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

setupapi: Implement SetupDiRegisterDeviceInfo.

parent a57a17d3
...@@ -1060,11 +1060,35 @@ BOOL WINAPI SetupDiRegisterDeviceInfo( ...@@ -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;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -289,7 +289,6 @@ static void testRegisterDeviceInfo(void) ...@@ -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) ...@@ -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) ...@@ -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
......
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