Exemplo n.º 1
0
        internal void LoadAndCallMethod(string Library, string MethodName)
        {
            PerformValidationCheck(Library);

            var LoadedLibraryPTR            = Load(Library);
            var LibraryToLoadCurrentProcPTR = NativeImport.LoadLibrary(Library);
            var PTRToMethod = NativeImport.GetProcAddress(LibraryToLoadCurrentProcPTR, MethodName);

            CallMethod(PTRToMethod, IntPtr.Zero);
        }
Exemplo n.º 2
0
        public static void InstallHook()
        {
            if (WinKBHookCallbackDelegate == null && WKBHookInstance == IntPtr.Zero)
            {
                WinKBHookCallbackDelegate = new NativeImport.WindowsHookAdditionals.HookProc(HookedKBWindowsCallback);

                var hinstance = NativeImport.LoadLibrary("User32");

                WKBHookInstance = NativeImport.SetWindowsHookEx(NativeImport.WindowsHookAdditionals.HookType.WH_KEYBOARD_LL, WinKBHookCallbackDelegate, hinstance, 0);

                Logger.Log("Installed Keyboard hook.");
            }
        }
Exemplo n.º 3
0
        internal Loader(string ProcessName)
        {
            try { LoadedProcess = Process.GetProcessesByName(ProcessName).First(); }
            catch (Exception)
            {
                Console.WriteLine($"Could Not Find Process: {ProcessName}");
                Console.Read();
                Environment.Exit(0);
            }

            Kernel32PTR    = NativeImport.LoadLibrary("kernel32");
            LoadLibraryPTR = NativeImport.GetProcAddress(Kernel32PTR, "LoadLibraryA");
        }
Exemplo n.º 4
0
        public void InstallHooks(IntPtr hwnd)
        {
            winMSHookCallbackDelegate = new NativeImport.WindowsHookAdditionals.HookProc(HookedMSWindowsCallback);
            winKBHookCallbackDelegate = new NativeImport.WindowsHookAdditionals.HookProc(HookedKBWindowsCallback);

            var hinstance = NativeImport.LoadLibrary("User32");

            wMSHookInstance = NativeImport.SetWindowsHookEx(NativeImport.WindowsHookAdditionals.HookType.WH_MOUSE_LL, winMSHookCallbackDelegate, hinstance, 0);
            wKBHookInstance = NativeImport.SetWindowsHookEx(NativeImport.WindowsHookAdditionals.HookType.WH_KEYBOARD_LL, winKBHookCallbackDelegate, hinstance, 0);

            rIUtils = new RawInputUtils(hwnd);

            Console.WriteLine("Installed input hooks");
        }
Exemplo n.º 5
0
        internal static IntPtr GetFunctionAddress(string LibraryName, string FunctionName)
        {
            IntPtr HModule = NativeImport.LoadLibrary(LibraryName);

            return(NativeImport.GetProcAddress(HModule, FunctionName));
        }
Exemplo n.º 6
0
 public static nint GetFunctionAddress(string libName, string funcName) => NativeImport.GetProcAddress(NativeImport.LoadLibrary(libName), funcName);