Alexandre Julliard : kernel32: Pass the exe name as argument to FormatMessage.
Alexandre Julliard
julliard at winehq.org
Mon Nov 30 10:42:44 CST 2009
Module: wine
Branch: master
Commit: a04512275420acd74fe5c0d90035a754d255f2ed
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a04512275420acd74fe5c0d90035a754d255f2ed
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sun Nov 29 16:42:50 2009 +0100
kernel32: Pass the exe name as argument to FormatMessage.
---
dlls/kernel32/process.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index a49169e..7918048 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1159,6 +1159,8 @@ void CDECL __wine_kernel_init(void)
if (!(peb->ImageBaseAddress = LoadLibraryExW( main_exe_name, 0, DONT_RESOLVE_DLL_REFERENCES )))
{
+ DWORD_PTR args[1];
+ WCHAR msgW[1024];
char msg[1024];
DWORD error = GetLastError();
@@ -1182,8 +1184,11 @@ void CDECL __wine_kernel_init(void)
ExitProcess( ERROR_BAD_EXE_FORMAT );
}
}
- FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, msg, sizeof(msg), NULL );
- MESSAGE( "wine: could not load %s: %s", debugstr_w(main_exe_name), msg );
+ args[0] = (DWORD_PTR)main_exe_name;
+ FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
+ NULL, error, 0, msgW, sizeof(msgW)/sizeof(WCHAR), (__ms_va_list *)args );
+ WideCharToMultiByte( CP_ACP, 0, msgW, -1, msg, sizeof(msg), NULL, NULL );
+ MESSAGE( "wine: %s", msg );
ExitProcess( error );
}
More information about the wine-cvs
mailing list