XamUserGetSigninInfo, NtCreateSemaphore, busted error codes.

This commit is contained in:
Ben Vanik 2014-01-05 00:48:00 -08:00
parent 29208a7fae
commit b7f83f4154
3 changed files with 55 additions and 9 deletions

View File

@ -53,6 +53,20 @@ SHIM_CALL XamUserGetSigninState_shim(
} }
SHIM_CALL XamUserGetSigninInfo_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t user_index = SHIM_GET_ARG_32(0);
uint32_t flags = SHIM_GET_ARG_32(1);
uint32_t info_ptr = SHIM_GET_ARG_32(2);
XELOGD(
"XamUserGetSigninInfo(%d, %.8X, %.8X)",
user_index, flags, info_ptr);
SHIM_SET_RETURN(X_ERROR_NO_SUCH_USER);
}
// http://freestyledash.googlecode.com/svn/trunk/Freestyle/Tools/Generic/xboxtools.cpp // http://freestyledash.googlecode.com/svn/trunk/Freestyle/Tools/Generic/xboxtools.cpp
SHIM_CALL XamUserReadProfileSettings_shim( SHIM_CALL XamUserReadProfileSettings_shim(
PPCContext* ppc_state, KernelState* state) { PPCContext* ppc_state, KernelState* state) {
@ -125,5 +139,6 @@ void xe::kernel::xam::RegisterUserExports(
ExportResolver* export_resolver, KernelState* state) { ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamUserGetXUID, state); SHIM_SET_MAPPING("xam.xex", XamUserGetXUID, state);
SHIM_SET_MAPPING("xam.xex", XamUserGetSigninState, state); SHIM_SET_MAPPING("xam.xex", XamUserGetSigninState, state);
SHIM_SET_MAPPING("xam.xex", XamUserGetSigninInfo, state);
SHIM_SET_MAPPING("xam.xex", XamUserReadProfileSettings, state); SHIM_SET_MAPPING("xam.xex", XamUserReadProfileSettings, state);
} }

View File

@ -656,6 +656,33 @@ SHIM_CALL NtClearEvent_shim(
} }
SHIM_CALL NtCreateSemaphore_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t handle_ptr = SHIM_GET_ARG_32(0);
uint32_t obj_attributes_ptr = SHIM_GET_ARG_32(1);
int32_t count = SHIM_GET_ARG_32(2);
int32_t limit = SHIM_GET_ARG_32(3);
XELOGD(
"NtCreateSemaphore(%.8X, %.8X, %d, %d)",
handle_ptr, obj_attributes_ptr, count, limit);
XSemaphore* sem = new XSemaphore(state);
sem->Initialize(count, limit);
// obj_attributes may have a name inside of it, if != NULL.
if (obj_attributes_ptr) {
//sem->SetName(...);
}
if (handle_ptr) {
SHIM_SET_MEM_32(handle_ptr, sem->handle());
}
SHIM_SET_RETURN(X_STATUS_SUCCESS);
}
void xeKeInitializeSemaphore( void xeKeInitializeSemaphore(
void* semaphore_ptr, int32_t count, int32_t limit) { void* semaphore_ptr, int32_t count, int32_t limit) {
KernelState* state = shared_kernel_state_; KernelState* state = shared_kernel_state_;
@ -896,6 +923,7 @@ void xe::kernel::xboxkrnl::RegisterThreadingExports(
SHIM_SET_MAPPING("xboxkrnl.exe", KeResetEvent, state); SHIM_SET_MAPPING("xboxkrnl.exe", KeResetEvent, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtClearEvent, state); SHIM_SET_MAPPING("xboxkrnl.exe", NtClearEvent, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtCreateSemaphore, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeInitializeSemaphore, state); SHIM_SET_MAPPING("xboxkrnl.exe", KeInitializeSemaphore, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeReleaseSemaphore, state); SHIM_SET_MAPPING("xboxkrnl.exe", KeReleaseSemaphore, state);

View File

@ -53,15 +53,18 @@ typedef uint32_t X_STATUS;
// HRESULT (ERROR_*) // HRESULT (ERROR_*)
// Adding as needed. // Adding as needed.
typedef uint32_t X_RESULT; typedef uint32_t X_RESULT;
#define X_ERROR_SUCCESS ((uint32_t)0x00000000L) #define X_FACILITY_WIN32 7
#define X_ERROR_ACCESS_DENIED ((uint32_t)0x00000005L) #define X_HRESULT_FROM_WIN32(x) ((X_RESULT)(x) <= 0 ? ((X_RESULT)(x)) : ((X_RESULT) (((x) & 0x0000FFFF) | (X_FACILITY_WIN32 << 16) | 0x80000000)))
#define X_ERROR_INSUFFICIENT_BUFFER ((uint32_t)0x0000007AL) #define X_ERROR_SUCCESS X_HRESULT_FROM_WIN32(0x00000000L)
#define X_ERROR_BAD_ARGUMENTS ((uint32_t)0x000000A0L) #define X_ERROR_ACCESS_DENIED X_HRESULT_FROM_WIN32(0x00000005L)
#define X_ERROR_BUSY ((uint32_t)0x000000AAL) #define X_ERROR_INSUFFICIENT_BUFFER X_HRESULT_FROM_WIN32(0x0000007AL)
#define X_ERROR_DEVICE_NOT_CONNECTED ((uint32_t)0x0000048FL) #define X_ERROR_BAD_ARGUMENTS X_HRESULT_FROM_WIN32(0x000000A0L)
#define X_ERROR_NOT_FOUND ((uint32_t)0x00000490L) #define X_ERROR_BUSY X_HRESULT_FROM_WIN32(0x000000AAL)
#define X_ERROR_CANCELLED ((uint32_t)0x000004C7L) #define X_ERROR_DEVICE_NOT_CONNECTED X_HRESULT_FROM_WIN32(0x0000048FL)
#define X_ERROR_EMPTY ((uint32_t)0x000010D2L) #define X_ERROR_NOT_FOUND X_HRESULT_FROM_WIN32(0x00000490L)
#define X_ERROR_CANCELLED X_HRESULT_FROM_WIN32(0x000004C7L)
#define X_ERROR_NO_SUCH_USER X_HRESULT_FROM_WIN32(0x00000525L)
#define X_ERROR_EMPTY X_HRESULT_FROM_WIN32(0x000010D2L)
// MEM_*, used by NtAllocateVirtualMemory // MEM_*, used by NtAllocateVirtualMemory
#define X_MEM_COMMIT 0x00001000 #define X_MEM_COMMIT 0x00001000