Windows进程研究

moshui Lv3

KPCR

即CPU控制区(Processor Control Region),一个CPU核心一个。

32位时 在R0下直接可以通过FS获取(R3下则为TEB)。 基本上R0的fs=0x30
64位时 在R0下可以通过GS寄存器来获得_KPCR,例如:rdmsr 0xC0000101

结构

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
1: kd> dt _KPCR
nt!_KPCR
+0x000 NtTib : _NT_TIB
+0x000 GdtBase : Ptr64 _KGDTENTRY64
+0x008 TssBase : Ptr64 _KTSS64
+0x010 UserRsp : Uint8B
+0x018 Self : Ptr64 _KPCR
+0x020 CurrentPrcb : Ptr64 _KPRCB
+0x028 LockArray : Ptr64 _KSPIN_LOCK_QUEUE
+0x030 Used_Self : Ptr64 Void
+0x038 IdtBase : Ptr64 _KIDTENTRY64
+0x040 Unused : [2] Uint8B
+0x050 Irql : UChar
+0x051 SecondLevelCacheAssociativity : UChar
+0x052 ObsoleteNumber : UChar
+0x053 Fill0 : UChar
+0x054 Unused0 : [3] Uint4B
+0x060 MajorVersion : Uint2B
+0x062 MinorVersion : Uint2B
+0x064 StallScaleFactor : Uint4B
+0x068 Unused1 : [3] Ptr64 Void
+0x080 KernelReserved : [15] Uint4B
+0x0bc SecondLevelCacheSize : Uint4B
+0x0c0 HalReserved : [16] Uint4B
+0x100 Unused2 : Uint4B
+0x108 KdVersionBlock : Ptr64 Void
+0x110 Unused3 : Ptr64 Void
+0x118 PcrAlign1 : [24] Uint4B
+0x180 Prcb : _KPRCB

观察结构我们会发现0x18处的Self字段和0x20处的CurrentPrcb字段是指针,分别指向了当前的_KPCR_KPRCB结构,这两个指针完全是为了程序员编写方便,可以避免计算繁琐的结构体长度。

其中我们关注一下:NtTib字段与Prcb字段

_NT_TIB

1
2
3
4
5
6
7
8
9
10
1: kd> dt _NT_TIB
nt!_NT_TIB
+0x000 ExceptionList : Ptr64 _EXCEPTION_REGISTRATION_RECORD
+0x008 StackBase : Ptr64 Void
+0x010 StackLimit : Ptr64 Void
+0x018 SubSystemTib : Ptr64 Void
+0x020 FiberData : Ptr64 Void
+0x020 Version : Uint4B
+0x028 ArbitraryUserPointer : Ptr64 Void
+0x030 Self : Ptr64 _NT_TIB

其中StackBaseStackLimit字段为跑在当前核心上的栈顶和栈底。

