Skip to content

Commit 3e90b33

Browse files
[COMDLG32] Sync to Wine-10.0
1 parent 23043ce commit 3e90b33

61 files changed

Lines changed: 2394 additions & 2090 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dll/win32/comdlg32/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS)
23
add_definitions(
34
-D_WINE)
45

@@ -15,7 +16,7 @@ list(APPEND SOURCE
1516
fontdlg.c
1617
#itemdlg.c /* Win 7 */
1718
printdlg.c
18-
precomp.h
19+
#precomp.h
1920
${CMAKE_CURRENT_BINARY_DIR}/comdlg32_stubs.c)
2021

2122
add_library(comdlg32 MODULE
@@ -24,9 +25,10 @@ add_library(comdlg32 MODULE
2425
${CMAKE_CURRENT_BINARY_DIR}/comdlg32.def)
2526

2627
set_module_type(comdlg32 win32dll)
27-
target_link_libraries(comdlg32 uuid wine oldnames)
28+
#add_idl_reg_scripts(comdlg32 registry comdlg32_classes.idl) # Win 7
29+
target_link_libraries(comdlg32 uuid wine wine_dll_register wine_dll_canunload oldnames)
2830
add_delay_importlibs(comdlg32 ole32)
2931
add_importlibs(comdlg32 shell32 shlwapi comctl32 winspool user32 gdi32 advapi32 msvcrt kernel32 ntdll)
30-
add_pch(comdlg32 precomp.h SOURCE)
32+
# add_pch(comdlg32 precomp.h SOURCE) # TODO: see autocomp.cpp
3133
add_cd_file(TARGET comdlg32 DESTINATION reactos/system32 FOR all)
3234
set_wine_module_FIXME(comdlg32) # CORE-5743: No ARRAY_SIZE and CONST_VTABLE

dll/win32/comdlg32/autocomp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* PURPOSE: Implement auto-completion for comdlg32
55
* COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
66
*/
7+
/* TODO: Fix sdk\include\crt\stdio.h(977): error C2733: 'vswprintf': you cannot overload a function with 'extern "C"' linkage */
8+
#define _CRT_NON_CONFORMING_SWPRINTFS 1
79
#include "precomp.h"
810

911
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);

dll/win32/comdlg32/cdlg.h

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
/* Common dialogs implementation globals */
2727
#define COMDLG32_Atom MAKEINTATOM(0xa000) /* MS uses this one to identify props */
2828

29-
extern HINSTANCE COMDLG32_hInstance DECLSPEC_HIDDEN;
29+
extern HINSTANCE COMDLG32_hInstance;
3030
#ifdef __REACTOS__
3131
extern CRITICAL_SECTION COMDLG32_OpenFileLock DECLSPEC_HIDDEN;
3232
#endif
33+
extern HANDLE COMDLG32_hActCtx;
3334

34-
void COMDLG32_SetCommDlgExtendedError(DWORD err) DECLSPEC_HIDDEN;
35-
LPVOID COMDLG32_AllocMem(int size) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
35+
void COMDLG32_SetCommDlgExtendedError(DWORD err);
36+
LPVOID COMDLG32_AllocMem(int size) __WINE_ALLOC_SIZE(1);
3637

3738
/* Find/Replace local definitions */
3839

@@ -151,28 +152,6 @@ typedef struct {
151152
#define IDS_COLOR_AQUA 1054
152153
#define IDS_COLOR_WHITE 1055
153154

154-
/* Color dialog controls */
155-
#define IDC_COLOR_LUMBAR 702
156-
#define IDC_COLOR_EDIT_H 703
157-
#define IDC_COLOR_EDIT_S 704
158-
#define IDC_COLOR_EDIT_L 705
159-
#define IDC_COLOR_EDIT_R 706
160-
#define IDC_COLOR_EDIT_G 707
161-
#define IDC_COLOR_EDIT_B 708
162-
#define IDC_COLOR_RESULT 709
163-
#define IDC_COLOR_GRAPH 710
164-
#define IDC_COLOR_ADD 712
165-
#define IDC_COLOR_RES 713
166-
#define IDC_COLOR_DEFINE 719
167-
#define IDC_COLOR_PREDEF 720
168-
#define IDC_COLOR_USRDEF 721
169-
#define IDC_COLOR_HL 723
170-
#define IDC_COLOR_SL 724
171-
#define IDC_COLOR_LL 725
172-
#define IDC_COLOR_RL 726
173-
#define IDC_COLOR_GL 727
174-
#define IDC_COLOR_BL 728
175-
176155
#define IDS_FONT_SIZE 1200
177156
#define IDS_SAVE_BUTTON 1201
178157
#define IDS_SAVE_IN 1202
@@ -194,27 +173,24 @@ typedef struct {
194173
#include "shellapi.h"
195174

196175
/* Constructors */
197-
HRESULT FileOpenDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) DECLSPEC_HIDDEN;
198-
HRESULT FileSaveDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) DECLSPEC_HIDDEN;
176+
HRESULT FileOpenDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv);
177+
HRESULT FileSaveDialog_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv);
199178

