- added stubs for NtSuspendProcess and NtResumeProcess
- the ProcessDebugPort information class is read-only on NT5.1+
Modified: trunk/reactos/include/ntos/ps.h
Modified: trunk/reactos/include/ntos/zw.h
Modified: trunk/reactos/lib/ntdll/def/ntdll.def
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/ntoskrnl/ps/suspend.c
Modified: trunk/reactos/tools/nci/sysfuncs.lst
Modified: trunk/reactos/w32api/include/winnt.h

Modified: trunk/reactos/include/ntos/ps.h
--- trunk/reactos/include/ntos/ps.h	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/include/ntos/ps.h	2005-04-29 16:41:52 UTC (rev 14862)
@@ -70,7 +70,7 @@
 #define PROCESS_SET_QUOTA		(0x0100L)
 #define PROCESS_SET_INFORMATION		(0x0200L)
 #define PROCESS_QUERY_INFORMATION	(0x0400L)
-#define PROCESS_SET_PORT (0x0800L)
+#define PROCESS_SUSPEND_RESUME		(0x0800L)
 
 #define PROCESS_ALL_ACCESS		(0x1f0fffL)
 

Modified: trunk/reactos/include/ntos/zw.h
--- trunk/reactos/include/ntos/zw.h	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/include/ntos/zw.h	2005-04-29 16:41:52 UTC (rev 14862)
@@ -3713,6 +3713,20 @@
 	IN HANDLE ThreadHandle,
 	OUT PULONG SuspendCount  OPTIONAL
 	);
+
+
+NTSTATUS
+STDCALL
+NtResumeProcess(
+	IN HANDLE ProcessHandle
+	);
+
+NTSTATUS
+STDCALL
+ZwResumeProcess(
+	IN HANDLE ProcessHandle
+	);
+
 /*
  * FUNCTION: Writes the content of a registry key to ascii file
  * ARGUMENTS: 
@@ -4879,6 +4893,18 @@
 	OUT PULONG PreviousSuspendCount  OPTIONAL
 	);
 
+NTSTATUS
+STDCALL
+NtSuspendProcess(
+	IN HANDLE ProcessHandle
+	);
+
+NTSTATUS
+STDCALL
+ZwSuspendProcess(
+	IN HANDLE ProcessHandle
+	);
+
 /*
  * FUNCTION: Terminates the execution of a thread. 
  * ARGUMENTS: 

Modified: trunk/reactos/lib/ntdll/def/ntdll.def
--- trunk/reactos/lib/ntdll/def/ntdll.def	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/lib/ntdll/def/ntdll.def	2005-04-29 16:41:52 UTC (rev 14862)
@@ -215,6 +215,7 @@
 NtRequestWaitReplyPort@12
 NtResetEvent@8
 NtRestoreKey@12
+NtResumeProcess@4
 NtResumeThread@8
 NtSaveKey@8
 NtSetContextThread@8
@@ -251,6 +252,7 @@
 NtSignalAndWaitForSingleObject@16
 NtStartProfile@4
 NtStopProfile@4
+NtSuspendProcess@4
 NtSuspendThread@8
 NtSystemDebugControl@24
 NtTerminateJobObject@8
@@ -843,6 +845,7 @@
 ZwRequestWaitReplyPort@12
 ZwResetEvent@8
 ZwRestoreKey@12
+ZwResumeProcess@4
 ZwResumeThread@8
 ZwSaveKey@8
 ZwSetContextThread@8
@@ -878,6 +881,7 @@
 ZwSignalAndWaitForSingleObject@16
 ZwStartProfile@4
 ZwStopProfile@4
+ZwSuspendProcess@4
 ZwSuspendThread@8
 ZwSystemDebugControl@24
 ZwTerminateProcess@8

Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
--- trunk/reactos/ntoskrnl/ps/psmgr.c	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c	2005-04-29 16:41:52 UTC (rev 14862)
@@ -22,7 +22,7 @@
     STANDARD_RIGHTS_WRITE   | PROCESS_CREATE_PROCESS    | PROCESS_CREATE_THREAD   |
     PROCESS_VM_OPERATION    | PROCESS_VM_WRITE          | PROCESS_DUP_HANDLE      |
     PROCESS_TERMINATE       | PROCESS_SET_QUOTA         | PROCESS_SET_INFORMATION | 
-    PROCESS_SET_PORT,
+    PROCESS_SUSPEND_RESUME,
     STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
     PROCESS_ALL_ACCESS};
 

Modified: trunk/reactos/ntoskrnl/ps/query.c
--- trunk/reactos/ntoskrnl/ps/query.c	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/ntoskrnl/ps/query.c	2005-04-29 16:41:52 UTC (rev 14862)
@@ -16,7 +16,6 @@
 
 /* GLOBALS ******************************************************************/
 
