Example #1
0
        /// <summary>
        /// Gets an address from a vtable index. Since it uses index * IntPtr, it should work for both x64 and x32.
        /// </summary>
        /// <param name="intPtr">The int PTR.</param>
        /// <param name="functionIndex">Index of the function.</param>
        /// <returns>IntPtr.</returns>
        public static InternalMemoryPointer GetVtableAddress(this MemoryPointer intPtr, int functionIndex)
        {
            IntPtr vftable = intPtr.Read <IntPtr>();
            IntPtr result  = new InternalMemoryPointer(vftable + (functionIndex * IntPtr.Size)).Read <IntPtr>();

            return(new InternalMemoryPointer(result));
        }
        /// <summary>
        ///     Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).
        /// </summary>
        /// <param name="moduleName">The module name (not case-sensitive).</param>
        /// <param name="functionName">The function or variable name, or the function's ordinal value.</param>
        /// <returns>The address of the exported function.</returns>
        public override MemoryPointer GetProcAddress(string name)
        {
            MemoryPointer ret = new InternalMemoryPointer(Kernel32.GetProcAddress(ProcessModule.BaseAddress, name));

            if (ret == null)
            {
                throw new Win32Exception($"Couldn't get the function address with name {name}.");
            }

            return(ret);
        }
Example #3
0
        public override Delegate GetHookDelegate()
        {
            InternalMemoryPointer ptr = D3DHelper.GetD3D9Endscene();

            return(ptr.ToDelegate <D3D9EndSceneDelegate>());
        }