ReactOS  0.4.14-dev-114-gc8cbd56
devinst.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "guiddef.h"
#include "setupapi.h"
#include "cfgmgr32.h"
#include "wine/heap.h"
#include "wine/test.h"
Include dependency graph for devinst.c:

Go to the source code of this file.

Macros

#define check_device_info(a, b, c, d)   check_device_info_(__LINE__,a,b,c,d)
 
#define check_device_iface(a, b, c, d, e, f)   check_device_iface_(__LINE__,a,b,c,d,e,f)
 

Functions

static LSTATUS devinst_RegDeleteTreeW (HKEY hKey, LPCWSTR lpszSubKey)
 
static void test_create_device_list_ex (void)
 
static void test_open_class_key (void)
 
static void create_inf_file (LPCSTR filename)
 
static void get_temp_filename (LPSTR path)
 
static void test_install_class (void)
 
static void check_device_info_ (int line, HDEVINFO set, int index, const GUID *class, const char *expect_id)
 
static void test_device_info (void)
 
static void test_get_device_instance_id (void)
 
static void test_register_device_info (void)
 
static void check_device_iface_ (int line, HDEVINFO set, SP_DEVINFO_DATA *device, const GUID *class, int index, DWORD flags, const char *path)
 
static void test_device_iface (void)
 
static void test_device_iface_detail (void)
 
static void test_device_key (void)
 
static void test_register_device_iface (void)
 
static void test_registry_property_a (void)
 
static void test_registry_property_w (void)
 
static void test_get_inf_class (void)
 
static void test_devnode (void)
 
static void test_device_interface_key (void)
 
static void testSetupDiGetClassDevsA (void)
 
 START_TEST (devinst)
 

Variables

static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}}
 
static GUID guid2 = {0x6a55b5a5, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}}
 

Macro Definition Documentation

◆ check_device_iface

#define check_device_iface (   a,
  b,
  c,
  d,
  e,
  f 
)    check_device_iface_(__LINE__,a,b,c,d,e,f)

Definition at line 579 of file devinst.c.

◆ check_device_info

#define check_device_info (   a,
  b,
  c,
  d 
)    check_device_info_(__LINE__,a,b,c,d)

Definition at line 272 of file devinst.c.

Function Documentation

◆ check_device_iface_()

static void check_device_iface_ ( int  line,
HDEVINFO  set,
SP_DEVINFO_DATA device,
const GUID class,
int  index,
DWORD  flags,
const char path 
)
static

Definition at line 550 of file devinst.c.

552 {
553  char buffer[200];
555  SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)};
556  BOOL ret;
557 
558  detail->cbSize = sizeof(*detail);
559 
560  SetLastError(0xdeadbeef);
561  ret = SetupDiEnumDeviceInterfaces(set, device, class, index, &iface);
562  if (path)
563  {
564  ok_(__FILE__, line)(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
565  ok_(__FILE__, line)(IsEqualGUID(&iface.InterfaceClassGuid, class),
566  "Got unexpected class %s.\n", wine_dbgstr_guid(&iface.InterfaceClassGuid));
567  ok_(__FILE__, line)(iface.Flags == flags, "Got unexpected flags %#x.\n", iface.Flags);
568  ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL);
569  ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
570  ok_(__FILE__, line)(!strcasecmp(detail->DevicePath, path), "Got unexpected path %s.\n", detail->DevicePath);
571  }
572  else
573  {
574  ok_(__FILE__, line)(!ret, "Expected failure.\n");
575  ok_(__FILE__, line)(GetLastError() == ERROR_NO_MORE_ITEMS,
576  "Got unexpected error %#x.\n", GetLastError());
577  }
578 }
#define strcasecmp
Definition: fake.h:9
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
const char * wine_dbgstr_guid(const GUID *guid)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_A DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:2922
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
#define SetLastError(x)
Definition: compat.h:409
GLbitfield flags
Definition: glext.h:7161
int ret
CHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:846
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
Definition: services.c:325
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
Definition: _set.h:46
#define ok_(x1, x2)
Definition: atltest.h:61

◆ check_device_info_()

static void check_device_info_ ( int  line,
HDEVINFO  set,
int  index,
const GUID class,
const char expect_id 
)
static

Definition at line 248 of file devinst.c.

249 {
250  SP_DEVINFO_DATA device = {sizeof(device)};
251  char id[50];
252  BOOL ret;
253 
254  SetLastError(0xdeadbeef);
256  if (expect_id)
257  {
258  ok_(__FILE__, line)(ret, "Got unexpected error %#x.\n", GetLastError());
259  ok_(__FILE__, line)(IsEqualGUID(&device.ClassGuid, class),
260  "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid));
261  ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
262  ok_(__FILE__, line)(ret, "Got unexpected error %#x.\n", GetLastError());
263  ok_(__FILE__, line)(!strcasecmp(id, expect_id), "Got unexpected id %s.\n", id);
264  }
265  else
266  {
267  ok_(__FILE__, line)(!ret, "Expected failure.\n");
268  ok_(__FILE__, line)(GetLastError() == ERROR_NO_MORE_ITEMS,
269  "Got unexpected error %#x.\n", GetLastError());
270  }
271 }
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
#define strcasecmp
Definition: fake.h:9
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
const char * wine_dbgstr_guid(const GUID *guid)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetupDiGetDeviceInstanceIdA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1843
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
#define SetLastError(x)
Definition: compat.h:409
int ret
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
GLenum GLuint id
Definition: glext.h:5579
Definition: _set.h:46
#define ok_(x1, x2)
Definition: atltest.h:61

◆ create_inf_file()

static void create_inf_file ( LPCSTR  filename)
static

Definition at line 172 of file devinst.c.

173 {
174  DWORD dwNumberOfBytesWritten;
177 
178  static const char data[] =
179  "[Version]\n"
180  "Signature=\"$Chicago$\"\n"
181  "Class=Bogus\n"
182  "ClassGUID={6a55b5a4-3f65-11db-b704-0011955c2bdb}\n"
183  "[ClassInstall32]\n"
184  "AddReg=BogusClass.NT.AddReg\n"
185  "[BogusClass.NT.AddReg]\n"
186  "HKR,,,,\"Wine test devices\"\n";
187 
188  WriteFile(hf, data, sizeof(data) - 1, &dwNumberOfBytesWritten, NULL);
189  CloseHandle(hf);
190 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
const char * filename
Definition: ioapi.h:135
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by test_install_class().

◆ devinst_RegDeleteTreeW()

static LSTATUS devinst_RegDeleteTreeW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)
static

Definition at line 44 of file devinst.c.

45 {
46  LONG ret;
47  DWORD dwMaxSubkeyLen, dwMaxValueLen;
48  DWORD dwMaxLen, dwSize;
49  WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
50  HKEY hSubKey = hKey;
51 
52  if(lpszSubKey)
53  {
54  ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
55  if (ret) return ret;
56  }
57 
58  /* Get highest length for keys, values */
59  ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
60  &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
61  if (ret) goto cleanup;
62 
63  dwMaxSubkeyLen++;
64  dwMaxValueLen++;
65  dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
66  if (dwMaxLen > ARRAY_SIZE(szNameBuf))
67  {
68  /* Name too big: alloc a buffer for it */
69  if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
70  {
72  goto cleanup;
73  }
74  }
75 
76 
77  /* Recursively delete all the subkeys */
78  while (TRUE)
79  {
80  dwSize = dwMaxLen;
81  if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
82  NULL, NULL, NULL)) break;
83 
84  ret = devinst_RegDeleteTreeW(hSubKey, lpszName);
85  if (ret) goto cleanup;
86  }
87 
88  if (lpszSubKey)
89  ret = RegDeleteKeyW(hKey, lpszSubKey);
90  else
91  while (TRUE)
92  {
93  dwSize = dwMaxLen;
94  if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
95  NULL, NULL, NULL, NULL)) break;
96 
97  ret = RegDeleteValueW(hKey, lpszName);
98  if (ret) goto cleanup;
99  }
100 
101 cleanup:
102  /* Free buffer if allocated */
103  if (lpszName != szNameBuf)
104  HeapFree( GetProcessHeap(), 0, lpszName);
105  if(lpszSubKey)
106  RegCloseKey(hSubKey);
107  return ret;
108 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
int ret
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
#define ARRAY_SIZE(a)
Definition: main.h:24
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
static LSTATUS devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: devinst.c:44