-
 static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
 {
   ICI_SQ_SAME( sizeof(PROCESS_BASIC_INFORMATION),     sizeof(ULONG), ICIF_QUERY ),                     /* ProcessBasicInformation */
@@ -26,7 +25,7 @@
   ICI_SQ_SAME( sizeof(KERNEL_USER_TIMES),             sizeof(ULONG), ICIF_QUERY ),                     /* ProcessTimes */
   ICI_SQ_SAME( sizeof(KPRIORITY),                     sizeof(ULONG), ICIF_SET ),                       /* ProcessBasePriority */
   ICI_SQ_SAME( sizeof(ULONG),                         sizeof(ULONG), ICIF_SET ),                       /* ProcessRaisePriority */
-  ICI_SQ_SAME( sizeof(HANDLE),                        sizeof(ULONG), ICIF_QUERY | ICIF_SET ),          /* ProcessDebugPort */
+  ICI_SQ_SAME( sizeof(HANDLE),                        sizeof(ULONG), ICIF_QUERY ),                     /* ProcessDebugPort */
   ICI_SQ_SAME( sizeof(HANDLE),                        sizeof(ULONG), ICIF_SET ),                       /* ProcessExceptionPort */
   ICI_SQ_SAME( sizeof(PROCESS_ACCESS_TOKEN),          sizeof(ULONG), ICIF_SET ),                       /* ProcessAccessToken */
   ICI_SQ_SAME( 0 /* FIXME */,                         sizeof(ULONG), ICIF_QUERY | ICIF_SET ),          /* ProcessLdtInformation */
@@ -672,8 +671,7 @@
        Access = PROCESS_SET_INFORMATION | PROCESS_SET_SESSIONID;
        break;
      case ProcessExceptionPort:
-     case ProcessDebugPort:
-       Access = PROCESS_SET_INFORMATION | PROCESS_SET_PORT;
+       Access = PROCESS_SET_INFORMATION | PROCESS_SUSPEND_RESUME;
        break;
 
      default:
@@ -700,87 +698,6 @@
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
-      case ProcessDebugPort:
-      {
-        HANDLE PortHandle = NULL;
-
-        /* make a safe copy of the buffer on the stack */
-        _SEH_TRY
-        {
-          PortHandle = *(PHANDLE)ProcessInformation;
-          Status = (PortHandle != NULL ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER);
-        }
-        _SEH_HANDLE
-        {
-          Status = _SEH_GetExceptionCode();
-        }
-        _SEH_END;
-
-        if(NT_SUCCESS(Status))
-        {
-          PEPORT DebugPort;
-
-          /* in case we had success reading from the buffer, verify the provided
-           * LPC port handle
-           */
-          Status = ObReferenceObjectByHandle(PortHandle,
-                                             0,
-                                             LpcPortObjectType,
-                                             PreviousMode,
-                                             (PVOID)&DebugPort,
-                                             NULL);
-          if(NT_SUCCESS(Status))
-          {
-            /* lock the process to be thread-safe! */
-
-            Status = PsLockProcess(Process, FALSE);
-            if(NT_SUCCESS(Status))
-            {
-              /*
-               * according to "NT Native API" documentation, setting the debug
-               * port is only permitted once!
-               */
-              if(Process->DebugPort == NULL)
-              {
-                /* keep the reference to the handle! */
-                Process->DebugPort = DebugPort;
-                
-                if(Process->Peb)
-                {
-                  /* we're now debugging the process, so set the flag in the PEB
-                     structure. However, to access it we need to attach to the
-                     process so we're sure we're in the right context! */
-
-                  KeAttachProcess(&Process->Pcb);
-                  _SEH_TRY
-                  {
-                    Process->Peb->BeingDebugged = TRUE;
-                  }
-                  _SEH_HANDLE
-                  {
-                    DPRINT1("Trying to set the Peb->BeingDebugged field of process 0x%x failed, exception: 0x%x\n", Process, _SEH_GetExceptionCode());
-                  }
-                  _SEH_END;
-                  KeDetachProcess();
-                }
-                Status = STATUS_SUCCESS;
-              }
-              else
-              {
-                ObDereferenceObject(DebugPort);
-                Status = STATUS_PORT_ALREADY_SET;
-              }
-              PsUnlockProcess(Process);
-            }
-            else
-            {
-              ObDereferenceObject(DebugPort);
-            }
-          }
-        }
-        break;
-      }
-
       case ProcessExceptionPort:
       {
         HANDLE PortHandle = NULL;
@@ -988,6 +905,7 @@
       case ProcessWx86Information:
       case ProcessHandleCount:
       case ProcessWow64Information:
+      case ProcessDebugPort:
       default:
 	Status = STATUS_INVALID_INFO_CLASS;
      }

Modified: trunk/reactos/ntoskrnl/ps/suspend.c
--- trunk/reactos/ntoskrnl/ps/suspend.c	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/ntoskrnl/ps/suspend.c	2005-04-29 16:41:52 UTC (rev 14862)
@@ -173,4 +173,72 @@
     return Status;
 }
 
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtSuspendProcess(IN HANDLE ProcessHandle)
+{
+    KPROCESSOR_MODE PreviousMode;
+    PEPROCESS Process;
+    NTSTATUS Status;
+    
+    PAGED_CODE();
+    
+    PreviousMode = ExGetPreviousMode();
+    
+    Status = ObReferenceObjectByHandle(ProcessHandle,
+                                       PROCESS_SUSPEND_RESUME,
+                                       PsProcessType,
+                                       PreviousMode,
+                                       (PVOID*)&Process,
+                                       NULL);
+    if (NT_SUCCESS(Status))
+    {
+        /* FIXME */
+        Status = STATUS_NOT_IMPLEMENTED;
+        DPRINT1("NtSuspendProcess not yet implemented!\n");
+        
+        ObDereferenceObject(Process);
+    }
+    
+    return Status;
+}
+
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+NtResumeProcess(IN HANDLE ProcessHandle)
+{
+    KPROCESSOR_MODE PreviousMode;
+    PEPROCESS Process;
+    NTSTATUS Status;
+
+    PAGED_CODE();
+
+    PreviousMode = ExGetPreviousMode();
+
+    Status = ObReferenceObjectByHandle(ProcessHandle,
+                                       PROCESS_SUSPEND_RESUME,
+                                       PsProcessType,
+                                       PreviousMode,
+                                       (PVOID*)&Process,
+                                       NULL);
+    if (NT_SUCCESS(Status))
+    {
+        /* FIXME */
+        Status = STATUS_NOT_IMPLEMENTED;
+        DPRINT1("NtResumeProcess not yet implemented!\n");
+        
+        ObDereferenceObject(Process);
+    }
+
+    return Status;
+}
+
 /* EOF */

