ReactOS 0.4.15-dev-7788-g1ad9096
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];
21 BOOL ret;
22
23 SetLastError(0xfeedfab1);
26 ok(ret == FALSE, "ret = %d\n", ret);
27 ok(error == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", error);
28
29 SetLastError(0xfeedfab1);
32 ok(ret == FALSE, "ret = %d\n", ret);
33 ok(error == ERROR_NOACCESS, "error = %lu\n", error);
34
35 SetLastError(0xfeedfab1);
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);
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);
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);
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);
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);
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);
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);
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 ALIGN_UP_BY(size, align)
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
#define error(str)
Definition: mkdosfs.c:1605
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
void * PVOID
Definition: typedefs.h:50
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define ERROR_NOACCESS
Definition: winerror.h:578
#define SW_SHOWNORMAL
Definition: winuser.h:770
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
struct _WINDOWPLACEMENT WINDOWPLACEMENT
unsigned char BYTE
Definition: xxhash.c:193