Referenced by test_device_key().

◆ get_temp_filename()

static void get_temp_filename ( LPSTR  path)
static

Definition at line 192 of file devinst.c.

193 {
194  static char curr[MAX_PATH] = { 0 };
195  char temp[MAX_PATH];
196  LPSTR ptr;
197 
198  if (!*curr)
200  GetTempFileNameA(curr, "set", 0, temp);
201  ptr = strrchr(temp, '\\');
202 
203  lstrcpyA(path, ptr + 1);
204 }
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
char * LPSTR
Definition: xmlstorage.h:182
static PVOID ptr
Definition: dispmode.c:27
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static calc_node_t temp
Definition: rpn_ieee.c:38
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
Definition: services.c:325
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26

Referenced by test_install_class().

◆ START_TEST()

START_TEST ( devinst  )

Definition at line 1380 of file devinst.c.

1381 {
1382  HKEY hkey;
1383 
1385  {
1386  skip("needs admin rights\n");
1387  return;
1388  }
1389  RegCloseKey(hkey);
1390 
1394  test_device_info();
1399  test_device_key();
1405  test_devnode();
1407 }
static void test_registry_property_w(void)
Definition: devinst.c:1033
static void test_get_inf_class(void)
Definition: devinst.c:1137
static void test_device_info(void)
Definition: devinst.c:274
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static void test_device_interface_key(void)
Definition: devinst.c:1304
static void test_device_iface_detail(void)
Definition: devinst.c:688
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static void test_get_device_instance_id(void)
Definition: devinst.c:415
smooth NULL
Definition: ftsmooth.c:416
static void test_register_device_info(void)
Definition: devinst.c:479
static void test_register_device_iface(void)
Definition: devinst.c:880
static void test_open_class_key(void)
Definition: devinst.c:144
static void test_install_class(void)
Definition: devinst.c:206
static void test_create_device_list_ex(void)
Definition: devinst.c:110
static void test_devnode(void)
Definition: devinst.c:1284
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
static void test_device_iface(void)
Definition: devinst.c:581
#define skip(...)
Definition: atltest.h:64
static void test_device_key(void)
Definition: devinst.c:770
static void test_registry_property_a(void)
Definition: devinst.c:933
static void testSetupDiGetClassDevsA(void)
Definition: devinst.c:1358
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3623

◆ test_create_device_list_ex()

static void test_create_device_list_ex ( void  )
static

Definition at line 110 of file devinst.c.

111 {
112  static const WCHAR machine[] = { 'd','u','m','m','y',0 };
113  static const WCHAR empty[] = { 0 };
114  static char notnull[] = "NotNull";
115  HDEVINFO set;
116  BOOL ret;
117 
118  SetLastError(0xdeadbeef);
120  ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
121  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
122 
123  SetLastError(0xdeadbeef);
125  ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
129  "Got unexpected error %#x.\n", GetLastError());
130 
132  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.", GetLastError());
133 
135  ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
136 
138  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.", GetLastError());
139 
141  ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
142 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static const WCHAR empty[]
Definition: main.c:49
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1268
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SetLastError(x)
Definition: compat.h:409
int ret
static const char machine[]
Definition: profile.c:104
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_MACHINE_UNAVAILABLE
Definition: setupapi.h:325
#define ERROR_INVALID_MACHINENAME
Definition: setupapi.h:323
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
Definition: _set.h:46

Referenced by START_TEST().

◆ test_device_iface()

static void test_device_iface ( void  )
static

Definition at line 581 of file devinst.c.

