PATCH: Creating a property sheet dialog causes assertion in debug MFC

Adam Gundy arg at cyberscience.com
Wed Mar 5 08:34:02 CST 2003


Hi. PROPSHEET_CreateDialog wasn't returning the right (documented) values.
This caused the debug MFC library to assert.

Cyberscience disclaims all copyright and responsibility... ;-)

Changelog:

        * dlls/comctl32/propsheet.c: Adam Gundy <arg at cyberscience.com>
        PROPSHEET_CreateDialog() is documented to return -1 on failure,
        and the dialog handle on success. Prevents assertion in debug
        MFC library.

diff -u -r wine-20030219/dlls/comctl32/propsheet.c wine-20030219-new/dlls/comctl32/propsheet.c
--- wine-20030219/dlls/comctl32/propsheet.c     Fri Jan 24 00:54:59 2003
+++ wine-20030219-new/dlls/comctl32/propsheet.c Mon Feb 24 17:23:13 2003
@@ -118,7 +118,7 @@
 /******************************************************************************
  * Prototypes
  */
-static BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo);
+static int PROPSHEET_CreateDialog(PropSheetInfo* psInfo);
 static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, PropSheetInfo* psInfo);
 static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo);
 static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo);
@@ -552,7 +552,7 @@
  *
  * Creates the actual property sheet.
  */
-BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
+int PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
 {
   LRESULT ret;
   LPCVOID template;
@@ -568,10 +568,10 @@
   if(!(hRes = FindResourceW(COMCTL32_hModule,
                             MAKEINTRESOURCEW(resID),
                             RT_DIALOGW)))
-    return FALSE;
+    return -1;
 
   if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes)))
-    return FALSE;
+    return -1;
 
   /*
    * Make a copy of the dialog template.
@@ -581,7 +581,7 @@
   temp = COMCTL32_Alloc(resSize);
 
   if (!temp)
-    return FALSE;
+    return -1;
 
   memcpy(temp, template, resSize);
 
@@ -595,11 +595,14 @@
                                     PROPSHEET_DialogProc,
                                     (LPARAM)psInfo);
   else
+  {
       ret = CreateDialogIndirectParamW(psInfo->ppshheader.hInstance,
                                        (LPDLGTEMPLATEW) temp,
                                        psInfo->ppshheader.hwndParent,
                                        PROPSHEET_DialogProc,
-                                       (LPARAM)psInfo) ? TRUE : FALSE;
+                                       (LPARAM)psInfo);
+      if ( !ret ) ret = -1;
+  }
 
   COMCTL32_Free(temp);
 


Seeya,
 Adam
--
Real Programmers don't comment their code. If it was hard to write,
it should be hard to read, and even harder to modify.
These are all my own opinions.




More information about the wine-patches mailing list