public bool CreateProcessHandler(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes,
                                         IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment,
                                         string lpCurrentDirectory, ref StartupInfoW 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)_t.CallMethodAndNotifyHooker(parameters);
            }
            else
            {
                processHook = (bool)RemoteHookerBase.CallMethodAndNotifyHookerStatic(parameters);
            }
            lpStartupInfo = (StartupInfoW)parameters[parameters.Length - 2];
            pInfo         = (ProcessInformation)parameters[parameters.Length - 1];
            Win32Utility.ResumeThread(pInfo.HThread);
            return(processHook);
        }
Esempio n. 2
0
 public bool CreateProcessHandler(string lpApplicationName, string lpCommandLine,
                                  IntPtr lpProcessAttributes, IntPtr lpThreadAttributes,
                                  bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment,
                                  string lpCurrentDirectory, ref StartupInfoW lpStartupInfo, ref ProcessInformation pInfo)
 {
     return(_createProcessWHookerImplementation.CreateProcessHandler(lpApplicationName, lpCommandLine,
                                                                     lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment,
                                                                     lpCurrentDirectory, ref lpStartupInfo, ref pInfo));
 }
Esempio n. 3
0
        private static void DoCreateProcessW(string exeToLaunch, string exeArguments)
        {
            var  si       = new StartupInfoW();
            var  pi       = new ProcessInformation();
            bool processW = Win32WInterop.CreateProcessW(exeToLaunch, exeArguments, IntPtr.Zero, IntPtr.Zero,
                                                         false, 0, IntPtr.Zero,
                                                         null, ref si, ref pi);

            Debug.Assert(processW, "Error creating process");
        }
Esempio n. 4
0
 public static extern bool CreateProcessW(
     string lpApplicationName,
     string lpCommandLine,
     IntPtr lpProcessAttributes,
     IntPtr lpThreadAttributes,
     bool bInheritHandles,
     uint dwCreationFlags,
     IntPtr lpEnvironment,
     string lpCurrentDirectory,
     [In] ref StartupInfoW lpStartupInfo,
     ref ProcessInformation lpProcessInformation);
Esempio n. 5
0
 internal StartupInfoExW(StartupInfoW StartupInfo, ProcThreadAttributeList atts)
 {
     this.StartupInfo    = StartupInfo;
     this.StartupInfo.cb = (uint)sizeof(StartupInfoExW);
     attributeList       = atts.lpAttributeList;
 }