diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index 2ca46a53d..844e19651 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -464,13 +464,18 @@ namespace ams::ldr { Result CreateProcessImpl(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const bool *has_nso, const args::ArgumentInfo *arg_info, u32 flags, Handle reslimit_h) { /* Get CreateProcessParameter. */ svc::CreateProcessParameter param; - R_TRY(GetCreateProcessParameter(¶m, meta, flags, reslimit_h)); + R_TRY(GetCreateProcessParameter(std::addressof(param), meta, flags, reslimit_h)); /* Decide on an NSO layout. */ - R_TRY(DecideAddressSpaceLayout(out, ¶m, nso_headers, has_nso, arg_info)); + R_TRY(DecideAddressSpaceLayout(out, std::addressof(param), nso_headers, has_nso, arg_info)); - /* Actually create process. const_cast necessary because libnx doesn't declare svcCreateProcess with const u32*. */ - return svcCreateProcess(out->process_handle.GetPointer(), ¶m, reinterpret_cast(meta->aci_kac), meta->aci->kac_size / sizeof(u32)); + /* Actually create process. */ + Handle process_handle; + R_TRY(svc::CreateProcess(std::addressof(process_handle), std::addressof(param), static_cast(meta->aci_kac), meta->aci->kac_size / sizeof(u32))); + + /* Set the output handle. */ + *out->process_handle.GetPointer() = process_handle; + return ResultSuccess(); } Result LoadNsoSegment(fs::FileHandle file, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) {