Esempio n. 1
0
        private void Menu_Hook_Enable(object sender, EventArgs e)
        {
            String stubPath = System.IO.Path.Combine(VoodooSharp.GlobalRegistry.Instance.BinPath, "Voodoo_HookStub.dll");

            m_NativeModule = LoadLibrary(stubPath);
            if (m_NativeModule != IntPtr.Zero)
            {
                m_InstallFunc = (InstallGlobalHook)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_NativeModule, "InstallGlobalHook"), typeof(InstallGlobalHook));
                m_RemoveFunc  = (RemoveGlobalHook)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_NativeModule, "RemoveGlobalHook"), typeof(RemoveGlobalHook));
            }
            else
            {
                MessageBox.Show("Unable to load hook stub from:\n" + stubPath, "Hook Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (m_InstallFunc != null)
            {
                m_GlobalHook = m_InstallFunc();
                if (m_GlobalHook != IntPtr.Zero)
                {
                    cMenu_Hook_Off.Visible = false;
                    cMenu_Hook_On.Visible  = true;
                }
            }
            else
            {
                cMenu_Hook_Off.Visible = true;
                cMenu_Hook_On.Visible  = false;
            }
        }
Esempio n. 2
0
        private void Menu_Hook_Enable(object sender, EventArgs e)
        {
            String stubPath = System.IO.Path.Combine(VoodooSharp.GlobalRegistry.Instance.BinPath, "Voodoo_HookStub.dll");
            m_NativeModule = LoadLibrary(stubPath);
            if (m_NativeModule != IntPtr.Zero)
            {
                m_InstallFunc = (InstallGlobalHook)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_NativeModule, "InstallGlobalHook"), typeof(InstallGlobalHook));
                m_RemoveFunc = (RemoveGlobalHook)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_NativeModule, "RemoveGlobalHook"), typeof(RemoveGlobalHook));
            }
            else
            {
                MessageBox.Show("Unable to load hook stub from:\n" + stubPath, "Hook Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (m_InstallFunc != null)
            {
                m_GlobalHook = m_InstallFunc();
                if (m_GlobalHook != IntPtr.Zero)
                {
                    cMenu_Hook_Off.Visible = false;
                    cMenu_Hook_On.Visible = true;
                }
            }
            else
            {
                cMenu_Hook_Off.Visible = true;
                cMenu_Hook_On.Visible = false;
            }
        }