200179
/* Shared helper functions */
201-
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile) DECLSPEC_HIDDEN;
180+
void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent, LPWSTR lpstrFile, LPWSTR lpstrPathAndFile);
202181
#ifdef __REACTOS__
203182
struct FileOpenDlgInfos;
204183
int FILEDLG95_ValidatePathAction(struct FileOpenDlgInfos *fodInfos, LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
205-
HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction) DECLSPEC_HIDDEN;
184+
HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction);
206185
#else
207186
int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
208-
HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction) DECLSPEC_HIDDEN;
187+
HWND hwnd, DWORD flags, BOOL isSaveDlg, int defAction);
209188
#endif
210-
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed) DECLSPEC_HIDDEN;
211-
void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText) DECLSPEC_HIDDEN;
212-
213-
extern BOOL GetFileName31A( OPENFILENAMEA *lpofn, UINT dlgType ) DECLSPEC_HIDDEN;
214-
extern BOOL GetFileName31W( OPENFILENAMEW *lpofn, UINT dlgType ) DECLSPEC_HIDDEN;
189+
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed);
190+
void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText);
215191

216-
/* SHELL */
217-
extern LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID);
192+
extern BOOL GetFileName31A( OPENFILENAMEA *lpofn, UINT dlgType );
193+
extern BOOL GetFileName31W( OPENFILENAMEW *lpofn, UINT dlgType );
218194

219195
#define ONOPEN_BROWSE 1
220196
#define ONOPEN_OPEN 2

dll/win32/comdlg32/cdlg32.c

Lines changed: 19 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
3939
#include "cdlg.h"
4040

4141

42-
DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance = 0;
42+
HINSTANCE COMDLG32_hInstance = 0;
4343
#ifdef __REACTOS__
44-
CRITICAL_SECTION COMDLG32_OpenFileLock DECLSPEC_HIDDEN;
44+
CRITICAL_SECTION COMDLG32_OpenFileLock;
4545
#endif
46+
HANDLE COMDLG32_hActCtx = INVALID_HANDLE_VALUE;
4647

4748
static DWORD COMDLG32_TlsIndex = TLS_OUT_OF_INDEXES;
4849

