ddraw: Protect the ddraw list.
[wine] / dlls / localspl / tests / localmon.c
1 /* 
2  * Unit test suite for localspl API functions: local print monitor
3  *
4  * Copyright 2006 Detlef Riekenberg
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  */
21
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winerror.h"
27 #include "wingdi.h"
28 #include "winreg.h"
29
30 #include "winspool.h"
31 #include "ddk/winsplp.h"
32
33 #include "wine/test.h"
34
35
36 /* ##### */
37
38 static HANDLE  hdll;
39 static LPMONITOREX (WINAPI *pInitializePrintMonitor)(LPWSTR);
40
41 static const WCHAR emptyW[] =    {0};
42
43 /* ##### */
44
45 static void test_InitializePrintMonitor(void)
46 {
47     LPMONITOREX res;
48
49     if (!pInitializePrintMonitor) return;
50
51     SetLastError(0xdeadbeef);
52     res = pInitializePrintMonitor(NULL);
53     ok( (res == NULL) && (GetLastError() == ERROR_INVALID_PARAMETER),
54         "returned %p with %d\n (expected NULL with " \
55         "ERROR_INVALID_PARAMETER)\n", res, GetLastError());
56
57     SetLastError(0xdeadbeef);
58     res = pInitializePrintMonitor((LPWSTR) emptyW);
59     ok( (res == NULL) && (GetLastError() == ERROR_INVALID_PARAMETER),
60         "returned %p with %d\n (expected NULL with " \
61         "ERROR_INVALID_PARAMETER)\n", res, GetLastError());
62 }
63
64
65 START_TEST(localmon)
66 {
67     hdll = LoadLibraryA("localspl.dll");
68     if (!hdll) return;
69
70     pInitializePrintMonitor = (void *) GetProcAddress(hdll, "InitializePrintMonitor");
71     test_InitializePrintMonitor();
72 }