_KPRCB

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
1: kd> dt _KPRCB
nt!_KPRCB
+0x000 MxCsr : Uint4B
+0x004 LegacyNumber : UChar
+0x005 ReservedMustBeZero : UChar
+0x006 InterruptRequest : UChar
+0x007 IdleHalt : UChar
+0x008 CurrentThread : Ptr64 _KTHREAD
+0x010 NextThread : Ptr64 _KTHREAD
+0x018 IdleThread : Ptr64 _KTHREAD
+0x020 NestingLevel : UChar
+0x021 ClockOwner : UChar
+0x022 PendingTickFlags : UChar
+0x022 PendingTick : Pos 0, 1 Bit
+0x022 PendingBackupTick : Pos 1, 1 Bit
+0x023 IdleState : UChar
+0x024 Number : Uint4B
+0x028 RspBase : Uint8B
+0x030 PrcbLock : Uint8B
+0x038 PriorityState : Ptr64 Char
+0x040 CpuType : Char
+0x041 CpuID : Char
+0x042 CpuStep : Uint2B
+0x042 CpuStepping : UChar
+0x043 CpuModel : UChar
+0x044 MHz : Uint4B
+0x048 HalReserved : [8] Uint8B
+0x088 MinorVersion : Uint2B
+0x08a MajorVersion : Uint2B
+0x08c BuildType : UChar
+0x08d CpuVendor : UChar
+0x08e LegacyCoresPerPhysicalProcessor : UChar
+0x08f LegacyLogicalProcessorsPerCore : UChar
+0x090 TscFrequency : Uint8B
+0x098 CoresPerPhysicalProcessor : Uint4B
+0x09c LogicalProcessorsPerCore : Uint4B
+0x0a0 PrcbPad04 : [4] Uint8B
+0x0c0 ParentNode : Ptr64 _KNODE
+0x0c8 GroupSetMember : Uint8B
+0x0d0 Group : UChar
+0x0d1 GroupIndex : UChar
+0x0d2 PrcbPad05 : [2] UChar
+0x0d4 InitialApicId : Uint4B
+0x0d8 ScbOffset : Uint4B
+0x0dc ApicMask : Uint4B
+0x0e0 AcpiReserved : Ptr64 Void
+0x0e8 CFlushSize : Uint4B
+0x0ec PrcbFlags : _KPRCBFLAG
+0x0f0 TrappedSecurityDomain : Uint8B
+0x0f8 BpbState : UChar
+0x0f8 BpbCpuIdle : Pos 0, 1 Bit
+0x0f8 BpbFlushRsbOnTrap : Pos 1, 1 Bit
+0x0f8 BpbIbpbOnReturn : Pos 2, 1 Bit
+0x0f8 BpbIbpbOnTrap : Pos 3, 1 Bit
+0x0f8 BpbIbpbOnRetpolineExit : Pos 4, 1 Bit
+0x0f8 BpbFlushRsbOnReturn : Pos 5, 1 Bit
+0x0f8 BpbFlushRsbOnRetpolineExit : Pos 6, 1 Bit
+0x0f8 BpbStateReserved : Pos 7, 1 Bit
+0x0f9 BpbFeatures : UChar
+0x0f9 BpbClearOnIdle : Pos 0, 1 Bit
+0x0f9 BpbEnabled : Pos 1, 1 Bit
+0x0f9 BpbSmep : Pos 2, 1 Bit
+0x0f9 BpbFeaturesReserved : Pos 3, 5 Bits
+0x0fa BpbCurrentSpecCtrl : UChar
+0x0fb BpbKernelSpecCtrl : UChar
+0x0fc BpbNmiSpecCtrl : UChar
+0x0fd BpbUserSpecCtrl : UChar
+0x0fe PairRegister : Int2B
+0x0f0 PrcbPad11 : [2] Uint8B
+0x100 ProcessorState : _KPROCESSOR_STATE
+0x6c0 ExtendedSupervisorState : Ptr64 _XSAVE_AREA_HEADER
+0x6c8 ProcessorSignature : Uint4B
+0x6cc ProcessorFlags : Uint4B
+0x6d0 BpbRetpolineExitSpecCtrl : UChar
+0x6d1 BpbTrappedRetpolineExitSpecCtrl : UChar
+0x6d2 BpbTrappedBpbState : UChar
+0x6d2 BpbTrappedCpuIdle : Pos 0, 1 Bit
+0x6d2 BpbTrappedFlushRsbOnTrap : Pos 1, 1 Bit
+0x6d2 BpbTrappedIbpbOnReturn : Pos 2, 1 Bit
+0x6d2 BpbTrappedIbpbOnTrap : Pos 3, 1 Bit
+0x6d2 BpbTrappedIbpbOnRetpolineExit : Pos 4, 1 Bit
+0x6d2 BpbTrappedFlushRsbOnReturn : Pos 5, 1 Bit
+0x6d2 BpbTrappedFlushRsbOnRetpolineExit : Pos 6, 1 Bit
+0x6d2 BpbTrappedBpbStateReserved : Pos 7, 1 Bit
+0x6d3 BpbRetpolineState : UChar
+0x6d3 BpbRunningNonRetpolineCode : Pos 0, 1 Bit
+0x6d3 BpbIndirectCallsSafe : Pos 1, 1 Bit
+0x6d3 BpbRetpolineEnabled : Pos 2, 1 Bit
+0x6d3 BpbRetpolineStateReserved : Pos 3, 5 Bits
+0x6d4 PrcbPad12b : Uint4B
+0x6d0 PrcbPad12a : Uint8B
+0x6d8 PrcbPad12 : [3] Uint8B
+0x6f0 LockQueue : [17] _KSPIN_LOCK_QUEUE
+0x800 PPLookasideList : [16] _PP_LOOKASIDE_LIST
+0x900 PPNxPagedLookasideList : [32] _GENERAL_LOOKASIDE_POOL
+0x1500 PPNPagedLookasideList : [32] _GENERAL_LOOKASIDE_POOL
+0x2100 PPPagedLookasideList : [32] _GENERAL_LOOKASIDE_POOL
+0x2d00 MsrIa32TsxCtrl : Uint8B
+0x2d08 DeferredReadyListHead : _SINGLE_LIST_ENTRY
+0x2d10 MmPageFaultCount : Int4B
+0x2d14 MmCopyOnWriteCount : Int4B
+0x2d18 MmTransitionCount : Int4B
+0x2d1c MmDemandZeroCount : Int4B
+0x2d20 MmPageReadCount : Int4B
+0x2d24 MmPageReadIoCount : Int4B
+0x2d28 MmDirtyPagesWriteCount : Int4B
+0x2d2c MmDirtyWriteIoCount : Int4B
+0x2d30 MmMappedPagesWriteCount : Int4B
+0x2d34 MmMappedWriteIoCount : Int4B
+0x2d38 KeSystemCalls : Uint4B
+0x2d3c KeContextSwitches : Uint4B
+0x2d40 PrcbPad40 : Uint4B
+0x2d44 CcFastReadNoWait : Uint4B
+0x2d48 CcFastReadWait : Uint4B
+0x2d4c CcFastReadNotPossible : Uint4B
+0x2d50 CcCopyReadNoWait : Uint4B
+0x2d54 CcCopyReadWait : Uint4B
+0x2d58 CcCopyReadNoWaitMiss : Uint4B
+0x2d5c IoReadOperationCount : Int4B
+0x2d60 IoWriteOperationCount : Int4B
+0x2d64 IoOtherOperationCount : Int4B
+0x2d68 IoReadTransferCount : _LARGE_INTEGER
+0x2d70 IoWriteTransferCount : _LARGE_INTEGER
+0x2d78 IoOtherTransferCount : _LARGE_INTEGER
+0x2d80 PacketBarrier : Int4B
+0x2d84 TargetCount : Int4B
+0x2d88 IpiFrozen : Uint4B
+0x2d8c PrcbPad30 : Uint4B
+0x2d90 IsrDpcStats : Ptr64 Void
+0x2d98 DeviceInterrupts : Uint4B
+0x2d9c LookasideIrpFloat : Int4B
+0x2da0 InterruptLastCount : Uint4B
+0x2da4 InterruptRate : Uint4B
+0x2da8 PrcbPad31 : Uint8B
+0x2db0 PairPrcb : Ptr64 _KPRCB
+0x2db8 StaticAffinity : _KSTATIC_AFFINITY_BLOCK
+0x3058 PrcbPad35 : [5] Uint8B
+0x3080 InterruptObjectPool : _SLIST_HEADER
+0x3090 DpcRuntimeHistoryHashTable : Ptr64 _RTL_HASH_TABLE
+0x3098 DpcRuntimeHistoryHashTableCleanupDpc : Ptr64 _KDPC
+0x30a0 CurrentDpcRoutine : Ptr64 void
+0x30a8 CurrentDpcRuntimeHistoryCached : Uint8B
+0x30b0 CurrentDpcStartTime : Uint8B
+0x30b8 PrcbPad41 : [1] Uint8B
+0x30c0 DpcData : [2] _KDPC_DATA
+0x3110 DpcStack : Ptr64 Void
+0x3118 MaximumDpcQueueDepth : Int4B
+0x311c DpcRequestRate : Uint4B
+0x3120 MinimumDpcRate : Uint4B
+0x3124 DpcLastCount : Uint4B
+0x3128 ThreadDpcEnable : UChar
+0x3129 QuantumEnd : UChar
+0x312a DpcRoutineActive : UChar
+0x312b IdleSchedule : UChar
+0x312c DpcRequestSummary : Int4B
+0x312c DpcRequestSlot : [2] Int2B
+0x312c NormalDpcState : Int2B
+0x312e ThreadDpcState : Int2B
+0x312c DpcNormalProcessingActive : Pos 0, 1 Bit
+0x312c DpcNormalProcessingRequested : Pos 1, 1 Bit
+0x312c DpcNormalThreadSignal : Pos 2, 1 Bit
+0x312c DpcNormalTimerExpiration : Pos 3, 1 Bit
+0x312c DpcNormalDpcPresent : Pos 4, 1 Bit
+0x312c DpcNormalLocalInterrupt : Pos 5, 1 Bit
+0x312c DpcNormalSpare : Pos 6, 10 Bits
+0x312c DpcThreadActive : Pos 16, 1 Bit
+0x312c DpcThreadRequested : Pos 17, 1 Bit
+0x312c DpcThreadSpare : Pos 18, 14 Bits
+0x3130 PrcbPad93 : Uint4B
+0x3134 LastTick : Uint4B
+0x3138 ClockInterrupts : Uint4B
+0x313c ReadyScanTick : Uint4B
+0x3140 InterruptObject : [256] Ptr64 Void
+0x3940 TimerTable : _KTIMER_TABLE
+0x7b58 PrcbPad92 : [10] Uint4B
+0x7b80 DpcGate : _KGATE
+0x7b98 PrcbPad52 : Ptr64 Void
+0x7ba0 CallDpc : _KDPC
+0x7be0 ClockKeepAlive : Int4B
+0x7be4 PrcbPad60 : [2] UChar
+0x7be6 NmiActive : UChar
+0x7be7 MceActive : UChar
+0x7be6 CombinedNmiMceActive : Uint2B
+0x7be8 DpcWatchdogPeriod : Int4B
+0x7bec DpcWatchdogCount : Int4B
+0x7bf0 KeSpinLockOrdering : Int4B
+0x7bf4 DpcWatchdogProfileCumulativeDpcThreshold : Uint4B
+0x7bf8 CachedPtes : Ptr64 Void
+0x7c00 WaitListHead : _LIST_ENTRY
+0x7c10 WaitLock : Uint8B
+0x7c18 ReadySummary : Uint4B
+0x7c1c AffinitizedSelectionMask : Int4B
+0x7c20 QueueIndex : Uint4B
+0x7c24 PrcbPad75 : [2] Uint4B
+0x7c2c DpcWatchdogSequenceNumber : Uint4B
+0x7c30 TimerExpirationDpc : _KDPC
+0x7c70 ScbQueue : _RTL_RB_TREE
+0x7c80 DispatcherReadyListHead : [32] _LIST_ENTRY
+0x7e80 InterruptCount : Uint4B
+0x7e84 KernelTime : Uint4B
+0x7e88 UserTime : Uint4B
+0x7e8c DpcTime : Uint4B
+0x7e90 InterruptTime : Uint4B
+0x7e94 AdjustDpcThreshold : Uint4B
+0x7e98 DebuggerSavedIRQL : UChar
+0x7e99 GroupSchedulingOverQuota : UChar
+0x7e9a DeepSleep : UChar
+0x7e9b PrcbPad80 : UChar
+0x7e9c DpcTimeCount : Uint4B
+0x7ea0 DpcTimeLimit : Uint4B
+0x7ea4 PeriodicCount : Uint4B
+0x7ea8 PeriodicBias : Uint4B
+0x7eac AvailableTime : Uint4B
+0x7eb0 KeExceptionDispatchCount : Uint4B
+0x7eb4 ReadyThreadCount : Uint4B
+0x7eb8 ReadyQueueExpectedRunTime : Uint8B
+0x7ec0 StartCycles : Uint8B
+0x7ec8 TaggedCyclesStart : Uint8B
+0x7ed0 TaggedCycles : [3] Uint8B
+0x7ee8 AffinitizedCycles : Uint8B
+0x7ef0 ImportantCycles : Uint8B
+0x7ef8 UnimportantCycles : Uint8B
+0x7f00 DpcWatchdogProfileSingleDpcThreshold : Uint4B
+0x7f04 MmSpinLockOrdering : Int4B
+0x7f08 CachedStack : Ptr64 Void
+0x7f10 PageColor : Uint4B
+0x7f14 NodeColor : Uint4B
+0x7f18 NodeShiftedColor : Uint4B
+0x7f1c SecondaryColorMask : Uint4B
+0x7f20 PrcbPad81 : [6] UChar
+0x7f26 ExceptionStackActive : UChar
+0x7f27 TbFlushListActive : UChar
+0x7f28 ExceptionStack : Ptr64 Void
+0x7f30 PrcbPad82 : [1] Uint8B
+0x7f38 CycleTime : Uint8B
+0x7f40 Cycles : [4] [2] Uint8B
+0x7f80 CcFastMdlReadNoWait : Uint4B
+0x7f84 CcFastMdlReadWait : Uint4B
+0x7f88 CcFastMdlReadNotPossible : Uint4B
+0x7f8c CcMapDataNoWait : Uint4B
+0x7f90 CcMapDataWait : Uint4B
+0x7f94 CcPinMappedDataCount : Uint4B
+0x7f98 CcPinReadNoWait : Uint4B
+0x7f9c CcPinReadWait : Uint4B
+0x7fa0 CcMdlReadNoWait : Uint4B
+0x7fa4 CcMdlReadWait : Uint4B
+0x7fa8 CcLazyWriteHotSpots : Uint4B
+0x7fac CcLazyWriteIos : Uint4B
+0x7fb0 CcLazyWritePages : Uint4B
+0x7fb4 CcDataFlushes : Uint4B
+0x7fb8 CcDataPages : Uint4B
+0x7fbc CcLostDelayedWrites : Uint4B
+0x7fc0 CcFastReadResourceMiss : Uint4B
+0x7fc4 CcCopyReadWaitMiss : Uint4B
+0x7fc8 CcFastMdlReadResourceMiss : Uint4B
+0x7fcc CcMapDataNoWaitMiss : Uint4B
+0x7fd0 CcMapDataWaitMiss : Uint4B
+0x7fd4 CcPinReadNoWaitMiss : Uint4B
+0x7fd8 CcPinReadWaitMiss : Uint4B
+0x7fdc CcMdlReadNoWaitMiss : Uint4B
+0x7fe0 CcMdlReadWaitMiss : Uint4B
+0x7fe4 CcReadAheadIos : Uint4B
+0x7fe8 MmCacheTransitionCount : Int4B
+0x7fec MmCacheReadCount : Int4B
+0x7ff0 MmCacheIoCount : Int4B
+0x7ff4 PrcbPad91 : Uint4B
+0x7ff8 MmInternal : Ptr64 Void
+0x8000 PowerState : _PROCESSOR_POWER_STATE
+0x8200 HyperPte : Ptr64 Void
+0x8208 ScbList : _LIST_ENTRY
+0x8218 ForceIdleDpc : _KDPC
+0x8258 DpcWatchdogDpc : _KDPC
+0x8298 DpcWatchdogTimer : _KTIMER
+0x82d8 Cache : [5] _CACHE_DESCRIPTOR
+0x8314 CacheCount : Uint4B
+0x8318 CachedCommit : Uint4B
+0x831c CachedResidentAvailable : Uint4B
+0x8320 WheaInfo : Ptr64 Void
+0x8328 EtwSupport : Ptr64 Void
+0x8330 ExSaPageArray : Ptr64 Void
+0x8338 KeAlignmentFixupCount : Uint4B
+0x833c PrcbPad95 : Uint4B
+0x8340 HypercallPageList : _SLIST_HEADER
+0x8350 StatisticsPage : Ptr64 Uint8B
+0x8358 GenerationTarget : Uint8B
+0x8360 PrcbPad85 : [4] Uint8B
+0x8380 HypercallCachedPages : Ptr64 Void
+0x8388 VirtualApicAssist : Ptr64 Void
+0x8390 PackageProcessorSet : _KAFFINITY_EX
+0x8438 PackageId : Uint4B
+0x843c PrcbPad86 : Uint4B
+0x8440 SharedReadyQueueMask : Uint8B
+0x8448 SharedReadyQueue : Ptr64 _KSHARED_READY_QUEUE
+0x8450 SharedQueueScanOwner : Uint4B
+0x8454 ScanSiblingIndex : Uint4B
+0x8458 CoreProcessorSet : Uint8B
+0x8460 ScanSiblingMask : Uint8B
+0x8468 LLCMask : Uint8B
+0x8470 CacheProcessorMask : [5] Uint8B
+0x8498 ProcessorProfileControlArea : Ptr64 _PROCESSOR_PROFILE_CONTROL_AREA
+0x84a0 ProfileEventIndexAddress : Ptr64 Void
+0x84a8 DpcWatchdogProfile : Ptr64 Ptr64 Void
+0x84b0 DpcWatchdogProfileCurrentEmptyCapture : Ptr64 Ptr64 Void
+0x84b8 SchedulerAssist : Ptr64 Void
+0x84c0 SynchCounters : _SYNCH_COUNTERS
+0x8578 PrcbPad94 : Uint8B
+0x8580 FsCounters : _FILESYSTEM_DISK_COUNTERS
+0x8590 VendorString : [13] UChar
+0x859d PrcbPad100 : [3] UChar
+0x85a0 FeatureBits : Uint8B
+0x85a8 UpdateSignature : _LARGE_INTEGER
+0x85b0 PteBitCache : Uint8B
+0x85b8 PteBitOffset : Uint4B
+0x85bc PrcbPad105 : Uint4B
+0x85c0 Context : Ptr64 _CONTEXT
+0x85c8 ContextFlagsInit : Uint4B
+0x85cc PrcbPad115 : Uint4B
+0x85d0 ExtendedState : Ptr64 _XSAVE_AREA
+0x85d8 IsrStack : Ptr64 Void
+0x85e0 EntropyTimingState : _KENTROPY_TIMING_STATE
+0x8730 PrcbPad110 : Uint8B
+0x8738 StibpPairingTrace : <anonymous-tag>
+0x8770 AbSelfIoBoostsList : _SINGLE_LIST_ENTRY
+0x8778 AbPropagateBoostsList : _SINGLE_LIST_ENTRY
+0x8780 AbDpc : _KDPC
+0x87c0 IoIrpStackProfilerCurrent : _IOP_IRP_STACK_PROFILER
+0x8814 IoIrpStackProfilerPrevious : _IOP_IRP_STACK_PROFILER
+0x8868 SecureFault : _KSECURE_FAULT_INFORMATION
+0x8878 PrcbPad120 : Uint8B
+0x8880 LocalSharedReadyQueue : _KSHARED_READY_QUEUE
+0x8af0 PrcbPad125 : [2] Uint8B
+0x8b00 TimerExpirationTraceCount : Uint4B
+0x8b04 PrcbPad127 : Uint4B
+0x8b08 TimerExpirationTrace : [16] _KTIMER_EXPIRATION_TRACE
+0x8c08 PrcbPad128 : [7] Uint8B
+0x8c40 Mailbox : Ptr64 _REQUEST_MAILBOX
+0x8c48 PrcbPad130 : [7] Uint8B
+0x8c80 McheckContext : [2] _MACHINE_CHECK_CONTEXT
+0x8d20 PrcbPad134 : [4] Uint8B
+0x8d40 SelfmapLockHandle : [4] _KLOCK_QUEUE_HANDLE
+0x8da0 PrcbPad134a : [4] Uint8B
+0x8dc0 PrcbPad138 : [128] UChar
+0x8e40 PrcbPad138a : [64] UChar
+0x8e80 KernelDirectoryTableBase : Uint8B
+0x8e88 RspBaseShadow : Uint8B
+0x8e90 UserRspShadow : Uint8B
+0x8e98 ShadowFlags : Uint4B
+0x8e9c PrcbPad138b : Uint4B
+0x8ea0 PrcbPad138c : Uint8B
+0x8ea8 PrcbPad138d : Uint2B
+0x8eaa VerwSelector : Uint2B
+0x8eac DbgMceNestingLevel : Uint4B
+0x8eb0 DbgMceFlags : Uint4B
+0x8eb4 PrcbPad139b : Uint4B
+0x8eb8 PrcbPad140 : [505] Uint8B
+0x9e80 PrcbPad140a : [8] Uint8B
+0x9ec0 PrcbPad141 : [504] Uint8B
+0xae80 PrcbPad141a : [64] UChar
+0xaec0 RequestMailbox : [1] _REQUEST_MAILBOX

