[XBOXKRNL] - Replace lpvoid_t with pointer_t
- Replace lpvoid_t with pointer_t - Use TypedGuestPointer for X_DEVICE_OBJECT struct
This commit is contained in:
committed by
Radosław Gliński
parent
2b3f0cb456
commit
7d8db5a2cd
@@ -741,9 +741,9 @@ struct X_IRP_OVERLAY {
|
||||
X_LIST_ENTRY device_list_entry; // 0x0 sz:0x8
|
||||
xe::be<uint32_t> driver_context_ptr[4]; // 0x0 sz:0x10
|
||||
};
|
||||
xe::be<uint32_t> locked_buffer_length; // 0x10 sz:0x4
|
||||
xe::be<uint32_t> thread_ptr; // 0x14 sz:0x4
|
||||
X_LIST_ENTRY list_entry; // 0x18 sz:0x8
|
||||
xe::be<uint32_t> locked_buffer_length; // 0x10 sz:0x4
|
||||
TypedGuestPointer<X_KTHREAD> thread_ptr; // 0x14 sz:0x4
|
||||
X_LIST_ENTRY list_entry; // 0x18 sz:0x8
|
||||
union {
|
||||
xe::be<uint32_t>
|
||||
current_stack_location_ptr; // 0x20 sz:0x4, X_IO_STACK_LOCATION -> 0x24
|
||||
@@ -761,37 +761,37 @@ union X_IRP_TAIL {
|
||||
};
|
||||
|
||||
struct X_IRP {
|
||||
xe::be<uint16_t> type; // 0x0 sz:0x2
|
||||
xe::be<uint16_t> size; // 0x2 sz:0x2
|
||||
xe::be<uint32_t> flags; // 0x4 sz:0x4
|
||||
X_LIST_ENTRY thread_list_entry; // 0x8 sz:0x8
|
||||
X_IO_STATUS_BLOCK io_status; // 0x10 sz:0x8
|
||||
xe::be<uint8_t> stack_count; // 0x18 sz:0x1
|
||||
xe::be<uint8_t> current_location; // 0x19 sz:0x1
|
||||
xe::be<uint8_t> pending_returned; // 0x1A sz:0x1
|
||||
xe::be<uint8_t> cancel; // 0x1B sz:0x1
|
||||
xe::be<uint32_t> user_buffer_ptr; // 0x1C sz:0x4
|
||||
xe::be<uint32_t> user_iosb_ptr; // 0x20 sz:0x4, X_IO_STATUS_BLOCK*
|
||||
xe::be<uint32_t> user_event_ptr; // 0x24 sz:0x4, X_KEVENT*
|
||||
X_UNION_IRP_OVERLAY overlay; // 0x28 sz:0x8
|
||||
X_IRP_TAIL tail; // 0x30 sz:0x28
|
||||
xe::be<uint32_t> cancel_routine_ptr; // 0x58 sz:0x4
|
||||
xe::be<uint16_t> type; // 0x0 sz:0x2
|
||||
xe::be<uint16_t> size; // 0x2 sz:0x2
|
||||
xe::be<uint32_t> flags; // 0x4 sz:0x4
|
||||
X_LIST_ENTRY thread_list_entry; // 0x8 sz:0x8
|
||||
X_IO_STATUS_BLOCK io_status; // 0x10 sz:0x8
|
||||
xe::be<uint8_t> stack_count; // 0x18 sz:0x1
|
||||
xe::be<uint8_t> current_location; // 0x19 sz:0x1
|
||||
xe::be<uint8_t> pending_returned; // 0x1A sz:0x1
|
||||
xe::be<uint8_t> cancel; // 0x1B sz:0x1
|
||||
xe::be<uint32_t> user_buffer_ptr; // 0x1C sz:0x4
|
||||
TypedGuestPointer<X_IO_STATUS_BLOCK> user_iosb_ptr; // 0x20 sz:0x4
|
||||
TypedGuestPointer<X_KEVENT> user_event_ptr; // 0x24 sz:0x4
|
||||
X_UNION_IRP_OVERLAY overlay; // 0x28 sz:0x8
|
||||
X_IRP_TAIL tail; // 0x30 sz:0x28
|
||||
xe::be<uint32_t> cancel_routine_ptr; // 0x58 sz:0x4
|
||||
};
|
||||
static_assert_size(X_IRP, 0x60);
|
||||
|
||||
struct X_DEVICE_OBJECT {
|
||||
xe::be<uint16_t> type; // 0x0 sz:0x2
|
||||
xe::be<uint16_t> device_extension_size; // 0x2 sz:0x2
|
||||
xe::be<uint32_t> reference_count; // 0x4 sz:0x4
|
||||
xe::be<uint32_t> drive_object_ptr; // 0x8 sz:0x4, X_DRIVER_OBJECT*
|
||||
xe::be<uint32_t> mounted_or_self_device; // 0xC sz:0x4, X_DEVICE_OBJECT*
|
||||
xe::be<uint32_t> current_irp_ptr; // 0x10 sz:0x4, X_IRP*
|
||||
xe::be<uint32_t> flags; // 0x14 sz:0x4
|
||||
xe::be<uint32_t> device_extension_ptr; // 0x18 sz:0x4
|
||||
xe::be<uint8_t> device_type; // 0x1C sz:0x1
|
||||
xe::be<uint8_t> start_io_flags; // 0x1D sz:0x1
|
||||
xe::be<uint8_t> stack_size; // 0x1E sz:0x1
|
||||
xe::be<uint8_t> delete_pending; // 0x1F sz:0x1
|
||||
xe::be<uint16_t> type; // 0x0 sz:0x2
|
||||
xe::be<uint16_t> device_extension_size; // 0x2 sz:0x2
|
||||
xe::be<uint32_t> reference_count; // 0x4 sz:0x4
|
||||
TypedGuestPointer<X_DRIVER_OBJECT> drive_object_ptr; // 0x8 sz:0x4
|
||||
TypedGuestPointer<X_DEVICE_OBJECT> mounted_or_self_device; // 0xC sz:0x4
|
||||
TypedGuestPointer<X_IRP> current_irp_ptr; // 0x10 sz:0x4
|
||||
xe::be<uint32_t> flags; // 0x14 sz:0x4
|
||||
xe::be<uint32_t> device_extension_ptr; // 0x18 sz:0x4
|
||||
xe::be<uint8_t> device_type; // 0x1C sz:0x1
|
||||
xe::be<uint8_t> start_io_flags; // 0x1D sz:0x1
|
||||
xe::be<uint8_t> stack_size; // 0x1E sz:0x1
|
||||
xe::be<uint8_t> delete_pending; // 0x1F sz:0x1
|
||||
xe::be<uint32_t> sector_size; // 0x20 sz:0x4, set by XamRamDriveCreate
|
||||
xe::be<uint32_t>
|
||||
alignment; // 0x24 sz:0x4, NtQueryInformationFile called to verify
|
||||
|
||||
@@ -535,9 +535,9 @@ DECLARE_XBOXKRNL_EXPORT1(RtlImageXexHeaderField, kNone, kImplemented);
|
||||
#pragma pack(push, 1)
|
||||
struct X_RTL_CRITICAL_SECTION {
|
||||
X_DISPATCH_HEADER header;
|
||||
int32_t lock_count; // 0x10 -1 -> 0 on first lock
|
||||
xe::be<int32_t> recursion_count; // 0x14 0 -> 1 on first lock
|
||||
xe::be<uint32_t> owning_thread; // 0x18 PKTHREAD 0 unless locked
|
||||
int32_t lock_count; // 0x10 -1 -> 0 on first lock
|
||||
xe::be<int32_t> recursion_count; // 0x14 0 -> 1 on first lock
|
||||
TypedGuestPointer<X_KTHREAD> owning_thread; // 0x18 PKTHREAD 0 unless locked
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert_size(X_RTL_CRITICAL_SECTION, 28);
|
||||
|
||||
@@ -773,9 +773,9 @@ dword_result_t KeReleaseSemaphore_entry(pointer_t<X_KSEMAPHORE> semaphore_ptr,
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(KeReleaseSemaphore, kThreading, kImplemented);
|
||||
|
||||
dword_result_t NtCreateSemaphore_entry(lpdword_t handle_ptr,
|
||||
lpvoid_t obj_attributes_ptr,
|
||||
dword_t count, dword_t limit) {
|
||||
dword_result_t NtCreateSemaphore_entry(
|
||||
lpdword_t handle_ptr, pointer_t<X_OBJECT_ATTRIBUTES> obj_attributes_ptr,
|
||||
dword_t count, dword_t limit) {
|
||||
// Check for an existing semaphore with the same name.
|
||||
auto existing_object =
|
||||
LookupNamedObject<XSemaphore>(kernel_state(), obj_attributes_ptr);
|
||||
@@ -903,9 +903,9 @@ dword_result_t NtReleaseMutant_entry(dword_t mutant_handle,
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(NtReleaseMutant, kThreading, kImplemented);
|
||||
|
||||
dword_result_t NtCreateTimer_entry(lpdword_t handle_ptr,
|
||||
lpvoid_t obj_attributes_ptr,
|
||||
dword_t timer_type) {
|
||||
dword_result_t NtCreateTimer_entry(
|
||||
lpdword_t handle_ptr, pointer_t<X_OBJECT_ATTRIBUTES> obj_attributes_ptr,
|
||||
dword_t timer_type) {
|
||||
// timer_type = NotificationTimer (0) or SynchronizationTimer (1)
|
||||
|
||||
// Check for an existing timer with the same name.
|
||||
@@ -1057,7 +1057,7 @@ DECLARE_XBOXKRNL_EXPORT3(NtWaitForSingleObjectEx, kThreading, kImplemented,
|
||||
dword_result_t KeWaitForMultipleObjects_entry(
|
||||
dword_t count, lpdword_t objects_ptr, dword_t wait_type,
|
||||
dword_t wait_reason, dword_t processor_mode, dword_t alertable,
|
||||
lpqword_t timeout_ptr, lpvoid_t wait_block_array_ptr) {
|
||||
lpqword_t timeout_ptr, pointer_t<X_KWAIT_BLOCK> wait_block_array_ptr) {
|
||||
assert_true(wait_type <= X_KWAIT_REASON::WaitAny);
|
||||
|
||||
assert_true(count <= 64);
|
||||
@@ -1531,7 +1531,7 @@ void xeKeInitializeApc(XAPC* apc, uint32_t thread_ptr, uint32_t kernel_routine,
|
||||
}
|
||||
apc->enqueued = 0;
|
||||
}
|
||||
void KeInitializeApc_entry(pointer_t<XAPC> apc, lpvoid_t thread_ptr,
|
||||
void KeInitializeApc_entry(pointer_t<XAPC> apc, pointer_t<X_KTHREAD> thread_ptr,
|
||||
lpvoid_t kernel_routine, lpvoid_t rundown_routine,
|
||||
lpvoid_t normal_routine, dword_t processor_mode,
|
||||
lpvoid_t normal_context) {
|
||||
|
||||
@@ -131,7 +131,6 @@ class XObject {
|
||||
case X_DISPATCHER_FLAGS::DISPATCHER_MANUAL_RESET_EVENT:
|
||||
case X_DISPATCHER_FLAGS::DISPATCHER_AUTO_RESET_EVENT:
|
||||
return Type::Event;
|
||||
return Type::Mutant;
|
||||
case X_DISPATCHER_FLAGS::DISPATCHER_MUTANT:
|
||||
return Type::Mutant;
|
||||
case X_DISPATCHER_FLAGS::DISPATCHER_SEMAPHORE:
|
||||
|
||||
Reference in New Issue
Block a user