public unsafe SMHooks() { SMProcess = new ProcessSharp(System.Diagnostics.Process.GetCurrentProcess(), MemoryType.Local); // WndProc WndProcDelegate = new ManagedWndProc(WndProc); WndProcWrapper.SetCallback(Marshal.GetFunctionPointerForDelegate(WndProcDelegate)); // Native calls SetupNativeMethods(); }
/// <summary> /// Scan SuperMemo to find the methods matching the signatures provided by /// <paramref name="nativeData" />. Also sets up the WndProc detour. /// </summary> /// <param name="nativeData">The offsets and method signatures for the running SuperMemo version</param> private unsafe void InstallSM(NativeData nativeData) { _smProcess = new ProcessSharp(System.Diagnostics.Process.GetCurrentProcess(), MemoryType.Local); // WndProc _wndProcDelegate = new ManagedWndProc(WndProc); WndProcWrapper.SetCallback(Marshal.GetFunctionPointerForDelegate(_wndProcDelegate)); SMA.SetWndProcHookAddr(WndProcWrapper.GetWndProcNativeWrapperAddr()); // Native calls ScanSMMethods(nativeData); }