[PATCH v3 03/10] reg: Add system error printing function
Hugh McMaster
hugh.mcmaster at outlook.com
Mon Nov 10 05:06:44 CST 2014
On Saturday, 8 Nov 2014 11:26:44 +0100, Jonathan Vollebregt wrote:
+static void reg_print_error(LSTATUS error_code)
+{
+ switch (error_code)
+ {
+ case ERROR_SUCCESS:
+ return;
+ case ERROR_BAD_COMMAND:
+ reg_message(STRING_INVALID_CMDLINE);
+ return;
+ default:
+ {
+ static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0};
+ WCHAR *message = NULL;
+ FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+ error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *)&message, 0, NULL);
+
+ reg_message(STRING_ERROR);
+ reg_printfW(error_string, error_code, message);
+ LocalFree(message);
+ return;
+ }
+ }
+}This seems like a step backwards to me. It would be much better to add the required functionality -- e.g. FormatMessage() -- and fix reg.exe printf-style functions in one go.
See http://source.winehq.org/patches/data/107578 for what I mean.
Also, mixing reg_message() and reg_printfW() just seems wrong. A clear resource string incorporating your formatting above would suffice, I expect.
--
Hugh McMaster
More information about the wine-devel
mailing list