进程结构体

kd> dt _EPROCESS
+0x000 Pcb : _KPROCESS
+0x06c ProcessLock : _EX_PUSH_LOCK
+0x070 CreateTime : _LARGE_INTEGER //进程创建的时间
+0x078 ExitTime : _LARGE_INTEGER //进程退出的时间
+0x080 RundownProtect : _EX_RUNDOWN_REF //count 是一个整数 可以防止进程被杀死
+0x084 UniqueProcessId : Ptr32 Void //进程的PID
+0x088 ActiveProcessLinks : _LIST_ENTRY //活动进程链 可以通过这个双向链表找到所有的活动进程 双向链表指向进程的0x88处
+0x090 QuotaUsage : [3] Uint4B
+0x09c QuotaPeak : [3] Uint4B
+0x0a8 CommitCharge : Uint4B
+0x0ac PeakVirtualSize : Uint4B
+0x0b0 VirtualSize : Uint4B
+0x0b4 SessionProcessLinks : _LIST_ENTRY 可以通过这个链表,遍历到所有进程。 这个是无法隐藏的,隐藏了系统无法管理到该进程。
+0x0bc DebugPort : Ptr32 Void //调试端口
+0x0c0 ExceptionPort : Ptr32 Void
+0x0c4 ObjectTable : Ptr32 _HANDLE_TABLE 句柄表
+0x0c8 Token : _EX_FAST_REF
+0x0cc WorkingSetLock : _FAST_MUTEX
+0x0ec WorkingSetPage : Uint4B
+0x0f0 AddressCreationLock : _FAST_MUTEX
+0x110 HyperSpaceLock : Uint4B
+0x114 ForkInProgress : Ptr32 _ETHREAD
+0x118 HardwareTrigger : Uint4B
+0x11c VadRoot : Ptr32 Void
+0x120 VadHint : Ptr32 Void
+0x124 CloneRoot : Ptr32 Void
+0x128 NumberOfPrivatePages : Uint4B
+0x12c NumberOfLockedPages : Uint4B
+0x130 Win32Process : Ptr32 Void 不为NULL,说明是GUI进程
+0x134 Job : Ptr32 _EJOB
+0x138 SectionObject : Ptr32 Void
+0x13c SectionBaseAddress : Ptr32 Void
+0x140 QuotaBlock : Ptr32 _EPROCESS_QUOTA_BLOCK
+0x144 WorkingSetWatch : Ptr32 _PAGEFAULT_HISTORY
+0x148 Win32WindowStation : Ptr32 Void
+0x14c InheritedFromUniqueProcessId : Ptr32 Void 父进程的PID
+0x150 LdtInformation : Ptr32 Void
+0x154 VadFreeHint : Ptr32 Void
+0x158 VdmObjects : Ptr32 Void
+0x15c DeviceMap : Ptr32 Void
+0x160 PhysicalVadList : _LIST_ENTRY
+0x168 PageDirectoryPte : _HARDWARE_PTE
+0x168 Filler : Uint8B
+0x170 Session : Ptr32 Void
+0x174 ImageFileName : [16] UChar //进程名
+0x184 JobLinks : _LIST_ENTRY
+0x18c LockedPagesList : Ptr32 Void
+0x190 ThreadListHead : _LIST_ENTRY //进程的线程链表
+0x198 SecurityPort : Ptr32 Void
+0x19c PaeTop : Ptr32 Void
+0x1a0 ActiveThreads : Uint4B
+0x1a4 GrantedAccess : Uint4B
+0x1a8 DefaultHardErrorProcessing : Uint4B
+0x1ac LastThreadExitStatus : Int4B
+0x1b0 Peb : Ptr32 _PEB
+0x1b4 PrefetchTrace : _EX_FAST_REF
+0x1b8 ReadOperationCount : _LARGE_INTEGER 调用ReadFile的次数
+0x1c0 WriteOperationCount : _LARGE_INTEGER 调用WriteFile的次数
+0x1c8 OtherOperationCount : _LARGE_INTEGER
+0x1d0 ReadTransferCount : _LARGE_INTEGER
+0x1d8 WriteTransferCount : _LARGE_INTEGER
+0x1e0 OtherTransferCount : _LARGE_INTEGER
+0x1e8 CommitChargeLimit : Uint4B
+0x1ec CommitChargePeak : Uint4B
+0x1f0 AweInfo : Ptr32 Void
+0x1f4 SeAuditProcessCreationInfo : _SE_AUDIT_PROCESS_CREATION_INFO 可以通过这个字段获取进程的完整路径 里面存的是_OBJECT_NAME_INFORMATION 这个结构体 存的就是完整路径的指针 UNICODE_STRING
+0x1f8 Vm : _MMSUPPORT
+0x238 LastFaultCount : Uint4B
+0x23c ModifiedPageCount : Uint4B
+0x240 NumberOfVads : Uint4B
+0x244 JobStatus : Uint4B
+0x248 Flags : Uint4B 进程的死活可以设置这个值
+0x248 CreateReported : Pos 0, 1 Bit
+0x248 NoDebugInherit : Pos 1, 1 Bit
+0x248 ProcessExiting : Pos 2, 1 Bit
+0x248 ProcessDelete : Pos 3, 1 Bit
+0x248 Wow64SplitPages : Pos 4, 1 Bit
+0x248 VmDeleted : Pos 5, 1 Bit
+0x248 OutswapEnabled : Pos 6, 1 Bit
+0x248 Outswapped : Pos 7, 1 Bit
+0x248 ForkFailed : Pos 8, 1 Bit
+0x248 HasPhysicalVad : Pos 9, 1 Bit
+0x248 AddressSpaceInitialized : Pos 10, 2 Bits
+0x248 SetTimerResolution : Pos 12, 1 Bit
+0x248 BreakOnTermination : Pos 13, 1 Bit
+0x248 SessionCreationUnderway : Pos 14, 1 Bit
+0x248 WriteWatch : Pos 15, 1 Bit
+0x248 ProcessInSession : Pos 16, 1 Bit
+0x248 OverrideAddressSpace : Pos 17, 1 Bit
+0x248 HasAddressSpace : Pos 18, 1 Bit
+0x248 LaunchPrefetched : Pos 19, 1 Bit
+0x248 InjectInpageErrors : Pos 20, 1 Bit
+0x248 VmTopDown : Pos 21, 1 Bit
+0x248 Unused3 : Pos 22, 1 Bit
+0x248 Unused4 : Pos 23, 1 Bit
+0x248 VdmAllowed : Pos 24, 1 Bit
+0x248 Unused : Pos 25, 5 Bits
+0x248 Unused1 : Pos 30, 1 Bit
+0x248 Unused2 : Pos 31, 1 Bit
+0x24c ExitStatus : Int4B 进程的退出状态
+0x250 NextPageColor : Uint2B
+0x252 SubSystemMinorVersion : UChar
+0x253 SubSystemMajorVersion : UChar
+0x252 SubSystemVersion : Uint2B
+0x254 PriorityClass : UChar
+0x255 WorkingSetAcquiredUnsafe : UChar
+0x258 Cookie : Uint4B

