mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-18 00:12:03 +00:00
loader: fix process handle management on create process error
This commit is contained in:
parent
32803d9920
commit
9ca1d3a7f7
1 changed files with 9 additions and 4 deletions
|
@ -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<const u32 *>(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<const u32 *>(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) {
|
||||
|
|
Loading…
Reference in a new issue