Author: hbelusca
Date: Wed Aug 27 12:38:45 2014
New Revision: 63960
URL:
http://svn.reactos.org/svn/reactos?rev=63960&view=rev
Log:
[MPLAY32]: Improve ShowLastWin32Error().
Modified:
trunk/reactos/base/applications/mplay32/mplay32.c
Modified: trunk/reactos/base/applications/mplay32/mplay32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] Wed Aug 27 12:38:45
2014
@@ -88,13 +88,19 @@
static VOID
ShowLastWin32Error(HWND hwnd)
{
- DWORD dwError;
LPTSTR lpMessageBuffer;
-
- dwError = GetLastError();
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
dwError, 0, (LPWSTR)&lpMessageBuffer, 0, NULL);
- MessageBox(hwnd, lpMessageBuffer, szAppTitle, MB_OK | MB_ICONERROR);
- LocalFree(lpMessageBuffer);
+ DWORD dwError = GetLastError();
+
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ dwError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&lpMessageBuffer,
+ 0, NULL) != 0)
+ {
+ MessageBox(hwnd, lpMessageBuffer, szAppTitle, MB_OK | MB_ICONERROR);
+ if (lpMessageBuffer) LocalFree(lpMessageBuffer);
+ }
}
static VOID