DotNetVmtHook 1.0.0

.NET Core 2.1 .NET Standard 1.3 .NET Framework 4.6.1
dotnet add package DotNetVmtHook --version 1.0.0
NuGet\Install-Package DotNetVmtHook -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetVmtHook" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetVmtHook --version 1.0.0
#r "nuget: DotNetVmtHook, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install DotNetVmtHook as a Cake Addin
#addin nuget:?package=DotNetVmtHook&version=1.0.0

// Install DotNetVmtHook as a Cake Tool
#tool nuget:?package=DotNetVmtHook&version=1.0.0


Allows you to hook a VMT of a native application from .NET Framework and .NET Core.

Performance appears to be good; but I didn't run any benchmarks yet and of course hooking natively will be much faster.

Note: this uses shadow VMT and does not modify the original VMT function addresses. Instead, it replaces the object's VMT pointer. If you plan to use this in any game for "cheating": Don't. Most anti-cheats will detect this anyway.



    [SuppressUnmanagedCodeSecurity] //to make calls faster
    [UnmanagedFunctionPointer(CallingConvention.StdCall)] //depends on the native method
    [return: MarshalAs(UnmanagedType.I1)] //depends on the native method
    public unsafe delegate bool SomeMethodDelegate(void* data, int data2); //Adjust your signature to the native function
    public class SomeFunctionHook : VmtFunctionHook<SomeMethodDelegate>
        public SomeFunctionHook(VmtTable vmt) : base(vmt, NATIVE_FUNCTION_INDEX_HERE) { }
        private unsafe bool SomeFunction_Hooked(data, data2)
             //ANYTHING USED FROM OUTSIDE HERE NEEDS Gc.KeepAlive()!!!
             //Otherwise GC might loose track of it and collect it; resulting in native crash
             //Do Something
             return OriginalFunction(data, data2);
        protected override unsafe SomeMethodDelegate GetCallback()
            return SomeFunction_Hooked;
    VmtTable vmt = new Vmt32Table(YOUR_NATIVE_INSTANCE_POINTER_HERE);
    var functionHook = new SomeFunctionHook(vmt);
    // Somewhen later; when you want to clean up (restores original functions):


Works with .NET 4.5 / .NET Standard 1.3 (Depends on Buffer.MemoryCopy)

Should work on Linux; afaik you have to +1 the function indexes there (e.g. if your function index is 0x03 on Windows, its 0x04 on Linux).


Everything is licensed MIT. Please provide credit if you use this.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net46 net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.1

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETStandard 1.3

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 871 7/15/2018