Beispiel #1
0
        public Win32API.ProcessReturnCode CreateProcess(string CommandLine, out UInt32 ProcessId)
        {
            ProcessId = 0;
            string[] parms = new string[] { CommandLine, null, null, ProcessId.ToString() };
            object   prd   = _win_process.InvokeMethod("Create", parms);

            ProcessId = UInt32.Parse(parms[3]);
            Win32API.ProcessReturnCode p_out = (Win32API.ProcessReturnCode) int.Parse(prd.ToString());

            return(p_out);
        }
Beispiel #2
0
        public static Win32API.ProcessReturnCode StartProcess(string remotemachine, string commandline)
        {
            WmiAccess acc = new WmiAccess("Win32_Process", remotemachine);

            System.Management.ManagementBaseObject inParams = acc.WMI_Class_Instance.GetMethodParameters("Create");
            inParams["CommandLine"] = commandline;
            System.Management.ManagementBaseObject rt = acc.WMI_Class_Instance.InvokeMethod("Create", inParams, null);

            Win32API.ProcessReturnCode p_out = (Win32API.ProcessReturnCode) int.Parse(rt["ReturnValue"].ToString());
            return(p_out);
        }