Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- using System.IO;
- namespace ZuneBoards.DevelopmentFront.NativeAppLauncher.SD
- {
- static class Program
- {
- const string SourceDirectory = @"\gametitle\584E07D1\";
- const string Payload = @"Content\nativeapp.exe";
- static void Main(string[] args)
- {
- Run();
- }
- public static void Run()
- {
- // launch process
- Trace.Write("Launching payload");
- NativeMethods.PROCESS_INFORMATION pi = new NativeMethods.PROCESS_INFORMATION();
- NativeMethods.CreateProcess(Path.Combine(SourceDirectory, Payload), string.Empty, IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, IntPtr.Zero, null, ref pi);
- Trace.WriteLine("...ok.");
- // wait for exit
- NativeMethods.WaitForSingleObject(pi.hProcess, -1);
- // display exit code
- int ecode;
- NativeMethods.GetExitCodeProcess(pi.hProcess, out ecode);
- Trace.WriteLine(string.Format("Payload exited with code {0}", ecode));
- // clean up
- NativeMethods.CloseHandle(pi.hThread);
- NativeMethods.CloseHandle(pi.hProcess);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement