setupapi: Add a basic implementation of SetupDiCallClassInstaller().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-05-22 11:15:38 -05:00 committed by Alexandre Julliard
parent a35a2ec2af
commit 43ee138d47
3 changed files with 75 additions and 7 deletions

View File

@ -3520,15 +3520,34 @@ BOOL WINAPI SetupDiSetClassInstallParamsW(
}
/***********************************************************************
* SetupDiCallClassInstaller (SETUPAPI.@)
* SetupDiCallClassInstaller (SETUPAPI.@)
*/
BOOL WINAPI SetupDiCallClassInstaller(
DI_FUNCTION InstallFunction,
HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData)
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION function, HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
{
FIXME("%d %p %p\n", InstallFunction, DeviceInfoSet, DeviceInfoData);
return FALSE;
TRACE("function %#x, devinfo %p, device_data %p.\n", function, devinfo, device_data);
switch (function)
{
case DIF_REGISTERDEVICE:
return SetupDiRegisterDeviceInfo(devinfo, device_data, 0, NULL, NULL, NULL);
case DIF_REMOVE:
return SetupDiRemoveDevice(devinfo, device_data);
case DIF_SELECTBESTCOMPATDRV:
return SetupDiSelectBestCompatDrv(devinfo, device_data);
case DIF_REGISTER_COINSTALLERS:
return SetupDiRegisterCoDeviceInstallers(devinfo, device_data);
case DIF_FINISHINSTALL_ACTION:
case DIF_INSTALLDEVICE:
case DIF_INSTALLDEVICEFILES:
case DIF_INSTALLINTERFACES:
case DIF_PROPERTYCHANGE:
case DIF_SELECTDEVICE:
case DIF_UNREMOVE:
FIXME("Unhandled function %#x.\n", function);
default:
SetLastError(ERROR_DI_DO_DEFAULT);
return FALSE;
}
}
/***********************************************************************

View File

@ -2336,6 +2336,53 @@ static void test_driver_list(void)
DeleteFileA("C:/windows/inf/wine_test2.pnf");
}
static BOOL device_is_registered(HDEVINFO set, SP_DEVINFO_DATA *device)
{
HKEY key = SetupDiOpenDevRegKey(set, device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0);
ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
RegCloseKey(key);
return GetLastError() == ERROR_KEY_DOES_NOT_EXIST;
}
static void test_call_class_installer(void)
{
SP_DEVINFO_DATA device = {sizeof(device)};
HDEVINFO set;
BOOL ret;
if (wow64)
{
skip("SetupDiCallClassInstaller() does not work on WoW64.\n");
return;
}
set = SetupDiCreateDeviceInfoList(&guid, NULL);
ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
ok(device_is_registered(set, &device), "Expected device to be registered.\n");
/* This is probably not failure per se, but rather an indication that no
* class installer was called and no default handler exists. */
ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
ok(!ret, "Expected failure.\n");
ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
ret = SetupDiCallClassInstaller(0xdeadbeef, set, &device);
ok(!ret, "Expected failure.\n");
ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
SetupDiDestroyDeviceInfoList(set);
}
START_TEST(devinst)
{
static BOOL (WINAPI *pIsWow64Process)(HANDLE, BOOL *);
@ -2372,4 +2419,5 @@ START_TEST(devinst)
test_device_interface_key();
test_device_install_params();
test_driver_list();
test_call_class_installer();
}

View File

@ -1106,6 +1106,7 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PSP_INF_SIGNER_INFO)
#define DIF_POWERMESSAGEWAKE 0x27
#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED 0x28
#define DIF_UPDATEDRIVER_UI 0x29
#define DIF_FINISHINSTALL_ACTION 0x2a
#define DIF_RESERVED2 0x30
/* Directory ids */