Changeset 57501 in vbox
- Timestamp:
- Aug 22, 2015 7:15:54 PM (9 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r56916 r57501 43 43 44 44 # include <iprt/buildconfig.h> 45 # include <iprt/ctype.h> 45 46 # include <iprt/initterm.h> 46 47 # include <iprt/process.h> … … 625 626 #else /* VBOX_WITH_HARDENING */ 626 627 628 629 /** 630 * Special entrypoint used by the hardening code when something goes south. 631 * 632 * Display an error dialog to the user. 633 * 634 * @param pszWhere Indicates where the error occured. 635 * @param enmWhat Indicates what init operation was going on at the time. 636 * @param rc The VBox status code corresponding to the error. 637 * @param pszMsgFmt The message format string. 638 * @param va Format arguments. 639 */ 627 640 extern "C" DECLEXPORT(void) TrustedError(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va) 628 641 { … … 630 643 ShutUpAppKit(); 631 644 # endif /* RT_OS_DARWIN */ 632 633 /* We have to create QApplication anyway just to show the only one error-message. 634 * This is a bit hackish as we don't have the argument vector handy. */ 645 char szMsgBuf[_16K]; 646 647 /* 648 * We have to create QApplication anyway just to show the only one error-message. 649 * This is a bit hackish as we don't have the argument vector handy. 650 */ 635 651 int argc = 0; 636 652 char *argv[2] = { NULL, NULL }; 637 653 QApplication a(argc, &argv[0]); 638 654 639 /* Prepare the error-message: */ 640 QString strTitle = QApplication::tr("VirtualBox - Error In %1").arg(pszWhere); 641 642 char szMsgBuf[1024]; 655 /* 656 * The details starts off a properly formatted rc and where/what, we use 657 * the szMsgBuf for this, thus this have to come before the actual message 658 * formatting. 659 */ 660 RTStrPrintf(szMsgBuf, sizeof(szMsgBuf), 661 "<!--EOM-->" 662 "where: %s\n" 663 "what: %d\n" 664 "%Rra\n", 665 pszWhere, enmWhat, rc); 666 QString strDetails = szMsgBuf; 667 668 /* 669 * Format the error message. Take whatever comes after a double new line as 670 * something better off in the details section. 671 */ 643 672 RTStrPrintfV(szMsgBuf, sizeof(szMsgBuf), pszMsgFmt, va); 673 674 char *pszDetails = strstr(szMsgBuf, "\n\n"); 675 if (pszDetails) 676 { 677 while (RT_C_IS_SPACE(*pszDetails)) 678 *pszDetails++ = '\0'; 679 if (*pszDetails) 680 { 681 strDetails += "\n"; 682 strDetails += pszDetails; 683 } 684 RTStrStripR(szMsgBuf); 685 } 686 644 687 QString strText = QApplication::tr("<html><b>%1 (rc=%2)</b><br/><br/>").arg(szMsgBuf).arg(rc); 645 688 strText.replace(QString("\n"), QString("<br>")); 646 689 690 /* 691 * Append possibly helpful hints to the error message. 692 */ 647 693 switch (enmWhat) 648 694 { … … 681 727 strText += "</html>"; 682 728 729 683 730 # ifdef RT_OS_LINUX 684 /* We have to to make sure that we display the error-message 685 * after the parent displayed its own message. */ 731 /* 732 * We have to to make sure that we display the error-message 733 * after the parent displayed its own message. 734 */ 686 735 sleep(2); 687 # endif /* RT_OS_LINUX */ 688 689 QMessageBox::critical(0 /* parent */, strTitle, strText, 690 QMessageBox::Abort /* 1st button */, 0 /* 2nd button */); 736 # endif 737 738 /* 739 * Create the message box and show it. 740 */ 741 QString strTitle = QApplication::tr("VirtualBox - Error In %1").arg(pszWhere); 742 QIMessageBox msgBox(strTitle, strText, AlertIconType_Critical, AlertButton_Ok | AlertButtonOption_Default); 743 if (!strDetails.isEmpty()) 744 msgBox.setDetailsText(strDetails); 745 746 msgBox.exec(); 747 691 748 qFatal("%s", strText.toUtf8().constData()); 692 749 } … … 694 751 #endif /* VBOX_WITH_HARDENING */ 695 752 753 -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r57456 r57501 157 157 uint32_t cchErrorInfo; 158 158 /** The error info. */ 159 char szErrorInfo[ 2048];159 char szErrorInfo[16384 - sizeof(RTLISTNODE) - sizeof(HANDLE)*2 - sizeof(uint64_t) - sizeof(uint32_t) - 0x20]; 160 160 } SUPDRVNTERRORINFO; 161 161 /** Pointer to error info. */ -
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
r57358 r57501 921 921 922 922 /** 923 * @callback_method_impl{RTCRPKCS7VERIFYCERTCALLBACK, 923 * @callback_method_impl{FNRTDUMPPRINTFV, Formats into RTERRINFO. } 924 */ 925 static DECLCALLBACK(void) supHardNtViAsn1DumpToErrInfo(void *pvUser, const char *pszFormat, va_list va) 926 { 927 PRTERRINFO pErrInfo = (PRTERRINFO)pvUser; 928 RTErrInfoAddV(pErrInfo, pErrInfo->rc, pszFormat, va); 929 } 930 931 932 /** 933 * @callback_method_impl{FNRTCRPKCS7VERIFYCERTCALLBACK, 924 934 * Standard code signing. Use this for Microsoft SPC.} 925 935 */ … … 939 949 if (RTCrX509Certificate_Compare(pCert, &g_BuildX509Cert) == 0) /* healthy paranoia */ 940 950 return VINF_SUCCESS; 941 return RTErrInfoSetF(pErrInfo, VERR_SUP_VP_NOT_BUILD_CERT_IPE, "Not valid kernel code signature."); 951 int rc = RTErrInfoSetF(pErrInfo, VERR_SUP_VP_NOT_BUILD_CERT_IPE, "Not valid kernel code signature (fFlags=%#x).", fFlags); 952 if (pErrInfo) 953 { 954 RTErrInfoAdd(pErrInfo, rc, "\n\nExe cert:\n"); 955 RTAsn1Dump(&pCert->SeqCore.Asn1Core, 0 /*fFlags*/, 0 /*uLevel*/, supHardNtViAsn1DumpToErrInfo, pErrInfo); 956 RTErrInfoAdd(pErrInfo, rc, "\n\nBuild cert:\n"); 957 RTAsn1Dump(&g_BuildX509Cert.SeqCore.Asn1Core, 0 /*fFlags*/, 0 /*uLevel*/, supHardNtViAsn1DumpToErrInfo, pErrInfo); 958 } 959 return rc; 942 960 } 943 961 -
trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
r57358 r57501 217 217 char szWhere[80]; 218 218 /** Error message / path name string space. */ 219 char szErrorMsg[ 4096];219 char szErrorMsg[16384+1024]; 220 220 } SUPR3WINPROCPARAMS; 221 221 … … 4365 4365 * better chance resolving the issue. 4366 4366 */ 4367 char szErrorInfo[ _4K];4367 char szErrorInfo[16384]; 4368 4368 int rc = VERR_OPEN_FAILED; 4369 4369 if (SUP_NT_STATUS_IS_VBOX(rcNt)) /* See VBoxDrvNtErr2NtStatus. */ … … 4411 4411 "NtCreateFile(%ls) failed: %Rrc (rcNt=%#x)%s", s_wszName, rc, rcNt, 4412 4412 supR3HardenedWinReadErrorInfoDevice(szErrorInfo, sizeof(szErrorInfo), 4413 "\nVBoxDrvStub error: "));4413 "\nVBoxDrvStub error: ")); 4414 4414 } 4415 4415 else
Note:
See TracChangeset
for help on using the changeset viewer.