Juan Lang : setupapi: Add error checking to SetupDiCreateDeviceInterfaceW stub.
Alexandre Julliard
julliard at winehq.org
Mon Sep 24 08:08:00 CDT 2007
Module: wine
Branch: master
Commit: 66820122091fa678804fabd75daec4deb10316ef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=66820122091fa678804fabd75daec4deb10316ef
Author: Juan Lang <juan.lang at gmail.com>
Date: Fri Sep 21 11:34:53 2007 -0700
setupapi: Add error checking to SetupDiCreateDeviceInterfaceW stub.
---
dlls/setupapi/devinst.c | 26 ++++++++++++++++++++++++++
dlls/setupapi/tests/devinst.c | 5 -----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 2129296..f316c72 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -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;
}
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index cdeb429..8bf3a25 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -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,
More information about the wine-cvs
mailing list