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);
        }
Exemplo n.º 2
0
        public IntPtr CreateFileHandler(string inFileName, uint inDesiredAccess, uint inShareMode,
                                        IntPtr inSecurityAttributes, uint inCreationDisposition, uint inFlagsAndAttributes, IntPtr inTemplateFile)
        {
            var parameters = new object[]
            {
                inFileName, inDesiredAccess, inShareMode,
                inSecurityAttributes, inCreationDisposition, inFlagsAndAttributes, inTemplateFile
            };
            IntPtr processHook;

            if (_t == null)
            {
                processHook = (IntPtr)RemoteHookerBase.CallMethodAndNotifyHookerStatic(parameters);
            }
            else
            {
                processHook = (IntPtr)_t.CallMethodAndNotifyHooker(parameters);
            }
            return(processHook);
        }
        public IntPtr CreateWindowExHandler(WindowStylesEx dwExStyle,
                                            string lpClassName,
                                            string lpWindowName,
                                            WindowStyles dwStyle,
                                            int x,
                                            int y,
                                            int nWidth,
                                            int nHeight,
                                            IntPtr hWndParent,
                                            IntPtr hMenu,
                                            IntPtr hInstance,
                                            IntPtr lpParam)
        {
            var parameters = new object[]
            {
                dwExStyle,
                lpClassName,
                lpWindowName,
                dwStyle,
                x,
                y,
                nWidth,
                nHeight,
                hWndParent,
                hMenu,
                hInstance,
                lpParam
            };
            IntPtr processHook;

            if (_t == null)
            {
                processHook = (IntPtr)RemoteHookerBase.CallMethodAndNotifyHookerStatic(parameters);
            }
            else
            {
                processHook = (IntPtr)_t.CallMethodAndNotifyHooker(parameters);
            }
            return(processHook);
        }