582 {
583  char buffer[200];
585  SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)};
586  SP_DEVINFO_DATA device = {0};
587  BOOL ret;
588  HDEVINFO set;
589 
590  detail->cbSize = sizeof(*detail);
591 
592  SetLastError(0xdeadbeef);
594  ok(!ret, "Expected failure.\n");
595  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
596 
597  SetLastError(0xdeadbeef);
599  ok(!ret, "Expected failure.\n");
600  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
601 
603  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
604 
605  SetLastError(0xdeadbeef);
607  ok(!ret, "Expected failure.\n");
608  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
609 
610  SetLastError(0xdeadbeef);
612  ok(!ret, "Expected failure.\n");
613  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
614 
615  device.cbSize = sizeof(device);
616  ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
617  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
618 
619  check_device_iface(set, &device, &guid, 0, 0, NULL);
620 
621  SetLastError(0xdeadbeef);
623  ok(!ret, "Expected failure.\n");
624  ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
625 
627  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
628 
629  check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
630  check_device_iface(set, &device, &guid, 1, 0, NULL);
631 
632  /* Creating the same interface a second time succeeds */
634  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
635 
636  check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
637  check_device_iface(set, &device, &guid, 1, 0, NULL);
638 
639  ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "Oogah", 0, NULL);
640  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
641 
642  check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
643  check_device_iface(set, &device, &guid, 1, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\Oogah");
644  check_device_iface(set, &device, &guid, 2, 0, NULL);
645 
646  ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "test", 0, &iface);
647  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
648  ok(IsEqualGUID(&iface.InterfaceClassGuid, &guid), "Got unexpected class %s.\n",
650  ok(iface.Flags == 0, "Got unexpected flags %#x.\n", iface.Flags);
651  ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL);
652  ok(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
653  ok(!strcasecmp(detail->DevicePath, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\test"),
654  "Got unexpected path %s.\n", detail->DevicePath);
655 
656  check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
657  check_device_iface(set, &device, &guid, 1, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\Oogah");
658  check_device_iface(set, &device, &guid, 2, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\test");
659  check_device_iface(set, &device, &guid, 3, 0, NULL);
660 
662  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
663 
664  check_device_iface(set, &device, &guid2, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A5-3F65-11DB-B704-0011955C2BDB}");
665  check_device_iface(set, &device, &guid2, 1, 0, NULL);
666 
667  ret = SetupDiEnumDeviceInterfaces(set, &device, &guid2, 0, &iface);
668  ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
670  ok(ret, "Failed to remove interface, error %#x.\n", GetLastError());
671 
672  check_device_iface(set, &device, &guid2, 0, SPINT_REMOVED, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A5-3F65-11DB-B704-0011955C2BDB}");
673  check_device_iface(set, &device, &guid2, 1, 0, NULL);
674 
675  ret = SetupDiEnumDeviceInterfaces(set, &device, &guid, 0, &iface);
676  ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
678  ok(ret, "Failed to delete interface, error %#x.\n", GetLastError());
679 
680  check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\Oogah");
681  check_device_iface(set, &device, &guid, 1, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\test");
682  check_device_iface(set, &device, &guid, 2, 0, NULL);
683 
685  ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
686 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define strcasecmp
Definition: fake.h:9
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define check_device_iface(a, b, c, d, e, f)
Definition: devinst.c:579
const char * wine_dbgstr_guid(const GUID *guid)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
static GUID guid2
Definition: devinst.c:42
static GUID guid
Definition: devinst.c:41
BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_A DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:2922
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1214
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SetLastError(x)
Definition: compat.h:409
int ret
CHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:846
BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO info, PSP_DEVICE_INTERFACE_DATA data)
Definition: stubs.c:91
#define SPINT_REMOVED
Definition: setupapi.h:579
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
BOOL WINAPI SetupDiDeleteDeviceInterfaceData(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: interface.c:636
BOOL WINAPI SetupDiCreateDeviceInterfaceA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2506
Definition: _set.h:46

Referenced by START_TEST().

◆ test_device_iface_detail()

static void test_device_iface_detail ( void  )
static

Definition at line 688 of file devinst.c.

689 {
690  static const char path[] = "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
692  SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)};
693  SP_DEVINFO_DATA device = {sizeof(device)};
694  DWORD size = 0, expectedsize;
695  HDEVINFO set;
696  BOOL ret;
697 
698  SetLastError(0xdeadbeef);
700  ok(!ret, "Expected failure.\n");
701  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
702 
704  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
705 
706  SetLastError(0xdeadbeef);
708  ok(!ret, "Expected failure.\n");
709  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
710 
711  ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
712  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
713 
714  SetLastError(0xdeadbeef);
716  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
717 
718  SetLastError(0xdeadbeef);
720  ok(!ret, "Expected failure.\n");
721  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
722 
723  SetLastError(0xdeadbeef);
725  ok(!ret, "Expected failure.\n");
726  ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
727 
728  SetLastError(0xdeadbeef);
730  ok(!ret, "Expected failure.\n");
731  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
732 
733  detail = heap_alloc(size);
734  expectedsize = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_W, DevicePath[strlen(path) + 1]);
735 
736  detail->cbSize = 0;
737  SetLastError(0xdeadbeef);
738  ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, size, &size, NULL);
739  ok(!ret, "Expected failure.\n");
740  ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
741 
742  detail->cbSize = size;
743  SetLastError(0xdeadbeef);
744  ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, size, &size, NULL);
745  ok(!ret, "Expected failure.\n");
746  ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
747 
748  detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
749  SetLastError(0xdeadbeef);
750  ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, size, &size, NULL);
751  ok(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
752  ok(!strcasecmp(path, detail->DevicePath), "Got unexpected path %s.\n", detail->DevicePath);
753 
755  ok(!ret, "Expected failure.\n");
756  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
757  ok(size == expectedsize, "Got unexpected size %d.\n", size);
758 
759  memset(&device, 0, sizeof(device));
760  device.cbSize = sizeof(device);
762  ok(!ret, "Expected failure.\n");
763  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
764  ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid));
765 
766  heap_free(detail);
768 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define strcasecmp
Definition: fake.h:9
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:3016
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
const char * wine_dbgstr_guid(const GUID *guid)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
static GUID guid
Definition: devinst.c:41
BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_A DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:2922
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1214
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
CHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:846
#define ok(value,...)
Definition: atltest.h:57
Definition: services.c:325
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_DEVICE_INTERFACE_DETAIL_DATA_A
BOOL WINAPI SetupDiCreateDeviceInterfaceA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2506
Definition: _set.h:46
#define memset(x, y, z)
Definition: compat.h:39
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_device_info()

static void test_device_info ( void  )
static

Definition at line 274 of file devinst.c.

