ReactOS  0.4.12-dev-918-g6c6e7b8
GetWindowPlacement.c File Reference
#include "precomp.h"
Include dependency graph for GetWindowPlacement.c:

Go to the source code of this file.

Macros

#define ALIGN_DOWN_BY(size, align)   ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
 
#define ALIGN_UP_BY(size, align)   (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
 

Functions

 START_TEST (GetWindowPlacement)
 

Macro Definition Documentation

◆ ALIGN_DOWN_BY

#define ALIGN_DOWN_BY (   size,
  align 
)    ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))

Definition at line 10 of file GetWindowPlacement.c.

◆ ALIGN_UP_BY

#define ALIGN_UP_BY (   size,
  align 
)    (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))

Definition at line 13 of file GetWindowPlacement.c.

Function Documentation

◆ START_TEST()

START_TEST ( GetWindowPlacement  )

Definition at line 16 of file GetWindowPlacement.c.

17 {
18  BYTE buffer[sizeof(WINDOWPLACEMENT) + 16];
20  DWORD error;
21  BOOL ret;
22 
23  SetLastError(0xfeedfab1);
25  error = GetLastError();
26  ok(ret == FALSE, "ret = %d\n", ret);
27  ok(error == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", error);
28 
29  SetLastError(0xfeedfab1);
31  error = GetLastError();
32  ok(ret == FALSE, "ret = %d\n", ret);
33  ok(error == ERROR_NOACCESS, "error = %lu\n", error);
34 
35  SetLastError(0xfeedfab1);
37  error = GetLastError();
38  ok(ret == FALSE, "ret = %d\n", ret);
39  ok(error == ERROR_NOACCESS, "error = %lu\n", error);
40 
41  FillMemory(buffer, sizeof(buffer), 0x55);
42  SetLastError(0xfeedfab1);
44  error = GetLastError();
45  ok(ret == TRUE, "ret = %d\n", ret);
46  ok(error == 0xfeedfab1, "error = %lu\n", error);
47 
48  FillMemory(wp, sizeof(*wp), 0x55);
49  wp->length = 0;
50  SetLastError(0xfeedfab1);
52  error = GetLastError();
53  ok(ret == FALSE, "ret = %d\n", ret);
54  ok(error == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", error);
55  ok(wp->length == 0, "wp.length = %u\n", wp->length);
56 
57  FillMemory(wp, sizeof(*wp), 0x55);
58  wp->length = 0;
59  SetLastError(0xfeedfab1);
61  error = GetLastError();
62  ok(ret == TRUE, "ret = %d\n", ret);
63  ok(error == 0xfeedfab1, "error = %lu\n", error);
64  ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
65  ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
66 
67  FillMemory(wp, sizeof(*wp), 0x55);
68  wp->length = 1;
69  SetLastError(0xfeedfab1);
71  error = GetLastError();
72  ok(ret == TRUE, "ret = %d\n", ret);
73  ok(error == 0xfeedfab1, "error = %lu\n", error);
74  ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
75  ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
76 
77  FillMemory(wp, sizeof(*wp), 0x55);
78  wp->length = sizeof(*wp) - 1;
79  SetLastError(0xfeedfab1);
81  error = GetLastError();
82  ok(ret == TRUE, "ret = %d\n", ret);
83  ok(error == 0xfeedfab1, "error = %lu\n", error);
84  ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
85  ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
86 
87  FillMemory(wp, sizeof(*wp), 0x55);
88  wp->length = sizeof(*wp) + 1;
89  SetLastError(0xfeedfab1);
91  error = GetLastError();
92  ok(ret == TRUE, "ret = %d\n", ret);
93  ok(error == 0xfeedfab1, "error = %lu\n", error);
94  ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
95  ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
96 
97  FillMemory(wp, sizeof(*wp), 0x55);
98  wp->length = sizeof(*wp);
99  SetLastError(0xfeedfab1);
101  error = GetLastError();
102  ok(ret == TRUE, "ret = %d\n", ret);
103  ok(error == 0xfeedfab1, "error = %lu\n", error);
104  ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
105  ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
106  ok(wp->showCmd == SW_SHOWNORMAL, "wp.showCmd = %u\n", wp->showCmd);
107  ok(wp->ptMinPosition.x == -1, "wp.ptMinPosition.x = %ld\n", wp->ptMinPosition.x);
108  ok(wp->ptMinPosition.y == -1, "wp.ptMinPosition.x = %ld\n", wp->ptMinPosition.y);
109  ok(wp->ptMaxPosition.x == -1, "wp.ptMaxPosition.x = %ld\n", wp->ptMaxPosition.x);
110  ok(wp->ptMaxPosition.y == -1, "wp.ptMaxPosition.y = %ld\n", wp->ptMaxPosition.y);
111  ok(wp->rcNormalPosition.left == 0, "wp.rcNormalPosition.left = %ld\n", wp->rcNormalPosition.left);
112  ok(wp->rcNormalPosition.top == 0, "wp.rcNormalPosition.top = %ld\n", wp->rcNormalPosition.top);
113  ok(wp->rcNormalPosition.right != 0 &&
114  wp->rcNormalPosition.right != 0x55555555, "wp.rcNormalPosition.right = %ld\n", wp->rcNormalPosition.right);
115  ok(wp->rcNormalPosition.bottom != 0 &&
116  wp->rcNormalPosition.bottom != 0x55555555, "wp.rcNormalPosition.bottom = %ld\n", wp->rcNormalPosition.bottom);
117 }
#define TRUE
Definition: types.h:120
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
#define ERROR_NOACCESS
Definition: winerror.h:578
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
void * PVOID
Definition: retypes.h:9
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define ok(value,...)
Definition: CComObject.cpp:34
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
#define SetLastError(x)
Definition: compat.h:409
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
unsigned char BYTE
Definition: mem.h:68
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define ALIGN_UP_BY(size, align)