Example #1
0
        private static void DoCreateProcessA()
        {
            var si = new StartupInfoA();
            var pi = new ProcessInformation();

            Win32Interop.CreateProcessA("c:\\windows\\system32\\Notepad.exe", "", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero,
                                        null, ref si, ref pi);
        }
 public bool CreateProcessHandler(string lpApplicationName, string lpCommandLine,
                                  IntPtr lpProcessAttributes, IntPtr lpThreadAttributes,
                                  bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment,
                                  string lpCurrentDirectory, ref StartupInfoA lpStartupInfo, ref ProcessInformation pInfo)
 {
     return(_createProcessAHookerImplementation.CreateProcessHandler(lpApplicationName, lpCommandLine,
                                                                     lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment,
                                                                     lpCurrentDirectory, ref lpStartupInfo, ref pInfo));
 }
Example #3
0
 public static extern bool CreateProcessA(
     string lpApplicationName,
     string lpCommandLine,
     IntPtr lpProcessAttributes,
     IntPtr lpThreadAttributes,
     bool bInheritHandles,
     uint dwCreationFlags,
     IntPtr lpEnvironment,
     string lpCurrentDirectory,
     [In] ref StartupInfoA lpStartupInfo,
     ref ProcessInformation lpProcessInformation);
        public bool CreateProcessHandler(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes,
                                         IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment,
                                         string lpCurrentDirectory, ref StartupInfoA lpStartupInfo, ref ProcessInformation pInfo)
        {
            var processHook = false;
            var parameters  = new object[]
            {
                lpApplicationName, lpCommandLine, lpProcessAttributes,
                lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo,
                pInfo
            };

            if (_t == null)
            {
                processHook = (bool)RemoteHookerBase.CallMethodAndNotifyHookerStatic(parameters);
            }
            else
            {
                processHook = (bool)_t.CallMethodAndNotifyHooker(parameters);
            }
            lpStartupInfo = (StartupInfoA)parameters[parameters.Length - 2];
            pInfo         = (ProcessInformation)parameters[parameters.Length - 1];
            return(processHook);
        }