Third parameter in INF AddService directive seems to be optional. Ignore the error if it is missing

Implement SetupDiGetDeviceInfoListDetailW

svn path=/trunk/; revision=19518
This commit is contained in:
Hervé Poussineau
2005-11-24 09:05:38 +00:00
parent 5976ea377e
commit 1361420584
3 changed files with 58 additions and 20 deletions
+56 -9
View File
@@ -3283,6 +3283,42 @@ BOOL WINAPI SetupDiCallClassInstaller(
return ret;
}
/***********************************************************************
* SetupDiGetDeviceInfoListDetailW (SETUPAPI.@)
*/
BOOL WINAPI SetupDiGetDeviceInfoListDetailW(
IN HDEVINFO DeviceInfoSet,
OUT PSP_DEVINFO_LIST_DETAIL_DATA_W DeviceInfoListDetailData)
{
struct DeviceInfoSet *list;
BOOL ret = FALSE;
TRACE("%p %p\n", DeviceInfoSet, DeviceInfoListDetailData);
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoListDetailData)
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoListDetailData->cbSize != sizeof(SP_DEVINFO_LIST_DETAIL_DATA_W))
SetLastError(ERROR_INVALID_USER_BUFFER);
else
{
memcpy(
&DeviceInfoListDetailData->ClassGuid,
&list->ClassGuid,
sizeof(GUID));
DeviceInfoListDetailData->RemoteMachineHandle = list->hMachine;
DeviceInfoListDetailData->RemoteMachineName[0] = 0; /* FIXME */
ret = TRUE;
}
TRACE("Returning %d\n", ret);
return ret;
}
/***********************************************************************
* SetupDiGetDeviceInstallParamsA (SETUPAPI.@)
*/
@@ -5915,7 +5951,17 @@ SetupDiInstallDevice(
NULL, 0,
&RequiredSize);
if (!Result)
goto nextfile;
{
if (GetLastError() == ERROR_INVALID_PARAMETER)
{
/* This first is probably missing. It is not
* required, so ignore the error */
RequiredSize = 0;
Result = TRUE;
}
else
goto nextfile;
}
if (RequiredSize > 0)
{
/* We got the needed size for the buffer */
@@ -5932,11 +5978,12 @@ SetupDiInstallDevice(
&RequiredSize);
if (!Result)
goto nextfile;
SetLastError(ERROR_SUCCESS);
Result = SetupInstallServicesFromInfSectionExW(
SelectedDriver->InfFileDetails->hInf,
ServiceSection, Flags, DeviceInfoSet, DeviceInfoData, ServiceName, NULL);
}
SetLastError(ERROR_SUCCESS);
Result = SetupInstallServicesFromInfSectionExW(
SelectedDriver->InfFileDetails->hInf,
ServiceSection, Flags, DeviceInfoSet, DeviceInfoData, ServiceName, NULL);
if (Result && (Flags & SPSVCINST_ASSOCSERVICE))
{
AssociatedService = ServiceName;
@@ -5989,20 +6036,20 @@ nextfile:
/* Write information to enum key */
TRACE("Write information to enum key\n");
TRACE("Service : '%S'\n", AssociatedService);
TRACE("Class : '%S'\n", ClassName);
TRACE("ClassGUID : '%S'\n", lpFullGuidString);
TRACE("DeviceDesc : '%S'\n", SelectedDriver->Info.Description);
TRACE("Mfg : '%S'\n", SelectedDriver->Info.MfgName);
rc = RegSetValueEx(hKey, L"Service", 0, REG_SZ, (const BYTE *)AssociatedService, (wcslen(AssociatedService) + 1) * sizeof(WCHAR));
if (rc == ERROR_SUCCESS)
rc = RegSetValueEx(hKey, L"Class", 0, REG_SZ, (const BYTE *)ClassName, (wcslen(ClassName) + 1) * sizeof(WCHAR));
TRACE("Service : '%S'\n", AssociatedService);
rc = RegSetValueEx(hKey, L"Class", 0, REG_SZ, (const BYTE *)ClassName, (wcslen(ClassName) + 1) * sizeof(WCHAR));
if (rc == ERROR_SUCCESS)
rc = RegSetValueEx(hKey, L"ClassGUID", 0, REG_SZ, (const BYTE *)lpFullGuidString, (wcslen(lpFullGuidString) + 1) * sizeof(WCHAR));
if (rc == ERROR_SUCCESS)
rc = RegSetValueEx(hKey, L"DeviceDesc", 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (wcslen(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR));
if (rc == ERROR_SUCCESS)
rc = RegSetValueEx(hKey, L"Mfg", 0, REG_SZ, (const BYTE *)SelectedDriver->Info.MfgName, (wcslen(SelectedDriver->Info.MfgName) + 1) * sizeof(WCHAR));
if (rc == ERROR_SUCCESS && *AssociatedService)
rc = RegSetValueEx(hKey, L"Service", 0, REG_SZ, (const BYTE *)AssociatedService, (wcslen(AssociatedService) + 1) * sizeof(WCHAR));
if (rc != ERROR_SUCCESS)
{
SetLastError(rc);
+2 -2
View File
@@ -1691,7 +1691,7 @@ BOOL WINAPI SetupGetStringFieldA( PINFCONTEXT context, DWORD index, PSTR buffer,
unsigned int len;
SetLastError(0);
if (!field) return FALSE;
if (!field) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; }
len = PARSER_string_substA( file, field->text, NULL, 0 );
if (required) *required = len + 1;
if (buffer)
@@ -1722,7 +1722,7 @@ BOOL WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer
unsigned int len;
SetLastError(0);
if (!field) return FALSE;
if (!field) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; }
len = PARSER_string_substW( file, field->text, NULL, 0 );
if (required) *required = len + 1;
if (buffer)
-9
View File
@@ -50,15 +50,6 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailA(HDEVINFO devinfo, PSP_DEVINFO_LIST_D
return FALSE;
}
/***********************************************************************
* SetupDiGetDeviceInfoListDetailW (SETUPAPI.@)
*/
BOOL WINAPI SetupDiGetDeviceInfoListDetailW(HDEVINFO devinfo, PSP_DEVINFO_LIST_DETAIL_DATA_W devinfo_data )
{
FIXME("\n");
return FALSE;
}
/***********************************************************************
* SetupCopyOEMInfA (SETUPAPI.@)
*/