Esempio n. 1
0
        private static IntPtr smethod_0(int int_0, IntPtr intptr_1, IntPtr intptr_2)
        {
            bool flag = true;

            if (int_0 >= 0)
            {
                int num;
                if ((intptr_1 == ((IntPtr)0x100)) || (intptr_1 == ((IntPtr)260)))
                {
                    num = Marshal.ReadInt32(intptr_2);
                    if ((num == 0xa2) || (num == 0xa3))
                    {
                        Control = true;
                    }
                    else if ((num == 160) || (num == 0xa1))
                    {
                        Shift = true;
                    }
                    else if ((num == 0xa5) || (num == 0xa4))
                    {
                        Alt = true;
                    }
                    else if ((num == 0x5c) || (num == 0x5b))
                    {
                        Win = true;
                    }
                    else
                    {
                        flag = smethod_1((Keys)num);
                    }
                }
                else if ((intptr_1 == ((IntPtr)0x101)) || (intptr_1 == ((IntPtr)0x105)))
                {
                    num = Marshal.ReadInt32(intptr_2);
                    switch (num)
                    {
                    case 0xa2:
                    case 0xa3:
                        Control = false;
                        goto Label_0186;

                    case 160:
                    case 0xa1:
                        Shift = false;
                        goto Label_0186;
                    }
                    if ((num == 0xa5) || (num == 0xa4))
                    {
                        Alt = false;
                    }
                    else if ((num == 0x5c) || (num == 0x5b))
                    {
                        Win = false;
                    }
                    else
                    {
                        flag = smethod_2((Keys)num);
                    }
                }
            }
Label_0186:
            return(flag ? Hooks.CallNextHookEx(intptr_0, int_0, intptr_1, intptr_2) : new IntPtr(1));
        }
Esempio n. 2
0
        private static IntPtr Filter(int nCode, IntPtr wParam, IntPtr lParam)
        {
            bool result = true;

            if (nCode >= 0)
            {
                if (wParam == (IntPtr)Hooks.WM_KEYDOWN ||
                    wParam == (IntPtr)Hooks.WM_SYSKEYDOWN)
                {
                    int vkCode = Marshal.ReadInt32(lParam);
                    if ((Keys)vkCode == Keys.LControlKey ||
                        (Keys)vkCode == Keys.RControlKey)
                    {
                        Control = true;
                    }
                    else if ((Keys)vkCode == Keys.LShiftKey ||
                             (Keys)vkCode == Keys.RShiftKey)
                    {
                        Shift = true;
                    }
                    else if ((Keys)vkCode == Keys.RMenu ||
                             (Keys)vkCode == Keys.LMenu)
                    {
                        Alt = true;
                    }
                    else if ((Keys)vkCode == Keys.RWin ||
                             (Keys)vkCode == Keys.LWin)
                    {
                        Win = true;
                    }
                    else
                    {
                        result = OnKeyDown((Keys)vkCode);
                    }
                }
                else if (wParam == (IntPtr)Hooks.WM_KEYUP ||
                         wParam == (IntPtr)Hooks.WM_SYSKEYUP)
                {
                    int vkCode = Marshal.ReadInt32(lParam);
                    if ((Keys)vkCode == Keys.LControlKey ||
                        (Keys)vkCode == Keys.RControlKey)
                    {
                        Control = false;
                    }
                    else if ((Keys)vkCode == Keys.LShiftKey ||
                             (Keys)vkCode == Keys.RShiftKey)
                    {
                        Shift = false;
                    }
                    else if ((Keys)vkCode == Keys.RMenu ||
                             (Keys)vkCode == Keys.LMenu)
                    {
                        Alt = false;
                    }
                    else if ((Keys)vkCode == Keys.RWin ||
                             (Keys)vkCode == Keys.LWin)
                    {
                        Win = false;
                    }
                    else
                    {
                        result = OnKeyUp((Keys)vkCode);
                    }
                }
            }

            return(result ? Hooks.CallNextHookEx(hHook, nCode, wParam, lParam) : new IntPtr(1));
        }
Esempio n. 3
0
        private static IntPtr smethod_0(int int_0, IntPtr intptr_1, IntPtr intptr_2)
        {
            bool flag = true;

            if (int_0 >= 0)
            {
                Hooks.Struct25 struct2 = (Hooks.Struct25)Marshal.PtrToStructure(intptr_2, typeof(Hooks.Struct25));
                switch (((int)intptr_1))
                {
                case 0x200:
                    flag = smethod_3(new Point(struct2.struct26_0.int_0, struct2.struct26_0.int_1));
                    break;

                case 0x201:
                    flag = smethod_1(MouseButtons.Left);
                    break;

                case 0x202:
                    flag = smethod_2(MouseButtons.Left);
                    break;

                case 0x204:
                    flag = smethod_1(MouseButtons.Right);
                    break;

                case 0x205:
                    flag = smethod_2(MouseButtons.Right);
                    break;

                case 0x207:
                    flag = smethod_1(MouseButtons.Middle);
                    break;

                case 520:
                    flag = smethod_2(MouseButtons.Middle);
                    break;

                case 0x20a:
                    flag = smethod_4((struct2.int_0 >> 0x10) & 0xffff);
                    break;

                case 0x20b:
                    if ((struct2.int_0 >> 0x10) != 1)
                    {
                        if ((struct2.int_0 >> 0x10) == 2)
                        {
                            flag = smethod_1(MouseButtons.XButton2);
                        }
                        break;
                    }
                    flag = smethod_1(MouseButtons.XButton1);
                    break;

                case 0x20c:
                    if ((struct2.int_0 >> 0x10) != 1)
                    {
                        if ((struct2.int_0 >> 0x10) == 2)
                        {
                            flag = smethod_2(MouseButtons.XButton2);
                        }
                        break;
                    }
                    flag = smethod_2(MouseButtons.XButton1);
                    break;
                }
            }
            return(flag ? Hooks.CallNextHookEx(intptr_0, int_0, intptr_1, intptr_2) : new IntPtr(1));
        }
        private static IntPtr Filter(int nCode, IntPtr wParam, IntPtr lParam)
        {
            bool result = true;

            if (nCode >= 0)
            {
                Hooks.MouseHookStruct info = (Hooks.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Hooks.MouseHookStruct));
                switch ((int)wParam)
                {
                case Hooks.WM_LBUTTONDOWN:
                    result = OnMouseDown(MouseButtons.Left);
                    break;

                case Hooks.WM_LBUTTONUP:
                    result = OnMouseUp(MouseButtons.Left);
                    break;

                case Hooks.WM_RBUTTONDOWN:
                    result = OnMouseDown(MouseButtons.Right);
                    break;

                case Hooks.WM_RBUTTONUP:
                    result = OnMouseUp(MouseButtons.Right);
                    break;

                case Hooks.WM_MBUTTONDOWN:
                    result = OnMouseDown(MouseButtons.Middle);
                    break;

                case Hooks.WM_MBUTTONUP:
                    result = OnMouseUp(MouseButtons.Middle);
                    break;

                case Hooks.WM_XBUTTONDOWN:
                    if (info.Data >> 16 == Hooks.XBUTTON1)
                    {
                        result = OnMouseDown(MouseButtons.XButton1);
                    }
                    else if (info.Data >> 16 == Hooks.XBUTTON2)
                    {
                        result = OnMouseDown(MouseButtons.XButton2);
                    }
                    break;

                case Hooks.WM_XBUTTONUP:
                    if (info.Data >> 16 == Hooks.XBUTTON1)
                    {
                        result = OnMouseUp(MouseButtons.XButton1);
                    }
                    else if (info.Data >> 16 == Hooks.XBUTTON2)
                    {
                        result = OnMouseUp(MouseButtons.XButton2);
                    }
                    break;

                case Hooks.WM_MOUSEMOVE:
                    result = OnMouseMove(new Point(info.Point.X, info.Point.Y));
                    break;

                case Hooks.WM_MOUSEWHEEL:
                    result = OnMouseWheel((info.Data >> 16) & 0xffff);
                    break;
                }
            }

            return(result ? Hooks.CallNextHookEx(hHook, nCode, wParam, lParam) : new IntPtr(1));
        }