[NTOSKRNL] Implement NtSetInformationProcess:ProcessDeviceMap
authorPierre Schweitzer <pierre@reactos.org>
Mon, 3 Jun 2019 06:12:16 +0000 (08:12 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 10 Jun 2019 08:35:24 +0000 (10:35 +0200)
ntoskrnl/ps/query.c

index 5391ae1..31275a5 100644 (file)
@@ -1120,6 +1120,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
     NTSTATUS Status;
     HANDLE PortHandle = NULL;
     HANDLE TokenHandle = NULL;
+    HANDLE DirectoryHandle = NULL;
     PROCESS_SESSION_INFORMATION SessionInfo = {0};
     PROCESS_PRIORITY_CLASS PriorityClass = {0};
     PROCESS_FOREGROUND_BACKGROUND Foreground = {0};
@@ -1939,6 +1940,34 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
             Status = MmSetExecuteOptions(NoExecute);
             break;
 
+        case ProcessDeviceMap:
+
+            /* Check buffer length */
+            if (ProcessInformationLength != sizeof(HANDLE))
+            {
+                Status = STATUS_INFO_LENGTH_MISMATCH;
+                break;
+            }
+
+            /* Use SEH for capture */
+            _SEH2_TRY
+            {
+                /* Capture the handle */
+                DirectoryHandle = *(PHANDLE)ProcessInformation;
+            }
+            _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+            {
+                /* Get the exception code */
+                Status = _SEH2_GetExceptionCode();
+                _SEH2_YIELD(break);
+            }
+            _SEH2_END;
+
+            /* Call Ob to set the device map */
+            Status = ObSetDeviceMap(Process, DirectoryHandle);
+            break;
+
+
         /* We currently don't implement any of these */
         case ProcessLdtInformation:
         case ProcessLdtSize:
@@ -1961,11 +1990,6 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
             Status = STATUS_NOT_IMPLEMENTED;
             break;
 
-        case ProcessDeviceMap:
-            DPRINT1("Device map not implemented\n");
-            Status = STATUS_NOT_IMPLEMENTED;
-            break;
-
         case ProcessHandleTracing:
             DPRINT1("Handle tracing not implemented\n");
             Status = STATUS_NOT_IMPLEMENTED;