Care for write protected resource in propsheet

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sat Sep 28 17:16:00 CDT 2002


As we discussed beginning of August, our propsheet implementation
misbehaves when it has to deal with write protected in-memory resources.

Changelog:
	dlls/comctrl32/propsheet.c:
	Hack around write protected in-memory resources
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/comctl32/propsheet.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.69
diff -u -r1.69 propsheet.c
--- wine/dlls/comctl32/propsheet.c	6 Sep 2002 19:41:17 -0000	1.69
+++ wine/dlls/comctl32/propsheet.c	28 Sep 2002 22:08:56 -0000
@@ -2326,6 +2326,14 @@
   {
       PROPSHEET_AtoW(&ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate);
   }
+  /* Hack to care for write proteced resources */
+  if (ppsp->dwFlags & PSP_DLGINDIRECT)
+    {
+      /* The DLG_TEMPLATE in windoes/dialog.c has about 60 bytes and is quite
+	 similar, so 100 should be right*/
+      ppsp->u.pResource=(LPDLGTEMPLATEA)HeapAlloc(GetProcessHeap(), 0, 100);
+      memcpy((void*)ppsp->u.pResource, lpPropSheetPage->u.pResource, 100);
+    }
   if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
   {
       PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon);
@@ -2357,6 +2365,14 @@
     ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,(len+1)*sizeof (WCHAR) );
     strcpyW( (WCHAR *)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
   }
+  /* Hack to care for write proteced resources */
+  if (ppsp->dwFlags & PSP_DLGINDIRECT)
+    {
+      /* The DLG_TEMPLATE in windoes/dialog.c has about 60 bytes and is quite
+	 similar, so 100 should be right*/
+      ppsp->u.pResource=(LPDLGTEMPLATEW)HeapAlloc(GetProcessHeap(), 0, 100);
+      memcpy((void*)ppsp->u.pResource, lpPropSheetPage->u.pResource, 100);
+    }
   if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
   {
       int len = strlenW(lpPropSheetPage->u2.pszIcon);
@@ -2388,6 +2404,9 @@
 
   if ( !(psp->dwFlags & PSP_DLGINDIRECT) && HIWORD( psp->u.pszTemplate ) )
      HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u.pszTemplate);
+
+  if (psp->dwFlags & PSP_DLGINDIRECT)
+    HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u.pResource);
 
   if ( (psp->dwFlags & PSP_USEICONID) && HIWORD( psp->u2.pszIcon ) )
      HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u2.pszIcon);



More information about the wine-patches mailing list