MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / FormatLastError

Function FormatLastError

sourcecommon/utils.cpp:1275–1295  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1273}
1274//---------------------------------------------------------------------------
1275AnsiString FormatLastError(DWORD & error)
1276{
1277 AnsiString rv;
1278 error = GetLastError();
1279 LPVOID lpMsgBuf;
1280 if( ! FormatMessage(
1281 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
1282 NULL,
1283 error,
1284 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
1285 (LPTSTR) &lpMsgBuf,
1286 0,
1287 NULL)
1288 )
1289 return rv;
1290 rv = (LPCTSTR)lpMsgBuf;
1291 //lstrcpyn(szMess, (LPCTSTR)lpMsgBuf, MessSize);
1292 // Free the buffer.
1293 LocalFree( lpMsgBuf );
1294 return rv;
1295}
1296//---------------------------------------------------------------------------
1297AnsiString FormatLastError2(DWORD error)
1298{

Callers 1

MySetLocalTimeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected