- Timestamp:
- Jan 28, 2013 4:11:29 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp
r44339 r44432 57 57 } DIFXAPI_LOG; 58 58 59 typedef void (WINAPI * DIFXLOGCALLBACK_W) (DIFXAPI_LOG Event, DWORD Error, PCWSTR EventDescription, PVOID CallbackContext);60 typedef void ( __cdecl* DIFXAPILOGCALLBACK_W) (DIFXAPI_LOG Event, DWORD Error, PCWSTR EventDescription, PVOID CallbackContext);59 typedef void (WINAPI * DIFXLOGCALLBACK_W)( DIFXAPI_LOG Event, DWORD Error, PCWSTR EventDescription, PVOID CallbackContext); 60 typedef void ( __cdecl* DIFXAPILOGCALLBACK_W)( DIFXAPI_LOG Event, DWORD Error, PCWSTR EventDescription, PVOID CallbackContext); 61 61 62 62 typedef DWORD (WINAPI *fnDriverPackageInstall) (PCTSTR DriverPackageInfPath, DWORD Flags, PCINSTALLERINFO pInstallerInfo, BOOL *pNeedReboot); … … 68 68 typedef VOID (WINAPI *fnDIFXAPISetLogCallback) (DIFXAPILOGCALLBACK_W LogCallback, PVOID CallbackContext); 69 69 fnDIFXAPISetLogCallback g_pfnDIFXAPISetLogCallback = NULL; 70 71 typedef HRESULT (WINAPI *fnLaunchINFSectionEx) (HWND hwnd, HINSTANCE hInst, PSTR pszParams, INT nShow);72 fnLaunchINFSectionEx g_pfnLaunchINFSectionEx = NULL;73 70 74 71 /* Defines */ … … 361 358 * 362 359 * @return Exit code (EXIT_OK, EXIT_FAIL) 363 * @param pszInf Full qualified path of the .INF file to use.364 360 * @param pszSection Section to execute; usually it's "DefaultInstall". 365 361 * @param iMode Execution mode to use (see MSDN). 362 * @param pszInf Full qualified path of the .INF file to use. 366 363 */ 367 int ExecuteInfFile(const _TCHAR *psz Inf, const _TCHAR *pszSection, int iMode)364 int ExecuteInfFile(const _TCHAR *pszSection, int iMode, const _TCHAR *pszInf) 368 365 { 369 366 _tprintf(_T("Executing INF-File: %ws (Section: %ws) ...\n"), pszInf, pszSection); 370 367 371 368 /* Executed by the installer that already has proper privileges. */ 372 373 HRESULT hr = S_OK; 374 HMODULE hAdvPack = LoadLibrary(_T("advpack.dll")); 375 if (NULL == hAdvPack) 376 { 377 _tprintf(_T("ERROR: Unable to locate advpack.dll!\n")); 378 hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); 379 } 380 else 381 { 382 g_pfnLaunchINFSectionEx = (fnLaunchINFSectionEx)GetProcAddress(hAdvPack, "LaunchINFSectionEx"); 383 if (g_pfnLaunchINFSectionEx == NULL) 384 { 385 _tprintf(_T("ERROR: Unable to retrieve entry point for LaunchINFSectionEx!\n")); 386 hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND); 387 } 388 } 369 _TCHAR szCommandLine[_MAX_PATH + 1] = { 0 }; 370 swprintf(szCommandLine, sizeof(szCommandLine), TEXT( "%ws %d %ws" ), pszSection, iMode, pszInf); 389 371 390 372 #ifdef DEBUG 391 _tprintf (_T( " pfnLaunchINFSectionEx=%p\n"), g_pfnLaunchINFSectionEx);373 _tprintf (_T( "Commandline: %ws\n"), szCommandLine); 392 374 #endif 393 375 394 if (!g_pfnLaunchINFSectionEx) 395 { 396 _TCHAR szCommandLine[_MAX_PATH + 1] = { 0 }; 397 398 swprintf(szCommandLine, sizeof(szCommandLine), TEXT("%ws %d %ws"), 399 pszSection, iMode, pszInf); 400 401 InstallHinfSection(NULL /* hWnd */, NULL /* hInst */, 402 szCommandLine, SW_SHOW); 403 /* No return value given! */ 404 } 405 else 406 { 407 char szCommandLine[_MAX_PATH + 1] = { 0 }; 408 409 /* 4 means silent mode. */ 410 _snprintf(szCommandLine, sizeof(szCommandLine), "%ws,%ws,,4", 411 pszInf, pszSection); 412 413 hr = g_pfnLaunchINFSectionEx(NULL /* hWnd */, NULL /* hInst */, 414 szCommandLine, 0 /* Not used */); 415 if (FAILED(hr)) 416 _tprintf(_T("ERROR: LaunchINFSectionEx failed: 0x%08lx\n"), hr); 417 } 418 419 if (NULL != hAdvPack) 420 FreeLibrary(hAdvPack); 376 InstallHinfSection(NULL, NULL, szCommandLine, SW_SHOW); 377 /* No return value given! */ 421 378 422 379 return EXIT_OK; … … 1110 1067 { 1111 1068 _sntprintf(szINF, sizeof(szINF) / sizeof(TCHAR), _T("%ws"), argv[3]); 1112 rc = ExecuteInfFile( szINF, _T("DefaultInstall"), 132);1069 rc = ExecuteInfFile(_T("DefaultInstall"), 132, szINF); 1113 1070 } 1114 1071 }
Note:
See TracChangeset
for help on using the changeset viewer.