[Kernel] Fix return of XamUserGetXUID and XamUserGetSigninInfo.

This commit is contained in:
gibbed 2018-05-27 19:43:05 -05:00
parent da06cb4f06
commit 73c7546114
2 changed files with 17 additions and 15 deletions

View File

@ -21,16 +21,16 @@ namespace xe {
namespace kernel { namespace kernel {
namespace xam { namespace xam {
dword_result_t XamUserGetXUID(dword_t user_index, dword_t unk, X_HRESULT_result_t XamUserGetXUID(dword_t user_index, dword_t unk,
lpqword_t xuid_ptr) { lpqword_t xuid_ptr) {
if (user_index) { if (user_index) {
return X_ERROR_NO_SUCH_USER; return X_E_NO_SUCH_USER;
} }
const auto& user_profile = kernel_state()->user_profile(); const auto& user_profile = kernel_state()->user_profile();
if (xuid_ptr) { if (xuid_ptr) {
*xuid_ptr = user_profile->xuid(); *xuid_ptr = user_profile->xuid();
} }
return X_ERROR_SUCCESS; return X_E_SUCCESS;
} }
DECLARE_XAM_EXPORT(XamUserGetXUID, DECLARE_XAM_EXPORT(XamUserGetXUID,
ExportTag::kUserProfiles | ExportTag::kImplemented); ExportTag::kUserProfiles | ExportTag::kImplemented);
@ -63,22 +63,22 @@ typedef struct {
} X_USER_SIGNIN_INFO; } X_USER_SIGNIN_INFO;
static_assert_size(X_USER_SIGNIN_INFO, 40); static_assert_size(X_USER_SIGNIN_INFO, 40);
dword_result_t XamUserGetSigninInfo(dword_t user_index, dword_t flags, X_HRESULT_result_t XamUserGetSigninInfo(dword_t user_index, dword_t flags,
pointer_t<X_USER_SIGNIN_INFO> info) { pointer_t<X_USER_SIGNIN_INFO> info) {
if (!info) { if (!info) {
return X_ERROR_INVALID_PARAMETER; return X_E_INVALIDARG;
} }
std::memset(info, 0, sizeof(X_USER_SIGNIN_INFO)); std::memset(info, 0, sizeof(X_USER_SIGNIN_INFO));
if (user_index == 0) { if (user_index) {
return X_E_NO_SUCH_USER;
}
const auto& user_profile = kernel_state()->user_profile(); const auto& user_profile = kernel_state()->user_profile();
info->xuid = user_profile->xuid(); info->xuid = user_profile->xuid();
info->signin_state = user_profile->signin_state(); info->signin_state = user_profile->signin_state();
std::strncpy(info->name, user_profile->name().data(), 15); std::strncpy(info->name, user_profile->name().data(), 15);
return X_ERROR_SUCCESS; return X_E_SUCCESS;
} else {
return X_ERROR_NO_SUCH_USER;
}
} }
DECLARE_XAM_EXPORT(XamUserGetSigninInfo, DECLARE_XAM_EXPORT(XamUserGetSigninInfo,
ExportTag::kUserProfiles | ExportTag::kImplemented); ExportTag::kUserProfiles | ExportTag::kImplemented);

View File

@ -110,6 +110,8 @@ typedef uint32_t X_HRESULT;
#define X_E_FALSE static_cast<X_HRESULT>(0x80000000L) #define X_E_FALSE static_cast<X_HRESULT>(0x80000000L)
#define X_E_SUCCESS X_HRESULT_FROM_WIN32(X_ERROR_SUCCESS) #define X_E_SUCCESS X_HRESULT_FROM_WIN32(X_ERROR_SUCCESS)
#define X_E_INVALIDARG X_HRESULT_FROM_WIN32(X_ERROR_INVALID_PARAMETER) #define X_E_INVALIDARG X_HRESULT_FROM_WIN32(X_ERROR_INVALID_PARAMETER)
#define X_E_DEVICE_NOT_CONNECTED X_HRESULT_FROM_WIN32(X_ERROR_DEVICE_NOT_CONNECTED)
#define X_E_NO_SUCH_USER X_HRESULT_FROM_WIN32(X_ERROR_NO_SUCH_USER)
// MEM_*, used by NtAllocateVirtualMemory // MEM_*, used by NtAllocateVirtualMemory
#define X_MEM_COMMIT 0x00001000 #define X_MEM_COMMIT 0x00001000