Added process ids.

svn path=/trunk/; revision=443
This commit is contained in:
Eric Kohl 1999-05-10 12:37:45 +00:00
parent 169894bcc5
commit e9ecf45119
4 changed files with 21 additions and 5 deletions

View file

@ -268,6 +268,9 @@ typedef struct _KPROCESS
typedef struct _EPROCESS typedef struct _EPROCESS
{ {
KPROCESS Pcb; KPROCESS Pcb;
ULONG UniqueProcessId;
ULONG InheritedFromUniqueProcessId;
} EPROCESS, *PEPROCESS; } EPROCESS, *PEPROCESS;
#define PROCESS_STATE_TERMINATED (1) #define PROCESS_STATE_TERMINATED (1)

View file

@ -282,7 +282,8 @@ GetCurrentDirectoryW@8
GetCurrentDirectoryW = GetCurrentDirectoryW@8 GetCurrentDirectoryW = GetCurrentDirectoryW@8
GetCurrentProcess@0 GetCurrentProcess@0
GetCurrentProcess = GetCurrentProcess@0 GetCurrentProcess = GetCurrentProcess@0
;GetCurrentProcessId@0 GetCurrentProcessId@0
GetCurrentProcessId = GetCurrentProcessId@0
GetCurrentThread@0 GetCurrentThread@0
GetCurrentThread = GetCurrentThread@0 GetCurrentThread = GetCurrentThread@0
GetCurrentThreadId@0 GetCurrentThreadId@0

View file

@ -29,6 +29,8 @@ HANDLE SystemProcessHandle = NULL;
POBJECT_TYPE PsProcessType = NULL; POBJECT_TYPE PsProcessType = NULL;
static ULONG NextUniqueProcessId = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID PsInitProcessManagment(VOID) VOID PsInitProcessManagment(VOID)
@ -78,6 +80,9 @@ VOID PsInitProcessManagment(VOID)
InitializeListHead(&(KProcess->MemoryAreaList)); InitializeListHead(&(KProcess->MemoryAreaList));
ObCreateHandleTable(NULL,FALSE,SystemProcess); ObCreateHandleTable(NULL,FALSE,SystemProcess);
KProcess->PageTableDirectory = get_page_directory(); KProcess->PageTableDirectory = get_page_directory();
SystemProcess->UniqueProcessId = NextUniqueProcessId;
SystemProcess->InheritedFromUniqueProcessId = NextUniqueProcessId;
ObCreateHandle(SystemProcess, ObCreateHandle(SystemProcess,
SystemProcess, SystemProcess,
@ -192,6 +197,8 @@ NTSTATUS STDCALL ZwCreateProcess(
KProcess = &(Process->Pcb); KProcess = &(Process->Pcb);
InitializeListHead(&(KProcess->MemoryAreaList)); InitializeListHead(&(KProcess->MemoryAreaList));
Process->UniqueProcessId = InterlockedIncrement(&NextUniqueProcessId);
Process->InheritedFromUniqueProcessId = ParentProcess->UniqueProcessId;
ObCreateHandleTable(ParentProcess, ObCreateHandleTable(ParentProcess,
InheritObjectTable, InheritObjectTable,
Process); Process);
@ -273,6 +280,10 @@ NTSTATUS STDCALL ZwQueryInformationProcess(IN HANDLE ProcessHandle,
ProcessInformation; ProcessInformation;
memset(ProcessBasicInformationP, 0, sizeof(PROCESS_BASIC_INFORMATION)); memset(ProcessBasicInformationP, 0, sizeof(PROCESS_BASIC_INFORMATION));
ProcessBasicInformationP->AffinityMask = Process->Pcb.Affinity; ProcessBasicInformationP->AffinityMask = Process->Pcb.Affinity;
ProcessBasicInformationP->UniqueProcessId =
Process->UniqueProcessId;
ProcessBasicInformationP->InheritedFromUniqueProcessId =
Process->InheritedFromUniqueProcessId;
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
break; break;

View file

@ -52,8 +52,7 @@ ULONG PiNrRunnableThreads = 0;
static PETHREAD CurrentThread = NULL; static PETHREAD CurrentThread = NULL;
static ULONG NextThreadUniqueId = 0; static ULONG NextUniqueThreadId = 0;
//static ULONG NextProcessUniqueId = 0;
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
@ -257,8 +256,10 @@ NTSTATUS PsInitializeThread(HANDLE ProcessHandle,
InitializeListHead(Thread->Tcb.ApcList); InitializeListHead(Thread->Tcb.ApcList);
InitializeListHead(&(Thread->IrpList)); InitializeListHead(&(Thread->IrpList));
Thread->Cid.UniqueThread = (HANDLE)InterlockedIncrement( Thread->Cid.UniqueThread = (HANDLE)InterlockedIncrement(
&NextThreadUniqueId); &NextUniqueThreadId);
DbgPrint("Thread->Cid.UniqueThread %d\n",Thread->Cid.UniqueThread); 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, ObReferenceObjectByPointer(Thread,
THREAD_ALL_ACCESS, THREAD_ALL_ACCESS,
PsThreadType, PsThreadType,