Пример #1
0
        internal NtProcessCreateResult(NtStatus status,
                                       ProcessCreateInfoData create_info, ProcessCreateState create_state) : this(status) {
            switch (create_state)
            {
            case ProcessCreateState.FailOnSectionCreate:
                if (create_info.FileHandle != IntPtr.Zero)
                {
                    ImageFile = NtFile.FromHandle(create_info.FileHandle).Duplicate();
                }
                break;

            case ProcessCreateState.FailExeName:
                if (create_info.IFEOKey != IntPtr.Zero)
                {
                    IFEOKeyHandle = NtKey.FromHandle(create_info.IFEOKey).Duplicate();
                }
                break;

            case ProcessCreateState.FailExeFormat:
                DllCharacteristics = (DllCharacteristics)create_info.DllCharacteristics;
                break;
            }

            Status        = status;
            CreateState   = create_state;
            Process       = null;
            Thread        = null;
            SectionHandle = null;
        }
 internal CreateUserProcessResult(SafeKernelObjectHandle process_handle, SafeKernelObjectHandle thread_handle,
                                  ProcessCreateInfoData create_info,
                                  SectionImageInformation image_info, ClientId client_id)
 {
     Process       = new NtProcess(process_handle);
     Thread        = new NtThread(thread_handle);
     ImageFile     = new NtFile(new SafeKernelObjectHandle(create_info.Success.FileHandle, true));
     SectionHandle = new NtSection(new SafeKernelObjectHandle(create_info.Success.SectionHandle, true));
     ImageInfo     = image_info;
     ClientId      = client_id;
     CreateInfo    = create_info;
     CreateState   = ProcessCreateState.Success;
 }
        internal CreateUserProcessResult(NtStatus status, ProcessCreateInfoData create_info, ProcessCreateState create_state)
        {
            ImageFile = null;
            if (create_state == ProcessCreateState.FailOnSectionCreate)
            {
                ImageFile = new NtFile(new SafeKernelObjectHandle(create_info.FileHandle, true));
            }
            else if (create_state == ProcessCreateState.FailExeName)
            {
                IFEOKeyHandle = RegistryKey.FromHandle(new SafeRegistryHandle(create_info.IFEOKey, true));
            }
            Status      = status;
            CreateInfo  = create_info;
            CreateState = create_state;

            Process       = null;
            Thread        = null;
            SectionHandle = null;
            ImageInfo     = new SectionImageInformation();
            ClientId      = new ClientId();
        }
 public ProcessCreateInfo()
 {
     Size  = new IntPtr(Marshal.SizeOf(this));
     State = ProcessCreateState.InitialState;
 }
        internal CreateUserProcessResult(NtStatus status, ProcessCreateInfoData create_info, ProcessCreateState create_state)
        {
            ImageFile = null;
            if (create_state == ProcessCreateState.FailOnSectionCreate)
            {
                ImageFile = new NtFile(new SafeKernelObjectHandle(create_info.FileHandle, true));
            }
            else if (create_state == ProcessCreateState.FailExeName)
            {
                IFEOKeyHandle = RegistryKey.FromHandle(new SafeRegistryHandle(create_info.IFEOKey, true));
            }
            Status = status;
            CreateInfo = create_info;
            CreateState = create_state;

            Process = null;
            Thread = null;
            SectionHandle = null;
            ImageInfo = new SectionImageInformation();
            ClientId = new ClientId();
        }
 internal CreateUserProcessResult(SafeKernelObjectHandle process_handle, SafeKernelObjectHandle thread_handle,
   ProcessCreateInfoData create_info,
   SectionImageInformation image_info, ClientId client_id)
 {
     Process = new NtProcess(process_handle);
     Thread = new NtThread(thread_handle);
     ImageFile = new NtFile(new SafeKernelObjectHandle(create_info.Success.FileHandle, true));
     SectionHandle = new NtSection(new SafeKernelObjectHandle(create_info.Success.SectionHandle, true));
     ImageInfo = image_info;
     ClientId = client_id;
     CreateInfo = create_info;
     CreateState = ProcessCreateState.Success;
 }