regedit: Use Unicode when printing system error messages.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2016-07-15 07:49:58 +00:00 committed by Alexandre Julliard
parent 8dfc25ea9e
commit 86ebd5eee0
3 changed files with 14 additions and 12 deletions

View File

@ -28,7 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
static void output_writeconsole(const WCHAR *str, DWORD wlen)
void output_writeconsole(const WCHAR *str, DWORD wlen)
{
DWORD count, ret;

View File

@ -31,8 +31,11 @@
#include <winreg.h>
#include <assert.h>
#include <wine/unicode.h>
#include <wine/debug.h>
#include "regproc.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
#define REG_VAL_BUF_SIZE 4096
/* maximal number of characters in hexadecimal data line,
@ -856,20 +859,18 @@ static void processRegLinesW(FILE *in)
static void REGPROC_print_error(void)
{
LPVOID lpMsgBuf;
DWORD error_code;
int status;
WCHAR *str;
DWORD error_code, len;
error_code = GetLastError ();
status = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error_code, 0, (LPSTR) &lpMsgBuf, 0, NULL);
if (!status) {
fprintf(stderr, "regedit: Cannot display message for error %d, status %d\n",
error_code, GetLastError());
error_code = GetLastError();
len = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error_code, 0, (WCHAR *)&str, 0, NULL);
if (len == 0 && GetLastError() != NO_ERROR) {
WINE_FIXME("FormatMessage failed: le=%u, previous=%u\n", GetLastError(), error_code);
exit(1);
}
puts(lpMsgBuf);
LocalFree(lpMsgBuf);
output_writeconsole(str, len);
LocalFree(str);
exit(1);
}

View File

@ -24,6 +24,7 @@
#define REG_FORMAT_5 1
#define REG_FORMAT_4 2
void output_writeconsole(const WCHAR *str, DWORD wlen);
void __cdecl output_message(unsigned int id, ...);
BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format);