1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for NtUserEnumDisplayMonitors
5  * PROGRAMMERS:
6  */
7 
8 #include <win32nt.h>
9 
10 ULONG gMonitorCount = 0;
11 HDC ghdcMonitor = 0;
12 RECT grcMonitor = {0};
13 
14 BOOL
15 NTAPI
16 NtUserEnumDisplayMonitors1(
17     HDC hDC,
18     LPCRECT lprcClip,
19     MONITORENUMPROC lpfnEnum,
20     LPARAM dwData)
21 {
22     return (INT)Syscall(L"NtUserEnumDisplayMonitors", 4, &hDC);
23 }
24 
25 BOOL CALLBACK
26 MonitorEnumProc(
27     HMONITOR hMonitor,
28     HDC hdcMonitor,
29     LPRECT lprcMonitor,
30     LPARAM dwData)
31 {
32     gMonitorCount++;
33     if (gMonitorCount == 1)
34     {
35         ghdcMonitor = hdcMonitor;
36         grcMonitor = *lprcMonitor;
37     }
38     return TRUE;
39 }
40 
41 START_TEST(NtUserEnumDisplayMonitors)
42 {
43     BOOL ret;
44 
45     // WILL crash!
46 //  TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0);
47 
48     ret = NtUserEnumDisplayMonitors(0, NULL, MonitorEnumProc, 0);
49     TEST(ret == TRUE);
50     TEST(gMonitorCount > 0);
51     TEST(ghdcMonitor == 0);
52     TEST(grcMonitor.left == 0);
53     TEST(grcMonitor.right > 0);
54     TEST(grcMonitor.top == 0);
55     TEST(grcMonitor.bottom > 0);
56 
57 }
58