Remove old PInvoke libs

This commit is contained in:
goaaats 2025-04-15 23:58:01 +02:00
parent 90b15d45c6
commit 4e724fbe45
8 changed files with 11 additions and 17 deletions

View file

@ -13,9 +13,9 @@ using Dalamud.Plugin.Internal;
using Dalamud.Storage;
using Dalamud.Utility;
using Dalamud.Utility.Timing;
using PInvoke;
using Serilog;
using Windows.Win32.Foundation;
using Windows.Win32.Security;
#if DEBUG
[assembly: InternalsVisibleTo("Dalamud.CorePlugin")]
@ -171,8 +171,9 @@ internal sealed unsafe class Dalamud : IServiceType
if (!reportCrashesSetting && !pmHasDevPlugins)
{
// Leaking on purpose for now
var attribs = Kernel32.SECURITY_ATTRIBUTES.Create();
Kernel32.CreateMutex(attribs, false, "DALAMUD_CRASHES_NO_MORE");
var attribs = default(SECURITY_ATTRIBUTES);
attribs.nLength = (uint)Unsafe.SizeOf<SECURITY_ATTRIBUTES>();
Windows.Win32.PInvoke.CreateMutex(attribs, false, "DALAMUD_CRASHES_NO_MORE");
}
this.unloadSignal.Set();

View file

@ -74,10 +74,6 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MinSharp" Version="1.0.4" />
<PackageReference Include="PInvoke.DwmApi" Version="0.7.104" />
<PackageReference Include="PInvoke.Kernel32" Version="0.7.104" />
<PackageReference Include="PInvoke.User32" Version="0.7.104" />
<PackageReference Include="PInvoke.Win32" Version="0.7.104" />
<PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />

View file

@ -1,3 +1,4 @@
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Net;
@ -16,7 +17,6 @@ using Dalamud.Storage;
using Dalamud.Support;
using Dalamud.Utility;
using Newtonsoft.Json;
using PInvoke;
using Serilog;
using Serilog.Core;
using Serilog.Events;

View file

@ -2,9 +2,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using Dalamud.Memory;
using JetBrains.Annotations;
using PInvoke;
using Windows.Win32.System.Memory;
using Win32Exception = System.ComponentModel.Win32Exception;

View file

@ -40,13 +40,12 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
using PInvoke;
using Serilog.Events;
namespace Dalamud.Interface.Internal;
/// <summary>
/// This plugin implements all of the Dalamud interface separately, to allow for reloading of the interface and rapid prototyping.
/// This plugin implements all the Dalamud interface separately, to allow for reloading of the interface and rapid prototyping.
/// </summary>
[ServiceManager.EarlyLoadedService]
internal class DalamudInterface : IInternalDisposableService
@ -575,7 +574,7 @@ internal class DalamudInterface : IInternalDisposableService
// Release focus of any ImGui window if we click into the game.
var io = ImGui.GetIO();
if (!io.WantCaptureMouse && (User32.GetKeyState((int)User32.VirtualKey.VK_LBUTTON) & 0x8000) != 0)
if (!io.WantCaptureMouse && (global::Windows.Win32.PInvoke.GetKeyState((int)VirtualKey.LBUTTON) & 0x8000) != 0)
{
unsafe
{

View file

@ -2,7 +2,6 @@
using Dalamud.Bindings.ImGui;
using Dalamud.Hooking;
using PInvoke;
using Serilog;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
@ -81,7 +80,7 @@ internal class HookWidget : IDataWindowWidget
var result = this.messageBoxMinHook!.Original(hwnd, "Cause Access Violation?", caption, MESSAGEBOX_STYLE.MB_YESNO);
if (result == (int)User32.MessageBoxResult.IDYES)
if (result == (int)MESSAGEBOX_RESULT.IDYES)
{
Marshal.ReadByte(IntPtr.Zero);
}

View file

@ -17,7 +17,6 @@ using Dalamud.Logging.Internal;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.UI;
using PInvoke;
namespace Dalamud.Interface.Windowing;
@ -732,7 +731,7 @@ public abstract class Window
hovered = true;
// We can't use ImGui native functions here, because they don't work with clickthrough
if ((User32.GetKeyState((int)VirtualKey.LBUTTON) & 0x8000) != 0)
if ((global::Windows.Win32.PInvoke.GetKeyState((int)VirtualKey.LBUTTON) & 0x8000) != 0)
{
held = true;
pressed = true;

View file

@ -8,11 +8,13 @@ SetWindowPos
SetForegroundWindow
SetFocus
SetActiveWindow
GetKeyState
HWND_TOPMOST
HWND_NOTOPMOST
SET_WINDOW_POS_FLAGS
SetEvent
CreateMutex
SymInitialize
SymCleanup