Changeset 96603 in vbox for trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestDrvInst.cpp
- Timestamp:
- Sep 5, 2022 6:12:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestDrvInst.cpp
r96421 r96603 98 98 99 99 /** 100 * Inner video driver installation function.100 * Inner NT4 video driver installation function. 101 101 * 102 102 * This can normally return immediately on errors as the parent will do the 103 103 * cleaning up. 104 104 */ 105 static RTEXITCODE InstallVideoDriverInner(WCHAR const * const pwszDriverDir, HDEVINFO hDevInfo, HINF *phInf) 106 { 107 /* 108 * Get the first found driver. 109 * Our Inf file only contains one so this is fine. 110 */ 111 SP_DRVINFO_DATA_W drvInfoData = { sizeof(SP_DRVINFO_DATA) }; 105 static RTEXITCODE InstallNt4VideoDriverInner(WCHAR const * const pwszDriverDir, HDEVINFO hDevInfo, HINF *phInf) 106 { 107 /* 108 * Get the first found driver - our Inf file only contains one so this is ok. 109 * 110 * Note! We must use the V1 structure here as it is the only NT4 recognizes. 111 * There are four versioned structures: 112 * - SP_ALTPLATFORM_INFO 113 * - SP_DRVINFO_DATA_W 114 * - SP_BACKUP_QUEUE_PARAMS_W 115 * - SP_INF_SIGNER_INFO_W, 116 * but we only make use of SP_DRVINFO_DATA_W. 117 */ 118 SetLastError(NO_ERROR); 119 SP_DRVINFO_DATA_V1_W drvInfoData = { sizeof(drvInfoData) }; 112 120 if (!SetupDiEnumDriverInfoW(hDevInfo, NULL, SPDIT_CLASSDRIVER, 0, &drvInfoData)) 113 121 return ErrorMsgLastErr("SetupDiEnumDriverInfoW"); … … 120 128 SP_DRVINFO_DETAIL_DATA_W s; 121 129 uint64_t au64Padding[(sizeof(SP_DRVINFO_DETAIL_DATA_W) + 256) / sizeof(uint64_t)]; 122 } DriverInfoDetailData = { { sizeof( SP_DRVINFO_DETAIL_DATA) } };130 } DriverInfoDetailData = { { sizeof(DriverInfoDetailData.s) } }; 123 131 DWORD cbReqSize = NULL; 124 132 if ( !SetupDiGetDriverInfoDetailW(hDevInfo, NULL, &drvInfoData, … … 164 172 * ... 165 173 */ 166 SP_DEVINFO_DATA deviceInfoData = { sizeof( SP_DEVINFO_DATA) };174 SP_DEVINFO_DATA deviceInfoData = { sizeof(deviceInfoData) }; 167 175 /* Check for existing first. */ 168 176 BOOL fDevInfoOkay = SetupDiOpenDeviceInfoW(hDevInfo, wszDevInstanceId, NULL, 0, &deviceInfoData); … … 190 198 * Redo the install parameter thing with deviceInfoData. 191 199 */ 192 SP_DEVINSTALL_PARAMS_W DeviceInstallParams = { sizeof( SP_DEVINSTALL_PARAMS) };200 SP_DEVINSTALL_PARAMS_W DeviceInstallParams = { sizeof(DeviceInstallParams) }; 193 201 if (!SetupDiGetDeviceInstallParamsW(hDevInfo, &deviceInfoData, &DeviceInstallParams)) 194 202 return ErrorMsgLastErr("SetupDiGetDeviceInstallParamsW(#2)"); /** @todo Original code didn't return here. */ 195 203 196 DeviceInstallParams.cbSize = sizeof( SP_DEVINSTALL_PARAMS);204 DeviceInstallParams.cbSize = sizeof(DeviceInstallParams); 197 205 DeviceInstallParams.Flags |= DI_NOFILECOPY /* We did our own file copying */ 198 206 | DI_DONOTCALLCONFIGMG … … 212 220 213 221 /* 214 * Repeat ethe query at the start of the function.215 */ 216 drvInfoData.cbSize = sizeof( SP_DRVINFO_DATA);222 * Repeat the query at the start of the function. 223 */ 224 drvInfoData.cbSize = sizeof(drvInfoData); 217 225 if (!SetupDiEnumDriverInfoW(hDevInfo, &deviceInfoData, SPDIT_CLASSDRIVER, 0, &drvInfoData)) 218 226 return ErrorMsgLastErr("SetupDiEnumDriverInfoW(#2)"); … … 343 351 * @param pwszDriverDir The base directory where we find the INF. 344 352 */ 345 static RTEXITCODE Install VideoDriver(WCHAR const * const pwszDriverDir)353 static RTEXITCODE InstallNt4VideoDriver(WCHAR const * const pwszDriverDir) 346 354 { 347 355 /* … … 356 364 */ 357 365 RTEXITCODE rcExit = RTEXITCODE_FAILURE; 358 SP_DEVINSTALL_PARAMS_W DeviceInstallParams = { sizeof( SP_DEVINSTALL_PARAMS) };366 SP_DEVINSTALL_PARAMS_W DeviceInstallParams = { sizeof(DeviceInstallParams) }; 359 367 if (SetupDiGetDeviceInstallParamsW(hDevInfo, NULL, &DeviceInstallParams)) 360 368 { … … 362 370 * Insert our install parameters and update hDevInfo with them. 363 371 */ 364 DeviceInstallParams.cbSize = sizeof( SP_DEVINSTALL_PARAMS);372 DeviceInstallParams.cbSize = sizeof(DeviceInstallParams); 365 373 DeviceInstallParams.Flags |= DI_NOFILECOPY /* We did our own file copying */ 366 374 | DI_DONOTCALLCONFIGMG … … 380 388 { 381 389 HINF hInf = NULL; 382 rcExit = Install VideoDriverInner(pwszDriverDir, hDevInfo, &hInf);390 rcExit = InstallNt4VideoDriverInner(pwszDriverDir, hDevInfo, &hInf); 383 391 384 392 if (hInf) … … 479 487 if (cwcInstallDir > 0) 480 488 { 481 while (cwcInstallDir > 0 && RTPATH_IS_SEP(wszInstallDir[cwcInstallDir - 1]))489 while (cwcInstallDir > 0 && !RTPATH_IS_SEP(wszInstallDir[cwcInstallDir - 1])) 482 490 cwcInstallDir--; 483 491 if (!cwcInstallDir) /* paranoia^3 */ … … 492 500 */ 493 501 if (fInstall) 494 rcExit = Install VideoDriver(wszInstallDir);502 rcExit = InstallNt4VideoDriver(wszInstallDir); 495 503 else 496 504 rcExit = UninstallDrivers();
Note:
See TracChangeset
for help on using the changeset viewer.