These are implemented (and formatting)

This commit is contained in:
Dr. Chat 2015-07-17 19:58:56 -05:00
parent c60d30a311
commit 55f5b95670
1 changed files with 28 additions and 29 deletions

View File

@ -49,6 +49,34 @@ SHIM_CALL ObOpenObjectByName_shim(PPCContext* ppc_context,
SHIM_SET_RETURN_32(result); SHIM_SET_RETURN_32(result);
} }
dword_result_t ObOpenObjectByPointer(lpvoid_t object_ptr,
lpdword_t out_handle_ptr) {
auto object = XObject::GetNativeObject<XObject>(kernel_state(), object_ptr);
if (!object) {
return X_STATUS_UNSUCCESSFUL;
}
// Retain the handle. Will be released in NtClose.
object->RetainHandle();
*out_handle_ptr = object->handle();
return X_STATUS_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT(ObOpenObjectByPointer, ExportTag::kImplemented);
dword_result_t ObLookupThreadByThreadId(dword_t thread_id,
lpdword_t out_object_ptr) {
auto thread = kernel_state()->GetThreadByID(thread_id);
if (!thread) {
return X_STATUS_NOT_FOUND;
}
// Retain the object. Will be released in ObDereferenceObject.
thread->Retain();
*out_object_ptr = thread->guest_object();
return X_STATUS_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT(ObLookupThreadByThreadId, ExportTag::kImplemented);
SHIM_CALL ObReferenceObjectByHandle_shim(PPCContext* ppc_context, SHIM_CALL ObReferenceObjectByHandle_shim(PPCContext* ppc_context,
KernelState* kernel_state) { KernelState* kernel_state) {
uint32_t handle = SHIM_GET_ARG_32(0); uint32_t handle = SHIM_GET_ARG_32(0);
@ -136,35 +164,6 @@ SHIM_CALL ObDereferenceObject_shim(PPCContext* ppc_context,
SHIM_SET_RETURN_32(0); SHIM_SET_RETURN_32(0);
} }
dword_result_t ObLookupThreadByThreadId(dword_t thread_id, lpdword_t out_object_ptr) {
auto thread = kernel_state()->GetThreadByID(thread_id);
if (!thread) {
return X_STATUS_NOT_FOUND;
}
// Retain the object. Will be released in ObDereferenceObject.
thread->Retain();
*out_object_ptr = thread->guest_object();
auto hdr = kernel_memory()->TranslateVirtual<X_DISPATCH_HEADER*>(thread->guest_object());
assert_true(hdr->type == 6);
return X_STATUS_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT(ObLookupThreadByThreadId, ExportTag::kStub);
dword_result_t ObOpenObjectByPointer(lpvoid_t object_ptr, lpdword_t out_handle_ptr) {
auto object = XObject::GetNativeObject<XObject>(kernel_state(), object_ptr);
if (!object) {
return X_STATUS_UNSUCCESSFUL;
}
// Retain the handle. Will be released in NtClose.
object->RetainHandle();
*out_handle_ptr = object->handle();
return X_STATUS_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT(ObOpenObjectByPointer, ExportTag::kStub);
dword_result_t NtDuplicateObject(dword_t handle, lpdword_t new_handle_ptr, dword_result_t NtDuplicateObject(dword_t handle, lpdword_t new_handle_ptr,
dword_t options) { dword_t options) {
// NOTE: new_handle_ptr can be zero to just close a handle. // NOTE: new_handle_ptr can be zero to just close a handle.