MCPcopy Create free account
hub / github.com/SOUI2/soui / MyFormatMessage

Function MyFormatMessage

third-part/7z/CPP/Windows/ErrorMsg.cpp:18–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace NError {
17
18static bool MyFormatMessage(DWORD errorCode, UString &message)
19{
20 LPVOID msgBuf;
21 #ifndef _UNICODE
22 if (!g_IsNT)
23 {
24 if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
25 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
26 NULL, errorCode, 0, (LPTSTR) &msgBuf, 0, NULL) == 0)
27 return false;
28 message = GetUnicodeString((LPCTSTR)msgBuf);
29 }
30 else
31 #endif
32 {
33 if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
34 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
35 NULL, errorCode, 0, (LPWSTR) &msgBuf, 0, NULL) == 0)
36 return false;
37 message = (LPCWSTR)msgBuf;
38 }
39 ::LocalFree(msgBuf);
40 return true;
41}
42
43UString MyFormatMessage(DWORD errorCode)
44{

Callers 15

ShowErrorMessageDWORDFunction · 0.85
ShowSysErrorMessageFunction · 0.85
MainAr.cppFile · 0.85
ScanErrorMethod · 0.85
OpenResultMethod · 0.85
ExtractResultMethod · 0.85
ListArchivesFunction · 0.85
PrintWarningsPathsFunction · 0.85
WarningsCheckFunction · 0.85
CommonErrorMethod · 0.85
ErrorMessageHRESULTFunction · 0.85

Calls 5

GetUnicodeStringFunction · 0.85
IsEmptyMethod · 0.45
AddAsciiMethod · 0.45
LenMethod · 0.45
DeleteFromMethod · 0.45

Tested by

no test coverage detected