setupapi: Implement SetupDiRegisterDeviceInfo.

This commit is contained in:
Juan Lang 2007-09-20 09:16:25 -07:00 committed by Alexandre Julliard
parent a57a17d3fc
commit f4b9bc2454
2 changed files with 26 additions and 7 deletions

View File

@ -1060,11 +1060,35 @@ BOOL WINAPI SetupDiRegisterDeviceInfo(
PVOID CompareContext, PVOID CompareContext,
PSP_DEVINFO_DATA DupDeviceInfoData) PSP_DEVINFO_DATA DupDeviceInfoData)
{ {
struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
struct DeviceInfo *devInfo;
TRACE("%p %p %08x %p %p %p\n", DeviceInfoSet, DeviceInfoData, Flags, TRACE("%p %p %08x %p %p %p\n", DeviceInfoSet, DeviceInfoData, Flags,
CompareProc, CompareContext, DupDeviceInfoData); CompareProc, CompareContext, DupDeviceInfoData);
FIXME("\n"); if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
return FALSE; {
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;
}
devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
if (devInfo->phantom)
{
devInfo->phantom = FALSE;
RegDeleteValueW(devInfo->key, Phantom);
}
return TRUE;
} }
/*********************************************************************** /***********************************************************************

View File

@ -289,7 +289,6 @@ static void testRegisterDeviceInfo(void)
} }
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL); ret = pSetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
ret = pSetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL); ret = pSetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
@ -301,18 +300,15 @@ static void testRegisterDeviceInfo(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetupDiRegisterDeviceInfo(set, NULL, 0, NULL, NULL, NULL); ret = pSetupDiRegisterDeviceInfo(set, NULL, 0, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
devInfo.cbSize = sizeof(devInfo); devInfo.cbSize = sizeof(devInfo);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ret = pSetupDiCreateDeviceInfoA(set, "USB\\BOGUS\\0000", &guid, ret = pSetupDiCreateDeviceInfoA(set, "USB\\BOGUS\\0000", &guid,
@ -324,7 +320,6 @@ static void testRegisterDeviceInfo(void)
/* If it already existed, registering it again will fail */ /* If it already existed, registering it again will fail */
ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL,
NULL); NULL);
todo_wine
ok(ret, "SetupDiCreateDeviceInfoA failed: %d\n", GetLastError()); ok(ret, "SetupDiCreateDeviceInfoA failed: %d\n", GetLastError());
} }
/* FIXME: On Win2K+ systems, this is now persisted to registry in /* FIXME: On Win2K+ systems, this is now persisted to registry in