Advertisement
Guest User

Loader? by DJFender

a guest
Jun 29th, 2010
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4.  
  5. namespace ZuneBoards.DevelopmentFront.NativeAppLauncher.SD
  6. {
  7.     static class Program
  8.     {
  9.         const string SourceDirectory = @"\gametitle\584E07D1\";
  10.        const string Payload =         @"Content\nativeapp.exe";
  11.  
  12.        static void Main(string[] args)
  13.        {
  14.            Run();
  15.        }
  16.        public static void Run()
  17.        {
  18.            // launch process
  19.            Trace.Write("Launching payload");
  20.            NativeMethods.PROCESS_INFORMATION pi = new NativeMethods.PROCESS_INFORMATION();
  21.            NativeMethods.CreateProcess(Path.Combine(SourceDirectory, Payload), string.Empty, IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, IntPtr.Zero, null, ref pi);
  22.            Trace.WriteLine("...ok.");
  23.            // wait for exit
  24.            NativeMethods.WaitForSingleObject(pi.hProcess, -1);
  25.            // display exit code
  26.            int ecode;
  27.            NativeMethods.GetExitCodeProcess(pi.hProcess, out ecode);
  28.            Trace.WriteLine(string.Format("Payload exited with code {0}", ecode));
  29.            // clean up
  30.            NativeMethods.CloseHandle(pi.hThread);
  31.            NativeMethods.CloseHandle(pi.hProcess);
  32.        }
  33.    }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement