Patches to make MSVC 6 work

Mike McCormack mike at codeweavers.com
Thu Jul 3 15:23:34 CDT 2003


Hi All,

These two patches and the following registry key should get MSVC 6 to 
install with version = win98.

have fun,

Mike


[Software\\Microsoft\\Windows\\CurrentVersion]
"WindowsVersion"="Windows 98"
"VersionNumber"="4.10.1998"


ChangeLog:
* preserve A/W when creating propsheet dialogs
* nul parameters need to be quoted on the commandline

-------------- next part --------------
? ch.diff
? ch4.diff
? fd_fix.diff
? file_change.diff
? filedlg95.jpg
? np.diff
? np2.diff
? ntdll_slash.diff
? total-20030221.diff
? total-20030223.diff
? total-20030304.diff
? total-20030609.diff
? total-msvc.diff
? server/x3
Index: dlls/comctl32/propsheet.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.84
diff -u -r1.84 propsheet.c
--- dlls/comctl32/propsheet.c	18 Jun 2003 19:45:23 -0000	1.84
+++ dlls/comctl32/propsheet.c	3 Jul 2003 20:19:24 -0000
@@ -78,6 +78,7 @@
 {
   HWND hwnd;
   PROPSHEETHEADERW ppshheader;
+  BOOL unicode;
   LPWSTR strPropertiesFor;
   int nPages;
   int active_page;
@@ -109,6 +110,8 @@
 const WCHAR PropSheetInfoStr[] =
     {'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 };
 
+#define PSP_INTERNAL_UNICODE 0x80000000
+
 #define MAX_CAPTION_LENGTH 255
 #define MAX_TABTEXT_LENGTH 255
 #define MAX_BUTTONTEXT_LENGTH 64
@@ -412,7 +415,7 @@
    */
   if (dwFlags & PSP_DLGINDIRECT)
     pTemplate = (DLGTEMPLATE*)lppsp->u.pResource;
-  else
+  else if(dwFlags & PSP_INTERNAL_UNICODE )
   {
     HRSRC hResource = FindResourceW(lppsp->hInstance,
                                     lppsp->u.pszTemplate,
@@ -421,6 +424,15 @@
                                      hResource);
     pTemplate = (LPDLGTEMPLATEW)LockResource(hTemplate);
   }
+  else
+  {
+    HRSRC hResource = FindResourceA(lppsp->hInstance,
+                                    (LPSTR)lppsp->u.pszTemplate,
+                                    RT_DIALOGA);
+    HGLOBAL hTemplate = LoadResource(lppsp->hInstance,
+                                     hResource);
+    pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
+  }
 
   /*
    * Extract the size of the page and the caption.
@@ -565,10 +577,20 @@
   if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
     resID = IDD_WIZARD;
 
-  if(!(hRes = FindResourceW(COMCTL32_hModule,
+  if( psInfo->unicode )
+  {
+    if(!(hRes = FindResourceW(COMCTL32_hModule,
                             MAKEINTRESOURCEW(resID),
                             RT_DIALOGW)))
-    return -1;
+      return -1;
+  }
+  else
+  {
+    if(!(hRes = FindResourceA(COMCTL32_hModule,
+                            MAKEINTRESOURCEA(resID),
+                            RT_DIALOGA)))
+      return -1;
+  }
 
   if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes)))
     return -1;
@@ -588,20 +610,41 @@
   if (psInfo->useCallback)
     (*(psInfo->ppshheader.pfnCallback))(0, PSCB_PRECREATE, (LPARAM)temp);
 
-  if (!(psInfo->ppshheader.dwFlags & PSH_MODELESS))
+  if( psInfo->unicode )
+  {
+    if (!(psInfo->ppshheader.dwFlags & PSH_MODELESS))
       ret = DialogBoxIndirectParamW(psInfo->ppshheader.hInstance,
                                     (LPDLGTEMPLATEW) temp,
                                     psInfo->ppshheader.hwndParent,
                                     PROPSHEET_DialogProc,
                                     (LPARAM)psInfo);
-  else
-  {
+    else
+    {
       ret = (int)CreateDialogIndirectParamW(psInfo->ppshheader.hInstance,
                                             (LPDLGTEMPLATEW) temp,
                                             psInfo->ppshheader.hwndParent,
                                             PROPSHEET_DialogProc,
                                             (LPARAM)psInfo);
       if ( !ret ) ret = -1;
+    }
+  }
+  else
+  {
+    if (!(psInfo->ppshheader.dwFlags & PSH_MODELESS))
+      ret = DialogBoxIndirectParamA(psInfo->ppshheader.hInstance,
+                                    (LPDLGTEMPLATEA) temp,
+                                    psInfo->ppshheader.hwndParent,
+                                    PROPSHEET_DialogProc,
+                                    (LPARAM)psInfo);
+    else
+    {
+      ret = (int)CreateDialogIndirectParamA(psInfo->ppshheader.hInstance,
+                                            (LPDLGTEMPLATEA) temp,
+                                            psInfo->ppshheader.hwndParent,
+                                            PROPSHEET_DialogProc,
+                                            (LPARAM)psInfo);
+      if ( !ret ) ret = -1;
+    }
   }
 
   COMCTL32_Free(temp);
@@ -1342,7 +1385,7 @@
       pTemplate = (DLGTEMPLATE*)ppshpage->u.pResource;
       resSize = GetTemplateSize(pTemplate);
     }
-  else
+  else if(ppshpage->dwFlags & PSP_INTERNAL_UNICODE)
   {
     HRSRC hResource;
     HANDLE hTemplate;
@@ -1364,6 +1407,28 @@
      * Make a copy of the dialog template to make it writable
      */
   }
+  else
+  {
+    HRSRC hResource;
+    HANDLE hTemplate;
+
+    hResource = FindResourceA(ppshpage->hInstance,
+                                    (LPSTR)ppshpage->u.pszTemplate,
+                                    RT_DIALOGA);
+    if(!hResource)
+	return FALSE;
+
+    resSize = SizeofResource(ppshpage->hInstance, hResource);
+
+    hTemplate = LoadResource(ppshpage->hInstance, hResource);
+    if(!hTemplate)
+	return FALSE;
+
+    pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
+    /*
+     * Make a copy of the dialog template to make it writable
+     */
+  }
   temp = COMCTL32_Alloc(resSize);
   if (!temp)
     return FALSE;
@@ -1400,7 +1465,14 @@
                                PSPCB_CREATE,
                                (LPPROPSHEETPAGEW)ppshpage);
 