275 {
276  static const GUID deadbeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
277  SP_DEVINFO_DATA device = {0}, ret_device = {sizeof(ret_device)};
278  char id[MAX_DEVICE_ID_LEN + 2];
279  HDEVINFO set;
280  BOOL ret;
281 
282  SetLastError(0xdeadbeef);
284  ok(!ret, "Expected failure.\n");
285  ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#x.\n", GetLastError());
286 
287  SetLastError(0xdeadbeef);
288  ret = SetupDiCreateDeviceInfoA(NULL, "Root\\LEGACY_BOGUS\\0000", NULL, NULL, NULL, 0, NULL);
289  ok(!ret, "Expected failure.\n");
290  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
291 
293  ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
294 
295  SetLastError(0xdeadbeef);
296  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", NULL, NULL, NULL, 0, NULL);
297  ok(!ret, "Expected failure.\n");
298  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
299 
300  SetLastError(0xdeadbeef);
301  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &deadbeef, NULL, NULL, 0, NULL);
302  ok(!ret, "Expected failure.\n");
303  ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#x.\n", GetLastError());
304 
305  SetLastError(0xdeadbeef);
306  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &GUID_NULL, NULL, NULL, 0, NULL);
307  ok(!ret, "Expected failure.\n");
308  ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#x.\n", GetLastError());
309 
310  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, NULL);
311  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
312 
313  check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
315 
316  SetLastError(0xdeadbeef);
317  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
318  ok(!ret, "Expected failure.\n");
319  ok(GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, "Got unexpected error %#x.\n", GetLastError());
320 
321  SetLastError(0xdeadbeef);
322  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device);
323  ok(!ret, "Expected failure.\n");
324  ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
325 
326  check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
327  check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0001");
329 
330  device.cbSize = sizeof(device);
331  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0002", &guid, NULL, NULL, 0, &device);
332  ok(ret, "Got unexpected error %#x.\n", GetLastError());
333  ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n",
334  wine_dbgstr_guid(&device.ClassGuid));
335  ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
336  ok(ret, "Got unexpected error %#x.\n", GetLastError());
337  ok(!strcmp(id, "ROOT\\LEGACY_BOGUS\\0002"), "Got unexpected id %s.\n", id);
338 
339  check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
340  check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0001");
341  check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\0002");
343 
344  ret = SetupDiEnumDeviceInfo(set, 0, &ret_device);
345  ok(ret, "Failed to enumerate devices, error %#x.\n", GetLastError());
346  ret = SetupDiDeleteDeviceInfo(set, &ret_device);
347  ok(ret, "Failed to delete device, error %#x.\n", GetLastError());
348 
349  check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0001");
350  check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0002");
352 
354  ok(ret, "Got unexpected error %#x.\n", GetLastError());
355 
356  check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0001");
357 
358  ret = SetupDiEnumDeviceInfo(set, 1, &ret_device);
359  ok(ret, "Got unexpected error %#x.\n", GetLastError());
360  ok(IsEqualGUID(&ret_device.ClassGuid, &guid), "Got unexpected class %s.\n",
361  wine_dbgstr_guid(&ret_device.ClassGuid));
362  ret = SetupDiGetDeviceInstanceIdA(set, &ret_device, id, sizeof(id), NULL);
363  ok(!ret, "Expected failure.\n");
364  ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#x.\n", GetLastError());
365  ok(ret_device.DevInst == device.DevInst, "Expected device node %#x, got %#x.\n",
366  device.DevInst, ret_device.DevInst);
367 
369 
371 
373  ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
374 
375  SetLastError(0xdeadbeef);
376  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", NULL, NULL, NULL, 0, NULL);
377  ok(!ret, "Expected failure.\n");
378  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
379 
380  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\deadbeef", &deadbeef, NULL, NULL, 0, NULL);
381  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
382 
383  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\null", &GUID_NULL, NULL, NULL, 0, NULL);
384  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
385 
386  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\testguid", &guid, NULL, NULL, 0, NULL);
387  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
388 
389  check_device_info(set, 0, &deadbeef, "ROOT\\LEGACY_BOGUS\\deadbeef");
390  check_device_info(set, 1, &GUID_NULL, "ROOT\\LEGACY_BOGUS\\null");
391  check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\testguid");
393 
394  memset(id, 'x', sizeof(id));
395  memcpy(id, "Root\\LEGACY_BOGUS\\", strlen("Root\\LEGACY_BOGUS\\"));
396  id[MAX_DEVICE_ID_LEN + 1] = 0;
397  SetLastError(0xdeadbeef);
399  ok(!ret, "Expected failure.\n");
400  ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#x.\n", GetLastError());
401 
402  id[MAX_DEVICE_ID_LEN] = 0;
403  SetLastError(0xdeadbeef);
405  ok(!ret, "Expected failure.\n");
406  ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#x.\n", GetLastError());
407 
408  id[MAX_DEVICE_ID_LEN - 1] = 0;
410  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
411 
413 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
const char * wine_dbgstr_guid(const GUID *guid)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define MAX_DEVICE_ID_LEN
Definition: pnpmgr.c:28
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
BOOL WINAPI SetupDiGetDeviceInstanceIdA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1843
static GUID guid
Definition: devinst.c:41
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1214
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define ERROR_CLASS_MISMATCH
Definition: setupapi.h:292
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupDiDeleteDeviceInfo(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4717
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_NO_SUCH_DEVINST
Definition: setupapi.h:302
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GUID_NULL
Definition: ks.h:106
#define ERROR_DEVINST_ALREADY_EXISTS
Definition: setupapi.h:298
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ERROR_INVALID_DEVINST_NAME
Definition: setupapi.h:296
Definition: _set.h:46
#define memset(x, y, z)
Definition: compat.h:39
#define check_device_info(a, b, c, d)
Definition: devinst.c:272

Referenced by START_TEST().

◆ test_device_interface_key()

static void test_device_interface_key ( void  )
static

Definition at line 1304 of file devinst.c.

1305 {
1306  const char keypath[] = "System\\CurrentControlSet\\Control\\DeviceClasses\\"
1307  "{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\"
1308  "##?#ROOT#LEGACY_BOGUS#0001#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
1309  SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) };
1310  SP_DEVINFO_DATA devinfo = { sizeof(devinfo) };
1311  HKEY parent, key, dikey;
1312  char buffer[5];
1313  HDEVINFO set;
1314  LONG sz, ret;
1315 
1317  ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed: %#x\n", GetLastError());
1318 
1319  ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &devinfo);
1320  ok(ret, "SetupDiCreateDeviceInfo failed: %#x\n", GetLastError());
1321 
1322  ret = SetupDiCreateDeviceInterfaceA(set, &devinfo, &guid, NULL, 0, &iface);
1323  ok(ret, "SetupDiCreateDeviceInterface failed: %#x\n", GetLastError());
1324 
1325  ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &parent);
1326  ok(!ret, "failed to open device parent key: %u\n", ret);
1327 
1328  ret = RegOpenKeyA(parent, "#\\Device Parameters", &key);
1329  ok(ret == ERROR_FILE_NOT_FOUND, "key shouldn't exist\n");
1330 
1332  ok(dikey != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
1333 
1334  ret = RegOpenKeyA(parent, "#\\Device Parameters", &key);
1335  ok(!ret, "key should exist: %u\n", ret);
1336 
1337  ret = RegSetValueA(key, NULL, REG_SZ, "test", 5);
1338  sz = sizeof(buffer);
1339  ret = RegQueryValueA(dikey, NULL, buffer, &sz);
1340  ok(!ret, "RegQueryValue failed: %u\n", ret);
1341  ok(!strcmp(buffer, "test"), "got wrong data %s\n", buffer);
1342 
1343  RegCloseKey(dikey);
1344  RegCloseKey(key);
1345 
1347  ok(ret, "got error %u\n", GetLastError());
1348 
1349  ret = RegOpenKeyA(parent, "#\\Device Parameters", &key);
1350  ok(ret == ERROR_FILE_NOT_FOUND, "key shouldn't exist\n");
1351 
1354  SetupDiRemoveDevice(set, &devinfo);
1356 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4225
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
LONG WINAPI RegSetValueA(HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
Definition: reg.c:4968
HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyA(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCSTR InfSectionName)
Definition: devinst.c:2584
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static GUID guid
Definition: devinst.c:41
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
r parent
Definition: btrfs.c:2897
BOOL WINAPI SetupDiDeleteDeviceInterfaceRegKey(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved)
Definition: devinst.c:2733
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
int ret
HKEY key
Definition: reg.c:42
BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO info, PSP_DEVICE_INTERFACE_DATA data)
Definition: stubs.c:91
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL WINAPI SetupDiCreateDeviceInterfaceA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2506
Definition: _set.h:46
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_device_key()

static void test_device_key ( void  )
static

Definition at line 770 of file devinst.c.

771 {
772  static const WCHAR classKey[] = {'S','y','s','t','e','m','\\',
773  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
774  'C','o','n','t','r','o','l','\\','C','l','a','s','s','\\',
775  '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-',
776  '1','1','d','b','-','b','7','0','4','-',
777  '0','0','1','1','9','5','5','c','2','b','d','b','}',0};
778  static const WCHAR bogus[] = {'S','y','s','t','e','m','\\',
779  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
780  'E','n','u','m','\\','R','o','o','t','\\',
781  'L','E','G','A','C','Y','_','B','O','G','U','S',0};
782  SP_DEVINFO_DATA device = {sizeof(device)};
783  BOOL ret;
784  HDEVINFO set;
785  HKEY key = NULL;
786  LONG res;
787 
788  SetLastError(0xdeadbeef);
789  key = SetupDiCreateDevRegKeyW(NULL, NULL, 0, 0, 0, NULL, NULL);
790  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
791  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
792 
794  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
795 
797  ok(res != ERROR_SUCCESS, "Key should not exist.\n");
798  RegCloseKey(key);
799 
800  ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
801  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
802  ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key), "Key should exist.\n");
803  RegCloseKey(key);
804 
805  SetLastError(0xdeadbeef);
806  key = SetupDiOpenDevRegKey(NULL, NULL, 0, 0, 0, 0);
807  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
808  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
809 
810  SetLastError(0xdeadbeef);
811  key = SetupDiOpenDevRegKey(set, NULL, 0, 0, 0, 0);
812  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
813  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
814 
815  SetLastError(0xdeadbeef);
816  key = SetupDiOpenDevRegKey(set, &device, 0, 0, 0, 0);
817  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
818  ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#x.\n", GetLastError());
819 
820  SetLastError(0xdeadbeef);
822  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
823  ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#x.\n", GetLastError());
824 
825  SetLastError(0xdeadbeef);
827  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
828  ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#x.\n", GetLastError());
829 
830  SetLastError(0xdeadbeef);
832  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
833  ok(GetLastError() == ERROR_DEVINFO_NOT_REGISTERED, "Got unexpected error %#x.\n", GetLastError());
834 
836  ok(ret, "Failed to register device, error %#x.\n", GetLastError());
837 
838  SetLastError(0xdeadbeef);
840  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
841  ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
842 
843  SetLastError(0xdeadbeef);
844  res = RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key);
845 todo_wine
846  ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
847  RegCloseKey(key);
848 
851  "Failed to create device key, error %#x.\n", GetLastError());
852  if (key != INVALID_HANDLE_VALUE)
853  {
854  RegCloseKey(key);
855 
856  ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key), "Key should exist.\n");
857  RegCloseKey(key);
858 
859  SetLastError(0xdeadbeef);
861 todo_wine {
862  ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
864  "Got unexpected error %#x.\n", GetLastError());
865 }
866 
868  ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#x.\n", GetLastError());
869  RegCloseKey(key);
870  }
871 
873  ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
875 
876  /* remove once Wine is fixed */
878 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define ERROR_KEY_DOES_NOT_EXIST
Definition: setupapi.h:295
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static GUID guid
Definition: devinst.c:41
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1214
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1405
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIREG_BOTH
Definition: setupapi.h:183
#define ERROR_DEVINFO_NOT_REGISTERED
Definition: setupapi.h:299
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SetLastError(x)
Definition: compat.h:409
int ret
#define todo_wine
Definition: test.h:154
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5919
BOOL WINAPI SetupDiRegisterDeviceInfo(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData)
Definition: devinst.c:1716
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define DIREG_DRV
Definition: setupapi.h:182
Definition: _set.h:46
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
static LSTATUS devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: devinst.c:44
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ test_devnode()