此结构为处理机的扩展信息块。
结构过长,如果要想了解某个字段可以通过 ba r 地址 的方式下读写断点来分析。

重要变量

  • KiProcessorBlock:其中存储了_KPRCB的地址,如需获得_KPCR还需要手动减回去。
    1
    2
    3
    4
    5
    6
    0: kd> dq KiProcessorBlock
    fffff802`33507cc0 fffff802`30fa2180 ffff9a01`683ea180
    fffff802`33507cd0 00000000`00000000 00000000`00000000

    0: kd> rdmsr 0xC0000101
    msr[c0000101] = fffff802`30fa2000 //通过读gs直接获得_KPCR
    此处笔者的虚拟机只给了2个核心。
  • KeNumberProcessors:处理机数量
    1
    2
    0: kd> dd KeNumberProcessors
    fffff802`33506404 00000002 00010000 00083038 ebac8bc0

进程

由于Windows是微内核结构,所以其进程结构有2个一个是用于操作系统调度一个是用户层控制
其中EPROCESS中包含了KPROCESS

KPROCESS

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
69
70
71
0: kd> dt _KPROCESS
nt!_KPROCESS
+0x000 Header : _DISPATCHER_HEADER 分发器对象,内核对象都有

+0x018 ProfileListHead : _LIST_ENTRY
+0x028 DirectoryTableBase : Uint8B Cr3

