ReactOS  0.4.14-dev-376-gaedba84
propsheet.c File Reference
#include <windows.h>
#include <commctrl.h>
#include "msg.h"
#include "resources.h"
#include "wine/test.h"
Include dependency graph for propsheet.c:

Go to the source code of this file.

Classes

struct  custom_proppage
 

Macros

#define IDC_APPLY_BUTTON   12321
 
#define RECEIVER_SHEET_CALLBACK   0
 
#define RECEIVER_SHEET_WINPROC   1
 
#define RECEIVER_PAGE   2
 
#define NUM_MSG_SEQUENCES   1
 
#define PROPSHEET_SEQ_INDEX   0
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageA)(const PROPSHEETPAGEA *desc)
 
static BOOL (WINAPI *pDestroyPropertySheetPage)(HPROPSHEETPAGE proppage)
 
static INT_PTR (WINAPI *pPropertySheetA)(const PROPSHEETHEADERA *header)
 
static void detect_locale (void)
 
static void flush_events (void)
 
static int CALLBACK sheet_callback (HWND hwnd, UINT msg, LPARAM lparam)
 
static INT_PTR CALLBACK page_dlg_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_title (void)
 
static void test_nopage (void)
 
static int CALLBACK disableowner_callback (HWND hwnd, UINT msg, LPARAM lparam)
 
static void register_parent_wnd_class (void)
 
static void test_disableowner (void)
 
static INT_PTR CALLBACK nav_page_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK new_nav_dialog_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static LRESULT CALLBACK hook_proc (int code, WPARAM wp, LPARAM lp)
 
static void test_wiznavigation (void)
 
static void test_buttons (void)
 
static INT_PTR CALLBACK page_with_custom_default_button_dlg_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_custom_default_button (void)
 
static void save_message (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver)
 
static LRESULT CALLBACK sheet_callback_messages_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK sheet_callback_messages (HWND hwnd, UINT msg, LPARAM lParam)
 
static INT_PTR CALLBACK page_dlg_proc_messages (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_messages (void)
 
static void test_PSM_ADDPAGE (void)
 
static void test_PSM_INSERTPAGE (void)
 
static UINT CALLBACK proppage_callback_a (HWND hwnd, UINT msg, PROPSHEETPAGEA *psp)
 
static UINT CALLBACK proppage_callback_w (HWND hwnd, UINT msg, PROPSHEETPAGEW *psp)
 
static void test_CreatePropertySheetPage (void)
 
static void test_bad_control_class (void)
 
static void init_functions (void)
 
 START_TEST (propsheet)
 

Variables

static HWND parenthwnd
 
static HWND sheethwnd
 
static BOOL rtl
 
static LONG active_page = -1
 
static WNDPROC old_nav_dialog_proc
 
static BOOL add_button_has_been_pressed
 
static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static WNDPROC oldWndProc
 
static const struct message property_sheet_seq []
 

Macro Definition Documentation

◆ IDC_APPLY_BUTTON

#define IDC_APPLY_BUTTON   12321

Definition at line 39 of file propsheet.c.

◆ NUM_MSG_SEQUENCES

#define NUM_MSG_SEQUENCES   1

Definition at line 633 of file propsheet.c.

◆ PROPSHEET_SEQ_INDEX

#define PROPSHEET_SEQ_INDEX   0

Definition at line 634 of file propsheet.c.

◆ RECEIVER_PAGE

#define RECEIVER_PAGE   2

Definition at line 631 of file propsheet.c.

◆ RECEIVER_SHEET_CALLBACK

#define RECEIVER_SHEET_CALLBACK   0

Definition at line 629 of file propsheet.c.

◆ RECEIVER_SHEET_WINPROC

#define RECEIVER_SHEET_WINPROC   1

Definition at line 630 of file propsheet.c.

◆ X

#define X (   f)    p##f = (void*)GetProcAddress(hComCtl32, #f);

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pDestroyPropertySheetPage)
static

◆ detect_locale()

static void detect_locale ( void  )
static

Definition at line 46 of file propsheet.c.

47 {
48  DWORD reading_layout;
50  (void *)&reading_layout, sizeof(reading_layout)) && reading_layout == 1;
51 }
static BOOL rtl
Definition: propsheet.c:36
#define LOCALE_USER_DEFAULT
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define LOCALE_IREADINGLAYOUT
Definition: winnls.h:153
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by START_TEST().

◆ disableowner_callback()

static int CALLBACK disableowner_callback ( HWND  hwnd,
UINT  msg,
LPARAM  lparam 
)
static

Definition at line 221 of file propsheet.c.

222 {
223  switch(msg)
224  {
225  case PSCB_INITIALIZED:
226  {
227  ok(IsWindowEnabled(parenthwnd) == 0, "parent window should be disabled\n");
228  PostQuitMessage(0);
229  return FALSE;
230  }
231  }
232  return FALSE;
233 }
static HWND parenthwnd
Definition: propsheet.c:33
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by test_disableowner().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 54 of file propsheet.c.

55 {
56  MSG msg;
57  int diff = 200;
58  int min_timeout = 100;
59  DWORD time = GetTickCount() + diff;
60 
61  while (diff > 0)
62  {
63  if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
64  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
65  diff = time - GetTickCount();
66  }
67 }
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
__u16 time
Definition: mkdosfs.c:366
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define QS_ALLINPUT
Definition: winuser.h:874
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by test_nopage().

◆ hook_proc()

