[GDI32API]
[reactos.git] / rostests / apitests / gdi32api / gdi32api.c
1 #include "gdi32api.h"
2
3 HINSTANCE g_hInstance;
4 PGDI_TABLE_ENTRY GdiHandleTable;
5
6 BOOL
7 IsFunctionPresent(LPWSTR lpszFunction)
8 {
9 return TRUE;
10 }
11
12 static
13 PGDI_TABLE_ENTRY
14 MyGdiQueryTable()
15 {
16 PTEB pTeb = NtCurrentTeb();
17 PPEB pPeb = pTeb->ProcessEnvironmentBlock;
18 return pPeb->GdiSharedHandleTable;
19 }
20
21 BOOL
22 IsHandleValid(HGDIOBJ hobj)
23 {
24 USHORT Index = (ULONG_PTR)hobj;
25 PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index];
26
27 if (pentry->KernelData == NULL ||
28 pentry->KernelData < (PVOID)0x80000000 ||
29 (USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
30 {
31 return FALSE;
32 }
33
34 return TRUE;
35 }
36
37 int APIENTRY
38 WinMain(HINSTANCE hInstance,
39 HINSTANCE hPrevInstance,
40 LPSTR lpCmdLine,
41 int nCmdShow)
42 {
43 g_hInstance = hInstance;
44
45 GdiHandleTable = MyGdiQueryTable();
46 if(!GdiHandleTable)
47 {
48 return -1;
49 }
50
51 return TestMain(L"gdi32api", L"gdi32.dll");
52 }