[Kernel] Suffix export functions with _entry.

This commit is contained in:
gibbed
2022-01-09 11:14:40 -06:00
committed by Rick Gibbed
parent ce1a84375b
commit 3ad0a7dab2
40 changed files with 965 additions and 888 deletions

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2020 Ben Vanik. All rights reserved. *
* Copyright 2022 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -20,9 +20,9 @@ namespace xe {
namespace kernel {
namespace xboxkrnl {
dword_result_t ObOpenObjectByName(lpunknown_t obj_attributes_ptr,
lpunknown_t object_type_ptr, dword_t unk,
lpdword_t handle_ptr) {
dword_result_t ObOpenObjectByName_entry(lpunknown_t obj_attributes_ptr,
lpunknown_t object_type_ptr,
dword_t unk, lpdword_t handle_ptr) {
// r3 = ptr to info?
// +0 = -4
// +4 = name ptr
@@ -47,8 +47,8 @@ dword_result_t ObOpenObjectByName(lpunknown_t obj_attributes_ptr,
}
DECLARE_XBOXKRNL_EXPORT1(ObOpenObjectByName, kNone, kImplemented);
dword_result_t ObOpenObjectByPointer(lpvoid_t object_ptr,
lpdword_t out_handle_ptr) {
dword_result_t ObOpenObjectByPointer_entry(lpvoid_t object_ptr,
lpdword_t out_handle_ptr) {
auto object = XObject::GetNativeObject<XObject>(kernel_state(), object_ptr);
if (!object) {
return X_STATUS_UNSUCCESSFUL;
@@ -61,8 +61,8 @@ dword_result_t ObOpenObjectByPointer(lpvoid_t object_ptr,
}
DECLARE_XBOXKRNL_EXPORT1(ObOpenObjectByPointer, kNone, kImplemented);
dword_result_t ObLookupThreadByThreadId(dword_t thread_id,
lpdword_t out_object_ptr) {
dword_result_t ObLookupThreadByThreadId_entry(dword_t thread_id,
lpdword_t out_object_ptr) {
auto thread = kernel_state()->GetThreadByID(thread_id);
if (!thread) {
return X_STATUS_NOT_FOUND;
@@ -75,9 +75,9 @@ dword_result_t ObLookupThreadByThreadId(dword_t thread_id,
}
DECLARE_XBOXKRNL_EXPORT1(ObLookupThreadByThreadId, kNone, kImplemented);
dword_result_t ObReferenceObjectByHandle(dword_t handle,
dword_t object_type_ptr,
lpdword_t out_object_ptr) {
dword_result_t ObReferenceObjectByHandle_entry(dword_t handle,
dword_t object_type_ptr,
lpdword_t out_object_ptr) {
// These values come from how Xenia handles uninitialized kernel data exports.
// D###BEEF where ### is the ordinal.
const static std::unordered_map<XObject::Type, uint32_t> object_types = {
@@ -109,22 +109,24 @@ dword_result_t ObReferenceObjectByHandle(dword_t handle,
}
DECLARE_XBOXKRNL_EXPORT1(ObReferenceObjectByHandle, kNone, kImplemented);
dword_result_t ObReferenceObjectByName(lpstring_t name, dword_t attributes,
dword_t object_type_ptr,
lpvoid_t parse_context,
lpdword_t out_object_ptr) {
dword_result_t ObReferenceObjectByName_entry(lpstring_t name,
dword_t attributes,
dword_t object_type_ptr,
lpvoid_t parse_context,
lpdword_t out_object_ptr) {
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
X_STATUS result =
kernel_state()->object_table()->GetObjectByName(name.value(), &handle);
if (XSUCCEEDED(result)) {
return ObReferenceObjectByHandle(handle, object_type_ptr, out_object_ptr);
return ObReferenceObjectByHandle_entry(handle, object_type_ptr,
out_object_ptr);
}
return result;
}
DECLARE_XBOXKRNL_EXPORT1(ObReferenceObjectByName, kNone, kImplemented);
dword_result_t ObDereferenceObject(dword_t native_ptr) {
dword_result_t ObDereferenceObject_entry(dword_t native_ptr) {
// Check if a dummy value from ObReferenceObjectByHandle.
if (native_ptr == 0xDEADF00D) {
return 0;
@@ -140,8 +142,8 @@ dword_result_t ObDereferenceObject(dword_t native_ptr) {
}
DECLARE_XBOXKRNL_EXPORT1(ObDereferenceObject, kNone, kImplemented);
dword_result_t ObCreateSymbolicLink(pointer_t<X_ANSI_STRING> path_ptr,
pointer_t<X_ANSI_STRING> target_ptr) {
dword_result_t ObCreateSymbolicLink_entry(pointer_t<X_ANSI_STRING> path_ptr,
pointer_t<X_ANSI_STRING> target_ptr) {
auto path = util::TranslateAnsiString(kernel_memory(), path_ptr);
auto target = util::TranslateAnsiString(kernel_memory(), target_ptr);
path = xe::utf8::canonicalize_guest_path(path);
@@ -159,7 +161,7 @@ dword_result_t ObCreateSymbolicLink(pointer_t<X_ANSI_STRING> path_ptr,
}
DECLARE_XBOXKRNL_EXPORT1(ObCreateSymbolicLink, kNone, kImplemented);
dword_result_t ObDeleteSymbolicLink(pointer_t<X_ANSI_STRING> path_ptr) {
dword_result_t ObDeleteSymbolicLink_entry(pointer_t<X_ANSI_STRING> path_ptr) {
auto path = util::TranslateAnsiString(kernel_memory(), path_ptr);
if (!kernel_state()->file_system()->UnregisterSymbolicLink(path)) {
return X_STATUS_UNSUCCESSFUL;
@@ -169,8 +171,8 @@ dword_result_t ObDeleteSymbolicLink(pointer_t<X_ANSI_STRING> path_ptr) {
}
DECLARE_XBOXKRNL_EXPORT1(ObDeleteSymbolicLink, kNone, kImplemented);
dword_result_t NtDuplicateObject(dword_t handle, lpdword_t new_handle_ptr,
dword_t options) {
dword_result_t NtDuplicateObject_entry(dword_t handle, lpdword_t new_handle_ptr,
dword_t options) {
// NOTE: new_handle_ptr can be zero to just close a handle.
// NOTE: this function seems to be used to get the current thread handle
// (passed handle=-2).
@@ -194,7 +196,7 @@ dword_result_t NtDuplicateObject(dword_t handle, lpdword_t new_handle_ptr,
}
DECLARE_XBOXKRNL_EXPORT1(NtDuplicateObject, kNone, kImplemented);
dword_result_t NtClose(dword_t handle) {
dword_result_t NtClose_entry(dword_t handle) {
return kernel_state()->object_table()->ReleaseHandle(handle);
}
DECLARE_XBOXKRNL_EXPORT1(NtClose, kNone, kImplemented);