[v2 PATCH] comctl32/propsheet: Double size of a template buffer passed to PSCB_PRECREATE
Nikolay Sivov
nsivov at codeweavers.com
Fri Jan 13 05:25:54 CST 2017
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
v2: added a test
Fixes https://bugs.winehq.org/show_bug.cgi?id=33859
This is what happens on Windows, callback is called with block twice as large
as dialog template resource.
dlls/comctl32/propsheet.c | 2 +-
dlls/comctl32/tests/propsheet.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index 860084414b..1809b8647d 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -639,7 +639,7 @@ static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
*/
resSize = SizeofResource(COMCTL32_hModule, hRes);
- temp = Alloc(resSize);
+ temp = Alloc(2 * resSize);
if (!temp)
return -1;
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index 6594298801..592ad154a1 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -55,6 +55,21 @@ static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
{
switch(msg)
{
+ case PSCB_PRECREATE:
+ {
+ HMODULE module = GetModuleHandleA("comctl32.dll");
+ DWORD size, buffer_size;
+ HRSRC hrsrc;
+
+ hrsrc = FindResourceA(module, MAKEINTRESOURCEA(1006 /* IDD_PROPSHEET */),
+ (LPSTR)RT_DIALOG);
+ size = SizeofResource(module, hrsrc);
+ ok(size != 0, "Failed to get size of propsheet dialog resource\n");
+ buffer_size = HeapSize(GetProcessHeap(), 0, (void *)lparam);
+ ok(buffer_size == 2 * size, "Unexpected template buffer size %u, resource size %u\n",
+ buffer_size, size);
+ break;
+ }
case PSCB_INITIALIZED:
{
char caption[256];
--
2.11.0
More information about the wine-patches
mailing list