static LRESULT CALLBACK hook_proc ( int  code,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 325 of file propsheet.c.

326 {
327  static BOOL done;
328  if (code == HCBT_CREATEWND)
329  {
331 
332  /* The first dialog created will be the parent dialog */
333  if (!done && c->lpcs->lpszClass == (LPWSTR)WC_DIALOG)
334  {
336  done = TRUE;
337  }
338  }
339 
340  return CallNextHookEx( NULL, code, wp, lp );
341 }
#define LONG_PTR
Definition: treelist.c:79
#define TRUE
Definition: types.h:120
#define HCBT_CREATEWND
Definition: winuser.h:58
#define WC_DIALOG
Definition: undocuser.h:11
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static LRESULT CALLBACK new_nav_dialog_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: propsheet.c:314
const GLubyte * c
Definition: glext.h:8905
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5247
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WNDPROC old_nav_dialog_proc
Definition: propsheet.c:312

Referenced by test_wiznavigation().

◆ HPROPSHEETPAGE()

static HPROPSHEETPAGE ( WINAPI pCreatePropertySheetPageA) const
static

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 1189 of file propsheet.c.

1190 {
1191  HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
1192 
1193 #define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
1197  X(PropertySheetA);
1198 #undef X
1199 }
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3144
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
Definition: propsheet.c:2864
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3075
#define X(f)
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(LPCPROPSHEETPAGEA lpPropSheetPage)
Definition: propsheet.c:2991

Referenced by START_TEST().

◆ INT_PTR()

static INT_PTR ( WINAPI pPropertySheetA) const
static

Referenced by PROPSHEET_CreateDialog().

◆ nav_page_proc()

static INT_PTR CALLBACK nav_page_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 288 of file propsheet.c.

289 {
290  switch(msg){
291  case WM_NOTIFY:
292  {
294  switch(hdr->code){
295  case PSN_SETACTIVE:
296  active_page = /* PropSheet_HwndToIndex(hdr->hwndFrom, hwnd); */
297  (int)SendMessageA(hdr->hwndFrom, PSM_HWNDTOINDEX, (WPARAM)hwnd, 0);
298  return TRUE;
299  case PSN_KILLACTIVE:
300  /* prevent navigation away from the fourth page */
301  if(active_page == 3){
303  return TRUE;
304  }
305  }
306  break;
307  }
308  }
309  return FALSE;
310 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT_PTR WPARAM
Definition: windef.h:207
#define PSN_SETACTIVE
Definition: prsht.h:115
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
#define PSN_KILLACTIVE
Definition: prsht.h:116
static LONG active_page
Definition: propsheet.c:37
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define msg(x)
Definition: auth_time.c:54
#define WM_NOTIFY
Definition: richedit.h:61
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by test_wiznavigation().

◆ new_nav_dialog_proc()

static LRESULT CALLBACK new_nav_dialog_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 314 of file propsheet.c.

315 {
316  switch (msg)
317  {
318  case DM_SETDEFID:
319  ok( IsWindowEnabled( GetDlgItem(hwnd, wp) ), "button is not enabled\n" );
320  break;
321  }
322  return CallWindowProcW( old_nav_dialog_proc, hwnd, msg, wp, lp );
323 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DM_SETDEFID
Definition: winuser.h:2081
BOOL WINAPI IsWindowEnabled(_In_ HWND)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static WNDPROC old_nav_dialog_proc
Definition: propsheet.c:312

Referenced by hook_proc().

◆ page_dlg_proc()

static INT_PTR CALLBACK page_dlg_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 101 of file propsheet.c.

103 {
104  switch(msg)
105  {
106  case WM_INITDIALOG:
107  {
108  HWND sheet = GetParent(hwnd);
109  char caption[256];
110  GetWindowTextA(sheet, caption, sizeof(caption));
111  ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
112  return TRUE;
113  }
114 
115  case WM_NOTIFY:
116  {
117  NMHDR *nmhdr = (NMHDR *)lparam;
118  switch(nmhdr->code)
119  {
120  case PSN_APPLY:
121  return TRUE;
122  default:
123  return FALSE;
124  }
125  }
126  case WM_NCDESTROY:
127  ok(!SendMessageA(sheethwnd, PSM_INDEXTOHWND, 400, 0),"Should always be 0\n");
128  return TRUE;
129 
130  default:
131  return FALSE;
132  }
133 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PSN_APPLY
Definition: prsht.h:117
UINT code
Definition: winuser.h:3133
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_NCDESTROY
Definition: winuser.h:1666
static HWND sheethwnd
Definition: propsheet.c:34
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WM_INITDIALOG
Definition: winuser.h:1721
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_bad_control_class(), test_buttons(), test_nopage(), and test_title().

◆ page_dlg_proc_messages()

static INT_PTR CALLBACK page_dlg_proc_messages ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 782 of file propsheet.c.

784 {
786 
787  return FALSE;
788 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define RECEIVER_PAGE
Definition: propsheet.c:631
WPARAM wParam
Definition: combotst.c:138
static void save_message(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver)
Definition: propsheet.c:735
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139

Referenced by test_CreatePropertySheetPage(), test_messages(), test_PSM_ADDPAGE(), and test_PSM_INSERTPAGE().

◆ page_with_custom_default_button_dlg_proc()

static INT_PTR CALLBACK page_with_custom_default_button_dlg_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 543 of file propsheet.c.

544 {
545  switch (msg)
546  {
547  case WM_COMMAND:
548  switch(LOWORD(wparam))
549  {
550  case IDC_PS_PUSHBUTTON1:
551  switch(HIWORD(wparam))
552  {
553  case BN_CLICKED:
555  return TRUE;
556  }
557  break;
558  }
559  break;
560  }
561  return FALSE;
562 }
#define TRUE
Definition: types.h:120
static BOOL add_button_has_been_pressed
Definition: propsheet.c:540
#define IDC_PS_PUSHBUTTON1
Definition: resources.h:50
#define BN_CLICKED
Definition: winuser.h:1907
#define WM_COMMAND
Definition: winuser.h:1722
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_custom_default_button().

◆ proppage_callback_a()

static UINT CALLBACK proppage_callback_a ( HWND  hwnd,
UINT  msg,
PROPSHEETPAGEA psp 
)
static

Definition at line 1025 of file propsheet.c.

1026 {
1027  struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam;
1028  PROPSHEETPAGEA *psp_orig = &cpage->u.pageA;
1029 
1030  ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd);
1031 
1032  ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n",
1033  psp->lParam, psp);
1034  ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n");
1035  ok(!lstrcmpA(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n");
1036 
1037  switch (msg)
1038  {
1039  case PSPCB_ADDREF:
1040  ok(psp->dwSize > PROPSHEETPAGEA_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize);
1041  cpage->addref_called++;
1042  break;
1043  case PSPCB_RELEASE:
1044  ok(psp->dwSize >= PROPSHEETPAGEA_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize);
1045  cpage->release_called++;
1046  break;
1047  default:
1048  ok(0, "Unexpected message %u\n", msg);
1049  }
1050 
1051  return 1;
1052 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD dwSize
Definition: prsht.h:177
unsigned int addref_called
Definition: propsheet.c:1021
LPCSTR pszTitle
Definition: prsht.h:188
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
PROPSHEETPAGEA pageA
Definition: propsheet.c:1018
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define PSPCB_RELEASE
Definition: prsht.h:37
#define PROPSHEETPAGEA_V1_SIZE
Definition: prsht.h:200
LPARAM lParam
Definition: prsht.h:190
union custom_proppage::@1604 u
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define PSPCB_ADDREF
Definition: prsht.h:171
unsigned int release_called
Definition: propsheet.c:1022

Referenced by test_CreatePropertySheetPage().

◆ proppage_callback_w()

static UINT CALLBACK proppage_callback_w ( HWND  hwnd,
UINT  msg,
PROPSHEETPAGEW psp 
)
static

Definition at line 1054 of file propsheet.c.

1055 {
1056  struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam;
1057  PROPSHEETPAGEW *psp_orig = &cpage->u.pageW;
1058 
1059  ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd);
1060  ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n",
1061  psp->lParam, psp);
1062  ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n");
1063  ok(!lstrcmpW(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n");
1064 
1065  switch (msg)
1066  {
1067  case PSPCB_ADDREF:
1068  ok(psp->dwSize > PROPSHEETPAGEW_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize);
1069  cpage->addref_called++;
1070  break;
1071  case PSPCB_RELEASE:
1072  ok(psp->dwSize >= PROPSHEETPAGEW_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize);
1073  cpage->release_called++;
1074  break;
1075  default:
1076  ok(0, "Unexpected message %u\n", msg);
1077  }
1078 
1079  return 1;
1080 }
PROPSHEETPAGEW pageW
Definition: propsheet.c:1019
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
unsigned int addref_called
Definition: propsheet.c:1021
DWORD dwSize
Definition: prsht.h:205
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPCWSTR pszTitle
Definition: prsht.h:216
#define PSPCB_RELEASE
Definition: prsht.h:37
union custom_proppage::@1604 u
LPARAM lParam
Definition: prsht.h:218
#define ok(value,...)
Definition: atltest.h:57
#define PROPSHEETPAGEW_V1_SIZE
Definition: prsht.h:228
#define msg(x)
Definition: auth_time.c:54
#define PSPCB_ADDREF
Definition: prsht.h:171
unsigned int release_called
Definition: propsheet.c:1022

Referenced by test_CreatePropertySheetPage().

◆ register_parent_wnd_class()

static void register_parent_wnd_class ( void  )
static

Definition at line 235 of file propsheet.c.

236 {
237  WNDCLASSA cls;
238 
239  cls.style = 0;
241  cls.cbClsExtra = 0;
242  cls.cbWndExtra = 0;
244  cls.hIcon = 0;
245  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
247  cls.lpszMenuName = NULL;
248  cls.lpszClassName = "parent class";
249  RegisterClassA(&cls);
250 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
int cbClsExtra
Definition: winuser.h:3139
LPCSTR lpszMenuName
Definition: winuser.h:3145
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3144
int cbWndExtra
Definition: winuser.h:3140
HCURSOR hCursor
Definition: winuser.h:3143
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3146
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3137
HINSTANCE hInstance
Definition: winuser.h:3141
WNDPROC lpfnWndProc
Definition: winuser.h:3138
#define IDC_ARROW
Definition: winuser.h:682
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3142

Referenced by test_disableowner().

◆ save_message()

static void save_message ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
INT  receiver 
)
static

Definition at line 735 of file propsheet.c.

736 {
737  struct message msg = { 0 };
738 
739  if (message < WM_USER &&
740  message != WM_GETICON &&
741  message != WM_GETTEXT &&
743  message != WM_IME_NOTIFY &&
744  message != WM_PAINT &&
745  message != WM_ERASEBKGND &&
746  message != WM_SETCURSOR &&
748  (message < WM_MOUSEFIRST || message > WM_MOUSEHWHEEL) &&
749  message != 0x90)
750  {
751  msg.message = message;
752  msg.flags = sent|wparam|lparam|id;
753  msg.wParam = wParam;
754  msg.lParam = lParam;
755  msg.id = receiver;
757  }
758 }
#define WM_IME_NOTIFY
Definition: winuser.h:1812
Definition: tftpd.h:59
#define WM_NCMBUTTONDBLCLK
Definition: winuser.h:1682
#define WM_GETTEXT
Definition: winuser.h:1600
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
WPARAM wParam
Definition: combotst.c:138
#define WM_SETCURSOR
Definition: winuser.h:1618
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: propsheet.c:636
#define WM_IME_SETCONTEXT
Definition: winuser.h:1811
#define PROPSHEET_SEQ_INDEX
Definition: propsheet.c:634
#define WM_PAINT
Definition: winuser.h:1602
Definition: msg.h:34
#define WM_USER
Definition: winuser.h:1877
#define add_message(msg)
Definition: msg.c:2142
#define msg(x)
Definition: auth_time.c:54
GLenum GLuint id
Definition: glext.h:5579
#define WM_ERASEBKGND
Definition: winuser.h:1607
LPARAM lParam
Definition: combotst.c:139
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by page_dlg_proc_messages(), sheet_callback_messages(), and sheet_callback_messages_proc().

◆ sheet_callback()

static int CALLBACK sheet_callback ( HWND  hwnd,
UINT  msg,
LPARAM  lparam 
)
static

Definition at line 70 of file propsheet.c.

71 {
72  switch(msg)
73  {
74  case PSCB_PRECREATE:
75  {
76  HMODULE module = GetModuleHandleA("comctl32.dll");
78  HRSRC hrsrc;
79 
80  hrsrc = FindResourceA(module, MAKEINTRESOURCEA(1006 /* IDD_PROPSHEET */),
81  (LPSTR)RT_DIALOG);
82  size = SizeofResource(module, hrsrc);
83  ok(size != 0, "Failed to get size of propsheet dialog resource\n");
84  buffer_size = HeapSize(GetProcessHeap(), 0, (void *)lparam);
85  ok(buffer_size == 2 * size, "Unexpected template buffer size %u, resource size %u\n",
86  buffer_size, size);
87  break;
88  }
89  case PSCB_INITIALIZED:
90  {
91  char caption[256];
92  GetWindowTextA(hwnd, caption, sizeof(caption));
93  ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
94  sheethwnd = hwnd;
95  return 0;
96  }
97  }
98  return 0;
99 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
char * LPSTR
Definition: xmlstorage.h:182
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:927
#define PSCB_PRECREATE
Definition: prsht.h:76
#define RT_DIALOG
Definition: pedump.c:367
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
unsigned long DWORD
Definition: ntddk_ex.h:95
static HWND sheethwnd
Definition: propsheet.c:34
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define msg(x)
Definition: auth_time.c:54
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by test_buttons(), test_nopage(), and test_title().

◆ sheet_callback_messages()

static int CALLBACK sheet_callback_messages ( HWND  hwnd,
UINT  msg,
LPARAM  lParam 
)
static

Definition at line 767 of file propsheet.c.

768 {
770 
771  switch (msg)
772  {
773  case PSCB_INITIALIZED:
776  return TRUE;
777  }
778 
779  return TRUE;
780 }
#define RECEIVER_SHEET_CALLBACK
Definition: propsheet.c:629
static WNDPROC oldWndProc
Definition: propsheet.c:637
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
static void save_message(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver)
Definition: propsheet.c:735
#define GetWindowLongPtrA
Definition: winuser.h:4729
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
#define PSCB_INITIALIZED
Definition: prsht.h:75
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define msg(x)
Definition: auth_time.c:54
static LRESULT CALLBACK sheet_callback_messages_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:760
LPARAM lParam
Definition: combotst.c:139

Referenced by test_messages().

◆ sheet_callback_messages_proc()

static LRESULT CALLBACK sheet_callback_messages_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 760 of file propsheet.c.

761 {
763 
765 }
static WNDPROC oldWndProc
Definition: propsheet.c:637
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void save_message(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver)
Definition: propsheet.c:735
#define RECEIVER_SHEET_WINPROC
Definition: propsheet.c:630
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139

Referenced by sheet_callback_messages().

◆ START_TEST()

START_TEST ( propsheet  )

Definition at line 1201 of file propsheet.c.

1202 {
1203  detect_locale();
1204  if (rtl)
1205  {
1206  /* use locale-specific RTL resources when on an RTL locale */
1207  /* without this, propsheets on RTL locales use English LTR resources */
1208  trace("RTL locale detected\n");
1210  }
1211 
1212  init_functions();
1213 
1215  test_title();
1216  test_nopage();
1219  test_buttons();
1221  test_messages();
1222  test_PSM_ADDPAGE();
1225 }
static void test_title(void)
Definition: propsheet.c:135
static BOOL rtl
Definition: propsheet.c:36
#define LAYOUT_RTL
Definition: wingdi.h:1370
static void test_custom_default_button(void)
Definition: propsheet.c:564
static void test_PSM_INSERTPAGE(void)
Definition: propsheet.c:920
static void test_PSM_ADDPAGE(void)
Definition: propsheet.c:830
static void test_disableowner(void)
Definition: propsheet.c:252
static void test_CreatePropertySheetPage(void)
Definition: propsheet.c:1082
static void test_wiznavigation(void)
Definition: propsheet.c:343
static void detect_locale(void)
Definition: propsheet.c:46
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1716
static void test_bad_control_class(void)
Definition: propsheet.c:1149
#define trace
Definition: atltest.h:70
static void init_functions(void)
Definition: propsheet.c:1189
static void test_buttons(void)
Definition: propsheet.c:471
static void test_nopage(void)
Definition: propsheet.c:174
static void test_messages(void)
Definition: propsheet.c:790

◆ test_bad_control_class()

static void test_bad_control_class ( void  )
static

Definition at line 1149 of file propsheet.c.

1150 {
1151  PROPSHEETPAGEA psp;
1152  PROPSHEETHEADERA psh;
1153  HPROPSHEETPAGE hpsp;
1154  INT_PTR ret;
1155 
1156  memset(&psp, 0, sizeof(psp));
1157  psp.dwSize = sizeof(psp);
1159  U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_BAD_CONTROL);
1160  psp.pfnDlgProc = page_dlg_proc;
1161 
1162  hpsp = pCreatePropertySheetPageA(&psp);
1163  ok(hpsp != 0, "CreatePropertySheetPage failed\n");
1164 
1165  memset(&psh, 0, sizeof(psh));
1167  psh.nPages = 1;
1168  psh.hwndParent = GetDesktopWindow();
1169  U3(psh).phpage = &hpsp;
1170 
1171 #ifndef __REACTOS__ /* FIXME: Inspect why this causes a hang */
1172  ret = pPropertySheetA(&psh);
1173  ok(ret == 0, "got %ld\n", ret);
1174 #endif
1175 
1176  /* Need to recreate hpsp otherwise the test fails under Windows */
1177  hpsp = pCreatePropertySheetPageA(&psp);
1178  ok(hpsp != 0, "CreatePropertySheetPage failed\n");
1179  U3(psh).phpage = &hpsp;
1180 
1181  psh.dwFlags = PSH_MODELESS;
1182  ret = pPropertySheetA(&psh);
1183  ok(ret != 0, "got %ld\n", ret);
1184 
1185  ok(IsWindow((HWND)ret), "bad window handle %#lx\n", ret);
1187 }
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:101
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI IsWindow(_In_opt_ HWND)
DWORD dwSize
Definition: prsht.h:177
#define U(x)
Definition: wordpad.c:44
#define U3(x)
Definition: wordpad.c:46
int32_t INT_PTR
Definition: typedefs.h:62
#define PSH_MODELESS
Definition: prsht.h:50
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND hwndParent
Definition: prsht.h:242
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HINSTANCE hInstance
Definition: prsht.h:179
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD dwSize
Definition: prsht.h:240
DWORD dwFlags
Definition: prsht.h:241
#define IDD_PROP_PAGE_BAD_CONTROL
Definition: resources.h:42
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39
DLGPROC pfnDlgProc
Definition: prsht.h:189

Referenced by START_TEST().

◆ test_buttons()

static void test_buttons ( void  )
static

Definition at line 471 of file propsheet.c.

472 {
473  HPROPSHEETPAGE hpsp[1];
474  PROPSHEETPAGEA psp;
475  PROPSHEETHEADERA psh;
476  HWND hdlg;
477  HWND button;
478  RECT rc;
479  int prevRight, top;
480 
481  memset(&psp, 0, sizeof(psp));
482  psp.dwSize = sizeof(psp);
483  psp.dwFlags = 0;
485  U(psp).pszTemplate = "prop_page1";
486  U2(psp).pszIcon = NULL;
488  psp.lParam = 0;
489 
490  hpsp[0] = pCreatePropertySheetPageA(&psp);
491 
492  memset(&psh, 0, sizeof(psh));
495  psh.pszCaption = "test caption";
496  psh.nPages = 1;
498  U3(psh).phpage = hpsp;
500 
501  hdlg = (HWND)pPropertySheetA(&psh);
502  ok(hdlg != INVALID_HANDLE_VALUE, "got null handle\n");
503 
504  /* OK button */
505  button = GetDlgItem(hdlg, IDOK);
506  GetWindowRect(button, &rc);
507  prevRight = rc.right;
508  top = rc.top;
509 
510  /* Cancel button */
511  button = GetDlgItem(hdlg, IDCANCEL);
512  GetWindowRect(button, &rc);
513  ok(rc.top == top, "Cancel button should have same top as OK button\n");
514  if (rtl)
515  ok(rc.left < prevRight, "Cancel button should be to the left of OK button\n");
516  else
517  ok(rc.left > prevRight, "Cancel button should be to the right of OK button\n");
518  prevRight = rc.right;
519 
521  GetWindowRect(button, &rc);
522  ok(rc.top == top, "Apply button should have same top as OK button\n");
523  if (rtl)
524  ok(rc.left < prevRight, "Apply button should be to the left of Cancel button\n");
525  else
526  ok(rc.left > prevRight, "Apply button should be to the right of Cancel button\n");
527  prevRight = rc.right;
528 
529  button = GetDlgItem(hdlg, IDHELP);
530  GetWindowRect(button, &rc);
531  ok(rc.top == top, "Help button should have same top as OK button\n");
532  if (rtl)
533  ok(rc.left < prevRight, "Help button should be to the left of Apply button\n");
534  else
535  ok(rc.left > prevRight, "Help button should be to the right of Apply button\n");
536 
537  DestroyWindow(hdlg);
538 }
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:101
#define IDOK
Definition: winuser.h:824
static BOOL rtl
Definition: propsheet.c:36
DWORD dwSize
Definition: prsht.h:177
#define U(x)
Definition: wordpad.c:44
DWORD button
Definition: button.c:166
LPCSTR pszCaption
Definition: prsht.h:248
#define U3(x)
Definition: wordpad.c:46
LONG top
Definition: windef.h:292
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
LONG left
Definition: windef.h:291
#define PSH_MODELESS
Definition: prsht.h:50
#define PSH_USECALLBACK
Definition: prsht.h:48
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
#define IDHELP
Definition: resource_2.h:8
HWND hwndParent
Definition: prsht.h:242
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
Definition: propsheet.c:70
HINSTANCE hInstance
Definition: prsht.h:179
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:258
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
DWORD dwSize
Definition: prsht.h:240
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define IDC_APPLY_BUTTON
Definition: propsheet.c:39
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define IDCANCEL
Definition: winuser.h:825
#define memset(x, y, z)
Definition: compat.h:39
DLGPROC pfnDlgProc
Definition: prsht.h:189

Referenced by START_TEST().

◆ test_CreatePropertySheetPage()

static void test_CreatePropertySheetPage ( void  )
static

Definition at line 1082 of file propsheet.c.

1083 {
1084  static const WCHAR titleW[] = {'T','i','t','l','e',0};
1085  struct custom_proppage page;
1086  HPROPSHEETPAGE hpsp;
1087  BOOL ret;
1088 
1089  memset(&page.u.pageA, 0, sizeof(page.u.pageA));
1090  page.u.pageA.dwFlags = PSP_USECALLBACK;
1091  page.u.pageA.pfnDlgProc = page_dlg_proc_messages;
1092  page.u.pageA.pfnCallback = proppage_callback_a;
1093  page.u.pageA.lParam = (LPARAM)&page;
1094  page.u.pageA.pszTitle = "Title";
1095 
1096  /* Only minimal size validation is performed */
1097  for (page.u.pageA.dwSize = PROPSHEETPAGEA_V1_SIZE - 1; page.u.pageA.dwSize <= PROPSHEETPAGEA_V4_SIZE + 1; page.u.pageA.dwSize++)
1098  {
1099  page.addref_called = 0;
1100  hpsp = pCreatePropertySheetPageA(&page.u.pageA);
1101 
1102  if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE)
1103  ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize);
1104  else
1105  {
1106  ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageA.dwSize);
1107  ok(page.addref_called == (page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n");
1108  }
1109 
1110  if (hpsp)
1111  {
1112  page.release_called = 0;
1113  ret = pDestroyPropertySheetPage(hpsp);
1114  ok(ret, "Failed to destroy a page\n");
1115  ok(page.release_called == 1, "Expected RELEASE callback message\n");
1116  }
1117  }
1118 
1119  memset(&page.u.pageW, 0, sizeof(page.u.pageW));
1120  page.u.pageW.dwFlags = PSP_USECALLBACK;
1121  page.u.pageW.pfnDlgProc = page_dlg_proc_messages;
1122  page.u.pageW.pfnCallback = proppage_callback_w;
1123  page.u.pageW.lParam = (LPARAM)&page;
1124  page.u.pageW.pszTitle = titleW;
1125 
1126  for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++)
1127  {
1128  page.addref_called = 0;
1129  hpsp = pCreatePropertySheetPageW(&page.u.pageW);
1130 
1131  if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE)
1132  ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize);
1133  else
1134  {
1135  ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageW.dwSize);
1136  ok(page.addref_called == (page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n");
1137  }
1138 
1139  if (hpsp)
1140  {
1141  page.release_called = 0;
1142  ret = pDestroyPropertySheetPage(hpsp);
1143  ok(ret, "Failed to destroy a page\n");
1144  ok(page.release_called == 1, "Expected RELEASE callback message\n");
1145  }
1146  }
1147 }
static UINT CALLBACK proppage_callback_a(HWND hwnd, UINT msg, PROPSHEETPAGEA *psp)
Definition: propsheet.c:1025
#define PSP_USECALLBACK
Definition: prsht.h:30
#define PROPSHEETPAGEW_V4_SIZE
Definition: prsht.h:231
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
Definition: module.h:566
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PROPSHEETPAGEA_V1_SIZE
Definition: prsht.h:200
static INT_PTR CALLBACK page_dlg_proc_messages(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:782
static const WCHAR titleW[]
Definition: htmlelem.c:1067
int ret
static UINT CALLBACK proppage_callback_w(HWND hwnd, UINT msg, PROPSHEETPAGEW *psp)
Definition: propsheet.c:1054
#define ok(value,...)
Definition: atltest.h:57
#define PROPSHEETPAGEW_V1_SIZE
Definition: prsht.h:228
#define memset(x, y, z)
Definition: compat.h:39
#define PROPSHEETPAGEA_V4_SIZE
Definition: prsht.h:203

Referenced by START_TEST().

◆ test_custom_default_button()

static void test_custom_default_button ( void  )
static

Definition at line 564 of file propsheet.c.

565 {
566  HWND hdlg, page;
567  PROPSHEETPAGEA psp[1];
568  PROPSHEETHEADERA psh;
569  MSG msg;
570  LRESULT result;
571 
572  psp[0].dwSize = sizeof (PROPSHEETPAGEA);
573  psp[0].dwFlags = PSP_USETITLE;
574  psp[0].hInstance = GetModuleHandleA(NULL);
576  U2(psp[0]).pszIcon = NULL;
578  psp[0].pszTitle = "Page1";
579  psp[0].lParam = 0;
580 
585  U(psh).pszIcon = NULL;
586  psh.pszCaption = "PropertySheet1";
587  psh.nPages = 1;
588  U3(psh).ppsp = psp;
589  U2(psh).nStartPage = 0;
590 
591  /* The goal of the test is to make sure that the Add button is pressed
592  * when the ENTER key is pressed and a different control, a combobox,
593  * has the keyboard focus. */
595 
596  /* Create the modeless property sheet. */
597  hdlg = (HWND)pPropertySheetA(&psh);
598  ok(hdlg != INVALID_HANDLE_VALUE, "Cannot create the property sheet\n");
599 
600  /* Set the Add button as the default button. */
602 
603  /* Make sure the default button is the Add button. */
604  result = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
605  ok(DC_HASDEFID == HIWORD(result), "The property sheet does not have a default button\n");
606  ok(IDC_PS_PUSHBUTTON1 == LOWORD(result), "The default button is not the Add button\n");
607 
608  /* At this point, the combobox should have keyboard focus, so we press ENTER.
609  * Pull the lever, Kronk! */
612 
613  /* Process all the messages in the queue for this thread. */
614  while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
615  {
616  /* (!PropSheet_IsDialogMessage(hdlg, &msg)) */
617  if (!((BOOL)SendMessageA(hdlg, PSM_ISDIALOGMESSAGE, 0, (LPARAM)&msg)))
618  {
621  }
622  }
623 
624  ok(add_button_has_been_pressed, "The Add button has not been pressed!\n");
625 
626  DestroyWindow(hdlg);
627 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
DWORD dwSize
Definition: prsht.h:177
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static INT_PTR CALLBACK page_with_custom_default_button_dlg_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:543
#define U(x)
Definition: wordpad.c:44
static BOOL add_button_has_been_pressed
Definition: propsheet.c:540
LPCSTR pszCaption
Definition: prsht.h:248
LPCSTR pszTitle
Definition: prsht.h:188
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define DM_SETDEFID
Definition: winuser.h:2081
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PSH_MODELESS
Definition: prsht.h:50
BOOL WINAPI DestroyWindow(_In_ HWND)
#define VK_RETURN
Definition: winuser.h:2176
#define PSM_ISDIALOGMESSAGE
Definition: prsht.h:96
#define DM_GETDEFID
Definition: winuser.h:2080
HWND hwndParent
Definition: prsht.h:242
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DC_HASDEFID
Definition: winuser.h:2584
HINSTANCE hInstance
Definition: prsht.h:179
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
Definition: module.h:566
const char * LPCSTR
Definition: xmlstorage.h:183
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_PS_PUSHBUTTON1
Definition: resources.h:50
DWORD dwSize
Definition: prsht.h:240
#define PSM_GETCURRENTPAGEHWND
Definition: prsht.h:81
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define PSP_USETITLE
Definition: prsht.h:26
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define IDC_PS_COMBO1
Definition: resources.h:49
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HIWORD(l)
Definition: typedefs.h:246
struct _PROPSHEETPAGEA PROPSHEETPAGEA
HINSTANCE hInstance
Definition: prsht.h:243
#define PM_REMOVE
Definition: winuser.h:1182
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
#define LOWORD(l)
Definition: pedump.c:82
DLGPROC pfnDlgProc
Definition: prsht.h:189
#define IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON
Definition: resources.h:39

Referenced by START_TEST().

◆ test_disableowner()

static void test_disableowner ( void  )
static

Definition at line 252 of file propsheet.c.

253 {
254  HPROPSHEETPAGE hpsp[1];
255  PROPSHEETPAGEA psp;
256  PROPSHEETHEADERA psh;
257  INT_PTR p;
258 
260  parenthwnd = CreateWindowA("parent class", "", WS_CAPTION | WS_SYSMENU | WS_VISIBLE, 100, 100, 100, 100, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), 0);
261 
262  memset(&psp, 0, sizeof(psp));
263  psp.dwSize = sizeof(psp);
264  psp.dwFlags = 0;
266  U(psp).pszTemplate = "prop_page1";
267  U2(psp).pszIcon = NULL;
268  psp.pfnDlgProc = NULL;
269  psp.lParam = 0;
270 
271  hpsp[0] = pCreatePropertySheetPageA(&psp);
272 
273  memset(&psh, 0, sizeof(psh));
275  psh.dwFlags = PSH_USECALLBACK;
276  psh.pszCaption = "test caption";
277  psh.nPages = 1;
278  psh.hwndParent = parenthwnd;
279  U3(psh).phpage = hpsp;
281 
282  p = pPropertySheetA(&psh);
283  ok(p == 0, "Expected 0, got %ld\n", p);
284  ok(IsWindowEnabled(parenthwnd) != 0, "parent window should be enabled\n");
286 }
static HWND parenthwnd
Definition: propsheet.c:33
DWORD dwSize
Definition: prsht.h:177
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define U3(x)
Definition: wordpad.c:46
int32_t INT_PTR
Definition: typedefs.h:62
#define PSH_USECALLBACK
Definition: prsht.h:48
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND hwndParent
Definition: prsht.h:242
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
HINSTANCE hInstance
Definition: prsht.h:179
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:258
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define WS_CAPTION
Definition: pedump.c:624
DWORD dwSize
Definition: prsht.h:240
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
static int CALLBACK disableowner_callback(HWND hwnd, UINT msg, LPARAM lparam)
Definition: propsheet.c:221
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define ok(value,...)
Definition: atltest.h:57
GLfloat GLfloat p
Definition: glext.h:8902
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
DLGPROC pfnDlgProc
Definition: prsht.h:189
static void register_parent_wnd_class(void)
Definition: propsheet.c:235

Referenced by START_TEST().

◆ test_messages()

static void test_messages ( void  )
static

Definition at line 790 of file propsheet.c.

791 {
792  HPROPSHEETPAGE hpsp[1];
793  PROPSHEETPAGEA psp;
794  PROPSHEETHEADERA psh;
795  HWND hdlg;
796 
798 
799  memset(&psp, 0, sizeof(psp));
800  psp.dwSize = sizeof(psp);
801  psp.dwFlags = 0;
803  U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST);
804  U2(psp).pszIcon = NULL;
806  psp.lParam = 0;
807 
808  hpsp[0] = pCreatePropertySheetPageA(&psp);
809 
810  memset(&psh, 0, sizeof(psh));
814  psh.pszCaption = "test caption";
815  psh.nPages = 1;
817  U3(psh).phpage = hpsp;
819 
820  hdlg = (HWND)pPropertySheetA(&psh);
821  ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
822 
823  ShowWindow(hdlg,SW_NORMAL);
824 
825  ok_sequence(sequences, PROPSHEET_SEQ_INDEX, property_sheet_seq, "property sheet with custom window proc", TRUE);
826 
827  DestroyWindow(hdlg);
828 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define SW_NORMAL
Definition: winuser.h:763
#define TRUE
Definition: types.h:120
static int CALLBACK sheet_callback_messages(HWND hwnd, UINT msg, LPARAM lParam)
Definition: propsheet.c:767
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
DWORD dwSize
Definition: prsht.h:177
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define PSH_WIZARD
Definition: prsht.h:45
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PSH_MODELESS
Definition: prsht.h:50
#define PSH_USECALLBACK
Definition: prsht.h:48
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PSH_USEICONID
Definition: prsht.h:42
static const struct message property_sheet_seq[]
Definition: propsheet.c:639
HWND hwndParent
Definition: prsht.h:242
#define NUM_MSG_SEQUENCES
Definition: propsheet.c:633
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: propsheet.c:636
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
HINSTANCE hInstance
Definition: prsht.h:179
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:258
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD dwSize
Definition: prsht.h:240
#define PROPSHEET_SEQ_INDEX
Definition: propsheet.c:634
static INT_PTR CALLBACK page_dlg_proc_messages(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:782
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39
DLGPROC pfnDlgProc
Definition: prsht.h:189
#define IDD_PROP_PAGE_MESSAGE_TEST
Definition: resources.h:40

Referenced by run_test_(), and START_TEST().

◆ test_nopage()

static void test_nopage ( void  )
static

Definition at line 174 of file propsheet.c.

175 {
176  HPROPSHEETPAGE hpsp[1];
177  PROPSHEETPAGEA psp;
178  PROPSHEETHEADERA psh;
179  HWND hdlg, hpage;
180  MSG msg;
181 
182  memset(&psp, 0, sizeof(psp));
183  psp.dwSize = sizeof(psp);
184  psp.dwFlags = 0;
186  U(psp).pszTemplate = "prop_page1";
187  U2(psp).pszIcon = NULL;
189  psp.lParam = 0;
190 
191  hpsp[0] = pCreatePropertySheetPageA(&psp);
192 
193  memset(&psh, 0, sizeof(psh));
196  psh.pszCaption = "test caption";
197  psh.nPages = 1;
199  U3(psh).phpage = hpsp;
201 
202  hdlg = (HWND)pPropertySheetA(&psh);
203  ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
204 
205  ShowWindow(hdlg,SW_NORMAL);
206  SendMessageA(hdlg, PSM_REMOVEPAGE, 0, 0);
207  hpage = /* PropSheet_GetCurrentPageHwnd(hdlg); */
209  active_page = /* PropSheet_HwndToIndex(hdlg, hpage)); */
210  (int)SendMessageA(hdlg, PSM_HWNDTOINDEX, (WPARAM)hpage, 0);
211  ok(hpage == NULL, "expected no current page, got %p, index=%d\n", hpage, active_page);
212  flush_events();
214 
215  /* Check that the property sheet was fully redrawn */
217  "expected no pending WM_PAINT messages\n");
218  DestroyWindow(hdlg);
219 }
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:101
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define SW_NORMAL
Definition: winuser.h:763
DWORD dwSize
Definition: prsht.h:177
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define PSM_REMOVEPAGE
Definition: prsht.h:166
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PSH_MODELESS
Definition: prsht.h:50
#define PSH_USECALLBACK
Definition: prsht.h:48
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PM_NOREMOVE
Definition: winuser.h:1181
static LONG active_page
Definition: propsheet.c:37
HWND hwndParent
Definition: prsht.h:242
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
Definition: propsheet.c:70
HINSTANCE hInstance
Definition: prsht.h:179
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:258
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
DWORD dwSize
Definition: prsht.h:240
#define PSM_GETCURRENTPAGEHWND
Definition: prsht.h:81
LPARAM lParam
Definition: prsht.h:190
#define WM_PAINT
Definition: winuser.h:1602
static void flush_events(void)
Definition: propsheet.c:54
DWORD dwFlags
Definition: prsht.h:241
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define RDW_ERASENOW
Definition: winuser.h:1205
#define memset(x, y, z)
Definition: compat.h:39
DLGPROC pfnDlgProc
Definition: prsht.h:189
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by START_TEST().

◆ test_PSM_ADDPAGE()

static void test_PSM_ADDPAGE ( void  )
static

Definition at line 830 of file propsheet.c.

831 {
832  HPROPSHEETPAGE hpsp[5];
833  PROPSHEETPAGEA psp;
834  PROPSHEETHEADERA psh;
835  HWND hdlg, tab;
836  BOOL ret;
837  DWORD r;
838 
839  memset(&psp, 0, sizeof(psp));
840  psp.dwSize = sizeof(psp);
841  psp.dwFlags = 0;
843  U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST);
844  U2(psp).pszIcon = NULL;
846  psp.lParam = 0;
847 
848  /* multiple pages with the same data */
849  hpsp[0] = pCreatePropertySheetPageA(&psp);
850  hpsp[1] = pCreatePropertySheetPageA(&psp);
851  hpsp[2] = pCreatePropertySheetPageA(&psp);
852 
853  U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
854  hpsp[3] = pCreatePropertySheetPageA(&psp);
855 
856  psp.dwFlags = PSP_PREMATURE;
857  hpsp[4] = pCreatePropertySheetPageA(&psp);
858 
859  memset(&psh, 0, sizeof(psh));
861  psh.dwFlags = PSH_MODELESS;
862  psh.pszCaption = "test caption";
863  psh.nPages = 1;
865  U3(psh).phpage = hpsp;
866 
867  hdlg = (HWND)pPropertySheetA(&psh);
868  ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
869 
870  /* add pages one by one */
871  ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[1]);
872  ok(ret == TRUE, "got %d\n", ret);
873 
874  /* try with null and invalid value */
875  ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, 0);
876  ok(ret == FALSE, "got %d\n", ret);
877 
878 if (0)
879 {
880  /* crashes on native */
882 }
883  /* check item count */
884  tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
885 
886  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
887  ok(r == 2, "got %d\n", r);
888 
889  ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[2]);
890  ok(ret == TRUE, "got %d\n", ret);
891 
892  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
893  ok(r == 3, "got %d\n", r);
894 
895  /* add property sheet page that can't be created */
896  ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[3]);
897  ok(ret == TRUE, "got %d\n", ret);
898 
899  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
900  ok(r == 4, "got %d\n", r);
901 
902  /* select page that can't be created */
903  ret = SendMessageA(hdlg, PSM_SETCURSEL, 3, 1);
904  ok(ret == TRUE, "got %d\n", ret);
905 
906  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
907  ok(r == 3, "got %d\n", r);
908 
909  /* test PSP_PREMATURE flag with incorrect property sheet page */
910  ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[4]);
911  ok(ret == FALSE, "got %d\n", ret);
912 
913  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
914  ok(r == 3, "got %d\n", r);
915 
916  pDestroyPropertySheetPage(hpsp[4]);
917  DestroyWindow(hdlg);
918 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
DWORD dwSize
Definition: prsht.h:177
#define PSM_GETTABCONTROL
Definition: prsht.h:80
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define IDD_PROP_PAGE_ERROR
Definition: resources.h:41
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define PSH_MODELESS
Definition: prsht.h:50
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PSM_SETCURSEL
Definition: prsht.h:167
HWND hwndParent
Definition: prsht.h:242
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HINSTANCE hInstance
Definition: prsht.h:179
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD dwSize
Definition: prsht.h:240
static INT_PTR CALLBACK page_dlg_proc_messages(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:782
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define PSM_ADDPAGE
Definition: prsht.h:165
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define ok(value,...)
Definition: atltest.h:57
#define PSP_PREMATURE
Definition: prsht.h:31
#define memset(x, y, z)
Definition: compat.h:39
#define TCM_GETITEMCOUNT
Definition: commctrl.h:3964
DLGPROC pfnDlgProc
Definition: prsht.h:189
#define IDD_PROP_PAGE_MESSAGE_TEST
Definition: resources.h:40

Referenced by START_TEST().

◆ test_PSM_INSERTPAGE()

static void test_PSM_INSERTPAGE ( void  )
static

Definition at line 920 of file propsheet.c.

921 {
922  HPROPSHEETPAGE hpsp[5];
923  PROPSHEETPAGEA psp;
924  PROPSHEETHEADERA psh;
925  HWND hdlg, tab;
926  BOOL ret;
927  DWORD r;
928 
929  memset(&psp, 0, sizeof(psp));
930  psp.dwSize = sizeof(psp);
931  psp.dwFlags = 0;
933  U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST);
934  U2(psp).pszIcon = NULL;
936  psp.lParam = 0;
937 
938  /* multiple pages with the same data */
939  hpsp[0] = pCreatePropertySheetPageA(&psp);
940  hpsp[1] = pCreatePropertySheetPageA(&psp);
941  hpsp[2] = pCreatePropertySheetPageA(&psp);
942 
943  U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
944  hpsp[3] = pCreatePropertySheetPageA(&psp);
945 
946  psp.dwFlags = PSP_PREMATURE;
947  hpsp[4] = pCreatePropertySheetPageA(&psp);
948 
949  memset(&psh, 0, sizeof(psh));
951  psh.dwFlags = PSH_MODELESS;
952  psh.pszCaption = "test caption";
953  psh.nPages = 1;
955  U3(psh).phpage = hpsp;
956 
957  hdlg = (HWND)pPropertySheetA(&psh);
958  ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
959 
960  /* add pages one by one */
961  ret = SendMessageA(hdlg, PSM_INSERTPAGE, 5, (LPARAM)hpsp[1]);
962  ok(ret == TRUE, "got %d\n", ret);
963 
964  /* try with invalid values */
965  ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, 0);
966  ok(ret == FALSE, "got %d\n", ret);
967 
968 if (0)
969 {
970  /* crashes on native */
971  ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)INVALID_HANDLE_VALUE);
972 }
973 
974  ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)INVALID_HANDLE_VALUE, (LPARAM)hpsp[2]);
975  ok(ret == FALSE, "got %d\n", ret);
976 
977  /* check item count */
978  tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
979 
980  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
981  ok(r == 2, "got %d\n", r);
982 
983  ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)hpsp[1], (LPARAM)hpsp[2]);
984  ok(ret == TRUE, "got %d\n", ret);
985 
986  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
987  ok(r == 3, "got %d\n", r);
988 
989  /* add property sheet page that can't be created */
990  ret = SendMessageA(hdlg, PSM_INSERTPAGE, 1, (LPARAM)hpsp[3]);
991  ok(ret == TRUE, "got %d\n", ret);
992 
993  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
994  ok(r == 4, "got %d\n", r);
995 
996  /* select page that can't be created */
997  ret = SendMessageA(hdlg, PSM_SETCURSEL, 1, 0);
998  ok(ret == TRUE, "got %d\n", ret);
999 
1000  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
1001  ok(r == 3, "got %d\n", r);
1002 
1003  /* test PSP_PREMATURE flag with incorrect property sheet page */
1004  ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)hpsp[4]);
1005  ok(ret == FALSE, "got %d\n", ret);
1006 
1007  r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
1008  ok(r == 3, "got %d\n", r);
1009 
1010  pDestroyPropertySheetPage(hpsp[4]);
1011  DestroyWindow(hdlg);
1012 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
DWORD dwSize
Definition: prsht.h:177
#define PSM_GETTABCONTROL
Definition: prsht.h:80
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define IDD_PROP_PAGE_ERROR
Definition: resources.h:41
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
UINT_PTR WPARAM
Definition: windef.h:207
#define PSH_MODELESS
Definition: prsht.h:50
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PSM_SETCURSEL
Definition: prsht.h:167
HWND hwndParent
Definition: prsht.h:242
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HINSTANCE hInstance
Definition: prsht.h:179
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD dwSize
Definition: prsht.h:240
static INT_PTR CALLBACK page_dlg_proc_messages(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: propsheet.c:782
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define ok(value,...)
Definition: atltest.h:57
#define PSP_PREMATURE
Definition: prsht.h:31
#define memset(x, y, z)
Definition: compat.h:39
#define TCM_GETITEMCOUNT
Definition: commctrl.h:3964
DLGPROC pfnDlgProc
Definition: prsht.h:189
#define IDD_PROP_PAGE_MESSAGE_TEST
Definition: resources.h:40

Referenced by START_TEST().

◆ test_title()

static void test_title ( void  )
static

Definition at line 135 of file propsheet.c.

136 {
137  HPROPSHEETPAGE hpsp[1];
138  PROPSHEETPAGEA psp;
139  PROPSHEETHEADERA psh;
140  HWND hdlg;
141  DWORD style;
142 
143  memset(&psp, 0, sizeof(psp));
144  psp.dwSize = sizeof(psp);
145  psp.dwFlags = 0;
147  U(psp).pszTemplate = "prop_page1";
148  U2(psp).pszIcon = NULL;
150  psp.lParam = 0;
151 
152  hpsp[0] = pCreatePropertySheetPageA(&psp);
153 
154  memset(&psh, 0, sizeof(psh));
157  psh.pszCaption = "test caption";
158  psh.nPages = 1;
160  U3(psh).phpage = hpsp;
162 
163  hdlg = (HWND)pPropertySheetA(&psh);
164  ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle value %p\n", hdlg);
165 
166  style = GetWindowLongA(hdlg, GWL_STYLE);
169  "got unexpected style: %x\n", style);
170 
171  DestroyWindow(hdlg);
172 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:101
DWORD dwSize
Definition: prsht.h:177
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define PSH_MODELESS
Definition: prsht.h:50
#define PSH_USECALLBACK
Definition: prsht.h:48
BOOL WINAPI DestroyWindow(_In_ HWND)
#define DS_MODALFRAME
Definition: winuser.h:375
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
HWND hwndParent
Definition: prsht.h:242
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
Definition: propsheet.c:70
HINSTANCE hInstance
Definition: prsht.h:179
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:258
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
#define WS_CAPTION
Definition: pedump.c:624
DWORD dwSize
Definition: prsht.h:240
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
#define DS_SETFONT
Definition: winuser.h:378
#define DS_CONTEXTHELP
Definition: winuser.h:371
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
DWORD dwFlags
Definition: prsht.h:178
#define U2(x)
Definition: wordpad.c:45
#define GWL_STYLE
Definition: winuser.h:846
#define DS_3DLOOK
Definition: winuser.h:367
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
DLGPROC pfnDlgProc
Definition: prsht.h:189

Referenced by START_TEST().

◆ test_wiznavigation()

static void test_wiznavigation ( void  )
static

Definition at line 343 of file propsheet.c.

344 {
345  HPROPSHEETPAGE hpsp[4];
346  PROPSHEETPAGEA psp[4];
347  PROPSHEETHEADERA psh;
348  HWND hdlg, control;
349  LONG_PTR controlID;
350  DWORD style;
351  LRESULT defidres;
352  BOOL hwndtoindex_supported = TRUE;
353  const INT nextID = 12324;
354  const INT backID = 12323;
355  HHOOK hook;
356 
357  /* set up a hook proc in order to subclass the main dialog early on */
359 
360  /* create the property sheet pages */
361  memset(psp, 0, sizeof(PROPSHEETPAGEA) * 4);
362 
363  psp[0].dwSize = sizeof(PROPSHEETPAGEA);
364  psp[0].hInstance = GetModuleHandleA(NULL);
365  U(psp[0]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_INTRO);
366  psp[0].pfnDlgProc = nav_page_proc;
367  hpsp[0] = pCreatePropertySheetPageA(&psp[0]);
368 
369  psp[1].dwSize = sizeof(PROPSHEETPAGEA);
370  psp[1].hInstance = GetModuleHandleA(NULL);
371  U(psp[1]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT);
372  psp[1].pfnDlgProc = nav_page_proc;
373  hpsp[1] = pCreatePropertySheetPageA(&psp[1]);
374 
375  psp[2].dwSize = sizeof(PROPSHEETPAGEA);
376  psp[2].hInstance = GetModuleHandleA(NULL);
377  U(psp[2]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_RADIO);
378  psp[2].pfnDlgProc = nav_page_proc;
379  hpsp[2] = pCreatePropertySheetPageA(&psp[2]);
380 
381  psp[3].dwSize = sizeof(PROPSHEETPAGEA);
382  psp[3].hInstance = GetModuleHandleA(NULL);
383  U(psp[3]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EXIT);
384  psp[3].pfnDlgProc = nav_page_proc;
385  hpsp[3] = pCreatePropertySheetPageA(&psp[3]);
386 
387  /* set up the property sheet dialog */
388  memset(&psh, 0, sizeof(psh));
391  psh.pszCaption = "A Wizard";
392  psh.nPages = 4;
394  U3(psh).phpage = hpsp;
395  hdlg = (HWND)pPropertySheetA(&psh);
396  ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
397 
398  ok(active_page == 0, "Active page should be 0. Is: %d\n", active_page);
399 
403  "got unexpected style: %x\n", style);
404 
405  control = GetFocus();
406  controlID = GetWindowLongPtrA(control, GWLP_ID);
407  ok(controlID == nextID, "Focus should have been set to the Next button. Expected: %d, Found: %ld\n", nextID, controlID);
408 
409  /* simulate pressing the Next button */
411  if (!active_page) hwndtoindex_supported = FALSE;
412  if (hwndtoindex_supported)
413  ok(active_page == 1, "Active page should be 1 after pressing Next. Is: %d\n", active_page);
414 
415  control = GetFocus();
416  controlID = GetWindowLongPtrA(control, GWLP_ID);
417  ok(controlID == IDC_PS_EDIT1, "Focus should be set to the first item on the second page. Expected: %d, Found: %ld\n", IDC_PS_EDIT1, controlID);
418 
419  defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
420  ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));
421 
422  /* set the focus to the second edit box on this page */
423  SetFocus(GetNextDlgTabItem(hdlg, control, FALSE));
424 
425  /* press next again */
427  if (hwndtoindex_supported)
428  ok(active_page == 2, "Active page should be 2 after pressing Next. Is: %d\n", active_page);
429 
430  control = GetFocus();
431  controlID = GetWindowLongPtrA(control, GWLP_ID);
432  ok(controlID == IDC_PS_RADIO1, "Focus should have been set to item on third page. Expected: %d, Found %ld\n", IDC_PS_RADIO1, controlID);
433 
434  /* back button */
436  if (hwndtoindex_supported)
437  ok(active_page == 1, "Active page should be 1 after pressing Back. Is: %d\n", active_page);
438 
439  control = GetFocus();
440  controlID = GetWindowLongPtrA(control, GWLP_ID);
441  ok(controlID == IDC_PS_EDIT1, "Focus should have been set to the first item on second page. Expected: %d, Found %ld\n", IDC_PS_EDIT1, controlID);
442 
443  defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
444  ok(defidres == MAKELRESULT(backID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", backID, LOWORD(defidres));
445 
446  /* press next twice */
448  if (hwndtoindex_supported)
449  ok(active_page == 2, "Active page should be 2 after pressing Next. Is: %d\n", active_page);
451  if (hwndtoindex_supported)
452  ok(active_page == 3, "Active page should be 3 after pressing Next. Is: %d\n", active_page);
453  else
454  active_page = 3;
455 
456  control = GetFocus();
457  controlID = GetWindowLongPtrA(control, GWLP_ID);
458  ok(controlID == nextID, "Focus should have been set to the Next button. Expected: %d, Found: %ld\n", nextID, controlID);
459 
460  /* try to navigate away, but shouldn't be able to */
462  ok(active_page == 3, "Active page should still be 3 after pressing Back. Is: %d\n", active_page);
463 
464  defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
465  ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));
466 
467  DestroyWindow(hdlg);
469 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
DWORD dwSize
Definition: prsht.h:177
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELRESULT(l, h)
Definition: winuser.h:3949
#define IDD_PROP_PAGE_EXIT
Definition: resources.h:37
#define U(x)
Definition: wordpad.c:44
LPCSTR pszCaption
Definition: prsht.h:248
#define U3(x)
Definition: wordpad.c:46
HANDLE HWND
Definition: compat.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
HWND WINAPI SetFocus(_In_opt_ HWND)
#define IDC_PS_RADIO1
Definition: resources.h:46
#define PSH_WIZARD
Definition: prsht.h:45
#define PSH_MODELESS
Definition: prsht.h:50
HWND WINAPI GetNextDlgTabItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
#define IDC_PS_EDIT1
Definition: resources.h:44
#define DM_GETDEFID
Definition: winuser.h:2080
#define DS_MODALFRAME
Definition: winuser.h:375
static LONG active_page
Definition: propsheet.c:37
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
HWND hwndParent
Definition: prsht.h:242
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DC_HASDEFID
Definition: winuser.h:2584
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HINSTANCE hInstance
Definition: prsht.h:179
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define PROPSHEETHEADERA_V1_SIZE
Definition: prsht.h:272
#define WH_CBT
Definition: winuser.h:35
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define GetWindowLongPtrA
Definition: winuser.h:4729
#define WS_CAPTION
Definition: pedump.c:624
Definition: msg.h:42
DWORD dwSize
Definition: prsht.h:240
#define IDD_PROP_PAGE_EDIT
Definition: resources.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDD_PROP_PAGE_RADIO
Definition: resources.h:36
DWORD dwFlags
Definition: prsht.h:241
#define DS_SETFONT
Definition: winuser.h:378
#define DS_CONTEXTHELP
Definition: winuser.h:371
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define PSBTN_NEXT
Definition: prsht.h:147
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define GWL_STYLE
Definition: winuser.h:846
#define IDD_PROP_PAGE_INTRO
Definition: resources.h:34
#define DS_3DLOOK
Definition: winuser.h:367
static INT_PTR CALLBACK nav_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: propsheet.c:288
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_POPUP
Definition: pedump.c:616
HWND WINAPI GetFocus(void)
Definition: window.c:1905
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
struct _PROPSHEETPAGEA PROPSHEETPAGEA
#define PSM_PRESSBUTTON
Definition: prsht.h:100
LONG_PTR LRESULT
Definition: windef.h:209
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
#define PSBTN_BACK
Definition: prsht.h:146
#define LOWORD(l)
Definition: pedump.c:82
static LRESULT CALLBACK hook_proc(int code, WPARAM wp, LPARAM lp)
Definition: propsheet.c:325
DLGPROC pfnDlgProc
Definition: prsht.h:189
#define GWLP_ID
Definition: winuser.h:854

Referenced by START_TEST().

Variable Documentation

◆ active_page

LONG active_page = -1
static

◆ add_button_has_been_pressed

BOOL add_button_has_been_pressed
static

◆ old_nav_dialog_proc

WNDPROC old_nav_dialog_proc
static

Definition at line 312 of file propsheet.c.

Referenced by hook_proc(), and new_nav_dialog_proc().

◆ oldWndProc

WNDPROC oldWndProc
static

Definition at line 637 of file propsheet.c.

Referenced by sheet_callback_messages(), and sheet_callback_messages_proc().

◆ parenthwnd

HWND parenthwnd
static

Definition at line 33 of file propsheet.c.

Referenced by disableowner_callback(), and test_disableowner().

◆ property_sheet_seq

const struct message property_sheet_seq[]
static

Definition at line 639 of file propsheet.c.

Referenced by test_messages().

◆ rtl

◆ sequences

Definition at line 636 of file propsheet.c.

Referenced by save_message(), and test_messages().

◆ sheethwnd

HWND sheethwnd
static

Definition at line 34 of file propsheet.c.

Referenced by page_dlg_proc(), and sheet_callback().