mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
Remove most hand-authored native functions
This commit is contained in:
parent
1bc216ccd6
commit
fe562e8cf3
14 changed files with 204 additions and 1744 deletions
|
|
@ -70,12 +70,12 @@ public abstract class Hook<T> : IDalamudHook where T : Delegate
|
|||
|
||||
/// <inheritdoc/>
|
||||
public virtual string BackendName => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique GUID for this hook.
|
||||
/// </summary>
|
||||
protected Guid HookId { get; } = Guid.NewGuid();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Remove a hook from the current process.
|
||||
/// </summary>
|
||||
|
|
@ -200,11 +200,11 @@ public abstract class Hook<T> : IDalamudHook where T : Delegate
|
|||
if (EnvironmentConfiguration.DalamudForceMinHook)
|
||||
useMinHook = true;
|
||||
|
||||
var moduleHandle = NativeFunctions.GetModuleHandleW(moduleName);
|
||||
if (moduleHandle == IntPtr.Zero)
|
||||
using var moduleHandle = Windows.Win32.PInvoke.GetModuleHandle(moduleName);
|
||||
if (moduleHandle.IsInvalid)
|
||||
throw new Exception($"Could not get a handle to module {moduleName}");
|
||||
|
||||
var procAddress = NativeFunctions.GetProcAddress(moduleHandle, exportName);
|
||||
var procAddress = (nint)Windows.Win32.PInvoke.GetProcAddress(moduleHandle, exportName);
|
||||
if (procAddress == IntPtr.Zero)
|
||||
throw new Exception($"Could not get the address of {moduleName}::{exportName}");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue