[Kernel] nonintrusive guest to host object mapping

This commit is contained in:
disjtqz
2023-10-13 15:04:01 -04:00
committed by Radosław Gliński
parent d36b1b3830
commit ee424ae14a
7 changed files with 106 additions and 63 deletions

View File

@@ -62,28 +62,6 @@ typedef struct {
} X_DISPATCH_HEADER;
static_assert_size(X_DISPATCH_HEADER, 0x10);
// https://www.nirsoft.net/kernel_struct/vista/OBJECT_HEADER.html
struct X_OBJECT_HEADER {
xe::be<uint32_t> pointer_count;
union {
xe::be<uint32_t> handle_count;
xe::be<uint32_t> next_to_free;
};
uint8_t name_info_offset;
uint8_t handle_info_offset;
uint8_t quota_info_offset;
uint8_t flags;
union {
xe::be<uint32_t> object_create_info; // X_OBJECT_CREATE_INFORMATION
xe::be<uint32_t> quota_block_charged;
};
xe::be<uint32_t> object_type_ptr; // -0x8 POBJECT_TYPE
xe::be<uint32_t> unk_04; // -0x4
// Object lives after this header.
// (There's actually a body field here which is the object itself)
};
// https://www.nirsoft.net/kernel_struct/vista/OBJECT_CREATE_INFORMATION.html
struct X_OBJECT_CREATE_INFORMATION {
xe::be<uint32_t> attributes; // 0x0
@@ -99,16 +77,6 @@ struct X_OBJECT_CREATE_INFORMATION {
// Security QoS here (SECURITY_QUALITY_OF_SERVICE) too!
};
struct X_OBJECT_TYPE {
xe::be<uint32_t> constructor; // 0x0
xe::be<uint32_t> destructor; // 0x4
xe::be<uint32_t> unk_08; // 0x8
xe::be<uint32_t> unk_0C; // 0xC
xe::be<uint32_t> unk_10; // 0x10
xe::be<uint32_t> unk_14; // 0x14 probably offset from ntobject to keobject
xe::be<uint32_t> pool_tag; // 0x18
};
class XObject {
public:
// 45410806 needs proper handle value for certain calculations
@@ -221,11 +189,7 @@ class XObject {
return reinterpret_cast<T*>(CreateNative(sizeof(T)));
}
// Stash native pointer into X_DISPATCH_HEADER
static void StashHandle(X_DISPATCH_HEADER* header, uint32_t handle) {
header->wait_list_flink = kXObjSignature;
header->wait_list_blink = handle;
}
static uint32_t TimeoutTicksToMs(int64_t timeout_ticks);