Ejemplo n.º 1
0
        // Token: 0x06000317 RID: 791 RVA: 0x0000F43C File Offset: 0x0000D63C
        private static HookResult HookGlobal(int hookId, Callback callback)
        {
            HookProcedure       hookProcedure       = (int code, IntPtr param, IntPtr lParam) => HookHelper.HookProcedure(code, param, lParam, callback);
            HookProcedureHandle hookProcedureHandle = HookNativeMethods.SetWindowsHookEx(hookId, hookProcedure, Process.GetCurrentProcess().MainModule.BaseAddress, 0);

            if (hookProcedureHandle.IsInvalid)
            {
                HookHelper.ThrowLastUnmanagedErrorAsException();
            }
            return(new HookResult(hookProcedureHandle, hookProcedure));
        }
Ejemplo n.º 2
0
        // Token: 0x06000316 RID: 790 RVA: 0x0000F3EC File Offset: 0x0000D5EC
        private static HookResult HookApp(int hookId, Callback callback)
        {
            HookProcedure       hookProcedure       = (int code, IntPtr param, IntPtr lParam) => HookHelper.HookProcedure(code, param, lParam, callback);
            HookProcedureHandle hookProcedureHandle = HookNativeMethods.SetWindowsHookEx(hookId, hookProcedure, IntPtr.Zero, ThreadNativeMethods.GetCurrentThreadId());

            if (hookProcedureHandle.IsInvalid)
            {
                HookHelper.ThrowLastUnmanagedErrorAsException();
            }
            return(new HookResult(hookProcedureHandle, hookProcedure));
        }