ReactOS  0.4.14-dev-384-g5b37caa
NtGdiSelectBrush.c File Reference
#include <win32nt.h>
Include dependency graph for NtGdiSelectBrush.c:

Go to the source code of this file.

Functions

 START_TEST (NtGdiSelectBrush)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtGdiSelectBrush  )

Definition at line 10 of file NtGdiSelectBrush.c.

11 {
12  HDC hDC;
13  HBRUSH hBrush, hOldBrush;
14  DC_ATTR *pdcattr;
15 
16  hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
17 
18  hBrush = GetStockObject(GRAY_BRUSH);
19 
20  /* Test NULL DC */
22  hOldBrush = NtGdiSelectBrush(NULL, hBrush);
23  TEST(hOldBrush == NULL);
25 
26  /* Test invalid DC */
28  hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush);
29  TEST(hOldBrush == NULL);
31 
32  /* Test NULL brush */
34  hOldBrush = NtGdiSelectBrush(hDC, NULL);
35  TEST(hOldBrush == NULL);
37 
38  /* Test invalid brush */
40  hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff));
41  TEST(hOldBrush == NULL);
43 
45  hOldBrush = NtGdiSelectBrush(hDC, hBrush);
46  TEST(hOldBrush != NULL);
47  hOldBrush = NtGdiSelectBrush(hDC, hOldBrush);
48  TEST(hOldBrush == hBrush);
50 
51  /* Begin with a white brush */
53  /* Select a brush in user mode */
55  /* See what we get returned */
57  TEST(hOldBrush == GetStockObject(BLACK_BRUSH));
58 
59 
60  /* Begin with a white brush */
62 
63  pdcattr = GdiGetHandleUserData(hDC);
64  /* Change the brush in user mode, without setting flags */
65  pdcattr->hbrush = (HBRUSH)12345;
66 
68  TEST(hOldBrush == (HBRUSH)12345);
69 
70 
71  DeleteDC(hDC);
72 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define ERROR_SUCCESS
Definition: deptool.c:10
HANDLE hbrush
Definition: ntgdihdl.h:299
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define WHITE_BRUSH
Definition: wingdi.h:901
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define GRAY_BRUSH
Definition: wingdi.h:897
#define BLACK_BRUSH
Definition: wingdi.h:895
#define TEST(x)
Definition: precomp.h:20
#define SetLastError(x)
Definition: compat.h:417
static const WCHAR L[]
Definition: oid.c:1250
static HDC hDC
Definition: 3dtext.c:33
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68
BOOL WINAPI DeleteDC(_In_ HDC)
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)