This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Loader? by DJFender

By: a guest on Jun 29th, 2010  |  syntax: C++  |  size: 1.23 KB  |  views: 161  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data