-- v2: comctl32: Add helper for getting icon from HPROPSHEETPAGE. comctl32: Add helper for getting title from HPROPSHEETPAGE. comctl32: Add helper for loading dialog template from HPROPSHEETPAGE.
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 | 368 +++++++++++++++++--------------------- 1 file changed, 165 insertions(+), 203 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 4b9d6b1d1c4..fc67b5f0b68 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -198,6 +198,139 @@ 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 get_template_size(const DLGTEMPLATE *template) +{ + const WORD *p = (const WORD *)template; + BOOL istemplateex = ((const MyDLGTEMPLATEEX *)template)->signature == 0xFFFF; + WORD nitems; + 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 */ + } + + nitems = *p; + p++; /* nb items */ + p++; /* x */ + p++; /* y */ + p++; /* width */ + p++; /* height */ + + /* menu */ + switch (*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 (*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 *)template)->style : + template->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", nitems); + while (nitems > 0) + { + p = (WORD*)(((DWORD_PTR)p + 3) & ~3); /* DWORD align */ + + /* skip header */ + p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE)) + / sizeof(WORD); + + /* check class */ + switch (*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 (*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 */ + --nitems; + } + + ret = (p - (const WORD *)template) * sizeof(WORD); + TRACE("%p %p size 0x%08x\n", p, template, ret); + return ret; +} + static DWORD HPSP_get_flags(HPROPSHEETPAGE hpsp) { if (!hpsp) return 0; @@ -213,6 +346,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 = get_template_size(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 +606,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 +1354,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 +1376,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 fc67b5f0b68..2429e28cb0b 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -376,6 +376,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 @@ -703,24 +723,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 | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 2429e28cb0b..a6c1df11d63 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -396,6 +396,26 @@ static WCHAR* HPSP_get_title(HPROPSHEETPAGE hpsp, const WCHAR *template_title) return heap_strdupW(pTitle); }
+static HICON HPSP_get_icon(HPROPSHEETPAGE hpsp) +{ + HICON ret; + + if (hpsp->psp.dwFlags & PSP_USEICONID) + { + int cx = GetSystemMetrics(SM_CXSMICON); + int cy = GetSystemMetrics(SM_CYSMICON); + + 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 @@ -734,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=125048
Your paranoid android.
=== debian11 (32 bit report) ===
ddraw: ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x1000. ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x3000.
=== debian11 (build log) ===
0760:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 0760:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 0760:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this.
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24887. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24887. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24887.
This merge request was approved by Zhiyi Zhang.
This merge request was approved by Nikolay Sivov.