-
Notifications
You must be signed in to change notification settings - Fork 3
/
procname.h
68 lines (54 loc) · 1.98 KB
/
procname.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (c) 2004 Security Architects Corporation. All rights reserved.
*
* Module Name:
*
* procname.h
*
* Abstract:
*
* This module defines various types used by process id to process name conversion routines.
*
* Author:
*
* Eugene Tsyrklevich 23-Feb-2004
*
* Revision History:
*
* 07-Apr-2004 ET - Copied from process.h
*/
#ifndef __PROCNAME_H__
#define __PROCNAME_H__
#include "userland.h"
typedef struct _IMAGE_PID_ENTRY
{
struct _IMAGE_PID_ENTRY *next;
ULONG ProcessId;
ULONG ParentId;
BOOLEAN FirstThread; // Was more than one thread already created?
// (some actions need to take place only in the main thread)
UCHAR WaitingForUserRequestId; // contains the sequence id of the reply we are waiting for
KEVENT UserlandRequestDoneEvent;
PUSERLAND_REPLY_HEADER UserlandReply;
SECURITY_POLICY SecPolicy;
WCHAR ImageName[1];
} IMAGE_PID_ENTRY, *PIMAGE_PID_ENTRY;
/*
* 1. The following number should be prime.
* 2. It should also be slightly larger than the "average" number of processes of any given machine to
* minimize the number of hash table collisions (we want O(1) access) and at the same time not
* eating up too much memory (gImagePidHtbl[]).
*/
#define IMAGE_PID_HASHTABLE_SIZE 67
extern IMAGE_PID_ENTRY gImagePidHtbl[IMAGE_PID_HASHTABLE_SIZE];
extern USHORT ProcessNameOffset, ThreadServiceTableOffset;
extern BOOLEAN BootingUp;
BOOLEAN InitProcessNameEntries();
VOID RemoveProcessNameEntries();
PIMAGE_PID_ENTRY FindImagePidEntry(ULONG ProcessId, ULONG ParentId);
BOOLEAN ProcessInsertImagePidEntry(ULONG ProcessId, PIMAGE_PID_ENTRY NewProcess);
PIMAGE_PID_ENTRY CreateNewProcessEntry(ULONG ProcessId, ULONG ParentId, PUNICODE_STRING ProcessName, BOOLEAN NewProcess);
//PIMAGE_PID_ENTRY CreateAndLoadNewProcessEntry(ULONG ProcessId, PUNICODE_STRING ProcessName, BOOLEAN NewProcess);
VOID EnumerateExistingProcesses();
PWCHAR GetCurrentProcessName();
#endif /* __PROCNAME_H__ */