Module: wine Branch: master Commit: 429705eaf33c9de76530007d8fecb818562064c7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=429705eaf33c9de76530007d8f...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Mar 1 22:47:21 2017 +0300
comctl32/propsheet: Implement PSPCB_ADDREF/PSPCB_RELEASE notifications.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/comctl32/propsheet.c | 41 +++++++++++++++++++++++++++++++++++------ dlls/comctl32/tests/propsheet.c | 4 ---- 2 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 88a44cd..0cfc799 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -2962,10 +2962,20 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( if (lpPropSheetPage->dwSize < PROPSHEETPAGEA_V1_SIZE) return NULL;
- ppsp = Alloc(sizeof(PROPSHEETPAGEW)); - memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA))); + /* original data is used for callback notifications */ + if ((lpPropSheetPage->dwFlags & PSP_USECALLBACK) && lpPropSheetPage->pfnCallback) + { + ppsp = Alloc(2 * sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEA))); + memcpy(ppsp + 1, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEA))); + } + else + { + ppsp = Alloc(sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEA))); + }
- ppsp->dwFlags &= ~ PSP_INTERNAL_UNICODE; + ppsp->dwFlags &= ~PSP_INTERNAL_UNICODE;
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) { @@ -3017,6 +3027,9 @@ 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); + return (HPROPSHEETPAGE)ppsp; }
@@ -3032,10 +3045,20 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage if (lpPropSheetPage->dwSize < PROPSHEETPAGEW_V1_SIZE) return NULL;
- ppsp = Alloc(sizeof(PROPSHEETPAGEW)); - memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEW))); + /* original data is used for callback notifications */ + if ((lpPropSheetPage->dwFlags & PSP_USECALLBACK) && lpPropSheetPage->pfnCallback) + { + ppsp = Alloc(2 * sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEW))); + memcpy(ppsp + 1, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEW))); + } + else + { + ppsp = Alloc(sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEW))); + }
- ppsp->dwFlags |= PSP_INTERNAL_UNICODE; + ppsp->dwFlags |= PSP_INTERNAL_UNICODE;
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) { @@ -3067,6 +3090,9 @@ 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); + return (HPROPSHEETPAGE)ppsp; }
@@ -3088,6 +3114,9 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) if (!psp) return FALSE;
+ if ((psp->dwFlags & PSP_USECALLBACK) && psp->pfnCallback) + psp->pfnCallback(0, PSPCB_RELEASE, psp + 1); + if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE( psp->u.pszTemplate )) Free ((LPVOID)psp->u.pszTemplate);
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c index 8a4e6d1..9405965 100644 --- a/dlls/comctl32/tests/propsheet.c +++ b/dlls/comctl32/tests/propsheet.c @@ -1080,7 +1080,6 @@ static void test_CreatePropertySheetPage(void) else { ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageA.dwSize); - todo_wine_if(page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE) ok(page.addref_called == (page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n"); }
@@ -1089,7 +1088,6 @@ static void test_CreatePropertySheetPage(void) page.release_called = 0; ret = DestroyPropertySheetPage(hpsp); ok(ret, "Failed to destroy a page\n"); - todo_wine ok(page.release_called == 1, "Expected RELEASE callback message\n"); } } @@ -1111,7 +1109,6 @@ static void test_CreatePropertySheetPage(void) else { ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageW.dwSize); - todo_wine_if(page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE) ok(page.addref_called == (page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n"); }
@@ -1120,7 +1117,6 @@ static void test_CreatePropertySheetPage(void) page.release_called = 0; ret = DestroyPropertySheetPage(hpsp); ok(ret, "Failed to destroy a page\n"); - todo_wine ok(page.release_called == 1, "Expected RELEASE callback message\n"); } }