mirror of https://github.com/dahall/Vanara.git
Checkpoint
parent
620cda8594
commit
4f2bc5233c
|
@ -24,7 +24,7 @@
|
|||
<RepositoryUrl>https://github.com/dahall/vanara</RepositoryUrl>
|
||||
<RootNamespace>Vanara.PInvoke</RootNamespace>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<NoWarn>$(NoWarn);NETSDK1138;SYSLIB0003;SYSLIB0004;SYSLIB0011;IL2026;IL2075;IL2067;IL2070;IL2072;IL2077;IL2080;IL2087;IL2090;CS0618;CA1401;CA2101;</NoWarn>
|
||||
<NoWarn>$(NoWarn);NETSDK1138;SYSLIB0003;SYSLIB0004;SYSLIB0011;IL2026;IL2075;IL2067;IL2070;IL2072;IL2077;IL2080;IL2087;IL2090;CS0618;CA1401;CA2101;SYSLIB1054;</NoWarn>
|
||||
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
|
|
|
@ -3200,7 +3200,7 @@ public static partial class MsftEdit
|
|||
// dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] LPCRECTL
|
||||
// lprcBounds, [in] LPCRECTL lprcWBounds, [in] LPRECT lprcUpdate, BOOL(* )(DWORD) pfnContinue, DWORD dwContinue, LONG lViewId );
|
||||
[PreserveSig]
|
||||
HRESULT TxDraw(DVASPECT dwDrawAspect, int lindex, IntPtr pvAspect, in DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcBounds,
|
||||
HRESULT TxDraw(DVASPECT dwDrawAspect, int lindex, IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcBounds,
|
||||
in RECT lprcWBounds, in RECT lprcUpdate, IntPtr pfnContinue, uint dwContinue, TXTVIEW lViewId);
|
||||
|
||||
/// <summary>Returns horizontal scroll bar information.</summary>
|
||||
|
@ -3386,7 +3386,7 @@ public static partial class MsftEdit
|
|||
// DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in]
|
||||
// LPCRECT lprcClient, [in] INT x, [in] INT y );
|
||||
[PreserveSig]
|
||||
HRESULT OnTxSetCursor(uint dwDrawAspect, int lindex, [In] IntPtr pvAspect, in DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y);
|
||||
HRESULT OnTxSetCursor(uint dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y);
|
||||
|
||||
/// <summary>Tests whether a specified point is within the rectangle of the text services object.</summary>
|
||||
/// <param name="dwDrawAspect">
|
||||
|
@ -3485,7 +3485,7 @@ public static partial class MsftEdit
|
|||
// [in] DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in]
|
||||
// LPCRECT lprcClient, [in] INT x, [in] INT y, [out] DWORD *pHitResult );
|
||||
[PreserveSig]
|
||||
HRESULT TxQueryHitPoint(DVASPECT dwDrawAspect, int lindex, [In] IntPtr pvAspect, in DVTARGETDEVICE ptd, [In] HDC hdcDraw,
|
||||
HRESULT TxQueryHitPoint(DVASPECT dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw,
|
||||
[In] HDC hicTargetDev, in RECT lprcClient, int x, int y, out uint pHitResult);
|
||||
|
||||
/// <summary>Notifies the text services object that this control is in-place active.</summary>
|
||||
|
@ -3833,7 +3833,7 @@ public static partial class MsftEdit
|
|||
// DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, const SIZEL *psizelExtent, [in, out] LONG
|
||||
// *pwidth, [in, out] LONG *pheight );
|
||||
[PreserveSig]
|
||||
HRESULT TxGetNaturalSize(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, in DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight);
|
||||
HRESULT TxGetNaturalSize(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, [In] DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight);
|
||||
|
||||
/// <summary>Gets the drop target for the text control.</summary>
|
||||
/// <param name="ppDropTarget">
|
||||
|
@ -4314,7 +4314,7 @@ public static partial class MsftEdit
|
|||
// dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] LPCRECTL
|
||||
// lprcBounds, [in] LPCRECTL lprcWBounds, [in] LPRECT lprcUpdate, BOOL(* )(DWORD) pfnContinue, DWORD dwContinue, LONG lViewId );
|
||||
[PreserveSig]
|
||||
new HRESULT TxDraw(DVASPECT dwDrawAspect, int lindex, IntPtr pvAspect, in DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcBounds,
|
||||
new HRESULT TxDraw(DVASPECT dwDrawAspect, int lindex, IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcBounds,
|
||||
in RECT lprcWBounds, in RECT lprcUpdate, IntPtr pfnContinue, uint dwContinue, TXTVIEW lViewId);
|
||||
|
||||
/// <summary>Returns horizontal scroll bar information.</summary>
|
||||
|
@ -4500,7 +4500,7 @@ public static partial class MsftEdit
|
|||
// DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in]
|
||||
// LPCRECT lprcClient, [in] INT x, [in] INT y );
|
||||
[PreserveSig]
|
||||
new HRESULT OnTxSetCursor(uint dwDrawAspect, int lindex, [In] IntPtr pvAspect, in DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y);
|
||||
new HRESULT OnTxSetCursor(uint dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y);
|
||||
|
||||
/// <summary>Tests whether a specified point is within the rectangle of the text services object.</summary>
|
||||
/// <param name="dwDrawAspect">
|
||||
|
@ -4599,7 +4599,7 @@ public static partial class MsftEdit
|
|||
// [in] DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in]
|
||||
// LPCRECT lprcClient, [in] INT x, [in] INT y, [out] DWORD *pHitResult );
|
||||
[PreserveSig]
|
||||
new HRESULT TxQueryHitPoint(DVASPECT dwDrawAspect, int lindex, [In] IntPtr pvAspect, in DVTARGETDEVICE ptd, [In] HDC hdcDraw,
|
||||
new HRESULT TxQueryHitPoint(DVASPECT dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw,
|
||||
[In] HDC hicTargetDev, in RECT lprcClient, int x, int y, out uint pHitResult);
|
||||
|
||||
/// <summary>Notifies the text services object that this control is in-place active.</summary>
|
||||
|
@ -4947,7 +4947,7 @@ public static partial class MsftEdit
|
|||
// DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, const SIZEL *psizelExtent, [in, out] LONG
|
||||
// *pwidth, [in, out] LONG *pheight );
|
||||
[PreserveSig]
|
||||
new HRESULT TxGetNaturalSize(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, in DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight);
|
||||
new HRESULT TxGetNaturalSize(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, [In] DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight);
|
||||
|
||||
/// <summary>Gets the drop target for the text control.</summary>
|
||||
/// <param name="ppDropTarget">
|
||||
|
@ -5330,7 +5330,7 @@ public static partial class MsftEdit
|
|||
// TxGetNaturalSize2( DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, const SIZEL *psizelExtent,
|
||||
// LONG *pwidth, LONG *pheight, LONG *pascent );
|
||||
[PreserveSig]
|
||||
HRESULT TxGetNaturalSize2(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, in DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight, out int pascent);
|
||||
HRESULT TxGetNaturalSize2(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, [In] DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight, out int pascent);
|
||||
|
||||
/// <summary>Draws the text services object by using Direct2D rendering.</summary>
|
||||
/// <param name="pRenderTarget">
|
||||
|
|
|
@ -700,7 +700,7 @@ public static partial class Ole32
|
|||
// rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "7295a55b-12c7-4ed0-a7a4-9ecee16afdec")]
|
||||
public static extern HRESULT CoCreateInstance(in Guid rclsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object pUnkOuter,
|
||||
public static extern HRESULT CoCreateInstance(in Guid rclsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object? pUnkOuter,
|
||||
CLSCTX dwClsContext, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object ppv);
|
||||
|
||||
/// <summary>
|
||||
|
@ -800,8 +800,8 @@ public static partial class Ole32
|
|||
// REFCLSID Clsid, IUnknown *punkOuter, DWORD dwClsCtx, COSERVERINFO *pServerInfo, DWORD dwCount, MULTI_QI *pResults );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "3b414b95-e8d2-42e8-b4f2-5cc5189a3d08")]
|
||||
public static extern HRESULT CoCreateInstanceEx(in Guid Clsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object punkOuter,
|
||||
CLSCTX dwClsCtx, [Optional] COSERVERINFO pServerInfo, uint dwCount,
|
||||
public static extern HRESULT CoCreateInstanceEx(in Guid Clsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object? punkOuter,
|
||||
CLSCTX dwClsCtx, [Optional] COSERVERINFO? pServerInfo, uint dwCount,
|
||||
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] MULTI_QI[] pResults);
|
||||
|
||||
/// <summary>Creates an instance of a specific class on a specific computer from within an app container.</summary>
|
||||
|
@ -881,7 +881,7 @@ public static partial class Ole32
|
|||
// CoCreateInstanceFromApp( REFCLSID Clsid, IUnknown *punkOuter, DWORD dwClsCtx, PVOID reserved, DWORD dwCount, MULTI_QI *pResults );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "1C773D78-5B33-44FE-A09B-AB8087F678A1")]
|
||||
public static extern HRESULT CoCreateInstanceFromApp(in Guid Clsid, [MarshalAs(UnmanagedType.IUnknown)] object punkOuter, uint dwClsCtx, IntPtr reserved, uint dwCount, ref MULTI_QI pResults);
|
||||
public static extern HRESULT CoCreateInstanceFromApp(in Guid Clsid, [MarshalAs(UnmanagedType.IUnknown)] object? punkOuter, uint dwClsCtx, IntPtr reserved, uint dwCount, ref MULTI_QI pResults);
|
||||
|
||||
/// <summary>
|
||||
/// Locates the implementation of a Component Object Model (COM) interface in a server process given an interface to a proxied object.
|
||||
|
@ -1594,7 +1594,7 @@ public static partial class Ole32
|
|||
// rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID riid, LPVOID *ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "65e758ce-50a4-49e8-b3b2-0cd148d2781a")]
|
||||
public static extern HRESULT CoGetClassObject(in Guid rclsid, CLSCTX dwClsContext, IntPtr pvReserved, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object ppv);
|
||||
public static extern HRESULT CoGetClassObject(in Guid rclsid, CLSCTX dwClsContext, [Optional] IntPtr pvReserved, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object ppv);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -1743,7 +1743,7 @@ public static partial class Ole32
|
|||
// rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID riid, LPVOID *ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "65e758ce-50a4-49e8-b3b2-0cd148d2781a")]
|
||||
public static extern HRESULT CoGetClassObject(in Guid rclsid, CLSCTX dwClsContext, [In, Optional] COSERVERINFO pvReserved, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object ppv);
|
||||
public static extern HRESULT CoGetClassObject(in Guid rclsid, CLSCTX dwClsContext, [In, Optional] COSERVERINFO? pvReserved, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object ppv);
|
||||
|
||||
/// <summary>Returns a pointer to an implementation of IObjContext for the current context.</summary>
|
||||
/// <param name="pToken">A pointer to an implementation of IObjContext for the current context.</param>
|
||||
|
@ -2225,7 +2225,7 @@ public static partial class Ole32
|
|||
// REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL *ppMarshal );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "0cb74adc-e192-4ae5-9267-02c79e301681")]
|
||||
public static extern HRESULT CoGetStandardMarshal(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnk,
|
||||
public static extern HRESULT CoGetStandardMarshal(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnk,
|
||||
MSHCTX dwDestContext, [Optional] IntPtr pvDestContext, MSHLFLAGS mshlflags, out IMarshal ppMarshal);
|
||||
|
||||
/// <summary>Creates an aggregated standard marshaler for use with lightweight client-side handlers.</summary>
|
||||
|
@ -2701,7 +2701,7 @@ public static partial class Ole32
|
|||
// CoMarshalInterThreadInterfaceInStream( REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "c9ab8713-8604-4f0b-a11b-bdfb7d595d95")]
|
||||
public static extern HRESULT CoMarshalInterThreadInterfaceInStream(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnk, out IStream ppStm);
|
||||
public static extern HRESULT CoMarshalInterThreadInterfaceInStream(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnk, out IStream ppStm);
|
||||
|
||||
/// <summary>Retrieves a list of the authentication services registered when the process called CoInitializeSecurity.</summary>
|
||||
/// <param name="pcAuthSvc">A pointer to a variable that receives the number of entries returned in the asAuthSvc array.</param>
|
||||
|
@ -3253,7 +3253,7 @@ public static partial class Ole32
|
|||
// IUnknown *pUnk );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "0978e252-2206-4597-abf2-fe0dac32efc4")]
|
||||
public static extern HRESULT CoSetCancelObject([In, MarshalAs(UnmanagedType.IUnknown)] object pUnk);
|
||||
public static extern HRESULT CoSetCancelObject([In, MarshalAs(UnmanagedType.IUnknown)] object? pUnk);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the authentication information that will be used to make calls on the specified proxy. This is a helper function for IClientSecurity::SetBlanket.
|
||||
|
@ -3375,7 +3375,7 @@ public static partial class Ole32
|
|||
[PInvokeData("combaseapi.h", MSDNShortId = "c2e5e681-8fa5-4b02-b59d-ba796eb0dccf")]
|
||||
public static extern HRESULT CoSetProxyBlanket([In, MarshalAs(UnmanagedType.IUnknown)] object pProxy,
|
||||
RPC_C_AUTHN dwAuthnSvc = RPC_C_AUTHN.RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ dwAuthzSvc = RPC_C_AUTHZ.RPC_C_AUTHZ_DEFAULT,
|
||||
string pServerPrincName = COLE_DEFAULT_PRINCIPAL, RPC_C_AUTHN_LEVEL dwAuthnLevel = RPC_C_AUTHN_LEVEL.RPC_C_AUTHN_LEVEL_DEFAULT,
|
||||
string? pServerPrincName = COLE_DEFAULT_PRINCIPAL, RPC_C_AUTHN_LEVEL dwAuthnLevel = RPC_C_AUTHN_LEVEL.RPC_C_AUTHN_LEVEL_DEFAULT,
|
||||
RPC_C_IMP_LEVEL dwImpLevel = RPC_C_IMP_LEVEL.RPC_C_IMP_LEVEL_DEFAULT, RPC_AUTH_IDENTITY_HANDLE pAuthInfo = default,
|
||||
EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities = EOLE_AUTHENTICATION_CAPABILITIES.EOAC_DEFAULT);
|
||||
|
||||
|
@ -3439,7 +3439,7 @@ public static partial class Ole32
|
|||
// IUnknown *pNewObject, IUnknown **ppOldObject );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "146855a2-97ec-4e71-88dc-316eaa1a24a0")]
|
||||
public static extern HRESULT CoSwitchCallContext([In, MarshalAs(UnmanagedType.IUnknown)] object pNewObject,
|
||||
public static extern HRESULT CoSwitchCallContext([In, MarshalAs(UnmanagedType.IUnknown)] object? pNewObject,
|
||||
[MarshalAs(UnmanagedType.IUnknown)] out object ppOldObject);
|
||||
|
||||
/// <summary>Allocates a block of task memory in the same way that IMalloc::Alloc does.</summary>
|
||||
|
@ -3899,7 +3899,7 @@ public static partial class Ole32
|
|||
// CreateStreamOnHGlobal( HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "413c107b-a943-4c02-9c00-aea708e876d7")]
|
||||
public static extern HRESULT CreateStreamOnHGlobal(IntPtr hGlobal, [MarshalAs(UnmanagedType.Bool)] bool fDeleteOnRelease, out IStream ppstm);
|
||||
public static extern HRESULT CreateStreamOnHGlobal([Optional] IntPtr hGlobal, [MarshalAs(UnmanagedType.Bool)] bool fDeleteOnRelease, out IStream ppstm);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Determines whether the DLL that implements this function is in use. If not, the caller can unload the DLL from memory.</para>
|
||||
|
@ -4017,7 +4017,7 @@ public static partial class Ole32
|
|||
// FreePropVariantArray( ULONG cVariants, PROPVARIANT *rgvars );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("combaseapi.h", MSDNShortId = "2eefb57e-9311-46e1-9eed-e25aa3b5afaa")]
|
||||
public static extern HRESULT FreePropVariantArray(uint cVariants, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPVARIANT[] rgvars);
|
||||
public static extern HRESULT FreePropVariantArray(uint cVariants, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPVARIANT[]? rgvars);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>GetHGlobalFromStream</c> function retrieves the global memory handle to a stream that was created through a call to the
|
||||
|
|
|
@ -6,19 +6,19 @@ namespace Vanara.PInvoke;
|
|||
public static partial class Ole32
|
||||
{
|
||||
/// <summary>Browsable Shell Extention</summary>
|
||||
public static readonly Guid CATID_BrowsableShellExt = new Guid(0x00021490, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
public static readonly Guid CATID_BrowsableShellExt = new(0x00021490, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
|
||||
/// <summary>The catid browse in place</summary>
|
||||
public static readonly Guid CATID_BrowseInPlace = new Guid(0x00021491, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
public static readonly Guid CATID_BrowseInPlace = new(0x00021491, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
|
||||
/// <summary>Desk Band</summary>
|
||||
public static readonly Guid CATID_DeskBand = new Guid(0x00021492, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
public static readonly Guid CATID_DeskBand = new(0x00021492, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
|
||||
/// <summary>Vertical Explorer Bar</summary>
|
||||
public static readonly Guid CATID_InfoBand = new Guid(0x00021493, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
public static readonly Guid CATID_InfoBand = new(0x00021493, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
|
||||
/// <summary>Horizontal Explorer Bar</summary>
|
||||
public static readonly Guid CATID_CommBand = new Guid(0x00021494, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
public static readonly Guid CATID_CommBand = new(0x00021494, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
|
||||
|
||||
/// <summary>
|
||||
/// Obtains information about the categories implemented or required by a certain class, as well as information about the categories
|
||||
|
|
|
@ -7,17 +7,16 @@ namespace Vanara.PInvoke;
|
|||
public static partial class Ole32
|
||||
{
|
||||
/// <summary>CLSID_ContextSwitcher</summary>
|
||||
public static readonly Guid CLSID_ContextSwitcher = new Guid(0x0000034e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
|
||||
public static readonly Guid CLSID_ContextSwitcher = new(0x0000034e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
|
||||
|
||||
/// <summary>IID_ICallbackWithNoReentrancyToApplicationSTA</summary>
|
||||
public static readonly Guid IID_ICallbackWithNoReentrancyToApplicationSTA = new Guid(0x0a299774, 0x3e4e, 0xfc42, 0x1d, 0x9d, 0x72, 0xce, 0xe1, 0x05, 0xca, 0x57);
|
||||
public static readonly Guid IID_ICallbackWithNoReentrancyToApplicationSTA = new(0x0a299774, 0x3e4e, 0xfc42, 0x1d, 0x9d, 0x72, 0xce, 0xe1, 0x05, 0xca, 0x57);
|
||||
|
||||
/// <summary>IID_IEnterActivityWithNoLock</summary>
|
||||
public static readonly Guid IID_IEnterActivityWithNoLock = new Guid(0xd7174f82, 0x36b8, 0x4aa8, 0x80, 0x0a, 0xe9, 0x63, 0xab, 0x2d, 0xfa, 0xb9);
|
||||
public static readonly Guid IID_IEnterActivityWithNoLock = new(0xd7174f82, 0x36b8, 0x4aa8, 0x80, 0x0a, 0xe9, 0x63, 0xab, 0x2d, 0xfa, 0xb9);
|
||||
|
||||
/// <summary>
|
||||
/// The function to be called inside the object context if <see cref="IContextCallback.ContextCallback(PFNCONTEXTCALL, in
|
||||
/// ComCallData, in Guid, int, IntPtr)"/>.
|
||||
/// The function to be called inside the object context if <see cref="IContextCallback.ContextCallback"/>.
|
||||
/// </summary>
|
||||
/// <param name="data">The data passed to the function when it is called in the context.</param>
|
||||
/// <returns>The result. Typically the result of <see cref="CoDisconnectContext(uint)"/>.</returns>
|
||||
|
@ -59,12 +58,8 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ctxtcall/nf-ctxtcall-icontextcallback-contextcallback
|
||||
[PreserveSig]
|
||||
HRESULT ContextCallback(
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] PFNCONTEXTCALL pfnCallback,
|
||||
in ComCallData pParam,
|
||||
in Guid riid,
|
||||
int iMethod,
|
||||
[In, Optional] IntPtr pUnk);
|
||||
HRESULT ContextCallback([MarshalAs(UnmanagedType.FunctionPtr)] PFNCONTEXTCALL pfnCallback, in ComCallData pParam, in Guid riid,
|
||||
int iMethod, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pUnk);
|
||||
}
|
||||
|
||||
/// <summary/>
|
||||
|
@ -86,15 +81,5 @@ public static partial class Ole32
|
|||
/// <remarks>An instance of this interface for the current context can be obtained using CoGetObjectContext.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ctxtcall/nn-ctxtcall-icontextcallback
|
||||
[ComImport, Guid("0000034e-0000-0000-C000-000000000046"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class ContextSwitcher : IContextCallback
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
public virtual extern HRESULT ContextCallback(
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] PFNCONTEXTCALL pfnCallback,
|
||||
in ComCallData pParam,
|
||||
in Guid riid,
|
||||
int iMethod,
|
||||
IntPtr pUnk = new IntPtr());
|
||||
}
|
||||
public class ContextSwitcher { }
|
||||
}
|
|
@ -832,7 +832,7 @@ public static partial class Ole32
|
|||
/// <param name="pvaOut">Pointer to a VARIANTARG structure to receive command output. This parameter can be NULL.</param>
|
||||
/// <returns>This method returns S_OK on success.</returns>
|
||||
[PreserveSig]
|
||||
HRESULT Exec([In, Optional] GuidPtr pguidCmdGroup, uint nCmdID, uint nCmdexecopt, [In, Optional] /* VARIANT* */ IntPtr pvaIn, [In, Out, Optional] /* VARIANT* */ IntPtr pvaOut);
|
||||
HRESULT Exec([In, Optional] GuidPtr pguidCmdGroup, uint nCmdID, uint nCmdexecopt, [In, Optional] object? pvaIn, [In, Out, Optional] object? pvaOut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -900,7 +900,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/docobj/nf-docobj-ioledocument-createview HRESULT CreateView(
|
||||
// IOleInPlaceSite *pIPSite, IStream *pstm, DWORD dwReserved, IOleDocumentView **ppView );
|
||||
[PreserveSig]
|
||||
HRESULT CreateView([In, Optional] IOleInPlaceSite pIPSite, [In, Optional] IStream pstm, [In, Optional] uint dwReserved, out IOleDocumentView ppView);
|
||||
HRESULT CreateView([In, Optional] IOleInPlaceSite? pIPSite, [In, Optional] IStream? pstm, [In, Optional] uint dwReserved, out IOleDocumentView ppView);
|
||||
|
||||
/// <summary>Retrieves status information about the document object.</summary>
|
||||
/// <param name="pdwStatus">
|
||||
|
@ -1059,7 +1059,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/docobj/nf-docobj-ioledocumentsite-activateme HRESULT ActivateMe(
|
||||
// IOleDocumentView *pViewToActivate );
|
||||
[PreserveSig]
|
||||
HRESULT ActivateMe([In] IOleDocumentView pViewToActivate);
|
||||
HRESULT ActivateMe([In] IOleDocumentView? pViewToActivate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1127,7 +1127,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/docobj/nf-docobj-ioledocumentview-setinplacesite HRESULT SetInPlaceSite(
|
||||
// IOleInPlaceSite *pIPSite );
|
||||
[PreserveSig]
|
||||
HRESULT SetInPlaceSite([In, Optional] IOleInPlaceSite pIPSite);
|
||||
HRESULT SetInPlaceSite([In, Optional] IOleInPlaceSite? pIPSite);
|
||||
|
||||
/// <summary>Retrieves the view site associated with this view object.</summary>
|
||||
/// <param name="ppIPSite">
|
||||
|
@ -1313,7 +1313,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/docobj/nf-docobj-ioledocumentview-setrectcomplex HRESULT SetRectComplex(
|
||||
// LPRECT prcView, LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox );
|
||||
[PreserveSig]
|
||||
HRESULT SetRectComplex([In, Optional] PRECT prcView, [In, Optional] PRECT prcHScroll, [In, Optional] PRECT prcVScroll, [In, Optional] PRECT prcSizeBox);
|
||||
HRESULT SetRectComplex([In, Optional] PRECT? prcView, [In, Optional] PRECT? prcHScroll, [In, Optional] PRECT? prcVScroll, [In, Optional] PRECT? prcSizeBox);
|
||||
|
||||
/// <summary>Activates or deactivates a view.</summary>
|
||||
/// <param name="fShow">If <c>TRUE</c>, the view is to show itself. If <c>FALSE</c>, the view is to hide itself.</param>
|
||||
|
@ -1607,7 +1607,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/docobj/nf-docobj-ioledocumentview-clone HRESULT Clone( IOleInPlaceSite
|
||||
// *pIPSiteNew, IOleDocumentView **ppViewNew );
|
||||
[PreserveSig]
|
||||
HRESULT Clone(IOleInPlaceSite pIPSiteNew, out IOleDocumentView ppViewNew);
|
||||
HRESULT Clone(IOleInPlaceSite? pIPSiteNew, out IOleDocumentView ppViewNew);
|
||||
}
|
||||
|
||||
/// <summary>Enables compound documents in general and active documents in particular to support programmatic printing.</summary>
|
||||
|
@ -1743,7 +1743,7 @@ public static partial class Ole32
|
|||
// *pcPagesPrinted, LONG *pnLastPage );
|
||||
[PreserveSig]
|
||||
HRESULT Print(PRINTFLAG grfFlags, [In, Out] IntPtr /*DVTARGETDEVICE** */ pptd, [In, Out] IntPtr /*PAGESET***/ ppPageSet,
|
||||
[In, Out, Optional] IntPtr /*STGMEDIUM**/ pstgmOptions, [In] IContinueCallback pcallback, int nFirstPage,
|
||||
[In, Out, Optional] IntPtr /*STGMEDIUM**/ pstgmOptions, [In] IContinueCallback? pcallback, int nFirstPage,
|
||||
out int pcPagesPrinted, out int pnLastPage);
|
||||
}
|
||||
|
||||
|
@ -1903,13 +1903,13 @@ public static partial class Ole32
|
|||
/// Gets or sets the command name or status text. When setting, this value must not be longer than <see cref="cwBuf"/> and the
|
||||
/// <see cref="cwActual"/> field will be updated based on the character count of the value provided.
|
||||
/// </summary>
|
||||
public string rgwz
|
||||
public string? rgwz
|
||||
#pragma warning restore IDE1006 // Naming Styles
|
||||
{
|
||||
get => cwBuf > 0 ? _rgwz.ToString() : null;
|
||||
set
|
||||
{
|
||||
if (value == null) value = string.Empty;
|
||||
value ??= string.Empty;
|
||||
if (value.Length + 1 > cwBuf)
|
||||
throw new ArgumentOutOfRangeException(nameof(rgwz), "Set value must be of a length that will fit into supplied buffer of length 'cwBuf'.");
|
||||
unsafe
|
||||
|
|
|
@ -7,6 +7,73 @@ namespace Vanara.PInvoke;
|
|||
|
||||
public static partial class Ole32
|
||||
{
|
||||
/// <summary>
|
||||
/// The following values are used as flags in the access mask of an Access Control Entry (ACE) in a component-related security descriptor.
|
||||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-coma/a7395012-15a8-4f7c-ada9-d16bef022be3
|
||||
[PInvokeData("combaseapi.h")]
|
||||
[Flags]
|
||||
public enum COM_RIGHTS : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// In an OldVersionComponentAccessMask (section 2.2.2.21.1.2), this value represents a combination of all of the rights represented
|
||||
/// by COM_RIGHTS_EXECUTE_LOCAL, COM_RIGHTS_EXECUTE_REMOTE, COM_RIGHTS_ACTIVATE_LOCAL, and COM_RIGHTS_ACTIVATE_REMOTE.
|
||||
/// <para>
|
||||
/// In a NewVersionComponentAccessMask (section 2.2.2.21.1.3), this flag has no specific meaning but is required to be set for
|
||||
/// historical reasons.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
COM_RIGHTS_EXECUTE = 0x00000001,
|
||||
|
||||
/// <summary>
|
||||
/// In a NewVersionComponentAccessMask, this value represents the right of a security principal to use ORB-specific local mechanisms
|
||||
/// to cause a component to be executed, where the precise meaning of execute depends on the context.
|
||||
/// <para>
|
||||
/// In a component access security descriptor, this right controls whether or not a principal is authorized to execute method calls
|
||||
/// on component instances.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// In a component launch security descriptor, this right controls whether or not a principal is authorized to create a process in
|
||||
/// which the component will be hosted.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
COM_RIGHTS_EXECUTE_LOCAL = 0x00000002,
|
||||
|
||||
/// <summary>
|
||||
/// In a NewVersionComponentAccessMask, this value represents the right of a security principal to use ORB-specific remote mechanisms
|
||||
/// to cause a component to be executed, where the precise meaning of execute depends on the context.
|
||||
/// <para>
|
||||
/// In a component access security descriptor, this right controls whether or not a principal is authorized to execute method calls
|
||||
/// on component instances.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// In a component launch security descriptor, this right controls whether or not a principal is authorized to create a process in
|
||||
/// which the component will be hosted.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
COM_RIGHTS_EXECUTE_REMOTE = 0x00000004,
|
||||
|
||||
/// <summary>
|
||||
/// In a NewVersionComponentAccessMask, this value represents the right of a security principal to use ORB-specific local mechanisms
|
||||
/// to activate a component.
|
||||
/// <para>This right is meaningful only in a component launch security descriptor.</para>
|
||||
/// </summary>
|
||||
COM_RIGHTS_ACTIVATE_LOCAL = 0x00000008,
|
||||
|
||||
/// <summary>
|
||||
/// In a NewVersionComponentAccessMask, this value represents the right of a security principal to use ORB-specific local mechanisms
|
||||
/// to activate a component.
|
||||
/// <para>This right is meaningful only in a component launch security descriptor.</para>
|
||||
/// </summary>
|
||||
COM_RIGHTS_ACTIVATE_REMOTE = 0x000000010,
|
||||
|
||||
/// <summary></summary>
|
||||
COM_RIGHTS_RESERVED1 = 32,
|
||||
|
||||
/// <summary></summary>
|
||||
COM_RIGHTS_RESERVED2 = 64,
|
||||
}
|
||||
|
||||
/// <summary>Enables the management of access to objects and properties on the objects.</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/iaccess/nn-iaccess-iaccesscontrol
|
||||
[PInvokeData("iaccess.h", MSDNShortId = "NN:iaccess.IAccessControl")]
|
||||
|
@ -79,7 +146,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/iaccess/nf-iaccess-iaccesscontrol-revokeaccessrights HRESULT
|
||||
// RevokeAccessRights( LPWSTR lpProperty, ULONG cTrustees, TRUSTEEW [] prgTrustees );
|
||||
[PreserveSig]
|
||||
HRESULT RevokeAccessRights([MarshalAs(UnmanagedType.LPWStr)] string lpProperty, uint cTrustees,
|
||||
HRESULT RevokeAccessRights([MarshalAs(UnmanagedType.LPWStr)] string? lpProperty, uint cTrustees,
|
||||
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TRUSTEE[] prgTrustees);
|
||||
|
||||
/// <summary>Gets the entire list of access rights and/or the owner and group for the specified object.</summary>
|
||||
|
@ -109,7 +176,7 @@ public static partial class Ole32
|
|||
// GetAllAccessRights( LPWSTR lpProperty, PACTRL_ACCESSW_ALLOCATE_ALL_NODES *ppAccessList, PTRUSTEEW *ppOwner, PTRUSTEEW
|
||||
// *ppGroup );
|
||||
[PreserveSig]
|
||||
HRESULT GetAllAccessRights([MarshalAs(UnmanagedType.LPWStr)] string lpProperty, out SafeCoTaskMemHandle ppAccessList,
|
||||
HRESULT GetAllAccessRights([MarshalAs(UnmanagedType.LPWStr)] string? lpProperty, out SafeCoTaskMemHandle ppAccessList,
|
||||
out SafeCoTaskMemHandle ppOwner, out SafeCoTaskMemHandle ppGroup);
|
||||
|
||||
/// <summary>Determines whether the specified trustee has access rights to the object or property.</summary>
|
||||
|
@ -451,7 +518,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/iaccess/nf-iaccess-iaccesscontrol-isaccessallowed HRESULT IsAccessAllowed(
|
||||
// PTRUSTEEW pTrustee, LPWSTR lpProperty, ACCESS_RIGHTS AccessRights, BOOL *pfAccessAllowed );
|
||||
[PreserveSig]
|
||||
HRESULT IsAccessAllowed(in TRUSTEE pTrustee, [MarshalAs(UnmanagedType.LPWStr)] string lpProperty, uint AccessRights,
|
||||
HRESULT IsAccessAllowed(in TRUSTEE pTrustee, [MarshalAs(UnmanagedType.LPWStr)] string? lpProperty, COM_RIGHTS AccessRights,
|
||||
[MarshalAs(UnmanagedType.Bool)] out bool pfAccessAllowed);
|
||||
}
|
||||
}
|
|
@ -378,11 +378,11 @@ public static partial class Ole32
|
|||
// CoSetMessageDispatcher( PMessageDispatcher pMessageDispatcher );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("messagedispatcherapi.h", MSDNShortId = "3D6CFE01-8D3D-474E-A7D0-9B129ECD4EEA")]
|
||||
public static extern void CoSetMessageDispatcher(IMessageDispatcher pMessageDispatcher);
|
||||
public static extern void CoSetMessageDispatcher(IMessageDispatcher? pMessageDispatcher);
|
||||
|
||||
|
||||
/// <summary>Marshals HSTRING values.</summary>
|
||||
/// <seealso cref="System.Runtime.InteropServices.ICustomMarshaler"/>
|
||||
/// <seealso cref="ICustomMarshaler"/>
|
||||
internal class HStringMarshaler : ICustomMarshaler
|
||||
{
|
||||
private HStringMarshaler(string cookie)
|
||||
|
@ -426,18 +426,130 @@ public static partial class Ole32
|
|||
/// <param name="pNativeData">A pointer to the unmanaged data to be wrapped.</param>
|
||||
/// <returns>Returns the managed view of the COM data.</returns>
|
||||
[SecurityCritical]
|
||||
public object MarshalNativeToManaged(IntPtr pNativeData) => pNativeData == IntPtr.Zero ? null : (string)WindowsGetStringRawBuffer(pNativeData, out var len);
|
||||
public object MarshalNativeToManaged(IntPtr pNativeData) => (pNativeData == IntPtr.Zero ? null : (string?)WindowsGetStringRawBuffer(pNativeData, out _)) ?? "";
|
||||
|
||||
/// <summary>Creates a new <c>HSTRING</c> based on the specified source string.</summary>
|
||||
/// <param name="sourceString">
|
||||
/// <para>Type: [in, optional] <c>LPCWSTR</c></para>
|
||||
/// <para>
|
||||
/// A null-terminated string to use as the source for the new <c>HSTRING</c>. To create a new, empty, or <c>NULL</c> string, pass
|
||||
/// <c>NULL</c> for <c>sourceString</c> and 0 for <c>length</c>.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="length">
|
||||
/// <para>Type: [in] <c>UINT32</c></para>
|
||||
/// <para>The length of <c>sourceString</c>, in Unicode characters. Must be 0 if <c>sourceString</c> is <c>NULL</c>.</para>
|
||||
/// </param>
|
||||
/// <param name="hstring">
|
||||
/// <para>Type: [out] <c><c>HSTRING</c>*</c></para>
|
||||
/// <para>
|
||||
/// A pointer to the newly created <c>HSTRING</c>, or <c>NULL</c> if an error occurs. Any existing content in <c>string</c> is
|
||||
/// overwritten. The <c>HSTRING</c> is a standard handle type.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <para>Type: <c>HRESULT</c></para>
|
||||
/// <para>This function can return one of these values.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <description>Return code</description>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <description><c>S_OK</c></description>
|
||||
/// <description>The [**HSTRING**](/windows/win32/winrt/hstring) was created successfully.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description><c>E_INVALIDARG</c></description>
|
||||
/// <description><c>string</c> is <c>NULL</c>.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description><c>E_OUTOFMEMORY</c></description>
|
||||
/// <description>Failed to allocate the new [**HSTRING**](/windows/win32/winrt/hstring).</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description><c>E_POINTER</c></description>
|
||||
/// <description><c>sourceString</c> is <c>NULL</c> and <c>length</c> is non-zero.</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Use the <c>WindowsCreateString</c> function to allocate a new <c>HSTRING</c>. The Windows Runtime copies <c>string</c> to the
|
||||
/// backing buffer of the new <c>HSTRING</c> and manages the buffer lifetime by using a reference count. Call the
|
||||
/// WindowsCreateStringReference function to create a <c>fast-pass string</c>, which uses an existing string without copying it.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Call the WindowsDeleteString function to de-allocate the <c>HSTRING</c>. Each call to the <c>WindowsCreateString</c> function
|
||||
/// must be matched by a call to <c>WindowsDeleteString</c>.
|
||||
/// </para>
|
||||
/// <para>To create a new, empty, or <c>NULL</c> string, pass <c>NULL</c> for <c>sourceString</c> and 0 for <c>length</c>.</para>
|
||||
/// <para>
|
||||
/// If <c>sourceString</c> has embedded null characters, the <c>WindowsCreateString</c> function copies all characters to the
|
||||
/// terminating null character.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/winstring/nf-winstring-windowscreatestring HRESULT WindowsCreateString(
|
||||
// PCNZWCH sourceString, UINT32 length, HSTRING *string );
|
||||
[PInvokeData("winstring.h", MSDNShortId = "NF:winstring.WindowsCreateString")]
|
||||
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
[SecurityCritical]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern HRESULT WindowsCreateString([MarshalAs(UnmanagedType.LPWStr)] string sourceString, int length, out IntPtr hstring);
|
||||
private static extern HRESULT WindowsCreateString([MarshalAs(UnmanagedType.LPWStr)] string? sourceString, int length, out IntPtr hstring);
|
||||
|
||||
/// <summary>Decrements the reference count of a string buffer.</summary>
|
||||
/// <param name="hstring">
|
||||
/// <para>Type: [in] <c>HSTRING</c></para>
|
||||
/// <para>
|
||||
/// The string to be deleted. If <c>string</c> is a fast-pass string created by WindowsCreateStringReference, or if <c>string</c> is
|
||||
/// <c>NULL</c> or empty, no action is taken and <c>S_OK</c> is returned.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <para>Type: <c>HRESULT</c></para>
|
||||
/// <para>This function always returns <c>S_OK</c>.</para>
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Use the <c>WindowsDeleteString</c> function to de-allocate an <c>HSTRING</c>. Calling <c>WindowsDeleteString</c> decrements the
|
||||
/// reference count of the backing buffer, and if the reference count reaches 0, the Windows Runtime de-allocates the buffer.
|
||||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/winstring/nf-winstring-windowsdeletestring HRESULT WindowsDeleteString(
|
||||
// HSTRING string );
|
||||
[PInvokeData("winstring.h", MSDNShortId = "NF:winstring.WindowsDeleteString")]
|
||||
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
[SecurityCritical]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern HRESULT WindowsDeleteString(IntPtr hstring);
|
||||
|
||||
/// <summary>Retrieves the backing buffer for the specified string.</summary>
|
||||
/// <param name="hstring">
|
||||
/// <para>Type: [in, optional] <c>HSTRING</c></para>
|
||||
/// <para>An optional string for which the backing buffer is to be retrieved. Can be <c>NULL</c>.</para>
|
||||
/// </param>
|
||||
/// <param name="length">
|
||||
/// <para>Type: [out, optional] <c>UINT32 *</c></para>
|
||||
/// <para>
|
||||
/// An optional pointer to a <c>UINT32</c>. If <c>NULL</c> is passed for length, then it is ignored. If length is a valid pointer to
|
||||
/// a <c>UINT32</c>, and string is a valid <c>HSTRING</c>, then on successful completion the function sets the value pointed to by
|
||||
/// length to the number of Unicode characters in the backing buffer for string (including embedded null characters, but excluding
|
||||
/// the terminating null). If length is a valid pointer to a <c>UINT32</c>, and string is <c>NULL</c>, then the value pointed to by
|
||||
/// length is set to 0.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <para>Type: <c>PCWSTR</c></para>
|
||||
/// <para>
|
||||
/// A pointer to the buffer that provides the backing store for <c>string</c>, or the empty string if <c>string</c> is <c>NULL</c> or
|
||||
/// the empty string.
|
||||
/// </para>
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>Use the <c>WindowsGetStringRawBuffer</c> function to obtain a pointer to the backing buffer of an <c>HSTRING</c>.</para>
|
||||
/// <para>Don't change the contents of the bufferâan <c>HSTRING</c> is required to be immutable.</para>
|
||||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/winstring/nf-winstring-windowsgetstringrawbuffer PCWSTR
|
||||
// WindowsGetStringRawBuffer( HSTRING string, UINT32 *length );
|
||||
[PInvokeData("winstring.h", MSDNShortId = "NF:winstring.WindowsGetStringRawBuffer")]
|
||||
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
[SecurityCritical]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
|
|
|
@ -39,7 +39,8 @@ public static partial class Ole32
|
|||
// iidIntercepted, IUnknown *punkOuter, REFIID iid, void **ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("callobj.h", MSDNShortId = "d1ffee1d-f907-4091-b993-cf13d8ce616c")]
|
||||
public static extern HRESULT CoGetInterceptor(in Guid iidIntercepted, [MarshalAs(UnmanagedType.IUnknown), Optional] object punkOuter, in Guid iid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
public static extern HRESULT CoGetInterceptor(in Guid iidIntercepted, [MarshalAs(UnmanagedType.IUnknown), Optional] object? punkOuter,
|
||||
in Guid iid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>StgConvertVariantToProperty</c> function converts a <c>PROPVARIANT</c> data type to a <c>SERIALIZEDPROPERTYVALUE</c> data type.
|
||||
|
@ -61,7 +62,8 @@ public static partial class Ole32
|
|||
// BOOLEAN fReserved, ULONG *pcIndirect );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("propidl.h", MSDNShortId = "3d35b808-4fa6-44ec-9c46-96ceee1dafd0")]
|
||||
public static extern IntPtr StgConvertVariantToProperty([In] PROPVARIANT pvar, ushort CodePage, [Optional] IntPtr pprop, ref uint pcb, uint pid, [MarshalAs(UnmanagedType.U1), Optional] bool fReserved, ref uint pcIndirect);
|
||||
public static extern IntPtr StgConvertVariantToProperty([In] PROPVARIANT pvar, ushort CodePage, [Optional] IntPtr pprop, ref uint pcb,
|
||||
uint pid, [MarshalAs(UnmanagedType.U1), Optional] bool fReserved, ref uint pcIndirect);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>StgPropertyLengthAsVariant</c> function examines a <c>SERIALIZEDPROPERTYVALUE</c> and returns the amount of memory that
|
||||
|
|
|
@ -721,7 +721,7 @@ public static partial class Ole32
|
|||
/// instantiate objects through <c>IClassFactory2</c> when a full machine license does not exist.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <seealso cref="Vanara.PInvoke.Ole32.IClassFactory"/>
|
||||
/// <seealso cref="IClassFactory"/>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nn-ocidl-iclassfactory2
|
||||
[PInvokeData("ocidl.h", MSDNShortId = "c49c7612-3b1f-4535-baf3-8458b3f34f95")]
|
||||
[ComImport, Guid("B196B28F-BAB4-101A-B69C-00AA00341D07"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
|
@ -809,7 +809,8 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/desktop/api/unknwn/nf-unknwn-iclassfactory-createinstance HRESULT CreateInstance(
|
||||
// IUnknown *pUnkOuter, REFIID riid, void **ppvObject );
|
||||
[PreserveSig]
|
||||
new HRESULT CreateInstance([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object ppvObject);
|
||||
new HRESULT CreateInstance([In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object? ppvObject);
|
||||
|
||||
/// <summary>Locks an object application open in memory. This enables instances to be created more quickly.</summary>
|
||||
/// <param name="fLock">If <c>TRUE</c>, increments the lock count; if <c>FALSE</c>, decrements the lock count.</param>
|
||||
|
@ -930,7 +931,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-requestlickey HRESULT RequestLicKey( DWORD
|
||||
// dwReserved, BSTR *pBstrKey );
|
||||
[PreserveSig]
|
||||
HRESULT RequestLicKey([Optional] uint dwReserved, [MarshalAs(UnmanagedType.BStr)] out string pBstrKey);
|
||||
HRESULT RequestLicKey([Optional] uint dwReserved, [MarshalAs(UnmanagedType.BStr)] out string? pBstrKey);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the licensed object for the specified license key. This method is the only possible means to create
|
||||
|
@ -998,8 +999,8 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-createinstancelic HRESULT
|
||||
// CreateInstanceLic( IUnknown *pUnkOuter, IUnknown *pUnkReserved, REFIID riid, BSTR bstrKey, PVOID *ppvObj );
|
||||
[PreserveSig]
|
||||
HRESULT CreateInstanceLic([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkReserved,
|
||||
in Guid riid, [In, MarshalAs(UnmanagedType.BStr)] string bstrKey, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 2)] out object ppvObj);
|
||||
HRESULT CreateInstanceLic([In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkReserved,
|
||||
in Guid riid, [In, MarshalAs(UnmanagedType.BStr)] string bstrKey, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 2)] out object? ppvObj);
|
||||
}
|
||||
|
||||
/// <summary>Enumerates the undo units on the undo or redo stack.</summary>
|
||||
|
@ -1898,7 +1899,7 @@ public static partial class Ole32
|
|||
/// <para>E_NOTIMPL is not allowed without implementation of the <c>SetSite</c> method, the IObjectWithSite interface is unnecessary.</para>
|
||||
/// </remarks>
|
||||
[PreserveSig]
|
||||
HRESULT SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkSite);
|
||||
HRESULT SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkSite);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Retrieves the latest site passed using SetSite.</para>
|
||||
|
@ -1936,7 +1937,7 @@ public static partial class Ole32
|
|||
/// <para>E_NOTIMPL is not allowed any object implementing this interface must be able to return the last site seen in IObjectWithSite::SetSite.</para>
|
||||
/// </remarks>
|
||||
[PreserveSig]
|
||||
HRESULT GetSite(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object ppvSite);
|
||||
HRESULT GetSite(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object? ppvSite);
|
||||
}
|
||||
|
||||
/// <summary>Provides the features for supporting keyboard mnemonics, ambient properties, and events in control objects.</summary>
|
||||
|
@ -2142,7 +2143,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-iolecontrolsite-getextendedcontrol HRESULT
|
||||
// GetExtendedControl( IDispatch **ppDisp );
|
||||
[PreserveSig]
|
||||
HRESULT GetExtendedControl([MarshalAs(UnmanagedType.IDispatch)] out object ppDisp);
|
||||
HRESULT GetExtendedControl([MarshalAs(UnmanagedType.IDispatch)] out object? ppDisp);
|
||||
|
||||
/// <summary>
|
||||
/// Converts coordinates expressed in <c>HIMETRIC</c> units (as is standard in OLE) to the units specified by the container.
|
||||
|
@ -3735,7 +3736,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleinplacesitewindowless-getdc HRESULT GetDC( LPCRECT
|
||||
// pRect, DWORD grfFlags, HDC *phDC );
|
||||
[PreserveSig]
|
||||
HRESULT GetDC([In, Optional] PRECT pRect, OLEDCFLAGS grfFlags, out HDC phDC);
|
||||
HRESULT GetDC([In, Optional] PRECT? pRect, OLEDCFLAGS grfFlags, out HDC phDC);
|
||||
|
||||
/// <summary>Releases the device context previously obtained by a call to IOleInPlaceSiteWindowless::GetDC.</summary>
|
||||
/// <param name="hDC">The device context to be released.</param>
|
||||
|
@ -3768,7 +3769,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleinplacesitewindowless-invalidaterect HRESULT
|
||||
// InvalidateRect( LPCRECT pRect, BOOL fErase );
|
||||
[PreserveSig]
|
||||
HRESULT InvalidateRect([In, Optional] PRECT pRect, [MarshalAs(UnmanagedType.Bool)] bool fErase);
|
||||
HRESULT InvalidateRect([In, Optional] PRECT? pRect, [MarshalAs(UnmanagedType.Bool)] bool fErase);
|
||||
|
||||
/// <summary>Enables an object to invalidate a specified region of its in-place image on the screen.</summary>
|
||||
/// <param name="hRGN">
|
||||
|
@ -3787,7 +3788,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleinplacesitewindowless-invalidatergn HRESULT
|
||||
// InvalidateRgn( HRGN hRGN, BOOL fErase );
|
||||
[PreserveSig]
|
||||
HRESULT InvalidateRgn(HRGN hRGN, [MarshalAs(UnmanagedType.Bool)] bool fErase);
|
||||
HRESULT InvalidateRgn([Optional] HRGN hRGN, [MarshalAs(UnmanagedType.Bool)] bool fErase);
|
||||
|
||||
/// <summary>Enables an object to scroll an area within its in-place active image on the screen.</summary>
|
||||
/// <param name="dx">The amount to scroll the x-axis.</param>
|
||||
|
@ -3851,7 +3852,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleinplacesitewindowless-scrollrect HRESULT ScrollRect(
|
||||
// INT dx, INT dy, LPCRECT pRectScroll, LPCRECT pRectClip );
|
||||
[PreserveSig]
|
||||
HRESULT ScrollRect(int dx, int dy, [In, Optional] PRECT pRectScroll, [In, Optional] PRECT pRectClip);
|
||||
HRESULT ScrollRect(int dx, int dy, [In, Optional] PRECT? pRectScroll, [In, Optional] PRECT? pRectClip);
|
||||
|
||||
/// <summary>Adjusts a specified rectangle if it is entirely or partially covered by overlapping, opaque objects.</summary>
|
||||
/// <param name="prc">The rectangle to be adjusted.</param>
|
||||
|
@ -4089,7 +4090,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleundounit-do HRESULT Do( IOleUndoManager *pUndoManager );
|
||||
[PreserveSig]
|
||||
new HRESULT Do(IOleUndoManager pUndoManager);
|
||||
new HRESULT Do(IOleUndoManager? pUndoManager);
|
||||
|
||||
/// <summary>Retrieves a description of the undo unit that can be used in the undo or redo user interface.</summary>
|
||||
/// <param name="pBstr">A pointer to string that describes this undo unit.</param>
|
||||
|
@ -4588,7 +4589,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleundomanager-discardfrom HRESULT DiscardFrom(
|
||||
// IOleUndoUnit *pUU );
|
||||
[PreserveSig]
|
||||
HRESULT DiscardFrom(IOleUndoUnit pUU);
|
||||
HRESULT DiscardFrom(IOleUndoUnit? pUU);
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the undo manager to invoke undo actions back through the undo stack, down to and including the specified undo unit.
|
||||
|
@ -4650,7 +4651,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleundomanager-undoto HRESULT UndoTo( IOleUndoUnit *pUU );
|
||||
[PreserveSig]
|
||||
HRESULT UndoTo(IOleUndoUnit pUU);
|
||||
HRESULT UndoTo(IOleUndoUnit? pUU);
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the undo manager to invoke undo actions back through the redo stack, down to and including the specified undo unit.
|
||||
|
@ -4704,7 +4705,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleundomanager-redoto HRESULT RedoTo( IOleUndoUnit *pUU );
|
||||
[PreserveSig]
|
||||
HRESULT RedoTo(IOleUndoUnit pUU);
|
||||
HRESULT RedoTo(IOleUndoUnit? pUU);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an enumerator object that the caller can use to iterate through a series of top-level undo units from the undo stack.
|
||||
|
@ -4916,7 +4917,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ioleundounit-do HRESULT Do( IOleUndoManager *pUndoManager );
|
||||
[PreserveSig]
|
||||
HRESULT Do(IOleUndoManager pUndoManager);
|
||||
HRESULT Do(IOleUndoManager? pUndoManager);
|
||||
|
||||
/// <summary>Retrieves a description of the undo unit that can be used in the undo or redo user interface.</summary>
|
||||
/// <param name="pBstr">A pointer to string that describes this undo unit.</param>
|
||||
|
@ -5195,7 +5196,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-iperpropertybrowsing-getpredefinedvalue HRESULT
|
||||
// GetPredefinedValue( DISPID dispID, DWORD dwCookie, VARIANT *pVarOut );
|
||||
[PreserveSig]
|
||||
HRESULT GetPredefinedValue(int dispID, uint dwCookie, out OleAut32.VARIANT pVarOut);
|
||||
HRESULT GetPredefinedValue(int dispID, uint dwCookie, out object pVarOut);
|
||||
}
|
||||
|
||||
/// <summary>Works with IPropertyBag and IErrorlog to define an individual property-based persistence mechanism.</summary>
|
||||
|
@ -5287,7 +5288,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ipersistpropertybag-load HRESULT Load( IPropertyBag
|
||||
// *pPropBag, IErrorLog *pErrorLog );
|
||||
void Load(OleAut32.IPropertyBag pPropBag, [Optional] OleAut32.IErrorLog pErrorLog);
|
||||
void Load(OleAut32.IPropertyBag pPropBag, [Optional] OleAut32.IErrorLog? pErrorLog);
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the object to save its properties to the given property bag, and optionally, to clear the object's dirty flag.
|
||||
|
@ -5785,7 +5786,7 @@ public static partial class Ole32
|
|||
// LONG cx, LONG cy, OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc, OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc, LPCRECT
|
||||
// pRcWBounds );
|
||||
[PreserveSig]
|
||||
HRESULT Render(HDC hDC, int x, int y, int cx, int cy, int xSrc, int ySrc, int cxSrc, int cySrc, [In, Optional] PRECT pRcWBounds);
|
||||
HRESULT Render(HDC hDC, int x, int y, int cx, int cy, int xSrc, int ySrc, int cxSrc, int cySrc, [In, Optional] PRECT? pRcWBounds);
|
||||
|
||||
/// <summary>Assigns a GDI palette to the picture contained in the picture object.</summary>
|
||||
/// <param name="hPal">A handle to the GDI palette assigned to the picture.</param>
|
||||
|
@ -6231,7 +6232,7 @@ public static partial class Ole32
|
|||
// LONG cx, LONG cy, OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc, OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc, LPCRECT
|
||||
// pRcWBounds );
|
||||
[PreserveSig]
|
||||
HRESULT Render(HDC hDC, int x, int y, int cx, int cy, int xSrc, int ySrc, int cxSrc, int cySrc, [In, Optional] PRECT pRcWBounds);
|
||||
HRESULT Render(HDC hDC, int x, int y, int cx, int cy, int xSrc, int ySrc, int cxSrc, int cySrc, [In, Optional] PRECT? pRcWBounds);
|
||||
|
||||
/// <summary>Assigns a GDI palette to the picture contained in the picture object.</summary>
|
||||
/// <param name="hPal">A handle to the GDI palette assigned to the picture.</param>
|
||||
|
@ -6682,7 +6683,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ipropertypage-setpagesite HRESULT SetPageSite(
|
||||
// IPropertyPageSite *pPageSite );
|
||||
[PreserveSig]
|
||||
HRESULT SetPageSite(IPropertyPageSite pPageSite);
|
||||
HRESULT SetPageSite(IPropertyPageSite? pPageSite);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Creates the dialog box window for the property page.</para>
|
||||
|
@ -7061,7 +7062,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ipropertypage-setpagesite HRESULT SetPageSite(
|
||||
// IPropertyPageSite *pPageSite );
|
||||
[PreserveSig]
|
||||
new HRESULT SetPageSite(IPropertyPageSite pPageSite);
|
||||
new HRESULT SetPageSite(IPropertyPageSite? pPageSite);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Creates the dialog box window for the property page.</para>
|
||||
|
@ -7528,7 +7529,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-ipropertypagesite-getpagecontainer HRESULT
|
||||
// GetPageContainer( IUnknown **ppUnk );
|
||||
[PreserveSig]
|
||||
HRESULT GetPageContainer([MarshalAs(UnmanagedType.IUnknown)] out object ppUnk);
|
||||
HRESULT GetPageContainer([MarshalAs(UnmanagedType.IUnknown)] out object? ppUnk);
|
||||
|
||||
/// <summary>Passes a keystroke to the property frame for processing.</summary>
|
||||
/// <param name="pMsg">A pointer to the MSG structure to be processed.</param>
|
||||
|
@ -8203,9 +8204,9 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-draw HRESULT Draw( DWORD dwDrawAspect, LONG
|
||||
// lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL(*
|
||||
// )(ULONG_PTR dwContinue) pfnContinue, ULONG_PTR dwContinue );
|
||||
new unsafe HRESULT Draw(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, [In, Optional] DVTARGETDEVICE* ptd,
|
||||
[In, Optional] HDC hdcTargetDev, [In] HDC hdcDraw, [In, Optional] PRECT lprcBounds, [In, Optional] PRECT lprcWBounds,
|
||||
[In, Optional, MarshalAs(UnmanagedType.FunctionPtr)] Func<IntPtr, BOOL> pfnContinue, [In, Optional] IntPtr dwContinue);
|
||||
new HRESULT Draw(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, [In, Optional] DVTARGETDEVICE? ptd,
|
||||
[In, Optional] HDC hdcTargetDev, [In] HDC hdcDraw, [In, Optional] PRECT? lprcBounds, [In, Optional] PRECT? lprcWBounds,
|
||||
[In, Optional, MarshalAs(UnmanagedType.FunctionPtr)] Func<IntPtr, BOOL>? pfnContinue, [In, Optional] IntPtr dwContinue);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the logical palette that the object will use for drawing in its IViewObject::Draw method with the corresponding parameters.
|
||||
|
@ -8288,7 +8289,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-getcolorset HRESULT GetColorSet( DWORD
|
||||
// dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet );
|
||||
new unsafe HRESULT GetColorSet(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, [In, Optional] DVTARGETDEVICE* ptd,
|
||||
new HRESULT GetColorSet(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, [In, Optional] DVTARGETDEVICE? ptd,
|
||||
[In, Optional] HDC hicTargetDev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(VanaraCustomMarshaler<LOGPALETTE>))] out LOGPALETTE ppColorSet);
|
||||
|
||||
/// <summary>
|
||||
|
@ -8353,7 +8354,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-freeze HRESULT Freeze( DWORD dwDrawAspect,
|
||||
// LONG lindex, void *pvAspect, DWORD *pdwFreeze );
|
||||
new unsafe HRESULT Freeze(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, out uint pdwFreeze);
|
||||
new HRESULT Freeze(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, out uint pdwFreeze);
|
||||
|
||||
/// <summary>
|
||||
/// Releases a drawing that was previously frozen using IViewObject::Freeze. The most common use of this method is for banded printing.
|
||||
|
@ -8452,7 +8453,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-setadvise HRESULT SetAdvise( DWORD aspects,
|
||||
// DWORD advf, IAdviseSink *pAdvSink );
|
||||
new HRESULT SetAdvise(DVASPECT aspects, ADVF advf, [In, Optional] IAdviseSink pAdvSink);
|
||||
new HRESULT SetAdvise(DVASPECT aspects, ADVF advf, [In, Optional] IAdviseSink? pAdvSink);
|
||||
|
||||
/// <summary>Retrieves the advisory connection on the object that was used in the most recent call to IViewObject::SetAdvise.</summary>
|
||||
/// <param name="pAspects">
|
||||
|
@ -8516,7 +8517,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject2-getextent
|
||||
// HRESULT GetExtent( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel );
|
||||
new HRESULT GetExtent(uint dwDrawAspect, int lindex, in DVTARGETDEVICE ptd, out SIZE lpsizel);
|
||||
new HRESULT GetExtent(uint dwDrawAspect, int lindex, [In] DVTARGETDEVICE ptd, out SIZE lpsizel);
|
||||
|
||||
/// <summary>Retrieves a rectangle describing a requested drawing aspect.</summary>
|
||||
/// <param name="dwAspect">The drawing aspect requested.</param>
|
||||
|
@ -8882,14 +8883,14 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ocidl/nf-ocidl-iviewobjectex-getnaturalextent HRESULT GetNaturalExtent(
|
||||
// DWORD dwAspect, LONG lindex, DVTARGETDEVICE *ptd, HDC hicTargetDev, DVEXTENTINFO *pExtentInfo, LPSIZEL pSizel );
|
||||
[PreserveSig]
|
||||
HRESULT GetNaturalExtent(DVASPECT2 dwAspect, int lindex, in DVTARGETDEVICE ptd, HDC hicTargetDev, in DVEXTENTINFO pExtentInfo, out SIZE pSizel);
|
||||
HRESULT GetNaturalExtent(DVASPECT2 dwAspect, int lindex, [In] DVTARGETDEVICE? ptd, HDC hicTargetDev, in DVEXTENTINFO pExtentInfo, out SIZE pSizel);
|
||||
}
|
||||
|
||||
/// <summary>Extension method to simplify using the <see cref="IObjectWithSite.GetSite"/> method.</summary>
|
||||
/// <typeparam name="T">Type of the interface to get.</typeparam>
|
||||
/// <param name="ows">An <see cref="IObjectWithSite"/> instance.</param>
|
||||
/// <returns>Receives the interface pointer requested in <typeparamref name="T"/>.</returns>
|
||||
public static T GetSite<T>(this IObjectWithSite ows) where T : class { ows.GetSite(typeof(T).GUID, out var pSite).ThrowIfFailed(); return (T)pSite; }
|
||||
public static T? GetSite<T>(this IObjectWithSite ows) where T : class { ows.GetSite(typeof(T).GUID, out object? pSite).ThrowIfFailed(); return (T?)pSite; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies a counted array of values that can be used to obtain the value corresponding to one of the predefined strings for a property.
|
||||
|
@ -9019,7 +9020,7 @@ public static partial class Ole32
|
|||
// dwFlags; } DVASPECTINFO;
|
||||
[PInvokeData("ocidl.h", MSDNShortId = "NS:ocidl.tagAspectInfo")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct DVASPECTINFO
|
||||
public class DVASPECTINFO
|
||||
{
|
||||
/// <summary>The size of the structure, in bytes.</summary>
|
||||
public uint cb;
|
||||
|
|
|
@ -590,7 +590,7 @@ public static partial class Ole32
|
|||
// grfOpt, REFIID iidResult, LPVOID *ppvResult );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "5a022c39-fc2c-458b-9dfe-fed1255d49a4")]
|
||||
public static extern HRESULT BindMoniker(IMoniker pmk, [Optional] uint grfOpt, in Guid iidResult, [MarshalAs(UnmanagedType.IUnknown)] out object ppvResult);
|
||||
public static extern HRESULT BindMoniker(IMoniker pmk, [Optional] uint grfOpt, in Guid iidResult, [MarshalAs(UnmanagedType.IUnknown)] out object? ppvResult);
|
||||
|
||||
/// <summary>
|
||||
/// This function passes the foreground privilege (the privilege to set the foreground window) from one process to another. The
|
||||
|
@ -831,7 +831,9 @@ public static partial class Ole32
|
|||
// MULTI_QI *pResults );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "f8a22f5f-a21f-49e7-bd6c-ca987206ee46")]
|
||||
public static extern HRESULT CoGetInstanceFromFile([Optional] COSERVERINFO pServerInfo, in Guid pClsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object punkOuter, CLSCTX dwClsCtx, STGM grfMode, [MarshalAs(UnmanagedType.LPWStr)] string pwszName, uint dwCount, [In, Out] MULTI_QI[] pResults);
|
||||
public static extern HRESULT CoGetInstanceFromFile([Optional] COSERVERINFO? pServerInfo, in Guid pClsid,
|
||||
[MarshalAs(UnmanagedType.IUnknown), Optional] object? punkOuter, CLSCTX dwClsCtx, STGM grfMode,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pwszName, uint dwCount, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] MULTI_QI[] pResults);
|
||||
|
||||
/// <summary>Creates a new object and initializes it from a file using IPersistFile::Load.</summary>
|
||||
/// <param name="pServerInfo">
|
||||
|
@ -905,7 +907,9 @@ public static partial class Ole32
|
|||
// MULTI_QI *pResults );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "f8a22f5f-a21f-49e7-bd6c-ca987206ee46")]
|
||||
public static extern HRESULT CoGetInstanceFromFile([Optional] COSERVERINFO pServerInfo, [Optional] IntPtr pClsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object punkOuter, CLSCTX dwClsCtx, STGM grfMode, [MarshalAs(UnmanagedType.LPWStr)] string pwszName, uint dwCount, [In, Out] MULTI_QI[] pResults);
|
||||
public static extern HRESULT CoGetInstanceFromFile([Optional] COSERVERINFO? pServerInfo, [Optional] IntPtr pClsid,
|
||||
[MarshalAs(UnmanagedType.IUnknown), Optional] object? punkOuter, CLSCTX dwClsCtx, STGM grfMode,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pwszName, uint dwCount, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] MULTI_QI[] pResults);
|
||||
|
||||
/// <summary>Creates a new object and initializes it from a storage object through an internal call to IPersistFile::Load.</summary>
|
||||
/// <param name="pServerInfo">
|
||||
|
@ -980,7 +984,9 @@ public static partial class Ole32
|
|||
// dwCount, MULTI_QI *pResults );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "6a77770c-b7e1-4d29-9c4b-331b5950a635")]
|
||||
public static extern HRESULT CoGetInstanceFromIStorage([Optional] COSERVERINFO pServerInfo, in Guid pClsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object punkOuter, CLSCTX dwClsCtx, IStorage pstg, uint dwCount, [In, Out] MULTI_QI[] pResults);
|
||||
public static extern HRESULT CoGetInstanceFromIStorage([Optional] COSERVERINFO? pServerInfo, in Guid pClsid,
|
||||
[MarshalAs(UnmanagedType.IUnknown), Optional] object? punkOuter, CLSCTX dwClsCtx, IStorage pstg, uint dwCount,
|
||||
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] MULTI_QI[] pResults);
|
||||
|
||||
/// <summary>Creates a new object and initializes it from a storage object through an internal call to IPersistFile::Load.</summary>
|
||||
/// <param name="pServerInfo">
|
||||
|
@ -1055,7 +1061,9 @@ public static partial class Ole32
|
|||
// dwCount, MULTI_QI *pResults );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "6a77770c-b7e1-4d29-9c4b-331b5950a635")]
|
||||
public static extern HRESULT CoGetInstanceFromIStorage([Optional] COSERVERINFO pServerInfo, [Optional] IntPtr pClsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object punkOuter, CLSCTX dwClsCtx, IStorage pstg, uint dwCount, [In, Out] MULTI_QI[] pResults);
|
||||
public static extern HRESULT CoGetInstanceFromIStorage([Optional] COSERVERINFO? pServerInfo, [Optional] IntPtr pClsid,
|
||||
[MarshalAs(UnmanagedType.IUnknown), Optional] object? punkOuter, CLSCTX dwClsCtx, IStorage pstg, uint dwCount,
|
||||
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] MULTI_QI[] pResults);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a display name into a moniker that identifies the object named, and then binds to the object identified by the moniker.
|
||||
|
@ -1115,7 +1123,8 @@ public static partial class Ole32
|
|||
// *pBindOptions, REFIID riid, void **ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "0f5c9ef5-3918-4f93-bfd1-1017029b3dc1")]
|
||||
public static extern HRESULT CoGetObject([MarshalAs(UnmanagedType.LPWStr)] string pszName, in BIND_OPTS pBindOptions, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
public static extern HRESULT CoGetObject([MarshalAs(UnmanagedType.LPWStr)] string pszName, in BIND_OPTS pBindOptions, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a display name into a moniker that identifies the object named, and then binds to the object identified by the moniker.
|
||||
|
@ -1175,67 +1184,8 @@ public static partial class Ole32
|
|||
// *pBindOptions, REFIID riid, void **ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "0f5c9ef5-3918-4f93-bfd1-1017029b3dc1")]
|
||||
public static extern HRESULT CoGetObject([MarshalAs(UnmanagedType.LPWStr)] string pszName, [In] BIND_OPTS_V pBindOptions, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a display name into a moniker that identifies the object named, and then binds to the object identified by the moniker.
|
||||
/// </summary>
|
||||
/// <param name="pszName">The display name of the object to be created.</param>
|
||||
/// <param name="pBindOptions">
|
||||
/// The binding options used to create a moniker that creates the actual object. For details, see BIND_OPTS. This parameter can be <c>NULL</c>.
|
||||
/// </param>
|
||||
/// <param name="riid">A reference to the identifier of an interface that is implemented on the object to be created.</param>
|
||||
/// <param name="ppv">The address of a pointer to the interface specified by riid on the object that is created.</param>
|
||||
/// <returns>
|
||||
/// <para>
|
||||
/// This function can return the standard return values E_FAIL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.
|
||||
/// </para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>The object was created successfully.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>MK_E_SYNTAX</term>
|
||||
/// <term>The pszName parameter is not a properly formed display name.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>MK_E_NOOBJECT</term>
|
||||
/// <term>
|
||||
/// The object identified by this moniker, or some object identified by the composite moniker of which this moniker is a part, could
|
||||
/// not be found.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>MK_E_EXCEEDEDDEADLINE</term>
|
||||
/// <term>The binding operation could not be completed within the time limit specified by the BIND_OPTS structure passed in pBindOptions.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>MK_E_CONNECTMANUALLY</term>
|
||||
/// <term>
|
||||
/// The binding operation requires assistance from the end user. The most common reasons for returning this value are that a
|
||||
/// password is needed or that a floppy needs to be mounted.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>MK_E_INTERMEDIATEINTERFACENOTSUPPORTED</term>
|
||||
/// <term>
|
||||
/// An intermediate object was found but it did not support an interface required to complete the binding operation. For example, an
|
||||
/// item moniker returns this value if its container does not support the IOleItemContainer interface.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <remarks><c>CoGetObject</c> encapsulates calls to the COM library functions CreateBindCtx, MkParseDisplayName, and IMoniker::BindToObject.</remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-cogetobject HRESULT CoGetObject( LPCWSTR pszName, BIND_OPTS
|
||||
// *pBindOptions, REFIID riid, void **ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "0f5c9ef5-3918-4f93-bfd1-1017029b3dc1")]
|
||||
public static extern HRESULT CoGetObject([MarshalAs(UnmanagedType.LPWStr)] string pszName, [Optional] IntPtr pBindOptions, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
public static extern HRESULT CoGetObject([MarshalAs(UnmanagedType.LPWStr)] string pszName, [In, Optional] BIND_OPTS_V? pBindOptions, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the default values of the Security Descriptors of the machine-wide launch and access permissions, as well as launch and
|
||||
|
@ -1383,7 +1333,7 @@ public static partial class Ole32
|
|||
/// </returns>
|
||||
[DllImport(Lib.Ole32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = false)]
|
||||
[PInvokeData("Objbase.h", MSDNShortId = "ms695279")]
|
||||
public static extern HRESULT CoInitializeEx([Optional] IntPtr pvReserved, COINIT coInit);
|
||||
public static extern HRESULT CoInitializeEx([Optional] IntPtr pvReserved, COINIT coInit = COINIT.COINIT_MULTITHREADED);
|
||||
|
||||
/// <summary>Registers security and sets the default security values for the process.</summary>
|
||||
/// <param name="pSecDesc">
|
||||
|
@ -1468,9 +1418,186 @@ public static partial class Ole32
|
|||
// dwCapabilities, _In_opt_ void *pReserved3); https://msdn.microsoft.com/en-us/library/windows/desktop/ms693736(v=vs.85).aspx
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("Objbase.h", MSDNShortId = "ms693736")]
|
||||
public static extern HRESULT CoInitializeSecurity([Optional] IntPtr pSecDesc, int cAuthSvc, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SOLE_AUTHENTICATION_SERVICE[] asAuthSvc,
|
||||
[Optional] IntPtr pReserved1, RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel, in SOLE_AUTHENTICATION_LIST pAuthList, EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities,
|
||||
[Optional] IntPtr pReserved3);
|
||||
public static extern HRESULT CoInitializeSecurity([Optional] PSECURITY_DESCRIPTOR pSecDesc, int cAuthSvc,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SOLE_AUTHENTICATION_SERVICE[]? asAuthSvc, [Optional] IntPtr pReserved1,
|
||||
RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel, [In, Optional] SOLE_AUTHENTICATION_LIST? pAuthList,
|
||||
EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities, IntPtr pReserved3 = default);
|
||||
|
||||
/// <summary>Registers security and sets the default security values for the process.</summary>
|
||||
/// <param name="pSecDesc">
|
||||
/// The access permissions that a server will use to receive calls. This parameter is used by COM only when a server calls
|
||||
/// <c>CoInitializeSecurity</c>. Its value is a pointer to one of three types: an AppID, an <c>IAccessControl</c> object, or a
|
||||
/// <c>SECURITY_DESCRIPTOR</c>, in absolute format. See the Remarks section for more information.
|
||||
/// </param>
|
||||
/// <param name="cAuthSvc">
|
||||
/// The count of entries in the asAuthSvc parameter. This parameter is used by COM only when a server calls
|
||||
/// <c>CoInitializeSecurity</c>. If this parameter is 0, no authentication services will be registered and the server cannot receive
|
||||
/// secure calls. A value of -1 tells COM to choose which authentication services to register, and if this is the case, the
|
||||
/// asAuthSvc parameter must be <c>NULL</c>. However, Schannel will never be chosen as an authentication service by the server if
|
||||
/// this parameter is -1.
|
||||
/// </param>
|
||||
/// <param name="asAuthSvc">
|
||||
/// An array of authentication services that a server is willing to use to receive a call. This parameter is used by COM only when a
|
||||
/// server calls <c>CoInitializeSecurity</c>. For more information, see <c>SOLE_AUTHENTICATION_SERVICE</c>.
|
||||
/// </param>
|
||||
/// <param name="pReserved1">This parameter is reserved and must be <c>NULL</c>.</param>
|
||||
/// <param name="dwAuthnLevel">
|
||||
/// The default authentication level for the process. Both servers and clients use this parameter when they call
|
||||
/// <c>CoInitializeSecurity</c>. COM will fail calls that arrive with a lower authentication level. By default, all proxies will use
|
||||
/// at least this authentication level. This value should contain one of the authentication level constants. By default, all calls
|
||||
/// to <c>IUnknown</c> are made at this level.
|
||||
/// </param>
|
||||
/// <param name="dwImpLevel">
|
||||
/// <para>
|
||||
/// The default impersonation level for proxies. The value of this parameter is used only when the process is a client. It should be
|
||||
/// a value from the impersonation level constants, except for RPC_C_IMP_LEVEL_DEFAULT, which is not for use with <c>CoInitializeSecurity</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Outgoing calls from the client always use the impersonation level as specified. (It is not negotiated.) Incoming calls to the
|
||||
/// client can be at any impersonation level. By default, all <c>IUnknown</c> calls are made with this impersonation level, so even
|
||||
/// security-aware applications should set this level carefully. To determine which impersonation levels each authentication service
|
||||
/// supports, see the description of the authentication services in COM and Security Packages. For more information about
|
||||
/// impersonation levels, see Impersonation.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="pAuthList">
|
||||
/// A pointer to <c>SOLE_AUTHENTICATION_LIST</c>, which is an array of <c>SOLE_AUTHENTICATION_INFO</c> structures. This list
|
||||
/// indicates the information for each authentication service that a client can use to call a server. This parameter is used by COM
|
||||
/// only when a client calls <c>CoInitializeSecurity</c>.
|
||||
/// </param>
|
||||
/// <param name="dwCapabilities">
|
||||
/// Additional capabilities of the client or server, specified by setting one or more <c>EOLE_AUTHENTICATION_CAPABILITIES</c>
|
||||
/// values. Some of these value cannot be used simultaneously, and some cannot be set when particular authentication services are
|
||||
/// being used. For more information about these flags, see the Remarks section.
|
||||
/// </param>
|
||||
/// <param name="pReserved3">This parameter is reserved and must be <c>NULL</c>.</param>
|
||||
/// <returns>
|
||||
/// <para>This function can return the standard return value E_INVALIDARG, as well as the following values.</para>
|
||||
/// <para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>Indicates success.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>RPC_E_TOO_LATE</term>
|
||||
/// <term>CoInitializeSecurity has already been called.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>RPC_E_NO_GOOD_SECURITY_PACKAGES</term>
|
||||
/// <term>
|
||||
/// The asAuthSvc parameter was not NULL, and none of the authentication services in the list could be registered. Check the results
|
||||
/// saved in asAuthSvc for authentication service–specific error codes.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>E_OUT_OF_MEMORY</term>
|
||||
/// <term>Out of memory.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </para>
|
||||
/// </returns>
|
||||
// HRESULT CoInitializeSecurity( _In_opt_ PSECURITY_DESCRIPTOR pSecDesc, _In_ LONG cAuthSvc, _In_opt_ SOLE_AUTHENTICATION_SERVICE
|
||||
// *asAuthSvc, _In_opt_ void *pReserved1, _In_ DWORD dwAuthnLevel, _In_ DWORD dwImpLevel, _In_opt_ void *pAuthList, _In_ DWORD
|
||||
// dwCapabilities, _In_opt_ void *pReserved3); https://msdn.microsoft.com/en-us/library/windows/desktop/ms693736(v=vs.85).aspx
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("Objbase.h", MSDNShortId = "ms693736")]
|
||||
public static extern HRESULT CoInitializeSecurity([Optional] IAccessControl? pSecDesc, int cAuthSvc,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SOLE_AUTHENTICATION_SERVICE[]? asAuthSvc, [Optional] IntPtr pReserved1,
|
||||
RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel, [In, Optional] SOLE_AUTHENTICATION_LIST? pAuthList,
|
||||
EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities = EOLE_AUTHENTICATION_CAPABILITIES.EOAC_ACCESS_CONTROL, IntPtr pReserved3 = default);
|
||||
|
||||
/// <summary>Registers security and sets the default security values for the process.</summary>
|
||||
/// <param name="pSecDesc">
|
||||
/// The access permissions that a server will use to receive calls. This parameter is used by COM only when a server calls
|
||||
/// <c>CoInitializeSecurity</c>. Its value is a pointer to one of three types: an AppID, an <c>IAccessControl</c> object, or a
|
||||
/// <c>SECURITY_DESCRIPTOR</c>, in absolute format. See the Remarks section for more information.
|
||||
/// </param>
|
||||
/// <param name="cAuthSvc">
|
||||
/// The count of entries in the asAuthSvc parameter. This parameter is used by COM only when a server calls
|
||||
/// <c>CoInitializeSecurity</c>. If this parameter is 0, no authentication services will be registered and the server cannot receive
|
||||
/// secure calls. A value of -1 tells COM to choose which authentication services to register, and if this is the case, the
|
||||
/// asAuthSvc parameter must be <c>NULL</c>. However, Schannel will never be chosen as an authentication service by the server if
|
||||
/// this parameter is -1.
|
||||
/// </param>
|
||||
/// <param name="asAuthSvc">
|
||||
/// An array of authentication services that a server is willing to use to receive a call. This parameter is used by COM only when a
|
||||
/// server calls <c>CoInitializeSecurity</c>. For more information, see <c>SOLE_AUTHENTICATION_SERVICE</c>.
|
||||
/// </param>
|
||||
/// <param name="pReserved1">This parameter is reserved and must be <c>NULL</c>.</param>
|
||||
/// <param name="dwAuthnLevel">
|
||||
/// The default authentication level for the process. Both servers and clients use this parameter when they call
|
||||
/// <c>CoInitializeSecurity</c>. COM will fail calls that arrive with a lower authentication level. By default, all proxies will use
|
||||
/// at least this authentication level. This value should contain one of the authentication level constants. By default, all calls
|
||||
/// to <c>IUnknown</c> are made at this level.
|
||||
/// </param>
|
||||
/// <param name="dwImpLevel">
|
||||
/// <para>
|
||||
/// The default impersonation level for proxies. The value of this parameter is used only when the process is a client. It should be
|
||||
/// a value from the impersonation level constants, except for RPC_C_IMP_LEVEL_DEFAULT, which is not for use with <c>CoInitializeSecurity</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Outgoing calls from the client always use the impersonation level as specified. (It is not negotiated.) Incoming calls to the
|
||||
/// client can be at any impersonation level. By default, all <c>IUnknown</c> calls are made with this impersonation level, so even
|
||||
/// security-aware applications should set this level carefully. To determine which impersonation levels each authentication service
|
||||
/// supports, see the description of the authentication services in COM and Security Packages. For more information about
|
||||
/// impersonation levels, see Impersonation.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="pAuthList">
|
||||
/// A pointer to <c>SOLE_AUTHENTICATION_LIST</c>, which is an array of <c>SOLE_AUTHENTICATION_INFO</c> structures. This list
|
||||
/// indicates the information for each authentication service that a client can use to call a server. This parameter is used by COM
|
||||
/// only when a client calls <c>CoInitializeSecurity</c>.
|
||||
/// </param>
|
||||
/// <param name="dwCapabilities">
|
||||
/// Additional capabilities of the client or server, specified by setting one or more <c>EOLE_AUTHENTICATION_CAPABILITIES</c>
|
||||
/// values. Some of these value cannot be used simultaneously, and some cannot be set when particular authentication services are
|
||||
/// being used. For more information about these flags, see the Remarks section.
|
||||
/// </param>
|
||||
/// <param name="pReserved3">This parameter is reserved and must be <c>NULL</c>.</param>
|
||||
/// <returns>
|
||||
/// <para>This function can return the standard return value E_INVALIDARG, as well as the following values.</para>
|
||||
/// <para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>Indicates success.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>RPC_E_TOO_LATE</term>
|
||||
/// <term>CoInitializeSecurity has already been called.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>RPC_E_NO_GOOD_SECURITY_PACKAGES</term>
|
||||
/// <term>
|
||||
/// The asAuthSvc parameter was not NULL, and none of the authentication services in the list could be registered. Check the results
|
||||
/// saved in asAuthSvc for authentication service–specific error codes.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>E_OUT_OF_MEMORY</term>
|
||||
/// <term>Out of memory.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </para>
|
||||
/// </returns>
|
||||
// HRESULT CoInitializeSecurity( _In_opt_ PSECURITY_DESCRIPTOR pSecDesc, _In_ LONG cAuthSvc, _In_opt_ SOLE_AUTHENTICATION_SERVICE
|
||||
// *asAuthSvc, _In_opt_ void *pReserved1, _In_ DWORD dwAuthnLevel, _In_ DWORD dwImpLevel, _In_opt_ void *pAuthList, _In_ DWORD
|
||||
// dwCapabilities, _In_opt_ void *pReserved3); https://msdn.microsoft.com/en-us/library/windows/desktop/ms693736(v=vs.85).aspx
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("Objbase.h", MSDNShortId = "ms693736")]
|
||||
public static extern HRESULT CoInitializeSecurity(in Guid pSecDesc, int cAuthSvc,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SOLE_AUTHENTICATION_SERVICE[]? asAuthSvc, [Optional] IntPtr pReserved1,
|
||||
RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel, [In, Optional] SOLE_AUTHENTICATION_LIST? pAuthList,
|
||||
EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities = EOLE_AUTHENTICATION_CAPABILITIES.EOAC_APPID, IntPtr pReserved3 = default);
|
||||
|
||||
/// <summary>Determines whether the specified CLSID represents an OLE 1 object.</summary>
|
||||
/// <param name="rclsid">The CLSID to be checked.</param>
|
||||
|
@ -1664,7 +1791,7 @@ public static partial class Ole32
|
|||
// LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "caa5b277-ddbd-4ba9-892d-590d953b8433")]
|
||||
public static extern HRESULT CoRegisterMessageFilter(IMessageFilter lpMessageFilter, out IMessageFilter lplpMessageFilter);
|
||||
public static extern HRESULT CoRegisterMessageFilter(IMessageFilter? lpMessageFilter, out IMessageFilter lplpMessageFilter);
|
||||
|
||||
/// <summary>Revokes a registered implementation of the IInitializeSpy interface.</summary>
|
||||
/// <param name="uliCookie">A ULARGE_INTEGER cookie identifying the registration.</param>
|
||||
|
@ -1865,7 +1992,7 @@ public static partial class Ole32
|
|||
// *ppmk );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "1f8fcbd6-8f05-4d32-af8a-d8de1b56dacf")]
|
||||
public static extern HRESULT CreateAntiMoniker(out IMoniker ppmk);
|
||||
public static extern HRESULT CreateAntiMoniker(out IMoniker? ppmk);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pointer to an implementation of IBindCtx (a bind context object). This object stores information about a particular
|
||||
|
@ -1880,7 +2007,7 @@ public static partial class Ole32
|
|||
/// <returns>This function can return the standard return values E_OUTOFMEMORY and S_OK.</returns>
|
||||
[DllImport(Lib.Ole32, ExactSpelling = true)]
|
||||
[PInvokeData("Objbase.h", MSDNShortId = "ms678542")]
|
||||
public static extern HRESULT CreateBindCtx([Optional] uint reserved, out IBindCtx ppbc);
|
||||
public static extern HRESULT CreateBindCtx([Optional] uint reserved, out IBindCtx? ppbc);
|
||||
|
||||
/// <summary>Creates a class moniker that refers to the specified class.</summary>
|
||||
/// <param name="rclsid">A reference to the CLSID of the object type to which this moniker binds.</param>
|
||||
|
@ -1911,7 +2038,7 @@ public static partial class Ole32
|
|||
// rclsid, LPMONIKER *ppmk );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "9361b2c1-ef26-4225-92ff-e0bef0285bc4")]
|
||||
public static extern HRESULT CreateClassMoniker(in Guid rclsid, out IMoniker ppmk);
|
||||
public static extern HRESULT CreateClassMoniker(in Guid rclsid, out IMoniker? ppmk);
|
||||
|
||||
/// <summary>Retrieves a pointer to a new instance of an OLE-provided implementation of a data cache.</summary>
|
||||
/// <param name="pUnkOuter">
|
||||
|
@ -1956,7 +2083,8 @@ public static partial class Ole32
|
|||
// pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID *ppv );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "8a64675b-1337-4555-b9a6-e19f9b987ba2")]
|
||||
public static extern HRESULT CreateDataCache([MarshalAs(UnmanagedType.IUnknown), Optional] object pUnkOuter, in Guid rclsid, in Guid iid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
|
||||
public static extern HRESULT CreateDataCache([MarshalAs(UnmanagedType.IUnknown), Optional] object? pUnkOuter, in Guid rclsid, in Guid iid,
|
||||
[MarshalAs(UnmanagedType.IUnknown)] out object? ppv);
|
||||
|
||||
/// <summary>Creates a file moniker based on the specified path.</summary>
|
||||
/// <param name="lpszPathName">
|
||||
|
@ -2014,7 +2142,7 @@ public static partial class Ole32
|
|||
// lpszPathName, LPMONIKER *ppmk );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "d9677fa0-cda0-4b63-a21f-1fd0e27c8f3f")]
|
||||
public static extern HRESULT CreateFileMoniker([MarshalAs(UnmanagedType.LPWStr)] string lpszPathName, out IMoniker ppmk);
|
||||
public static extern HRESULT CreateFileMoniker([MarshalAs(UnmanagedType.LPWStr)] string lpszPathName, out IMoniker? ppmk);
|
||||
|
||||
/// <summary>Performs a generic composition of two monikers and supplies a pointer to the resulting composite moniker.</summary>
|
||||
/// <param name="pmkFirst">
|
||||
|
@ -2076,7 +2204,7 @@ public static partial class Ole32
|
|||
// LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER *ppmkComposite );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "7fe5b3ff-6e9b-4a28-93d3-52c76d3e8b77")]
|
||||
public static extern HRESULT CreateGenericComposite(IMoniker pmkFirst, IMoniker pmkRest, out IMoniker ppmkComposite);
|
||||
public static extern HRESULT CreateGenericComposite(IMoniker pmkFirst, IMoniker pmkRest, out IMoniker? ppmkComposite);
|
||||
|
||||
/// <summary>Creates an item moniker that identifies an object within a containing object (typically a compound document).</summary>
|
||||
/// <param name="lpszDelim">
|
||||
|
@ -2129,7 +2257,7 @@ public static partial class Ole32
|
|||
// lpszDelim, LPCOLESTR lpszItem, LPMONIKER *ppmk );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "339919ed-660c-4239-825b-7fa96c48e5cd")]
|
||||
public static extern HRESULT CreateItemMoniker([MarshalAs(UnmanagedType.LPWStr)] string lpszDelim, [MarshalAs(UnmanagedType.LPWStr)] string lpszItem, out IMoniker ppmk);
|
||||
public static extern HRESULT CreateItemMoniker([MarshalAs(UnmanagedType.LPWStr)] string lpszDelim, [MarshalAs(UnmanagedType.LPWStr)] string lpszItem, out IMoniker? ppmk);
|
||||
|
||||
/// <summary>Creates an OBJREF moniker based on a pointer to an object.</summary>
|
||||
/// <param name="punk">A pointer to the IUnknown interface on the object that the moniker is to represent.</param>
|
||||
|
@ -2190,7 +2318,7 @@ public static partial class Ole32
|
|||
// LPUNKNOWN punk, LPMONIKER *ppmk );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "d4d40fd5-6035-4ddc-a443-01d32dcf4bca")]
|
||||
public static extern HRESULT CreatePointerMoniker([MarshalAs(UnmanagedType.IUnknown)] object punk, out IMoniker ppmk);
|
||||
public static extern HRESULT CreatePointerMoniker([MarshalAs(UnmanagedType.IUnknown)] object punk, out IMoniker? ppmk);
|
||||
|
||||
/// <summary>Returns the CLSID associated with the specified file name.</summary>
|
||||
/// <param name="szFilename">A pointer to the filename for which you are requesting the associated CLSID.</param>
|
||||
|
@ -2472,7 +2600,7 @@ public static partial class Ole32
|
|||
// LPMONIKER pmkThis, LPMONIKER pmkOther, LPMONIKER *ppmkCommon );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "6caa8c2e-c3d6-45d5-8efe-74d6a2c4a926")]
|
||||
public static extern HRESULT MonikerCommonPrefixWith(IMoniker pmkThis, IMoniker pmkOther, out IMoniker ppmkCommon);
|
||||
public static extern HRESULT MonikerCommonPrefixWith(IMoniker pmkThis, IMoniker pmkOther, out IMoniker? ppmkCommon);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -2537,7 +2665,8 @@ public static partial class Ole32
|
|||
// LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER *ppmkRelPath, BOOL dwReserved );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("objbase.h", MSDNShortId = "55ab4db3-a94e-48ba-abe3-44963c35e062")]
|
||||
public static extern HRESULT MonikerRelativePathTo(IMoniker pmkSrc, IMoniker pmkDest, out IMoniker ppmkRelPath, [MarshalAs(UnmanagedType.Bool)] bool dwReserved = false);
|
||||
public static extern HRESULT MonikerRelativePathTo(IMoniker pmkSrc, IMoniker pmkDest, out IMoniker? ppmkRelPath,
|
||||
[MarshalAs(UnmanagedType.Bool)] bool dwReserved = false);
|
||||
|
||||
/// <summary>Provides a CO_MTA_USAGE_COOKIE.</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
@ -2550,7 +2679,7 @@ public static partial class Ole32
|
|||
public CO_MTA_USAGE_COOKIE(IntPtr preexistingHandle) => handle = preexistingHandle;
|
||||
|
||||
/// <summary>Returns an invalid handle by instantiating a <see cref="CO_MTA_USAGE_COOKIE"/> object with <see cref="IntPtr.Zero"/>.</summary>
|
||||
public static CO_MTA_USAGE_COOKIE NULL => new CO_MTA_USAGE_COOKIE(IntPtr.Zero);
|
||||
public static CO_MTA_USAGE_COOKIE NULL => new(IntPtr.Zero);
|
||||
|
||||
/// <summary>Gets a value indicating whether this instance is a null handle.</summary>
|
||||
public bool IsNull => handle == IntPtr.Zero;
|
||||
|
@ -2563,7 +2692,7 @@ public static partial class Ole32
|
|||
/// <summary>Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="CO_MTA_USAGE_COOKIE"/>.</summary>
|
||||
/// <param name="h">The pointer to a handle.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
public static implicit operator CO_MTA_USAGE_COOKIE(IntPtr h) => new CO_MTA_USAGE_COOKIE(h);
|
||||
public static implicit operator CO_MTA_USAGE_COOKIE(IntPtr h) => new(h);
|
||||
|
||||
/// <summary>Implements the operator !=.</summary>
|
||||
/// <param name="h1">The first handle.</param>
|
||||
|
@ -2578,7 +2707,7 @@ public static partial class Ole32
|
|||
public static bool operator ==(CO_MTA_USAGE_COOKIE h1, CO_MTA_USAGE_COOKIE h2) => h1.Equals(h2);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object obj) => obj is CO_MTA_USAGE_COOKIE h ? handle == h.handle : false;
|
||||
public override bool Equals(object? obj) => obj is CO_MTA_USAGE_COOKIE h && handle == h.handle;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => handle.GetHashCode();
|
||||
|
@ -2680,7 +2809,7 @@ public static partial class Ole32
|
|||
|
||||
/// <summary>The name of the computer.</summary>
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string pwszName;
|
||||
public string? pwszName;
|
||||
|
||||
/// <summary>
|
||||
/// A pointer to a COAUTHINFO structure to override the default activation security for machine remote activations. Otherwise,
|
||||
|
|
|
@ -605,7 +605,7 @@ public static partial class Ole32
|
|||
// LPOLESTR pszKey, IUnknown **ppunk );
|
||||
[PInvokeData("objidl.h", MSDNShortId = "8f423495-7a34-4901-968e-1fe204680d8a")]
|
||||
[PreserveSig]
|
||||
HRESULT GetObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey, [MarshalAs(UnmanagedType.Interface)] out object ppunk);
|
||||
HRESULT GetObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey, [MarshalAs(UnmanagedType.Interface)] out object? ppunk);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a pointer to an interface that can be used to enumerate the keys of the bind context's string-keyed table of pointers.
|
||||
|
@ -633,7 +633,7 @@ public static partial class Ole32
|
|||
// IEnumString **ppenum );
|
||||
[PInvokeData("objidl.h", MSDNShortId = "9e799ce4-e9b3-4b31-98a0-2167a0c19848")]
|
||||
[PreserveSig]
|
||||
HRESULT EnumObjectParam(out IEnumString ppenum);
|
||||
HRESULT EnumObjectParam(out IEnumString? ppenum);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the specified key and its associated pointer from the bind context's string-keyed table of objects. The key must
|
||||
|
@ -802,7 +802,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-idataadviseholder-advise HRESULT Advise( IDataObject
|
||||
// *pDataObject, FORMATETC *pFetc, DWORD advf, IAdviseSink *pAdvise, DWORD *pdwConnection );
|
||||
[PreserveSig]
|
||||
HRESULT Advise([Optional] IDataObject pDataObject, in FORMATETC pFetc, ADVF advf, IAdviseSink pAdvise, out uint pdwConnection);
|
||||
HRESULT Advise([Optional] IDataObject? pDataObject, in FORMATETC pFetc, ADVF advf, IAdviseSink pAdvise, out uint pdwConnection);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a connection between a data object and an advisory sink that was set up through a previous call to
|
||||
|
@ -850,7 +850,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/zh-cn/windows/win32/api/objidl/nf-objidl-idataadviseholder-enumadvise HRESULT EnumAdvise(
|
||||
// IEnumSTATDATA **ppenumAdvise );
|
||||
[PreserveSig]
|
||||
HRESULT EnumAdvise(out IEnumSTATDATA ppenumAdvise);
|
||||
HRESULT EnumAdvise(out IEnumSTATDATA? ppenumAdvise);
|
||||
|
||||
/// <summary>
|
||||
/// Sends notifications to each advise sink for which there is a connection established by calling the IAdviseSink::OnDataChange
|
||||
|
@ -885,7 +885,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-idataadviseholder-sendondatachange HRESULT
|
||||
// SendOnDataChange( IDataObject *pDataObject, DWORD dwReserved, DWORD advf );
|
||||
[PreserveSig]
|
||||
HRESULT SendOnDataChange(IDataObject pDataObject, [Optional] uint dwReserved, ADVF advf);
|
||||
HRESULT SendOnDataChange(IDataObject pDataObject, [Optional] uint dwReserved, [Optional] ADVF advf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1539,7 +1539,7 @@ public static partial class Ole32
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-idataobject-dadvise HRESULT DAdvise( [in] FORMATETC
|
||||
// *pformatetc, [in] DWORD advf, [in] IAdviseSink *pAdvSink, [out] DWORD *pdwConnection );
|
||||
[PreserveSig]
|
||||
HRESULT DAdvise(in FORMATETC pformatetc, ADVF advf, [In, Optional, MarshalAs(UnmanagedType.Interface)] IAdviseSink pAdvSink, out uint pdwConnection);
|
||||
HRESULT DAdvise(in FORMATETC pformatetc, ADVF advf, [In, Optional, MarshalAs(UnmanagedType.Interface)] IAdviseSink? pAdvSink, out uint pdwConnection);
|
||||
|
||||
/// <summary>Destroys a notification connection that had been previously set up.</summary>
|
||||
/// <param name="dwConnection">
|
||||
|
@ -1618,7 +1618,7 @@ public static partial class Ole32
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-idataobject-enumdadvise HRESULT EnumDAdvise( [out]
|
||||
// IEnumSTATDATA **ppenumAdvise );
|
||||
[PreserveSig]
|
||||
HRESULT EnumDAdvise([Optional, MarshalAs(UnmanagedType.Interface)] out IEnumSTATDATA ppenumAdvise);
|
||||
HRESULT EnumDAdvise([Optional, MarshalAs(UnmanagedType.Interface)] out IEnumSTATDATA? ppenumAdvise);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -497,7 +497,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-imessagefilter-handleincomingcall DWORD
|
||||
// HandleInComingCall( DWORD dwCallType, HTASK htaskCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo );
|
||||
[PreserveSig]
|
||||
SERVERCALL HandleInComingCall(CALLTYPE dwCallType, HTASK htaskCaller, uint dwTickCount, [Optional] INTERFACEINFO lpInterfaceInfo);
|
||||
SERVERCALL HandleInComingCall(CALLTYPE dwCallType, HTASK htaskCaller, uint dwTickCount, [Optional] INTERFACEINFO? lpInterfaceInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Provides applications with an opportunity to display a dialog box offering retry, cancel, or task-switching options.
|
||||
|
@ -1039,7 +1039,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersiststorage-savecompleted HRESULT SaveCompleted(
|
||||
// IStorage *pStgNew );
|
||||
void SaveCompleted([In] IStorage pStgNew);
|
||||
void SaveCompleted([In] IStorage? pStgNew);
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the object to release all storage objects that have been passed to it by its container and to enter HandsOff mode.
|
||||
|
@ -1501,7 +1501,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-irunnableobject-run HRESULT Run( LPBINDCTX pbc );
|
||||
[PreserveSig]
|
||||
HRESULT Run(IBindCtx pbc);
|
||||
HRESULT Run(IBindCtx? pbc);
|
||||
|
||||
/// <summary>Determines whether an object is currently in the running state.</summary>
|
||||
/// <returns>If the object is in the running state, the return value is <c>TRUE</c>. Otherwise, it is <c>FALSE</c>.</returns>
|
||||
|
|
|
@ -194,47 +194,32 @@ public static partial class Ole32
|
|||
/// </summary>
|
||||
/// <param name="pmkObjectName">A pointer to the IMoniker interface on the moniker.</param>
|
||||
/// <returns>
|
||||
/// <para>This method can return the following values.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>Indicates that pmkObjectName was found in the ROT and a pointer was retrieved.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>S_FALSE</term>
|
||||
/// <term>
|
||||
/// There is no entry for pmkObjectName in the ROT, or that the object it identifies is no longer running (in which case, the
|
||||
/// entry is revoked).
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// A pointer to an IUnknown pointer variable that receives the interface pointer to the running object. When successful, the
|
||||
/// implementation calls AddRef on the object; it is the caller's responsibility to call Release. If the object is not running or if
|
||||
/// an error occurs, the implementation sets * <c>ppunkObject</c> to <c>NULL</c>.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method checks the ROT for the moniker specified by pmkObjectName. If that moniker had previously been registered with a
|
||||
/// call to IRunningObjectTable::Register, this method returns the pointer that was registered at that time.
|
||||
/// This method checks the ROT for the moniker specified by <c>pmkObjectName</c>. If that moniker had previously been registered with
|
||||
/// a call to IRunningObjectTable::Register, this method returns the pointer that was registered at that time.
|
||||
/// </para>
|
||||
/// <para>Notes to Callers</para>
|
||||
/// <para>
|
||||
/// Generally, you call the <c>IRunningObjectTable::GetObject</c> method only if you are writing your own moniker class (that
|
||||
/// is, implementing the IMoniker interface). You typically call this method from your implementation of IMoniker::BindToObject.
|
||||
/// Generally, you call the <c>IRunningObjectTable::GetObject</c> method only if you are writing your own moniker class (that is,
|
||||
/// implementing the IMoniker interface). You typically call this method from your implementation of IMoniker::BindToObject.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// However, note that not all implementations of IMoniker::BindToObject need to call this method. If you expect your moniker to
|
||||
/// have a prefix (indicated by a non- <c>NULL</c> pmkToLeft parameter to <c>IMoniker::BindToObject</c>), you should not check
|
||||
/// the ROT. The reason for this is that only complete monikers are registered with the ROT, and if your moniker has a prefix,
|
||||
/// your moniker is part of a composite and thus not complete. Instead, your moniker should request services from the object
|
||||
/// identified by the prefix (for example, the container of the object identified by your moniker).
|
||||
/// However, note that not all implementations of IMoniker::BindToObject need to call this method. If you expect your moniker to have
|
||||
/// a prefix (indicated by a non- <c>NULL</c><c>pmkToLeft</c> parameter to <c>IMoniker::BindToObject</c>), you should not check the
|
||||
/// ROT. The reason for this is that only complete monikers are registered with the ROT, and if your moniker has a prefix, your
|
||||
/// moniker is part of a composite and thus not complete. Instead, your moniker should request services from the object identified by
|
||||
/// the prefix (for example, the container of the object identified by your moniker).
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-irunningobjecttable-getobject HRESULT GetObject(
|
||||
// IMoniker *pmkObjectName, IUnknown **ppunkObject );
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-irunningobjecttable-getobject
|
||||
// HRESULT GetObject( [in] IMoniker *pmkObjectName, [out] IUnknown **ppunkObject );
|
||||
[return: MarshalAs(UnmanagedType.IUnknown)]
|
||||
object GetObject([In] IMoniker pmkObjectName);
|
||||
object? GetObject([In] IMoniker pmkObjectName);
|
||||
|
||||
/// <summary>
|
||||
/// Records the time that a running object was last modified. The object must have previously been registered with the running
|
||||
|
@ -313,7 +298,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-irunningobjecttable-enumrunning HRESULT EnumRunning(
|
||||
// IEnumMoniker **ppenumMoniker );
|
||||
IEnumMoniker EnumRunning();
|
||||
IEnumMoniker? EnumRunning();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -363,9 +348,7 @@ public static partial class Ole32
|
|||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IStream CreateStream([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName,
|
||||
[In] STGM grfMode,
|
||||
[In, Optional] uint reserved1,
|
||||
[In, Optional] uint reserved2);
|
||||
[In] STGM grfMode, [In, Optional] uint reserved1, [In, Optional] uint reserved2);
|
||||
|
||||
/// <summary>The OpenStream method opens an existing stream object within this storage object in the specified access mode.</summary>
|
||||
/// <param name="pwcsName">
|
||||
|
@ -383,8 +366,7 @@ public static partial class Ole32
|
|||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IStream OpenStream([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName, [In, Optional] IntPtr reserved1,
|
||||
[In] STGM grfMode,
|
||||
[In, Optional] uint reserved2);
|
||||
[In] STGM grfMode, [In, Optional] uint reserved2);
|
||||
|
||||
/// <summary>
|
||||
/// The CreateStorage method creates and opens a new storage object nested within this storage object with the specified name in
|
||||
|
@ -405,9 +387,7 @@ public static partial class Ole32
|
|||
/// <returns>On return, the new IStorage interface pointer.</returns>
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IStorage CreateStorage([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName,
|
||||
[In] STGM grfMode,
|
||||
[In, Optional] uint reserved1,
|
||||
IStorage CreateStorage([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName, [In] STGM grfMode, [In, Optional] uint reserved1,
|
||||
[In, Optional] uint reserved2);
|
||||
|
||||
/// <summary>The OpenStorage method opens an existing storage object with the specified name in the specified access mode.</summary>
|
||||
|
@ -426,11 +406,8 @@ public static partial class Ole32
|
|||
/// <returns>On return, the IStorage interface pointer to the opened storage.</returns>
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IStorage OpenStorage([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName,
|
||||
[In, Optional, MarshalAs(UnmanagedType.Interface)] IStorage pstgPriority,
|
||||
[In] STGM grfMode,
|
||||
[In, Optional] SNB snbExclude,
|
||||
[In, Optional] uint reserved);
|
||||
IStorage OpenStorage([In, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, [In, Optional, MarshalAs(UnmanagedType.Interface)] IStorage? pstgPriority,
|
||||
[In] STGM grfMode, [In, Optional] SNB? snbExclude, [In, Optional] uint reserved);
|
||||
|
||||
/// <summary>The CopyTo method copies the entire contents of an open storage object to another storage object.</summary>
|
||||
/// <param name="ciidExclude">
|
||||
|
@ -455,10 +432,8 @@ public static partial class Ole32
|
|||
/// calling its IStorage::Revert method.
|
||||
/// </param>
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
void CopyTo([In, Optional] uint ciidExclude,
|
||||
[In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[]? rgiidExclude,
|
||||
[In] SNB snbExclude,
|
||||
[In, MarshalAs(UnmanagedType.Interface)] IStorage pstgDest);
|
||||
void CopyTo([In, Optional] uint ciidExclude, [In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[]? rgiidExclude,
|
||||
[In, Optional] SNB? snbExclude, [In, MarshalAs(UnmanagedType.Interface)] IStorage pstgDest);
|
||||
|
||||
/// <summary>
|
||||
/// The MoveElementTo method copies or moves a substorage or stream from this storage object to another storage object.
|
||||
|
@ -470,9 +445,8 @@ public static partial class Ole32
|
|||
/// Specifies whether the operation should be a move (STGMOVE_MOVE) or a copy (STGMOVE_COPY). See the STGMOVE enumeration.
|
||||
/// </param>
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
void MoveElementTo([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName,
|
||||
[In, MarshalAs(UnmanagedType.Interface)] IStorage pstgDest, [In, MarshalAs(UnmanagedType.LPWStr)] string pwcsNewName,
|
||||
[In] STGMOVE grfFlags);
|
||||
void MoveElementTo([In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName, [In, MarshalAs(UnmanagedType.Interface)] IStorage pstgDest,
|
||||
[In, MarshalAs(UnmanagedType.LPWStr)] string pwcsNewName, [In] STGMOVE grfFlags);
|
||||
|
||||
/// <summary>
|
||||
/// The Commit method ensures that any changes made to a storage object open in transacted mode are reflected in the parent
|
||||
|
@ -657,7 +631,7 @@ public static partial class Ole32
|
|||
/// </typeparam>
|
||||
/// <param name="e">The <see cref="IEnumUnknown"/> instance.</param>
|
||||
/// <returns>The enumerated values.</returns>
|
||||
public static IEnumerable<T> Enumerate<T>(this IEnumUnknown e) where T : class => e.Enumerate().Select(p => p == IntPtr.Zero ? null : (T)Marshal.GetObjectForIUnknown(p));
|
||||
public static IEnumerable<T?> Enumerate<T>(this IEnumUnknown e) where T : class => e.Enumerate().Select(p => p == IntPtr.Zero ? null : (T)Marshal.GetObjectForIUnknown(p));
|
||||
|
||||
/// <summary>Structure returned by IEnumContextProps::Enum</summary>
|
||||
[PInvokeData("objidl.h", MSDNShortId = "64591e45-5478-4360-8c1f-08b09b5aef8e")]
|
||||
|
@ -691,35 +665,67 @@ public static partial class Ole32
|
|||
// tdSize; WORD tdDriverNameOffset; WORD tdDeviceNameOffset; WORD tdPortNameOffset; WORD tdExtDevmodeOffset; BYTE tdData[1]; } DVTARGETDEVICE;
|
||||
[PInvokeData("objidl.h", MSDNShortId = "724ff714-c170-4d06-92cb-e042e41c0af2")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct DVTARGETDEVICE
|
||||
public class DVTARGETDEVICE : SafeCoTaskMemHandle
|
||||
{
|
||||
/// <summary>
|
||||
/// The size, in bytes, of the <c>DVTARGETDEVICE</c> structure. The initial size is included so the structure can be copied more easily.
|
||||
/// </summary>
|
||||
public uint tdSize;
|
||||
private const int structSz = 13;
|
||||
private readonly List<string?> names = new() { "", null, null };
|
||||
private readonly ushort dataOff = 12, nameOff;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="DVTARGETDEVICE"/> class.</summary>
|
||||
public DVTARGETDEVICE() : base(structSz + Marshal.SizeOf(typeof(DEVMODE)) + 8)
|
||||
{
|
||||
nameOff = (ushort)(dataOff + Marshal.SizeOf(typeof(DEVMODE)));
|
||||
Write((uint)structSz, false, 0); // tdSize
|
||||
Write(dataOff, false, 10); // tdExtDevmodeOffset
|
||||
UpdateNames();
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="DVTARGETDEVICE"/> class with values.</summary>
|
||||
/// <param name="driverName">Name of the driver.</param>
|
||||
/// <param name="deviceName">Name of the device.</param>
|
||||
/// <param name="portName">Name of the port.</param>
|
||||
/// <param name="devMode">The DEVMODE structure reference retrieved by calling DocumentProperties.</param>
|
||||
public DVTARGETDEVICE(string driverName, string? deviceName, string? portName, DEVMODE? devMode = null) : this()
|
||||
{
|
||||
names[0] = driverName;
|
||||
names[1] = deviceName;
|
||||
names[2] = portName;
|
||||
UpdateNames();
|
||||
if (devMode.HasValue)
|
||||
Write(devMode.Value, false, dataOff);
|
||||
}
|
||||
|
||||
private void UpdateNames()
|
||||
{
|
||||
using SafeCoTaskMemHandle mem = CreateFromStringList(names.Select(n => n ?? ""), StringListPackMethod.Concatenated, CharSet.Unicode);
|
||||
Size = (uint)nameOff + mem.Size;
|
||||
mem.DangerousGetHandle().CopyTo(handle.Offset(nameOff), mem.Size);
|
||||
|
||||
var off = nameOff;
|
||||
mem.Write(off, false, 4); // tdDriverNameOffset
|
||||
off += (ushort)names[0].GetByteCount(true, CharSet.Unicode);
|
||||
mem.Write(names[1] is null ? 0 : off, false, 6); // tdDeviceNameOffset
|
||||
off += (ushort)(names[1] ?? "").GetByteCount(true, CharSet.Unicode);
|
||||
mem.Write(names[2] is null ? 0 : off, false, 8); // tdPortNameOffset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The offset, in bytes, from the beginning of the structure to the device driver name, which is stored as a NULL-terminated
|
||||
/// string in the <c>tdData</c> buffer.
|
||||
/// The device driver name.
|
||||
/// </summary>
|
||||
public ushort tdDriverNameOffset;
|
||||
public string tdDriverName { get => names[0]!; set { names[0] = value ?? throw new ArgumentNullException(); UpdateNames(); } }
|
||||
|
||||
/// <summary>
|
||||
/// The offset, in bytes, from the beginning of the structure to the device name, which is stored as a NULL-terminated string in
|
||||
/// the <c>tdData</c> buffer. This value can be zero to indicate no device name.
|
||||
/// The device name, which can be <see langword="null"/> to indicate no device name.
|
||||
/// </summary>
|
||||
public ushort tdDeviceNameOffset;
|
||||
public string? tdDeviceName { get => names[1] == string.Empty ? null : names[1]; set { names[1] = value; UpdateNames(); } }
|
||||
|
||||
/// <summary>
|
||||
/// The offset, in bytes, from the beginning of the structure to the port name, which is stored as a NULL-terminated string in
|
||||
/// the <c>tdData</c> buffer. This value can be zero to indicate no port name.
|
||||
/// The port name, which can be <see langword="null"/> to indicate no port name.
|
||||
/// </summary>
|
||||
public ushort tdPortNameOffset;
|
||||
public string? tdPortName { get => names[2] == string.Empty ? null : names[2]; set { names[2] = value; UpdateNames(); } }
|
||||
|
||||
/// <summary>The offset, in bytes, from the beginning of the structure to the DEVMODE structure retrieved by calling DocumentProperties.</summary>
|
||||
public ushort tdExtDevmodeOffset;
|
||||
|
||||
private byte _tdData;
|
||||
/// <summary>The DEVMODE structure reference retrieved by calling DocumentProperties.</summary>
|
||||
public ref DEVMODE tdExtDevmode => ref handle.AsRef<DEVMODE>(dataOff, Size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -863,7 +869,8 @@ public static partial class Ole32
|
|||
/// <param name="bo">The <see cref="BIND_OPTS_V"/> instance.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
public static implicit operator System.Runtime.InteropServices.ComTypes.BIND_OPTS(BIND_OPTS_V bo) =>
|
||||
new System.Runtime.InteropServices.ComTypes.BIND_OPTS { cbStruct = (int)bo.cbStruct, grfFlags = (int)bo.grfFlags, grfMode = (int)bo.grfFlags, dwTickCountDeadline = (int)bo.dwTickCountDeadline };
|
||||
new()
|
||||
{ cbStruct = (int)bo.cbStruct, grfFlags = (int)bo.grfFlags, grfMode = (int)bo.grfFlags, dwTickCountDeadline = (int)bo.dwTickCountDeadline };
|
||||
|
||||
/// <summary>
|
||||
/// Performs an implicit conversion from <see cref="System.Runtime.InteropServices.ComTypes.BIND_OPTS"/> to <see cref="BIND_OPTS_V"/>.
|
||||
|
@ -871,7 +878,7 @@ public static partial class Ole32
|
|||
/// <param name="bo">The <see cref="System.Runtime.InteropServices.ComTypes.BIND_OPTS"/> instance.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
public static implicit operator BIND_OPTS_V(System.Runtime.InteropServices.ComTypes.BIND_OPTS bo) =>
|
||||
new BIND_OPTS_V() { grfFlags = (BIND_FLAGS)bo.grfFlags, grfMode = (STGM)bo.grfFlags, dwTickCountDeadline = (uint)bo.dwTickCountDeadline };
|
||||
new() { grfFlags = (BIND_FLAGS)bo.grfFlags, grfMode = (STGM)bo.grfFlags, dwTickCountDeadline = (uint)bo.dwTickCountDeadline };
|
||||
}
|
||||
|
||||
/// <summary>Contains parameters used during a moniker-binding operation.</summary>
|
||||
|
@ -969,8 +976,8 @@ public static partial class Ole32
|
|||
|
||||
/// <summary>Simple generic implementation of <see cref="IEnumUnknown"/>.</summary>
|
||||
/// <typeparam name="T">The type to enumerate.</typeparam>
|
||||
/// <seealso cref="System.Collections.Generic.IReadOnlyList{T}"/>
|
||||
/// <seealso cref="Vanara.PInvoke.Ole32.IEnumUnknown"/>
|
||||
/// <seealso cref="IReadOnlyList{T}"/>
|
||||
/// <seealso cref="IEnumUnknown"/>
|
||||
public class IEnumUnknownImpl<T> : IReadOnlyList<T>, IEnumUnknown where T : class
|
||||
{
|
||||
private int current = -1;
|
||||
|
@ -1073,7 +1080,8 @@ public static partial class Ole32
|
|||
public class INTERFACEINFO
|
||||
{
|
||||
/// <summary>A pointer to the IUnknown interface on the object.</summary>
|
||||
[MarshalAs(UnmanagedType.IUnknown)] public object pUnk;
|
||||
[MarshalAs(UnmanagedType.IUnknown)]
|
||||
public object? pUnk;
|
||||
|
||||
/// <summary>The identifier of the requested interface.</summary>
|
||||
public Guid iid;
|
||||
|
@ -1087,7 +1095,7 @@ public static partial class Ole32
|
|||
/// used by the IStorage interface and by function calls that open storage objects. The strings point to contained storage objects
|
||||
/// or streams that are to be excluded in the open calls.
|
||||
/// </summary>
|
||||
/// <seealso cref="System.IDisposable"/>
|
||||
/// <seealso cref="IDisposable"/>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public class SNB : IDisposable
|
||||
{
|
||||
|
@ -1095,10 +1103,10 @@ public static partial class Ole32
|
|||
|
||||
/// <summary>Initializes a new instance of the <see cref="SNB"/> class.</summary>
|
||||
/// <param name="names">The list of names to associate with this instance.</param>
|
||||
public SNB(IEnumerable<string> names) => ptr = names == null ? SafeCoTaskMemHandle.Null : SafeCoTaskMemHandle.CreateFromStringList(names, StringListPackMethod.Packed, CharSet.Unicode);
|
||||
public SNB(IEnumerable<string?> names) => ptr = names == null ? SafeCoTaskMemHandle.Null : SafeCoTaskMemHandle.CreateFromStringList(names!, StringListPackMethod.Packed, CharSet.Unicode);
|
||||
|
||||
/// <summary>Prevents a default instance of the <see cref="SNB"/> class from being created.</summary>
|
||||
private SNB() { }
|
||||
private SNB() => ptr = SafeCoTaskMemHandle.Null;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="SNB"/> class.</summary>
|
||||
/// <param name="p">The native pointer.</param>
|
||||
|
@ -1106,19 +1114,19 @@ public static partial class Ole32
|
|||
|
||||
/// <summary>Gets the names.</summary>
|
||||
/// <value>The names.</value>
|
||||
public IEnumerable<string> Names => ptr.ToStringEnum(Count, CharSet.Unicode);
|
||||
public IEnumerable<string?> Names => ptr.ToStringEnum(Count, CharSet.Unicode);
|
||||
|
||||
private int Count => ptr.DangerousGetHandle().GetNulledPtrArrayLength();
|
||||
|
||||
/// <summary>Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="SNB"/>.</summary>
|
||||
/// <param name="p">The native pointer to take ownership of.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
public static implicit operator SNB(IntPtr p) => new SNB(p);
|
||||
public static implicit operator SNB(IntPtr p) => new(p);
|
||||
|
||||
/// <summary>Performs an implicit conversion from <see cref="IEnumerable{T}"/> to <see cref="SNB"/>.</summary>
|
||||
/// <param name="names">The names.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
public static implicit operator SNB(string[] names) => new SNB(names);
|
||||
public static implicit operator SNB(string?[] names) => new(names);
|
||||
|
||||
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
|
||||
void IDisposable.Dispose() => ptr?.Dispose();
|
||||
|
|
|
@ -294,7 +294,7 @@ public static partial class Ole32
|
|||
public enum RPCOPT_PROPERTIES
|
||||
{
|
||||
/// <summary>Controls how long your machine will attempt to establish RPC communications with another before failing.</summary>
|
||||
[CorrespondingType(typeof(Rpc.RCP_C_BINDING_TIMEOUT), CorrespondingAction.GetSet)]
|
||||
[CorrespondingType(typeof(RCP_C_BINDING_TIMEOUT), CorrespondingAction.GetSet)]
|
||||
COMBND_RPCTIMEOUT = 0x01,
|
||||
|
||||
/// <summary>Describes the degree of remoteness of the RPC connection.</summary>
|
||||
|
@ -420,7 +420,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-icallfactory-createcall HRESULT CreateCall( REFIID riid,
|
||||
// IUnknown *pCtrlUnk, REFIID riid2, IUnknown **ppv );
|
||||
[PreserveSig]
|
||||
HRESULT CreateCall(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object pCtrlUnk,
|
||||
HRESULT CreateCall(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object? pCtrlUnk,
|
||||
in Guid riid2, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 2)] out object ppv);
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ public static partial class Ole32
|
|||
// *pAuthInfo, DWORD dwCapabilities );
|
||||
[PreserveSig]
|
||||
HRESULT SetBlanket([In, MarshalAs(UnmanagedType.IUnknown)] object pProxy, RPC_C_AUTHN dwAuthnSvc, RPC_C_AUTHZ dwAuthzSvc,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pServerPrincName, RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string? pServerPrincName, RPC_C_AUTHN_LEVEL dwAuthnLevel, RPC_C_IMP_LEVEL dwImpLevel,
|
||||
[In, Optional] IntPtr pAuthInfo, EOLE_AUTHENTICATION_CAPABILITIES dwCapabilities);
|
||||
|
||||
/// <summary>Makes a private copy of the proxy for the specified interface.</summary>
|
||||
|
@ -1398,58 +1398,133 @@ public static partial class Ole32
|
|||
/// <term>Values</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>COMGLB_APPID</term>
|
||||
/// <term>The AppID for the process. This is the only supported property on Windows XP.</term>
|
||||
/// <description>COMGLB_APPID</description>
|
||||
/// <description>The AppID for the process. This is the only supported property on Windows XP.</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>COMGLB_EXCEPTION_HANDLING</term>
|
||||
/// <term>
|
||||
/// Possible values for the COMGLB_EXCEPTION_HANDLING property are: By default, the COM runtime handles fatal exceptions raised
|
||||
/// during method invocations by returning the RPC_E_SERVERFAULT error code to the client. An application disables this behavior to
|
||||
/// allow exceptions to propagate to WER, which creates application process dumps and terminates the application. This prevents
|
||||
/// possible data corruption and allows an application vendor to debug the dumps. For new applications, it is recommended that the
|
||||
/// COMGLB_EXCEPTION_HANDLING property be set to COMGLB_EXCEPTION_DONOT_HANDLE_ANY.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <description>COMGLB_EXCEPTION_HANDLING</description>
|
||||
/// <description>
|
||||
/// <para>Possible values for the COMGLB_EXCEPTION_HANDLING property are:</para>
|
||||
/// <list type="bullet">
|
||||
/// <item>COMGLB_EXCEPTION_HANDLE: This is the default behavior. This setting causes the COM runtime to handle fatal exceptions.</item>
|
||||
/// <item>COMGLB_EXCEPTION_DONOT_HANDLE: This causes the COM runtime not to handle fatal exceptions.</item>
|
||||
/// <item>COMGLB_EXCEPTION_DONOT_HANDLE_FATAL: Alias for COMGLB_EXCEPTION_DONOT_HANDLE. Supported in Windows 7 and later.</item>
|
||||
/// <item>
|
||||
/// <term>COMGLB_RPC_THREADPOOL_SETTING</term>
|
||||
/// <term>
|
||||
/// Possible values for the COMGLB_RPC_THREADPOOL_SETTING property in the Set method are: Possible values for the
|
||||
/// COMGLB_RPC_THREADPOOL_SETTING property in the Query method are: RPC uses the system thread pool by default in Windows 7. Since
|
||||
/// the system thread pool is shared by multiple components in the process, COM and RPC operations may behave incorrectly if the
|
||||
/// thread pool state is corrupted by a component. The COMGLB_RPC_THREADPOOL_SETTING property can be used to change the RPC thread
|
||||
/// pool behavior. Changing the default behavior will incur a performance penalty since this causes RPC to use an extra thread.
|
||||
/// Therefore, care should be exercised when changing this setting. It is recommended that this setting is changed only for
|
||||
/// application compatibility reasons. Note This property is only supported in Windows 7 and later versions of Windows.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>COMGLB_RO_SETTINGS</term>
|
||||
/// <term>
|
||||
/// Possible values for the COMGLB_RO_SETTINGS property are: Note This property is only supported in Windows 8 and later versions of Windows.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>COMGLB_UNMARSHALING_POLICY</term>
|
||||
/// <term>
|
||||
/// Possible values for the COMGLB_UNMARSHALING_POLICY property are: Note This property is only supported in Windows 8 and later
|
||||
/// versions of Windows.
|
||||
/// </term>
|
||||
/// COMGLB_EXCEPTION_DONOT_HANDLE_ANY: When set and a fatal exception occurs in a COM method, this causes the COM runtime to not handle
|
||||
/// the exception. <br/> When set and a non-fatal exception occurs in a COM method, this causes the COM runtime to create a Windows Error
|
||||
/// Reporting (WER) dump and terminate the process. Supported in Windows 7 and later.
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// It's important for applications that detect crashes and other exceptions that might be generated while executing inbound COM
|
||||
/// calls, for example a call on a local server or when executing the IDropTarget::Drop method, to set COMGLB_EXCEPTION_HANDLING to
|
||||
/// COMGLB_EXCEPTION_DONOT_HANDLE to disable COM behavior of catching exceptions. Failure to do this can lead to corrupt process
|
||||
/// state, for example locks held when these exceptions are thrown are abandoned, and the process could enter an inconsistent state.
|
||||
/// By default, the COM runtime handles fatal exceptions raised during method invocations by returning the RPC_E_SERVERFAULT error code
|
||||
/// to the client. An application disables this behavior to allow exceptions to propagate to WER, which creates application process dumps
|
||||
/// and terminates the application. This prevents possible data corruption and allows an application vendor to debug the dumps.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <note type="note">Even if COM runtime exception handling is disabled, exceptions might not propagate to WER if there is another
|
||||
/// application-level exception handler in the process that handles the exception.</note>
|
||||
/// </para>
|
||||
/// <para>For new applications, it is recommended that the COMGLB_EXCEPTION_HANDLING property be set to COMGLB_EXCEPTION_DONOT_HANDLE_ANY.</para>
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description>COMGLB_RPC_THREADPOOL_SETTING</description>
|
||||
/// <description>
|
||||
/// <para>Possible values for the COMGLB_RPC_THREADPOOL_SETTING property in the Set method are:</para>
|
||||
/// <list type="bullet">
|
||||
/// <item>COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL: Instructs RPC to use a dedicated private thread pool.</item>
|
||||
/// </list>
|
||||
/// <para>Possible values for the COMGLB_RPC_THREADPOOL_SETTING property in the Query method are:</para>
|
||||
/// <list type="bullet">
|
||||
/// <item>COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL: RPC uses a dedicated private thread pool.</item>
|
||||
/// <item>COMGLB_RPC_THREADPOOL_SETTING_DEFAULT_POOL: RPC uses the system default thread pool.</item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// RPC uses the system thread pool by default in Windows 7. Since the system thread pool is shared by multiple components in the
|
||||
/// process, COM and RPC operations may behave incorrectly if the thread pool state is corrupted by a component. The
|
||||
/// COMGLB_RPC_THREADPOOL_SETTING property can be used to change the RPC thread pool behavior. Changing the default behavior will incur a
|
||||
/// performance penalty since this causes RPC to use an extra thread. Therefore, care should be exercised when changing this setting. It
|
||||
/// is recommended that this setting is changed only for application compatibility reasons.
|
||||
/// </para>
|
||||
/// <para><br/></para>
|
||||
/// <para>
|
||||
/// <note type="note">This property must be set immediately after COM is initialized in the process. If this property is set after
|
||||
/// performing any operations that cause COM to initialize the RPC channel (for example, marshaling or unmarshalling object references),
|
||||
/// the Set method will fail.</note>
|
||||
/// </para>
|
||||
/// <para><br/></para>
|
||||
/// <para><strong>Note:</strong> This property is only supported in Windows 7 and later versions of Windows.</para>
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description>COMGLB_RO_SETTINGS</description>
|
||||
/// <description>
|
||||
/// <para>Possible values for the COMGLB_RO_SETTINGS property are:</para>
|
||||
/// <list type="bullet">
|
||||
/// <item>
|
||||
/// COMGLB_FAST_RUNDOWN: Indicates that stubs in the current process are subjected to fast stub rundown behavior, which means that stubs
|
||||
/// are run down on termination of the client process, instead of waiting for normal cleanup timeouts to expire.
|
||||
/// </item>
|
||||
/// <item>COMGLB_STA_MODALLOOP_REMOVE_TOUCH_MESSAGES: Remove touch messages from the message queue in the STA modal loop.</item>
|
||||
/// <item>
|
||||
/// COMGLB_STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES: Input messages are removed in the STA modal loop when the thread's message
|
||||
/// queue is attached.
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// COMGLB_STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES: Input messages aren't removed in the STA modal loop when the thread's
|
||||
/// message queue is attached.
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// COMGLB_STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES: Pointer input messages aren't removed in the STA modal loop when the
|
||||
/// thread's message queue is attached but are temporarily masked to avoid deadlocks arising from the attached queue.
|
||||
/// </item>
|
||||
/// <item>COMGLB_RESERVED1: Reserved for future use.</item>
|
||||
/// <item>COMGLB_RESERVED2: Reserved for future use.</item>
|
||||
/// <item>COMGLB_RESERVED3: Reserved for future use.</item>
|
||||
/// </list>
|
||||
/// <para><strong>Note</strong> This property is only supported in Windows 8 and later versions of Windows.</para>
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description>COMGLB_UNMARSHALING_POLICY</description>
|
||||
/// <description>
|
||||
/// <para>Possible values for the COMGLB_UNMARSHALING_POLICY property are:</para>
|
||||
/// <list type="bullet">
|
||||
/// <item>
|
||||
/// COMGLB_UNMARSHALING_POLICY_NORMAL: Unmarshaling behavior is the same as versions before than Windows 8. EOAC_NO_CUSTOM_MARSHAL
|
||||
/// restrictions apply if this flag is set in CoInitializeSecurity. Otherwise, there are no restrictions. This is the default for
|
||||
/// processes that aren't in the app container.
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// COMGLB_UNMARSHALING_POLICY_STRONG: Unmarshaling allows only a system-trusted list of hardened unmarshalers and unmarshalers allowed
|
||||
/// per-process by the CoAllowUnmarshalerCLSID function. This is the default for processes in the app container.
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// COMGLB_UNMARSHALING_POLICY_HYBRID: Unmarshaling data whose source is app container allows only a system-trusted list of hardened
|
||||
/// unmarshalers and unmarshalers allowed per-process by the CoAllowUnmarshalerCLSID function. Unmarshaling behavior for data with a
|
||||
/// source that's not app container is unchanged from previous versions.
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// <para><font color="#333333"><strong>Note</strong></font> This property is only supported in Windows 8 and later versions of Windows.</para>
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// It's important for applications that detect crashes and other exceptions that might be generated while executing inbound COM calls,
|
||||
/// for example a call on a local server or when executing the IDropTarget::Drop method, to set COMGLB_EXCEPTION_HANDLING to
|
||||
/// COMGLB_EXCEPTION_DONOT_HANDLE to disable COM behavior of catching exceptions. Failure to do this can lead to corrupt process state,
|
||||
/// for example locks held when these exceptions are thrown are abandoned, and the process could enter an inconsistent state.
|
||||
/// </para>
|
||||
/// <para>All such applications should execute this code at startup.</para>
|
||||
/// <para>
|
||||
/// <code> IGlobalOptions *pGlobalOptions; hr = CoCreateInstance(CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGlobalOptions)); if (SUCCEEDED(hr)) { hr = pGlobalOptions->Set(COMGLB_EXCEPTION_HANDLING, COMGLB_EXCEPTION_DONOT_HANDLE); pGlobalOptions->Release(); }</code>
|
||||
/// <span id="cbc_1" codelanguage="CSharp" x-lang="CSharp"></span><div class="highlight-title"><span tabindex="0"
|
||||
/// class="highlight-copycode"></span> C#</div><div class="code"><pre xml:space="preserve">IGlobalOptions *pGlobalOptions; <br/> hr =
|
||||
/// CoCreateInstance(CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGlobalOptions)); <br/> if (SUCCEEDED(hr)) <br/>{
|
||||
/// <br/> hr = pGlobalOptions->Set(COMGLB_EXCEPTION_HANDLING, COMGLB_EXCEPTION_DONOT_HANDLE); <br/> pGlobalOptions->Release(); <br/>}</pre></div>
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/objidlbase/nn-objidlbase-iglobaloptions
|
||||
[PInvokeData("objidlbase.h", MSDNShortId = "NN:objidlbase.IGlobalOptions")]
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/objidl/nn-objidl-iglobaloptions
|
||||
[PInvokeData("objidl.h", MSDNShortId = "NN:objidl.IGlobalOptions")]
|
||||
[ComImport, Guid("0000015B-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface IGlobalOptions
|
||||
{
|
||||
|
@ -1516,7 +1591,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidlbase/nf-objidlbase-iinternalunknown-queryinternalinterface HRESULT
|
||||
// QueryInternalInterface( REFIID riid, void **ppv );
|
||||
[PreserveSig]
|
||||
HRESULT QueryInternalInterface(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object ppv);
|
||||
HRESULT QueryInternalInterface(in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] out object? ppv);
|
||||
}
|
||||
|
||||
/// <summary>Allocates, frees, and manages memory.</summary>
|
||||
|
@ -1888,7 +1963,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-imarshal-getunmarshalclass HRESULT GetUnmarshalClass(
|
||||
// REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid );
|
||||
Guid GetUnmarshalClass(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pv, [In] MSHCTX dwDestContext,
|
||||
Guid GetUnmarshalClass(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pv, [In] MSHCTX dwDestContext,
|
||||
[In, Optional] IntPtr pvDestContext, [In] MSHLFLAGS mshlflags);
|
||||
|
||||
/// <summary>Retrieves the maximum size of the buffer that will be needed during marshaling.</summary>
|
||||
|
@ -1960,7 +2035,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-imarshal-getmarshalsizemax HRESULT GetMarshalSizeMax(
|
||||
// REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize );
|
||||
uint GetMarshalSizeMax(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pv, [In] MSHCTX dwDestContext,
|
||||
uint GetMarshalSizeMax(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pv, [In] MSHCTX dwDestContext,
|
||||
[In, Optional] IntPtr pvDestContext, [In] MSHLFLAGS mshlflags);
|
||||
|
||||
/// <summary>Marshals an interface pointer.</summary>
|
||||
|
@ -2046,7 +2121,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-imarshal-marshalinterface HRESULT MarshalInterface(
|
||||
// IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags );
|
||||
void MarshalInterface([In] IStream pStm, in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pv,
|
||||
void MarshalInterface([In] IStream pStm, in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pv,
|
||||
[In] MSHCTX dwDestContext, [In, Optional] IntPtr pvDestContext, [In] MSHLFLAGS mshlflags);
|
||||
|
||||
/// <summary>Unmarshals an interface pointer.</summary>
|
||||
|
@ -2472,7 +2547,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-istream-clone HRESULT Clone( IStream **ppstm );
|
||||
[PreserveSig]
|
||||
new HRESULT Clone(out IStream ppstm);
|
||||
new HRESULT Clone(out IStream? ppstm);
|
||||
|
||||
/// <summary>Gets information about the marshaling context.</summary>
|
||||
/// <param name="attribute">The attribute to query.</param>
|
||||
|
@ -2703,7 +2778,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidlbase/nf-objidlbase-ipsfactorybuffer-createstub HRESULT CreateStub(
|
||||
// REFIID riid, IUnknown *pUnkServer, IRpcStubBuffer **ppStub );
|
||||
[PreserveSig]
|
||||
HRESULT CreateStub(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pUnkServer, out IRpcStubBuffer ppStub);
|
||||
HRESULT CreateStub(in Guid riid, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pUnkServer, out IRpcStubBuffer ppStub);
|
||||
}
|
||||
|
||||
/// <summary>Marshals data between a COM client proxy and a COM server stub.</summary>
|
||||
|
@ -2753,7 +2828,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-irpcchannelbuffer-getdestctx HRESULT GetDestCtx( DWORD
|
||||
// *pdwDestContext, void **ppvDestContext );
|
||||
[PreserveSig]
|
||||
HRESULT GetDestCtx(out MSHCTX pdwDestContext, out IntPtr ppvDestContext);
|
||||
HRESULT GetDestCtx(out MSHCTX pdwDestContext, [Optional] IntPtr ppvDestContext);
|
||||
|
||||
/// <summary>Determines whether the RPC channel is connected.</summary>
|
||||
/// <returns>If the RPC channel exists, the return value is <c>TRUE</c>. Otherwise, it is <c>FALSE</c>.</returns>
|
||||
|
@ -2924,7 +2999,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-irpcstubbuffer-isiidsupported IRpcStubBuffer *
|
||||
// IsIIDSupported( REFIID riid );
|
||||
[PreserveSig]
|
||||
IRpcStubBuffer IsIIDSupported(in Guid riid);
|
||||
IRpcStubBuffer? IsIIDSupported(in Guid riid);
|
||||
|
||||
/// <summary>Retrieves the total number of references that a stub has on the server object to which it is connected.</summary>
|
||||
/// <returns>This method returns the total number of references that a stub has on the server object to which it is connected.</returns>
|
||||
|
@ -3077,8 +3152,8 @@ public static partial class Ole32
|
|||
// *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **pServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, void **pPrivs, DWORD
|
||||
// *pCapabilities );
|
||||
[PreserveSig]
|
||||
HRESULT QueryBlanket(out Rpc.RPC_C_AUTHN pAuthnSvc, out Rpc.RPC_C_AUTHZ pAuthzSvc, [MarshalAs(UnmanagedType.LPWStr)] out string pServerPrincName,
|
||||
out Rpc.RPC_C_AUTHN_LEVEL pAuthnLevel, out Rpc.RPC_C_IMP_LEVEL pImpLevel, out IntPtr pPrivs, ref uint pCapabilities);
|
||||
HRESULT QueryBlanket(out RPC_C_AUTHN pAuthnSvc, out RPC_C_AUTHZ pAuthzSvc, [MarshalAs(UnmanagedType.LPWStr)] out string pServerPrincName,
|
||||
out RPC_C_AUTHN_LEVEL pAuthnLevel, out RPC_C_IMP_LEVEL pImpLevel, out IntPtr pPrivs, ref uint pCapabilities);
|
||||
|
||||
/// <summary>Enables a server to impersonate a client for the duration of a call.</summary>
|
||||
/// <returns>If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.</returns>
|
||||
|
@ -3576,7 +3651,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-istream-clone HRESULT Clone( IStream **ppstm );
|
||||
[PreserveSig]
|
||||
HRESULT Clone(out IStream ppstm);
|
||||
HRESULT Clone(out IStream? ppstm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3851,7 +3926,8 @@ public static partial class Ole32
|
|||
public GuidPtr pIID;
|
||||
|
||||
/// <summary>A pointer to the interface requested in <c>pIID</c>. This member must be <c>NULL</c> on input.</summary>
|
||||
[MarshalAs(UnmanagedType.IUnknown)] public object pItf;
|
||||
[MarshalAs(UnmanagedType.IUnknown)]
|
||||
public object? pItf;
|
||||
|
||||
/// <summary>
|
||||
/// The return value of the QueryInterface call to locate the requested interface. Common return values include S_OK and
|
||||
|
@ -3954,7 +4030,7 @@ public static partial class Ole32
|
|||
// tagSOLE_AUTHENTICATION_LIST { DWORD cAuthInfo; SOLE_AUTHENTICATION_INFO *aAuthInfo; } SOLE_AUTHENTICATION_LIST, *PSOLE_AUTHENTICATION_LIST;
|
||||
[PInvokeData("objidl.h", MSDNShortId = "21f7aef3-b6be-41cc-a6ed-16d3778e3cee")]
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct SOLE_AUTHENTICATION_LIST : IArrayStruct<SOLE_AUTHENTICATION_INFO>
|
||||
public class SOLE_AUTHENTICATION_LIST : IArrayStruct<SOLE_AUTHENTICATION_INFO>
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>The count of pointers in the array pointed to by <c>aAuthInfo</c>.</para>
|
||||
|
@ -3996,7 +4072,7 @@ public static partial class Ole32
|
|||
/// RPC_E_NO_GOOD_SECURITY_PACKAGES is returned.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string pPrincipalName;
|
||||
public string? pPrincipalName;
|
||||
|
||||
/// <summary>
|
||||
/// When used in CoInitializeSecurity, set on return to indicate the status of the call to register the authentication services.
|
||||
|
|
|
@ -283,7 +283,7 @@ public static partial class Ole32
|
|||
// LPSTGMEDIUM pmedium, OUT LPOLESTREAM polestm );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "a6026b71-4223-40ab-b209-44531480db57")]
|
||||
public static extern HRESULT OleConvertIStorageToOLESTREAMEx([In] IStorage pstg, CLIPFORMAT cfFormat, int lWidth, int lHeight, uint dwSize, in STGMEDIUM pmedium, out OLESTREAM polestm);
|
||||
public static extern HRESULT OleConvertIStorageToOLESTREAMEx([In] IStorage pstg, [Optional] CLIPFORMAT cfFormat, int lWidth, int lHeight, uint dwSize, in STGMEDIUM pmedium, out OLESTREAM polestm);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -345,7 +345,7 @@ public static partial class Ole32
|
|||
// OleConvertOLESTREAMToIStorage( IN LPOLESTREAM lpolestream, OUT LPSTORAGE pstg, IN const DVTARGETDEVICE *ptd );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "8fed879c-5f97-4450-8259-da9643dd828c")]
|
||||
public static extern HRESULT OleConvertOLESTREAMToIStorage(in OLESTREAM lpolestream, out IStorage pstg, in DVTARGETDEVICE ptd);
|
||||
public static extern HRESULT OleConvertOLESTREAMToIStorage(in OLESTREAM lpolestream, out IStorage pstg, [In] DVTARGETDEVICE ptd);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>OleConvertOLESTREAMToIStorageEx</c> function converts the specified object from the OLE 1 storage model to an OLE 2
|
||||
|
@ -387,7 +387,8 @@ public static partial class Ole32
|
|||
// LONG *plHeight, OUT DWORD *pdwSize, OUT LPSTGMEDIUM pmedium );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "2e77fa0e-1d98-4c59-8d3c-65bd7235ec8f")]
|
||||
public static extern HRESULT OleConvertOLESTREAMToIStorageEx(in OLESTREAM polestm, out IStorage pstg, out CLIPFORMAT pcfFormat, out int plwWidth, out int plHeight, out uint pdwSize, out STGMEDIUM pmedium);
|
||||
public static extern HRESULT OleConvertOLESTREAMToIStorageEx(in OLESTREAM polestm, out IStorage pstg, out CLIPFORMAT pcfFormat,
|
||||
out int plwWidth, out int plHeight, out uint pdwSize, out STGMEDIUM pmedium);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an embedded object identified by a CLSID. You use it typically to implement the menu item that allows the end user to
|
||||
|
@ -467,7 +468,8 @@ public static partial class Ole32
|
|||
// IN DWORD renderopt, IN LPFORMATETC pFormatEtc, IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "00b7edd2-8e2e-4e0a-91a6-d966f6c8d456")]
|
||||
public static extern HRESULT OleCreate(in Guid rclsid, in Guid riid, OLERENDER renderopt, in FORMATETC pFormatEtc, [In, Optional] IOleClientSite pClientSite, [In] IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreate(in Guid rclsid, in Guid riid, OLERENDER renderopt, in FORMATETC pFormatEtc, [In, Optional] IOleClientSite? pClientSite,
|
||||
[In] IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the default embedding handler. This instance is initialized so it creates a local server when the
|
||||
|
@ -501,7 +503,8 @@ public static partial class Ole32
|
|||
// REFCLSID clsid, IN LPUNKNOWN pUnkOuter, IN REFIID riid, OUT LPVOID *lplpObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "ffe87012-b000-4ed7-b0b2-78ffdc794d3b")]
|
||||
public static extern HRESULT OleCreateDefaultHandler(in Guid clsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object pUnkOuter, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object lplpObj);
|
||||
public static extern HRESULT OleCreateDefaultHandler(in Guid clsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object? pUnkOuter,
|
||||
in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object lplpObj);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an OLE embedding helper object using application-supplied code aggregated with pieces of the OLE default object handler.
|
||||
|
@ -616,7 +619,8 @@ public static partial class Ole32
|
|||
// REFCLSID clsid, IN LPUNKNOWN pUnkOuter, IN DWORD flags, IN LPCLASSFACTORY pCF, IN REFIID riid, OUT LPVOID *lplpObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "5c67b513-0692-4e0a-beab-8b514089699c")]
|
||||
public static extern HRESULT OleCreateEmbeddingHelper(in Guid clsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object pUnkOuter, EMBDHLP flags, [Optional] IClassFactory pCF, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object lplpObj);
|
||||
public static extern HRESULT OleCreateEmbeddingHelper(in Guid clsid, [MarshalAs(UnmanagedType.IUnknown), Optional] object? pUnkOuter,
|
||||
EMBDHLP flags, [Optional] IClassFactory? pCF, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object lplpObj);
|
||||
|
||||
/// <summary>
|
||||
/// Extends OleCreate functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple
|
||||
|
@ -721,8 +725,9 @@ public static partial class Ole32
|
|||
// *lpAdviseSink, OUT DWORD *rgdwConnection, IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "11f2703c-b596-4cb9-855a-d8cf4b947fae")]
|
||||
public static extern HRESULT OleCreateEx(in Guid rclsid, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateEx(in Guid rclsid, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats,
|
||||
[In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc, [Optional] IAdviseSink? lpAdviseSink,
|
||||
[Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an embedded object from a data transfer object retrieved either from the clipboard or as part of an OLE drag-and-drop
|
||||
|
@ -854,7 +859,8 @@ public static partial class Ole32
|
|||
// LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "aa5e997e-60d4-472d-9c81-5359c277bde3")]
|
||||
public static extern HRESULT OleCreateFromData(IDataObject pSrcDataObj, in Guid riid, OLERENDER renderopt, in FORMATETC pFormatEtc, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateFromData(IDataObject pSrcDataObj, in Guid riid, OLERENDER renderopt, in FORMATETC pFormatEtc,
|
||||
[Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Extends OleCreateFromData functionality by supporting more efficient instantiation of objects in containers requiring caching of
|
||||
|
@ -962,8 +968,9 @@ public static partial class Ole32
|
|||
// LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "10091a24-6a50-4eb2-a518-b92a572daa6c")]
|
||||
public static extern HRESULT OleCreateFromDataEx(IDataObject pSrcDataObj, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateFromDataEx(IDataObject pSrcDataObj, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt,
|
||||
uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc, [Optional] IAdviseSink? lpAdviseSink,
|
||||
[Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>Creates an embedded object from the contents of a named file.</summary>
|
||||
/// <param name="rclsid">This parameter is reserved and must be CLSID_NULL.</param>
|
||||
|
@ -1036,7 +1043,8 @@ public static partial class Ole32
|
|||
// LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "98c63646-6617-46b6-8c3e-82d1c4d0adb6")]
|
||||
public static extern HRESULT OleCreateFromFile(in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid, OLERENDER renderopt, in FORMATETC lpFormatEtc, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateFromFile(in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid,
|
||||
OLERENDER renderopt, in FORMATETC lpFormatEtc, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Extends OleCreateFromFile functionality by supporting more efficient instantiation of objects in containers requiring caching of
|
||||
|
@ -1145,8 +1153,10 @@ public static partial class Ole32
|
|||
// pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "a75bb031-6e4a-4440-82f3-6a6f9417c62b")]
|
||||
public static extern HRESULT OleCreateFromFileEx(in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateFromFileEx(in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid,
|
||||
OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink? lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite? pClientSite, IStorage pStg,
|
||||
[MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>Creates an OLE compound-document linked object.</summary>
|
||||
/// <param name="pmkLinkSrc">
|
||||
|
@ -1191,7 +1201,8 @@ public static partial class Ole32
|
|||
// REFIID riid, IN DWORD renderopt, IN LPFORMATETC lpFormatEtc, IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "ef52dc37-aa63-47f3-a04f-f9d22178690f")]
|
||||
public static extern HRESULT OleCreateLink(IMoniker pmkLinkSrc, in Guid riid, OLERENDER renderopt, in FORMATETC lpFormatEtc, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateLink(IMoniker pmkLinkSrc, in Guid riid, OLERENDER renderopt, in FORMATETC lpFormatEtc,
|
||||
[Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Extends <c>OleCreateLink</c> functionality by supporting more efficient instantiation of objects in containers requiring caching
|
||||
|
@ -1298,8 +1309,9 @@ public static partial class Ole32
|
|||
// IAdviseSink *lpAdviseSink, OUT DWORD *rgdwConnection, IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "b43acd14-3cf8-45da-8c2c-f2f6dc2ada78")]
|
||||
public static extern HRESULT OleCreateLinkEx(IMoniker pmkLinkSrc, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateLinkEx(IMoniker pmkLinkSrc, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats,
|
||||
[In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc, [Optional] IAdviseSink? lpAdviseSink,
|
||||
[Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a linked object from a data transfer object retrieved either from the clipboard or as part of an OLE drag-and-drop operation.
|
||||
|
@ -1386,7 +1398,8 @@ public static partial class Ole32
|
|||
// LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "3eda0cf5-c33d-43cf-ba8a-02a4f6383adc")]
|
||||
public static extern HRESULT OleCreateLinkFromData(IDataObject pSrcDataObj, in Guid riid, OLERENDER renderopt, in FORMATETC pFormatEtc, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateLinkFromData(IDataObject pSrcDataObj, in Guid riid, OLERENDER renderopt, in FORMATETC pFormatEtc,
|
||||
[Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Extends OleCreateLinkFromData functionality by supporting more efficient instantiation of objects in containers requiring caching
|
||||
|
@ -1494,8 +1507,9 @@ public static partial class Ole32
|
|||
// pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "f486dc73-3cb9-4839-931a-91cc3a5837d3")]
|
||||
public static extern HRESULT OleCreateLinkFromDataEx(IDataObject pSrcDataObj, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateLinkFromDataEx(IDataObject pSrcDataObj, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt,
|
||||
uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc, [Optional] IAdviseSink? lpAdviseSink,
|
||||
[Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>Creates an object that is linked to a file.</summary>
|
||||
/// <param name="lpszFileName">Pointer to a string naming the source file to be linked to.</param>
|
||||
|
@ -1546,7 +1560,8 @@ public static partial class Ole32
|
|||
// OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "06b013db-0554-4dbc-b19d-28314fb4fee0")]
|
||||
public static extern HRESULT OleCreateLinkToFile([MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid, OLERENDER renderopt, in FORMATETC lpFormatEtc, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateLinkToFile([MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid, OLERENDER renderopt,
|
||||
in FORMATETC lpFormatEtc, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Extends OleCreateLinkToFile functionality by supporting more efficient instantiation of objects in containers requiring caching
|
||||
|
@ -1654,8 +1669,9 @@ public static partial class Ole32
|
|||
// LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "9a333bac-8ee3-4941-8e4b-78a2befceff8")]
|
||||
public static extern HRESULT OleCreateLinkToFileEx([MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid, OLECREATE dwFlags, OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc,
|
||||
[Optional] IAdviseSink lpAdviseSink, [Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateLinkToFileEx([MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, in Guid riid, OLECREATE dwFlags,
|
||||
OLERENDER renderopt, uint cFormats, [In, Optional] ADVF[]? rgAdvf, [In, Optional] FORMATETC[]? rgFormatEtc, [Optional] IAdviseSink? lpAdviseSink,
|
||||
[Out, Optional] uint[]? rgdwConnection, [Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>
|
||||
/// Creates and returns an OLE menu descriptor (that is, an OLE-provided data structure that describes the menus) for OLE to use when
|
||||
|
@ -1736,7 +1752,8 @@ public static partial class Ole32
|
|||
// LPSTORAGE pStg, OUT LPVOID *ppvObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "847d82f5-149d-48a4-a228-f5551a07a790")]
|
||||
public static extern HRESULT OleCreateStaticFromData(IDataObject pSrcDataObj, in Guid iid, OLERENDER renderopt, in FORMATETC pFormatEtc, [Optional] IOleClientSite pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
public static extern HRESULT OleCreateStaticFromData(IDataObject pSrcDataObj, in Guid iid, OLERENDER renderopt, in FORMATETC pFormatEtc,
|
||||
[Optional] IOleClientSite? pClientSite, IStorage pStg, [MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
|
||||
|
||||
/// <summary>Called by the container to free the shared menu descriptor allocated by the OleCreateMenuDescriptor function.</summary>
|
||||
/// <param name="holemenu">Handle to the shared menu descriptor that was returned by the OleCreateMenuDescriptor function.</param>
|
||||
|
@ -1887,7 +1904,7 @@ public static partial class Ole32
|
|||
// CLIPFORMAT cfFormat, IN UINT uiFlags );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "c4ba0b54-e9e1-4c05-b4f8-ce5390cada17")]
|
||||
public static extern HANDLE OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, Kernel32.GMEM uiFlags);
|
||||
public static extern HANDLE OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, Kernel32.GMEM uiFlags = Kernel32.GMEM.GMEM_MOVEABLE);
|
||||
|
||||
/// <summary>
|
||||
/// Carries out the clipboard shutdown sequence. It also releases the IDataObject pointer that was placed on the clipboard by the
|
||||
|
@ -2189,7 +2206,8 @@ public static partial class Ole32
|
|||
// *targetDescription, PWSTR *dataDescription );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "1DAD2A9A-EDA2-49D2-90F7-2A9022988177")]
|
||||
public static extern HRESULT OleGetClipboardWithEnterpriseInfo(out IDataObject dataObject, out StrPtrUni dataEnterpriseId, out StrPtrUni sourceDescription, out StrPtrUni targetDescription, out StrPtrUni dataDescription);
|
||||
public static extern HRESULT OleGetClipboardWithEnterpriseInfo(out IDataObject dataObject, out StrPtrUni dataEnterpriseId,
|
||||
out StrPtrUni sourceDescription, out StrPtrUni targetDescription, out StrPtrUni dataDescription);
|
||||
|
||||
/// <summary>Returns a handle to a metafile containing an icon and a string label for the specified CLSID.</summary>
|
||||
/// <param name="rclsid">The CLSID for which the icon and string are to be requested.</param>
|
||||
|
@ -2203,7 +2221,8 @@ public static partial class Ole32
|
|||
// LPOLESTR lpszLabel, IN BOOL fUseTypeAsLabel );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "88ac1c14-b5a8-4100-9fa5-d7af35052b48")]
|
||||
public static extern SafeHGlobalHandle OleGetIconOfClass(in Guid rclsid, [Optional, MarshalAs(UnmanagedType.LPWStr)] string? lpszLabel, [MarshalAs(UnmanagedType.Bool)] bool fUseTypeAsLabel);
|
||||
public static extern SafeHGlobalHandle OleGetIconOfClass(in Guid rclsid, [Optional, MarshalAs(UnmanagedType.LPWStr)] string? lpszLabel,
|
||||
[MarshalAs(UnmanagedType.Bool)] bool fUseTypeAsLabel);
|
||||
|
||||
/// <summary>Returns a handle to a metafile containing an icon and string label for the specified file name.</summary>
|
||||
/// <param name="lpszPath">A pointer to a file for which the icon and string are to be requested.</param>
|
||||
|
@ -2487,7 +2506,8 @@ public static partial class Ole32
|
|||
// OleMetafilePictFromIconAndLabel( IN HICON hIcon, LPOLESTR lpszLabel, LPOLESTR lpszSourceFile, IN UINT iIconIndex );
|
||||
[DllImport(Lib.Ole32, SetLastError = true, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "627a79eb-46dd-4df7-a0d6-cab37b73387a")]
|
||||
public static extern SafeHGlobalHandle OleMetafilePictFromIconAndLabel(HICON hIcon, [MarshalAs(UnmanagedType.LPWStr), Optional] string? lpszLabel, [MarshalAs(UnmanagedType.LPWStr), Optional] string? lpszSourceFile, [In] uint iIconIndex);
|
||||
public static extern SafeHGlobalHandle OleMetafilePictFromIconAndLabel(HICON hIcon, [MarshalAs(UnmanagedType.LPWStr), Optional] string? lpszLabel,
|
||||
[MarshalAs(UnmanagedType.LPWStr), Optional] string? lpszSourceFile, [In] uint iIconIndex);
|
||||
|
||||
/// <summary>Increments or decrements an external reference that keeps an object in the running state.</summary>
|
||||
/// <param name="pUnknown">Pointer to the IUnknown interface on the object that is to be locked or unlocked.</param>
|
||||
|
@ -3139,7 +3159,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/ole2/nf-ole2-olesetclipboard HRESULT OleSetClipboard( IN LPDATAOBJECT pDataObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "741def10-d2b5-4395-8049-1eba2e29b0e8")]
|
||||
public static extern HRESULT OleSetClipboard([In, Optional] IDataObject pDataObj);
|
||||
public static extern HRESULT OleSetClipboard([In, Optional] IDataObject? pDataObj);
|
||||
|
||||
/// <summary>
|
||||
/// Notifies an object that it is embedded in an OLE container, which ensures that reference counting is done correctly for
|
||||
|
@ -3206,7 +3226,8 @@ public static partial class Ole32
|
|||
// holemenu, IN HWND hwndFrame, IN HWND hwndActiveObject, IN LPOLEINPLACEFRAME lpFrame, IN LPOLEINPLACEACTIVEOBJECT lpActiveObj );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("ole2.h", MSDNShortId = "c80fe36d-5093-4814-83a9-0c11c5a7cf5f")]
|
||||
public static extern HRESULT OleSetMenuDescriptor([In] HOLEMENU holemenu, [In] HWND hwndFrame, [In] HWND hwndActiveObject, [In] IOleInPlaceFrame lpFrame, [In] IOleInPlaceActiveObject lpActiveObj);
|
||||
public static extern HRESULT OleSetMenuDescriptor([In, Optional] HOLEMENU holemenu, [In] HWND hwndFrame, [In] HWND hwndActiveObject,
|
||||
[In] IOleInPlaceFrame? lpFrame, [In] IOleInPlaceActiveObject? lpActiveObj);
|
||||
|
||||
/// <summary>
|
||||
/// Called by the object application, allows an object's container to translate accelerators according to the container's accelerator table.
|
||||
|
@ -3500,7 +3521,7 @@ public static partial class Ole32
|
|||
public HOLEMENU(IntPtr preexistingHandle) => handle = preexistingHandle;
|
||||
|
||||
/// <summary>Returns an invalid handle by instantiating a <see cref="HOLEMENU"/> object with <see cref="IntPtr.Zero"/>.</summary>
|
||||
public static HOLEMENU NULL => new HOLEMENU(IntPtr.Zero);
|
||||
public static HOLEMENU NULL => new(IntPtr.Zero);
|
||||
|
||||
/// <summary>Gets a value indicating whether this instance is a null handle.</summary>
|
||||
public bool IsNull => handle == IntPtr.Zero;
|
||||
|
@ -3513,7 +3534,7 @@ public static partial class Ole32
|
|||
/// <summary>Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="HOLEMENU"/>.</summary>
|
||||
/// <param name="h">The pointer to a handle.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
public static implicit operator HOLEMENU(IntPtr h) => new HOLEMENU(h);
|
||||
public static implicit operator HOLEMENU(IntPtr h) => new(h);
|
||||
|
||||
/// <summary>Implements the operator !=.</summary>
|
||||
/// <param name="h1">The first handle.</param>
|
||||
|
@ -3528,7 +3549,7 @@ public static partial class Ole32
|
|||
public static bool operator ==(HOLEMENU h1, HOLEMENU h2) => h1.Equals(h2);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object obj) => obj is HOLEMENU h ? handle == h.handle : false;
|
||||
public override bool Equals(object? obj) => obj is HOLEMENU h && handle == h.handle;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => handle.GetHashCode();
|
||||
|
|
|
@ -1060,9 +1060,7 @@ public static partial class Ole32
|
|||
// rgelt, ULONG *pceltFetched );
|
||||
[PInvokeData("oleidl.h", MSDNShortId = "bb934017-9054-42b5-89d4-a24f12829503")]
|
||||
[PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
HRESULT Next([In] uint celt,
|
||||
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] OLEVERB[] rgelt,
|
||||
out uint pceltFetched);
|
||||
HRESULT Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] OLEVERB[] rgelt, out uint pceltFetched);
|
||||
|
||||
/// <summary>Skips over the specified number of items in the enumeration sequence.</summary>
|
||||
/// <param name="celt">The number of items to be skipped.</param>
|
||||
|
@ -1374,7 +1372,7 @@ public static partial class Ole32
|
|||
/// data stored in an array of STATDATA structures containing information about current cache connections.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolecache-enumcache
|
||||
IEnumSTATDATA EnumCache();
|
||||
IEnumSTATDATA? EnumCache();
|
||||
|
||||
/// <summary>Fills the cache as needed using the data provided by the specified data object.</summary>
|
||||
/// <param name="pDataObject">A pointer to the IDataObject interface on the data object from which the cache is to be initialized.</param>
|
||||
|
@ -1526,7 +1524,7 @@ public static partial class Ole32
|
|||
/// data stored in an array of STATDATA structures containing information about current cache connections.
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolecache-enumcache
|
||||
new IEnumSTATDATA EnumCache();
|
||||
new IEnumSTATDATA? EnumCache();
|
||||
|
||||
/// <summary>Fills the cache as needed using the data provided by the specified data object.</summary>
|
||||
/// <param name="pDataObject">A pointer to the IDataObject interface on the data object from which the cache is to be initialized.</param>
|
||||
|
@ -1660,7 +1658,7 @@ public static partial class Ole32
|
|||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolecache2-updatecache HRESULT UpdateCache( LPDATAOBJECT
|
||||
// pDataObject, DWORD grfUpdf, LPVOID pReserved );
|
||||
HRESULT UpdateCache(IDataObject pDataObject, UPDFCACHE grfUpdf, [In, Optional] IntPtr pReserved);
|
||||
HRESULT UpdateCache(IDataObject? pDataObject, UPDFCACHE grfUpdf, [In, Optional] IntPtr pReserved);
|
||||
|
||||
/// <summary>Discards the caches found in memory.</summary>
|
||||
/// <param name="dwDiscardOptions">
|
||||
|
@ -1894,7 +1892,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleclientsite-getmoniker HRESULT GetMoniker( DWORD
|
||||
// dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk );
|
||||
[PreserveSig]
|
||||
HRESULT GetMoniker(OLEGETMONIKER dwAssign, OLEWHICHMK dwWhichMoniker, out IMoniker ppmk);
|
||||
HRESULT GetMoniker(OLEGETMONIKER dwAssign, OLEWHICHMK dwWhichMoniker, out IMoniker? ppmk);
|
||||
|
||||
/// <summary>Retrieves a pointer to the object's container.</summary>
|
||||
/// <param name="ppContainer">
|
||||
|
@ -1937,7 +1935,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleclientsite-getcontainer HRESULT GetContainer(
|
||||
// IOleContainer **ppContainer );
|
||||
[PreserveSig]
|
||||
HRESULT GetContainer(out IOleContainer ppContainer);
|
||||
HRESULT GetContainer(out IOleContainer? ppContainer);
|
||||
|
||||
/// <summary>
|
||||
/// Asks a container to display its object to the user. This method ensures that the container itself is visible and not minimized.
|
||||
|
@ -2094,7 +2092,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iparsedisplayname-parsedisplayname HRESULT
|
||||
// ParseDisplayName( IBindCtx *pbc, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut );
|
||||
[PreserveSig]
|
||||
new HRESULT ParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out uint pchEaten, out IMoniker ppmkOut);
|
||||
new HRESULT ParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out uint pchEaten, out IMoniker? ppmkOut);
|
||||
|
||||
/// <summary>Enumerates the objects in the current container.</summary>
|
||||
/// <param name="grfFlags">Specifies which objects in a container are to be enumerated, as defined in the enumeration OLECONTF.</param>
|
||||
|
@ -2112,7 +2110,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolecontainer-enumobjects HRESULT EnumObjects( DWORD
|
||||
// grfFlags, IEnumUnknown **ppenum );
|
||||
[PreserveSig]
|
||||
HRESULT EnumObjects(OLECONTF grfFlags, out IEnumUnknown ppenum);
|
||||
HRESULT EnumObjects(OLECONTF grfFlags, out IEnumUnknown? ppenum);
|
||||
|
||||
/// <summary>Keeps the container for embedded objects running until explicitly released.</summary>
|
||||
/// <param name="fLock">Indicates whether to lock ( <c>TRUE</c>) or unlock ( <c>FALSE</c>) a container.</param>
|
||||
|
@ -2681,7 +2679,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleinplaceuiwindow-setborderspace HRESULT
|
||||
// SetBorderSpace( LPCBORDERWIDTHS pborderwidths );
|
||||
new void SetBorderSpace(in RECT pborderwidths);
|
||||
new void SetBorderSpace([In] PRECT? pborderwidths);
|
||||
|
||||
/// <summary>Provides a direct channel of communication between the object and each of the frame and document windows.</summary>
|
||||
/// <param name="pActiveObject">A pointer to the IOleInPlaceActiveObject interface on the active in-place object.</param>
|
||||
|
@ -2719,7 +2717,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleinplaceuiwindow-setactiveobject HRESULT
|
||||
// SetActiveObject( IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName );
|
||||
new void SetActiveObject([In] IOleInPlaceActiveObject pActiveObject, [MarshalAs(UnmanagedType.LPWStr)] string pszObjName);
|
||||
new void SetActiveObject([In] IOleInPlaceActiveObject pActiveObject, [MarshalAs(UnmanagedType.LPWStr)] string? pszObjName);
|
||||
|
||||
/// <summary>Enables the container to insert menu groups into the composite menu to be used during the in-place session.</summary>
|
||||
/// <param name="hmenuShared">A handle to an empty menu.</param>
|
||||
|
@ -2829,7 +2827,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleinplaceframe-setstatustext HRESULT SetStatusText(
|
||||
// LPCOLESTR pszStatusText );
|
||||
void SetStatusText([MarshalAs(UnmanagedType.LPWStr)] string pszStatusText);
|
||||
void SetStatusText([MarshalAs(UnmanagedType.LPWStr)] string? pszStatusText);
|
||||
|
||||
/// <summary>Enables or disables a frame's modeless dialog boxes.</summary>
|
||||
/// <param name="fEnable">
|
||||
|
@ -3525,7 +3523,7 @@ public static partial class Ole32
|
|||
// GetWindowContext( IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect,
|
||||
// LPOLEINPLACEFRAMEINFO lpFrameInfo );
|
||||
[PreserveSig]
|
||||
unsafe HRESULT GetWindowContext(out IOleInPlaceFrame ppFrame, out IOleInPlaceUIWindow ppDoc, [Out] RECT* lprcPosRect, [Out] RECT* lprcClipRect, [Out] OLEINPLACEFRAMEINFO* lpFrameInfo);
|
||||
unsafe HRESULT GetWindowContext(out IOleInPlaceFrame? ppFrame, out IOleInPlaceUIWindow? ppDoc, [Out] RECT* lprcPosRect, [Out] RECT* lprcClipRect, [Out] OLEINPLACEFRAMEINFO* lpFrameInfo);
|
||||
|
||||
/// <summary>Instructs the container to scroll the view of the object by the specified number of pixels.</summary>
|
||||
/// <param name="scrollExtant">The number of pixels by which to scroll in the X and Y directions.</param>
|
||||
|
@ -3977,7 +3975,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleinplaceuiwindow-setborderspace HRESULT
|
||||
// SetBorderSpace( LPCBORDERWIDTHS pborderwidths );
|
||||
void SetBorderSpace(in RECT pborderwidths);
|
||||
void SetBorderSpace([In] PRECT? pborderwidths);
|
||||
|
||||
/// <summary>Provides a direct channel of communication between the object and each of the frame and document windows.</summary>
|
||||
/// <param name="pActiveObject">A pointer to the IOleInPlaceActiveObject interface on the active in-place object.</param>
|
||||
|
@ -4015,7 +4013,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleinplaceuiwindow-setactiveobject HRESULT
|
||||
// SetActiveObject( IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName );
|
||||
void SetActiveObject([In] IOleInPlaceActiveObject pActiveObject, [MarshalAs(UnmanagedType.LPWStr)] string pszObjName);
|
||||
void SetActiveObject([In] IOleInPlaceActiveObject pActiveObject, [MarshalAs(UnmanagedType.LPWStr)] string? pszObjName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -4161,7 +4159,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolelink-setsourcemoniker HRESULT SetSourceMoniker( [in]
|
||||
// IMoniker *pmk, [in] REFCLSID rclsid );
|
||||
[PreserveSig]
|
||||
HRESULT SetSourceMoniker([In, Optional] IMoniker pmk, in Guid rclsid);
|
||||
HRESULT SetSourceMoniker([In, Optional] IMoniker? pmk, in Guid rclsid);
|
||||
|
||||
/// <summary>Retrieves the moniker identifying the link source of a linked object.</summary>
|
||||
/// <param name="ppmk">
|
||||
|
@ -4212,7 +4210,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolelink-getsourcemoniker HRESULT GetSourceMoniker( [out]
|
||||
// IMoniker **ppmk );
|
||||
[PreserveSig]
|
||||
HRESULT GetSourceMoniker(out IMoniker ppmk);
|
||||
HRESULT GetSourceMoniker(out IMoniker? ppmk);
|
||||
|
||||
/// <summary>Sets the display name for the link source.</summary>
|
||||
/// <param name="pszStatusText">A pointer to the display name of the new link source. This parameter cannot be <c>NULL</c>.</param>
|
||||
|
@ -4302,7 +4300,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolelink-getsourcedisplayname HRESULT
|
||||
// GetSourceDisplayName( [out] LPOLESTR *ppszDisplayName );
|
||||
[PreserveSig]
|
||||
HRESULT GetSourceDisplayName(out IntPtr ppszDisplayName);
|
||||
HRESULT GetSourceDisplayName([MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplayName);
|
||||
|
||||
/// <summary>Activates the connection to the link source by binding the moniker stored within the linked object.</summary>
|
||||
/// <param name="bindflags">
|
||||
|
@ -4386,7 +4384,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolelink-bindtosource HRESULT BindToSource( [in] DWORD
|
||||
// bindflags, [in] IBindCtx *pbc );
|
||||
[PreserveSig]
|
||||
HRESULT BindToSource(OLELINKBIND bindflags, [In, Optional] IBindCtx pbc);
|
||||
HRESULT BindToSource(OLELINKBIND bindflags, [In, Optional] IBindCtx? pbc);
|
||||
|
||||
/// <summary>Activates the connection between the linked object and the link source if the link source is already running.</summary>
|
||||
/// <returns>
|
||||
|
@ -4442,7 +4440,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolelink-getboundsource HRESULT GetBoundSource( [out]
|
||||
// IUnknown **ppunk );
|
||||
[PreserveSig]
|
||||
HRESULT GetBoundSource(out IDataObject ppunk);
|
||||
HRESULT GetBoundSource(out IDataObject? ppunk);
|
||||
|
||||
/// <summary>Breaks the connection between a linked object and its link source.</summary>
|
||||
/// <returns>This method returns S_OK on success.</returns>
|
||||
|
@ -4523,7 +4521,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iolelink-update HRESULT Update( [in] IBindCtx *pbc );
|
||||
[PreserveSig]
|
||||
HRESULT Update([In, Optional] IBindCtx pbc);
|
||||
HRESULT Update([In, Optional] IBindCtx? pbc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -4580,7 +4578,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-setclientsite HRESULT SetClientSite(
|
||||
// IOleClientSite *pClientSite );
|
||||
[PreserveSig]
|
||||
HRESULT SetClientSite(IOleClientSite pClientSite);
|
||||
HRESULT SetClientSite(IOleClientSite? pClientSite);
|
||||
|
||||
/// <summary>Retrieves a pointer to an embedded object's client site.</summary>
|
||||
/// <param name="ppClientSite">
|
||||
|
@ -4610,7 +4608,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-getclientsite HRESULT GetClientSite(
|
||||
// IOleClientSite **ppClientSite );
|
||||
[PreserveSig]
|
||||
HRESULT GetClientSite(out IOleClientSite ppClientSite);
|
||||
HRESULT GetClientSite(out IOleClientSite? ppClientSite);
|
||||
|
||||
/// <summary>Provides an object with the names of its container application and the compound document in which it is embedded.</summary>
|
||||
/// <param name="szContainerApp">Pointer to the name of the container application in which the object is running.</param>
|
||||
|
@ -4645,7 +4643,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-sethostnames HRESULT SetHostNames( LPCOLESTR
|
||||
// szContainerApp, LPCOLESTR szContainerObj );
|
||||
[PreserveSig]
|
||||
HRESULT SetHostNames([MarshalAs(UnmanagedType.LPWStr)] string szContainerApp, [MarshalAs(UnmanagedType.LPWStr)] string szContainerObj);
|
||||
HRESULT SetHostNames([MarshalAs(UnmanagedType.LPWStr)] string szContainerApp, [MarshalAs(UnmanagedType.LPWStr)] string? szContainerObj);
|
||||
|
||||
/// <summary>Changes an embedded object from the running to the loaded state. Disconnects a linked object from its link source.</summary>
|
||||
/// <param name="dwSaveOption">
|
||||
|
@ -4826,7 +4824,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-getmoniker HRESULT GetMoniker( DWORD dwAssign,
|
||||
// DWORD dwWhichMoniker, IMoniker **ppmk );
|
||||
[PreserveSig]
|
||||
HRESULT GetMoniker(OLEGETMONIKER dwAssign, OLEWHICHMK dwWhichMoniker, out IMoniker ppmk);
|
||||
HRESULT GetMoniker(OLEGETMONIKER dwAssign, OLEWHICHMK dwWhichMoniker, out IMoniker? ppmk);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a newly created object with data from a specified data object, which can reside either in the same container or
|
||||
|
@ -4907,7 +4905,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-initfromdata HRESULT InitFromData( IDataObject
|
||||
// *pDataObject, BOOL fCreation, DWORD dwReserved );
|
||||
[PreserveSig]
|
||||
HRESULT InitFromData(IDataObject pDataObject, [MarshalAs(UnmanagedType.Bool)] bool fCreation, uint dwReserved = 0);
|
||||
HRESULT InitFromData(IDataObject? pDataObject, [MarshalAs(UnmanagedType.Bool)] bool fCreation, uint dwReserved = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a data object containing the current contents of the embedded object on which this method is called. Using the
|
||||
|
@ -4955,7 +4953,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-getclipboarddata HRESULT GetClipboardData(
|
||||
// DWORD dwReserved, IDataObject **ppDataObject );
|
||||
[PreserveSig]
|
||||
HRESULT GetClipboardData([Optional] uint dwReserved, out IDataObject ppDataObject);
|
||||
HRESULT GetClipboardData([Optional] uint dwReserved, out IDataObject? ppDataObject);
|
||||
|
||||
/// <summary>
|
||||
/// Requests that an object perform an action in response to an end-user's action. The possible actions are enumerated for the
|
||||
|
@ -5192,7 +5190,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-enumverbs HRESULT EnumVerbs( IEnumOLEVERB
|
||||
// **ppEnumOleVerb );
|
||||
[PreserveSig]
|
||||
HRESULT EnumVerbs(out IEnumOLEVERB ppEnumOleVerb);
|
||||
HRESULT EnumVerbs(out IEnumOLEVERB? ppEnumOleVerb);
|
||||
|
||||
/// <summary>Updates an object handler's or link object's data or view caches.</summary>
|
||||
/// <returns>
|
||||
|
@ -5363,7 +5361,7 @@ public static partial class Ole32
|
|||
// dwFormOfType, LPOLESTR *pszUserType );
|
||||
[return: MarshalAs(UnmanagedType.LPWStr)]
|
||||
[PreserveSig]
|
||||
HRESULT GetUserType(USERCLASSTYPE dwFormOfType, [MarshalAs(UnmanagedType.LPWStr)] out string pszUserType);
|
||||
HRESULT GetUserType(USERCLASSTYPE dwFormOfType, [MarshalAs(UnmanagedType.LPWStr)] out string? pszUserType);
|
||||
|
||||
/// <summary>Informs an object of how much display space its container has assigned it.</summary>
|
||||
/// <param name="dwDrawAspect">
|
||||
|
@ -5601,7 +5599,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-ioleobject-enumadvise HRESULT EnumAdvise( IEnumSTATDATA
|
||||
// **ppenumAdvise );
|
||||
[PreserveSig]
|
||||
HRESULT EnumAdvise(out IEnumSTATDATA ppenumAdvise);
|
||||
HRESULT EnumAdvise(out IEnumSTATDATA? ppenumAdvise);
|
||||
|
||||
/// <summary>Retrieves the status of an object at creation and loading.</summary>
|
||||
/// <param name="dwAspect">
|
||||
|
@ -5931,7 +5929,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iparsedisplayname-parsedisplayname HRESULT
|
||||
// ParseDisplayName( IBindCtx *pbc, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut );
|
||||
[PreserveSig]
|
||||
HRESULT ParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out uint pchEaten, out IMoniker ppmkOut);
|
||||
HRESULT ParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out uint pchEaten, out IMoniker? ppmkOut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -6123,9 +6121,9 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-draw HRESULT Draw( DWORD dwDrawAspect, LONG
|
||||
// lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL(*
|
||||
// )(ULONG_PTR dwContinue) pfnContinue, ULONG_PTR dwContinue );
|
||||
unsafe HRESULT Draw(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, [In, Optional] DVTARGETDEVICE* ptd,
|
||||
[In, Optional] HDC hdcTargetDev, [In] HDC hdcDraw, [In, Optional] PRECT lprcBounds, [In, Optional] PRECT lprcWBounds,
|
||||
[In, Optional, MarshalAs(UnmanagedType.FunctionPtr)] Func<IntPtr, BOOL> pfnContinue, [In, Optional] IntPtr dwContinue);
|
||||
HRESULT Draw(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, [In, Optional] DVTARGETDEVICE? ptd,
|
||||
[In, Optional] HDC hdcTargetDev, [In] HDC hdcDraw, [In, Optional] PRECT? lprcBounds, [In, Optional] PRECT? lprcWBounds,
|
||||
[In, Optional, MarshalAs(UnmanagedType.FunctionPtr)] Func<IntPtr, BOOL>? pfnContinue, [In, Optional] IntPtr dwContinue);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the logical palette that the object will use for drawing in its IViewObject::Draw method with the corresponding parameters.
|
||||
|
@ -6208,7 +6206,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-getcolorset HRESULT GetColorSet( DWORD
|
||||
// dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet );
|
||||
unsafe HRESULT GetColorSet(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, [In, Optional] DVTARGETDEVICE* ptd,
|
||||
HRESULT GetColorSet(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, [In, Optional] DVTARGETDEVICE? ptd,
|
||||
[In, Optional] HDC hicTargetDev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(VanaraCustomMarshaler<LOGPALETTE>))] out LOGPALETTE ppColorSet);
|
||||
|
||||
/// <summary>
|
||||
|
@ -6273,7 +6271,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-freeze HRESULT Freeze( DWORD dwDrawAspect,
|
||||
// LONG lindex, void *pvAspect, DWORD *pdwFreeze );
|
||||
unsafe HRESULT Freeze(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, out uint pdwFreeze);
|
||||
HRESULT Freeze(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, out uint pdwFreeze);
|
||||
|
||||
/// <summary>
|
||||
/// Releases a drawing that was previously frozen using IViewObject::Freeze. The most common use of this method is for banded printing.
|
||||
|
@ -6372,7 +6370,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-setadvise HRESULT SetAdvise( DWORD aspects,
|
||||
// DWORD advf, IAdviseSink *pAdvSink );
|
||||
HRESULT SetAdvise(DVASPECT aspects, ADVF advf, [In, Optional] IAdviseSink pAdvSink);
|
||||
HRESULT SetAdvise(DVASPECT aspects, ADVF advf, [In, Optional] IAdviseSink? pAdvSink);
|
||||
|
||||
/// <summary>Retrieves the advisory connection on the object that was used in the most recent call to IViewObject::SetAdvise.</summary>
|
||||
/// <param name="pAspects">
|
||||
|
@ -6573,9 +6571,9 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-draw HRESULT Draw( DWORD dwDrawAspect, LONG
|
||||
// lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL(*
|
||||
// )(ULONG_PTR dwContinue) pfnContinue, ULONG_PTR dwContinue );
|
||||
new unsafe HRESULT Draw(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, [In, Optional] DVTARGETDEVICE* ptd,
|
||||
[In, Optional] HDC hdcTargetDev, [In] HDC hdcDraw, [In, Optional] PRECT lprcBounds, [In, Optional] PRECT lprcWBounds,
|
||||
[In, Optional, MarshalAs(UnmanagedType.FunctionPtr)] Func<IntPtr, BOOL> pfnContinue, [In, Optional] IntPtr dwContinue);
|
||||
new HRESULT Draw(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, [In, Optional] DVTARGETDEVICE? ptd,
|
||||
[In, Optional] HDC hdcTargetDev, [In] HDC hdcDraw, [In, Optional] PRECT? lprcBounds, [In, Optional] PRECT? lprcWBounds,
|
||||
[In, Optional, MarshalAs(UnmanagedType.FunctionPtr)] Func<IntPtr, BOOL>? pfnContinue, [In, Optional] IntPtr dwContinue);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the logical palette that the object will use for drawing in its IViewObject::Draw method with the corresponding parameters.
|
||||
|
@ -6658,7 +6656,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-getcolorset HRESULT GetColorSet( DWORD
|
||||
// dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet );
|
||||
new unsafe HRESULT GetColorSet(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, [In, Optional] DVTARGETDEVICE* ptd,
|
||||
new HRESULT GetColorSet(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, [In, Optional] DVTARGETDEVICE? ptd,
|
||||
[In, Optional] HDC hicTargetDev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(VanaraCustomMarshaler<LOGPALETTE>))] out LOGPALETTE ppColorSet);
|
||||
|
||||
/// <summary>
|
||||
|
@ -6723,7 +6721,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-freeze HRESULT Freeze( DWORD dwDrawAspect,
|
||||
// LONG lindex, void *pvAspect, DWORD *pdwFreeze );
|
||||
new unsafe HRESULT Freeze(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO* pvAspect, out uint pdwFreeze);
|
||||
new HRESULT Freeze(DVASPECT dwDrawAspect, int lindex, [In, Optional] DVASPECTINFO? pvAspect, out uint pdwFreeze);
|
||||
|
||||
/// <summary>
|
||||
/// Releases a drawing that was previously frozen using IViewObject::Freeze. The most common use of this method is for banded printing.
|
||||
|
@ -6822,7 +6820,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject-setadvise HRESULT SetAdvise( DWORD aspects,
|
||||
// DWORD advf, IAdviseSink *pAdvSink );
|
||||
new HRESULT SetAdvise(DVASPECT aspects, ADVF advf, [In, Optional] IAdviseSink pAdvSink);
|
||||
new HRESULT SetAdvise(DVASPECT aspects, ADVF advf, [In, Optional] IAdviseSink? pAdvSink);
|
||||
|
||||
/// <summary>Retrieves the advisory connection on the object that was used in the most recent call to IViewObject::SetAdvise.</summary>
|
||||
/// <param name="pAspects">
|
||||
|
@ -6886,7 +6884,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleidl/nf-oleidl-iviewobject2-getextent HRESULT GetExtent( DWORD
|
||||
// dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel );
|
||||
HRESULT GetExtent(uint dwDrawAspect, int lindex, in DVTARGETDEVICE ptd, out SIZE lpsizel);
|
||||
HRESULT GetExtent(uint dwDrawAspect, int lindex, [In] DVTARGETDEVICE ptd, out SIZE lpsizel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -72,7 +72,7 @@ public static partial class Ole32
|
|||
public uint ClipboardFormat => ulClipFmt is (-1) or (-2) ? (uint)Marshal.ReadInt32(pClipData) : 0;
|
||||
|
||||
/// <summary>The clipboard name.</summary>
|
||||
public string ClipboardFormatName => ulClipFmt > 0 ? Marshal.PtrToStringUni(pClipData) : null;
|
||||
public string? ClipboardFormatName => ulClipFmt > 0 ? Marshal.PtrToStringUni(pClipData) : null;
|
||||
|
||||
/// <summary>The clipboard format id.</summary>
|
||||
public Guid FMTID => ulClipFmt == -3 ? pClipData.ToStructure<Guid>() : Guid.Empty;
|
||||
|
@ -169,7 +169,7 @@ public static partial class Ole32
|
|||
public bool boolVal => GetRawValue<bool>().GetValueOrDefault();
|
||||
|
||||
/// <summary>Gets the BSTR value.</summary>
|
||||
public string bstrVal => GetString(VarType);
|
||||
public string? bstrVal => GetString(VarType);
|
||||
|
||||
/// <summary>Gets the byte value.</summary>
|
||||
public byte bVal => GetRawValue<byte>().GetValueOrDefault();
|
||||
|
@ -178,7 +178,7 @@ public static partial class Ole32
|
|||
public IEnumerable<bool> cabool => GetVector<short>().Select(s => s != 0);
|
||||
|
||||
/// <summary>Gets the string array value.</summary>
|
||||
public IEnumerable<string> cabstr => GetStringVector();
|
||||
public IEnumerable<string?> cabstr => GetStringVector();
|
||||
|
||||
/// <summary>Gets the sbyte array value.</summary>
|
||||
public IEnumerable<sbyte> cac => GetVector<sbyte>();
|
||||
|
@ -211,10 +211,10 @@ public static partial class Ole32
|
|||
public IEnumerable<int> cal => GetVector<int>();
|
||||
|
||||
/// <summary>Gets the ANSI string array value.</summary>
|
||||
public IEnumerable<string> calpstr => GetStringVector();
|
||||
public IEnumerable<string?> calpstr => GetStringVector();
|
||||
|
||||
/// <summary>Gets the Unicode string array value.</summary>
|
||||
public IEnumerable<string> calpwstr => GetStringVector();
|
||||
public IEnumerable<string?> calpwstr => GetStringVector();
|
||||
|
||||
/// <summary>Gets the PROPVARIANT array value.</summary>
|
||||
public IEnumerable<PROPVARIANT> capropvar => GetVector<PROPVARIANT>();
|
||||
|
@ -286,7 +286,7 @@ public static partial class Ole32
|
|||
public int lVal => GetRawValue<int>().GetValueOrDefault();
|
||||
|
||||
/// <summary>Gets the array of objects.</summary>
|
||||
public IEnumerable<object> parray => GetSafeArray();
|
||||
public IEnumerable<object?> parray => GetSafeArray();
|
||||
|
||||
/// <summary>Gets the "by value" boolean value.</summary>
|
||||
public bool? pboolVal => GetRawValue<bool>();
|
||||
|
@ -330,7 +330,7 @@ public static partial class Ole32
|
|||
public decimal? pdecVal => GetRawValue<decimal>();
|
||||
|
||||
/// <summary>Gets the "by value" pointer value.</summary>
|
||||
public object pdispVal => punkVal;
|
||||
public object? pdispVal => punkVal;
|
||||
|
||||
/// <summary>Gets the "by value" float value.</summary>
|
||||
public float? pfltVal => GetRawValue<float>();
|
||||
|
@ -361,13 +361,13 @@ public static partial class Ole32
|
|||
}
|
||||
|
||||
/// <summary>Gets the IStorage value.</summary>
|
||||
public IStorage pStorage => (IStorage)punkVal;
|
||||
public IStorage? pStorage => (IStorage?)punkVal;
|
||||
|
||||
/// <summary>Gets the IStream value.</summary>
|
||||
public IStream pStream => (IStream)punkVal;
|
||||
public IStream? pStream => (IStream?)punkVal;
|
||||
|
||||
/// <summary>Gets the ANSI string value.</summary>
|
||||
public string pszVal => GetString(VarType);
|
||||
public string? pszVal => GetString(VarType);
|
||||
|
||||
/// <summary>Gets the "by value" uint value.</summary>
|
||||
public uint? puintVal => GetRawValue<uint>();
|
||||
|
@ -379,19 +379,19 @@ public static partial class Ole32
|
|||
public uint? pulVal => GetRawValue<uint>();
|
||||
|
||||
/// <summary>Gets the "by value" IUnknown value.</summary>
|
||||
public object punkVal => _ptr == IntPtr.Zero ? null : Marshal.GetObjectForIUnknown(_ptr);
|
||||
public object? punkVal => _ptr == IntPtr.Zero ? null : Marshal.GetObjectForIUnknown(_ptr);
|
||||
|
||||
/// <summary>Gets the "by value" Guid value.</summary>
|
||||
public Guid? puuid => GetRawValue<Guid>();
|
||||
|
||||
/// <summary>Gets the "by value" PROPVARIANT value.</summary>
|
||||
public PROPVARIANT pvarVal => _ptr.ToStructure<PROPVARIANT>();
|
||||
public PROPVARIANT? pvarVal => _ptr.ToStructure<PROPVARIANT>();
|
||||
|
||||
/// <summary>Gets a stream with a Guid version.</summary>
|
||||
public IntPtr pVersionedStream => GetRawValue<IntPtr>().GetValueOrDefault();
|
||||
|
||||
/// <summary>Gets the Unicode string value.</summary>
|
||||
public string pwszVal => GetString(VarType);
|
||||
public string? pwszVal => GetString(VarType);
|
||||
|
||||
/// <summary>Gets the Win32Error value.</summary>
|
||||
public Win32Error scode => new(GetRawValue<uint>().GetValueOrDefault());
|
||||
|
@ -409,7 +409,7 @@ public static partial class Ole32
|
|||
public uint ulVal => GetRawValue<uint>().GetValueOrDefault();
|
||||
|
||||
/// <summary>Gets the value base on the <see cref="vt"/> value.</summary>
|
||||
public object Value
|
||||
public object? Value
|
||||
{
|
||||
get => GetValue();
|
||||
private set => SetValue(value);
|
||||
|
@ -439,7 +439,7 @@ public static partial class Ole32
|
|||
/// <summary>Gets the Type for a provided VARTYPE.</summary>
|
||||
/// <param name="vt">The VARTYPE value to lookup.</param>
|
||||
/// <returns>A best fit <see cref="Type"/> for the provided VARTYPE.</returns>
|
||||
public static Type GetType(VARTYPE vt)
|
||||
public static Type? GetType(VARTYPE vt)
|
||||
{
|
||||
// Safe arrays are always pointers
|
||||
if (vt.IsFlagSet(VARTYPE.VT_ARRAY)) return typeof(IntPtr);
|
||||
|
@ -447,17 +447,17 @@ public static partial class Ole32
|
|||
// VT_NULL is always DBNull
|
||||
if (elemType == VARTYPE.VT_NULL) return typeof(DBNull);
|
||||
// Get type of element, return null if VT_EMPTY or not found
|
||||
var type = CorrespondingTypeAttribute.GetCorrespondingTypes(elemType).FirstOrDefault();
|
||||
Type? type = CorrespondingTypeAttribute.GetCorrespondingTypes(elemType).FirstOrDefault();
|
||||
if (type == null || elemType == 0) return null;
|
||||
// Change type if by reference
|
||||
if (vt.IsFlagSet(VARTYPE.VT_BYREF))
|
||||
{
|
||||
type = Nullable.GetUnderlyingType(type);
|
||||
if (type.IsValueType)
|
||||
if (type is not null && type.IsValueType)
|
||||
type = typeof(Nullable<>).MakeGenericType(type);
|
||||
}
|
||||
// Change type if vector
|
||||
if (vt.IsFlagSet(VARTYPE.VT_VECTOR))
|
||||
if (vt.IsFlagSet(VARTYPE.VT_VECTOR) && type is not null)
|
||||
{
|
||||
type = typeof(IEnumerable<>).MakeGenericType(type);
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ public static partial class Ole32
|
|||
/// <summary>Gets the VARTYPE for a provided type.</summary>
|
||||
/// <param name="type">The type to analyze.</param>
|
||||
/// <returns>A best fit <see cref="VARTYPE"/> for the provided type.</returns>
|
||||
public static VARTYPE GetVarType(Type type)
|
||||
public static VARTYPE GetVarType(Type? type)
|
||||
{
|
||||
if (type == null)
|
||||
return VARTYPE.VT_NULL;
|
||||
|
@ -508,7 +508,9 @@ public static partial class Ole32
|
|||
return ret | VARTYPE.VT_HRESULT;
|
||||
if (elemtype.IsCOMObject)
|
||||
{
|
||||
Type[] intf = elemtype.GetInterfaces();
|
||||
#pragma warning disable IL2065 // The method has a DynamicallyAccessedMembersAttribute (which applies to the implicit 'this' parameter), but the value used for the 'this' parameter can not be statically analyzed.
|
||||
Type[] intf = elemtype!.GetInterfaces();
|
||||
#pragma warning restore IL2065 // The method has a DynamicallyAccessedMembersAttribute (which applies to the implicit 'this' parameter), but the value used for the 'this' parameter can not be statically analyzed.
|
||||
if (intf.Contains(typeof(IStream))) return ret | VARTYPE.VT_STREAM;
|
||||
if (intf.Contains(typeof(IStorage))) return ret | VARTYPE.VT_STORAGE;
|
||||
return ret | VARTYPE.VT_UNKNOWN;
|
||||
|
@ -610,7 +612,7 @@ public static partial class Ole32
|
|||
/// position in the sort order as <paramref name="other"/>. Greater than zero This instance follows <paramref name="other"/> in
|
||||
/// the sort order.
|
||||
/// </returns>
|
||||
public int CompareTo(object other)
|
||||
public int CompareTo(object? other)
|
||||
{
|
||||
var v = Value;
|
||||
if (other is null) return v == null ? 0 : 1;
|
||||
|
@ -632,12 +634,12 @@ public static partial class Ole32
|
|||
/// <summary>Determines whether the specified <see cref="object"/>, is equal to this instance.</summary>
|
||||
/// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
|
||||
/// <returns><c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||
public override bool Equals(object obj) => obj is PROPVARIANT pv ? Equals(pv.Value) : obj == this;
|
||||
public override bool Equals(object? obj) => obj is PROPVARIANT pv ? Equals(pv.Value) : obj == this;
|
||||
|
||||
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
|
||||
/// <param name="other">An object to compare with this object.</param>
|
||||
/// <returns>true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.</returns>
|
||||
public bool Equals(PROPVARIANT other) => CompareTo(other) == 0;
|
||||
public bool Equals(PROPVARIANT? other) => CompareTo(other) == 0;
|
||||
|
||||
/// <summary>Returns a hash code for this instance.</summary>
|
||||
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
|
||||
|
@ -647,7 +649,7 @@ public static partial class Ole32
|
|||
/// <returns>A <see cref="string"/> that represents this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
string s = null;
|
||||
string s = "";
|
||||
if (IsVector && Value is IEnumerable ie)
|
||||
s = string.Join(",", ie.Cast<object>().Select(o => o.ToString()).ToArray());
|
||||
else if (PropVariantToStringAlloc(this, out var str).Succeeded)
|
||||
|
@ -670,11 +672,11 @@ public static partial class Ole32
|
|||
/// meanings: Value Meaning Less than zero This object is less than the <paramref name="other"/> parameter.Zero This object is
|
||||
/// equal to <paramref name="other"/>. Greater than zero This object is greater than <paramref name="other"/>.
|
||||
/// </returns>
|
||||
int IComparable<PROPVARIANT>.CompareTo(PROPVARIANT other) => CompareTo(other);
|
||||
int IComparable<PROPVARIANT>.CompareTo(PROPVARIANT? other) => CompareTo(other);
|
||||
|
||||
private static IEnumerable<T> ConvertToEnum<T>(object array, Func<object, T> conv = null)
|
||||
private static IEnumerable<T> ConvertToEnum<T>(object array, Func<object, T>? conv = null)
|
||||
{
|
||||
if (array is null) return null;
|
||||
if (array is null) return new T[0];
|
||||
|
||||
if (array is IEnumerable<T> iet) return iet;
|
||||
|
||||
|
@ -687,11 +689,11 @@ public static partial class Ole32
|
|||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
return new T[0];
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetString(VarEnum ve, IntPtr ptr) => (VARTYPE)ve switch
|
||||
private static string? GetString(VarEnum ve, IntPtr ptr) => (VARTYPE)ve switch
|
||||
{
|
||||
VARTYPE.VT_LPSTR => Marshal.PtrToStringAnsi(ptr),
|
||||
VARTYPE.VT_LPWSTR => Marshal.PtrToStringUni(ptr),
|
||||
|
@ -729,9 +731,9 @@ public static partial class Ole32
|
|||
return _ptr.ToNullableStructure<T>();
|
||||
}
|
||||
|
||||
private IEnumerable<object> GetSafeArray()
|
||||
private IEnumerable<object?> GetSafeArray()
|
||||
{
|
||||
if (_ptr == IntPtr.Zero) return null;
|
||||
if (_ptr == IntPtr.Zero) return new object[0];
|
||||
var sa = new SafeSAFEARRAY(_ptr, false);
|
||||
var dims = SafeArrayGetDim(sa);
|
||||
if (dims != 1) throw new NotSupportedException("Only single-dimensional arrays are supported");
|
||||
|
@ -752,19 +754,22 @@ public static partial class Ole32
|
|||
if (elemSz == 0) throw new Win32Exception();
|
||||
using var mem = new SafeCoTaskMemHandle(elemSz);
|
||||
SafeArrayGetVartype(sa, out var elemVT);
|
||||
var elemType = GetType(elemVT);
|
||||
for (int i = lBound; i <= uBound; i++)
|
||||
Type? elemType = GetType(elemVT);
|
||||
if (elemType is not null)
|
||||
{
|
||||
SafeArrayGetElement(sa, i, mem).ThrowIfFailed();
|
||||
ret[i - lBound] = mem.DangerousGetHandle().Convert(mem.Size, elemType);
|
||||
for (int i = lBound; i <= uBound; i++)
|
||||
{
|
||||
SafeArrayGetElement(sa, i, mem).ThrowIfFailed();
|
||||
ret[i - lBound] = mem.DangerousGetHandle().Convert(mem.Size, elemType)!;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetString(VarEnum ve) => GetString(ve, _ptr);
|
||||
private string? GetString(VarEnum ve) => GetString(ve, _ptr);
|
||||
|
||||
private string[] GetStringVector()
|
||||
private string?[] GetStringVector()
|
||||
{
|
||||
var ve = (VarEnum)((int)vt & 0x0FFF);
|
||||
if (ve == VarEnum.VT_LPSTR)
|
||||
|
@ -773,7 +778,7 @@ public static partial class Ole32
|
|||
return vals;
|
||||
}
|
||||
|
||||
private object GetValue()
|
||||
private object? GetValue()
|
||||
{
|
||||
if (vt.IsFlagSet(VARTYPE.VT_ARRAY)) return GetSafeArray();
|
||||
var isVector = vt.IsFlagSet(VARTYPE.VT_VECTOR);
|
||||
|
@ -794,7 +799,7 @@ public static partial class Ole32
|
|||
VARTYPE.VT_R8 => isRef ? dblVal : (isVector ? cadbl : dblVal),
|
||||
VARTYPE.VT_BOOL => isRef ? pboolVal : (isVector ? cabool : boolVal),
|
||||
VARTYPE.VT_ERROR => isRef ? pscode : (isVector ? cascode : scode),
|
||||
VARTYPE.VT_HRESULT => isRef ? (pulVal.HasValue ? new HRESULT(plVal.Value) : (HRESULT?)null) : (isVector ? cal.Select(u => new HRESULT(u)) : new HRESULT(lVal)),
|
||||
VARTYPE.VT_HRESULT => isRef ? (pulVal.HasValue ? new HRESULT(plVal.GetValueOrDefault()) : (HRESULT?)null) : (isVector ? cal.Select(u => new HRESULT(u)) : new HRESULT(lVal)),
|
||||
VARTYPE.VT_CY => isRef ? pcyVal : (isVector ? cacy : cyVal),
|
||||
VARTYPE.VT_DATE => isRef ? pdate : (isVector ? cadate : date),
|
||||
VARTYPE.VT_FILETIME => isRef ? filetime : (isVector ? cafiletime : filetime),
|
||||
|
@ -814,7 +819,7 @@ public static partial class Ole32
|
|||
};
|
||||
}
|
||||
|
||||
private IEnumerable<T> GetVector<T>() => vt.IsFlagSet(VARTYPE.VT_VECTOR) ? (_blob.cbSize <= 0 ? new T[0] : _blob.pBlobData.ToArray<T>((int)_blob.cbSize)) : throw new InvalidCastException();
|
||||
private IEnumerable<T> GetVector<T>() => vt.IsFlagSet(VARTYPE.VT_VECTOR) ? (_blob.cbSize <= 0 ? new T[0] : _blob.pBlobData.ToArray<T>((int)_blob.cbSize))! : throw new InvalidCastException();
|
||||
|
||||
private void SetSafeArray(IList<object> array)
|
||||
{
|
||||
|
@ -851,13 +856,13 @@ public static partial class Ole32
|
|||
case VARTYPE.VT_BSTR:
|
||||
vt = svt | VARTYPE.VT_VECTOR;
|
||||
_blob.cbSize = (uint)sc.Length;
|
||||
_blob.pBlobData = value.Select(Marshal.StringToBSTR).MarshalToPtr<IntPtr>(Marshal.AllocCoTaskMem, out var _);
|
||||
_blob.pBlobData = value.Select(Marshal.StringToBSTR).MarshalToPtr(Marshal.AllocCoTaskMem, out var _);
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_LPSTR:
|
||||
vt = svt | VARTYPE.VT_VECTOR;
|
||||
_blob.cbSize = (uint)sc.Length;
|
||||
_blob.pBlobData = value.Select(Marshal.StringToCoTaskMemAnsi).MarshalToPtr<IntPtr>(Marshal.AllocCoTaskMem, out var _);
|
||||
_blob.pBlobData = value.Select(Marshal.StringToCoTaskMemAnsi).MarshalToPtr(Marshal.AllocCoTaskMem, out var _);
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_LPWSTR:
|
||||
|
@ -894,7 +899,7 @@ public static partial class Ole32
|
|||
/// <param name="vEnum">
|
||||
/// If this value equals VT_EMPTY, the method will attempt to ascertain the value type from the <paramref name="value"/>.
|
||||
/// </param>
|
||||
private void SetValue(object value, VarEnum vEnum = VarEnum.VT_EMPTY)
|
||||
private void SetValue(object? value, VarEnum vEnum = VarEnum.VT_EMPTY)
|
||||
{
|
||||
Clear();
|
||||
var newVT = vt = vEnum == VarEnum.VT_EMPTY ? GetVarType(value?.GetType()) : (VARTYPE)vEnum;
|
||||
|
@ -913,7 +918,7 @@ public static partial class Ole32
|
|||
}
|
||||
else
|
||||
{
|
||||
SetSafeArray(ConvertToEnum<object>(value).ToList());
|
||||
SetSafeArray(ConvertToEnum<object>(value!).ToList());
|
||||
vt = VARTYPE.VT_ARRAY | VARTYPE.VT_VARIANT;
|
||||
}
|
||||
return;
|
||||
|
@ -1032,37 +1037,37 @@ public static partial class Ole32
|
|||
if (isVector)
|
||||
AllocVector(GetArray<CLIPDATA>(out sz), sz);
|
||||
else
|
||||
_ptr = ((CLIPDATA)value).MarshalToPtr(Marshal.AllocCoTaskMem, out var _);
|
||||
_ptr = ((CLIPDATA)value!).MarshalToPtr(Marshal.AllocCoTaskMem, out var _);
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_BSTR:
|
||||
if (isVector)
|
||||
SetStringVector(ConvertToEnum<string>(value), VarType);
|
||||
SetStringVector(ConvertToEnum<string>(value!), VarType);
|
||||
else
|
||||
{
|
||||
if (isRef)
|
||||
SetStruct((IntPtr?)value, VarType);
|
||||
SetStruct<IntPtr>((IntPtr)value!, VarType);
|
||||
else
|
||||
_ptr = Marshal.StringToBSTR(value?.ToString());
|
||||
_ptr = Marshal.StringToBSTR(value!.ToString());
|
||||
}
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_BLOB:
|
||||
case VARTYPE.VT_BLOB_OBJECT:
|
||||
if (!isVector && !isRef)
|
||||
_blob = (BLOB)value;
|
||||
_blob = (BLOB)value!;
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_LPSTR:
|
||||
if (isVector)
|
||||
SetStringVector(ConvertToEnum<string>(value), VarType);
|
||||
SetStringVector(ConvertToEnum<string>(value!), VarType);
|
||||
else
|
||||
_ptr = Marshal.StringToCoTaskMemAnsi(value?.ToString());
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_LPWSTR:
|
||||
if (isVector)
|
||||
SetStringVector(ConvertToEnum<string>(value), VarType);
|
||||
SetStringVector(ConvertToEnum<string>(value!), VarType);
|
||||
else
|
||||
_ptr = Marshal.StringToCoTaskMemUni(value?.ToString());
|
||||
break;
|
||||
|
@ -1072,7 +1077,7 @@ public static partial class Ole32
|
|||
if (isVector)
|
||||
AllocVector(GetArray(out sz, ToIUnkPtr), sz);
|
||||
else
|
||||
SetStruct<IntPtr>(ToIUnkPtr(value), VarType);
|
||||
SetStruct<IntPtr>(ToIUnkPtr(value!), VarType);
|
||||
break;
|
||||
|
||||
#if !(NETSTANDARD2_0)
|
||||
|
@ -1081,20 +1086,20 @@ public static partial class Ole32
|
|||
if (isVector)
|
||||
AllocVector(GetArray(out sz, ToIDispPtr), sz);
|
||||
else
|
||||
SetStruct<IntPtr>(ToIDispPtr(value), VarType);
|
||||
SetStruct<IntPtr>(ToIDispPtr(value!), VarType);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VARTYPE.VT_STREAM:
|
||||
case VARTYPE.VT_STREAMED_OBJECT:
|
||||
if (!isVector && !isRef)
|
||||
SetStruct<IntPtr>(Marshal.GetComInterfaceForObject(value, typeof(IStream)), VarType);
|
||||
SetStruct<IntPtr>(Marshal.GetComInterfaceForObject(value!, typeof(IStream)), VarType);
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_STORAGE:
|
||||
case VARTYPE.VT_STORED_OBJECT:
|
||||
if (!isVector && !isRef)
|
||||
SetStruct<IntPtr>(Marshal.GetComInterfaceForObject(value, typeof(IStorage)), VarType);
|
||||
SetStruct<IntPtr>(Marshal.GetComInterfaceForObject(value!, typeof(IStorage)), VarType);
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_DECIMAL:
|
||||
|
@ -1110,7 +1115,7 @@ public static partial class Ole32
|
|||
if (isVector)
|
||||
AllocVector(GetArray(out sz, o => { ((PROPVARIANT)o).Clone(out var oo); return oo; }), sz);
|
||||
else if (isRef)
|
||||
InitPropVariantVectorFromPropVariant((PROPVARIANT)value, this);
|
||||
InitPropVariantVectorFromPropVariant((PROPVARIANT)value!, this);
|
||||
break;
|
||||
|
||||
case VARTYPE.VT_USERDEFINED:
|
||||
|
@ -1121,26 +1126,26 @@ public static partial class Ole32
|
|||
throw new ArgumentOutOfRangeException(nameof(Value), $"{vt}={value}");
|
||||
}
|
||||
|
||||
HRESULT AllocVector<T>(T[] vector, uint vsz, PROPVARIANT pv = null)
|
||||
HRESULT AllocVector<T>(T[] vector, uint vsz, PROPVARIANT? pv = null)
|
||||
{
|
||||
_blob.cbSize = vsz;
|
||||
_blob.pBlobData = vector.MarshalToPtr<T>(global::System.Runtime.InteropServices.Marshal.AllocCoTaskMem, out var _);
|
||||
return HRESULT.S_OK;
|
||||
}
|
||||
|
||||
T[] GetArray<T>(out uint len, Func<object, T> conv = null)
|
||||
T[] GetArray<T>(out uint len, Func<object, T>? conv = null)
|
||||
{
|
||||
var ret = ConvertToEnum<T>(value, conv).ToArray();
|
||||
var ret = ConvertToEnum<T>(value!, conv).ToArray();
|
||||
len = (uint)ret.Length;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Init<T>(Func<T[], uint, PROPVARIANT, HRESULT> init, Func<object, T> conv = null) where T : struct
|
||||
void Init<T>(Func<T[], uint, PROPVARIANT, HRESULT> init, Func<object, T>? conv = null) where T : struct
|
||||
{
|
||||
if (isVector)
|
||||
init(GetArray<T>(out sz, conv), sz, this).ThrowIfFailed();
|
||||
else
|
||||
SetStruct((T?)(conv?.Invoke(value) ?? value), VarType);
|
||||
SetStruct((T?)(conv?.Invoke(value!) ?? value), VarType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propidl/nf-propidl-ipropertysetstorage-create
|
||||
[PreserveSig]
|
||||
HRESULT Create(in Guid rfmtid, [In] IntPtr pclsid, [In] PROPSETFLAG grfFlags, [In] STGM grfMode, out IPropertyStorage ppprstg);
|
||||
HRESULT Create(in Guid rfmtid, [In, Optional] IntPtr pclsid, [In] PROPSETFLAG grfFlags, [In] STGM grfMode, out IPropertyStorage ppprstg);
|
||||
|
||||
/// <summary>
|
||||
/// <para>The <c>Open</c> method opens a property set contained in the property set storage object.</para>
|
||||
|
@ -739,7 +739,8 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propidl/nf-propidl-ipropertystorage-readpropertynames
|
||||
[PreserveSig]
|
||||
HRESULT ReadPropertyNames(uint cpropid, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] rgpropid, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rglpwstrName);
|
||||
HRESULT ReadPropertyNames(uint cpropid, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] rgpropid,
|
||||
[In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rglpwstrName);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -791,7 +792,8 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propidl/nf-propidl-ipropertystorage-writepropertynames
|
||||
[PreserveSig]
|
||||
HRESULT WritePropertyNames(uint cpropid, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] rgpropid, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rglpwstrName);
|
||||
HRESULT WritePropertyNames(uint cpropid, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] rgpropid,
|
||||
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rglpwstrName);
|
||||
|
||||
/// <summary>
|
||||
/// <para>The <c>DeletePropertyNames</c> method deletes specified string names from the current property set.</para>
|
||||
|
@ -980,7 +982,7 @@ public static partial class Ole32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propidl/nf-propidl-ipropertystorage-settimes
|
||||
[PreserveSig]
|
||||
HRESULT SetTimes(in FILETIME pctime, in FILETIME patime, in FILETIME pmtime);
|
||||
HRESULT SetTimes([In, Optional] IntPtr pctime, [In, Optional] IntPtr patime, [In, Optional] IntPtr pmtime);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -1105,7 +1107,7 @@ public static partial class Ole32
|
|||
/// <para>For more information, see Property Storage Considerations.</para>
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propidl/nf-propidl-ipropertystorage-readmultiple
|
||||
public static HRESULT ReadMultiple(this IPropertyStorage ipst, PROPSPEC[] rgpspec, out PROPVARIANT[] rgpropvar)
|
||||
public static HRESULT ReadMultiple(this IPropertyStorage ipst, PROPSPEC[] rgpspec, out PROPVARIANT[]? rgpropvar)
|
||||
{
|
||||
if (ipst is null) throw new ArgumentNullException(nameof(ipst));
|
||||
if (rgpspec is null) throw new ArgumentNullException(nameof(rgpspec));
|
||||
|
@ -1115,6 +1117,52 @@ public static partial class Ole32
|
|||
return hr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// The <c>SetTimes</c> method sets the modification, access, and creation times of this property set, if supported by the
|
||||
/// implementation. Not all implementations support all these time values.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="ipst">The <see cref="IPropertyStorage" /> reference.</param>
|
||||
/// <param name="pctime">
|
||||
/// <para>
|
||||
/// Pointer to the new creation time for the property set. May be <c>NULL</c>, indicating that this time is not to be modified by
|
||||
/// this call.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="patime">
|
||||
/// <para>
|
||||
/// Pointer to the new access time for the property set. May be <c>NULL</c>, indicating that this time is not to be modified by
|
||||
/// this call.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <param name="pmtime">
|
||||
/// <para>
|
||||
/// Pointer to the new modification time for the property set. May be <c>NULL</c>, indicating that this time is not to be
|
||||
/// modified by this call.
|
||||
/// </para>
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <para>This method supports the standard return value E_UNEXPECTED, in addition to the following:</para>
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Sets the modification, access, and creation times of the current open property set, if supported by the implementation (not
|
||||
/// all implementations support all these time values). Unsupported time stamps are always reported as zero, enabling the caller
|
||||
/// to test for support. A call to IPropertyStorage::Stat supplies (among other data) time-stamp information.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Notice that this functionality is provided as an IPropertyStorage method on a property-storage object that is already open,
|
||||
/// in contrast to being provided as a method in IPropertySetStorage. Normally, when the <c>SetTimes</c> method is not explicitly
|
||||
/// called, the access and modification times are updated as a side effect of reading and writing the property set. When
|
||||
/// <c>SetTimes</c> is used, the latest specified times supersede either default times or time values specified in previous calls
|
||||
/// to <c>SetTimes</c>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propidl/nf-propidl-ipropertystorage-settimes
|
||||
public static HRESULT SetTimes(this IPropertyStorage ipst, [In, Optional] FILETIME? pctime, [In, Optional] FILETIME? patime, [In, Optional] FILETIME? pmtime) =>
|
||||
ipst.SetTimes((SafeCoTaskMemStruct<FILETIME>)pctime, (SafeCoTaskMemStruct<FILETIME>)patime, (SafeCoTaskMemStruct<FILETIME>)pmtime);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>WriteMultiple</c> method writes a specified group of properties to the current property set. If a property with a
|
||||
/// specified name or property identifier already exists, it is replaced, even when the old and new types for the property value
|
||||
|
|
|
@ -93,7 +93,7 @@ public static partial class Ole32
|
|||
// https://docs.microsoft.com/en-us/windows/desktop/api/unknwn/nf-unknwn-iclassfactory-createinstance HRESULT CreateInstance(
|
||||
// IUnknown *pUnkOuter, REFIID riid, void **ppvObject );
|
||||
[PreserveSig]
|
||||
HRESULT CreateInstance([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object ppvObject);
|
||||
HRESULT CreateInstance([In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object? ppvObject);
|
||||
|
||||
/// <summary>Locks an object application open in memory. This enables instances to be created more quickly.</summary>
|
||||
/// <param name="fLock">If <c>TRUE</c>, increments the lock count; if <c>FALSE</c>, decrements the lock count.</param>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -424,7 +424,7 @@ public static partial class Ole32
|
|||
/// pointer to the element type.
|
||||
/// </para>
|
||||
/// </returns>
|
||||
public static Type GetCorrespondingType(this VARTYPE vt)
|
||||
public static Type? GetCorrespondingType(this VARTYPE vt)
|
||||
{
|
||||
var elemVT = vt & ~(VARTYPE)0xF000;
|
||||
var specVT = vt & (VARTYPE)0xF000;
|
||||
|
|
|
@ -477,7 +477,7 @@ public static partial class Ole32
|
|||
// *pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "3292484b-8eff-438d-b989-b58ae323872b")]
|
||||
public static extern HRESULT StgCreateDocfile([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, STGM grfMode, [Optional] uint reserved, out IStorage ppstgOpen);
|
||||
public static extern HRESULT StgCreateDocfile([MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, [Optional] uint reserved, out IStorage ppstgOpen);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>StgCreateDocfileOnILockBytes</c> function creates and opens a new compound file storage object on top of a byte-array
|
||||
|
@ -644,150 +644,58 @@ public static partial class Ole32
|
|||
public static extern HRESULT StgCreatePropStg([In, MarshalAs(UnmanagedType.IUnknown)] object pUnk, in Guid fmtid, in Guid pclsid, PROPSETFLAG grfFlags, [Optional] uint dwReserved, out IPropertyStorage ppPropStg);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// The <c>StgCreateStorageEx</c> function creates a new storage object using a provided implementation for the IStorage or
|
||||
/// IPropertySetStorage interfaces. To open an existing file, use the StgOpenStorageEx function instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Applications written for Windows 2000, Windows Server 2003 and Windows XP must use <c>StgCreateStorageEx</c> rather than
|
||||
/// StgCreateDocfile to take advantage of the enhanced Windows 2000 and Windows XP Structured Storage features.
|
||||
/// </para>
|
||||
/// The <c>StgCreatePropStg</c> function creates and opens a property set in a specified storage or stream object. The property set
|
||||
/// supplies the system-provided, stand-alone implementation of the IPropertyStorage interface.
|
||||
/// </summary>
|
||||
/// <param name="pwcsName">
|
||||
/// <para>
|
||||
/// A pointer to the path of the file to create. It is passed uninterpreted to the file system. This can be a relative name or
|
||||
/// <c>NULL</c>. If <c>NULL</c>, a temporary file is allocated with a unique name. If non- <c>NULL</c>, the string size must not
|
||||
/// exceed MAX_PATH characters.
|
||||
/// </para>
|
||||
/// <para><c>Windows 2000:</c> Unlike the CreateFile function, you cannot exceed the MAX_PATH limit by using the "\?" prefix.</para>
|
||||
/// <param name="pUnk">
|
||||
/// A pointer to the <c>IUnknown</c> interface on the storage or stream object that stores the new property set.
|
||||
/// </param>
|
||||
/// <param name="grfMode">
|
||||
/// A value that specifies the access mode to use when opening the new storage object. For more information, see STGM Constants. If
|
||||
/// the caller specifies transacted mode together with STGM_CREATE or STGM_CONVERT, the overwrite or conversion takes place when the
|
||||
/// commit operation is called for the root storage. If IStorage::Commit is not called for the root storage object, previous contents
|
||||
/// of the file will be restored. STGM_CREATE and STGM_CONVERT cannot be combined with the STGM_NOSNAPSHOT flag, because a snapshot
|
||||
/// copy is required when a file is overwritten or converted in the transacted mode.
|
||||
/// <param name="fmtid">The FMTID of the property set to be created.</param>
|
||||
/// <param name="pclsid">
|
||||
/// A Pointer to the initial CLSID for this property set. May be <c>NULL</c>, in which case pclsid is set to all zeroes.
|
||||
/// </param>
|
||||
/// <param name="stgfmt">A value that specifies the storage file format. For more information, see the STGFMT enumeration.</param>
|
||||
/// <param name="grfAttrs">
|
||||
/// <para>A value that depends on the value of the stgfmt parameter.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Parameter Values</term>
|
||||
/// <term>Meaning</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>STGFMT_DOCFILE</term>
|
||||
/// <term>
|
||||
/// 0, or FILE_FLAG_NO_BUFFERING. For more information, see CreateFile. If the sector size of the file, specified in pStgOptions, is
|
||||
/// not an integer multiple of the underlying disk's physical sector size, this operation will fail.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>All other values of stgfmt</term>
|
||||
/// <term>Must be 0.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// <param name="grfFlags">The values from PROPSETFLAG Constants that determine how the property set is created and opened.</param>
|
||||
/// <param name="dwReserved">Reserved; must be zero.</param>
|
||||
/// <param name="ppPropStg">
|
||||
/// The address of an IPropertyStorage* pointer variable that receives the interface pointer to the new property set.
|
||||
/// </param>
|
||||
/// <param name="pStgOptions">
|
||||
/// The pStgOptions parameter is valid only if the stgfmt parameter is set to STGFMT_DOCFILE. If the stgfmt parameter is set to
|
||||
/// STGFMT_DOCFILE, pStgOptions points to the STGOPTIONS structure, which specifies features of the storage object, such as the
|
||||
/// sector size. This parameter may be <c>NULL</c>, which creates a storage object with a default sector size of 512 bytes. If non-
|
||||
/// <c>NULL</c>, the <c>ulSectorSize</c> member must be set to either 512 or 4096. If set to 4096, STGM_SIMPLE may not be specified
|
||||
/// in the grfMode parameter. The <c>usVersion</c> member must be set before calling <c>StgCreateStorageEx</c>. For more information,
|
||||
/// see <c>STGOPTIONS</c>.
|
||||
/// </param>
|
||||
/// <param name="pSecurityDescriptor">
|
||||
/// <para>
|
||||
/// Enables the ACLs to be set when the file is created. If not <c>NULL</c>, needs to be a pointer to the SECURITY_ATTRIBUTES
|
||||
/// structure. See CreateFile for information on how to set ACLs on files.
|
||||
/// </para>
|
||||
/// <para><c>Windows Server 2003, Windows 2000 Server, Windows XP and Windows 2000 Professional:</c> Value must be <c>NULL</c>.</para>
|
||||
/// </param>
|
||||
/// <param name="riid">
|
||||
/// A value that specifies the interface identifier (IID) of the interface pointer to return. This IID may be for the IStorage
|
||||
/// interface or the IPropertySetStorage interface.
|
||||
/// </param>
|
||||
/// <param name="ppObjectOpen">
|
||||
/// A pointer to an interface pointer variable that receives a pointer for an interface on the new storage object; contains
|
||||
/// <c>NULL</c> if operation failed.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// This function can also return any file system errors or system errors wrapped in an <c>HRESULT</c>. For more information, see
|
||||
/// Error Handling Strategies and Handling Unknown Errors.
|
||||
/// </returns>
|
||||
/// <returns>This function supports the standard return values E_INVALIDARG and E_UNEXPECTED, in addition to the following:</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// When an application modifies its file, it usually creates a copy of the original. The <c>StgCreateStorageEx</c> function is one
|
||||
/// way for creating a copy. This function works indirectly with the Encrypting File System (EFS) duplication API. When you use this
|
||||
/// function, you will need to set the options for the file storage in the STGOPTIONS structure.
|
||||
/// <c>StgCreatePropStg</c> creates and opens a new property set which supplies the system-provided, stand-alone implementation of
|
||||
/// the IPropertyStorage interface. The new property set is contained in the storage or stream object specified by pUnk. The value of
|
||||
/// the grfFlags parameter indicates whether pUnk specifies a storage or stream object. For example, if PROPSETFLAG_NONSIMPLE is set,
|
||||
/// then pUnk can be queried for an IStorage interface on a storage object.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>StgCreateStorageEx</c> is a superset of the StgCreateDocfile function, and should be used by new code. Future enhancements to
|
||||
/// Structured Storage will be exposed through the <c>StgCreateStorageEx</c> function. See the following Requirements section for
|
||||
/// information on supported platforms.
|
||||
/// In either case, this function calls pUnk->AddRef for the storage or stream object containing the property set. It is the
|
||||
/// responsibility of the caller to release the object when it is no longer needed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The <c>StgCreateStorageEx</c> function creates a new storage object using one of the system-provided, structured-storage
|
||||
/// implementations. This function can be used to obtain an IStorage compound file implementation, an IPropertySetStorage compound
|
||||
/// file implementation, or to obtain an IPropertySetStorage NTFS implementation.
|
||||
/// This function is similar to the IPropertySetStorage::Create method. However, <c>StgCreatePropStg</c> adds the pUnk parameter and
|
||||
/// supports the PROPSETFLAG_UNBUFFERED value for the grfFlags parameter. Use this function instead of the <c>Create</c> method if
|
||||
/// you have an IStorage interface that does not support the IPropertySetStorage interface, or if you want to use the
|
||||
/// PROPSETFLAG_UNBUFFERED value. For more information about using this PROPSETFLAG_UNBUFFERED enumeration value, see PROPSETFLAG Constants.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When a new file is created, the storage implementation used depends on the flag that you specify and on the type of drive on
|
||||
/// which the file is stored. For more information, see the STGFMT enumeration.
|
||||
/// The property set automatically contains code page and locale identifier (ID) properties. These are set to the current system
|
||||
/// default and the current user default, respectively.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>StgCreateStorageEx</c> creates the file if it does not exist. If it does exist, the use of the STGM_CREATE, STGM_CONVERT, and
|
||||
/// STGM_FAILIFTHERE flags in the grfMode parameter indicate how to proceed. For more information on these values, see STGM
|
||||
/// Constants. It is not valid, in direct mode, to specify the STGM_READ mode in the grfMode parameter (direct mode is indicated by
|
||||
/// not specifying the STGM_TRANSACTED flag). This function cannot be used to open an existing file; use the StgOpenStorageEx
|
||||
/// function instead.
|
||||
/// The grfFlags parameter is a combination of values taken from PROPSETFLAG Constants. The new enumeration value
|
||||
/// PROPSETFLAG_UNBUFFERED is supported. For more information, see <c>PROPSETFLAG Constants</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// You can use the <c>StgCreateStorageEx</c> function to get access to the root storage of a structured-storage document or the
|
||||
/// property set storage of any file that supports property sets. See the STGFMT documentation for information about which IIDs are
|
||||
/// supported for different <c>STGFMT</c> values.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When a file is created with this function to access the NTFS property set implementation, special sharing rules apply. For more
|
||||
/// information, see IPropertySetStorage-NTFS Implementation.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If a compound file is created in transacted mode (by specifying STGM_TRANSACTED) and read-only mode (by specifying STGM_READ), it
|
||||
/// is possible to make changes to the returned storage object. For example, it is possible to call IStorage::CreateStream. However,
|
||||
/// it is not possible to commit those changes by calling IStorage::Commit. Therefore, such changes will be lost.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Specifying STGM_SIMPLE provides a much faster implementation of a compound file object in a limited, but frequently used case
|
||||
/// involving applications that require a compound file implementation with multiple streams and no storages. For more information,
|
||||
/// see STGM Constants. It is not valid to specify that STGM_TRANSACTED if STGM_SIMPLE is specified.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The simple mode does not support all the methods on IStorage. Specifically, in simple mode, supported <c>IStorage</c> methods are
|
||||
/// CreateStream, Commit, and SetClass as well as the COM IUnknown methods of QueryInterface, AddRef and Release. In addition,
|
||||
/// SetElementTimes is supported with a <c>NULL</c> name, allowing applications to set times on a root storage. All the other methods
|
||||
/// of <c>IStorage</c> return STG_E_INVALIDFUNCTION.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the grfMode parameter specifies STGM_TRANSACTED and no file yet exists with the name specified by the pwcsName parameter, the
|
||||
/// file is created immediately. In an access-controlled file system, the caller must have write permissions for the file system
|
||||
/// directory in which the compound file is created. If STGM_TRANSACTED is not specified, and STGM_CREATE is specified, an existing
|
||||
/// file with the same name is destroyed before creating the new file.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// You can also use <c>StgCreateStorageEx</c> to create a temporary compound file by passing a <c>NULL</c> value for the pwcsName
|
||||
/// parameter. However, these files are temporary only in the sense that they have a unique system-provided name – one that is
|
||||
/// probably meaningless to the user. The caller is responsible for deleting the temporary file when finished with it, unless
|
||||
/// STGM_DELETEONRELEASE was specified for the grfMode parameter. For more information on these flags, see STGM Constants.
|
||||
/// This function is exported out of the redistributable Iprop.dll, which is included in Windows NT 4.0 with Service Pack 2 (SP2) and
|
||||
/// later and available as a redistributable in Windows 95, Windows 98 and later. In Windows 2000 and Windows XP, it is exported out
|
||||
/// of ole32.dll. It can also be exported out of iprop.dll in Windows 2000 and Windows XP, but the call gets forwarded to ole32.dll.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/coml2api/nf-coml2api-stgcreatestorageex HRESULT StgCreateStorageEx( const
|
||||
// WCHAR *pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS *pStgOptions, PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||
// REFIID riid, void **ppObjectOpen );
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/coml2api/nf-coml2api-stgcreatepropstg HRESULT StgCreatePropStg( IUnknown
|
||||
// *pUnk, REFFMTID fmtid, const CLSID *pclsid, DWORD grfFlags, DWORD dwReserved, IPropertyStorage **ppPropStg );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "6442977d-e980-419e-abe9-9d15dbb045c1")]
|
||||
public static extern HRESULT StgCreateStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt, FileFlagsAndAttributes grfAttrs, in STGOPTIONS pStgOptions,
|
||||
[Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "fc171888-3723-4894-a356-1b234352c4e8")]
|
||||
public static extern HRESULT StgCreatePropStg([In, MarshalAs(UnmanagedType.IUnknown)] object pUnk, in Guid fmtid, [In, Optional] IntPtr pclsid, PROPSETFLAG grfFlags, [Optional] uint dwReserved, out IPropertyStorage ppPropStg);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -932,8 +840,156 @@ public static partial class Ole32
|
|||
// REFIID riid, void **ppObjectOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "6442977d-e980-419e-abe9-9d15dbb045c1")]
|
||||
public static extern HRESULT StgCreateStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt, FileFlagsAndAttributes grfAttrs, [Optional] IntPtr pStgOptions,
|
||||
[Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
public static extern HRESULT StgCreateStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt,
|
||||
FileFlagsAndAttributes grfAttrs, in STGOPTIONS pStgOptions, [Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// The <c>StgCreateStorageEx</c> function creates a new storage object using a provided implementation for the IStorage or
|
||||
/// IPropertySetStorage interfaces. To open an existing file, use the StgOpenStorageEx function instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Applications written for Windows 2000, Windows Server 2003 and Windows XP must use <c>StgCreateStorageEx</c> rather than
|
||||
/// StgCreateDocfile to take advantage of the enhanced Windows 2000 and Windows XP Structured Storage features.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="pwcsName">
|
||||
/// <para>
|
||||
/// A pointer to the path of the file to create. It is passed uninterpreted to the file system. This can be a relative name or
|
||||
/// <c>NULL</c>. If <c>NULL</c>, a temporary file is allocated with a unique name. If non- <c>NULL</c>, the string size must not
|
||||
/// exceed MAX_PATH characters.
|
||||
/// </para>
|
||||
/// <para><c>Windows 2000:</c> Unlike the CreateFile function, you cannot exceed the MAX_PATH limit by using the "\?" prefix.</para>
|
||||
/// </param>
|
||||
/// <param name="grfMode">
|
||||
/// A value that specifies the access mode to use when opening the new storage object. For more information, see STGM Constants. If
|
||||
/// the caller specifies transacted mode together with STGM_CREATE or STGM_CONVERT, the overwrite or conversion takes place when the
|
||||
/// commit operation is called for the root storage. If IStorage::Commit is not called for the root storage object, previous contents
|
||||
/// of the file will be restored. STGM_CREATE and STGM_CONVERT cannot be combined with the STGM_NOSNAPSHOT flag, because a snapshot
|
||||
/// copy is required when a file is overwritten or converted in the transacted mode.
|
||||
/// </param>
|
||||
/// <param name="stgfmt">A value that specifies the storage file format. For more information, see the STGFMT enumeration.</param>
|
||||
/// <param name="grfAttrs">
|
||||
/// <para>A value that depends on the value of the stgfmt parameter.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Parameter Values</term>
|
||||
/// <term>Meaning</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>STGFMT_DOCFILE</term>
|
||||
/// <term>
|
||||
/// 0, or FILE_FLAG_NO_BUFFERING. For more information, see CreateFile. If the sector size of the file, specified in pStgOptions, is
|
||||
/// not an integer multiple of the underlying disk's physical sector size, this operation will fail.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>All other values of stgfmt</term>
|
||||
/// <term>Must be 0.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </param>
|
||||
/// <param name="pStgOptions">
|
||||
/// The pStgOptions parameter is valid only if the stgfmt parameter is set to STGFMT_DOCFILE. If the stgfmt parameter is set to
|
||||
/// STGFMT_DOCFILE, pStgOptions points to the STGOPTIONS structure, which specifies features of the storage object, such as the
|
||||
/// sector size. This parameter may be <c>NULL</c>, which creates a storage object with a default sector size of 512 bytes. If non-
|
||||
/// <c>NULL</c>, the <c>ulSectorSize</c> member must be set to either 512 or 4096. If set to 4096, STGM_SIMPLE may not be specified
|
||||
/// in the grfMode parameter. The <c>usVersion</c> member must be set before calling <c>StgCreateStorageEx</c>. For more information,
|
||||
/// see <c>STGOPTIONS</c>.
|
||||
/// </param>
|
||||
/// <param name="pSecurityDescriptor">
|
||||
/// <para>
|
||||
/// Enables the ACLs to be set when the file is created. If not <c>NULL</c>, needs to be a pointer to the SECURITY_ATTRIBUTES
|
||||
/// structure. See CreateFile for information on how to set ACLs on files.
|
||||
/// </para>
|
||||
/// <para><c>Windows Server 2003, Windows 2000 Server, Windows XP and Windows 2000 Professional:</c> Value must be <c>NULL</c>.</para>
|
||||
/// </param>
|
||||
/// <param name="riid">
|
||||
/// A value that specifies the interface identifier (IID) of the interface pointer to return. This IID may be for the IStorage
|
||||
/// interface or the IPropertySetStorage interface.
|
||||
/// </param>
|
||||
/// <param name="ppObjectOpen">
|
||||
/// A pointer to an interface pointer variable that receives a pointer for an interface on the new storage object; contains
|
||||
/// <c>NULL</c> if operation failed.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// This function can also return any file system errors or system errors wrapped in an <c>HRESULT</c>. For more information, see
|
||||
/// Error Handling Strategies and Handling Unknown Errors.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// When an application modifies its file, it usually creates a copy of the original. The <c>StgCreateStorageEx</c> function is one
|
||||
/// way for creating a copy. This function works indirectly with the Encrypting File System (EFS) duplication API. When you use this
|
||||
/// function, you will need to set the options for the file storage in the STGOPTIONS structure.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>StgCreateStorageEx</c> is a superset of the StgCreateDocfile function, and should be used by new code. Future enhancements to
|
||||
/// Structured Storage will be exposed through the <c>StgCreateStorageEx</c> function. See the following Requirements section for
|
||||
/// information on supported platforms.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The <c>StgCreateStorageEx</c> function creates a new storage object using one of the system-provided, structured-storage
|
||||
/// implementations. This function can be used to obtain an IStorage compound file implementation, an IPropertySetStorage compound
|
||||
/// file implementation, or to obtain an IPropertySetStorage NTFS implementation.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When a new file is created, the storage implementation used depends on the flag that you specify and on the type of drive on
|
||||
/// which the file is stored. For more information, see the STGFMT enumeration.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>StgCreateStorageEx</c> creates the file if it does not exist. If it does exist, the use of the STGM_CREATE, STGM_CONVERT, and
|
||||
/// STGM_FAILIFTHERE flags in the grfMode parameter indicate how to proceed. For more information on these values, see STGM
|
||||
/// Constants. It is not valid, in direct mode, to specify the STGM_READ mode in the grfMode parameter (direct mode is indicated by
|
||||
/// not specifying the STGM_TRANSACTED flag). This function cannot be used to open an existing file; use the StgOpenStorageEx
|
||||
/// function instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// You can use the <c>StgCreateStorageEx</c> function to get access to the root storage of a structured-storage document or the
|
||||
/// property set storage of any file that supports property sets. See the STGFMT documentation for information about which IIDs are
|
||||
/// supported for different <c>STGFMT</c> values.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When a file is created with this function to access the NTFS property set implementation, special sharing rules apply. For more
|
||||
/// information, see IPropertySetStorage-NTFS Implementation.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If a compound file is created in transacted mode (by specifying STGM_TRANSACTED) and read-only mode (by specifying STGM_READ), it
|
||||
/// is possible to make changes to the returned storage object. For example, it is possible to call IStorage::CreateStream. However,
|
||||
/// it is not possible to commit those changes by calling IStorage::Commit. Therefore, such changes will be lost.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Specifying STGM_SIMPLE provides a much faster implementation of a compound file object in a limited, but frequently used case
|
||||
/// involving applications that require a compound file implementation with multiple streams and no storages. For more information,
|
||||
/// see STGM Constants. It is not valid to specify that STGM_TRANSACTED if STGM_SIMPLE is specified.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The simple mode does not support all the methods on IStorage. Specifically, in simple mode, supported <c>IStorage</c> methods are
|
||||
/// CreateStream, Commit, and SetClass as well as the COM IUnknown methods of QueryInterface, AddRef and Release. In addition,
|
||||
/// SetElementTimes is supported with a <c>NULL</c> name, allowing applications to set times on a root storage. All the other methods
|
||||
/// of <c>IStorage</c> return STG_E_INVALIDFUNCTION.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the grfMode parameter specifies STGM_TRANSACTED and no file yet exists with the name specified by the pwcsName parameter, the
|
||||
/// file is created immediately. In an access-controlled file system, the caller must have write permissions for the file system
|
||||
/// directory in which the compound file is created. If STGM_TRANSACTED is not specified, and STGM_CREATE is specified, an existing
|
||||
/// file with the same name is destroyed before creating the new file.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// You can also use <c>StgCreateStorageEx</c> to create a temporary compound file by passing a <c>NULL</c> value for the pwcsName
|
||||
/// parameter. However, these files are temporary only in the sense that they have a unique system-provided name – one that is
|
||||
/// probably meaningless to the user. The caller is responsible for deleting the temporary file when finished with it, unless
|
||||
/// STGM_DELETEONRELEASE was specified for the grfMode parameter. For more information on these flags, see STGM Constants.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/coml2api/nf-coml2api-stgcreatestorageex HRESULT StgCreateStorageEx( const
|
||||
// WCHAR *pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS *pStgOptions, PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||
// REFIID riid, void **ppObjectOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "6442977d-e980-419e-abe9-9d15dbb045c1")]
|
||||
public static extern HRESULT StgCreateStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt,
|
||||
FileFlagsAndAttributes grfAttrs, [Optional] IntPtr pStgOptions, [Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
|
||||
/// <summary>The <c>StgIsStorageFile</c> function indicates whether a particular disk file contains a storage object.</summary>
|
||||
/// <param name="pwcsName">
|
||||
|
@ -1119,7 +1175,8 @@ public static partial class Ole32
|
|||
// *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "5ff18dc8-b24f-42bb-8c32-efc4d3696687")]
|
||||
public static extern HRESULT StgOpenStorage([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, [In, Optional] IStorage pstgPriority, STGM grfMode, SNB snbExclude, [Optional] uint reserved, out IStorage ppstgOpen);
|
||||
public static extern HRESULT StgOpenStorage([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, [In, Optional] IStorage? pstgPriority,
|
||||
STGM grfMode, [Optional] SNB? snbExclude, [Optional] uint reserved, out IStorage ppstgOpen);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -1241,8 +1298,9 @@ public static partial class Ole32
|
|||
// riid, void **ppObjectOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "4f2138fb-1f80-4345-a3cb-9c11023457b1")]
|
||||
public static extern HRESULT StgOpenStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt, FileFlagsAndAttributes grfAttrs, in STGOPTIONS pStgOptions,
|
||||
[Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
public static extern HRESULT StgOpenStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt,
|
||||
FileFlagsAndAttributes grfAttrs, in STGOPTIONS pStgOptions, [Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -1364,8 +1422,9 @@ public static partial class Ole32
|
|||
// riid, void **ppObjectOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "4f2138fb-1f80-4345-a3cb-9c11023457b1")]
|
||||
public static extern HRESULT StgOpenStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt, FileFlagsAndAttributes grfAttrs, [Optional] IntPtr pStgOptions,
|
||||
[Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
public static extern HRESULT StgOpenStorageEx([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsName, STGM grfMode, STGFMT stgfmt,
|
||||
FileFlagsAndAttributes grfAttrs, [Optional] IntPtr pStgOptions, [Optional] PSECURITY_DESCRIPTOR pSecurityDescriptor, in Guid riid,
|
||||
[MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 6)] out object ppObjectOpen);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>StgOpenStorageOnILockBytes</c> function opens an existing storage object that does not reside in a disk file, but instead
|
||||
|
@ -1431,7 +1490,8 @@ public static partial class Ole32
|
|||
// **ppstgOpen );
|
||||
[DllImport(Lib.Ole32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("coml2api.h", MSDNShortId = "7920bd46-0a8f-42e0-9988-59d85edb64e2")]
|
||||
public static extern HRESULT StgOpenStorageOnILockBytes([In] ILockBytes plkbyt, [In, Optional] IStorage pstgPriority, STGM grfMode, SNB snbExclude, [Optional] uint reserved, out IStorage ppstgOpen);
|
||||
public static extern HRESULT StgOpenStorageOnILockBytes([In] ILockBytes plkbyt, [In, Optional] IStorage? pstgPriority, STGM grfMode,
|
||||
SNB? snbExclude, [Optional] uint reserved, out IStorage ppstgOpen);
|
||||
|
||||
/// <summary>
|
||||
/// The <c>StgSetTimes</c> function sets the creation, access, and modification times of the indicated file, if supported by the
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using Vanara.Extensions;
|
||||
using Vanara.InteropServices;
|
||||
using DISPPARAMS = System.Runtime.InteropServices.ComTypes.DISPPARAMS;
|
||||
using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
|
||||
using FUNCDESC = System.Runtime.InteropServices.ComTypes.FUNCDESC;
|
||||
|
@ -3592,7 +3596,222 @@ public static partial class OleAut32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oaidl/nf-oaidl-idispatch-invoke HRESULT Invoke(DISPID dispIdMember, REFIID
|
||||
// riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
||||
[System.Security.SecurityCritical]
|
||||
void Invoke(int dispIdMember, [Optional] in Guid riid, LCID lcid, INVOKEKIND wFlags, ref DISPPARAMS pDispParams, [Optional] IntPtr pVarResult, [Optional] IntPtr pExcepInfo, [Optional] IntPtr puArgErr);
|
||||
void Invoke(int dispIdMember, [Optional] in Guid riid, LCID lcid, ushort wFlags, ref DISPPARAMS pDispParams, out object? pVarResult,
|
||||
out EXCEPINFO pExcepInfo, out uint puArgErr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used on
|
||||
/// subsequent calls to Invoke. The dispatch function DispGetIDsOfNames provides a standard implementation of <c>GetIDsOfNames</c>.
|
||||
/// </summary>
|
||||
/// <param name="source">The IDispatch source object.</param>
|
||||
/// <param name="names">The array of names to be mapped.</param>
|
||||
/// <returns>
|
||||
/// An array, each element of which contains an identifier (ID) corresponding to one of the names passed in the
|
||||
/// <paramref name="names" /> array. The first element represents the member name. The subsequent elements represent each of the member's parameters.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// An IDispatch implementation can associate any positive integer ID value with a given name. Zero is reserved for the default,
|
||||
/// or <c>Value</c> property; –1 is reserved to indicate an unknown name; and other negative values are defined for other
|
||||
/// purposes. For example, if <c>GetIDsOfNames</c> is called, and the implementation does not recognize one or more of the
|
||||
/// names, it returns DISP_E_UNKNOWNNAME, and the rgDispId array contains DISPID_UNKNOWN for the entries that correspond to the
|
||||
/// unknown names.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The member and parameter DISPIDs must remain constant for the lifetime of the object. This allows a client to obtain the
|
||||
/// DISPIDs once, and cache them for later use.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When <c>GetIDsOfNames</c> is called with more than one name, the first name (rgszNames[0]) corresponds to the member name,
|
||||
/// and subsequent names correspond to the names of the member's parameters.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The same name may map to different DISPIDs, depending on context. For example, a name may have a DISPID when it is used as a
|
||||
/// member name with a particular interface, a different ID as a member of a different interface, and different mapping for each
|
||||
/// time it appears as a parameter.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>GetIDsOfNames</c> is used when an IDispatch client binds to names at run time. To bind at compile time instead, an
|
||||
/// <c>IDispatch</c> client can map names to DISPIDs by using the type information interfaces described in Type Description
|
||||
/// Interfaces. This allows a client to bind to members at compile time and avoid calling <c>GetIDsOfNames</c> at run time. For
|
||||
/// a description of binding at compile time, see Type Description Interfaces.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The implementation of <c>GetIDsOfNames</c> is case insensitive. Users that need case-sensitive name mapping should use type
|
||||
/// information interfaces to map names to DISPIDs, rather than call <c>GetIDsOfNames</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>Caution</c> You cannot use this method to access values that have been added dynamically, such as values added through
|
||||
/// JavaScript. Instead, use the GetDispID of the IDispatchEx interface. For more information, see the IDispatchEx interface.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static int[] GetIDsOfNames(this IDispatch source, params string[] names)
|
||||
{
|
||||
if (source is null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
if (names is null || names.Any(s => string.IsNullOrEmpty(s)))
|
||||
throw new ArgumentNullException(nameof(names));
|
||||
var ids = new int[names.Length];
|
||||
source.GetIDsOfNames(Guid.Empty, names, (uint)names.Length, LCID.LOCALE_SYSTEM_DEFAULT, ids);
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used on subsequent
|
||||
/// calls to Invoke. The dispatch function DispGetIDsOfNames provides a standard implementation of <c>GetIDsOfNames</c>.
|
||||
/// </summary>
|
||||
/// <param name="source">The IDispatch source object.</param>
|
||||
/// <param name="name">The name to be mapped.</param>
|
||||
/// <returns>An identifier (ID) corresponding to the name passed in <paramref name="name"/>.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// An IDispatch implementation can associate any positive integer ID value with a given name. Zero is reserved for the default, or
|
||||
/// <c>Value</c> property; –1 is reserved to indicate an unknown name; and other negative values are defined for other purposes. For
|
||||
/// example, if <c>GetIDsOfNames</c> is called, and the implementation does not recognize one or more of the names, it returns
|
||||
/// DISP_E_UNKNOWNNAME, and the rgDispId array contains DISPID_UNKNOWN for the entries that correspond to the unknown names.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The member and parameter DISPIDs must remain constant for the lifetime of the object. This allows a client to obtain the DISPIDs
|
||||
/// once, and cache them for later use.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When <c>GetIDsOfNames</c> is called with more than one name, the first name (rgszNames[0]) corresponds to the member name, and
|
||||
/// subsequent names correspond to the names of the member's parameters.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The same name may map to different DISPIDs, depending on context. For example, a name may have a DISPID when it is used as a member
|
||||
/// name with a particular interface, a different ID as a member of a different interface, and different mapping for each time it appears
|
||||
/// as a parameter.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>GetIDsOfNames</c> is used when an IDispatch client binds to names at run time. To bind at compile time instead, an
|
||||
/// <c>IDispatch</c> client can map names to DISPIDs by using the type information interfaces described in Type Description Interfaces.
|
||||
/// This allows a client to bind to members at compile time and avoid calling <c>GetIDsOfNames</c> at run time. For a description of
|
||||
/// binding at compile time, see Type Description Interfaces.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The implementation of <c>GetIDsOfNames</c> is case insensitive. Users that need case-sensitive name mapping should use type
|
||||
/// information interfaces to map names to DISPIDs, rather than call <c>GetIDsOfNames</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <c>Caution</c> You cannot use this method to access values that have been added dynamically, such as values added through JavaScript.
|
||||
/// Instead, use the GetDispID of the IDispatchEx interface. For more information, see the IDispatchEx interface.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static int GetID(this IDispatch source, string name) => GetIDsOfNames(source, new[] { name })[0];
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to properties and methods exposed by an object. The dispatch function DispInvoke provides a standard implementation
|
||||
/// of <c>Invoke</c>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The expected return type.</typeparam>
|
||||
/// <param name="source">The IDispatch source object.</param>
|
||||
/// <param name="invokeFlags">
|
||||
/// <para>Flags describing the context of the <c>Invoke</c> call.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Value</term>
|
||||
/// <term>Meaning</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>DISPATCH_METHOD</term>
|
||||
/// <term>The member is invoked as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag can be set.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>DISPATCH_PROPERTYGET</term>
|
||||
/// <term>The member is retrieved as a property or data member.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>DISPATCH_PROPERTYPUT</term>
|
||||
/// <term>The member is changed as a property or data member.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>DISPATCH_PROPERTYPUTREF</term>
|
||||
/// <term>
|
||||
/// The member is changed by a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a
|
||||
/// reference to an object.
|
||||
/// </term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </param>
|
||||
/// <param name="dispId">Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier.</param>
|
||||
/// <param name="args">An array of arguments.</param>
|
||||
/// <returns>
|
||||
/// Pointer to the location where the result is to be stored, or NULL if the caller expects no result. This argument is ignored if
|
||||
/// DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF is specified.
|
||||
/// </returns>
|
||||
/// <exception cref="System.ArgumentNullException">source</exception>
|
||||
/// <exception cref="System.ArgumentException">
|
||||
/// Unable to cast source to IDispatch - source or At least one argument must be specified for DISPATCH_PROPERTYPUT
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Generally, you should not implement <c>Invoke</c> directly. Instead, use the dispatch interface to create functions CreateStdDispatch
|
||||
/// and DispInvoke. For details, refer to <c>CreateStdDispatch</c>, <c>DispInvoke</c>, Creating the IDispatch Interface and Exposing
|
||||
/// ActiveX Objects.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If some application-specific processing needs to be performed before calling a member, the code should perform the necessary actions,
|
||||
/// and then call ITypeInfo::Invoke to invoke the member. <c>ITypeInfo::Invoke</c> acts exactly like <c>Invoke</c>. The standard
|
||||
/// implementations of <c>Invoke</c> created by <c>CreateStdDispatch</c> and <c>DispInvoke</c> defer to <c>ITypeInfo::Invoke</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// In an ActiveX client, <c>Invoke</c> should be used to get and set the values of properties, or to call a method of an ActiveX object.
|
||||
/// The dispIdMember argument identifies the member to invoke. The DISPIDs that identify members are defined by the implementor of the
|
||||
/// object and can be determined by using the object's documentation, the IDispatch::GetIDsOfNames function, or the ITypeInfo interface.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When you use <c>IDispatch::Invoke()</c> with DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF, you have to specially initialize the
|
||||
/// <c>cNamedArgs</c> and <c>rgdispidNamedArgs</c> elements of your DISPPARAMS structure with the following:
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The information that follows addresses developers of ActiveX clients and others who use code to expose ActiveX objects. It describes
|
||||
/// the behavior that users of exposed objects should expect.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static T? Invoke<T>(this IDispatch source, INVOKEKIND invokeFlags, int dispId, params object[] args)
|
||||
{
|
||||
if (source is null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
args ??= new object[0];
|
||||
|
||||
DISPPARAMS dp = default;
|
||||
if (invokeFlags == INVOKEKIND.INVOKE_PROPERTYPUT)
|
||||
{
|
||||
// There must be at least one argument specified; only one if it is a non-indexed property and
|
||||
// multiple if there are index values as well as the value to set to
|
||||
if (args.Length < 1)
|
||||
throw new ArgumentException("At least one argument must be specified for DISPATCH_PROPERTYPUT");
|
||||
|
||||
dp.cNamedArgs = 1;
|
||||
dp.rgdispidNamedArgs = dispId.MarshalToPtr(Marshal.AllocCoTaskMem, out _);
|
||||
}
|
||||
|
||||
// Convert parameters to VARIANTs in reverse order and store in array.
|
||||
if (args.Length > 0)
|
||||
{
|
||||
dp.rgvarg = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(VARIANT)) * args.Length);
|
||||
dp.cArgs = args.Length;
|
||||
unsafe
|
||||
{
|
||||
VARIANT* ptr = (VARIANT*)dp.rgvarg;
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
Marshal.GetNativeVariantForObject(args[args.Length - 1 - i], (IntPtr)(void*)&ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Call Invoke and clean up allocated memory
|
||||
try
|
||||
{
|
||||
source.Invoke(dispId, Guid.Empty, LCID.LOCALE_SYSTEM_DEFAULT, (ushort)invokeFlags, ref dp, out var result, out _, out _);
|
||||
return (T?)result;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeCoTaskMem(dp.rgvarg);
|
||||
Marshal.FreeCoTaskMem(dp.rgdispidNamedArgs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Provides detailed contextual error information.</summary>
|
||||
|
@ -3706,7 +3925,7 @@ public static partial class OleAut32
|
|||
/// Errors are logged in the error log that is pointed to by pErrorLog. When pVar->vt specifies another object pointer
|
||||
/// (VT_UNKNOWN), the property bag is responsible for creating and initializing the object described by pszPropName.
|
||||
/// </remarks>
|
||||
void Read([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropName, [In, Out] ref object pVar, [In] IErrorLog pErrorLog);
|
||||
void Read([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropName, [In, Out, MarshalAs(UnmanagedType.Struct)] ref object pVar, [In] IErrorLog? pErrorLog);
|
||||
|
||||
/// <summary>Tells the property bag to save the named property in a caller-initialized VARIANT.</summary>
|
||||
/// <param name="pszPropName">The address of a string containing the name of the property to write. This cannot be NULL.</param>
|
||||
|
@ -3728,7 +3947,7 @@ public static partial class OleAut32
|
|||
/// specific location. This avoids potential extra copy operations that might be involved with other property-based persistence mechanisms.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
void Write([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropName, in object pVar);
|
||||
void Write([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropName, [MarshalAs(UnmanagedType.Struct)] in object pVar);
|
||||
}
|
||||
|
||||
/// <summary>Provides an object with a property bag in which the object can save its properties persistently.</summary>
|
||||
|
@ -3792,8 +4011,9 @@ public static partial class OleAut32
|
|||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768194%28v%3dvs.85%29
|
||||
// HRESULT retVal = object.Read(cProperties, pPropBag, pErrLog, pvarValue, phrError);
|
||||
void Read(uint cProperties, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPBAG2[] pPropBag, [Optional] IErrorLog pErrLog,
|
||||
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] object[] pvarValue, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] HRESULT[] phrError);
|
||||
void Read(uint cProperties, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPBAG2[] pPropBag, [Optional] IErrorLog? pErrLog,
|
||||
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0, ArraySubType = UnmanagedType.Struct)] object[] pvarValue,
|
||||
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] HRESULT[] phrError);
|
||||
|
||||
/// <summary>Causes one or more properties to be saved into the property bag.</summary>
|
||||
/// <param name="cProperties">
|
||||
|
@ -3817,7 +4037,8 @@ public static partial class OleAut32
|
|||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768195(v=vs.85)
|
||||
// HRESULT retVal = object.Write(cProperties, pPropBag, pvarValue);
|
||||
void Write(uint cProperties, PROPBAG2[] pPropBag, VARIANT[] pvarValue);
|
||||
void Write(uint cProperties, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PROPBAG2[] pPropBag,
|
||||
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0, ArraySubType = UnmanagedType.Struct)] object[] pvarValue);
|
||||
|
||||
/// <summary>Gets the number of properties in the property bag.</summary>
|
||||
/// <returns>
|
||||
|
@ -3860,7 +4081,7 @@ public static partial class OleAut32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768191(v=vs.85)
|
||||
// HRESULT retVal = object.GetPropertyInfo(iProperty, cProperties, pPropBag, pcProperties);
|
||||
void GetPropertyInfo( uint iProperty, uint cProperties, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] PROPBAG2[] pPropBag, out uint pcProperties);
|
||||
void GetPropertyInfo(uint iProperty, uint cProperties, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] PROPBAG2[] pPropBag, out uint pcProperties);
|
||||
|
||||
/// <summary>
|
||||
/// Causes the property bag to instruct a property object that was previously created and initialized to read its persistent properties.
|
||||
|
@ -3904,7 +4125,7 @@ public static partial class OleAut32
|
|||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768193(v=vs.85)
|
||||
// HRESULT retVal = object.LoadObject(pstrName, dwHint, pUnkObject, pErrLog);
|
||||
void LoadObject([MarshalAs(UnmanagedType.LPWStr)] string pstrName, uint dwHint, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkObject, [Optional] IErrorLog pErrLog);
|
||||
void LoadObject([MarshalAs(UnmanagedType.LPWStr)] string pstrName, uint dwHint, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkObject, [Optional] IErrorLog? pErrLog);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -4083,7 +4304,7 @@ public static partial class OleAut32
|
|||
/// <para>The pointer to the variant.</para>
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/oaidl/nf-oaidl-irecordinfo-putfield
|
||||
void PutField(uint wFlags, IntPtr pvData, [MarshalAs(UnmanagedType.LPWStr)] string szFieldName, [In, MarshalAs(UnmanagedType.Struct)] ref object pvarField);
|
||||
void PutField(INVOKEKIND wFlags, IntPtr pvData, [MarshalAs(UnmanagedType.LPWStr)] string szFieldName, [In, MarshalAs(UnmanagedType.Struct)] in object pvarField);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -4105,7 +4326,7 @@ public static partial class OleAut32
|
|||
/// <para>The variant to be put into the field.</para>
|
||||
/// </param>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/oaidl/nf-oaidl-irecordinfo-putfieldnocopy
|
||||
void PutFieldNoCopy(uint wFlags, IntPtr pvData, [MarshalAs(UnmanagedType.LPWStr)] string szFieldName, [In, MarshalAs(UnmanagedType.Struct)] ref object pvarField);
|
||||
void PutFieldNoCopy(INVOKEKIND wFlags, IntPtr pvData, [MarshalAs(UnmanagedType.LPWStr)] string szFieldName, [In, MarshalAs(UnmanagedType.Struct)] in object pvarField);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the names of the fields of the record.</para>
|
||||
|
@ -4130,7 +4351,7 @@ public static partial class OleAut32
|
|||
/// <para>In case of out of memory, pcNames points to error code.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/oaidl/nf-oaidl-irecordinfo-getfieldnames
|
||||
void GetFieldNames(ref uint pcNames, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.BStr, SizeParamIndex = 0)] string[] rgBstrNames);
|
||||
void GetFieldNames(ref uint pcNames, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.BStr, SizeParamIndex = 0)] string[]? rgBstrNames);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Determines whether the record that is passed in matches that of the current record information.</para>
|
||||
|
@ -4155,7 +4376,9 @@ public static partial class OleAut32
|
|||
/// </list>
|
||||
/// </returns>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/oaidl/nf-oaidl-irecordinfo-ismatchingtype
|
||||
[PreserveSig] [return: MarshalAs(UnmanagedType.Bool)] bool IsMatchingType([In] IRecordInfo pRecordInfo);
|
||||
[PreserveSig]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
bool IsMatchingType([In] IRecordInfo pRecordInfo);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Allocates memory for a new record, initializes the instance and returns a pointer to the record.</para>
|
||||
|
@ -4302,7 +4525,7 @@ public static partial class OleAut32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oaidl/nf-oaidl-itypechangeevents-requesttypechange HRESULT
|
||||
// RequestTypeChange( CHANGEKIND changeKind, ITypeInfo *pTInfoBefore, LPOLESTR pStrName, INT *pfCancel );
|
||||
[PreserveSig]
|
||||
HRESULT RequestTypeChange([In] CHANGEKIND changeKind, [In] ITypeInfo pTInfoBefore, [MarshalAs(UnmanagedType.LPWStr)] string pStrName, out int pfCancel);
|
||||
HRESULT RequestTypeChange([In] CHANGEKIND changeKind, [In] ITypeInfo pTInfoBefore, [MarshalAs(UnmanagedType.LPWStr)] string? pStrName, out bool pfCancel);
|
||||
|
||||
/// <summary>Raised after a type has been changed.</summary>
|
||||
/// <param name="changeKind">
|
||||
|
@ -4344,6 +4567,6 @@ public static partial class OleAut32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/oaidl/nf-oaidl-itypechangeevents-aftertypechange HRESULT AfterTypeChange(
|
||||
// CHANGEKIND changeKind, ITypeInfo *pTInfoAfter, LPOLESTR pStrName );
|
||||
[PreserveSig]
|
||||
HRESULT AfterTypeChange([In] CHANGEKIND changeKind, [In] ITypeInfo pTInfoAfter, [MarshalAs(UnmanagedType.LPWStr)] string pStrName);
|
||||
HRESULT AfterTypeChange([In] CHANGEKIND changeKind, [In] ITypeInfo pTInfoAfter, [MarshalAs(UnmanagedType.LPWStr)] string? pStrName);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using static Vanara.PInvoke.Ole32;
|
||||
|
||||
namespace Vanara.PInvoke;
|
||||
|
@ -2363,6 +2364,59 @@ public static partial class OleAut32
|
|||
[PInvokeData("oleauto.h", MSDNShortId = "5d9be6cd-92e5-485c-ba0d-8630d3e414b8")]
|
||||
public static extern HRESULT VariantCopyInd(out VARIANT pvarDest, in VARIANT pvargSrc);
|
||||
|
||||
/// <summary>
|
||||
/// Frees the destination variant and makes a copy of the source variant, performing the necessary indirection if the source is
|
||||
/// specified to be VT_BYREF.
|
||||
/// </summary>
|
||||
/// <param name="pvarDest">The destination variant.</param>
|
||||
/// <param name="pvargSrc">The source variant.</param>
|
||||
/// <returns>
|
||||
/// <para>This function can return one of these values.</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Return code</term>
|
||||
/// <term>Description</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>S_OK</term>
|
||||
/// <term>Success.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>DISP_E_ARRAYISLOCKED</term>
|
||||
/// <term>The variant contains an array that is locked.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>DISP_E_BADVARTYPE</term>
|
||||
/// <term>The variant type is not a valid type of variant.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>E_INVALIDARG</term>
|
||||
/// <term>One of the arguments is not valid.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>E_OUTOFMEMORY</term>
|
||||
/// <term>Insufficient memory to complete the operation.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This function is useful when a copy of a variant is needed, and to guarantee that it is not VT_BYREF, such as when handling
|
||||
/// arguments in an implementation of IDispatch::Invoke.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// For example, if the source is a (VT_BYREF | VT_I2), the destination will be a BYVAL | VT_I2. The same is true for all legal
|
||||
/// VT_BYREF combinations, including VT_VARIANT.
|
||||
/// </para>
|
||||
/// <para>If pvargSrc is (VT_BYREF | VT_VARIANT), and the contained variant is VT_BYREF, the contained variant is also dereferenced.</para>
|
||||
/// <para>This function frees any existing contents of pvarDest.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-variantcopyind HRESULT VariantCopyInd( VARIANT *pvarDest,
|
||||
// const VARIANTARG *pvargSrc );
|
||||
[DllImport(Lib.OleAut32, SetLastError = false, ExactSpelling = true)]
|
||||
[PInvokeData("oleauto.h", MSDNShortId = "5d9be6cd-92e5-485c-ba0d-8630d3e414b8")]
|
||||
public static extern HRESULT VariantCopyInd(out VARIANT pvarDest, [In] object pvargSrc);
|
||||
|
||||
/// <summary>Initializes a variant.</summary>
|
||||
/// <param name="pvarg">The variant to initialize.</param>
|
||||
/// <returns>This function does not return a value.</returns>
|
||||
|
@ -3066,5 +3120,13 @@ public static partial class OleAut32
|
|||
private readonly IntPtr _record;
|
||||
private readonly IntPtr _recordInfo;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="VARIANT"/> struct.</summary>
|
||||
/// <param name="o">An object value.</param>
|
||||
public VARIANT(object o)
|
||||
{
|
||||
VariantCopyInd(out var v, o).ThrowIfFailed();
|
||||
this = v;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Vanara.Extensions;
|
||||
using Vanara.InteropServices;
|
||||
|
@ -456,7 +460,7 @@ public static partial class OleAut32
|
|||
public IntPtr prgCustData;
|
||||
|
||||
/// <summary>Gets the array of <see cref="CUSTDATAITEM"/> structures.</summary>
|
||||
public CUSTDATAITEM[] Items => prgCustData.ToArray<CUSTDATAITEM>((int)cCustData);
|
||||
public CUSTDATAITEM[] Items => prgCustData.ToArray<CUSTDATAITEM>((int)cCustData) ?? new CUSTDATAITEM[0];
|
||||
}
|
||||
|
||||
/// <summary>Represents a custom data item.</summary>
|
||||
|
|
|
@ -1794,7 +1794,7 @@ public static partial class OleAut32
|
|||
public static extern HRESULT SafeArrayUnlock(SafeSAFEARRAY psa);
|
||||
|
||||
/// <summary>Represents a safe array.</summary>
|
||||
/// <seealso cref="System.IDisposable"/>
|
||||
/// <seealso cref="IDisposable"/>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
[PInvokeData("OaIdl.h", MSDNShortId = "ms221482")]
|
||||
public struct SAFEARRAY
|
||||
|
@ -1852,7 +1852,7 @@ public static partial class OleAut32
|
|||
///}
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="System.IDisposable"/>
|
||||
/// <seealso cref="IDisposable"/>
|
||||
[PInvokeData("OleAuto.h")]
|
||||
public class SafeArrayScopedAccessData : IDisposable
|
||||
{
|
||||
|
@ -1883,7 +1883,7 @@ public static partial class OleAut32
|
|||
}
|
||||
|
||||
/// <summary>Provides a safe handle for items created with <see cref="SafeArrayAllocDescriptor"/>.</summary>
|
||||
/// <seealso cref="Vanara.PInvoke.OleAut32.SafeSAFEARRAY"/>
|
||||
/// <seealso cref="SafeSAFEARRAY"/>
|
||||
public class SafeDescriptorSAFEARRAY : SafeSAFEARRAY
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="SafeDescriptorSAFEARRAY"/> class and assigns an existing handle.</summary>
|
||||
|
|
|
@ -1999,7 +1999,7 @@ public static partial class OleAut32
|
|||
public ushort wFlags;
|
||||
|
||||
/// <summary>The return type for the method.</summary>
|
||||
public Ole32.VARTYPE vtReturn;
|
||||
public VARTYPE vtReturn;
|
||||
}
|
||||
|
||||
/// <summary>Specifies numeric parsing information.</summary>
|
||||
|
@ -2077,7 +2077,7 @@ public static partial class OleAut32
|
|||
public StrPtrUni szName;
|
||||
|
||||
/// <summary>The parameter type. If more than one parameter type is accepted, VT_VARIANT should be specified.</summary>
|
||||
public Ole32.VARTYPE vt;
|
||||
public VARTYPE vt;
|
||||
}
|
||||
|
||||
/// <summary>Represents an unpacked date.</summary>
|
||||
|
|
|
@ -19,7 +19,7 @@ public static partial class OleAut32
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/wia_xp/ns-wia_xp-wia_propid_to_name typedef struct _WIA_PROPID_TO_NAME {
|
||||
// PROPID propid; LPOLESTR pszName; } WIA_PROPID_TO_NAME, *PWIA_PROPID_TO_NAME;
|
||||
[PInvokeData("wia_xp.h")]
|
||||
public static Dictionary<WIA_PROPID, string> WIA_PROPID_TO_NAME = new Dictionary<WIA_PROPID, string>
|
||||
public static Dictionary<WIA_PROPID, string> WIA_PROPID_TO_NAME = new()
|
||||
{
|
||||
{ WIA_PROPID.WIA_DIP_BAUDRATE , "BaudRate" },
|
||||
{ WIA_PROPID.WIA_DIP_DEV_DESC , "Description" },
|
||||
|
|
|
@ -35,7 +35,7 @@ public static partial class PropSys
|
|||
}
|
||||
|
||||
/// <summary>Exposes a method that encapsulates a change to a single property.</summary>
|
||||
/// <seealso cref="Vanara.PInvoke.PropSys.IObjectWithPropertyKey"/>
|
||||
/// <seealso cref="IObjectWithPropertyKey"/>
|
||||
[PInvokeData("Propsys.h", MSDNShortId = "bb775244")]
|
||||
[ComImport, Guid("f917bc8a-1bba-4478-a245-1bde03eb9431"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface IPropertyChange : IObjectWithPropertyKey
|
||||
|
|
|
@ -556,7 +556,7 @@ public static partial class PropSys
|
|||
/// <summary>
|
||||
/// Exposes a method to create a specified IPropertyStore object in circumstances where property access is potentially slow.
|
||||
/// </summary>
|
||||
/// <seealso cref="Vanara.PInvoke.PropSys.IPropertyStoreFactory"/>
|
||||
/// <seealso cref="IPropertyStoreFactory"/>
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nn-propsys-idelayedpropertystorefactory
|
||||
[PInvokeData("propsys.h", MSDNShortId = "855c9f10-9f40-4c60-a669-551fa51133f5")]
|
||||
[ComImport, Guid("40d4577f-e237-4bdb-bd69-58f089431b6a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
|
@ -1168,7 +1168,7 @@ public static partial class PropSys
|
|||
}
|
||||
|
||||
/// <summary>Exposes methods that extract data from enumeration information. IPropertyEnumType2 extends IPropertyEnumType.</summary>
|
||||
/// <seealso cref="Vanara.PInvoke.PropSys.IPropertyEnumType"/>
|
||||
/// <seealso cref="IPropertyEnumType"/>
|
||||
[ComImport, Guid("9b6e051c-5ddd-4321-9070-fe2acb55e794"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
[PInvokeData("Propsys.h")]
|
||||
public interface IPropertyEnumType2 : IPropertyEnumType
|
||||
|
@ -2156,7 +2156,7 @@ public static class PSExtensions
|
|||
/// <summary>Enumerates the keys of a property store.</summary>
|
||||
/// <param name="ps">The <see cref="PropSys.IPropertyStore"/> instance used to retrieve the keys.</param>
|
||||
/// <returns>A sequence of keys found in the property store.</returns>
|
||||
public static System.Collections.Generic.IEnumerable<PROPERTYKEY> EnumKeys(this PropSys.IPropertyStore ps)
|
||||
public static IEnumerable<PROPERTYKEY> EnumKeys(this PropSys.IPropertyStore ps)
|
||||
{
|
||||
for (var i = 0U; i < ps.GetCount(); i++)
|
||||
yield return ps.GetAt(i);
|
||||
|
|
|
@ -130,8 +130,7 @@ public static class TestCaseSources
|
|||
if (first)
|
||||
{
|
||||
hdr = items;
|
||||
if (cols is null)
|
||||
cols = items;
|
||||
cols ??= items;
|
||||
idxs = cols.Select(s => Array.IndexOf(items, s)).ToArray();
|
||||
first = false;
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue