From e28ed99f1bd6e56656ded2ffb79318c3a5c2d02b Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Wed, 31 Dec 2008 22:01:58 +0000 Subject: [PATCH] - Implement SetupDiSetDeviceInstallParamsA. svn path=/trunk/; revision=38494 --- reactos/dll/win32/setupapi/devinst.c | 36 ++++++++++++++++++++++++ reactos/dll/win32/setupapi/setupapi.spec | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/setupapi/devinst.c b/reactos/dll/win32/setupapi/devinst.c index 22177a5f92b..d3637f01e72 100644 --- a/reactos/dll/win32/setupapi/devinst.c +++ b/reactos/dll/win32/setupapi/devinst.c @@ -4242,6 +4242,42 @@ SetupDiSetDeviceInstallParamsW( return ret; } +BOOL WINAPI SetupDiSetDeviceInstallParamsA( + HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + PSP_DEVINSTALL_PARAMS_A DeviceInstallParams) +{ + SP_DEVINSTALL_PARAMS_W deviceInstallParamsW; + int len = 0; + BOOL ret = FALSE; + + TRACE("%p %p %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstallParams); + + if (DeviceInstallParams == NULL) + SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInstallParams->cbSize < sizeof(SP_DEVINSTALL_PARAMS_A)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else + { + memcpy(&deviceInstallParamsW, DeviceInstallParams, FIELD_OFFSET(SP_DEVINSTALL_PARAMS_A, DriverPath)); + deviceInstallParamsW.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W); + len = MultiByteToWideChar(CP_ACP, 0, DeviceInstallParams->DriverPath, -1, NULL, 0); + if (!len) + { + ERR("DrivePath is NULL\n"); + ret = FALSE; + } + else + { + MultiByteToWideChar(CP_ACP, 0, DeviceInstallParams->DriverPath, -1, deviceInstallParamsW.DriverPath, len); + ret = SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &deviceInstallParamsW); + } + } + + TRACE("Returning %d\n", ret); + return ret; +} + static HKEY OpenHardwareProfileKey( IN HKEY HKLM, diff --git a/reactos/dll/win32/setupapi/setupapi.spec b/reactos/dll/win32/setupapi/setupapi.spec index cb89b25a6fb..4f0d7617600 100644 --- a/reactos/dll/win32/setupapi/setupapi.spec +++ b/reactos/dll/win32/setupapi/setupapi.spec @@ -382,7 +382,7 @@ @ stub SetupDiSelectOEMDrv @ stdcall SetupDiSetClassInstallParamsA(ptr ptr ptr long) @ stdcall SetupDiSetClassInstallParamsW(ptr ptr ptr long) -@ stub SetupDiSetDeviceInstallParamsA +@ stdcall SetupDiSetDeviceInstallParamsA(ptr ptr ptr) @ stdcall SetupDiSetDeviceInstallParamsW(ptr ptr ptr) @ stdcall SetupDiSetDeviceRegistryPropertyA(ptr ptr long ptr long) @ stdcall SetupDiSetDeviceRegistryPropertyW(ptr ptr long ptr long)