Modified: trunk/reactos/tools/nci/sysfuncs.lst
--- trunk/reactos/tools/nci/sysfuncs.lst	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/tools/nci/sysfuncs.lst	2005-04-29 16:41:52 UTC (rev 14862)
@@ -166,6 +166,7 @@
 NtRequestWaitReplyPort 3
 NtResetEvent 2
 NtRestoreKey 3
+NtResumeProcess 1
 NtResumeThread 2
 NtSaveKey 2
 NtSaveKeyEx 3
@@ -206,6 +207,7 @@
 NtSignalAndWaitForSingleObject 4
 NtStartProfile 1
 NtStopProfile 1
+NtSuspendProcess 1
 NtSuspendThread 2
 NtSystemDebugControl 6
 NtTerminateJobObject 2

Modified: trunk/reactos/w32api/include/winnt.h
--- trunk/reactos/w32api/include/winnt.h	2005-04-29 14:38:05 UTC (rev 14861)
+++ trunk/reactos/w32api/include/winnt.h	2005-04-29 16:41:52 UTC (rev 14862)
@@ -368,6 +368,7 @@
 #define PROCESS_SET_QUOTA	256
 #define PROCESS_SET_INFORMATION	512
 #define PROCESS_QUERY_INFORMATION	1024
+#define PROCESS_SUSPEND_RESUME	2048
 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
 #define THREAD_TERMINATE	1
 #define THREAD_SUSPEND_RESUME	2