X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Flib%2Fsetupapi%2Fdevinst.c;h=880a5ad063768d505937bd2d0f21be0a778134e6;hp=11f4aec60d023448e8c2870593bc4f183b62f509;hb=f0a99faa99b3968126c95d61342801b0078c959f;hpb=66242cc2c649de610b67a2517ff1124ea07b0e53 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.@) */