Author: gbrunmar
Date: Thu May 15 14:07:46 2008
New Revision: 33532
URL:
http://svn.reactos.org/svn/reactos?rev=33532&view=rev
Log:
Patch by Kamil Hornicek ( tykef AT atlas DOT cz ):
* Fixed DialogBoxParam to set correct error values and returning correct error codes
Modified:
trunk/reactos/dll/win32/user32/windows/dialog.c
Modified: trunk/reactos/dll/win32/user32/windows/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Thu May 15 14:07:46 2008
@@ -1678,8 +1678,17 @@
HRSRC hrsrc;
LPCDLGTEMPLATE ptr;
- if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG ))) return
0;
- if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
+ if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG )) ||
+ !(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc)))
+ {
+ SetLastError(ERROR_RESOURCE_NAME_NOT_FOUND);
+ return -1;
+ }
+ if (!IsWindow(hWndParent))
+ {
+ SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+ return 0;
+ }
hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam,
FALSE, TRUE);
if (hwnd) return DIALOG_DoDialogBox(hwnd, hWndParent);
return -1;
@@ -1702,8 +1711,17 @@
HRSRC hrsrc;
LPCDLGTEMPLATE ptr;
- if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG ))) return
0;
- if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
+ if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG )) ||
+ !(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc)))
+ {
+ SetLastError(ERROR_RESOURCE_NAME_NOT_FOUND);
+ return -1;
+ }
+ if (!IsWindow(hWndParent))
+ {
+ SetLastError(ERROR_INVALID_WINDOW_HANDLE);
+ return 0;
+ }
hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam,
TRUE, TRUE);
if (hwnd) return DIALOG_DoDialogBox(hwnd, hWndParent);
return -1;