ReactOS  0.4.14-dev-49-gfb4591c
SetProp.c File Reference
#include "precomp.h"
Include dependency graph for SetProp.c:

Go to the source code of this file.

Functions

static BOOL CALLBACK EnumFunc (_In_ HWND hWnd, _In_ PCWSTR lpszString, _In_ HANDLE hData)
 
static BOOL CALLBACK EnumFuncEx (_In_ HWND hWnd, _In_ PWSTR lpszString, _In_ HANDLE hData, _In_ ULONG_PTR dwData)
 
 START_TEST (SetProp)
 

Variables

static ATOM Atom1
 
static ATOM Atom2
 
static ATOM Atom3
 

Function Documentation

◆ EnumFunc()

static BOOL CALLBACK EnumFunc ( _In_ HWND  hWnd,
_In_ PCWSTR  lpszString,
_In_ HANDLE  hData 
)
static

Definition at line 15 of file SetProp.c.

19 {
20  if (HIWORD(lpszString))
21  ok(0, "Unexpected EnumFunc call: %p, '%ls', %p\n", hWnd, lpszString, hData);
22  else
23  ok(0, "Unexpected EnumFunc call: %p, 0x%04x, %p\n", hWnd, (USHORT)(ULONG_PTR)lpszString, hData);
24  return TRUE;
25 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
uint32_t ULONG_PTR
Definition: typedefs.h:63
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
#define HIWORD(l)
Definition: typedefs.h:246

Referenced by EnumDesktopsA(), EnumDesktopsW(), EnumNamesA(), EnumWindowStationsA(), EnumWindowStationsW(), and START_TEST().

◆ EnumFuncEx()

static BOOL CALLBACK EnumFuncEx ( _In_ HWND  hWnd,
_In_ PWSTR  lpszString,
_In_ HANDLE  hData,
_In_ ULONG_PTR  dwData 
)
static

Definition at line 30 of file SetProp.c.

35 {
36  if (dwData == 0)
37  {
38  if (HIWORD(lpszString))
39  ok(0, "Unexpected EnumFuncEx call: %p, '%ls', %p\n", hWnd, lpszString, hData);
40  else
41  ok(0, "Unexpected EnumFuncEx call: %p, 0x%04x, %p\n", hWnd, (USHORT)(ULONG_PTR)lpszString, hData);
42  }
43  else
44  {
45  if (HIWORD(lpszString))
46  {
47  if (!wcscmp(lpszString, L"PropTestAtom1"))
48  ok(hData == &Atom1, "EnumFuncEx: %p, '%ls', %p; expected %p\n", hWnd, lpszString, hData, &Atom1);
49  else if (!wcscmp(lpszString, L"PropTestAtom2"))
50  ok(hData == &Atom2, "EnumFuncEx: %p, '%ls', %p; expected %p\n", hWnd, lpszString, hData, &Atom2);
51  else
52  ok(0, "Unexpected EnumFuncEx call: %p, '%ls', %p\n", hWnd, lpszString, hData);
53  }
54  else
55  ok(0, "Unexpected EnumFuncEx call: %p, 0x%04x, %p\n", hWnd, (USHORT)(ULONG_PTR)lpszString, hData);
56  }
57  return TRUE;
58 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
static HANDLE ULONG_PTR dwData
Definition: file.c:35
uint32_t ULONG_PTR
Definition: typedefs.h:63
static ATOM Atom2
Definition: SetProp.c:10
static const WCHAR L[]
Definition: oid.c:1250
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static ATOM Atom1
Definition: SetProp.c:10
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
#define HIWORD(l)
Definition: typedefs.h:246

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( SetProp  )

Definition at line 60 of file SetProp.c.

61 {
62  HWND hWnd;
63  MSG msg;
64  UINT Atom;
65  HANDLE Prop;
67  ATOM SysICAtom;
68  ATOM SysICSAtom;
69  HICON hIcon;
70  HICON hIcon2;
71 
72  Atom1 = GlobalAddAtomW(L"PropTestAtom1");
73  ok(Atom1 != 0, "PropTestAtom1 is 0x%04x\n", Atom1);
74  ok(Atom1 >= 0xc000, "PropTestAtom1 is 0x%04x\n", Atom1);
75  ok(Atom1 >= 0xc018, "PropTestAtom1 is 0x%04x\n", Atom1);
76 
77  /* These are not in the global atom table */
78  Atom = GlobalFindAtomW(L"SysIC");
79  ok(Atom == 0, "SysIC atom is 0x%04x\n", Atom);
80  Atom = GlobalFindAtomW(L"SysICS");
81  ok(Atom == 0, "SysICS atom is 0x%04x\n", Atom);
82 
83  SetCursorPos(0, 0);
84 
86 
87  hWnd = CreateWindowExW(0, L"PropTest", NULL, 0, 10, 10, 20, 20, NULL, NULL, 0, NULL);
88 
90  if (0) // Windows returns an uninitialized value here
91  ok(Result == TRUE, "EnumProps returned %Iu\n", Result);
93  if (0) // Windows returns an uninitialized value here
94  ok(Result == TRUE, "EnumPropsEx returned %Iu\n", Result);
95 
96  Atom2 = GlobalAddAtomW(L"PropTestAtom2");
97  ok(Atom2 != 0, "PropTestAtom2 is 0x%04x\n", Atom2);
98  ok(Atom2 >= 0xc000, "PropTestAtom2 is 0x%04x\n", Atom2);
99  ok(Atom2 >= 0xc018, "PropTestAtom2 is 0x%04x\n", Atom2);
100 
101  while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
103 
105  if (0) // Windows returns an uninitialized value here
106  ok(Result == TRUE, "EnumPropsEx returned %Iu\n", Result);
107 
109  ok(Result == TRUE, "SetProp returned %Iu\n", Result);
111  ok(Result == TRUE, "SetProp returned %Iu\n", Result);
112  Prop = GetPropW(hWnd, (PCWSTR)MAKEINTATOM(Atom2));
113  ok(Prop == &Atom3, "GetProp returned %p, expected %p\n", Prop, &Atom3);
115  ok(Result == TRUE, "SetProp returned %Iu\n", Result);
116  Prop = GetPropW(hWnd, (PCWSTR)MAKEINTATOM(Atom2));
117  ok(Prop == &Atom2, "GetProp returned %p, expected %p\n", Prop, &Atom2);
118  Prop = GetPropW(hWnd, L"PropTestAtom2");
119  ok(Prop == &Atom2, "GetProp returned %p, expected %p\n", Prop, &Atom2);
120  Prop = GetPropA(hWnd, "PropTestAtom2");
121  ok(Prop == &Atom2, "GetProp returned %p, expected %p\n", Prop, &Atom2);
122 
124  ok(Result == TRUE, "EnumPropsEx returned %Iu\n", Result);
125 
127  ok(hIcon != NULL, "LoadImage failed with %lu\n", GetLastError());
128  /* Should not have any icon */
129  hIcon2 = (HICON)SendMessageW(hWnd, WM_GETICON, ICON_BIG, 0);
130  ok(hIcon2 == NULL, "WM_GETICON returned %p, expected NULL\n", hIcon2);
131  hIcon2 = (HICON)SendMessageW(hWnd, WM_GETICON, ICON_SMALL, 0);
132  ok(hIcon2 == NULL, "WM_GETICON returned %p, expected NULL\n", hIcon2);
133 
134  /* Set big icon, should also set small icon */
135  Result = SendMessageW(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
136  ok(Result == 0, "WM_SETICON returned 0x%Ix\n", Result);
137 
138  hIcon2 = (HICON)SendMessageW(hWnd, WM_GETICON, ICON_BIG, 0);
139  ok(hIcon2 == hIcon, "WM_GETICON returned %p, expected %p\n", hIcon2, hIcon);
140  hIcon2 = (HICON)SendMessageW(hWnd, WM_GETICON, ICON_SMALL, 0);
141  ok(hIcon2 != hIcon && hIcon != NULL, "WM_GETICON returned %p, expected not %p and not NULL\n", hIcon2, hIcon);
142 
143  while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
145 
146  /* We should have only the props that we explicitly set */
147  for (Atom = 0x0000; Atom <= 0xffff; Atom++)
148  {
149  Prop = GetPropW(hWnd, (PCWSTR)MAKEINTATOM(Atom));
150  if (Atom == Atom1)
151  ok(Prop == &Atom1, "Window %p Prop 0x%04x = %p, expected %p\n", hWnd, Atom, Prop, &Atom1);
152  else if (Atom == Atom2)
153  ok(Prop == &Atom2, "Window %p Prop 0x%04x = %p, expected %p\n", hWnd, Atom, Prop, &Atom2);
154  else
155  ok(Prop == NULL, "Window %p Prop 0x%04x = %p\n", hWnd, Atom, Prop);
156  }
157 
158  /* In particular we shouldn't see these from WM_SETICON */
159  SysICAtom = RegisterWindowMessageW(L"SysIC");
160  Prop = GetPropW(hWnd, (PCWSTR)MAKEINTATOM(SysICAtom));
161  ok(Prop == NULL, "SysIC prop (0x%04x) is %p\n", SysICAtom, Prop);
162 
163  SysICSAtom = RegisterWindowMessageW(L"SysICS");
164  Prop = GetPropW(hWnd, (PCWSTR)MAKEINTATOM(SysICSAtom));
165  ok(Prop == NULL, "SysICS prop (0x%04x) is %p\n", SysICSAtom, Prop);
166 
169 
171 
172  while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
174  }
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
#define MAKEINTRESOURCE
Definition: winuser.h:591
const uint16_t * PCWSTR
Definition: typedefs.h:55
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
static HICON
Definition: imagelist.c:84
#define PeekMessage
Definition: winuser.h:5731
#define TRUE
Definition: types.h:120
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
WORD ATOM
Definition: dimm.idl:113
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString)
Definition: atom.c:474
_Out_ RTL_ATOM * Atom
Definition: class.h:54
BOOL WINAPI DestroyWindow(_In_ HWND)
#define OIC_NOTE
Definition: winuser.h:1152
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL CALLBACK EnumFuncEx(_In_ HWND hWnd, _In_ PWSTR lpszString, _In_ HANDLE hData, _In_ ULONG_PTR dwData)
Definition: SetProp.c:30
#define ICON_SMALL
Definition: tnclass.cpp:48
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL CALLBACK EnumFunc(_In_ HWND hWnd, _In_ PCWSTR lpszString, _In_ HANDLE hData)
Definition: SetProp.c:15
static ATOM Atom2
Definition: SetProp.c:10
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
static HICON hIcon2
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
int WINAPI EnumPropsExW(_In_ HWND, _In_ PROPENUMPROCEXW, _In_ LPARAM)
int WINAPI EnumPropsW(_In_ HWND, _In_ PROPENUMPROCW)
static ATOM Atom3
Definition: SetProp.c:10
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
static ATOM Atom1
Definition: SetProp.c:10
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182
LONG_PTR LRESULT
Definition: windef.h:209
#define MAKEINTATOM(i)
Definition: winbase.h:1416
#define ICON_BIG
Definition: tnclass.cpp:51

Variable Documentation

◆ Atom1

ATOM Atom1
static

Definition at line 10 of file SetProp.c.

Referenced by EnumFuncEx(), START_TEST(), and test_NtAtom().

◆ Atom2

ATOM Atom2
static

Definition at line 10 of file SetProp.c.

Referenced by EnumFuncEx(), START_TEST(), and test_NtAtom().

◆ Atom3

ATOM Atom3
static

Definition at line 10 of file SetProp.c.

Referenced by START_TEST(), and test_NtAtom().