static void test_devnode ( void  )
static

Definition at line 1284 of file devinst.c.

1285 {
1286  HDEVINFO set;
1287  SP_DEVINFO_DATA device = { sizeof(SP_DEVINFO_DATA) };
1288  char buffer[50];
1289  DWORD ret;
1290 
1292  ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed: %#x\n", GetLastError());
1293  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL,
1294  NULL, 0, &device);
1295  ok(ret, "SetupDiCreateDeviceInfo failed: %#x\n", GetLastError());
1296 
1297  ret = CM_Get_Device_IDA(device.DevInst, buffer, sizeof(buffer), 0);
1298  ok(!ret, "got %#x\n", ret);
1299  ok(!strcmp(buffer, "ROOT\\LEGACY_BOGUS\\0000"), "got %s\n", buffer);
1300 
1302 }
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
CONFIGRET WINAPI CM_Get_Device_IDA(_In_ DEVINST dnDevInst, _Out_writes_(BufferLen) PCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags)
Definition: cfgmgr.c:3647
static GUID guid
Definition: devinst.c:41
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
unsigned long DWORD
Definition: ntddk_ex.h:95
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
int ret
#define ok(value,...)
Definition: atltest.h:57
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: _set.h:46

Referenced by START_TEST().

◆ test_get_device_instance_id()

static void test_get_device_instance_id ( void  )
static

Definition at line 415 of file devinst.c.

