From f0a99faa99b3968126c95d61342801b0078c959f Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Wed, 26 Oct 2005 19:00:08 +0000 Subject: [PATCH 1/1] implemented SetupDiSetSelectedDriverA svn path=/trunk/; revision=18778 --- reactos/lib/setupapi/devinst.c | 66 +++++++++++++++++++++++++++++- reactos/lib/setupapi/setupapi.spec | 2 +- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/reactos/lib/setupapi/devinst.c b/reactos/lib/setupapi/devinst.c index 11f4aec60d0..880a5ad0637 100644 --- a/reactos/lib/setupapi/devinst.c +++ b/reactos/lib/setupapi/devinst.c @@ -121,7 +121,7 @@ struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */ struct InfFileDetails { HINF hInf; - ULONG References; + LONG References; }; struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */ @@ -4974,6 +4974,70 @@ SetupDiGetSelectedDriverW( return ret; } + +/*********************************************************************** + * SetupDiSetSelectedDriverA (SETUPAPI.@) + */ +BOOL WINAPI +SetupDiSetSelectedDriverA( + IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, + IN OUT PSP_DRVINFO_DATA_A DriverInfoData OPTIONAL) +{ + SP_DRVINFO_DATA_V1_W DriverInfoDataW; + PSP_DRVINFO_DATA_W pDriverInfoDataW = NULL; + BOOL ret = FALSE; + + if (DriverInfoData != NULL) + { + if (DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V2_A) && + DriverInfoData->cbSize != sizeof(SP_DRVINFO_DATA_V1_A)); + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + DriverInfoDataW.cbSize = sizeof(SP_DRVINFO_DATA_V1_W); + DriverInfoDataW.Reserved = DriverInfoData->Reserved; + + if (DriverInfoDataW.Reserved == 0) + { + DriverInfoDataW.DriverType = DriverInfoData->DriverType; + + /* convert the strings to unicode */ + if (!MultiByteToWideChar(CP_ACP, + 0, + DriverInfoData->Description, + LINE_LEN, + DriverInfoDataW.Description, + LINE_LEN) || + !MultiByteToWideChar(CP_ACP, + 0, + DriverInfoData->ProviderName, + LINE_LEN, + DriverInfoDataW.ProviderName, + LINE_LEN)) + { + return FALSE; + } + } + + pDriverInfoDataW = (PSP_DRVINFO_DATA_W)&DriverInfoDataW; + } + + ret = SetupDiSetSelectedDriverW(DeviceInfoSet, + DeviceInfoData, + pDriverInfoDataW); + + if (ret && pDriverInfoDataW != NULL) + { + DriverInfoData->Reserved = DriverInfoDataW.Reserved; + } + + return ret; +} + + /*********************************************************************** * SetupDiSetSelectedDriverW (SETUPAPI.@) */ diff --git a/reactos/lib/setupapi/setupapi.spec b/reactos/lib/setupapi/setupapi.spec index a1fb4cedd6d..e81eeda1854 100644 --- a/reactos/lib/setupapi/setupapi.spec +++ b/reactos/lib/setupapi/setupapi.spec @@ -381,7 +381,7 @@ @ stub SetupDiSetDriverInstallParamsA @ stub SetupDiSetDriverInstallParamsW @ stub SetupDiSetSelectedDevice -@ stub SetupDiSetSelectedDriverA +@ stdcall SetupDiSetSelectedDriverA(ptr ptr ptr) @ stdcall SetupDiSetSelectedDriverW(ptr ptr ptr) @ stub SetupDiUnremoveDevice @ stub SetupDuplicateDiskSpaceListA -- 2.17.1