win32_common.c: get NTSTATUS error messages from ntdll
authorEric Biggers <ebiggers3@gmail.com>
Wed, 25 Nov 2015 04:14:51 +0000 (22:14 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 19 Dec 2015 16:31:10 +0000 (10:31 -0600)
src/win32_common.c

index 30f7d62..b25871a 100644 (file)
@@ -449,9 +449,11 @@ retry:
        if (n >= buflen)
                goto realloc;
 
-       ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-                           NULL,
-                           is_ntstatus ? (*func_RtlNtStatusToDosError)(code) : code,
+       ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
+                               FORMAT_MESSAGE_IGNORE_INSERTS |
+                               (is_ntstatus ? FORMAT_MESSAGE_FROM_HMODULE : 0),
+                           (is_ntstatus ? ntdll_spec.handle : NULL),
+                           code,
                            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                            &buf[n],
                            buflen - n,