416 {
417  BOOL ret;
418  HDEVINFO set;
419  SP_DEVINFO_DATA device = {0};
420  char id[200];
421  DWORD size;
422 
423  SetLastError(0xdeadbeef);
425  ok(!ret, "Expected failure.\n");
426  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
427 
428  SetLastError(0xdeadbeef);
430  ok(!ret, "Expected failure.\n");
431  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
432 
434  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
435 
436  SetLastError(0xdeadbeef);
438  ok(!ret, "Expected failure.\n");
439  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
440 
441  SetLastError(0xdeadbeef);
443  ok(!ret, "Expected failure.\n");
444  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
445 
446  SetLastError(0xdeadbeef);
448  ok(!ret, "Expected failure.\n");
449  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
450 
451  device.cbSize = sizeof(device);
452  SetLastError(0xdeadbeef);
454  ok(!ret, "Expected failure.\n");
455  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
456 
457  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
458  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
459 
460  SetLastError(0xdeadbeef);
462  ok(!ret, "Expected failure.\n");
463  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
464 
465  ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
466  ok(ret, "Failed to get device id, error %#x.\n", GetLastError());
467  ok(!strcmp(id, "ROOT\\LEGACY_BOGUS\\0000"), "Got unexpected id %s.\n", id);
468 
470  ok(ret, "SetupDiCreateDeviceInfoA failed: %08x\n", GetLastError());
471 
472  ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
473  ok(ret, "Failed to get device id, error %#x.\n", GetLastError());
474  ok(!strcmp(id, "ROOT\\LEGACY_BOGUS\\0001"), "Got unexpected id %s.\n", id);
475 
477 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetupDiGetDeviceInstanceIdA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1843
static GUID guid
Definition: devinst.c:41
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1214
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: _set.h:46
#define DICD_GENERATE_ID
Definition: setupapi.h:110
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_get_inf_class()

static void test_get_inf_class ( void  )
static

Definition at line 1137 of file devinst.c.

1138 {
1139  static const char inffile[] = "winetest.inf";
1140  static const char content[] = "[Version]\r\n\r\n";
1141  static const char* signatures[] = {"\"$CHICAGO$\"", "\"$Windows NT$\""};
1142 
1143  char cn[MAX_PATH];
1144  char filename[MAX_PATH];
1145  DWORD count;
1146  BOOL retval;
1147  GUID guid;
1148  HANDLE h;
1149  int i;
1150 
1154 
1155  /* not existing file */
1156  SetLastError(0xdeadbeef);
1158  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1160  "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
1161 
1162  /* missing file wins against other invalid parameter */
1163  SetLastError(0xdeadbeef);
1165  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1167  "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
1168 
1169  SetLastError(0xdeadbeef);
1171  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1173  "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
1174 
1175  SetLastError(0xdeadbeef);
1176  retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
1177  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1179  "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
1180 
1181  SetLastError(0xdeadbeef);
1183  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1185  "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
1186 
1187  /* test file content */
1190  ok(h != INVALID_HANDLE_VALUE, "Failed to create file, error %#x.\n", GetLastError());
1191  CloseHandle(h);
1192 
1194  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1195 
1196  for(i=0; i < ARRAY_SIZE(signatures); i++)
1197  {
1198  trace("testing signature %s\n", signatures[i]);
1201  ok(h != INVALID_HANDLE_VALUE, "Failed to create file, error %#x.\n", GetLastError());
1202  WriteFile(h, content, sizeof(content), &count, NULL);
1203  CloseHandle(h);
1204 
1206  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1207 
1208  WritePrivateProfileStringA("Version", "Signature", signatures[i], filename);
1209 
1211  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1212 
1213  WritePrivateProfileStringA("Version", "Class", "WINE", filename);
1214 
1215  count = 0xdeadbeef;
1217  ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
1218  ok(count == 5, "expected count==5, got %u\n", count);
1219 
1220  count = 0xdeadbeef;
1221  retval = SetupDiGetINFClassA(filename, &guid, cn, 5, &count);
1222  ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
1223  ok(count == 5, "expected count==5, got %u\n", count);
1224 
1225  count = 0xdeadbeef;
1226  SetLastError(0xdeadbeef);
1227  retval = SetupDiGetINFClassA(filename, &guid, cn, 4, &count);
1228  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1230  "expected error ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
1231  ok(count == 5, "expected count==5, got %u\n", count);
1232 
1233  /* invalid parameter */
1234  SetLastError(0xdeadbeef);
1235  retval = SetupDiGetINFClassA(NULL, &guid, cn, MAX_PATH, &count);
1236  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1238  "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
1239 
1240  SetLastError(0xdeadbeef);
1242  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1244  "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
1245 
1246  SetLastError(0xdeadbeef);
1248  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1250  "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
1251 
1252  SetLastError(0xdeadbeef);
1253  retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
1254  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1256  "Got unexpected error %#x.\n", GetLastError());
1257 
1259 
1260  WritePrivateProfileStringA("Version", "Signature", signatures[i], filename);
1261  WritePrivateProfileStringA("Version", "ClassGUID", "WINE", filename);
1262 
1263  SetLastError(0xdeadbeef);
1265  ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
1267  "Got unexpected error %#x.\n", GetLastError());
1268 
1269  /* network adapter guid */
1270  WritePrivateProfileStringA("Version", "ClassGUID",
1271  "{4d36e972-e325-11ce-bfc1-08002be10318}", filename);
1272 
1273  /* this test succeeds only if the guid is known to the system */
1274  count = 0xdeadbeef;
1276  ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
1277  todo_wine
1278  ok(count == 4, "expected count==4, got %u(%s)\n", count, cn);
1279 
1281  }
1282 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static BYTE cn[]
Definition: cert.c:2938
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static GUID guid
Definition: devinst.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
content
Definition: atl_ax.c:994
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define trace
Definition: atltest.h:70
BOOL WINAPI SetupDiGetINFClassA(IN PCSTR InfName, OUT LPGUID ClassGuid, OUT PSTR ClassName, IN DWORD ClassNameSize, OUT PDWORD RequiredSize OPTIONAL)
Definition: parser.c:2347
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define RPC_S_INVALID_STRING_UUID
Definition: winerror.h:1016
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define todo_wine
Definition: test.h:154
static const char inffile[]
#define CREATE_ALWAYS
Definition: disk.h:72
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
BOOL WINAPI DECLSPEC_HOTPATCH WritePrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR string, LPCSTR filename)
Definition: profile.c:1484
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_install_class()

static void test_install_class ( void  )
static

Definition at line 206 of file devinst.c.