+0x030 ThreadListHead : _LIST_ENTRY 进程有多少个线程,线程被初始创建的时候加入,终止的时候删除

+0x040 ProcessLock : Uint4B 在修改KPROCESS时用于互斥的

+0x044 ProcessTimerDelay : Uint4B
+0x048 DeepFreezeStartTime : Uint8B

+0x050 Affinity : _KAFFINITY_EX 标准亲和性——进程中的线程可以跑在那个核心

+0x0f8 AffinityPadding : [12] Uint8B

+0x158 ReadyListHead : _LIST_ENTRY 就绪链表,记录了该进程处于就绪状态但为加入全局就绪链表的线程。(意义在于当进程被换出,线程就绪后被挂进来等进程被换入的时候挂到全局链表去)

+0x168 SwapListEntry : _SINGLE_LIST_ENTRY 当一个进程要被换出内存的时候,通过此域加入到KiProcessOutSwapListHead中,换入时加入KiProcessInSwapListHead

+0x170 ActiveProcessors : _KAFFINITY_EX 当前进程中线程跑在哪几个核心上

+0x218 ActiveProcessorsPadding : [12] Uint8B
+0x278 AutoAlignment : Pos 0, 1 Bit
+0x278 DisableBoost : Pos 1, 1 Bit
+0x278 DisableQuantum : Pos 2, 1 Bit 关闭线程的时间碎片的标志位
+0x278 DeepFreeze : Pos 3, 1 Bit
+0x278 TimerVirtualization : Pos 4, 1 Bit
+0x278 CheckStackExtents : Pos 5, 1 Bit
+0x278 CacheIsolationEnabled : Pos 6, 1 Bit
+0x278 PpmPolicy : Pos 7, 3 Bits
+0x278 VaSpaceDeleted : Pos 10, 1 Bit
+0x278 ReservedFlags : Pos 11, 21 Bits
+0x278 ProcessFlags : Int4B
+0x27c ActiveGroupsMask : Uint4B
+0x280 BasePriority : Char 进程的优先级,线程创建会继承这个优先级
+0x281 QuantumReset : Char 时间片数量
+0x282 Visited : Char
+0x283 Flags : _KEXECUTE_OPTIONS

