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
{
KPROCESS Pcb;
ULONG UniqueProcessId;
ULONG InheritedFromUniqueProcessId;
} EPROCESS, *PEPROCESS;
#define PROCESS_STATE_TERMINATED (1)

View 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

View 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;

View 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,