https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cd3c1e94ff4510ddfe27e…
commit cd3c1e94ff4510ddfe27e67d75bf9039fd926db8
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Fri Jan 24 20:43:06 2020 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Wed Jan 29 22:58:43 2020 +0100
[SDK] Add some missing propsheet fields + validate struct sizes
---
modules/rostests/apitests/comctl32/propsheet.c | 98 +++++++++++++++++++-------
sdk/include/psdk/prsht.h | 18 +++++
2 files changed, 92 insertions(+), 24 deletions(-)
diff --git a/modules/rostests/apitests/comctl32/propsheet.c
b/modules/rostests/apitests/comctl32/propsheet.c
index 9daf5b0a401..e4d7be568b4 100644
--- a/modules/rostests/apitests/comctl32/propsheet.c
+++ b/modules/rostests/apitests/comctl32/propsheet.c
@@ -1,9 +1,10 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
- * PURPOSE: Test for property sheet
+ * PURPOSE: Test for v6 property sheet
* COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com)
*/
+
#include "wine/test.h"
#include <windows.h>
#include <windowsx.h>
@@ -73,41 +74,68 @@ Page1DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0;
}
+#ifdef _MSC_VER
+#define CHECK_STRUCT_SIZE(x, y) C_ASSERT((x) == (y))
+#else
+// Can't do this compile time, thanks gcc
+// 'error: non-nested function with variably modified type'
+#define CHECK_STRUCT_SIZE(x, y) ok((x) == (y), "Wrong size for %s, got %u, expected
%u\n", #x, y, x)
+#endif
+
+// Validate struct sizes
+static void test_StructSizes()
+{
+#ifdef _M_X64
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V1_SIZE, 72);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V2_SIZE, 88);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V3_SIZE, 96);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V4_SIZE, 104);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V1_SIZE, 72);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V2_SIZE, 96);
+
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V1_SIZE, 72);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V2_SIZE, 88);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V3_SIZE, 96);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V4_SIZE, 104);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V1_SIZE, 72);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V2_SIZE, 96);
+#else
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V1_SIZE, 40);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V2_SIZE, 48);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V3_SIZE, 52);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V4_SIZE, 56);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V1_SIZE, 40);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V2_SIZE, 52);
+
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V1_SIZE, 40);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V2_SIZE, 48);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V3_SIZE, 52);
+ CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V4_SIZE, 56);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V1_SIZE, 40);
+ CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V2_SIZE, 52);
+#endif
+}
+
typedef HPROPSHEETPAGE (WINAPI *FN_CreatePropertySheetPageW)(LPCPROPSHEETPAGEW);
typedef int (WINAPI *FN_PropertySheetW)(LPCPROPSHEETHEADERW);
+static FN_CreatePropertySheetPageW pCreatePropertySheetPageW;
+static FN_PropertySheetW pPropertySheetW;
-START_TEST(propsheet)
+// Show that the Apply button is not enabled by default
+static void test_ApplyButtonDisabled()
{
- PROPSHEETPAGEW psp;
- PROPSHEETHEADERW header;
+ PROPSHEETPAGEW psp = {0};
+ PROPSHEETHEADERW header = {0};
HPROPSHEETPAGE hpsp[1];
- HMODULE hComCtl32;
- FN_CreatePropertySheetPageW pCreatePropertySheetPageW;
- FN_PropertySheetW pPropertySheetW;
-
- hComCtl32 = LoadLibraryW(L"comctl32.dll");
- pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32,
"CreatePropertySheetPageW");
- pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32,
"PropertySheetW");
-
- ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was
NULL.\n");
- ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n");
-
- if (!pCreatePropertySheetPageW || !pPropertySheetW)
- {
- skip("!pCreatePropertySheetPageW || !pPropertySheetW\n");
- return;
- }
- ZeroMemory(&psp, sizeof(psp));
psp.dwSize = sizeof(psp);
psp.dwFlags = PSP_DEFAULT;
psp.hInstance = GetModuleHandleW(NULL);
psp.pszTemplate = MAKEINTRESOURCEW(1);
psp.pfnDlgProc = Page1DlgProc;
- hpsp[0] = (*pCreatePropertySheetPageW)(&psp);
+ hpsp[0] = pCreatePropertySheetPageW(&psp);
ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n");
- ZeroMemory(&header, sizeof(header));
header.dwSize = sizeof(header);
header.dwFlags = 0;
header.hInstance = GetModuleHandleW(NULL);
@@ -115,7 +143,29 @@ START_TEST(propsheet)
header.nPages = ARRAYSIZE(hpsp);
header.phpage = hpsp;
header.pszCaption = L"propsheet";
- ok((*pPropertySheetW)(&header) > 0, "PropertySheet returned non-positive
value.\n");
+ ok(pPropertySheetW(&header) > 0, "PropertySheet returned non-positive
value.\n");
+}
+
+
+START_TEST(propsheet)
+{
+ HMODULE hComCtl32;
+
+ hComCtl32 = LoadLibraryW(L"comctl32.dll");
+ pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32,
"CreatePropertySheetPageW");
+ pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32,
"PropertySheetW");
+
+ ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was
NULL.\n");
+ ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n");
+
+ if (!pCreatePropertySheetPageW || !pPropertySheetW)
+ {
+ skip("!pCreatePropertySheetPageW || !pPropertySheetW\n");
+ return;
+ }
+
+ test_StructSizes();
+ test_ApplyButtonDisabled();
FreeLibrary(hComCtl32);
}
diff --git a/sdk/include/psdk/prsht.h b/sdk/include/psdk/prsht.h
index 0356c7e247e..a35537ebe4c 100644
--- a/sdk/include/psdk/prsht.h
+++ b/sdk/include/psdk/prsht.h
@@ -194,6 +194,15 @@ typedef struct _PROPSHEETPAGEA {
LPCSTR pszHeaderTitle;
LPCSTR pszHeaderSubTitle;
#endif
+#if (_WIN32_IE >= 0x0501)
+ HANDLE hActCtx;
+#endif
+#if (_WIN32_IE >= 0x0600)
+ _ANONYMOUS_UNION union {
+ HBITMAP hbmHeader;
+ LPCSTR pszbmHeader;
+ } DUMMYUNIONNAME3;
+#endif
} PROPSHEETPAGEA,*LPPROPSHEETPAGEA,
PROPSHEETPAGEA_LATEST, *LPPROPSHEETPAGEA_LATEST;
typedef const PROPSHEETPAGEA *LPCPROPSHEETPAGEA, *LPCPROPSHEETPAGEA_LATEST;
@@ -222,6 +231,15 @@ typedef struct _PROPSHEETPAGEW {
LPCWSTR pszHeaderTitle;
LPCWSTR pszHeaderSubTitle;
#endif
+#if (_WIN32_IE >= 0x0501)
+ HANDLE hActCtx;
+#endif
+#if (_WIN32_IE >= 0x0600)
+ _ANONYMOUS_UNION union {
+ HBITMAP hbmHeader;
+ LPCWSTR pszbmHeader;
+ } DUMMYUNIONNAME3;
+#endif
} PROPSHEETPAGEW,*LPPROPSHEETPAGEW,
PROPSHEETPAGEW_LATEST, *LPPROPSHEETPAGEW_LATEST;
typedef const PROPSHEETPAGEW *LPCPROPSHEETPAGEW, *LPCPROPSHEETPAGEW_LATEST;