dbghelp: Dwarf abbrev table is now a sparse array.
[wine] / dlls / setupapi / tests / devinst.c
1 /*
2  * Devinst tests
3  *
4  * Copyright 2006 Christian Gmeiner
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 #include <assert.h>
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "winreg.h"
29 #include "setupapi.h"
30
31 #include "wine/test.h"
32
33
34 static void test_Device_Info_List(void) 
35 {
36     HDEVINFO devlist;
37     BOOL ret;
38     DWORD error;
39     static const WCHAR machine[] = { 'd','u','m','m','y',0 };
40
41     SetLastError(0xdeadbeef);
42     /* create empty DeviceInfoList, but set Reserved to a value, which is not NULL */
43     devlist = SetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, "NotNull");
44
45     error = GetLastError();
46     ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %ld (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
47     ok(error == ERROR_INVALID_PARAMETER, "GetLastError returned wrong value : %ld, (expected %d)", error, ERROR_INVALID_PARAMETER);
48
49     SetLastError(0xdeadbeef);
50     /* create empty DeviceInfoList, but set MachineName to something */
51     devlist = SetupDiCreateDeviceInfoListExW(NULL, NULL, machine, NULL);
52
53     error = GetLastError();
54     ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %ld (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
55     ok(error == ERROR_INVALID_MACHINENAME, "GetLastError returned wrong value : %ld, (expected %d)", error, ERROR_INVALID_MACHINENAME);
56
57     /* create empty DeviceInfoList */
58     devlist = SetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL);
59     ok(devlist && devlist != INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %ld (expected != %p)\n", devlist, error, INVALID_HANDLE_VALUE);
60
61     /* destroy DeviceInfoList */
62     ret = SetupDiDestroyDeviceInfoList(devlist);
63     ok(ret, "SetupDiDestroyDeviceInfoList failed : %ld", error);
64 }
65
66 START_TEST(devinst)
67 {
68     test_Device_Info_List();
69 }