207 {
208  static const WCHAR classKey[] = {'S','y','s','t','e','m','\\',
209  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
210  'C','o','n','t','r','o','l','\\','C','l','a','s','s','\\',
211  '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-',
212  '1','1','d','b','-','b','7','0','4','-',
213  '0','0','1','1','9','5','5','c','2','b','d','b','}',0};
214  char tmpfile[MAX_PATH];
215  BOOL ret;
216 
217  tmpfile[0] = '.';
218  tmpfile[1] = '\\';
221 
223  ok(!ret, "Expected failure.\n");
224  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
225 
227  ok(!ret, "Expected failure.\n");
228  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
229 
231  ok(!ret, "Expected failure.\n");
232  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
233 
235  ok(!ret, "Expected failure.\n");
236  ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Got unexpected error %#x.\n", GetLastError());
237 
238  /* The next call will succeed. Information is put into the registry but the
239  * location(s) is/are depending on the Windows version.
240  */
242  ok(ret, "Failed to install class, error %#x.\n", GetLastError());
243 
244  ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey), "Failed to delete class key, error %u.\n", GetLastError());
246 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static void create_inf_file(LPCSTR filename)
Definition: devinst.c:172
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DI_NOVCP
Definition: setupapi.h:49
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static void get_temp_filename(LPSTR path)
Definition: devinst.c:192
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ret
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetupDiInstallClassA(HWND hwndParent, PCSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
Definition: devinst.c:3475
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ test_open_class_key()

static void test_open_class_key ( void  )
static

Definition at line 144 of file devinst.c.

145 {
146  static const char guidstr[] = "{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
147  HKEY root_key, class_key;
148  LONG res;
149 
150  SetLastError(0xdeadbeef);
152  ok(class_key == INVALID_HANDLE_VALUE, "Expected failure.\n");
153 todo_wine
154  ok(GetLastError() == ERROR_INVALID_CLASS, "Got unexpected error %#x.\n", GetLastError());
155 
157  ok(root_key != INVALID_HANDLE_VALUE, "Failed to open root key, error %#x.\n", GetLastError());
158 
159  res = RegCreateKeyA(root_key, guidstr, &class_key);
160  ok(!res, "Failed to create class key, error %#x.\n", GetLastError());
161  RegCloseKey(class_key);
162 
163  SetLastError(0xdeadbeef);
165  ok(class_key != INVALID_HANDLE_VALUE, "Failed to open class key, error %#x.\n", GetLastError());
166  RegCloseKey(class_key);
167 
168  RegDeleteKeyA(root_key, guidstr);
170 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static GUID guid
Definition: devinst.c:41
long LONG
Definition: pedump.c:60
struct reiserfs_key root_key
#define DIOCR_INSTALLER
Definition: setupapi.h:176
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1177
HKEY WINAPI SetupDiOpenClassRegKeyExA(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCSTR MachineName, PVOID Reserved)
Definition: devinst.c:3635
#define SetLastError(x)
Definition: compat.h:409
#define todo_wine
Definition: test.h:154
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ERROR_INVALID_CLASS
Definition: setupapi.h:297
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3623

Referenced by START_TEST().

◆ test_register_device_iface()

static void test_register_device_iface ( void  )
static

Definition at line 880 of file devinst.c.

881 {
882  static const WCHAR bogus[] = {'S','y','s','t','e','m','\\',
883  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
884  'E','n','u','m','\\','R','o','o','t','\\',
885  'L','E','G','A','C','Y','_','B','O','G','U','S',0};
886  SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}, ret_iface = {sizeof(ret_iface)};
887  SP_DEVINFO_DATA device = {sizeof(device)};
888  HDEVINFO set, set2;
889  BOOL ret;
890  HKEY key;
891  LONG res;
892 
894  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
895 
897  ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
898 
899  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
900  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
902  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
903  ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "removed", 0, &iface);
904  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
905  ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "deleted", 0, &iface);
906  ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
908  ok(ret, "Failed to register device, error %#x.\n", GetLastError());
909 
910  ret = SetupDiEnumDeviceInterfaces(set, &device, &guid, 1, &iface);
911  ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
913  ok(ret, "Failed to delete interface, error %#x.\n", GetLastError());
914  ret = SetupDiEnumDeviceInterfaces(set, &device, &guid, 2, &iface);
915  ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
917  ok(ret, "Failed to delete interface, error %#x.\n", GetLastError());
918 
920  ok(set2 != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
921 
922  check_device_iface(set2, NULL, &guid, 0, 0, "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}");
923  check_device_iface(set2, NULL, &guid, 1, 0, "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\deleted");
924  check_device_iface(set2, NULL, &guid, 2, 0, NULL);
925 
927  ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
928 
931 }
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define check_device_iface(a, b, c, d, e, f)
Definition: devinst.c:579
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static GUID guid
Definition: devinst.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
int ret
HKEY key
Definition: reg.c:42
BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO info, PSP_DEVICE_INTERFACE_DATA data)
Definition: stubs.c:91
BOOL WINAPI SetupDiRegisterDeviceInfo(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData)
Definition: devinst.c:1716
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
BOOL WINAPI SetupDiDeleteDeviceInterfaceData(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: interface.c:636
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
GLuint res
Definition: glext.h:9613
BOOL WINAPI SetupDiCreateDeviceInterfaceA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2506
Definition: _set.h:46
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by START_TEST().

◆ test_register_device_info()

static void test_register_device_info ( void  )
static

Definition at line 479 of file devinst.c.

480 {
481  SP_DEVINFO_DATA device = {0};
482  BOOL ret;
483  HDEVINFO set;
484  int i = 0;
485 
486  SetLastError(0xdeadbeef);
488  ok(!ret, "Expected failure.\n");
489  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
490 
492  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
493 
494  SetLastError(0xdeadbeef);
496  ok(!ret, "Expected failure.\n");
497  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
498 
499  SetLastError(0xdeadbeef);
501  ok(!ret, "Expected failure.\n");
502  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
503 
504  device.cbSize = sizeof(device);
505  SetLastError(0xdeadbeef);
507  ok(!ret, "Expected failure.\n");
508  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
509 
510  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
511  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
513  ok(ret, "Failed to register device, error %#x.\n", GetLastError());
514 
515  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device);
516  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
518  ok(ret, "Failed to register device, error %#x.\n", GetLastError());
520  ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
521 
522  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0002", &guid, NULL, NULL, 0, &device);
523  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
525  ok(ret, "Failed to register device, error %#x.\n", GetLastError());
527  ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
528 
529  ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0003", &guid, NULL, NULL, 0, &device);
530  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
531 
533 
535  ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
536 
537  check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\0000");
538  check_device_info(set, 1, &guid, "Root\\LEGACY_BOGUS\\0002");
540 
541  while (SetupDiEnumDeviceInfo(set, i++, &device))
542  {
544  ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
545  }
546 
548 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static GUID guid
Definition: devinst.c:41
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1214
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupDiDeleteDeviceInfo(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4717
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SetLastError(x)
Definition: compat.h:409
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
int ret
BOOL WINAPI SetupDiRegisterDeviceInfo(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData)
Definition: devinst.c:1716
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
#define ok(value,...)
Definition: atltest.h:57
Definition: _set.h:46
#define check_device_info(a, b, c, d)
Definition: devinst.c:272

Referenced by START_TEST().

◆ test_registry_property_a()

static void test_registry_property_a ( void  )
static

Definition at line 933 of file devinst.c.

934 {
935  static const CHAR bogus[] = "System\\CurrentControlSet\\Enum\\Root\\LEGACY_BOGUS";
936  SP_DEVINFO_DATA device = {sizeof(device)};
937  CHAR buf[6] = "";
938  DWORD size, type;
939  HDEVINFO set;
940  BOOL ret;
941  LONG res;
942  HKEY key;
943 
945  ok(set != INVALID_HANDLE_VALUE, "Failed to get device list, error %#x.\n", GetLastError());
946 
948  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
949 
950  SetLastError(0xdeadbeef);
952  ok(!ret, "Expected failure.\n");
953  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
954 
955  SetLastError(0xdeadbeef);
957  ok(!ret, "Expected failure.\n");
958  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
959 
960  SetLastError(0xdeadbeef);
962  ok(!ret, "Expected failure.\n");
963 todo_wine
964  ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
965 
967  todo_wine
968  ok(!ret, "Expected failure.\n");
969  /* GetLastError() returns nonsense in win2k3 */
970 
971  SetLastError(0xdeadbeef);
972  ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, (BYTE *)"Bogus", sizeof("Bogus"));
973  ok(ret, "Failed to set property, error %#x.\n", GetLastError());
974 
975  SetLastError(0xdeadbeef);
977  ok(!ret, "Expected failure.\n");
978  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
979 
980  SetLastError(0xdeadbeef);
982  ok(!ret, "Expected failure.\n");
983  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
984 
985  SetLastError(0xdeadbeef);
987  ok(!ret, "Expected failure.\n");
988 todo_wine
989  ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
990 
992  ok(!ret, "Expected failure, got %d\n", ret);
993  /* GetLastError() returns nonsense in win2k3 */
994 
995  SetLastError(0xdeadbeef);
997  ok(!ret, "Expected failure.\n");
998  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
999  ok(size == sizeof("Bogus"), "Got unexpected size %d.\n", size);
1000 
1001  SetLastError(0xdeadbeef);
1003  ok(ret, "Failed to get property, error %#x.\n", GetLastError());
1004  ok(!strcmp(buf, "Bogus"), "Got unexpected property %s.\n", buf);
1005 
1006  SetLastError(0xdeadbeef);
1008  ok(ret, "Failed to get property, error %#x.\n", GetLastError());
1009  ok(!strcmp(buf, "Bogus"), "Got unexpected property %s.\n", buf);
1010  ok(type == REG_SZ, "Got unexpected type %d.\n", type);
1011 
1012  SetLastError(0xdeadbeef);
1014  ok(ret, "Failed to set property, error %#x.\n", GetLastError());
1015 
1016  SetLastError(0xdeadbeef);
1018 todo_wine {
1019  ok(!ret, "Expected failure.\n");
1020  ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
1021 }
1022 
1024  ok(!ret, "Expected failure.\n");
1025  ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
1026 
1028 
1029  res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key);
1030  ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
1031 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_INVALID_REG_PROPERTY
Definition: setupapi.h:300
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
BOOL WINAPI SetupDiSetDeviceRegistryPropertyA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3439
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char CHAR
Definition: xmlstorage.h:175
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static GUID guid
Definition: devinst.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:514
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define SPDRP_HARDWAREID
Definition: setupapi.h:503
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
int ret
#define todo_wine
Definition: test.h:154
HKEY key
Definition: reg.c:42
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3144
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define ok(value,...)
Definition: atltest.h:57
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
GLuint res
Definition: glext.h:9613
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: _set.h:46
Definition: path.c:42
#define DICD_GENERATE_ID
Definition: setupapi.h:110
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_registry_property_w()

static void test_registry_property_w ( void  )
static

Definition at line 1033 of file devinst.c.

1034 {
1035  WCHAR friendly_name[] = {'B','o','g','u','s',0};
1036  SP_DEVINFO_DATA device = {sizeof(device)};
1037  WCHAR buf[6] = {0};
1038  DWORD size, type;
1039  HDEVINFO set;
1040  BOOL ret;
1041  LONG res;
1042  HKEY key;
1043  static const WCHAR bogus[] = {'S','y','s','t','e','m','\\',
1044  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
1045  'E','n','u','m','\\','R','o','o','t','\\',
1046  'L','E','G','A','C','Y','_','B','O','G','U','S',0};
1047 
1049  ok(set != INVALID_HANDLE_VALUE, "Failed to get device list, error %#x.\n", GetLastError());
1050 
1052  ok(ret, "Failed to create device, error %#x.\n", GetLastError());
1053 
1054  SetLastError(0xdeadbeef);
1056  ok(!ret, "Expected failure.\n");
1057  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
1058 
1059  SetLastError(0xdeadbeef);
1061  ok(!ret, "Expected failure.\n");
1062  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
1063 
1064  SetLastError(0xdeadbeef);
1066  ok(!ret, "Expected failure.\n");
1067 todo_wine
1068  ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
1069 
1071  todo_wine
1072  ok(!ret, "Expected failure.\n");
1073  /* GetLastError() returns nonsense in win2k3 */
1074 
1075  SetLastError(0xdeadbeef);
1077  ok(ret, "Failed to set property, error %#x.\n", GetLastError());
1078 
1079  SetLastError(0xdeadbeef);
1081  ok(!ret, "Expected failure.\n");
1082  ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
1083 
1084  SetLastError(0xdeadbeef);
1086  ok(!ret, "Expected failure.\n");
1087  ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
1088 
1089  SetLastError(0xdeadbeef);
1091  ok(!ret, "Expected failure.\n");
1092 todo_wine
1093  ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
1094 
1096  ok(!ret, "Expected failure.\n");
1097  /* GetLastError() returns nonsense in win2k3 */
1098 
1099  SetLastError(0xdeadbeef);
1101  ok(!ret, "Expected failure.\n");
1102  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
1103  ok(size == sizeof(friendly_name), "Got unexpected size %d.\n", size);
1104 
1105  SetLastError(0xdeadbeef);
1107  ok(ret, "Failed to get property, error %#x.\n", GetLastError());
1108  ok(!lstrcmpW(buf, friendly_name), "Got unexpected property %s.\n", wine_dbgstr_w(buf));
1109 
1110  SetLastError(0xdeadbeef);
1112  ok(ret, "Failed to get property, error %#x.\n", GetLastError());
1113  ok(!lstrcmpW(buf, friendly_name), "Got unexpected property %s.\n", wine_dbgstr_w(buf));
1114  ok(type == REG_SZ, "Got unexpected type %d.\n", type);
1115 
1116  SetLastError(0xdeadbeef);
1118  ok(ret, "Failed to set property, error %#x.\n", GetLastError());
1119 
1120  SetLastError(0xdeadbeef);
1122 todo_wine {
1123  ok(!ret, "Expected failure.\n");
1124  ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
1125 }
1126 
1128  ok(!ret, "Expected failure.\n");
1129  ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
1130 
1132 
1133  res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
1134  ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
1135 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_INVALID_REG_PROPERTY
Definition: setupapi.h:300
BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1537
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3229
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static GUID guid
Definition: devinst.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:514
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define SPDRP_HARDWAREID
Definition: setupapi.h:503
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
int ret
#define todo_wine
Definition: test.h:154
HKEY key
Definition: reg.c:42
unsigned char BYTE
Definition: mem.h:68
#define ERROR_INVALID_DATA
Definition: winerror.h:116
static const WCHAR friendly_name[]
Definition: devenum.c:40
#define ok(value,...)
Definition: atltest.h:57
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
GLuint res
Definition: glext.h:9613
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3457
Definition: _set.h:46
Definition: path.c:42
#define DICD_GENERATE_ID
Definition: setupapi.h:110
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ testSetupDiGetClassDevsA()

static void testSetupDiGetClassDevsA ( void  )
static

Definition at line 1358 of file devinst.c.

1359 {
1360  static GUID displayguid = {0x4d36e968, 0xe325, 0x11ce, {0xbf,0xc1,0x08,0x00,0x2b,0xe1,0x03,0x18}};
1361  SP_DEVINFO_DATA devinfo;
1363  HDEVINFO set;
1364  BOOL ret;
1365 
1366  disp.cb = sizeof(disp);
1367  ok(EnumDisplayDevicesA(NULL, 0, &disp, 0), "EnumDisplayDevices failed: %08x\n", GetLastError());
1368 
1369  SetLastError(0xdeadbeef);
1370  set = SetupDiGetClassDevsA(&displayguid, disp.DeviceID, 0, 0);
1371  ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", GetLastError());
1372 
1373  devinfo.cbSize = sizeof(devinfo);
1374  ret = SetupDiEnumDeviceInfo(set, 0, &devinfo);
1375  ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
1376 
1378 }
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
disp
Definition: i386-dis.c:3181
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEA lpDisplayDevice, DWORD dwFlags)
Definition: display.c:23
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define SetLastError(x)
Definition: compat.h:409
HDEVINFO WINAPI SetupDiGetClassDevsA(CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2241
int ret
#define ok(value,...)
Definition: atltest.h:57
Definition: _set.h:46

Referenced by START_TEST().

Variable Documentation

◆ guid

◆ guid2

GUID guid2 = {0x6a55b5a5, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}}
static