Commit 86ebd5ee authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

regedit: Use Unicode when printing system error messages.

parent 8dfc25ea
......@@ -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;
......
......@@ -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;
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());
WCHAR *str;
DWORD error_code, len;
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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment