Commit 66820122 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

setupapi: Add error checking to SetupDiCreateDeviceInterfaceW stub.

parent aa2b23ca
......@@ -1800,10 +1800,36 @@ BOOL WINAPI SetupDiCreateDeviceInterfaceW(
DWORD CreationFlags,
PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
{
struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
struct DeviceInfo *devInfo;
TRACE("%p %p %s %s %08x %p\n", DeviceInfoSet, DeviceInfoData,
debugstr_guid(InterfaceClassGuid), debugstr_w(ReferenceString),
CreationFlags, DeviceInterfaceData);
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)
|| !DeviceInfoData->Reserved)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!InterfaceClassGuid)
{
SetLastError(ERROR_INVALID_USER_BUFFER);
return FALSE;
}
devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
FIXME("stub\n");
return FALSE;
}
......
......@@ -351,12 +351,10 @@ static void testCreateDeviceInterface(void)
}
SetLastError(0xdeadbeef);
ret = pSetupDiCreateDeviceInterfaceA(NULL, NULL, NULL, NULL, 0, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pSetupDiCreateDeviceInterfaceA(NULL, NULL, &guid, NULL, 0, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
set = pSetupDiCreateDeviceInfoList(&guid, NULL);
......@@ -369,13 +367,11 @@ static void testCreateDeviceInterface(void)
SetLastError(0xdeadbeef);
ret = pSetupDiCreateDeviceInterfaceA(set, NULL, NULL, NULL, 0, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pSetupDiCreateDeviceInterfaceA(set, &devInfo, NULL, NULL, 0,
NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
devInfo.cbSize = sizeof(devInfo);
......@@ -385,7 +381,6 @@ static void testCreateDeviceInterface(void)
SetLastError(0xdeadbeef);
ret = pSetupDiCreateDeviceInterfaceA(set, &devInfo, NULL, NULL, 0,
NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_USER_BUFFER,
"Expected ERROR_INVALID_USER_BUFFER, got %08x\n", GetLastError());
ret = pSetupDiCreateDeviceInterfaceA(set, &devInfo, &guid, NULL, 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment