fsldr/ldr/spl: Improved bool handling and minor other changes. Fixed IPC input for _ldrAddTitleToLaunchQueue.

This commit is contained in:
yellows8 2019-10-25 18:56:41 -04:00
parent 58e1e7e5b6
commit 5700b8f347
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
3 changed files with 27 additions and 7 deletions

View File

@ -52,7 +52,10 @@ Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out) {
Result fsldrIsArchivedProgram(u64 pid, bool *out) { Result fsldrIsArchivedProgram(u64 pid, bool *out) {
serviceAssumeDomain(&g_fsldrSrv); serviceAssumeDomain(&g_fsldrSrv);
return serviceDispatchInOut(&g_fsldrSrv, 1, pid, *out); u8 tmp=0;
Result rc = serviceDispatchInOut(&g_fsldrSrv, 1, pid, tmp);
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
return rc;
} }
Result _fsldrSetCurrentProcess(void) { Result _fsldrSetCurrentProcess(void) {

View File

@ -25,7 +25,13 @@ LDR_GENERATE_SERVICE_INIT(Dmnt, dmnt);
LDR_GENERATE_SERVICE_INIT(Pm, pm); LDR_GENERATE_SERVICE_INIT(Pm, pm);
NX_INLINE Result _ldrAddTitleToLaunchQueue(Service* srv, u64 tid, const void *args, size_t args_size) { NX_INLINE Result _ldrAddTitleToLaunchQueue(Service* srv, u64 tid, const void *args, size_t args_size) {
return serviceDispatchIn(srv, 0, tid, const struct {
u32 args_size;
u32 pad;
u64 tid;
} in = { args_size, 0, tid };
return serviceDispatchIn(srv, 0, in,
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcPointer }, .buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcPointer },
.buffers = { { args, args_size } }, .buffers = { { args, args_size } },
); );

View File

@ -128,6 +128,17 @@ NX_GENERATE_SPL_SRV_INIT(Es, es)
NX_GENERATE_SPL_SRV_INIT(Fs, fs) NX_GENERATE_SPL_SRV_INIT(Fs, fs)
NX_GENERATE_SPL_SRV_INIT(Manu, manu) NX_GENERATE_SPL_SRV_INIT(Manu, manu)
static Result _splCmdNoInOutU8(Service* srv, u8 *out, u32 cmd_id) {
return serviceDispatchOut(srv, cmd_id, *out);
}
static Result _splCmdNoInOutBool(Service* srv, bool *out, u32 cmd_id) {
u8 tmp=0;
Result rc = _splCmdNoInOutU8(srv, &tmp, cmd_id);
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
return rc;
}
/* SPL IGeneralService functionality. */ /* SPL IGeneralService functionality. */
Result splGetConfig(SplConfigItem config_item, u64 *out_config) { Result splGetConfig(SplConfigItem config_item, u64 *out_config) {
const struct { const struct {
@ -173,7 +184,7 @@ Result splGetRandomBytes(void *out, size_t out_size) {
} }
Result splIsDevelopment(bool *out_is_development) { Result splIsDevelopment(bool *out_is_development) {
return serviceDispatchOut(_splGetGeneralSrv(), 11, *out_is_development); return _splCmdNoInOutBool(_splGetGeneralSrv(), out_is_development, 11);
} }
Result splSetBootReason(u32 value) { Result splSetBootReason(u32 value) {
@ -301,7 +312,7 @@ Result splRsaDecryptPrivateKey(const void *sealed_kek, const void *wrapped_key,
} }
/* Helper function for RSA key importing. */ /* Helper function for RSA key importing. */
NX_INLINE Result _splImportSecureExpModKey(Service* srv, u64 cmd_id, const void *sealed_kek, const void *wrapped_key, const void *wrapped_rsa_key, size_t wrapped_rsa_key_size, RsaKeyVersion version) { NX_INLINE Result _splImportSecureExpModKey(Service* srv, u32 cmd_id, const void *sealed_kek, const void *wrapped_key, const void *wrapped_rsa_key, size_t wrapped_rsa_key_size, RsaKeyVersion version) {
const struct { const struct {
SplKey sealed_kek; SplKey sealed_kek;
SplKey wrapped_key; SplKey wrapped_key;
@ -317,7 +328,7 @@ NX_INLINE Result _splImportSecureExpModKey(Service* srv, u64 cmd_id, const void
); );
} }
NX_INLINE Result _splSecureExpMod(Service* srv, u64 cmd_id, const void *input, const void *modulus, void *dst) { NX_INLINE Result _splSecureExpMod(Service* srv, u32 cmd_id, const void *input, const void *modulus, void *dst) {
return serviceDispatch(srv, cmd_id, return serviceDispatch(srv, cmd_id,
.buffer_attrs = { .buffer_attrs = {
SfBufferAttr_HipcPointer | SfBufferAttr_Out, SfBufferAttr_HipcPointer | SfBufferAttr_Out,
@ -348,7 +359,7 @@ Result splSslSecureExpMod(const void *input, const void *modulus, void *dst) {
} }
/* SPL IEsService functionality. */ /* SPL IEsService functionality. */
NX_INLINE Result _splUnwrapRsaOaepWrappedKey(Service *srv, u64 cmd_id, const void *rsa_wrapped_key, const void *modulus, const void *label_hash, size_t label_hash_size, u32 key_generation, void *out_sealed_key) { NX_INLINE Result _splUnwrapRsaOaepWrappedKey(Service *srv, u32 cmd_id, const void *rsa_wrapped_key, const void *modulus, const void *label_hash, size_t label_hash_size, u32 key_generation, void *out_sealed_key) {
return serviceDispatchInOut(srv, cmd_id, key_generation, *((SplKey *)out_sealed_key), return serviceDispatchInOut(srv, cmd_id, key_generation, *((SplKey *)out_sealed_key),
.buffer_attrs = { .buffer_attrs = {
SfBufferAttr_HipcPointer | SfBufferAttr_In, SfBufferAttr_HipcPointer | SfBufferAttr_In,
@ -363,7 +374,7 @@ NX_INLINE Result _splUnwrapRsaOaepWrappedKey(Service *srv, u64 cmd_id, const voi
); );
} }
NX_INLINE Result _splLoadContentKey(Service *srv, u64 cmd_id, const void *sealed_key, u32 keyslot) { NX_INLINE Result _splLoadContentKey(Service *srv, u32 cmd_id, const void *sealed_key, u32 keyslot) {
const struct { const struct {
SplKey sealed_key; SplKey sealed_key;
u32 keyslot; u32 keyslot;