+0x284 ThreadSeed : [20] Uint2B 该进程的线程选择适当的理想处理器(IdealProcessor)的初始值。被选了之后会换一个值

+0x2ac ThreadSeedPadding : [12] Uint2B
+0x2c4 IdealProcessor : [20] Uint2B
+0x2ec IdealProcessorPadding : [12] Uint2B
+0x304 IdealNode : [20] Uint2B
+0x32c IdealNodePadding : [12] Uint2B
+0x344 IdealGlobalNode : Uint2B
+0x346 Spare1 : Uint2B
+0x348 StackCount : _KSTACK_COUNT 记录了有多少个栈

+0x350 ProcessListEntry : _LIST_ENTRY 用于将当前系统中所有具有活动线程的进程串成一个链表,表头为KiProcessListHead

+0x360 CycleTime : Uint8B 结束才会有信息
+0x368 ContextSwitches : Uint8B
+0x370 SchedulingGroup : Ptr64 _KSCHEDULING_GROUP
+0x378 FreezeCount : Uint4B
+0x37c KernelTime : Uint4B 结束才会有信息
+0x380 UserTime : Uint4B 结束才会有信息
+0x384 ReadyTime : Uint4B 结束才会有信息
+0x388 UserDirectoryTableBase : Uint8B
+0x390 AddressPolicy : UChar
+0x391 Spare2 : [71] UChar
+0x3d8 InstrumentationCallback : Ptr64 Void
+0x3e0 SecureState : <anonymous-tag>
+0x3e8 KernelWaitTime : Uint8B
+0x3f0 UserWaitTime : Uint8B
+0x3f8 EndPadding : [8] Uint8B

所有的KPROCESS对象通过KiProcessListHead链表穿起来

