static void InstallMultiByteToWideChar()
        {
            if (Managed)
            {
                return;
            }

            dMultiByteToWideChar = new MultiByteToWideCharDelegate(MultiByteToWideCharHook);

            hMultiByteToWideChar = AutoHookCreator("kernel32.dll", "MultiByteToWideChar", dMultiByteToWideChar);

            hMultiByteToWideChar.Install();
        }
        static void InstallCreateWindowExHooks()
        {
            if (Managed)
            {
                return;
            }
            dCreateWindowExA = new CreateWindowExADelegate(CreateWindowEx);
            dCreateWindowExW = new CreateWindowExWDelegate(CreateWindowEx);

            hCreateWindowExA = AutoHookCreator("user32.dll", "CreateWindowExA", dCreateWindowExA);
            hCreateWindowExW = AutoHookCreator("user32.dll", "CreateWindowExW", dCreateWindowExW);

            hCreateWindowExA.Install();
            hCreateWindowExW.Install();
        }
        static void InstallCreateWindowHooks()
        {
            if (Managed)
            {
                return;
            }
            dCreateWindowA = new CreateWindowADelegate(CreateWindow);
            dCreateWindowW = new CreateWindowWDelegate(CreateWindow);

            hCreateWindowA = AutoHookCreator("user32.dll", "CreateWindowA", dCreateWindowA);
            hCreateWindowW = AutoHookCreator("user32.dll", "CreateWindowW", dCreateWindowW);

            hCreateWindowA.Install();
            hCreateWindowW.Install();
        }
        static void InstallSendMessageHooks()
        {
            if (Managed)
            {
                return;
            }
            dSendMessageA = new SendMessageADelegate(SendMessageAHook);
            dSendMessageW = new SendMessageWDelegate(SendMessageWHook);

            hSendMessageA = AutoHookCreator("user32.dll", "SendMessageA", dSendMessageA);
            hSendMessageW = AutoHookCreator("user32.dll", "SendMessageW", dSendMessageW);

            hSendMessageA.Install();
            hSendMessageW.Install();
        }
Example #5
0
        public static UnmanagedHook AutoHookCreator(string Module, string Function, Delegate Hook)
        {
            if (!ImportHook)
            {
                return(new UnmanagedHook(Module, Function, Hook));
            }

            var RHook = UnmanagedHook.TryHookImport(Module, Function, Hook);

            if (Debugging && !RHook.ImportHook)
            {
                Log("Import Hook Failed: {0} => {1}", true, Module, Function);
            }

            return(RHook);
        }
        static void InstallExtTextOutHooks()
        {
            if (Managed)
            {
                return;
            }

            dExtTextOutA = new ExtTextOutADelegate(hExtTextOut);
            dExtTextOutW = new ExtTextOutWDelegate(hExtTextOut);

            hExtTextOutA = AutoHookCreator("gdi32.dll", "ExtTextOutA", dExtTextOutA);
            hExtTextOutW = AutoHookCreator("gdi32.dll", "ExtTextOutW", dExtTextOutW);

            hExtTextOutA.Install();
            hExtTextOutW.Install();
        }
        static void InstallGlyphHooks()
        {
            if (Managed)
            {
                return;
            }

            dOutlineA = new GetGlyphOutlineDelegate(hGetGlyphOutlineA);
            dOutlineW = new GetGlyphOutlineDelegate(hGetGlyphOutlineW);

            OutlineA = AutoHookCreator("gdi32.dll", "GetGlyphOutlineA", dOutlineA);
            OutlineW = AutoHookCreator("gdi32.dll", "GetGlyphOutlineW", dOutlineW);

            OutlineA.Install();
            OutlineW.Install();
        }
        static void InstallSetWindowTextHooks()
        {
            if (Managed)
            {
                return;
            }

            dSetWindowTextA = new SetWindowTextADelegate(SetWindowTextHook);
            dSetWindowTextW = new SetWindowTextWDelegate(SetWindowTextHook);

            hSetWindowTextA = AutoHookCreator("user32.dll", "SetWindowTextA", dSetWindowTextA);
            hSetWindowTextW = AutoHookCreator("user32.dll", "SetWindowTextW", dSetWindowTextW);

            hSetWindowTextA.Install();
            hSetWindowTextW.Install();
        }
        static void InstallCreateFontHooks()
        {
            if (Managed)
            {
                return;
            }

            dCreateFontA = new CreateFontADelegate(hCreateFont);
            dCreateFontW = new CreateFontWDelegate(hCreateFont);

            hCreateFontA = AutoHookCreator("gdi32.dll", "CreateFontA", dCreateFontA);
            hCreateFontW = AutoHookCreator("gdi32.dll", "CreateFontW", dCreateFontW);

            hCreateFontA.Install();
            hCreateFontW.Install();
        }
        static void InstallIntroInjector()
        {
            if (ShowWindowHook != null || Managed)
            {
                return;
            }
#if !DEBUG
            CreateWindowExADel  = new CreateWindowExADelegate(hCreateWindowEx);
            CreateWindowExWDel  = new CreateWindowExWDelegate(hCreateWindowEx);
            CreateWindowExAHook = AutoHookCreator("user32.dll", "CreateWindowExA", CreateWindowExADel);
            CreateWindowExWHook = AutoHookCreator("user32.dll", "CreateWindowExW", CreateWindowExWDel);
            if (HookCreateWindowEx)
            {
                CreateWindowExADel = new CreateWindowExADelegate(hCreateWindowEx);
            }
#endif

            ShowWindowDel  = new ShowWindowDelegate(hShowWindow);
            ShowWindowHook = AutoHookCreator("user32.dll", "ShowWindow", ShowWindowDel);
            if (HookShowWindow)
            {
                ShowWindowHook.Install();
            }

            SetWindowPosDel  = new SetWindowPosDelegate(hSetWindowPos);
            SetWindowPosHook = AutoHookCreator("user32.dll", "SetWindowPos", SetWindowPosDel);
            if (HookSetWindowPos)
            {
                SetWindowPosHook.Install();
            }

            MoveWindowDel  = new MoveWindowDelegate(hMoveWindow);
            MoveWindowHook = AutoHookCreator("user32.dll", "MoveWindow", MoveWindowDel);
            if (HookMoveWindow)
            {
                MoveWindowHook.Install();
            }

            Log("Intro Injector Initialized...", true);
        }