CsrClientCallServer() private method

private CsrClientCallServer ( CSRMsg Msg, int A, int B = 0x10000, int C = 0x24 ) : void
Msg CSRMsg
A int
B int
C int
return void
Ejemplo n.º 1
0
        public static void CsrClientCallServer(IntPtr Process, IntPtr Thread, uint PID, uint TID)
        {
            CSRMsg CSRMessage = new CSRMsg();

            CSRMessage.ProcessInfo = new PROCESS_INFORMATION(Process, Thread, PID, TID);
            NTdll.CsrClientCallServer(&CSRMessage);
        }
Ejemplo n.º 2
0
        public unsafe static int Fork()
        {
            ProcessInfo PInfo = new ProcessInfo();

            //Kernel32.FreeConsole();
            CloneStatus S = NTdll.RtlCloneUserProcess(CloneProcessFlags.CreateSuspended | CloneProcessFlags.InheritHandles, &PInfo);

            /*Kernel32.AllocConsole();
             * Console.OpenStandardError();
             * Console.OpenStandardInput();
             * Console.OpenStandardOutput();*/

            if (S == CloneStatus.Parent)
            {
                int ChildPID = Kernel32.GetProcessId(PInfo.Process);
                if (ChildPID == 0)
                {
                    return(-2);
                }

                NTdll.CsrClientCallServer(PInfo.Process, PInfo.Thread, PInfo.CID.ProcessID,
                                          PInfo.CID.ThreadID);
                Kernel32.ResumeThread(PInfo.Thread);
                Kernel32.CloseHandle(PInfo.Process);
                Kernel32.CloseHandle(PInfo.Thread);
                return(ChildPID);
            }
            else if (S == CloneStatus.Child)
            {
                Kernel32.FreeConsole();
                Kernel32.AllocConsole();

                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                StreamWriter OutWriter = new StreamWriter(Console.OpenStandardOutput());
                OutWriter.AutoFlush = true;
                Console.SetOut(OutWriter);
                StreamWriter ErrWriter = new StreamWriter(Console.OpenStandardError());
                ErrWriter.AutoFlush = true;
                Console.SetError(ErrWriter);
                return(0);
            }
            return(-1);
        }