Changes

Jump to navigation Jump to search
Line 141: Line 141:     
=== LaunchProgram ===
 
=== LaunchProgram ===
This essentially supports launching a specified ProgramId with BuiltInSystem ([[NS_services|ns:dev]], [[PGL_services|pgl]] in newer versions) with the input arguments passed to [[Loader_services|ldr:shel]], etc.
+
This essentially supports launching a specified program ([[NS_services|ns:dev]], [[PGL_services|pgl]] in newer versions) with the input arguments passed to [[Loader_services|ldr:shel]], etc.
 +
 
 +
The u64 at [[#Command|payload]]+0 is the ProgramId, while the rest of the data is passed as the ldr:shel arguments buffer (size is determined from the payload size).
 +
 
 +
This first terminates the previously launched process, if the PID field is still set (TerminateProcess). Then the arguments are passed to ldr:shel (SetProgramArgument), if required FlushArguments is used then SetProgramArgument is used again. Then LaunchProgram is used with the input ProgramId and BuiltInSystem, launch_flags=0x1, and pgl_launch_flags=0x0. Then SetProgramArgument is used to clear the program arguments (empty string is passed).
 +
 
 +
Then pgl IEventObserver is used to wait on process events. When events Exited/DebugRunning occur for the launched program, TerminateProcess is used with that PID with the stored PID being cleared, then the wait loop exits. Other events result in the wait loop continuing. Event-wait timeout will result in breaking from the loop, without process-termination. The timeout in nanoseconds is 10 days.
 +
 
 +
Lastly cleanup is done, then the func returns.
    
=== GetReports ===
 
=== GetReports ===

Navigation menu