From 2ee074752dfd196c82e917a7d9e9dd42ff4febad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 27 Aug 2014 12:38:45 +0000 Subject: [PATCH] [MPLAY32]: Improve ShowLastWin32Error(). svn path=/trunk/; revision=63960 --- reactos/base/applications/mplay32/mplay32.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/reactos/base/applications/mplay32/mplay32.c b/reactos/base/applications/mplay32/mplay32.c index e2d53a96d1e..4340686768d 100644 --- a/reactos/base/applications/mplay32/mplay32.c +++ b/reactos/base/applications/mplay32/mplay32.c @@ -88,13 +88,19 @@ void ResizeClientArea(HWND hwnd, int nWidth, int nHeight) static VOID ShowLastWin32Error(HWND hwnd) { - DWORD dwError; LPTSTR lpMessageBuffer; + DWORD dwError = GetLastError(); - 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); + 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