From 94fe192581c31729fb94bc0ac83b58992ec453c5 Mon Sep 17 00:00:00 2001 From: Lightczx <1686188646@qq.com> Date: Mon, 8 Apr 2024 11:25:32 +0800 Subject: [PATCH] add IFileOperation --- .../Snap.Hutao/Win32/Foundation/DECIMAL.cs | 60 +++++++++++++++ .../Com/StructuredStorage/PROPVARIANT.cs | 39 ++++++++++ .../Win32/System/Variant/VARENUM.cs | 60 +++++++++++++++ .../Win32/UI/Shell/FILEOPERATION_FLAGS.cs | 42 +++++++++++ .../Win32/UI/Shell/IFileOperation.cs | 74 +++++++++++++++++++ .../UI/Shell/IFileOperationProgressSink.cs | 69 +++++++++++++++++ .../UI/Shell/IOperationsProgressDialog.cs | 65 ++++++++++++++++ .../IObjectWithPropertyKey.cs | 55 ++++++++++++++ .../Shell/PropertiesSystem/IPropertyChange.cs | 55 ++++++++++++++ .../PropertiesSystem/IPropertyChangeArray.cs | 60 +++++++++++++++ .../UI/Shell/PropertiesSystem/PDOPSTATUS.cs | 13 ++++ .../UI/Shell/PropertiesSystem/PROPERTYKEY.cs | 11 +++ .../Snap.Hutao/Win32/UI/Shell/SPACTION.cs | 22 ++++++ 13 files changed, 625 insertions(+) create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/Foundation/DECIMAL.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/System/Com/StructuredStorage/PROPVARIANT.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/System/Variant/VARENUM.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/FILEOPERATION_FLAGS.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperation.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperationProgressSink.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IOperationsProgressDialog.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IObjectWithPropertyKey.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChange.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChangeArray.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PDOPSTATUS.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PROPERTYKEY.cs create mode 100644 src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/SPACTION.cs diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/Foundation/DECIMAL.cs b/src/Snap.Hutao/Snap.Hutao/Win32/Foundation/DECIMAL.cs new file mode 100644 index 00000000..f82bd0e9 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/Foundation/DECIMAL.cs @@ -0,0 +1,60 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Win32.Foundation; + +[SuppressMessage("", "SA1201")] +[SuppressMessage("", "SA1300")] +[SuppressMessage("", "SA1307")] +internal struct DECIMAL +{ + public ushort wReserved; + + public byte scale; + + public byte sign; + + public unsafe ushort signscale + { + get + { + fixed (DECIMAL* pThis = &this) + { + return *(ushort*)&pThis->scale; + } + } + + set + { + fixed (DECIMAL* pThis = &this) + { + *(ushort*)&pThis->scale = value; + } + } + } + + public uint Hi32; + + public uint Lo32; + + public uint Mid32; + + public unsafe ulong Lo64 + { + get + { + fixed (DECIMAL* pThis = &this) + { + return *(ulong*)&pThis->Lo32; + } + } + + set + { + fixed (DECIMAL* pThis = &this) + { + *(ulong*)&pThis->Lo32 = value; + } + } + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/System/Com/StructuredStorage/PROPVARIANT.cs b/src/Snap.Hutao/Snap.Hutao/Win32/System/Com/StructuredStorage/PROPVARIANT.cs new file mode 100644 index 00000000..e9510f88 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/System/Com/StructuredStorage/PROPVARIANT.cs @@ -0,0 +1,39 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Win32.Foundation; +using Snap.Hutao.Win32.System.Variant; + +namespace Snap.Hutao.Win32.System.Com.StructuredStorage; + +[SuppressMessage("", "IDE1006")] +[SuppressMessage("", "SA1300")] +[SuppressMessage("", "SA1307")] +internal struct PROPVARIANT +{ + public VARENUM vt; + public ushort wReserved1; + public ushort wReserved2; + public ushort wReserved3; + public nint Value; + + // https://learn.microsoft.com/zh-cn/windows/win32/api/propidlbase/ns-propidlbase-propvariant + public unsafe DECIMAL decVal + { + get + { + fixed (PROPVARIANT* pThis = &this) + { + return *(DECIMAL*)pThis; + } + } + + set + { + fixed (PROPVARIANT* pThis = &this) + { + *(DECIMAL*)pThis = value; + } + } + } +} diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/System/Variant/VARENUM.cs b/src/Snap.Hutao/Snap.Hutao/Win32/System/Variant/VARENUM.cs new file mode 100644 index 00000000..7f943f8b --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/System/Variant/VARENUM.cs @@ -0,0 +1,60 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Win32.System.Variant; + +internal enum VARENUM : ushort +{ + VT_EMPTY = 0, + VT_NULL = 1, + VT_I2 = 2, + VT_I4 = 3, + VT_R4 = 4, + VT_R8 = 5, + VT_CY = 6, + VT_DATE = 7, + VT_BSTR = 8, + VT_DISPATCH = 9, + VT_ERROR = 10, + VT_BOOL = 11, + VT_VARIANT = 12, + VT_UNKNOWN = 13, + VT_DECIMAL = 14, + VT_I1 = 16, + VT_UI1 = 17, + VT_UI2 = 18, + VT_UI4 = 19, + VT_I8 = 20, + VT_UI8 = 21, + VT_INT = 22, + VT_UINT = 23, + VT_VOID = 24, + VT_HRESULT = 25, + VT_PTR = 26, + VT_SAFEARRAY = 27, + VT_CARRAY = 28, + VT_USERDEFINED = 29, + VT_LPSTR = 30, + VT_LPWSTR = 31, + VT_RECORD = 36, + VT_INT_PTR = 37, + VT_UINT_PTR = 38, + VT_FILETIME = 64, + VT_BLOB = 65, + VT_STREAM = 66, + VT_STORAGE = 67, + VT_STREAMED_OBJECT = 68, + VT_STORED_OBJECT = 69, + VT_BLOB_OBJECT = 70, + VT_CF = 71, + VT_CLSID = 72, + VT_VERSIONED_STREAM = 73, + VT_BSTR_BLOB = 4095, + VT_VECTOR = 4096, + VT_ARRAY = 8192, + VT_BYREF = 16384, + VT_RESERVED = 32768, + VT_ILLEGAL = 65535, + VT_ILLEGALMASKED = 4095, + VT_TYPEMASK = 4095, +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/FILEOPERATION_FLAGS.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/FILEOPERATION_FLAGS.cs new file mode 100644 index 00000000..62ff7eb4 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/FILEOPERATION_FLAGS.cs @@ -0,0 +1,42 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Win32.UI.Shell; + +[Flags] +internal enum FILEOPERATION_FLAGS : uint +{ + FOFX_NOSKIPJUNCTIONS = 0x00010000, + FOFX_PREFERHARDLINK = 0x00020000, + FOFX_SHOWELEVATIONPROMPT = 0x00040000, + FOFX_RECYCLEONDELETE = 0x00080000, + FOFX_EARLYFAILURE = 0x00100000, + FOFX_PRESERVEFILEEXTENSIONS = 0x00200000, + FOFX_KEEPNEWERFILE = 0x00400000, + FOFX_NOCOPYHOOKS = 0x00800000, + FOFX_NOMINIMIZEBOX = 0x01000000, + FOFX_MOVEACLSACROSSVOLUMES = 0x02000000, + FOFX_DONTDISPLAYSOURCEPATH = 0x04000000, + FOFX_DONTDISPLAYDESTPATH = 0x08000000, + FOFX_REQUIREELEVATION = 0x10000000, + FOFX_ADDUNDORECORD = 0x20000000, + FOFX_COPYASDOWNLOAD = 0x40000000, + FOFX_DONTDISPLAYLOCATIONS = 0x80000000, + FOF_MULTIDESTFILES = 0x00000001, + FOF_CONFIRMMOUSE = 0x00000002, + FOF_SILENT = 0x00000004, + FOF_RENAMEONCOLLISION = 0x00000008, + FOF_NOCONFIRMATION = 0x00000010, + FOF_WANTMAPPINGHANDLE = 0x00000020, + FOF_ALLOWUNDO = 0x00000040, + FOF_FILESONLY = 0x00000080, + FOF_SIMPLEPROGRESS = 0x00000100, + FOF_NOCONFIRMMKDIR = 0x00000200, + FOF_NOERRORUI = 0x00000400, + FOF_NOCOPYSECURITYATTRIBS = 0x00000800, + FOF_NORECURSION = 0x00001000, + FOF_NO_CONNECTED_ELEMENTS = 0x00002000, + FOF_WANTNUKEWARNING = 0x00004000, + FOF_NORECURSEREPARSE = 0x00008000, + FOF_NO_UI = 0x00000614, +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperation.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperation.cs new file mode 100644 index 00000000..db14bbe7 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperation.cs @@ -0,0 +1,74 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Win32.Foundation; +using Snap.Hutao.Win32.System.Com; +using Snap.Hutao.Win32.UI.Shell.PropertiesSystem; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace Snap.Hutao.Win32.UI.Shell; + +[SupportedOSPlatform("windows6.0.6000")] +[Guid("947AAB5F-0A5C-4C13-B4D6-4BF7836FC9F8")] +internal unsafe struct IFileOperation +{ + public readonly Vftbl* ThisPtr; + + internal static unsafe ref readonly Guid IID + { + get + { + ReadOnlySpan data = [0x5F, 0xAB, 0x7A, 0x94, 0x5C, 0x0A, 0x13, 0x4C, 0xB4, 0xD6, 0x4B, 0xF7, 0x83, 0x6F, 0xC9, 0xF8]; + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + public unsafe HRESULT QueryInterface(ref readonly Guid riid, out TInterface* pvObject) + where TInterface : unmanaged + { + fixed (Guid* riid2 = &riid) + { + fixed (TInterface** ppvObject = &pvObject) + { + return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject); + } + } + } + + public uint AddRef() + { + return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this)); + } + + public uint Release() + { + return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this)); + } + + internal readonly struct Vftbl + { + internal readonly IUnknown.Vftbl IUnknownVftbl; + internal readonly delegate* unmanaged[Stdcall] Advise; + internal readonly delegate* unmanaged[Stdcall] Unadvise; + internal readonly delegate* unmanaged[Stdcall] SetOperationFlags; + internal readonly delegate* unmanaged[Stdcall] SetProgressMessage; + internal readonly delegate* unmanaged[Stdcall] SetProgressDialog; + internal readonly delegate* unmanaged[Stdcall] SetProperties; + internal readonly delegate* unmanaged[Stdcall] SetOwnerWindow; + internal readonly delegate* unmanaged[Stdcall] ApplyPropertiesToItem; + internal readonly delegate* unmanaged[Stdcall] ApplyPropertiesToItems; + internal readonly delegate* unmanaged[Stdcall] RenameItem; + internal readonly delegate* unmanaged[Stdcall] RenameItems; + internal readonly delegate* unmanaged[Stdcall] MoveItem; + internal readonly delegate* unmanaged[Stdcall] MoveItems; + internal readonly delegate* unmanaged[Stdcall] CopyItem; + internal readonly delegate* unmanaged[Stdcall] CopyItems; + internal readonly delegate* unmanaged[Stdcall] DeleteItem; + internal readonly delegate* unmanaged[Stdcall] DeleteItems; + internal readonly delegate* unmanaged[Stdcall] NewItem; + internal readonly delegate* unmanaged[Stdcall] PerformOperations; + internal readonly delegate* unmanaged[Stdcall] GetAnyOperationsAborted; + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperationProgressSink.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperationProgressSink.cs new file mode 100644 index 00000000..d1a59d71 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IFileOperationProgressSink.cs @@ -0,0 +1,69 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +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("04B0F1A7-9490-44BC-96E1-4296A31252E2")] +internal unsafe struct IFileOperationProgressSink +{ + public readonly Vftbl* ThisPtr; + + internal static unsafe ref readonly Guid IID + { + get + { + ReadOnlySpan data = [0xA7, 0xF1, 0xB0, 0x04, 0x90, 0x94, 0xBC, 0x44, 0x96, 0xE1, 0x42, 0x96, 0xA3, 0x12, 0x52, 0xE2]; + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + public unsafe HRESULT QueryInterface(ref readonly Guid riid, out TInterface* pvObject) + where TInterface : unmanaged + { + fixed (Guid* riid2 = &riid) + { + fixed (TInterface** ppvObject = &pvObject) + { + return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject); + } + } + } + + public uint AddRef() + { + return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this)); + } + + public uint Release() + { + return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this)); + } + + internal readonly struct Vftbl + { + internal readonly IUnknown.Vftbl IUnknownVftbl; + internal readonly delegate* unmanaged[Stdcall] StartOperations; + internal readonly delegate* unmanaged[Stdcall] FinishOperations; + internal readonly delegate* unmanaged[Stdcall] PreRenameItem; + internal readonly delegate* unmanaged[Stdcall] PostRenameItem; + internal readonly delegate* unmanaged[Stdcall] PreMoveItem; + internal readonly delegate* unmanaged[Stdcall] PostMoveItem; + internal readonly delegate* unmanaged[Stdcall] PreCopyItem; + internal readonly delegate* unmanaged[Stdcall] PostCopyItem; + internal readonly delegate* unmanaged[Stdcall] PreDeleteItem; + internal readonly delegate* unmanaged[Stdcall] PostDeleteItem; + internal readonly delegate* unmanaged[Stdcall] PreNewItem; + internal readonly delegate* unmanaged[Stdcall] PostNewItem; + internal readonly delegate* unmanaged[Stdcall] UpdateProgress; + internal readonly delegate* unmanaged[Stdcall] ResetTimer; + internal readonly delegate* unmanaged[Stdcall] PauseTimer; + internal readonly delegate* unmanaged[Stdcall] ResumeTimer; + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IOperationsProgressDialog.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IOperationsProgressDialog.cs new file mode 100644 index 00000000..8b8051bc --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/IOperationsProgressDialog.cs @@ -0,0 +1,65 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Win32.Foundation; +using Snap.Hutao.Win32.System.Com; +using Snap.Hutao.Win32.UI.Shell.PropertiesSystem; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace Snap.Hutao.Win32.UI.Shell; + +[SupportedOSPlatform("windows6.0.6000")] +[Guid("0C9FB851-E5C9-43EB-A370-F0677B13874C")] +internal unsafe struct IOperationsProgressDialog +{ + public readonly Vftbl* ThisPtr; + + internal static unsafe ref readonly Guid IID + { + get + { + ReadOnlySpan data = [0x51, 0xB8, 0x9F, 0x0C, 0xC9, 0xE5, 0xEB, 0x43, 0xA3, 0x70, 0xF0, 0x67, 0x7B, 0x13, 0x87, 0x4C]; + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + public unsafe HRESULT QueryInterface(ref readonly Guid riid, out TInterface* pvObject) + where TInterface : unmanaged + { + fixed (Guid* riid2 = &riid) + { + fixed (TInterface** ppvObject = &pvObject) + { + return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject); + } + } + } + + public uint AddRef() + { + return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this)); + } + + public uint Release() + { + return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this)); + } + + internal readonly struct Vftbl + { + internal readonly IUnknown.Vftbl IUnknownVftbl; + internal readonly delegate* unmanaged[Stdcall] StartProgressDialog; + internal readonly delegate* unmanaged[Stdcall] StopProgressDialog; + internal readonly delegate* unmanaged[Stdcall] SetOperation; + internal readonly delegate* unmanaged[Stdcall] SetMode; + internal readonly delegate* unmanaged[Stdcall] UpdateProgress; + internal readonly delegate* unmanaged[Stdcall] UpdateLocations; + internal readonly delegate* unmanaged[Stdcall] ResetTimer; + internal readonly delegate* unmanaged[Stdcall] PauseTimer; + internal readonly delegate* unmanaged[Stdcall] ResumeTimer; + internal readonly delegate* unmanaged[Stdcall] GetMilliseconds; + internal readonly delegate* unmanaged[Stdcall] GetOperationStatus; + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IObjectWithPropertyKey.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IObjectWithPropertyKey.cs new file mode 100644 index 00000000..6a87f128 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IObjectWithPropertyKey.cs @@ -0,0 +1,55 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +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.PropertiesSystem; + +[SupportedOSPlatform("windows6.0.6000")] +[Guid("FC0CA0A7-C316-4FD2-9031-3E628E6D4F23")] +internal unsafe struct IObjectWithPropertyKey +{ + public readonly Vftbl* ThisPtr; + + internal static unsafe ref readonly Guid IID + { + get + { + ReadOnlySpan data = [0xA7, 0xA0, 0x0C, 0xFC, 0x16, 0xC3, 0xD2, 0x4F, 0x90, 0x31, 0x3E, 0x62, 0x8E, 0x6D, 0x4F, 0x23]; + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + public unsafe HRESULT QueryInterface(ref readonly Guid riid, out TInterface* pvObject) + where TInterface : unmanaged + { + fixed (Guid* riid2 = &riid) + { + fixed (TInterface** ppvObject = &pvObject) + { + return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject); + } + } + } + + public uint AddRef() + { + return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this)); + } + + public uint Release() + { + return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this)); + } + + internal readonly struct Vftbl + { + internal readonly IUnknown.Vftbl IUnknownVftbl; + internal readonly delegate* unmanaged[Stdcall] SetPropertyKey; + internal readonly delegate* unmanaged[Stdcall] GetPropertyKey; + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChange.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChange.cs new file mode 100644 index 00000000..fad1241f --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChange.cs @@ -0,0 +1,55 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Win32.Foundation; +using Snap.Hutao.Win32.System.Com; +using Snap.Hutao.Win32.System.Com.StructuredStorage; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace Snap.Hutao.Win32.UI.Shell.PropertiesSystem; + +[SupportedOSPlatform("windows6.0.6000")] +[Guid("F917BC8A-1BBA-4478-A245-1BDE03EB9431")] +internal unsafe struct IPropertyChange +{ + public readonly Vftbl* ThisPtr; + + internal static unsafe ref readonly Guid IID + { + get + { + ReadOnlySpan data = [0x8A, 0xBC, 0x17, 0xF9, 0xBA, 0x1B, 0x78, 0x44, 0xA2, 0x45, 0x1B, 0xDE, 0x03, 0xEB, 0x94, 0x31]; + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + public unsafe HRESULT QueryInterface(ref readonly Guid riid, out TInterface* pvObject) + where TInterface : unmanaged + { + fixed (Guid* riid2 = &riid) + { + fixed (TInterface** ppvObject = &pvObject) + { + return ThisPtr->IObjectWithPropertyKeyVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject); + } + } + } + + public uint AddRef() + { + return ThisPtr->IObjectWithPropertyKeyVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this)); + } + + public uint Release() + { + return ThisPtr->IObjectWithPropertyKeyVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this)); + } + + internal readonly struct Vftbl + { + internal readonly IObjectWithPropertyKey.Vftbl IObjectWithPropertyKeyVftbl; + internal readonly delegate* unmanaged[Stdcall] ApplyToPropVariant; + } +} diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChangeArray.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChangeArray.cs new file mode 100644 index 00000000..806f7a09 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/IPropertyChangeArray.cs @@ -0,0 +1,60 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +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.PropertiesSystem; + +[SupportedOSPlatform("windows6.0.6000")] +[Guid("380F5CAD-1B5E-42F2-805D-637FD392D31E")] +internal unsafe struct IPropertyChangeArray +{ + public readonly Vftbl* ThisPtr; + + internal static unsafe ref readonly Guid IID + { + get + { + ReadOnlySpan data = [0xAD, 0x5C, 0x0F, 0x38, 0x5E, 0x1B, 0xF2, 0x42, 0x80, 0x5D, 0x63, 0x7F, 0xD3, 0x92, 0xD3, 0x1E]; + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + public unsafe HRESULT QueryInterface(ref readonly Guid riid, out TInterface* pvObject) + where TInterface : unmanaged + { + fixed (Guid* riid2 = &riid) + { + fixed (TInterface** ppvObject = &pvObject) + { + return ThisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject); + } + } + } + + public uint AddRef() + { + return ThisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this)); + } + + public uint Release() + { + return ThisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this)); + } + + internal readonly struct Vftbl + { + internal readonly IUnknown.Vftbl IUnknownVftbl; + internal readonly delegate* unmanaged[Stdcall] GetCount; + internal readonly delegate* unmanaged[Stdcall] GetAt; + internal readonly delegate* unmanaged[Stdcall] InsertAt; + internal readonly delegate* unmanaged[Stdcall] Append; + internal readonly delegate* unmanaged[Stdcall] AppendOrReplace; + internal readonly delegate* unmanaged[Stdcall] RemoveAt; + internal readonly delegate* unmanaged[Stdcall] IsKeyInArray; + } +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PDOPSTATUS.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PDOPSTATUS.cs new file mode 100644 index 00000000..921048b5 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PDOPSTATUS.cs @@ -0,0 +1,13 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Win32.UI.Shell.PropertiesSystem; + +internal enum PDOPSTATUS +{ + PDOPS_RUNNING = 1, + PDOPS_PAUSED = 2, + PDOPS_CANCELLED = 3, + PDOPS_STOPPED = 4, + PDOPS_ERRORS = 5, +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PROPERTYKEY.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PROPERTYKEY.cs new file mode 100644 index 00000000..40abcd8a --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/PropertiesSystem/PROPERTYKEY.cs @@ -0,0 +1,11 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Win32.UI.Shell.PropertiesSystem; + +[SuppressMessage("", "SA1307")] +internal struct PROPERTYKEY +{ + public Guid fmtid; + public uint pid; +} \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/SPACTION.cs b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/SPACTION.cs new file mode 100644 index 00000000..a9380c10 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Win32/UI/Shell/SPACTION.cs @@ -0,0 +1,22 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +namespace Snap.Hutao.Win32.UI.Shell; + +internal enum SPACTION +{ + SPACTION_NONE = 0, + SPACTION_MOVING = 1, + SPACTION_COPYING = 2, + SPACTION_RECYCLING = 3, + SPACTION_APPLYINGATTRIBS = 4, + SPACTION_DOWNLOADING = 5, + SPACTION_SEARCHING_INTERNET = 6, + SPACTION_CALCULATING = 7, + SPACTION_UPLOADING = 8, + SPACTION_SEARCHING_FILES = 9, + SPACTION_DELETING = 10, + SPACTION_RENAMING = 11, + SPACTION_FORMATTING = 12, + SPACTION_COPY_MOVING = 13, +} \ No newline at end of file