[NTOS:KD] Use Zw* syscall variants
authorJérôme Gardou <jerome.gardou@reactos.org>
Fri, 26 Feb 2021 07:44:51 +0000 (08:44 +0100)
committerJérôme Gardou <jerome.gardou@reactos.org>
Fri, 26 Feb 2021 07:46:53 +0000 (08:46 +0100)
The log file can be (re-)initialized when previous mode is User-Mode,
thus the calls fail on probing input parameters

ntoskrnl/kd/kdio.c

index 288977b..4ada360 100644 (file)
@@ -253,7 +253,7 @@ KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable,
                                    NULL);
 
         /* Create the log file */
-        Status = NtCreateFile(&KdpLogFileHandle,
+        Status = ZwCreateFile(&KdpLogFileHandle,
                               FILE_APPEND_DATA | SYNCHRONIZE,
                               &ObjectAttributes,
                               &Iosb,
@@ -268,7 +268,10 @@ KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable,
         RtlFreeUnicodeString(&FileName);
 
         if (!NT_SUCCESS(Status))
+        {
+            DPRINT1("Failed to open log file: 0x%08x\n", Status);
             return;
+        }
 
         KeInitializeEvent(&KdpLoggerThreadEvent, SynchronizationEvent, TRUE);
 
@@ -282,12 +285,12 @@ KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable,
                                       NULL);
         if (!NT_SUCCESS(Status))
         {
-            NtClose(KdpLogFileHandle);
+            ZwClose(KdpLogFileHandle);
             return;
         }
 
         Priority = 7;
-        NtSetInformationThread(ThreadHandle,
+        ZwSetInformationThread(ThreadHandle,
                                ThreadPriority,
                                &Priority,
                                sizeof(Priority));