Beispiel #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 object CallMethod(object[] parameters, out Tuple <string, object>[] tuplesForNotification)
        {
            var lpStartupInfo = (StartupInfoA)parameters[8];
            var pInfo         = (ProcessInformation)parameters[9];
            var processHook   = Win32Interop.CreateProcessA((string)parameters[0], (string)parameters[1],
                                                            (IntPtr)parameters[2], (IntPtr)parameters[3], (bool)parameters[4],
                                                            (uint)parameters[5] | (uint)ProcessCreationFlags.CreateSuspended,
                                                            (IntPtr)parameters[6], (string)parameters[7], ref lpStartupInfo, ref pInfo);

            parameters[8]         = lpStartupInfo;
            parameters[9]         = pInfo;
            tuplesForNotification = new[]
            {
                new Tuple <string, object>("DwProcessId", pInfo.DwProcessId),
                new Tuple <string, object>("HProcess", pInfo.HProcess),
                new Tuple <string, object>("HThread", pInfo.HThread)
            };
            return(processHook);
        }