refine com import

This commit is contained in:
Lightczx
2024-01-26 17:18:57 +08:00
parent f823cb5f1a
commit 1e216e9823
24 changed files with 334 additions and 115 deletions

View File

@@ -41,21 +41,21 @@ internal sealed partial class ShellLinkInterop : IShellLinkInterop
bool result = false;
// DO NOT revert if condition, COM interfaces need to be released properly
HRESULT hr = CoCreateInstance(ref ShellLink.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, ref IShellLinkW.IID, out IShellLinkW* pShellLink);
HRESULT hr = CoCreateInstance(in ShellLink.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, in IShellLinkW.IID, out IShellLinkW* pShellLink);
if (SUCCEEDED(hr))
{
pShellLink->SetPath($"shell:AppsFolder\\{runtimeOptions.FamilyName}!App");
pShellLink->SetShowCmd(SHOW_WINDOW_CMD.SW_NORMAL);
pShellLink->SetIconLocation(targetLogoPath, 0);
if (SUCCEEDED(pShellLink->QueryInterface(ref IShellLinkDataList.IID, out IShellLinkDataList* pShellLinkDataList)))
if (SUCCEEDED(pShellLink->QueryInterface(in IShellLinkDataList.IID, out IShellLinkDataList* pShellLinkDataList)))
{
pShellLinkDataList->GetFlags(out uint flags);
pShellLinkDataList->SetFlags(flags | (uint)SHELL_LINK_DATA_FLAGS.SLDF_RUNAS_USER);
pShellLinkDataList->Release();
}
if (SUCCEEDED(pShellLink->QueryInterface(ref IPersistFile.IID, out IPersistFile* pPersistFile)))
if (SUCCEEDED(pShellLink->QueryInterface(in IPersistFile.IID, out IPersistFile* pPersistFile)))
{
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string target = Path.Combine(desktop, $"{SH.FormatAppNameAndVersion(runtimeOptions.Version)}.lnk");

View File

@@ -22,7 +22,7 @@ internal sealed partial class FileSystemPickerInteraction : IFileSystemPickerInt
public unsafe ValueResult<bool, ValueFile> PickFile(string? title, string? defaultFileName, (string Name, string Type)[]? filters)
{
HRESULT hr = CoCreateInstance(ref FileOpenDialog.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, ref IFileDialog.IID, out IFileDialog* pFileDialog);
HRESULT hr = CoCreateInstance(in FileOpenDialog.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, in IFileDialog.IID, out IFileDialog* pFileDialog);
Marshal.ThrowExceptionForHR(hr);
FILEOPENDIALOGOPTIONS options =
@@ -77,7 +77,7 @@ internal sealed partial class FileSystemPickerInteraction : IFileSystemPickerInt
public unsafe ValueResult<bool, ValueFile> SaveFile(string? title, string? defaultFileName, (string Name, string Type)[]? filters)
{
HRESULT hr = CoCreateInstance(ref FileSaveDialog.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, ref IFileDialog.IID, out IFileDialog* pFileDialog);
HRESULT hr = CoCreateInstance(in FileSaveDialog.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, in IFileDialog.IID, out IFileDialog* pFileDialog);
Marshal.ThrowExceptionForHR(hr);
FILEOPENDIALOGOPTIONS options =
@@ -133,7 +133,7 @@ internal sealed partial class FileSystemPickerInteraction : IFileSystemPickerInt
public unsafe ValueResult<bool, string> PickFolder(string? title)
{
HRESULT hr = CoCreateInstance(ref FileOpenDialog.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, ref IFileDialog.IID, out IFileDialog* pFileDialog);
HRESULT hr = CoCreateInstance(in FileOpenDialog.CLSID, default, CLSCTX.CLSCTX_INPROC_SERVER, in IFileDialog.IID, out IFileDialog* pFileDialog);
Marshal.ThrowExceptionForHR(hr);
FILEOPENDIALOGOPTIONS options =
@@ -204,7 +204,7 @@ internal sealed partial class FileSystemPickerInteraction : IFileSystemPickerInt
private static unsafe void SetDesktopAsStartupFolder(IFileDialog* pFileDialog)
{
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
HRESULT hr = SHCreateItemFromParsingName(desktopPath, default, ref IShellItem.IID, out IShellItem* pShellItem);
HRESULT hr = SHCreateItemFromParsingName(desktopPath, default, in IShellItem.IID, out IShellItem* pShellItem);
Marshal.ThrowExceptionForHR(hr);
pFileDialog->SetFolder(pShellItem);
}

View File

@@ -6,5 +6,5 @@ namespace Snap.Hutao.Win32.NetworkManagement.WindowsFirewall;
internal enum NETISO_FLAG
{
NETISO_FLAG_FORCE_COMPUTE_BINARIES = 1,
NETISO_FLAG_MAX = 2
NETISO_FLAG_MAX = 2,
}

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("0000000E-0000-0000-C000-000000000046")]
internal unsafe struct IBindCtx
{
internal static Guid IID = new(14u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IBindCtx
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("00000102-0000-0000-C000-000000000046")]
internal unsafe struct IEnumMoniker
{
internal static Guid IID = new(258u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IEnumMoniker
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("00000101-0000-0000-C000-000000000046")]
internal unsafe struct IEnumString
{
internal static Guid IID = new(257u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IEnumString
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("0000000F-0000-0000-C000-000000000046")]
internal unsafe struct IMoniker
{
internal static Guid IID = new(15u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IMoniker
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("0000010C-0000-0000-C000-000000000046")]
internal unsafe struct IPersist
{
internal static readonly Guid IID = new(268u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x0C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IPersist
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal unsafe readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("0000010B-0000-0000-C000-000000000046")]
internal unsafe struct IPersistFile
{
internal static Guid IID = new(267u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x0B, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface pvObject)
where TInterface : unmanaged
@@ -19,26 +30,26 @@ internal unsafe struct IPersistFile
{
fixed (TInterface* ppvObject = &pvObject)
{
return thisPtr->IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
public HRESULT Save(string szFileName, bool fRemember)
{
fixed (char* pszFileName = szFileName)
{
return thisPtr->Save((IPersistFile*)Unsafe.AsPointer(ref this), pszFileName, fRemember);
return ThisPtr->Save((IPersistFile*)Unsafe.AsPointer(ref this), pszFileName, fRemember);
}
}

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("00000109-0000-0000-C000-000000000046")]
internal unsafe struct IPersistStream
{
internal static Guid IID = new(265u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IPersistStream
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("00000010-0000-0000-C000-000000000046")]
internal unsafe struct IRunningObjectTable
{
internal static Guid IID = new(16u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IRunningObjectTable
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("0C733A30-2A1C-11CE-ADE5-00AA0044773D")]
internal unsafe struct ISequentialStream
{
internal static Guid IID = new(208878128u, 10780, 4558, 173, 229, 0, 170, 0, 68, 119, 61);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x30, 0x3A, 0x73, 0x0C, 0x1C, 0x2A, 0xCE, 0x11, 0xAD, 0xE5, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct ISequentialStream
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,25 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.System.Com;
[SupportedOSPlatform("windows5.0")]
[Guid("0000000C-0000-0000-C000-000000000046")]
internal unsafe struct IStream
{
internal static Guid IID = new(12u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +30,19 @@ internal unsafe struct IStream
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->ISequentialStreamVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->ISequentialStreamVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->ISequentialStreamVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->ISequentialStreamVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->ISequentialStreamVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->ISequentialStreamVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -3,14 +3,23 @@
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Snap.Hutao.Win32.System.Com;
[Guid("00000000-0000-0000-C000-000000000046")]
internal unsafe struct IUnknown
{
internal static Guid IID = new(0u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -19,19 +28,19 @@ internal unsafe struct IUnknown
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal unsafe readonly struct Vftbl

View File

@@ -1,9 +1,20 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Snap.Hutao.Win32.UI.Shell;
[Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")]
internal readonly struct FileOpenDialog
{
internal static Guid CLSID = new(3692845724u, 59530, 19934, 165, 161, 96, 248, 42, 32, 174, 247);
internal static unsafe ref readonly Guid CLSID
{
get
{
ReadOnlySpan<byte> data = [0x9C, 0x5A, 0x1C, 0xDC, 0x8A, 0xE8, 0xDE, 0x4D, 0xA5, 0xA1, 0x60, 0xF8, 0x2A, 0x20, 0xAE, 0xF7];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
}

View File

@@ -1,9 +1,20 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Snap.Hutao.Win32.UI.Shell;
[Guid("C0B4E2F3-BA21-4773-8DBA-335EC946EB8B")]
internal readonly struct FileSaveDialog
{
internal static Guid CLSID = new(3233080051u, 47649, 18291, 141, 186, 51, 94, 201, 70, 235, 139);
internal static unsafe ref readonly Guid CLSID
{
get
{
ReadOnlySpan<byte> data = [0xF3, 0xE2, 0xB4, 0xC0, 0x21, 0xBA, 0x73, 0x47, 0x8D, 0xBA, 0x33, 0x5E, 0xC9, 0x46, 0xEB, 0x8B];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
}

View File

@@ -5,17 +5,26 @@ using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using Snap.Hutao.Win32.UI.Shell.Common;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SuppressMessage("", "SH002")]
[SupportedOSPlatform("windows6.0.6000")]
[Guid("42F85136-DB7E-439C-85F1-E4075D135FC8")]
internal unsafe struct IFileDialog
{
internal static Guid IID = new(1123569974u, 56190, 17308, 133, 241, 228, 7, 93, 19, 95, 200);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x36, 0x51, 0xF8, 0x42, 0x7E, 0xDB, 0x9C, 0x43, 0x85, 0xF1, 0xE4, 0x07, 0x5D, 0x13, 0x5F, 0xC8];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -24,49 +33,49 @@ internal unsafe struct IFileDialog
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IModalWindowVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IModalWindowVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IModalWindowVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IModalWindowVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IModalWindowVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IModalWindowVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
public HRESULT Show([AllowNull] HWND hwndOwner)
{
return thisPtr->IModalWindowVftbl.Show((IModalWindow*)Unsafe.AsPointer(ref this), hwndOwner);
return ThisPtr->IModalWindowVftbl.Show((IModalWindow*)Unsafe.AsPointer(ref this), hwndOwner);
}
public HRESULT SetFileTypes(ReadOnlySpan<COMDLG_FILTERSPEC> filterSpecs)
{
fixed (COMDLG_FILTERSPEC* rgFilterSpec = filterSpecs)
{
return thisPtr->SetFileTypes((IFileDialog*)Unsafe.AsPointer(ref this), (uint)filterSpecs.Length, rgFilterSpec);
return ThisPtr->SetFileTypes((IFileDialog*)Unsafe.AsPointer(ref this), (uint)filterSpecs.Length, rgFilterSpec);
}
}
public HRESULT SetOptions(FILEOPENDIALOGOPTIONS fos)
{
return thisPtr->SetOptions((IFileDialog*)Unsafe.AsPointer(ref this), fos);
return ThisPtr->SetOptions((IFileDialog*)Unsafe.AsPointer(ref this), fos);
}
public HRESULT SetFolder(IShellItem* si)
{
return thisPtr->SetFolder((IFileDialog*)Unsafe.AsPointer(ref this), si);
return ThisPtr->SetFolder((IFileDialog*)Unsafe.AsPointer(ref this), si);
}
public HRESULT SetFileName(string szName)
{
fixed (char* pszName = szName)
{
return thisPtr->SetFileName((IFileDialog*)Unsafe.AsPointer(ref this), pszName);
return ThisPtr->SetFileName((IFileDialog*)Unsafe.AsPointer(ref this), pszName);
}
}
@@ -74,7 +83,7 @@ internal unsafe struct IFileDialog
{
fixed (char* pszTitle = szTitle)
{
return thisPtr->SetTitle((IFileDialog*)Unsafe.AsPointer(ref this), pszTitle);
return ThisPtr->SetTitle((IFileDialog*)Unsafe.AsPointer(ref this), pszTitle);
}
}
@@ -82,7 +91,7 @@ internal unsafe struct IFileDialog
{
fixed (IShellItem** ppsi = &psi)
{
return thisPtr->GetResult((IFileDialog*)Unsafe.AsPointer(ref this), ppsi);
return ThisPtr->GetResult((IFileDialog*)Unsafe.AsPointer(ref this), ppsi);
}
}

View File

@@ -4,14 +4,25 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SupportedOSPlatform("windows6.0.6000")]
[Guid("973510DB-7D7F-452B-8975-74A85828D354")]
internal unsafe struct IFileDialogEvents
{
internal static Guid IID = new(2536837339u, 32127, 17707, 137, 117, 116, 168, 88, 40, 211, 84);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0xDB, 0x10, 0x35, 0x97, 0x7F, 0x7D, 0x2B, 0x45, 0x89, 0x75, 0x74, 0xA8, 0x58, 0x28, 0xD3, 0x54];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -20,19 +31,19 @@ internal unsafe struct IFileDialogEvents
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -4,16 +4,25 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SupportedOSPlatform("windows5.1.2600")]
[Guid("B4DB1657-70D7-485E-8E3E-6FCB5A5C1802")]
internal unsafe struct IModalWindow
{
internal static Guid IID = new(3034256983u, 28887, 18526, 142, 62, 111, 203, 90, 92, 24, 2);
public readonly Vftbl* ThisPtr;
private readonly Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x57, 0x16, 0xDB, 0xB4, 0xD7, 0x70, 0x5E, 0x48, 0x8E, 0x3E, 0x6F, 0xCB, 0x5A, 0x5C, 0x18, 0x02];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -22,19 +31,19 @@ internal unsafe struct IModalWindow
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal unsafe readonly struct Vftbl

View File

@@ -5,14 +5,25 @@ using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using Snap.Hutao.Win32.System.SystemServices;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SupportedOSPlatform("windows5.1.2600")]
[Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE")]
internal unsafe struct IShellItem
{
internal static Guid IID = new(1132621086u, 59160, 17134, 188, 85, 161, 226, 97, 195, 123, 254);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x1E, 0x6D, 0x82, 0x43, 0x18, 0xE7, 0xEE, 0x42, 0xBC, 0x55, 0xA1, 0xE2, 0x61, 0xC3, 0x7B, 0xFE];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -21,26 +32,26 @@ internal unsafe struct IShellItem
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
public HRESULT GetDisplayName(SIGDN sigdnName, out PWSTR pszName)
{
fixed (PWSTR* ppszName = &pszName)
{
return thisPtr->GetDisplayName((IShellItem*)Unsafe.AsPointer(ref this), sigdnName, ppszName);
return ThisPtr->GetDisplayName((IShellItem*)Unsafe.AsPointer(ref this), sigdnName, ppszName);
}
}

View File

@@ -4,16 +4,25 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SupportedOSPlatform("windows6.0.6000")]
[Guid("2659B475-EEB8-48B7-8F07-B378810F48CF")]
internal unsafe struct IShellItemFilter
{
internal static Guid IID = new(643413109u, 61112, 18615, 143, 7, 179, 120, 129, 15, 72, 207);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0x75, 0xB4, 0x59, 0x26, 0xB8, 0xEE, 0xB7, 0x48, 0x8F, 0x07, 0xB3, 0x78, 0x81, 0x0F, 0x48, 0xCF];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -22,19 +31,19 @@ internal unsafe struct IShellItemFilter
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl

View File

@@ -4,16 +4,25 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SupportedOSPlatform("windows5.0")]
[Guid("45E2B4AE-B1C3-11D0-B92F-00A0C90312E1")]
internal unsafe struct IShellLinkDataList
{
internal static Guid IID = new(1172485294U, 45507, 4560, 185, 47, 0, 160, 201, 3, 18, 225);
public readonly Vftbl* ThisPtr;
private Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0xAE, 0xB4, 0xE2, 0x45, 0xC3, 0xB1, 0xD0, 0x11, 0xB9, 0x2F, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -22,32 +31,32 @@ internal unsafe struct IShellLinkDataList
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
public HRESULT GetFlags(out uint dwFlags)
{
fixed (uint* pdwFlags = &dwFlags)
{
return thisPtr->GetFlags((IShellLinkDataList*)Unsafe.AsPointer(ref this), pdwFlags);
return ThisPtr->GetFlags((IShellLinkDataList*)Unsafe.AsPointer(ref this), pdwFlags);
}
}
public HRESULT SetFlags(uint dwFlags)
{
return thisPtr->SetFlags((IShellLinkDataList*)Unsafe.AsPointer(ref this), dwFlags);
return ThisPtr->SetFlags((IShellLinkDataList*)Unsafe.AsPointer(ref this), dwFlags);
}
internal readonly struct Vftbl

View File

@@ -7,16 +7,25 @@ using Snap.Hutao.Win32.System.Com;
using Snap.Hutao.Win32.UI.Shell.Common;
using Snap.Hutao.Win32.UI.WindowsAndMessaging;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SupportedOSPlatform("windows5.1.2600")]
[Guid("000214F9-0000-0000-C000-000000000046")]
internal unsafe struct IShellLinkW
{
internal static Guid IID = new(136441u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
public readonly Vftbl* ThisPtr;
private readonly Vftbl* thisPtr;
internal static unsafe ref readonly Guid IID
{
get
{
ReadOnlySpan<byte> data = [0xF9, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
@@ -25,31 +34,31 @@ internal unsafe struct IShellLinkW
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
public HRESULT SetShowCmd(SHOW_WINDOW_CMD iShowCmd)
{
return thisPtr->SetShowCmd((IShellLinkW*)Unsafe.AsPointer(ref this), iShowCmd);
return ThisPtr->SetShowCmd((IShellLinkW*)Unsafe.AsPointer(ref this), iShowCmd);
}
public HRESULT SetIconLocation(string szIconPath, int iIcon)
{
fixed (char* pszIconPath = szIconPath)
{
return thisPtr->SetIconLocation((IShellLinkW*)Unsafe.AsPointer(ref this), pszIconPath, iIcon);
return ThisPtr->SetIconLocation((IShellLinkW*)Unsafe.AsPointer(ref this), pszIconPath, iIcon);
}
}
@@ -57,7 +66,7 @@ internal unsafe struct IShellLinkW
{
fixed (char* pszFile = szFile)
{
return thisPtr->SetPath((IShellLinkW*)Unsafe.AsPointer(ref this), pszFile);
return ThisPtr->SetPath((IShellLinkW*)Unsafe.AsPointer(ref this), pszFile);
}
}

View File

@@ -1,9 +1,20 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Snap.Hutao.Win32.UI.Shell;
[Guid("00021401-0000-0000-C000-000000000046")]
internal readonly struct ShellLink
{
internal static Guid CLSID = new(136193u, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
internal static unsafe ref readonly Guid CLSID
{
get
{
ReadOnlySpan<byte> data = [0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
}