Synchronize with trunk's revision r57652.
[reactos.git] / dll / win32 / comdlg32 / comdlg32_ros.diff
1 Index: filedlg.c
2 ===================================================================
3 --- filedlg.c (Revision 56893)
4 +++ filedlg.c (Arbeitskopie)
5 @@ -260,6 +260,8 @@
6 HRSRC hRes;
7 HANDLE hDlgTmpl = 0;
8 HRESULT hr;
9 + DWORD dwSize;
10 + LPDLGTEMPLATE hDialogTemplate;
11
12 /* test for missing functionality */
13 if (fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS)
14 @@ -276,12 +278,17 @@
15 return FALSE;
16 }
17 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) ||
18 + !(dwSize = SizeofResource(COMDLG32_hInstance, hRes )) ||
19 + !(hDialogTemplate = malloc(dwSize)) ||
20 !(template = LockResource( hDlgTmpl )))
21 {
22 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
23 return FALSE;
24 }
25
26 + /* Copy the read only resource */
27 + memcpy(hDialogTemplate, template, dwSize);
28 +
29 /* msdn: explorer style dialogs permit sizing by default.
30 * The OFN_ENABLESIZING flag is only needed when a hook or
31 * custom tmeplate is provided */
32 @@ -291,12 +298,12 @@
33
34 if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
35 {
36 - ((LPDLGTEMPLATEW)template)->style |= WS_SIZEBOX;
37 + hDialogTemplate->style |= WS_SIZEBOX;
38 fodInfos->sizedlg.cx = fodInfos->sizedlg.cy = 0;
39 fodInfos->initial_size.x = fodInfos->initial_size.y = 0;
40 }
41 else
42 - ((LPDLGTEMPLATEW)template)->style &= ~WS_SIZEBOX;
43 + hDialogTemplate->style &= ~WS_SIZEBOX;
44
45
46 /* old style hook messages */
47 @@ -313,19 +320,21 @@
48
49 if (fodInfos->unicode)
50 lRes = DialogBoxIndirectParamW(COMDLG32_hInstance,
51 - template,
52 + hDialogTemplate,
53 fodInfos->ofnInfos->hwndOwner,
54 FileOpenDlgProc95,
55 (LPARAM) fodInfos);
56 else
57 lRes = DialogBoxIndirectParamA(COMDLG32_hInstance,
58 - template,
59 + hDialogTemplate,
60 fodInfos->ofnInfos->hwndOwner,
61 FileOpenDlgProc95,
62 (LPARAM) fodInfos);
63 - if (SUCCEEDED(hr))
64 + if (SUCCEEDED(hr))
65 OleUninitialize();
66
67 + free(hDialogTemplate);
68 +
69 /* Unable to create the dialog */
70 if( lRes == -1)
71 return FALSE;