|
之前大家问我 系统标志位保护的兼容应该怎么做 今天来做一个简单的讲解首选需要你要兼容的机器 ------->本人是虚拟机
需要WinDbg这个软件 与VMware虚拟机进行双机调试。
具体怎么进行连接调试大家可以去网上找找 资料很多!
WinDbg附加到虚拟机系统后,输入>dt _EPROCESS< 可以查看当前系统的EPROCESS结构 我给大家贴上一个例子
这是我虚拟机Windows 8.1 的EPROCESS结构
kd> dt _EPROCESS
nt!_EPROCESS
+0x000 Pcb : _KPROCESS
+0x2c8 ProcessLock : _EX_PUSH_LOCK
+0x2d0 CreateTime : _LARGE_INTEGER
+0x2d8 RundownProtect : _EX_RUNDOWN_REF
+0x2e0 UniqueProcessId : Ptr64 Void
+0x2e8 ActiveProcessLinks : _LIST_ENTRY
+0x2f8 Flags2 : Uint4B
+0x2f8 JobNotReallyActive : Pos 0, 1 Bit
+0x2f8 AccountingFolded : Pos 1, 1 Bit
+0x2f8 NewProcessReported : Pos 2, 1 Bit
+0x2f8 ExitProcessReported : Pos 3, 1 Bit
+0x2f8 ReportCommitChanges : Pos 4, 1 Bit
+0x2f8 LastReportMemory : Pos 5, 1 Bit
+0x2f8 ForceWakeCharge : Pos 6, 1 Bit
+0x2f8 CrossSessionCreate : Pos 7, 1 Bit
+0x2f8 NeedsHandleRundown : Pos 8, 1 Bit
+0x2f8 RefTraceEnabled : Pos 9, 1 Bit
+0x2f8 DisableDynamicCode : Pos 10, 1 Bit
+0x2f8 EmptyJobEvaluated : Pos 11, 1 Bit
+0x2f8 DefaultPagePriority : Pos 12, 3 Bits
+0x2f8 PrimaryTokenFrozen : Pos 15, 1 Bit
+0x2f8 ProcessVerifierTarget : Pos 16, 1 Bit
+0x2f8 StackRandomizationDisabled : Pos 17, 1 Bit
+0x2f8 AffinityPermanent : Pos 18, 1 Bit
+0x2f8 AffinityUpdateEnable : Pos 19, 1 Bit
+0x2f8 PropagateNode : Pos 20, 1 Bit
+0x2f8 ExplicitAffinity : Pos 21, 1 Bit
+0x2f8 ProcessExecutionState : Pos 22, 2 Bits
+0x2f8 DisallowStrippedImages : Pos 24, 1 Bit
+0x2f8 HighEntropyASLREnabled : Pos 25, 1 Bit
+0x2f8 ExtensionPointDisable : Pos 26, 1 Bit
+0x2f8 ForceRelocateImages : Pos 27, 1 Bit
+0x2f8 ProcessStateChangeRequest : Pos 28, 2 Bits
+0x2f8 ProcessStateChangeInProgress : Pos 30, 1 Bit
+0x2f8 DisallowWin32kSystemCalls : Pos 31, 1 Bit
+0x2fc Flags : Uint4B
+0x2fc CreateReported : Pos 0, 1 Bit
+0x2fc NoDebugInherit : Pos 1, 1 Bit
+0x2fc ProcessExiting : Pos 2, 1 Bit
+0x2fc ProcessDelete : Pos 3, 1 Bit
+0x2fc ControlFlowGuardEnabled : Pos 4, 1 Bit
+0x2fc VmDeleted : Pos 5, 1 Bit
+0x2fc OutswapEnabled : Pos 6, 1 Bit
+0x2fc Outswapped : Pos 7, 1 Bit
+0x2fc ForkFailed : Pos 8, 1 Bit
+0x2fc Wow64VaSpace4Gb : Pos 9, 1 Bit
+0x2fc AddressSpaceInitialized : Pos 10, 2 Bits
+0x2fc SetTimerResolution : Pos 12, 1 Bit
+0x2fc BreakOnTermination : Pos 13, 1 Bit
+0x2fc DeprioritizeViews : Pos 14, 1 Bit
+0x2fc WriteWatch : Pos 15, 1 Bit
+0x2fc ProcessInSession : Pos 16, 1 Bit
+0x2fc OverrideAddressSpace : Pos 17, 1 Bit
+0x2fc HasAddressSpace : Pos 18, 1 Bit
+0x2fc LaunchPrefetched : Pos 19, 1 Bit
+0x2fc Background : Pos 20, 1 Bit
+0x2fc VmTopDown : Pos 21, 1 Bit
+0x2fc ImageNotifyDone : Pos 22, 1 Bit
+0x2fc PdeUpdateNeeded : Pos 23, 1 Bit
+0x2fc VdmAllowed : Pos 24, 1 Bit
+0x2fc ProcessRundown : Pos 25, 1 Bit
+0x2fc ProcessInserted : Pos 26, 1 Bit
+0x2fc DefaultIoPriority : Pos 27, 3 Bits
+0x2fc ProcessSelfDelete : Pos 30, 1 Bit
+0x2fc SetTimerResolutionLink : Pos 31, 1 Bit
+0x300 ProcessQuotaUsage : [2] Uint8B
+0x310 ProcessQuotaPeak : [2] Uint8B
+0x320 PeakVirtualSize : Uint8B
+0x328 VirtualSize : Uint8B
+0x330 SessionProcessLinks : _LIST_ENTRY
+0x340 ExceptionPortData : Ptr64 Void
+0x340 ExceptionPortValue : Uint8B
+0x340 ExceptionPortState : Pos 0, 3 Bits
+0x348 Token : _EX_FAST_REF
+0x350 WorkingSetPage : Uint8B
+0x358 AddressCreationLock : _EX_PUSH_LOCK
+0x360 PageTableCommitmentLock : _EX_PUSH_LOCK
+0x368 RotateInProgress : Ptr64 _ETHREAD
+0x370 ForkInProgress : Ptr64 _ETHREAD
+0x378 CommitChargeJob : Ptr64 _EJOB
+0x380 CloneRoot : _RTL_AVL_TREE
+0x388 NumberOfPrivatePages : Uint8B
+0x390 NumberOfLockedPages : Uint8B
+0x398 Win32Process : Ptr64 Void
+0x3a0 Job : Ptr64 _EJOB
+0x3a8 SectionObject : Ptr64 Void
+0x3b0 SectionBaseAddress : Ptr64 Void
+0x3b8 Cookie : Uint4B
+0x3c0 WorkingSetWatch : Ptr64 _PAGEFAULT_HISTORY
+0x3c8 Win32WindowStation : Ptr64 Void
+0x3d0 InheritedFromUniqueProcessId : Ptr64 Void
+0x3d8 LdtInformation : Ptr64 Void
+0x3e0 OwnerProcessId : Uint8B
+0x3e8 Peb : Ptr64 _PEB
+0x3f0 Session : Ptr64 Void
+0x3f8 AweInfo : Ptr64 Void
+0x400 QuotaBlock : Ptr64 _EPROCESS_QUOTA_BLOCK
+0x408 ObjectTable : Ptr64 _HANDLE_TABLE
+0x410 DebugPort : Ptr64 Void
+0x418 Wow64Process : Ptr64 Void
+0x420 DeviceMap : Ptr64 Void
+0x428 EtwDataSource : Ptr64 Void
+0x430 PageDirectoryPte : Uint8B
+0x438 ImageFileName : [15] UChar
+0x447 PriorityClass : UChar
+0x448 SecurityPort : Ptr64 Void
+0x450 SeAuditProcessCreationInfo : _SE_AUDIT_PROCESS_CREATION_INFO
+0x458 JobLinks : _LIST_ENTRY
+0x468 HighestUserAddress : Ptr64 Void
+0x470 ThreadListHead : _LIST_ENTRY
+0x480 ActiveThreads : Uint4B
+0x484 ImagePathHash : Uint4B
+0x488 DefaultHardErrorProcessing : Uint4B
+0x48c LastThreadExitStatus : Int4B
+0x490 PrefetchTrace : _EX_FAST_REF
+0x498 LockedPagesList : Ptr64 Void
+0x4a0 ReadOperationCount : _LARGE_INTEGER
+0x4a8 WriteOperationCount : _LARGE_INTEGER
+0x4b0 OtherOperationCount : _LARGE_INTEGER
+0x4b8 ReadTransferCount : _LARGE_INTEGER
+0x4c0 WriteTransferCount : _LARGE_INTEGER
+0x4c8 OtherTransferCount : _LARGE_INTEGER
+0x4d0 CommitCharge : Uint8B
+0x4d8 Vm : _MMSUPPORT
+0x5c0 MmProcessLinks : _LIST_ENTRY
+0x5d0 ModifiedPageCount : Uint4B
+0x5d4 ExitStatus : Int4B
+0x5d8 VadRoot : _RTL_AVL_TREE
+0x5e0 VadHint : Ptr64 Void
+0x5e8 VadCount : Uint8B
+0x5f0 VadPhysicalPages : Uint8B
+0x5f8 VadPhysicalPagesLimit : Uint8B
+0x600 AlpcContext : _ALPC_PROCESS_CONTEXT
+0x620 TimerResolutionLink : _LIST_ENTRY
+0x630 TimerResolutionStackRecord : Ptr64 _PO_DIAG_STACK_RECORD
+0x638 RequestedTimerResolution : Uint4B
+0x63c SmallestTimerResolution : Uint4B
+0x640 ExitTime : _LARGE_INTEGER
+0x648 InvertedFunctionTable : Ptr64 _INVERTED_FUNCTION_TABLE
+0x650 InvertedFunctionTableLock : _EX_PUSH_LOCK
+0x658 ActiveThreadsHighWatermark : Uint4B
+0x65c LargePrivateVadCount : Uint4B
+0x660 ThreadListLock : _EX_PUSH_LOCK
+0x668 WnfContext : Ptr64 Void
+0x670 Spare0 : Uint8B
+0x678 SignatureLevel : UChar
+0x679 SectionSignatureLevel : UChar
+0x67a Protection : _PS_PROTECTION
+0x67b SpareByte20 : [1] UChar
+0x67c Flags3 : Uint4B
+0x67c Minimal : Pos 0, 1 Bit
+0x680 SvmReserved : Int4B
+0x688 SvmReserved1 : Ptr64 Void
+0x690 SvmReserved2 : Uint8B
+0x698 LastFreezeInterruptTime : Uint8B
+0x6a0 DiskCounters : Ptr64 _PROCESS_DISK_COUNTERS
+0x6a8 PicoContext : Ptr64 Void
+0x6b0 KeepAliveCounter : Uint4B
+0x6b4 NoWakeKeepAliveCounter : Uint4B
+0x6b8 DeepFreezeStartTime : Uint8B
+0x6c0 CommitChargeLimit : Uint8B
+0x6c8 CommitChargePeak : Uint8B
+0x6d0 HighPriorityFaultsAllowed : Uint4B
我们需要找到Protection这个偏移 在上面的EPROCESS结构中 0x67a 就是当前系统的偏移!
那么很明显了 只要你有足够多的虚拟机 就可以做到兼容!
在驱动程序中 我们可以使用RtlGetVersion这个函数来获取当前系统的版本 这个函数在微软官方的文档里就有 R3层也可以调用 通过判断对应系统的版本 来返回对应的偏移值做出兼容!
给大家贴上一个简单的例子:
上面的写法我自己也有一点点没搞懂 我去csdn上查Windows10的EPROCESS结构中的Protection偏移是0x6fa 但是我自己虚拟机获得的数据却是0x87a 我觉得是系统单独版本的问题 这方面大家需要注意 错误的偏移会导致电脑蓝屏!
国庆最后一天了 希望大家都过了一个愉快的假期!
国庆最后一天了 希望大家都过了一个愉快的假期!
国庆最后一天了 希望大家都过了一个愉快的假期!
我自身技术不够------>大家嘴下留情!
|
-
评分
-
查看全部评分
|