Dalamud/docs/api/Dalamud.Hooking.Hook-1.html
2022-10-29 15:34:04 +02:00

892 lines
40 KiB
HTML

<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class Hook&lt;T&gt;
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class Hook&lt;T&gt;
">
<meta name="generator" content="docfx 2.59.4.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Dalamud.Hooking.Hook`1">
<h1 id="Dalamud_Hooking_Hook_1" data-uid="Dalamud.Hooking.Hook`1" class="text-break">Class Hook&lt;T&gt;
</h1>
<div class="markdown level0 summary"><p>Manages a hook which can be used to intercept a call to native function.
This class is basically a thin wrapper around the LocalHook type to provide helper functions.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">Hook&lt;T&gt;</span></div>
</div>
<div class="implements">
<h5>Implements</h5>
<div><span class="xref">System.IDisposable</span></div>
<div><a class="xref" href="Dalamud.Hooking.IDalamudHook.html">IDalamudHook</a></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<span class="xref">System.Object.Equals(System.Object)</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetHashCode()</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.ToString()</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Dalamud.Hooking.html">Dalamud.Hooking</a></h6>
<h6><strong>Assembly</strong>: Dalamud.dll</h6>
<h5 id="Dalamud_Hooking_Hook_1_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class Hook&lt;T&gt; : IDisposable, IDalamudHook where T : Delegate</code></pre>
</div>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="parametername">T</span></td>
<td><p>Delegate type to represents a function prototype. This must be the same prototype as original function do.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="constructors">Constructors
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1__ctor_System_IntPtr__0_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.%23ctor(System.IntPtr%2C%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L35">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1__ctor_" data-uid="Dalamud.Hooking.Hook`1.#ctor*"></a>
<h4 id="Dalamud_Hooking_Hook_1__ctor_System_IntPtr__0_" data-uid="Dalamud.Hooking.Hook`1.#ctor(System.IntPtr,`0)">Hook(IntPtr, T)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook&lt;T&gt;</a> class.
Hook is not activated until Enable() method is called.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[Obsolete(&quot;Use Hook&lt;T&gt;.FromAddress instead.&quot;)]
public Hook(IntPtr address, T detour)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IntPtr</span></td>
<td><span class="parametername">address</span></td>
<td><p>A memory address to install a hook.</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1__ctor_System_IntPtr__0_System_Boolean_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.%23ctor(System.IntPtr%2C%600%2CSystem.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L49">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1__ctor_" data-uid="Dalamud.Hooking.Hook`1.#ctor*"></a>
<h4 id="Dalamud_Hooking_Hook_1__ctor_System_IntPtr__0_System_Boolean_" data-uid="Dalamud.Hooking.Hook`1.#ctor(System.IntPtr,`0,System.Boolean)">Hook(IntPtr, T, Boolean)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook&lt;T&gt;</a> class.
Hook is not activated until Enable() method is called.
Please do not use MinHook unless you have thoroughly troubleshot why Reloaded does not work.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[Obsolete(&quot;Use Hook&lt;T&gt;.FromAddress instead.&quot;)]
public Hook(IntPtr address, T detour, bool useMinHook)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IntPtr</span></td>
<td><span class="parametername">address</span></td>
<td><p>A memory address to install a hook.</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">useMinHook</span></td>
<td><p>Use the MinHook hooking library instead of Reloaded.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="properties">Properties
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_Address.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.Address%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L81">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_Address_" data-uid="Dalamud.Hooking.Hook`1.Address*"></a>
<h4 id="Dalamud_Hooking_Hook_1_Address" data-uid="Dalamud.Hooking.Hook`1.Address">Address</h4>
<div class="markdown level1 summary"><p>Gets a memory address of the target function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IntPtr Address { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IntPtr</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.ObjectDisposedException</span></td>
<td><p>Hook is already disposed.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_BackendName.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.BackendName%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L123">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_BackendName_" data-uid="Dalamud.Hooking.Hook`1.BackendName*"></a>
<h4 id="Dalamud_Hooking_Hook_1_BackendName" data-uid="Dalamud.Hooking.Hook`1.BackendName">BackendName</h4>
<div class="markdown level1 summary"><p>Gets the name of the hooking backend used for the hook.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual string BackendName { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_IsDisposed.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.IsDisposed%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L120">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_IsDisposed_" data-uid="Dalamud.Hooking.Hook`1.IsDisposed*"></a>
<h4 id="Dalamud_Hooking_Hook_1_IsDisposed" data-uid="Dalamud.Hooking.Hook`1.IsDisposed">IsDisposed</h4>
<div class="markdown level1 summary"><p>Gets a value indicating whether or not the hook has been disposed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public bool IsDisposed { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_IsEnabled.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.IsEnabled%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L115">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_IsEnabled_" data-uid="Dalamud.Hooking.Hook`1.IsEnabled*"></a>
<h4 id="Dalamud_Hooking_Hook_1_IsEnabled" data-uid="Dalamud.Hooking.Hook`1.IsEnabled">IsEnabled</h4>
<div class="markdown level1 summary"><p>Gets a value indicating whether or not the hook is enabled.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual bool IsEnabled { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_Original.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.Original%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L94">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_Original_" data-uid="Dalamud.Hooking.Hook`1.Original*"></a>
<h4 id="Dalamud_Hooking_Hook_1_Original" data-uid="Dalamud.Hooking.Hook`1.Original">Original</h4>
<div class="markdown level1 summary"><p>Gets a delegate function that can be used to call the actual function as if function is not hooked yet.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual T Original { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">T</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.ObjectDisposedException</span></td>
<td><p>Hook is already disposed.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_OriginalDisposeSafe.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.OriginalDisposeSafe%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L100">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_OriginalDisposeSafe_" data-uid="Dalamud.Hooking.Hook`1.OriginalDisposeSafe*"></a>
<h4 id="Dalamud_Hooking_Hook_1_OriginalDisposeSafe" data-uid="Dalamud.Hooking.Hook`1.OriginalDisposeSafe">OriginalDisposeSafe</h4>
<div class="markdown level1 summary"><p>Gets a delegate function that can be used to call the actual function as if function is not hooked yet.
This can be called even after Dispose.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public T OriginalDisposeSafe { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">T</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_CheckDisposed.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.CheckDisposed%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L302">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_CheckDisposed_" data-uid="Dalamud.Hooking.Hook`1.CheckDisposed*"></a>
<h4 id="Dalamud_Hooking_Hook_1_CheckDisposed" data-uid="Dalamud.Hooking.Hook`1.CheckDisposed">CheckDisposed()</h4>
<div class="markdown level1 summary"><p>Check if this object has been disposed already.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected void CheckDisposed()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_Disable.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.Disable%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L291">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_Disable_" data-uid="Dalamud.Hooking.Hook`1.Disable*"></a>
<h4 id="Dalamud_Hooking_Hook_1_Disable" data-uid="Dalamud.Hooking.Hook`1.Disable">Disable()</h4>
<div class="markdown level1 summary"><p>Stops intercepting a call to the function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void Disable()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_Dispose.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.Dispose%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L267">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_Dispose_" data-uid="Dalamud.Hooking.Hook`1.Dispose*"></a>
<h4 id="Dalamud_Hooking_Hook_1_Dispose" data-uid="Dalamud.Hooking.Hook`1.Dispose">Dispose()</h4>
<div class="markdown level1 summary"><p>Remove a hook from the current process.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void Dispose()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_Enable.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.Enable%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L280">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_Enable_" data-uid="Dalamud.Hooking.Hook`1.Enable*"></a>
<h4 id="Dalamud_Hooking_Hook_1_Enable" data-uid="Dalamud.Hooking.Hook`1.Enable">Enable()</h4>
<div class="markdown level1 summary"><p>Starts intercepting a call to the function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void Enable()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_FromAddress_System_IntPtr__0_System_Boolean_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.FromAddress(System.IntPtr%2C%600%2CSystem.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L252">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_FromAddress_" data-uid="Dalamud.Hooking.Hook`1.FromAddress*"></a>
<h4 id="Dalamud_Hooking_Hook_1_FromAddress_System_IntPtr__0_System_Boolean_" data-uid="Dalamud.Hooking.Hook`1.FromAddress(System.IntPtr,`0,System.Boolean)">FromAddress(IntPtr, T, Boolean)</h4>
<div class="markdown level1 summary"><p>Creates a hook. Hooking address is inferred by calling to GetProcAddress() function.
The hook is not activated until Enable() method is called.
Please do not use MinHook unless you have thoroughly troubleshot why Reloaded does not work.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Hook&lt;T&gt; FromAddress(IntPtr procAddress, T detour, bool useMinHook = false)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IntPtr</span></td>
<td><span class="parametername">procAddress</span></td>
<td><p>A memory address to install a hook.</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">useMinHook</span></td>
<td><p>Use the MinHook hooking library instead of Reloaded.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook</a>&lt;T&gt;</td>
<td><p>The hook with the supplied parameters.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_FromFunctionPointerVariable_System_IntPtr__0_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.FromFunctionPointerVariable(System.IntPtr%2C%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L131">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_FromFunctionPointerVariable_" data-uid="Dalamud.Hooking.Hook`1.FromFunctionPointerVariable*"></a>
<h4 id="Dalamud_Hooking_Hook_1_FromFunctionPointerVariable_System_IntPtr__0_" data-uid="Dalamud.Hooking.Hook`1.FromFunctionPointerVariable(System.IntPtr,`0)">FromFunctionPointerVariable(IntPtr, T)</h4>
<div class="markdown level1 summary"><p>Creates a hook by rewriting import table address.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Hook&lt;T&gt; FromFunctionPointerVariable(IntPtr address, T detour)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IntPtr</span></td>
<td><span class="parametername">address</span></td>
<td><p>A memory address to install a hook.</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook</a>&lt;T&gt;</td>
<td><p>The hook with the supplied parameters.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_FromImport_System_Diagnostics_ProcessModule_System_String_System_String_System_UInt32__0_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.FromImport(System.Diagnostics.ProcessModule%2CSystem.String%2CSystem.String%2CSystem.UInt32%2C%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L145">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_FromImport_" data-uid="Dalamud.Hooking.Hook`1.FromImport*"></a>
<h4 id="Dalamud_Hooking_Hook_1_FromImport_System_Diagnostics_ProcessModule_System_String_System_String_System_UInt32__0_" data-uid="Dalamud.Hooking.Hook`1.FromImport(System.Diagnostics.ProcessModule,System.String,System.String,System.UInt32,`0)">FromImport(ProcessModule, String, String, UInt32, T)</h4>
<div class="markdown level1 summary"><p>Creates a hook by rewriting import table address.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Hook&lt;T&gt; FromImport(ProcessModule module, string moduleName, string functionName, uint hintOrOrdinal, T detour)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Diagnostics.ProcessModule</span></td>
<td><span class="parametername">module</span></td>
<td><p>Module to check for. Current process' main module if null.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">moduleName</span></td>
<td><p>Name of the DLL, including the extension.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">functionName</span></td>
<td><p>Decorated name of the function.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.UInt32</span></td>
<td><span class="parametername">hintOrOrdinal</span></td>
<td><p>Hint or ordinal. 0 to unspecify.</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook</a>&lt;T&gt;</td>
<td><p>The hook with the supplied parameters.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_FromSymbol_System_String_System_String__0_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.FromSymbol(System.String%2CSystem.String%2C%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L210">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_FromSymbol_" data-uid="Dalamud.Hooking.Hook`1.FromSymbol*"></a>
<h4 id="Dalamud_Hooking_Hook_1_FromSymbol_System_String_System_String__0_" data-uid="Dalamud.Hooking.Hook`1.FromSymbol(System.String,System.String,`0)">FromSymbol(String, String, T)</h4>
<div class="markdown level1 summary"><p>Creates a hook. Hooking address is inferred by calling to GetProcAddress() function.
The hook is not activated until Enable() method is called.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Hook&lt;T&gt; FromSymbol(string moduleName, string exportName, T detour)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">moduleName</span></td>
<td><p>A name of the module currently loaded in the memory. (e.g. ws2_32.dll).</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">exportName</span></td>
<td><p>A name of the exported function name (e.g. send).</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook</a>&lt;T&gt;</td>
<td><p>The hook with the supplied parameters.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1_FromSymbol_System_String_System_String__0_System_Boolean_.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601.FromSymbol(System.String%2CSystem.String%2C%600%2CSystem.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L223">View Source</a>
</span>
<a id="Dalamud_Hooking_Hook_1_FromSymbol_" data-uid="Dalamud.Hooking.Hook`1.FromSymbol*"></a>
<h4 id="Dalamud_Hooking_Hook_1_FromSymbol_System_String_System_String__0_System_Boolean_" data-uid="Dalamud.Hooking.Hook`1.FromSymbol(System.String,System.String,`0,System.Boolean)">FromSymbol(String, String, T, Boolean)</h4>
<div class="markdown level1 summary"><p>Creates a hook. Hooking address is inferred by calling to GetProcAddress() function.
The hook is not activated until Enable() method is called.
Please do not use MinHook unless you have thoroughly troubleshot why Reloaded does not work.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Hook&lt;T&gt; FromSymbol(string moduleName, string exportName, T detour, bool useMinHook)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">moduleName</span></td>
<td><p>A name of the module currently loaded in the memory. (e.g. ws2_32.dll).</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">exportName</span></td>
<td><p>A name of the exported function name (e.g. send).</p>
</td>
</tr>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">detour</span></td>
<td><p>Callback function. Delegate must have a same original function prototype.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">useMinHook</span></td>
<td><p>Use the MinHook hooking library instead of Reloaded.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Dalamud.Hooking.Hook-1.html">Hook</a>&lt;T&gt;</td>
<td><p>The hook with the supplied parameters.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="implements">Implements</h3>
<div>
<span class="xref">System.IDisposable</span>
</div>
<div>
<a class="xref" href="Dalamud.Hooking.IDalamudHook.html">IDalamudHook</a>
</div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Hooking_Hook_1.md&amp;value=---%0Auid%3A%20Dalamud.Hooking.Hook%601%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Hooking/Hook.cs/#L16" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<h5>In This Article</h5>
<div></div>
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>