Changeset 34195 in vbox for trunk/src/VBox/Installer/win/Stub
- Timestamp:
- Nov 19, 2010 1:14:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp
r33540 r34195 20 20 *******************************************************************************/ 21 21 #include <windows.h> 22 #include <lmerr.h> 22 23 #include <msiquery.h> 23 24 #include <objbase.h> … … 89 90 char *pszMsg; 90 91 va_list va; 92 int rc; 91 93 92 94 va_start(va, pszFmt); 93 RTStrAPrintfV(&pszMsg, pszFmt, va); 95 if (RTStrAPrintfV(&pszMsg, pszFmt, va)) 96 { 97 rc = MessageBox(GetDesktopWindow(), pszMsg, VBOX_STUB_TITLE, MB_ICONERROR); 98 RTStrFree(pszMsg); 99 } 100 else /* Should never happen! */ 101 AssertMsgFailed(("Failed to format error text of format string: %s!\n", pszFmt)); 94 102 va_end(va); 95 96 int rc;97 if (pszMsg)98 rc = MessageBox(GetDesktopWindow(), pszMsg, VBOX_STUB_TITLE, MB_ICONERROR);99 else100 rc = MessageBox(GetDesktopWindow(), pszFmt, VBOX_STUB_TITLE, MB_ICONERROR);101 RTStrFree(pszMsg);102 103 return rc; 103 104 } … … 130 131 /* Get resource size. */ 131 132 *pdwSize = SizeofResource(hInst, hRsrc); 132 AssertMsgBreak( (*pdwSize > 0,"Size of resource is invalid!\n"));133 AssertMsgBreak(*pdwSize > 0, ("Size of resource is invalid!\n")); 133 134 134 135 /* Get pointer to resource. */ … … 547 548 { 548 549 char *pszLog = RTPathJoinA(szExtractPath, "VBoxInstallLog.txt"); 549 AssertMsg RCBreak(vrc, ("Could not convert MSI log string to current codepage!\n"));550 AssertMsgBreak(pszLog, ("Could not construct path for log file!\n")); 550 551 UINT uLogLevel = MsiEnableLog(INSTALLLOGMODE_VERBOSE, 551 552 pszLog, INSTALLLOGATTRIBUTES_FLUSHEACHLINE); … … 571 572 case ERROR_INSTALL_PLATFORM_UNSUPPORTED: 572 573 573 ShowError("This installation package is not supported on this platform. \n");574 ShowError("This installation package is not supported on this platform."); 574 575 break; 575 576 576 577 default: 577 578 /** @todo Use FormatMessage here! */ 579 ShowError("Installation failed! ERROR: %u", uStatus); 578 { 579 DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER 580 | FORMAT_MESSAGE_IGNORE_INSERTS 581 | FORMAT_MESSAGE_FROM_SYSTEM; 582 HMODULE hModule = NULL; 583 if (uStatus >= NERR_BASE && uStatus <= MAX_NERR) 584 { 585 hModule = LoadLibraryEx(TEXT("netmsg.dll"), 586 NULL, 587 LOAD_LIBRARY_AS_DATAFILE); 588 if (hModule != NULL) 589 dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE; 590 } 591 592 DWORD dwBufferLength; 593 LPSTR szMessageBuffer; 594 if (dwBufferLength = FormatMessageA(dwFormatFlags, 595 hModule, /* If NULL, load system stuff. */ 596 uStatus, 597 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 598 (LPSTR)&szMessageBuffer, 599 0, 600 NULL)) 601 { 602 ShowError("Installation failed! Error: %s", szMessageBuffer); 603 LocalFree(szMessageBuffer); 604 } 605 else /* If text lookup failed, show at least the error number. */ 606 ShowError("Installation failed! Error: %u", uStatus); 607 if (hModule) 608 FreeLibrary(hModule); 580 609 break; 610 } 581 611 } 582 612 }
Note:
See TracChangeset
for help on using the changeset viewer.