Part 2 of kernel cleanup: merging functions into shims.
This commit is contained in:
@@ -133,9 +133,13 @@ SHIM_CALL ExGetXConfigSetting_shim(
|
||||
}
|
||||
|
||||
|
||||
int xeXexCheckExecutablePriviledge(uint32_t privilege) {
|
||||
KernelState* state = shared_kernel_state_;
|
||||
assert_not_null(state);
|
||||
SHIM_CALL XexCheckExecutablePrivilege_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t privilege = SHIM_GET_ARG_32(0);
|
||||
|
||||
XELOGD(
|
||||
"XexCheckExecutablePrivilege(%.8X)",
|
||||
privilege);
|
||||
|
||||
// BOOL
|
||||
// DWORD Privilege
|
||||
@@ -146,7 +150,8 @@ int xeXexCheckExecutablePriviledge(uint32_t privilege) {
|
||||
|
||||
XUserModule* module = state->GetExecutableModule();
|
||||
if (!module) {
|
||||
return 0;
|
||||
SHIM_SET_RETURN_32(0);
|
||||
return;
|
||||
}
|
||||
xe_xex2_ref xex = module->xex();
|
||||
|
||||
@@ -156,47 +161,10 @@ int xeXexCheckExecutablePriviledge(uint32_t privilege) {
|
||||
xe_xex2_release(xex);
|
||||
module->Release();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
SHIM_CALL XexCheckExecutablePrivilege_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t privilege = SHIM_GET_ARG_32(0);
|
||||
|
||||
XELOGD(
|
||||
"XexCheckExecutablePrivilege(%.8X)",
|
||||
privilege);
|
||||
|
||||
int result = xeXexCheckExecutablePriviledge(privilege);
|
||||
|
||||
SHIM_SET_RETURN_32(result);
|
||||
}
|
||||
|
||||
|
||||
int xeXexGetModuleHandle(const char* module_name,
|
||||
X_HANDLE* module_handle_ptr) {
|
||||
KernelState* state = shared_kernel_state_;
|
||||
assert_not_null(state);
|
||||
|
||||
// BOOL
|
||||
// LPCSZ ModuleName
|
||||
// LPHMODULE ModuleHandle
|
||||
|
||||
XModule* module = state->GetModule(module_name);
|
||||
if (!module) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NOTE: we don't retain the handle for return.
|
||||
*module_handle_ptr = module->handle();
|
||||
|
||||
module->Release();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
SHIM_CALL XexGetModuleHandle_shim(
|
||||
PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t module_name_ptr = SHIM_GET_ARG_32(0);
|
||||
@@ -207,11 +175,18 @@ SHIM_CALL XexGetModuleHandle_shim(
|
||||
"XexGetModuleHandle(%s, %.8X)",
|
||||
module_name, module_handle_ptr);
|
||||
|
||||
X_HANDLE module_handle = 0;
|
||||
int result = xeXexGetModuleHandle(module_name, &module_handle);
|
||||
SHIM_SET_MEM_32(module_handle_ptr, module_handle);
|
||||
XModule* module = state->GetModule(module_name);
|
||||
if (!module) {
|
||||
SHIM_SET_RETURN_32(X_ERROR_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
SHIM_SET_RETURN_32(result);
|
||||
// NOTE: we don't retain the handle for return.
|
||||
SHIM_SET_MEM_32(module_handle_ptr, module->handle());
|
||||
|
||||
module->Release();
|
||||
|
||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user