Changeset 44339 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Jan 23, 2013 3:32:39 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp
r43033 r44339 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; 70 73 71 74 /* Defines */ … … 358 361 * 359 362 * @return Exit code (EXIT_OK, EXIT_FAIL) 363 * @param pszInf Full qualified path of the .INF file to use. 360 364 * @param pszSection Section to execute; usually it's "DefaultInstall". 361 365 * @param iMode Execution mode to use (see MSDN). 362 * @param pszInf Full qualified path of the .INF file to use.363 366 */ 364 int ExecuteInfFile(const _TCHAR *psz Section, int iMode, const _TCHAR *pszInf)367 int ExecuteInfFile(const _TCHAR *pszInf, const _TCHAR *pszSection, int iMode) 365 368 { 366 369 _tprintf(_T("Executing INF-File: %ws (Section: %ws) ...\n"), pszInf, pszSection); 367 370 368 371 /* Executed by the installer that already has proper privileges. */ 369 _TCHAR szCommandLine[_MAX_PATH + 1] = { 0 }; 370 swprintf(szCommandLine, sizeof(szCommandLine), TEXT( "%ws %d %ws" ), pszSection, iMode, pszInf); 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 } 371 389 372 390 #ifdef DEBUG 373 _tprintf (_T( " Commandline: %ws\n"), szCommandLine);391 _tprintf (_T( "pfnLaunchINFSectionEx=%p\n"), g_pfnLaunchINFSectionEx); 374 392 #endif 375 393 376 InstallHinfSection(NULL, NULL, szCommandLine, SW_SHOW); 377 /* No return value given! */ 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); 378 421 379 422 return EXIT_OK; … … 1067 1110 { 1068 1111 _sntprintf(szINF, sizeof(szINF) / sizeof(TCHAR), _T("%ws"), argv[3]); 1069 rc = ExecuteInfFile( _T("DefaultInstall"), 132, szINF);1112 rc = ExecuteInfFile(szINF, _T("DefaultInstall"), 132); 1070 1113 } 1071 1114 }
Note:
See TracChangeset
for help on using the changeset viewer.