From: Piotr Caban piotr@codeweavers.com
--- dlls/comctl32/propsheet.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index b0a011b2c55..601b1982ef8 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -106,7 +106,6 @@ typedef struct tagPropPageInfo BOOL isDirty; LPCWSTR pszText; BOOL hasHelp; - BOOL useCallback; BOOL hasIcon; } PropPageInfo;
@@ -199,6 +198,15 @@ static WCHAR *heap_strdupAtoW(const char *str) return ret; }
+static void HPSP_call_callback(HPROPSHEETPAGE hpsp, UINT msg) +{ + if (!(hpsp->psp.dwFlags & PSP_USECALLBACK) || !hpsp->psp.pfnCallback || + (msg == PSPCB_ADDREF && hpsp->psp.dwSize <= PROPSHEETPAGEA_V1_SIZE)) + return; + + hpsp->psp.pfnCallback(0, msg, &hpsp->callback_psp); +} + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -419,7 +427,6 @@ static BOOL PROPSHEET_CollectPageInfo(HPROPSHEETPAGE hpsp, * Process property page flags. */ dwFlags = hpsp->psp.dwFlags; - psInfo->proppage[index].useCallback = (dwFlags & PSP_USECALLBACK) && (hpsp->psp.pfnCallback); psInfo->proppage[index].hasHelp = dwFlags & PSP_HASHELP; psInfo->proppage[index].hasIcon = dwFlags & (PSP_USEHICON | PSP_USEICONID);
@@ -1436,8 +1443,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, pTemplateCopy->dwExtendedStyle |= WS_EX_CONTROLPARENT; }
- if (psInfo->proppage[index].useCallback) - (*(hpsp->psp.pfnCallback))(0, PSPCB_CREATE, &hpsp->psp); + HPSP_call_callback(hpsp, PSPCB_CREATE);
if(hpsp->psp.dwFlags & PSP_INTERNAL_UNICODE) hwndPage = CreateDialogIndirectParamW(hpsp->psp.hInstance, @@ -3013,9 +3019,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( else ppsp->pszHeaderSubTitle = NULL;
- if ((ppsp->dwFlags & PSP_USECALLBACK) && ppsp->dwSize > PROPSHEETPAGEA_V1_SIZE && ppsp->pfnCallback) - ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp + 1); - + HPSP_call_callback(ret, PSPCB_ADDREF); return ret; }
@@ -3074,9 +3078,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage else ppsp->pszHeaderSubTitle = NULL;
- if ((ppsp->dwFlags & PSP_USECALLBACK) && ppsp->dwSize > PROPSHEETPAGEW_V1_SIZE && ppsp->pfnCallback) - ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp + 1); - + HPSP_call_callback(ret, PSPCB_ADDREF); return ret; }
@@ -3098,8 +3100,7 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) if (!hPropPage) return FALSE;
- if ((psp->dwFlags & PSP_USECALLBACK) && psp->pfnCallback) - psp->pfnCallback(0, PSPCB_RELEASE, &hPropPage->callback_psp); + HPSP_call_callback(hPropPage, PSPCB_RELEASE);
if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE( psp->u.pszTemplate )) Free((void*)psp->u.pszTemplate);
From: Piotr Caban piotr@codeweavers.com
--- dlls/comctl32/propsheet.c | 54 +++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 601b1982ef8..4b9d6b1d1c4 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -198,6 +198,12 @@ static WCHAR *heap_strdupAtoW(const char *str) return ret; }
+static DWORD HPSP_get_flags(HPROPSHEETPAGE hpsp) +{ + if (!hpsp) return 0; + return hpsp->psp.dwFlags; +} + static void HPSP_call_callback(HPROPSHEETPAGE hpsp, UINT msg) { if (!(hpsp->psp.dwFlags & PSP_USECALLBACK) || !hpsp->psp.pfnCallback || @@ -248,7 +254,7 @@ static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg,
if (((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && (psInfo->ppshheader.dwFlags & PSH_HEADER) && - !(hpsp->psp.dwFlags & PSP_HIDEHEADER)) || + !(HPSP_get_flags(hpsp) & PSP_HIDEHEADER)) || (psInfo->ppshheader.dwFlags & PSH_WIZARD)) { rc->left = rc->top = WIZARD_PADDING; @@ -263,7 +269,7 @@ static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg,
if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && (psInfo->ppshheader.dwFlags & PSH_HEADER) && - !(hpsp->psp.dwFlags & PSP_HIDEHEADER)) + !(HPSP_get_flags(hpsp) & PSP_HIDEHEADER)) { hwndChild = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); GetClientRect(hwndChild, &r); @@ -426,7 +432,7 @@ static BOOL PROPSHEET_CollectPageInfo(HPROPSHEETPAGE hpsp, /* * Process property page flags. */ - dwFlags = hpsp->psp.dwFlags; + dwFlags = HPSP_get_flags(hpsp); psInfo->proppage[index].hasHelp = dwFlags & PSP_HASHELP; psInfo->proppage[index].hasIcon = dwFlags & (PSP_USEHICON | PSP_USEICONID);
@@ -490,7 +496,7 @@ static BOOL PROPSHEET_CollectPageInfo(HPROPSHEETPAGE hpsp, width = (WORD)*p; p++; height = (WORD)*p; p++;
- if (hpsp->psp.dwFlags & (PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE)) + if (HPSP_get_flags(hpsp) & (PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE)) psInfo->ppshheader.dwFlags |= PSH_HEADER;
/* Special calculation for interior wizard pages so the largest page is @@ -1360,12 +1366,12 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, return FALSE; }
- if (hpsp->psp.dwFlags & PSP_DLGINDIRECT) + if (HPSP_get_flags(hpsp) & PSP_DLGINDIRECT) { pTemplate = hpsp->psp.u.pResource; resSize = GetTemplateSize(pTemplate); } - else if(hpsp->psp.dwFlags & PSP_INTERNAL_UNICODE) + else if(HPSP_get_flags(hpsp) & PSP_INTERNAL_UNICODE) { HRSRC hResource; HANDLE hTemplate; @@ -1445,7 +1451,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent,
HPSP_call_callback(hpsp, PSPCB_CREATE);
- if(hpsp->psp.dwFlags & PSP_INTERNAL_UNICODE) + if(HPSP_get_flags(hpsp) & PSP_INTERNAL_UNICODE) hwndPage = CreateDialogIndirectParamW(hpsp->psp.hInstance, pTemplateCopy, hwndParent, @@ -1468,7 +1474,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, /* Subclass exterior wizard pages */ if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && - (hpsp->psp.dwFlags & PSP_HIDEHEADER)) + (HPSP_get_flags(hpsp) & PSP_HIDEHEADER)) { SetWindowSubclass(hwndPage, PROPSHEET_WizardSubclassProc, 1, 0); } @@ -1559,7 +1565,7 @@ static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo) { hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER);
- if ((psInfo->proppage[index].hpage->psp.dwFlags & PSP_HIDEHEADER) || + if ((HPSP_get_flags(psInfo->proppage[index].hpage) & PSP_HIDEHEADER) || (!(psInfo->ppshheader.dwFlags & PSH_HEADER)) ) ShowWindow(hwndLineHeader, SW_HIDE); else @@ -2291,7 +2297,7 @@ static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter,
psInfo->proppage[index].hpage = hpage;
- if (hpage->psp.dwFlags & PSP_PREMATURE) + if (HPSP_get_flags(hpage) & PSP_PREMATURE) { /* Create the page but don't show it */ if (!PROPSHEET_CreatePage(hwndDlg, index, psInfo, hpage)) @@ -2404,7 +2410,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, /* Unsubclass the page dialog window */ if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && - (psInfo->proppage[index].hpage->psp.dwFlags & PSP_HIDEHEADER)) + (HPSP_get_flags(psInfo->proppage[index].hpage) & PSP_HIDEHEADER)) { RemoveWindowSubclass(psInfo->proppage[index].hwndPage, PROPSHEET_WizardSubclassProc, 1); @@ -2416,7 +2422,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, /* Free page resources */ if(psInfo->proppage[index].hpage) { - if (psInfo->proppage[index].hpage->psp.dwFlags & PSP_USETITLE) + if (HPSP_get_flags(psInfo->proppage[index].hpage) & PSP_USETITLE) Free ((LPVOID)psInfo->proppage[index].pszText);
DestroyPropertySheetPage(psInfo->proppage[index].hpage); @@ -2712,12 +2718,12 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
for (i = 0; i < psInfo->nPages; i++) { - PROPSHEETPAGEW* psp = &psInfo->proppage[i].hpage->psp; + DWORD flags = HPSP_get_flags(psInfo->proppage[i].hpage);
/* Unsubclass the page dialog window */ if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && - (psp->dwFlags & PSP_HIDEHEADER)) + (flags & PSP_HIDEHEADER)) { RemoveWindowSubclass(psInfo->proppage[i].hwndPage, PROPSHEET_WizardSubclassProc, 1); @@ -2726,13 +2732,10 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) if(psInfo->proppage[i].hwndPage) DestroyWindow(psInfo->proppage[i].hwndPage);
- if(psp) - { - if (psp->dwFlags & PSP_USETITLE) - Free ((LPVOID)psInfo->proppage[i].pszText); + if (flags & PSP_USETITLE) + Free ((LPVOID)psInfo->proppage[i].pszText);
- DestroyPropertySheetPage(psInfo->proppage[i].hpage); - } + DestroyPropertySheetPage(psInfo->proppage[i].hpage); }
DeleteObject(psInfo->hFont); @@ -3251,7 +3254,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) int offsety = 0; HBRUSH hbr; RECT r, rzone; - LPCPROPSHEETPAGEW ppshpage; + HPROPSHEETPAGE hpsp; WCHAR szBuffer[256]; int nLength;
@@ -3264,15 +3267,16 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) hOldPal = SelectPalette(hdc, psInfo->ppshheader.hplWatermark, FALSE);
if (psInfo->active_page < 0) - ppshpage = NULL; + hpsp = NULL; else - ppshpage = &psInfo->proppage[psInfo->active_page].hpage->psp; + hpsp = psInfo->proppage[psInfo->active_page].hpage;
- if ( (ppshpage && !(ppshpage->dwFlags & PSP_HIDEHEADER)) && + if ( hpsp && !(HPSP_get_flags(hpsp) & PSP_HIDEHEADER) && (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && (psInfo->ppshheader.dwFlags & PSH_HEADER) ) { HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER); + LPCPROPSHEETPAGEW ppshpage = &hpsp->psp; HFONT hOldFont; COLORREF clrOld = 0; int oldBkMode = 0; @@ -3378,7 +3382,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) SelectObject(hdc, hOldFont); }
- if ( (ppshpage && (ppshpage->dwFlags & PSP_HIDEHEADER)) && + if ( (HPSP_get_flags(hpsp) & PSP_HIDEHEADER) && (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && (psInfo->ppshheader.dwFlags & PSH_WATERMARK) ) {
From: Piotr Caban piotr@codeweavers.com
--- dlls/comctl32/propsheet.c | 369 +++++++++++++++++--------------------- 1 file changed, 166 insertions(+), 203 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 4b9d6b1d1c4..bcc9db04fac 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -198,6 +198,140 @@ static WCHAR *heap_strdupAtoW(const char *str) return ret; }
+/* + * Get the size of an in-memory Template + * + *( Based on the code of PROPSHEET_CollectPageInfo) + * See also dialog.c/DIALOG_ParseTemplate32(). + */ + +static UINT GetTemplateSize(const DLGTEMPLATE* pTemplate) + +{ + const WORD* p = (const WORD *)pTemplate; + BOOL istemplateex = (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF); + WORD nrofitems; + UINT ret; + + if (istemplateex) + { + /* DLGTEMPLATEEX (not defined in any std. header file) */ + + TRACE("is DLGTEMPLATEEX\n"); + p++; /* dlgVer */ + p++; /* signature */ + p += 2; /* help ID */ + p += 2; /* ext style */ + p += 2; /* style */ + } + else + { + /* DLGTEMPLATE */ + + TRACE("is DLGTEMPLATE\n"); + p += 2; /* style */ + p += 2; /* ext style */ + } + + nrofitems = (WORD)*p; p++; /* nb items */ + p++; /* x */ + p++; /* y */ + p++; /* width */ + p++; /* height */ + + /* menu */ + switch ((WORD)*p) + { + case 0x0000: + p++; + break; + case 0xffff: + p += 2; + break; + default: + TRACE("menu %s\n",debugstr_w( p )); + p += lstrlenW( p ) + 1; + break; + } + + /* class */ + switch ((WORD)*p) + { + case 0x0000: + p++; + break; + case 0xffff: + p += 2; /* 0xffff plus predefined window class ordinal value */ + break; + default: + TRACE("class %s\n",debugstr_w( p )); + p += lstrlenW( p ) + 1; + break; + } + + /* title */ + TRACE("title %s\n",debugstr_w( p )); + p += lstrlenW( p ) + 1; + + /* font, if DS_SETFONT set */ + if ((DS_SETFONT & ((istemplateex)? ((const MyDLGTEMPLATEEX*)pTemplate)->style : + pTemplate->style))) + { + p+=(istemplateex)?3:1; + TRACE("font %s\n",debugstr_w( p )); + p += lstrlenW( p ) + 1; /* the font name */ + } + + /* now process the DLGITEMTEMPLATE(EX) structs (plus custom data) + * that are following the DLGTEMPLATE(EX) data */ + TRACE("%d items\n",nrofitems); + while (nrofitems > 0) + { + p = (WORD*)(((DWORD_PTR)p + 3) & ~3); /* DWORD align */ + + /* skip header */ + p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE))/sizeof(WORD); + + /* check class */ + switch ((WORD)*p) + { + case 0x0000: + p++; + break; + case 0xffff: + TRACE("class ordinal %#lx\n",*(const DWORD*)p); + p += 2; + break; + default: + TRACE("class %s\n",debugstr_w( p )); + p += lstrlenW( p ) + 1; + break; + } + + /* check title text */ + switch ((WORD)*p) + { + case 0x0000: + p++; + break; + case 0xffff: + TRACE("text ordinal %#lx\n",*(const DWORD*)p); + p += 2; + break; + default: + TRACE("text %s\n",debugstr_w( p )); + p += lstrlenW( p ) + 1; + break; + } + p += *p / sizeof(WORD) + 1; /* Skip extra data */ + --nrofitems; + } + + ret = (p - (const WORD*)pTemplate) * sizeof(WORD); + TRACE("%p %p size 0x%08x\n", p, pTemplate, ret); + return ret; +} + static DWORD HPSP_get_flags(HPROPSHEETPAGE hpsp) { if (!hpsp) return 0; @@ -213,6 +347,36 @@ static void HPSP_call_callback(HPROPSHEETPAGE hpsp, UINT msg) hpsp->psp.pfnCallback(0, msg, &hpsp->callback_psp); }
+static const DLGTEMPLATE* HPSP_load_template(HPROPSHEETPAGE hpsp, DWORD *size) +{ + HGLOBAL template; + HRSRC res; + + if (hpsp->psp.dwFlags & PSP_DLGINDIRECT) + { + if (size) + *size = GetTemplateSize(hpsp->psp.u.pResource); + return hpsp->psp.u.pResource; + } + + if (hpsp->psp.dwFlags & PSP_INTERNAL_UNICODE) + { + res = FindResourceW(hpsp->psp.hInstance, hpsp->psp.u.pszTemplate, + (LPWSTR)RT_DIALOG); + } + else + { + res = FindResourceA(hpsp->psp.hInstance, + (LPCSTR)hpsp->psp.u.pszTemplate, (LPSTR)RT_DIALOG); + } + + if (size) + *size = SizeofResource(hpsp->psp.hInstance, res); + + template = LoadResource(hpsp->psp.hInstance, res); + return LockResource(template); +} + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -443,26 +607,7 @@ static BOOL PROPSHEET_CollectPageInfo(HPROPSHEETPAGE hpsp, /* * Process page template. */ - if (dwFlags & PSP_DLGINDIRECT) - pTemplate = hpsp->psp.u.pResource; - else if(dwFlags & PSP_INTERNAL_UNICODE ) - { - HRSRC hResource = FindResourceW(hpsp->psp.hInstance, - hpsp->psp.u.pszTemplate, - (LPWSTR)RT_DIALOG); - HGLOBAL hTemplate = LoadResource(hpsp->psp.hInstance, - hResource); - pTemplate = LockResource(hTemplate); - } - else - { - HRSRC hResource = FindResourceA(hpsp->psp.hInstance, - (LPCSTR)hpsp->psp.u.pszTemplate, - (LPSTR)RT_DIALOG); - HGLOBAL hTemplate = LoadResource(hpsp->psp.hInstance, - hResource); - pTemplate = LockResource(hTemplate); - } + pTemplate = HPSP_load_template(hpsp, NULL);
/* * Extract the size of the page and the caption. @@ -1210,140 +1355,6 @@ PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, return DefSubclassProc(hwnd, uMsg, wParam, lParam); }
-/* - * Get the size of an in-memory Template - * - *( Based on the code of PROPSHEET_CollectPageInfo) - * See also dialog.c/DIALOG_ParseTemplate32(). - */ - -static UINT GetTemplateSize(const DLGTEMPLATE* pTemplate) - -{ - const WORD* p = (const WORD *)pTemplate; - BOOL istemplateex = (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF); - WORD nrofitems; - UINT ret; - - if (istemplateex) - { - /* DLGTEMPLATEEX (not defined in any std. header file) */ - - TRACE("is DLGTEMPLATEEX\n"); - p++; /* dlgVer */ - p++; /* signature */ - p += 2; /* help ID */ - p += 2; /* ext style */ - p += 2; /* style */ - } - else - { - /* DLGTEMPLATE */ - - TRACE("is DLGTEMPLATE\n"); - p += 2; /* style */ - p += 2; /* ext style */ - } - - nrofitems = (WORD)*p; p++; /* nb items */ - p++; /* x */ - p++; /* y */ - p++; /* width */ - p++; /* height */ - - /* menu */ - switch ((WORD)*p) - { - case 0x0000: - p++; - break; - case 0xffff: - p += 2; - break; - default: - TRACE("menu %s\n",debugstr_w( p )); - p += lstrlenW( p ) + 1; - break; - } - - /* class */ - switch ((WORD)*p) - { - case 0x0000: - p++; - break; - case 0xffff: - p += 2; /* 0xffff plus predefined window class ordinal value */ - break; - default: - TRACE("class %s\n",debugstr_w( p )); - p += lstrlenW( p ) + 1; - break; - } - - /* title */ - TRACE("title %s\n",debugstr_w( p )); - p += lstrlenW( p ) + 1; - - /* font, if DS_SETFONT set */ - if ((DS_SETFONT & ((istemplateex)? ((const MyDLGTEMPLATEEX*)pTemplate)->style : - pTemplate->style))) - { - p+=(istemplateex)?3:1; - TRACE("font %s\n",debugstr_w( p )); - p += lstrlenW( p ) + 1; /* the font name */ - } - - /* now process the DLGITEMTEMPLATE(EX) structs (plus custom data) - * that are following the DLGTEMPLATE(EX) data */ - TRACE("%d items\n",nrofitems); - while (nrofitems > 0) - { - p = (WORD*)(((DWORD_PTR)p + 3) & ~3); /* DWORD align */ - - /* skip header */ - p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE))/sizeof(WORD); - - /* check class */ - switch ((WORD)*p) - { - case 0x0000: - p++; - break; - case 0xffff: - TRACE("class ordinal %#lx\n",*(const DWORD*)p); - p += 2; - break; - default: - TRACE("class %s\n",debugstr_w( p )); - p += lstrlenW( p ) + 1; - break; - } - - /* check title text */ - switch ((WORD)*p) - { - case 0x0000: - p++; - break; - case 0xffff: - TRACE("text ordinal %#lx\n",*(const DWORD*)p); - p += 2; - break; - default: - TRACE("text %s\n",debugstr_w( p )); - p += lstrlenW( p ) + 1; - break; - } - p += *p / sizeof(WORD) + 1; /* Skip extra data */ - --nrofitems; - } - - ret = (p - (const WORD*)pTemplate) * sizeof(WORD); - TRACE("%p %p size 0x%08x\n", p, pTemplate, ret); - return ret; -} - /****************************************************************************** * PROPSHEET_CreatePage * @@ -1366,55 +1377,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, return FALSE; }
- if (HPSP_get_flags(hpsp) & PSP_DLGINDIRECT) - { - pTemplate = hpsp->psp.u.pResource; - resSize = GetTemplateSize(pTemplate); - } - else if(HPSP_get_flags(hpsp) & PSP_INTERNAL_UNICODE) - { - HRSRC hResource; - HANDLE hTemplate; - - hResource = FindResourceW(hpsp->psp.hInstance, - hpsp->psp.u.pszTemplate, - (LPWSTR)RT_DIALOG); - if(!hResource) - return FALSE; - - resSize = SizeofResource(hpsp->psp.hInstance, hResource); - - hTemplate = LoadResource(hpsp->psp.hInstance, hResource); - if(!hTemplate) - return FALSE; - - pTemplate = LockResource(hTemplate); - /* - * Make a copy of the dialog template to make it writable - */ - } - else - { - HRSRC hResource; - HANDLE hTemplate; - - hResource = FindResourceA(hpsp->psp.hInstance, - (LPCSTR)hpsp->psp.u.pszTemplate, - (LPSTR)RT_DIALOG); - if(!hResource) - return FALSE; - - resSize = SizeofResource(hpsp->psp.hInstance, hResource); - - hTemplate = LoadResource(hpsp->psp.hInstance, hResource); - if(!hTemplate) - return FALSE; - - pTemplate = LockResource(hTemplate); - /* - * Make a copy of the dialog template to make it writable - */ - } + pTemplate = HPSP_load_template(hpsp, &resSize); pTemplateCopy = Alloc(resSize); if (!pTemplateCopy) return FALSE;
From: Piotr Caban piotr@codeweavers.com
--- dlls/comctl32/propsheet.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index bcc9db04fac..8a686673a62 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -377,6 +377,26 @@ static const DLGTEMPLATE* HPSP_load_template(HPROPSHEETPAGE hpsp, DWORD *size) return LockResource(template); }
+static WCHAR* HPSP_get_title(HPROPSHEETPAGE hpsp, const WCHAR *template_title) +{ + const WCHAR *pTitle; + WCHAR szTitle[256]; + + if (IS_INTRESOURCE(hpsp->psp.pszTitle)) + { + if (LoadStringW(hpsp->psp.hInstance, (DWORD_PTR)hpsp->psp.pszTitle, szTitle, ARRAY_SIZE(szTitle))) + pTitle = szTitle; + else if (*template_title) + pTitle = template_title; + else + pTitle = L"(null)"; + } + else + pTitle = hpsp->psp.pszTitle; + + return heap_strdupW(pTitle); +} + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -704,24 +724,7 @@ static BOOL PROPSHEET_CollectPageInfo(HPROPSHEETPAGE hpsp, TRACE("Tab %d %s\n",index,debugstr_w( p ));
if (dwFlags & PSP_USETITLE) - { - WCHAR szTitle[256]; - const WCHAR *pTitle; - - if (IS_INTRESOURCE( hpsp->psp.pszTitle )) - { - if (LoadStringW( hpsp->psp.hInstance, (DWORD_PTR)hpsp->psp.pszTitle, szTitle, ARRAY_SIZE(szTitle))) - pTitle = szTitle; - else if (*p) - pTitle = p; - else - pTitle = L"(null)"; - } - else - pTitle = hpsp->psp.pszTitle; - - psInfo->proppage[index].pszText = heap_strdupW( pTitle ); - } + psInfo->proppage[index].pszText = HPSP_get_title(hpsp, p);
/* * Build the image list for icons
From: Piotr Caban piotr@codeweavers.com
--- dlls/comctl32/propsheet.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 8a686673a62..c706c50f134 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -397,6 +397,25 @@ static WCHAR* HPSP_get_title(HPROPSHEETPAGE hpsp, const WCHAR *template_title) return heap_strdupW(pTitle); }
+static HICON HPSP_get_icon(HPROPSHEETPAGE hpsp) +{ + int cx = GetSystemMetrics(SM_CXSMICON); + int cy = GetSystemMetrics(SM_CYSMICON); + HICON ret; + + if (hpsp->psp.dwFlags & PSP_USEICONID) + { + ret = LoadImageW(hpsp->psp.hInstance, hpsp->psp.u2.pszIcon, IMAGE_ICON, + cx, cy, LR_DEFAULTCOLOR); + } + else + { + ret = hpsp->psp.u2.hIcon; + } + + return ret; +} + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -735,13 +754,7 @@ static BOOL PROPSHEET_CollectPageInfo(HPROPSHEETPAGE hpsp, int icon_cx = GetSystemMetrics(SM_CXSMICON); int icon_cy = GetSystemMetrics(SM_CYSMICON);
- if (dwFlags & PSP_USEICONID) - hIcon = LoadImageW(hpsp->psp.hInstance, hpsp->psp.u2.pszIcon, IMAGE_ICON, - icon_cx, icon_cy, LR_DEFAULTCOLOR); - else - hIcon = hpsp->psp.u2.hIcon; - - if ( hIcon ) + if ((hIcon = HPSP_get_icon(hpsp))) { if (psInfo->hImageList == 0 ) psInfo->hImageList = ImageList_Create(icon_cx, icon_cy, ILC_COLOR, 1, 1);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125031
Your paranoid android.
=== debian11 (32 bit report) ===
quartz: filtergraph.c:524: Test marked flaky: didn't get EOS filtergraph.c:529: Test marked flaky: expected 1243c8, got 0
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24739. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24739. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24739.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/propsheet.c:
return heap_strdupW(pTitle);
}
+static HICON HPSP_get_icon(HPROPSHEETPAGE hpsp) +{
- int cx = GetSystemMetrics(SM_CXSMICON);
- int cy = GetSystemMetrics(SM_CYSMICON);
- HICON ret;
- if (hpsp->psp.dwFlags & PSP_USEICONID)
Let's move getting cx and cy to this branch.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/propsheet.c:
return LockResource(template);
}
Typo in the subject. tile -> title.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/propsheet.c:
return ret;
}
+/*
- Get the size of an in-memory Template
- *( Based on the code of PROPSHEET_CollectPageInfo)
- See also dialog.c/DIALOG_ParseTemplate32().
- */
+static UINT GetTemplateSize(const DLGTEMPLATE* pTemplate)
I think this might be a good chance to fix the formatting of GetTemplateSize().