EPROCESS

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
1: kd> dt _EPROCESS ffffb70ff0f3f080
nt!_EPROCESS
+0x000 Pcb : _KPROCESS
+0x438 ProcessLock : _EX_PUSH_LOCK
+0x440 UniqueProcessId : 0x00000000`00000914 Void
+0x448 ActiveProcessLinks : _LIST_ENTRY [ 0xfffff802`334280a0 - 0xffffb70f`f17e34c8 ]
+0x458 RundownProtect : _EX_RUNDOWN_REF
+0x460 Flags2 : 0x200d014
+0x460 JobNotReallyActive : 0y0
+0x460 AccountingFolded : 0y0
+0x460 NewProcessReported : 0y1
+0x460 ExitProcessReported : 0y0
+0x460 ReportCommitChanges : 0y1
+0x460 LastReportMemory : 0y0
+0x460 ForceWakeCharge : 0y0
+0x460 CrossSessionCreate : 0y0
+0x460 NeedsHandleRundown : 0y0
+0x460 RefTraceEnabled : 0y0
+0x460 PicoCreated : 0y0
+0x460 EmptyJobEvaluated : 0y0
+0x460 DefaultPagePriority : 0y101
+0x460 PrimaryTokenFrozen : 0y1
+0x460 ProcessVerifierTarget : 0y0
+0x460 RestrictSetThreadContext : 0y0
+0x460 AffinityPermanent : 0y0
+0x460 AffinityUpdateEnable : 0y0
+0x460 PropagateNode : 0y0
+0x460 ExplicitAffinity : 0y0
+0x460 ProcessExecutionState : 0y00
+0x460 EnableReadVmLogging : 0y0
+0x460 EnableWriteVmLogging : 0y1
+0x460 FatalAccessTerminationRequested : 0y0
+0x460 DisableSystemAllowedCpuSet : 0y0
+0x460 ProcessStateChangeRequest : 0y00
+0x460 ProcessStateChangeInProgress : 0y0
+0x460 InPrivate : 0y0
+0x464 Flags : 0x144d0c01
+0x464 CreateReported : 0y1
+0x464 NoDebugInherit : 0y0
+0x464 ProcessExiting : 0y0
+0x464 ProcessDelete : 0y0
+0x464 ManageExecutableMemoryWrites : 0y0
+0x464 VmDeleted : 0y0
+0x464 OutswapEnabled : 0y0
+0x464 Outswapped : 0y0
+0x464 FailFastOnCommitFail : 0y0
+0x464 Wow64VaSpace4Gb : 0y0
+0x464 AddressSpaceInitialized : 0y11
+0x464 SetTimerResolution : 0y0
+0x464 BreakOnTermination : 0y0
+0x464 DeprioritizeViews : 0y0
+0x464 WriteWatch : 0y0
+0x464 ProcessInSession : 0y1
+0x464 OverrideAddressSpace : 0y0
+0x464 HasAddressSpace : 0y1
+0x464 LaunchPrefetched : 0y1
+0x464 Background : 0y0
+0x464 VmTopDown : 0y0
+0x464 ImageNotifyDone : 0y1
+0x464 PdeUpdateNeeded : 0y0
+0x464 VdmAllowed : 0y0
+0x464 ProcessRundown : 0y0
+0x464 ProcessInserted : 0y1
+0x464 DefaultIoPriority : 0y010
+0x464 ProcessSelfDelete : 0y0
+0x464 SetTimerResolutionLink : 0y0
+0x468 CreateTime : _LARGE_INTEGER 0x01db1015`64471ad8
+0x470 ProcessQuotaUsage : [2] 0x30d0
+0x480 ProcessQuotaPeak : [2] 0x30d0
+0x490 PeakVirtualSize : 0x675a000
+0x498 VirtualSize : 0x62d8000
+0x4a0 SessionProcessLinks : _LIST_ENTRY [ 0xffff9a01`69507010 - 0xffffb70f`f08f6520 ]
+0x4b0 ExceptionPortData : 0xffffb70f`ee886db0 Void
+0x4b0 ExceptionPortValue : 0xffffb70f`ee886db0
+0x4b0 ExceptionPortState : 0y000
+0x4b8 Token : _EX_FAST_REF
+0x4c0 MmReserved : 0
+0x4c8 AddressCreationLock : _EX_PUSH_LOCK
+0x4d0 PageTableCommitmentLock : _EX_PUSH_LOCK
+0x4d8 RotateInProgress : (null)
+0x4e0 ForkInProgress : (null)
+0x4e8 CommitChargeJob : 0xffffb70f`ee87f060 _EJOB
+0x4f0 CloneRoot : _RTL_AVL_TREE
+0x4f8 NumberOfPrivatePages : 0x183
+0x500 NumberOfLockedPages : 0
+0x508 Win32Process : 0xffffcaa5`02ebaab0 Void
+0x510 Job : 0xffffb70f`ee87f060 _EJOB
+0x518 SectionObject : 0xffff8988`d9a63210 Void
+0x520 SectionBaseAddress : 0x00000000`00400000 Void
+0x528 Cookie : 0xa7fc5269
+0x530 WorkingSetWatch : (null)
+0x538 Win32WindowStation : 0x00000000`0000014c Void
+0x540 InheritedFromUniqueProcessId : 0x00000000`00000f7c Void
+0x548 OwnerProcessId : 0xf7e
+0x550 Peb : 0x00000000`003f6000 _PEB
+0x558 Session : 0xffff9a01`69507000 _MM_SESSION_SPACE
+0x560 Spare1 : (null)
+0x568 QuotaBlock : 0xffffb70f`ecf1ed40 _EPROCESS_QUOTA_BLOCK
+0x570 ObjectTable : 0xffff8988`db317180 _HANDLE_TABLE
+0x578 DebugPort : (null)
+0x580 WoW64Process : 0xffffb70f`f11e2b70 _EWOW64PROCESS
+0x588 DeviceMap : 0xffff8988`d502beb0 Void
+0x590 EtwDataSource : 0xffffb70f`f1386690 Void
+0x598 PageDirectoryPte : 0
+0x5a0 ImageFilePointer : 0xffffb70f`f1ac0c30 _FILE_OBJECT
+0x5a8 ImageFileName : [15] "InstDrv.exe"
+0x5b7 PriorityClass : 0x3 ''
+0x5b8 SecurityPort : (null)
+0x5c0 SeAuditProcessCreationInfo : _SE_AUDIT_PROCESS_CREATION_INFO
+0x5c8 JobLinks : _LIST_ENTRY [ 0xffffb70f`ee87f088 - 0xffffb70f`ee87f088 ]
+0x5d8 HighestUserAddress : 0x00000000`7fff0000 Void
+0x5e0 ThreadListHead : _LIST_ENTRY [ 0xffffb70f`f04db568 - 0xffffb70f`f17f0528 ]
+0x5f0 ActiveThreads : 4
+0x5f4 ImagePathHash : 0x2170403f
+0x5f8 DefaultHardErrorProcessing : 0x8000
+0x5fc LastThreadExitStatus : 0n0
+0x600 PrefetchTrace : _EX_FAST_REF
+0x608 LockedPagesList : (null)
+0x610 ReadOperationCount : _LARGE_INTEGER 0x0
+0x618 WriteOperationCount : _LARGE_INTEGER 0x0
+0x620 OtherOperationCount : _LARGE_INTEGER 0x0
+0x628 ReadTransferCount : _LARGE_INTEGER 0x0
+0x630 WriteTransferCount : _LARGE_INTEGER 0x0
+0x638 OtherTransferCount : _LARGE_INTEGER 0x0
+0x640 CommitChargeLimit : 0
+0x648 CommitCharge : 0x1f1
+0x650 CommitChargePeak : 0x223
+0x680 Vm : _MMSUPPORT_FULL
+0x7c0 MmProcessLinks : _LIST_ENTRY [ 0xfffff802`33457ca8 - 0xffffb70f`f17e3840 ]
+0x7d0 ModifiedPageCount : 0x5f
+0x7d4 ExitStatus : 0n259
+0x7d8 VadRoot : _RTL_AVL_TREE
+0x7e0 VadHint : 0xffffb70f`efc56750 Void
+0x7e8 VadCount : 0x5a
+0x7f0 VadPhysicalPages : 0
+0x7f8 VadPhysicalPagesLimit : 0
+0x800 AlpcContext : _ALPC_PROCESS_CONTEXT
+0x820 TimerResolutionLink : _LIST_ENTRY [ 0x00000000`00000000 - 0x00000000`00000000 ]
+0x830 TimerResolutionStackRecord : (null)
+0x838 RequestedTimerResolution : 0
+0x83c SmallestTimerResolution : 0
+0x840 ExitTime : _LARGE_INTEGER 0x0
+0x848 InvertedFunctionTable : (null)
+0x850 InvertedFunctionTableLock : _EX_PUSH_LOCK
+0x858 ActiveThreadsHighWatermark : 4
+0x85c LargePrivateVadCount : 0
+0x860 ThreadListLock : _EX_PUSH_LOCK
+0x868 WnfContext : 0xffff8988`d582b630 Void
+0x870 ServerSilo : (null)
+0x878 SignatureLevel : 0 ''
+0x879 SectionSignatureLevel : 0 ''
+0x87a Protection : _PS_PROTECTION
+0x87b HangCount : 0y000
+0x87b GhostCount : 0y000
+0x87b PrefilterException : 0y0
+0x87c Flags3 : 0x59c008
+0x87c Minimal : 0y0
+0x87c ReplacingPageRoot : 0y0
+0x87c Crashed : 0y0
+0x87c JobVadsAreTracked : 0y1
+0x87c VadTrackingDisabled : 0y0
+0x87c AuxiliaryProcess : 0y0
+0x87c SubsystemProcess : 0y0
+0x87c IndirectCpuSets : 0y0
+0x87c RelinquishedCommit : 0y0
+0x87c HighGraphicsPriority : 0y0
+0x87c CommitFailLogged : 0y0
+0x87c ReserveFailLogged : 0y0
+0x87c SystemProcess : 0y0
+0x87c HideImageBaseAddresses : 0y0
+0x87c AddressPolicyFrozen : 0y1
+0x87c ProcessFirstResume : 0y1
+0x87c ForegroundExternal : 0y1
+0x87c ForegroundSystem : 0y0
+0x87c HighMemoryPriority : 0y0
+0x87c EnableProcessSuspendResumeLogging : 0y1
+0x87c EnableThreadSuspendResumeLogging : 0y1
+0x87c SecurityDomainChanged : 0y0
+0x87c SecurityFreezeComplete : 0y1
+0x87c VmProcessorHost : 0y0
+0x87c VmProcessorHostTransition : 0y0
+0x87c AltSyscall : 0y0
+0x87c TimerResolutionIgnore : 0y0
+0x87c DisallowUserTerminate : 0y0
+0x880 DeviceAsid : 0n0
+0x888 SvmData : (null)
+0x890 SvmProcessLock : _EX_PUSH_LOCK
+0x898 SvmLock : 0
+0x8a0 SvmProcessDeviceListHead : _LIST_ENTRY [ 0xffffb70f`f0f3f920 - 0xffffb70f`f0f3f920 ]
+0x8b0 LastFreezeInterruptTime : 0
+0x8b8 DiskCounters : 0xffffb70f`f0f3fac0 _PROCESS_DISK_COUNTERS
+0x8c0 PicoContext : (null)
+0x8c8 EnclaveTable : (null)
+0x8d0 EnclaveNumber : 0
+0x8d8 EnclaveLock : _EX_PUSH_LOCK
+0x8e0 HighPriorityFaultsAllowed : 0
+0x8e8 EnergyContext : 0xffffb70f`f0f3fae8 _PO_PROCESS_ENERGY_CONTEXT
+0x8f0 VmContext : (null)
+0x8f8 SequenceNumber : 0xa7
+0x900 CreateInterruptTime : 0x4573d7d6
+0x908 CreateUnbiasedInterruptTime : 0x4573d7d6
+0x910 TotalUnbiasedFrozenTime : 0
+0x918 LastAppStateUpdateTime : 0x4573d7d6
+0x920 LastAppStateUptime : 0y0000000000000000000000000000000000000000000000000000000000000 (0)
+0x920 LastAppState : 0y000
+0x928 SharedCommitCharge : 0x30b
+0x930 SharedCommitLock : _EX_PUSH_LOCK
+0x938 SharedCommitLinks : _LIST_ENTRY [ 0xffff8988`d99beac8 - 0xffff8988`d99bffb8 ]
+0x948 AllowedCpuSets : 0
+0x950 DefaultCpuSets : 0
+0x948 AllowedCpuSetsIndirect : (null)
+0x950 DefaultCpuSetsIndirect : (null)
+0x958 DiskIoAttribution : (null)
+0x960 DxgProcess : 0xffff8988`d9de6de0 Void
+0x968 Win32KFilterSet : 0
+0x970 ProcessTimerDelay : _PS_INTERLOCKED_TIMER_DELAY_VALUES
+0x978 KTimerSets : 0
+0x97c KTimer2Sets : 0
+0x980 ThreadTimerSets : 2
+0x988 VirtualTimerListLock : 0
+0x990 VirtualTimerListHead : _LIST_ENTRY [ 0xffffb70f`f0f3fa10 - 0xffffb70f`f0f3fa10 ]
+0x9a0 WakeChannel : _WNF_STATE_NAME
+0x9a0 WakeInfo : _PS_PROCESS_WAKE_INFORMATION
+0x9d0 MitigationFlags : 0x40
+0x9d0 MitigationFlagsValues : <anonymous-tag>
+0x9d4 MitigationFlags2 : 0x40000000
+0x9d4 MitigationFlags2Values : <anonymous-tag>
+0x9d8 PartitionObject : 0xffffb70f`eba9bea0 Void
+0x9e0 SecurityDomain : 0x00000001`00000036
+0x9e8 ParentSecurityDomain : 0x00000001`00000036
+0x9f0 CoverageSamplerContext : (null)
+0x9f8 MmHotPatchContext : (null)
+0xa00 DynamicEHContinuationTargetsTree : _RTL_AVL_TREE
+0xa08 DynamicEHContinuationTargetsLock : _EX_PUSH_LOCK
+0xa10 DynamicEnforcedCetCompatibleRanges : _PS_DYNAMIC_ENFORCED_ADDRESS_RANGES
+0xa20 DisabledComponentFlags : 0
+0xa28 PathRedirectionHashes : (null)

