* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Display Control Panel
* FILE: dll/cpl/desk/classinst.c
- * PURPOSE: Display class installer
+ * PURPOSE: Class installers
*
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
*/
HKEY hServicesKey = NULL;
HKEY hServiceKey = NULL;
HKEY hDeviceSubKey = NULL;
- DWORD disposition;
+ DWORD disposition, cchMax, cbData;
BOOL result;
LONG rc;
+ HRESULT hr;
if (InstallFunction != DIF_INSTALLDEVICE)
return ERROR_DI_DO_DEFAULT;
/* Set DI_DONOTCALLCONFIGMG flag */
- InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
+ InstallParams.cbSize = sizeof(InstallParams);
result = SetupDiGetDeviceInstallParams(DeviceInfoSet, DeviceInfoData, &InstallParams);
if (!result)
{
}
/* Get .inf file name and section name */
- DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
+ DriverInfoData.cbSize = sizeof(DriverInfoData);
result = SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData, &DriverInfoData);
if (!result)
{
goto cleanup;
}
- DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
- result = SetupDiGetDriverInfoDetail(
- DeviceInfoSet, DeviceInfoData,
- &DriverInfoData, &DriverInfoDetailData,
- sizeof(SP_DRVINFO_DETAIL_DATA), NULL);
+ DriverInfoDetailData.cbSize = sizeof(DriverInfoDetailData);
+ result = SetupDiGetDriverInfoDetail(DeviceInfoSet, DeviceInfoData,
+ &DriverInfoData, &DriverInfoDetailData,
+ sizeof(DriverInfoDetailData), NULL);
if (!result && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
rc = GetLastError();
goto cleanup;
}
- result = SetupDiGetActualSectionToInstall(
- hInf, DriverInfoDetailData.SectionName,
- SectionName, MAX_PATH - _tcslen(_T(".SoftwareSettings")), NULL, NULL);
+ cchMax = MAX_PATH - (sizeof(_T(".SoftwareSettings")) / sizeof(TCHAR));
+ result = SetupDiGetActualSectionToInstall(hInf,
+ DriverInfoDetailData.SectionName,
+ SectionName,
+ cchMax,
+ NULL,
+ NULL);
if (!result)
{
rc = GetLastError();
DPRINT("SetupDiGetActualSectionToInstall() failed with error 0x%lx\n", rc);
goto cleanup;
}
- _tcscat(SectionName, _T(".SoftwareSettings"));
+ hr = StringCbCat(SectionName, sizeof(SectionName), _T(".SoftwareSettings"));
+ if (FAILED(hr))
+ {
+ rc = ERROR_INSUFFICIENT_BUFFER;
+ goto cleanup;
+ }
/* Open driver registry key and create Settings subkey */
hDriverKey = SetupDiOpenDevRegKey(
goto cleanup;
}
+ /* Add Device Description string */
+ cbData = (DWORD)(_tcslen(DriverInfoData.Description) + 1) * sizeof(TCHAR);
+ rc = RegSetValueEx(hDeviceSubKey,
+ _T("Device Description"),
+ 0,
+ REG_SZ,
+ (const BYTE*)DriverInfoData.Description,
+ cbData);
+ if (rc != ERROR_SUCCESS)
+ {
+ DPRINT("RegSetValueEx() failed with error 0x%lx\n", rc);
+ goto cleanup;
+ }
+
/* FIXME: install OpenGLSoftwareSettings section */
rc = ERROR_SUCCESS;
return rc;
}
+
+DWORD WINAPI
+MonitorClassInstaller(
+ IN DI_FUNCTION InstallFunction,
+ IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
+{
+ return ERROR_DI_DO_DEFAULT;
+}