std::string Diagnostics::ErrorFrame::ToString() const { StringRef FormatString = ErrorTypeToString(Type); std::string ErrorOut = FormatErrorString(FormatString, Args); if (Range.Start.Line > 0 && Range.Start.Column > 0) return (Twine(Range.Start.Line) + ":" + Twine(Range.Start.Column) + ": " + ErrorOut).str(); return ErrorOut; }
VOID __stdcall CPGPdiskDrv::ReportErrorStartCallback( VMHANDLE hVM, THREADHANDLE hThread, PVOID Refdata, PCLIENT_STRUCT pRegs) { DualErr derr; ErrorCell *pErrPacket; LPSTR errString; static SHELLMessage_THUNK callbackThunk; // Pop an error off the queue. if (!Driver->mErrorQueue.Pop((PGPUInt32 *) &pErrPacket)) { pgpAssert(FALSE); return; } pgpAssertAddrValid(pErrPacket, ErrorCell); // Allocate scratch space for the error string. if (NULL==(int)(errString = new char[kHugeStringSize])) derr = DualErr(kPGDMinorError_OutOfMemory); // Format and display the error message. if (derr.IsntError()) { FormatErrorString(pErrPacket->perr, pErrPacket->derr, pErrPacket->drive, errString, kHugeStringSize); pErrPacket->errString = errString; switch (pErrPacket->perr) { case kPGDMajorError_PGPdiskReadError: case kPGDMajorError_PGPdiskWriteError: SHELL_Message(Get_Sys_VM_Handle(), MB_ICONEXCLAMATION | MB_YESNO, errString, "PGPdisk Error", ReportErrorEndCallback, pErrPacket, &callbackThunk); break; default: SHELL_Message(Get_Sys_VM_Handle(), MB_ICONEXCLAMATION | MB_OK, errString, "PGPdisk Error", ReportErrorEndCallback, pErrPacket, &callbackThunk); break; } } }
bool GetWin32ErrorString(DWORD LastNtStatus, std::wstring& Str) { return FormatErrorString(false, LastNtStatus, Str); }
bool GetNtErrorString(NTSTATUS LastNtStatus, string& Str) { return FormatErrorString(true, LastNtStatus, Str); }
bool GetWin32ErrorString(DWORD LastWin32Error, string& Str) { return FormatErrorString(false, LastWin32Error, Str); }