-  hwndPage = CreateDialogIndirectParamW(ppshpage->hInstance,
+  if(ppshpage->dwFlags & PSP_INTERNAL_UNICODE)
+     hwndPage = CreateDialogIndirectParamW(ppshpage->hInstance,
+					pTemplate,
+					hwndParent,
+					ppshpage->pfnDlgProc,
+					(LPARAM)ppshpage);
+  else
+     hwndPage = CreateDialogIndirectParamA(ppshpage->hInstance,
 					pTemplate,
 					hwndParent,
 					ppshpage->pfnDlgProc,
@@ -2421,6 +2493,7 @@
     }
   }
 
+  psInfo->unicode = FALSE;
   bRet = PROPSHEET_CreateDialog(psInfo);
 
   return bRet;
@@ -2465,6 +2538,7 @@
     }
   }
 
+  psInfo->unicode = TRUE;
   bRet = PROPSHEET_CreateDialog(psInfo);
 
   return bRet;
@@ -2481,9 +2555,13 @@
 
   memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA)));
 
+  ppsp->dwFlags &= ~ PSP_INTERNAL_UNICODE;
   if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) && HIWORD( ppsp->u.pszTemplate ) )
   {
-      PROPSHEET_AtoW(&ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate);
+     int len = strlen(lpPropSheetPage->u.pszTemplate);
+
+     ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,len+1 );
+     strcpy( (LPSTR)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
   }
   if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
   {
@@ -2508,6 +2586,8 @@
   PROPSHEETPAGEW* ppsp = COMCTL32_Alloc(sizeof(PROPSHEETPAGEW));
 
   memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEW)));
+
+  ppsp->dwFlags |= PSP_INTERNAL_UNICODE;
 
   if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) && HIWORD( ppsp->u.pszTemplate ) )
   {
-------------- next part --------------
Index: dlls/ntdll/env.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/env.c,v
retrieving revision 1.3
diff -u -r1.3 env.c
--- dlls/ntdll/env.c	18 Jun 2003 03:23:22 -0000	1.3
+++ dlls/ntdll/env.c	3 Jul 2003 20:19:25 -0000
@@ -538,6 +538,7 @@
         has_space=0;
         bcount=0;
         a=*arg;
+        if( !*a ) has_space=1;
         while (*a!='\0') {
             if (*a=='\\') {
                 bcount++;
@@ -573,6 +574,7 @@
         /* Check for quotes and spaces in this argument */
         has_space=has_quote=0;
         a=*arg;
+        if( !*a ) has_space=1;
         while (*a!='\0') {
             if (*a==' ' || *a=='\t') {
                 has_space=1;
Index: programs/wcmd/wcmdmain.c
===================================================================
RCS file: /home/wine/wine/programs/wcmd/wcmdmain.c,v
retrieving revision 1.28
diff -u -r1.28 wcmdmain.c
--- programs/wcmd/wcmdmain.c	11 May 2003 02:48:17 -0000	1.28
+++ programs/wcmd/wcmdmain.c	3 Jul 2003 20:19:25 -0000
@@ -97,6 +97,7 @@
           has_space=0;
           bcount=0;
           a=*arg;
+          if( !*a ) has_space=1;
           while (*a!='\0') {
               if (*a=='\\') {
                   bcount++;
@@ -131,6 +132,7 @@
           /* Check for quotes and spaces in this argument */
           has_space=has_quote=0;
           a=*arg;
+          if( !*a ) has_space=1;
           while (*a!='\0') {
               if (*a==' ' || *a=='\t') {
                   has_space=1;
Index: programs/winevdm/winevdm.c
===================================================================
RCS file: /home/wine/wine/programs/winevdm/winevdm.c,v
retrieving revision 1.2
diff -u -r1.2 winevdm.c
--- programs/winevdm/winevdm.c	2 May 2003 20:11:52 -0000	1.2
+++ programs/winevdm/winevdm.c	3 Jul 2003 20:19:25 -0000
@@ -48,6 +48,7 @@
         has_space=0;
         bcount=0;
         a=*arg;
+        if( !*a ) has_space=1;
         while (*a!='\0') {
             if (*a=='\\') {
                 bcount++;
@@ -82,6 +83,7 @@
         /* Check for quotes and spaces in this argument */
         has_space=has_quote=0;
         a=*arg;
+        if( !*a ) has_space=1;
         while (*a!='\0') {
             if (*a==' ' || *a=='\t') {
                 has_space=1;


More information about the wine-patches mailing list