49-
static HINSTANCE SHELL32_hInstance;
50-
51-
/* SHELL */
52-
LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID) DECLSPEC_HIDDEN;
53-
5450
/***********************************************************************
5551
* DllMain (COMDLG32.init)
5652
*
@@ -60,39 +56,39 @@ LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID) DECLSPEC_HIDDE
6056
* FALSE if sibling could not be loaded or instantiated twice, TRUE
6157
* otherwise.
6258
*/
63-
static const char GPA_string[] = "Failed to get entry point %s for hinst = %p\n";
64-
#define GPA(dest, hinst, name) \
65-
if(!(dest = (void*)GetProcAddress(hinst,name)))\
66-
{ \
67-
ERR(GPA_string, debugstr_a(name), hinst); \
68-
return FALSE; \
69-
}
70-
7159
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
7260
{
73-
TRACE("(%p, %d, %p)\n", hInstance, Reason, Reserved);
61+
TRACE("(%p, %ld, %p)\n", hInstance, Reason, Reserved);
7462

7563
switch(Reason)
7664
{
7765
case DLL_PROCESS_ATTACH:
66+
{
67+
ACTCTXW actctx = {0};
68+
7869
COMDLG32_hInstance = hInstance;
7970
DisableThreadLibraryCalls(hInstance);
8071

81-
SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL");
8272
#ifdef __REACTOS__
8373
InitializeCriticalSection(&COMDLG32_OpenFileLock);
8474
#endif
75+
actctx.cbSize = sizeof(actctx);
76+
actctx.hModule = COMDLG32_hInstance;
77+
actctx.lpResourceName = MAKEINTRESOURCEW(123);
78+
actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
79+
COMDLG32_hActCtx = CreateActCtxW(&actctx);
80+
if (COMDLG32_hActCtx == INVALID_HANDLE_VALUE)
81+
ERR("failed to create activation context, last error %lu\n", GetLastError());
8582

86-
/* SHELL */
87-
GPA(COMDLG32_SHSimpleIDListFromPathAW, SHELL32_hInstance, (LPCSTR)162);
8883
break;
89-
84+
}
9085
case DLL_PROCESS_DETACH:
9186
if (Reserved) break;
9287
if (COMDLG32_TlsIndex != TLS_OUT_OF_INDEXES) TlsFree(COMDLG32_TlsIndex);
9388
#ifdef __REACTOS__
9489
DeleteCriticalSection(&COMDLG32_OpenFileLock);
9590
#endif
91+
if (COMDLG32_hActCtx != INVALID_HANDLE_VALUE) ReleaseActCtx(COMDLG32_hActCtx);
9692
break;
9793
}
9894
return TRUE;
@@ -127,7 +123,7 @@ void *COMDLG32_AllocMem(int size)
127123
*/
128124
void COMDLG32_SetCommDlgExtendedError(DWORD err)
129125
{
130-
TRACE("(%08x)\n", err);
126+
TRACE("(%08lx)\n", err);
131127
if (COMDLG32_TlsIndex == TLS_OUT_OF_INDEXES)
132128
COMDLG32_TlsIndex = TlsAlloc();
133129
if (COMDLG32_TlsIndex != TLS_OUT_OF_INDEXES)
@@ -153,8 +149,6 @@ DWORD WINAPI CommDlgExtendedError(void)
153149
return 0; /* we never set an error, so there isn't one */
154150
}
155151

156-
#ifndef __REACTOS__ /* Win 7 */
157-
158152
/*************************************************************************
159153
* Implement the CommDlg32 class factory
160154
*
@@ -245,6 +239,7 @@ static const IClassFactoryVtbl CDLGCF_Vtbl =
245239
*/
246240
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
247241
{
242+
#ifndef __REACTOS__ /* TODO: SHCreateItemFromIDList */
248243
static IClassFactoryImpl FileOpenDlgClassFactory = {{&CDLGCF_Vtbl}, FileOpenDialog_Constructor};
249244
static IClassFactoryImpl FileSaveDlgClassFactory = {{&CDLGCF_Vtbl}, FileSaveDialog_Constructor};
250245

@@ -255,32 +250,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
255250

256251
if(IsEqualGUID(&CLSID_FileSaveDialog, rclsid))
257252
return IClassFactory_QueryInterface(&FileSaveDlgClassFactory.IClassFactory_iface, riid, ppv);
258-
259-
return CLASS_E_CLASSNOTAVAILABLE;
260-
}
261-
262-
/***********************************************************************
263-
* DllRegisterServer (COMMDLG32.@)
264-
*/
265-
HRESULT WINAPI DllRegisterServer(void)
266-
{
267-
#ifdef __REACTOS__
268-
return E_FAIL; // FIXME: __wine_register_resources(COMDLG32_hInstance);
269-
#else
270-
return __wine_register_resources(COMDLG32_hInstance);
271253
#endif
272-
}
273254

274-
/***********************************************************************
275-
* DllUnregisterServer (COMMDLG32.@)
276-
*/
277-
HRESULT WINAPI DllUnregisterServer(void)
278-
{
279-
#ifdef __REACTOS__
280-
return E_FAIL; // FIXME: __wine_unregister_resources(COMDLG32_hInstance);
281-
#else
282-
return __wine_unregister_resources(COMDLG32_hInstance);
283-
#endif
255+
return CLASS_E_CLASSNOTAVAILABLE;
284256
}
285-
286-
#endif /* Win 7 */

dll/win32/comdlg32/cdlg_xx.rc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
2323

2424
#define WINE_FILEDESCRIPTION_STR "Common Dialog Boxes"
2525
#define WINE_FILENAME_STR "comdlg32.dll"
26-
#define WINE_FILEVERSION 4,0,0,950 /* Maybe 4.1.0.980 for win98?? */
27-
#define WINE_FILEVERSION_STR "4.0"
26+
#define WINE_FILEVERSION 6,0,2900,5512
27+
#define WINE_FILEVERSION_STR "6.00.2900.5512"
28+
#define WINE_PRODUCTVERSION 6,0,2900,5512
29+
#define WINE_PRODUCTVERSION_STR "6.00.2900.5512"
2830

2931
#include <wine/wine_common_ver.rc>
3032

0 commit comments

Comments
 (0)