EPROCESS的第一个成员 _KPROCESS
kd> dt _KPROCESS
+0x000 Header : _DISPATCHER_HEADER //有这个成员就可以被WaitForSingleObject等待
+0x010 ProfileListHead : _LIST_ENTRY //性能分析
+0x018 DirectoryTableBase : [2] Uint4B //DirectoryTableBase[0] cr3 DirectoryTableBase[1] 超过4GE后的cr3
+0x020 LdtDescriptor : _KGDTENTRY //已经不用了
+0x028 Int21Descriptor : _KIDTENTRY //已经不用了
+0x030 IopmOffset : Uint2B
+0x032 Iopl : UChar
+0x033 Unused : UChar
+0x034 ActiveProcessors : Uint4B 在哪个核
+0x038 KernelTime : Uint4B //记录一个进程内核模式下花的时间
+0x03c UserTime : Uint4B //记录一个进程用户模式下花的时间
+0x040 ReadyListHead : _LIST_ENTRY 当前进程的所有处于就绪状态的线程链表
+0x048 SwapListEntry : _SINGLE_LIST_ENTRY 当前进程被交换到硬盘的链表
+0x04c VdmTrapcHandler : Ptr32 Void
+0x050 ThreadListHead : _LIST_ENTRY 当前进程所有线程的链表
+0x058 ProcessLock : Uint4B 进程锁
+0x05c Affinity : Uint4B //指定哪一个CPU来运行这个进程
+0x060 StackCount : Uint2B KiAttachProcess 调用时,该值+1
+0x062 BasePriority : Char 优先级 创建线程时 如果没有设置优先级 会从进程这里继承
+0x063 ThreadQuantum : Char 线程默认的时间碎片
+0x064 AutoAlignment : UChar
+0x065 State : UChar 交换的状态
+0x066 ThreadSeed : UChar 线程最喜欢的处理器
+0x067 DisableBoost : UChar
+0x068 PowerState : UChar
+0x069 DisableQuantum : UChar
+0x06a IdealNode : UChar
+0x06b Flags : _KEXECUTE_OPTIONS
_KEXECUTE_OPTIONS : 只要将此结构体置为 0x02 就能关闭 DEP 数据执行保护
Pos0 ExecuteDisable : bit 进程 DEP 开启时置 1
Pos1 ExecuteEnable : bit 进程 DEP 关闭时置 1
Pos2 DisableThunkEnulation : bit 为兼容 ATL 程序设计
Pos3 Permanent : bit 置 1 之后,这些标志位都不能再被修改
Pos4 ExecuteDispatchEnable : bit
Pos5 ImageDispathEnable : bit
Pos6 Spare : bit
+0x06b ExecuteOptions : UChar

