[Kernel] Deny non-zero users for some XAM exports.

This commit is contained in:
gibbed 2018-05-20 19:15:16 -05:00
parent cddfa26bae
commit 9f86868a95
1 changed files with 32 additions and 1 deletions

View File

@ -379,6 +379,16 @@ SHIM_CALL XamUserCheckPrivilege_shim(PPCContext* ppc_context,
XELOGD("XamUserCheckPrivilege(%d, %.8X, %.8X)", user_index, mask, XELOGD("XamUserCheckPrivilege(%d, %.8X, %.8X)", user_index, mask,
out_value_ptr); out_value_ptr);
if ((user_index & 0xFF) == 0xFF) {
// Always pin user to 0.
user_index = 0;
}
if (user_index) {
SHIM_SET_RETURN_32(X_ERROR_NO_SUCH_USER);
return;
}
// If we deny everything, games should hopefully not try to do stuff. // If we deny everything, games should hopefully not try to do stuff.
SHIM_SET_MEM_32(out_value_ptr, 0); SHIM_SET_MEM_32(out_value_ptr, 0);
@ -393,6 +403,16 @@ SHIM_CALL XamUserContentRestrictionGetFlags_shim(PPCContext* ppc_context,
XELOGD("XamUserContentRestrictionGetFlags(%d, %.8X)", user_index, XELOGD("XamUserContentRestrictionGetFlags(%d, %.8X)", user_index,
out_flags_ptr); out_flags_ptr);
if ((user_index & 0xFF) == 0xFF) {
// Always pin user to 0.
user_index = 0;
}
if (user_index) {
SHIM_SET_RETURN_32(X_ERROR_NO_SUCH_USER);
return;
}
// No restrictions? // No restrictions?
SHIM_SET_MEM_32(out_flags_ptr, 0); SHIM_SET_MEM_32(out_flags_ptr, 0);
@ -409,6 +429,16 @@ SHIM_CALL XamUserContentRestrictionGetRating_shim(PPCContext* ppc_context,
XELOGD("XamUserContentRestrictionGetRating(%d, %.8X, %.8X, %.8X)", user_index, XELOGD("XamUserContentRestrictionGetRating(%d, %.8X, %.8X, %.8X)", user_index,
unk1, out_unk2_ptr, out_unk3_ptr); unk1, out_unk2_ptr, out_unk3_ptr);
if ((user_index & 0xFF) == 0xFF) {
// Always pin user to 0.
user_index = 0;
}
if (user_index) {
SHIM_SET_RETURN_32(X_ERROR_NO_SUCH_USER);
return;
}
// Some games have special case paths for 3F that differ from the failure // Some games have special case paths for 3F that differ from the failure
// path, so my guess is that's 'don't care'. // path, so my guess is that's 'don't care'.
SHIM_SET_MEM_32(out_unk2_ptr, 0x3F); SHIM_SET_MEM_32(out_unk2_ptr, 0x3F);
@ -453,7 +483,8 @@ SHIM_CALL XamUserAreUsersFriends_shim(PPCContext* ppc_context,
XELOGD("XamUserAreUsersFriends(%d, %.8X, %.8X, %.8X, %.8X)", user_index, unk1, XELOGD("XamUserAreUsersFriends(%d, %.8X, %.8X, %.8X, %.8X)", user_index, unk1,
unk2, out_value_ptr, overlapped_ptr); unk2, out_value_ptr, overlapped_ptr);
if (user_index == 255) { if ((user_index & 0xFF) == 0xFF) {
// Always pin user to 0.
user_index = 0; user_index = 0;
} }