From ff5d0acb2a49ccf0e87c0f9e228ce9d4de090196 Mon Sep 17 00:00:00 2001 From: David Hall Date: Tue, 20 Dec 2022 15:03:19 -0700 Subject: [PATCH] Added missing parameter attributes --- PInvoke/Ole/Ole32/Ole2.cs | 2 +- PInvoke/Shell32/ShlObj.cs | 37 ++++++++++++++++--------------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/PInvoke/Ole/Ole32/Ole2.cs b/PInvoke/Ole/Ole32/Ole2.cs index 792fdc81..950640c8 100644 --- a/PInvoke/Ole/Ole32/Ole2.cs +++ b/PInvoke/Ole/Ole32/Ole2.cs @@ -3139,7 +3139,7 @@ namespace Vanara.PInvoke // 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] IDataObject pDataObj); + public static extern HRESULT OleSetClipboard([In, Optional] IDataObject pDataObj); /// /// Notifies an object that it is embedded in an OLE container, which ensures that reference counting is done correctly for diff --git a/PInvoke/Shell32/ShlObj.cs b/PInvoke/Shell32/ShlObj.cs index 373cdd8a..f2233fdf 100644 --- a/PInvoke/Shell32/ShlObj.cs +++ b/PInvoke/Shell32/ShlObj.cs @@ -4030,16 +4030,14 @@ namespace Vanara.PInvoke [PInvokeData("shlobj.h", MSDNShortId = "170afefc-b4de-4661-9c12-1341656b0fdb")] public static extern void SHChangeNotifyRegisterThread(SCNRT_STATUS status); - /// - /// Creates a data object in a parent folder. - /// + /// Creates a data object in a parent folder. /// /// Type: PCIDLIST_ABSOLUTE /// A pointer to an ITEMIDLIST (PIDL) of the parent folder that contains the data object. /// /// /// Type: UINT - /// The number of file objects or subfolders specified in the parameter. + /// The number of file objects or subfolders specified in the apidl parameter. /// /// /// Type: PCUITEMID_CHILD_ARRAY @@ -4051,19 +4049,19 @@ namespace Vanara.PInvoke /// /// Type: IDataObject* /// - /// A pointer to interface IDataObject. This parameter can be NULL. Specify only if the data object created needs to support - /// additional FORMATETC clipboard formats beyond the default formats it is assigned at creation. Alternatively, provide support for - /// populating the created data object using non-default clipboard formats by calling method IDataObject::SetData and specifying the - /// format in the FORMATETC structure passed in parameter . + /// A pointer to interface IDataObject. This parameter can be NULL. Specify pdtInner only if the data object created + /// needs to support additional FORMATETC clipboard formats beyond the default formats it is assigned at creation. Alternatively, + /// provide support for populating the created data object using non-default clipboard formats by calling method IDataObject::SetData + /// and specifying the format in the FORMATETC structure passed in parameter pFormatetc. /// /// /// /// Type: REFIID - /// A reference to the IID of the interface to retrieve through . This must be IID_IDataObject. + /// A reference to the IID of the interface to retrieve through ppv. This must be IID_IDataObject. /// /// /// Type: void** - /// When this method returns successfully, contains the IDataObject interface pointer requested in . + /// When this method returns successfully, contains the IDataObject interface pointer requested in riid. /// /// /// Type: HRESULT @@ -4072,8 +4070,8 @@ namespace Vanara.PInvoke /// /// /// This function is typically called when implementing method IShellFolder::GetUIObjectOf. When an interface pointer of interface ID - /// IID_IDataObject is requested (using parameter ), the implementer can return the interface pointer on the object created with - /// SHCreateDataObject in response. + /// IID_IDataObject is requested (using parameter riid), the implementer can return the interface pointer on the object + /// created with SHCreateDataObject in response. /// /// /// This function supports the CFSTR_SHELLIDLIST (also known as HIDA) clipboard format and also has generic support for arbitrary @@ -4083,17 +4081,14 @@ namespace Vanara.PInvoke /// The new data object is intended to be used in operations such as drag-and-drop, in which the data is stored in the clipboard with /// a given format. /// - /// - /// We recommend that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the and parameters. This macro provides the - /// correct IID based on the interface pointed to by the value in , which eliminates the possibility of a coding error in that could - /// lead to unexpected results. - /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/shlobj_core/nf-shlobj_core-shcreatedataobject SHSTDAPI SHCreateDataObject( - // PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IDataObject *pdtInner, REFIID riid, void **ppv ); + // https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shcreatedataobject + // SHSTDAPI SHCreateDataObject( [in, optional] PCIDLIST_ABSOLUTE pidlFolder, [in] UINT cidl, [in, optional] PCUITEMID_CHILD_ARRAY apidl, [in, optional] IDataObject *pdtInner, [in] REFIID riid, [out] void **ppv ); + [PInvokeData("shlobj_core.h", MSDNShortId = "NF:shlobj_core.SHCreateDataObject")] [DllImport(Lib.Shell32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("shlobj_core.h", MSDNShortId = "d56cdafe-9463-43a5-8ef0-6cfaf0c524a8")] - public static extern HRESULT SHCreateDataObject(PIDL pidlFolder, uint cidl, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] apidl, IDataObject pdtInner, in Guid riid, out IDataObject ppv); + public static extern HRESULT SHCreateDataObject([In, Optional] PIDL pidlFolder, uint cidl, + [In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] IntPtr[] apidl, [In, Optional] IDataObject pdtInner, + in Guid riid, out IDataObject ppv); /// /// Creates an object that represents the Shell's default context menu implementation.