- UID
- 2
- 精华
- 积分
- 7736
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
楼主 |
发表于 2015-7-23 15:47:44
|
显示全部楼层
关于获取objecttype的一点技巧
- ObReferenceObjectByHandle(
- _In_ HANDLE Handle,
- _In_ ACCESS_MASK DesiredAccess,
- _In_opt_ POBJECT_TYPE ObjectType,
- _In_ KPROCESSOR_MODE AccessMode,
- _Out_ PVOID *Object,
- _Out_opt_ POBJECT_HANDLE_INFORMATION HandleInformation
- );
- typedef struct _OBJECT_HEADER {
- LONG_PTR PointerCount;
- union {
- LONG_PTR HandleCount;
- PVOID NextToFree;
- };
- POBJECT_TYPE Type;
- UCHAR NameInfoOffset;
- UCHAR HandleInfoOffset;
- UCHAR QuotaInfoOffset;
- UCHAR Flags;
- union {
- POBJECT_CREATE_INFORMATION ObjectCreateInfo;
- PVOID QuotaBlockCharged;
- };
- PSECURITY_DESCRIPTOR SecurityDescriptor;
- QUAD Body;
- } OBJECT_HEADER, *POBJECT_HEADER;
- typedef struct _OBJECT_TYPE {
- ERESOURCE Mutex;
- LIST_ENTRY TypeList;
- UNICODE_STRING Name; // Copy from object header for convenience
- PVOID DefaultObject;
- ULONG Index;
- ULONG TotalNumberOfObjects;
- ULONG TotalNumberOfHandles;
- ULONG HighWaterNumberOfObjects;
- ULONG HighWaterNumberOfHandles;
- OBJECT_TYPE_INITIALIZER TypeInfo;
- #ifdef POOL_TAGGING
- ULONG Key;
- #endif //POOL_TAGGING
- ERESOURCE ObjectLocks[ OBJECT_LOCK_COUNT ];
- } OBJECT_TYPE, *POBJECT_TYPE;
- POBJECT_HEADER pObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
- POBJECT_TYPE ObjectType = ReadForWriteAccess(&ObjectHeader->Type);
- 或
- POBJECT_TYPE ObjectType = ObGetObjectType(Object);
- 实现:
- int __stdcall ObGetObjectType(int a1)
- {
- return *(&ObTypeIndexTable + *(_BYTE *)(a1 - 0xC));
- }
- ObjectType can be *ExEventObjectType, *ExSemaphoreObjectType, *IoFileObjectType, *PsProcessType, *PsThreadType, *SeTokenObjectType, *TmEnlistmentObjectType, *TmResourceManagerObjectType, *TmTransactionManagerObjectType, or *TmTransactionObjectType
复制代码 |
|