关键成员总结:

  • +0x440 UniqueProcessId pid
  • +0x448 ActiveProcessLinks 所有活动进程,其链表头是PsActiveProcessHead
  • +0x458 RundownProtect 进程停止保护锁,当进程到最后被销毁时,他要等到所有其他进程盒线程已经释放了此锁,才能继续运行。
  • +0x460 ExitProcessReported 进程死亡后上报。
  • +0x464 NoDebugInherit 该进程是否无调试继承,可以用来判断是否被调试
  • +0x464 VmTopDown 内存申请方向从大到小(原来是从小到大)
  • +0x464 ProcessInserted 0的话不允许其他进程打开当前进程句柄1则可以,会导致自己进程无法创建线程。
  • +0x498 VirtualSize 进程的虚拟内存大小
  • +0x490 PeakVirtualSize 进程虚拟内存的尖峰值。
  • +0x4a0 SessionProcessLinks 当进程加入到一个系统会话中时,该成员则被加入该会话的进程链表中。
  • +0x4c8 AddressCreationLock 用于保护对地址空间的操作,当内核代码需要对虚拟地址空间进行操作时,必须先上锁,完成后解锁。
  • +0x4f8 NumberOfPrivatePages 进程私有页面数量。
  • +0x500 NumberOfLockedPages 进程被锁住的页面数量。
  • +0x508 Win32Process 指向Windows子系统管理进程的区域,不为NULL,说明是Windows子系统进程(GUI进程)。
  • +0x518 SectionObject 指向进程的可执行文件的内存区对象。
  • +0x520 SectionBaseAddress 该进程的对象基地址。
  • +0x538 Win32WindowStation 该进程所属的窗口站的句柄。
  • +0x540 InheritedFromUniqueProcessId 父进程的pid。
  • +0x558 Session 指向进程所在的系统会话,类型为_MM_SESSION_SPACE指针。
  • 两个处理端口
    • +0x4b0 ExceptionPortData\Value 异常端口,当有异常或调试消息会从内核被发送至此。

    • +0x578 DebugPort 调试端口,当有异常或调试消息会从内核被发送至此。

  • +0x570 ObjectTable 进程句柄表,句柄表包含了所有已被该进程打开的对象。
  • +0x5b7 PriorityClass 表示该进程的优先级(WRK ntpsapi.h中PROCESS_PRIORITY_CLASS_xxx详细定义了)。
  • +0x5b8 SecurityPort 安全端口,指向该进程与lsass进程之间跨进程的通信端口。
  • +0x5c0 SeAuditProcessCreationInfo 存储了进程完整名字。
  • +0x5f0 ActiveThreads 活动的线程数量,为0时进程退出
  • +0x5fc LastThreadExitStatus 记录了刚才最后一个线程的退出状态。
  • +0x608 LockedPagesList 指向_LOCK_HEADER结构的指针,该结构包含一个链表头,系统通过此链表来记录哪些页面被锁定。
  • IO相关记录
    • +0x610 ReadOperationCount 记录了当前进程的NtReadFile的调用次数。
    • +0x618 IoWriteOperationCount 记录了当前进程的NtWriteFile的调用次数。
    • +0x620 OtherOperationCount 记录了除了读写以外的其他IO服务次数。
    • +0x628 ReadTransferCount 记录了读操作的完成次数
    • +0x630 WriteTransferCount 记录了写操作的完成次数
    • +0x638 OtherTransferCount 记录了除了读写以外的其他IO的完成次数
  • +0x648 CommitCharge 进程的虚拟内存页面提交数量。
  • +0x650 CommitChargePeak 尖峰时刻的已提交页面数量。
  • +0x680 Vm 系统为每个进程管理虚拟内存的重要成员。
  • +0x7c0 MmProcessLinks 代表一个双链表节点,所有拥有自己地址空间的进程都被加入其中。
  • +0x7d0 ModifiedPageCount 记录了进程中已修改的页面数量。
  • +0x7d4 ExitStatus 该进程的退出状态。
  • +0x7d8 VadRoot 用于管理该进程的虚拟地址空间。

