Added process ids.
authorEric Kohl <eric.kohl@reactos.org>
Mon, 10 May 1999 12:37:45 +0000 (12:37 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 10 May 1999 12:37:45 +0000 (12:37 +0000)
svn path=/trunk/; revision=443

reactos/include/ddk/pstypes.h
reactos/lib/kernel32/kernel32.def
reactos/ntoskrnl/ps/process.c
reactos/ntoskrnl/ps/thread.c

index e8f8e81..9316431 100644 (file)
@@ -268,6 +268,9 @@ typedef struct _KPROCESS
 typedef struct _EPROCESS
 {
    KPROCESS Pcb;
+
+   ULONG    UniqueProcessId;
+   ULONG    InheritedFromUniqueProcessId;
 } EPROCESS, *PEPROCESS;
 
 #define PROCESS_STATE_TERMINATED (1)
index a105027..ee884ed 100644 (file)
@@ -282,7 +282,8 @@ GetCurrentDirectoryW@8
 GetCurrentDirectoryW = GetCurrentDirectoryW@8
 GetCurrentProcess@0
 GetCurrentProcess = GetCurrentProcess@0
-;GetCurrentProcessId@0
+GetCurrentProcessId@0
+GetCurrentProcessId = GetCurrentProcessId@0
 GetCurrentThread@0
 GetCurrentThread = GetCurrentThread@0
 GetCurrentThreadId@0
index 0a30333..fd4def4 100644 (file)
@@ -29,6 +29,8 @@ HANDLE SystemProcessHandle = NULL;
 
 POBJECT_TYPE PsProcessType = NULL;
 
+static ULONG NextUniqueProcessId = 0;
+
 /* FUNCTIONS *****************************************************************/
 
 VOID PsInitProcessManagment(VOID)
@@ -78,6 +80,9 @@ VOID PsInitProcessManagment(VOID)
    InitializeListHead(&(KProcess->MemoryAreaList));
    ObCreateHandleTable(NULL,FALSE,SystemProcess);
    KProcess->PageTableDirectory = get_page_directory();
+
+   SystemProcess->UniqueProcessId = NextUniqueProcessId;
+   SystemProcess->InheritedFromUniqueProcessId = NextUniqueProcessId;
    
    ObCreateHandle(SystemProcess,
                  SystemProcess,
@@ -192,6 +197,8 @@ NTSTATUS STDCALL ZwCreateProcess(
    KProcess = &(Process->Pcb);
    
    InitializeListHead(&(KProcess->MemoryAreaList));
+   Process->UniqueProcessId = InterlockedIncrement(&NextUniqueProcessId);
+   Process->InheritedFromUniqueProcessId = ParentProcess->UniqueProcessId;
    ObCreateHandleTable(ParentProcess,
                       InheritObjectTable,
                       Process);
@@ -273,6 +280,10 @@ NTSTATUS STDCALL ZwQueryInformationProcess(IN HANDLE ProcessHandle,
          ProcessInformation;
        memset(ProcessBasicInformationP, 0, sizeof(PROCESS_BASIC_INFORMATION));
        ProcessBasicInformationP->AffinityMask = Process->Pcb.Affinity;
+        ProcessBasicInformationP->UniqueProcessId =
+          Process->UniqueProcessId;
+        ProcessBasicInformationP->InheritedFromUniqueProcessId =
+          Process->InheritedFromUniqueProcessId;
        Status = STATUS_SUCCESS;
        break;
        
index fb4d452..285c7f2 100644 (file)
@@ -52,8 +52,7 @@ ULONG PiNrRunnableThreads = 0;
 
 static PETHREAD CurrentThread = NULL;
 
-static ULONG NextThreadUniqueId = 0;
-//static ULONG NextProcessUniqueId = 0;
+static ULONG NextUniqueThreadId = 0;
 
 /* FUNCTIONS ***************************************************************/
 
@@ -257,8 +256,10 @@ NTSTATUS PsInitializeThread(HANDLE ProcessHandle,
    InitializeListHead(Thread->Tcb.ApcList);
    InitializeListHead(&(Thread->IrpList));
    Thread->Cid.UniqueThread = (HANDLE)InterlockedIncrement(
-                                                         &NextThreadUniqueId);
-   DbgPrint("Thread->Cid.UniqueThread %d\n",Thread->Cid.UniqueThread);
+                                                          &NextUniqueThreadId);
+   Thread->Cid.UniqueProcess = (HANDLE)Thread->ThreadsProcess->UniqueProcessId;
+   DbgPrint("Thread->Cid.UniqueThread %d\nThread->Cid.UniqueProcess %d\n",
+            Thread->Cid.UniqueThread, Thread->Cid.UniqueThread);
    ObReferenceObjectByPointer(Thread,
                              THREAD_ALL_ACCESS,
                              PsThreadType,