+0x0bc DebugPort : Ptr32 Void //调试端口
+0x174 ImageFileName : [16] UChar //进程名
FS[124] 的位置是_ETHREAD
_ETHREAD的+0x220就是_EPROCESS
在这里插入图片描述在这里插入图片描述
在这里插入图片描述
链表记录的位置减去0x88才是结构体开始的位置

kd> dd PsActiveProcessHead
805623d8 867b76e8 863880a8 00000001 eebe4644
805623e8 00000000 00040001 00000000 805623f4
805623f8 805623f4 00000000 7c920000 00000000
80562408 00000000 00000000 00000000 00000000
80562418 804f93fb 00000000 00000000 00000000
80562428 86151ae0 86151ae0 00000000 00000000
80562438 00000000 00000000 00000001 f7c85d50
80562448 00000000 00040001 00000000 80562454
kd> dt _EPROCESS 867b76e8-88
+0x000 Pcb : _KPROCESS
+0x06c ProcessLock : _EX_PUSH_LOCK
+0x070 CreateTime : _LARGE_INTEGER 0x0
+0x078 ExitTime : _LARGE_INTEGER 0x0
+0x080 RundownProtect : _EX_RUNDOWN_REF
+0x084 UniqueProcessId : 0x00000004
+0x088 ActiveProcessLinks : _LIST_ENTRY [ 0x865fec68 - 0x805623d8 ]
+0x090 QuotaUsage : [3] 0
+0x09c QuotaPeak : [3] 0
+0x0a8 CommitCharge : 7
+0x0ac PeakVirtualSize : 0x3e2000
+0x0b0 VirtualSize : 0x1ca000
+0x0b4 SessionProcessLinks : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x0bc DebugPort : (null)
+0x0c0 ExceptionPort : (null)
+0x0c4 ObjectTable : 0xe1000c40
+0x0c8 Token : _EX_FAST_REF
+0x0cc WorkingSetLock : _FAST_MUTEX
+0x0ec WorkingSetPage : 0
+0x0f0 AddressCreationLock : _FAST_MUTEX
+0x110 HyperSpaceLock : 0
+0x114 ForkInProgress : (null)
+0x118 HardwareTrigger : 0
+0x11c VadRoot : 0x867b0870
+0x120 VadHint : 0x867b0870
+0x124 CloneRoot : (null)
+0x128 NumberOfPrivatePages : 3
+0x12c NumberOfLockedPages : 0
+0x130 Win32Process : (null)
+0x134 Job : (null)
+0x138 SectionObject : (null)
+0x13c SectionBaseAddress : (null)
+0x140 QuotaBlock : 0x80562480
+0x144 WorkingSetWatch : (null)
+0x148 Win32WindowStation : (null)
+0x14c InheritedFromUniqueProcessId : (null)
+0x150 LdtInformation : (null)
+0x154 VadFreeHint : (null)
+0x158 VdmObjects : (null)
+0x15c DeviceMap : 0xe10087c0
+0x160 PhysicalVadList : _LIST_ENTRY [ 0x867b77c0 - 0x867b77c0 ]
+0x168 PageDirectoryPte : _HARDWARE_PTE
+0x168 Filler : 0
+0x170 Session : (null)
+0x174 ImageFileName : [16] “System”
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
+0x1f8

 kd> dt _MMSUPPORT
   +0x000 LastTrimTime     : _LARGE_INTEGER
   +0x008 Flags            : _MMSUPPORT_FLAGS
   +0x00c PageFaultCount   : Uint4B			当前进程发生页错误的总次数,例如缺页异常
   +0x010 PeakWorkingSetSize : Uint4B
   +0x014 WorkingSetSize   : Uint4B			工作集页的大小
   +0x018 MinimumWorkingSetSize : Uint4B		进程创建时页分配的最小个数
   +0x01c MaximumWorkingSetSize : Uint4B		进程创建时页分配的最多个数
   +0x020 VmWorkingSetList : Ptr32 _MMWSL		进程插入工作集的头部
   +0x024 WorkingSetExpansionLinks : _LIST_ENTRY	工作集链表	这里也可以遍历进程 -0x24-0x1f8 就是进程结构体
   +0x02c Claim            : Uint4B
   +0x030 NextEstimationSlot : Uint4B
   +0x034 NextAgingSlot    : Uint4B
   +0x038 EstimatedAvailable : Uint4B
   +0x03c GrowthSinceLastEstimate : Uint4B

练习 :通过进程结构体遍历所有的进程

	ULONG ProcessListHead=0;
	PLIST_ENTRY pListHead;
	PLIST_ENTRY pListNext;
	__asm{
	
		mov eax,fs:124h
		mov ebx,[eax+220h]  //得到线程结构体
		mov ProcessListHead,ebx
	}

	pListHead=(PLIST_ENTRY)(ProcessListHead+0x88);
	pListNext=pListHead;
	
	do
	{
	
		DbgPrint("ImageFileName=%s\n",(PULONG)pListNext-0x88/4+0x174/4);
		
		pListNext=pListNext->Flink;
	}while(pListHead!=pListNext);
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值