内核对象

凡是一种内核对象的都具有_OBJECT_HEADER结构,这个结构都在每个内核对象的头之上(从对象头往回减)

x64下大小固定为0x30

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
0: kd> dt _OBJECT_HEADER
nt!_OBJECT_HEADER
+0x000 PointerCount : Int8B
+0x008 HandleCount : Int8B
+0x008 NextToFree : Ptr64 Void
+0x010 Lock : _EX_PUSH_LOCK
+0x018 TypeIndex : UChar
+0x019 TraceFlags : UChar
+0x019 DbgRefTrace : Pos 0, 1 Bit
+0x019 DbgTracePermanent : Pos 1, 1 Bit
+0x01a InfoMask : UChar
+0x01b Flags : UChar
+0x01b NewObject : Pos 0, 1 Bit
+0x01b KernelObject : Pos 1, 1 Bit
+0x01b KernelOnlyAccess : Pos 2, 1 Bit
+0x01b ExclusiveObject : Pos 3, 1 Bit
+0x01b PermanentObject : Pos 4, 1 Bit
+0x01b DefaultSecurityQuota : Pos 5, 1 Bit
+0x01b SingleHandleEntry : Pos 6, 1 Bit
+0x01b DeletedInline : Pos 7, 1 Bit
+0x01c Reserved : Uint4B
+0x020 ObjectCreateInfo : Ptr64 _OBJECT_CREATE_INFORMATION
+0x020 QuotaBlockCharged : Ptr64 Void
+0x028 SecurityDescriptor : Ptr64 Void
+0x030 Body : _QUAD

改某些地方(例如flags字段)可以出现不一样的效果。

函数命名总结

  • Ex:执行体函数,进程、线程、链表、对象属性、赋值、取值、加锁相关
  • Ke:内核函数,大部分导出
  • Ki:微内核函数,不导出,内部自己使用,进程、线程、CPU调度相关
  • Ps:执行体函数,进程、线程相关
  • Mm:内存相关函数,一般导出
  • Mi:内存相关函数,Mm函数底层就是调用Mi,不导出
  • Io:文件、设备相关,导出
  • CC:文件缓存
  • Rtl:导出函数,一般是运行库、字符串、执行体
  • Zw:需要经过查询SSDT表的函数,不需要改变线程的先前模式
  • Nt:Zw函数的底层实现,ZW函数本身不实现功能
  • CM:注册表
  • Hal:硬件相关
  • Ob:对象管理器,句柄、创建内核对象、查找查询内核对象
  • Pnp:电源管理
  • Psp:执行体函数,进程、线程、ps
  • 标题: Windows进程研究
  • 作者: moshui
  • 创建于 : 2024-09-26 04:56:14
  • 更新于 : 2025-02-17 02:14:32
  • 链接: https://www.moshui.eu.org/2024/09/25/KPCR/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论