diff --git a/PInvoke/Ole/Ole32/ObjIdl3.cs b/PInvoke/Ole/Ole32/ObjIdl3.cs index 38a36dff..6ec79c6a 100644 --- a/PInvoke/Ole/Ole32/ObjIdl3.cs +++ b/PInvoke/Ole/Ole32/ObjIdl3.cs @@ -629,6 +629,15 @@ public static partial class Ole32 /// The enumerated values. public static IEnumerable Enumerate(this IEnumUnknown e) where T : class => e.Enumerate().Select(p => p == IntPtr.Zero ? null : (T)Marshal.GetObjectForIUnknown(p)); + /// Enumerates the values in a instance. + /// + /// The COM interface type to query for from each item in the collection. Note that if this type cannot be retrieved, an exception + /// will be thrown. + /// + /// The instance. + /// The enumerated values. + public static IEnumerable EnumerateNonNulls(this IEnumUnknown e) where T : class => e.Enumerate().Where(i => i is not null).Cast(); + /// Structure returned by IEnumContextProps::Enum [PInvokeData("objidl.h", MSDNShortId = "64591e45-5478-4360-8c1f-08b09b5aef8e")] // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ienumcontextprops-next diff --git a/PInvoke/SearchApi/SearchApi.cs b/PInvoke/SearchApi/SearchApi.cs index c08fe8ef..a4955111 100644 --- a/PInvoke/SearchApi/SearchApi.cs +++ b/PInvoke/SearchApi/SearchApi.cs @@ -964,7 +964,7 @@ public static partial class SearchApi // *SearchDecSize, WCHAR **pwcsSearchDesc, IFilter **ppIFilt ); [PInvokeData("filtereg.h", MSDNShortId = "b4eff132-9022-4091-a2a3-1d8e11a35b39")] [Obsolete, PreserveSig] - HRESULT LoadIFilterFromStorage([In] IStorage pStg, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In, MarshalAs(UnmanagedType.LPWStr)] string pwcsOverride, + HRESULT LoadIFilterFromStorage([In] IStorage pStg, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In, MarshalAs(UnmanagedType.LPWStr)] string pwcsOverride, [In, MarshalAs(UnmanagedType.Bool)] bool fUseDefault, out Guid pFilterClsid, [Optional] IntPtr SearchDecSize, [Optional] IntPtr pwcsSearchDesc, out IFilter ppIFilt); /// @@ -985,7 +985,7 @@ public static partial class SearchApi // *pFilterClsid, int *SearchDecSize, WCHAR **pwcsSearchDesc, IFilter **ppIFilt ); [PInvokeData("filtereg.h", MSDNShortId = "6a577306-d5ff-43c1-ab9f-3a7437661d2a")] [Obsolete, PreserveSig] - HRESULT LoadIFilterFromStream([In] IStream pStm, in FILTERED_DATA_SOURCES pFilteredSources, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, + HRESULT LoadIFilterFromStream([In] IStream pStm, in FILTERED_DATA_SOURCES pFilteredSources, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In, MarshalAs(UnmanagedType.Bool)] bool fUseDefault, out Guid pFilterClsid, [Optional] IntPtr SearchDecSize, [Optional] IntPtr pwcsSearchDesc, out IFilter ppIFilt); } @@ -2096,7 +2096,7 @@ public static partial class SearchApi // EnumerateRoots( IEnumSearchRoots **ppSearchRoots ); [PInvokeData("searchapi.h")] [PreserveSig] - HRESULT EnumerateRoots(out IEnumSearchRoots ppSearchRoots); + HRESULT EnumerateRoots(out IEnumSearchRoots? ppSearchRoots); /// Adds a hierarchical scope to the search engine. /// @@ -2472,7 +2472,7 @@ public static partial class SearchApi // EnumerateRoots( IEnumSearchRoots **ppSearchRoots ); [PInvokeData("searchapi.h")] [PreserveSig] - new HRESULT EnumerateRoots(out IEnumSearchRoots ppSearchRoots); + new HRESULT EnumerateRoots(out IEnumSearchRoots? ppSearchRoots); /// Adds a hierarchical scope to the search engine. /// @@ -4172,7 +4172,7 @@ public static partial class SearchApi // HRESULT put_QueryContentProperties( LPCWSTR pszContentProperties ); [PInvokeData("searchapi.h")] [DispId(0x60010009)] - string QueryContentProperties { [param: In, MarshalAs(UnmanagedType.LPWStr)] set; [return: MarshalAs(UnmanagedType.LPWStr)] get; } + string? QueryContentProperties { [param: In, MarshalAs(UnmanagedType.LPWStr)] set; [return: MarshalAs(UnmanagedType.LPWStr)] get; } /// Gets or sets the columns (or properties) requested in the select statement. /// @@ -6008,7 +6008,7 @@ public static partial class SearchApi // *SearchDecSize, WCHAR **pwcsSearchDesc, IFilter **ppIFilt ); [PInvokeData("filtereg.h", MSDNShortId = "920c976e-4dde-4e53-85b7-7547291736a0")] [PreserveSig] - new HRESULT LoadIFilter([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsPath, in FILTERED_DATA_SOURCES pFilteredSources, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, + new HRESULT LoadIFilter([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pwcsPath, in FILTERED_DATA_SOURCES pFilteredSources, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In, MarshalAs(UnmanagedType.Bool)] bool fUseDefault, out Guid pFilterClsid, [Optional] IntPtr SearchDecSize, [Optional] IntPtr pwcsSearchDesc, out IFilter ppIFilt); /// @@ -6029,7 +6029,7 @@ public static partial class SearchApi // *SearchDecSize, WCHAR **pwcsSearchDesc, IFilter **ppIFilt ); [PInvokeData("filtereg.h", MSDNShortId = "b4eff132-9022-4091-a2a3-1d8e11a35b39")] [Obsolete, PreserveSig] - new HRESULT LoadIFilterFromStorage([In] IStorage pStg, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In, MarshalAs(UnmanagedType.LPWStr)] string pwcsOverride, + new HRESULT LoadIFilterFromStorage([In] IStorage pStg, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In, MarshalAs(UnmanagedType.LPWStr)] string pwcsOverride, [In, MarshalAs(UnmanagedType.Bool)] bool fUseDefault, out Guid pFilterClsid, [Optional] IntPtr SearchDecSize, [Optional] IntPtr pwcsSearchDesc, out IFilter ppIFilt); /// @@ -6050,7 +6050,7 @@ public static partial class SearchApi // *pFilterClsid, int *SearchDecSize, WCHAR **pwcsSearchDesc, IFilter **ppIFilt ); [PInvokeData("filtereg.h", MSDNShortId = "6a577306-d5ff-43c1-ab9f-3a7437661d2a")] [Obsolete, PreserveSig] - new HRESULT LoadIFilterFromStream([In] IStream pStm, in FILTERED_DATA_SOURCES pFilteredSources, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, + new HRESULT LoadIFilterFromStream([In] IStream pStm, in FILTERED_DATA_SOURCES pFilteredSources, [In, MarshalAs(UnmanagedType.IUnknown)] object? pUnkOuter, [In, MarshalAs(UnmanagedType.Bool)] bool fUseDefault, out Guid pFilterClsid, [Optional] IntPtr SearchDecSize, [Optional] IntPtr pwcsSearchDesc, out IFilter ppIFilt); /// Undocumented. diff --git a/PInvoke/SearchApi/ShObjIdl.IOpenSearchSource.cs b/PInvoke/SearchApi/ShObjIdl.IOpenSearchSource.cs index cccd946f..41d7b280 100644 --- a/PInvoke/SearchApi/ShObjIdl.IOpenSearchSource.cs +++ b/PInvoke/SearchApi/ShObjIdl.IOpenSearchSource.cs @@ -76,6 +76,6 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-iopensearchsource-getresults // HRESULT GetResults( HWND hwnd, LPCWSTR pszQuery, DWORD dwStartIndex, DWORD dwCount, REFIID riid, void **ppv ); [PreserveSig] - HRESULT GetResults(HWND hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszQuery, uint dwStartIndex, uint dwCount, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object ppv); + HRESULT GetResults(HWND hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszQuery, uint dwStartIndex, uint dwCount, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] out object? ppv); } } \ No newline at end of file diff --git a/PInvoke/SearchApi/ShObjIdl.ISearchFolderItemFactory.cs b/PInvoke/SearchApi/ShObjIdl.ISearchFolderItemFactory.cs index 53748454..fc801867 100644 --- a/PInvoke/SearchApi/ShObjIdl.ISearchFolderItemFactory.cs +++ b/PInvoke/SearchApi/ShObjIdl.ISearchFolderItemFactory.cs @@ -143,7 +143,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-getshellitem // HRESULT GetShellItem( REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown)] - object GetShellItem(in Guid riid); + object? GetShellItem(in Guid riid); /// Gets the search folder as an ITEMIDLIST. /// @@ -159,7 +159,7 @@ public static partial class SearchApi /// Type of the interface to get. /// An instance. /// Receives the interface pointer requested in . - public static T GetShellItem(this ISearchFolderItemFactory sfif) where T : class => (T)sfif.GetShellItem(typeof(T).GUID); + public static T? GetShellItem(this ISearchFolderItemFactory sfif) where T : class => (T?)sfif.GetShellItem(typeof(T).GUID); /// CLSID_SearchFolderItemFactory [PInvokeData("shobjidl_core.h", MSDNShortId = "a684b373-6de4-4b4a-bbae-85e1c5a7e04a")] diff --git a/PInvoke/SearchApi/StructuredQuery.cs b/PInvoke/SearchApi/StructuredQuery.cs index b839b86a..ab50aa22 100644 --- a/PInvoke/SearchApi/StructuredQuery.cs +++ b/PInvoke/SearchApi/StructuredQuery.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using static Vanara.PInvoke.Ole32; using static Vanara.PInvoke.Shell32; @@ -349,7 +350,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-makeandor HRESULT // MakeAndOr( CONDITION_TYPE ct, IEnumUnknown *peuSubs, BOOL fSimplify, ICondition **ppcResult ); - ICondition MakeAndOr([In] CONDITION_TYPE ct, [In] IEnumUnknown peuSubs, [In, MarshalAs(UnmanagedType.Bool)] bool fSimplify); + ICondition MakeAndOr([In] CONDITION_TYPE ct, [In] IEnumUnknown? peuSubs, [In, MarshalAs(UnmanagedType.Bool)] bool fSimplify); /// Creates a leaf condition node that represents a comparison of property value and constant value. /// @@ -370,13 +371,22 @@ public static partial class SearchApi /// Type: PROPVARIANT const* /// The constant value against which the property value should be compared. /// - /// The rich chunk1. - /// The rich chunk2. - /// The rich chunk3. + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the property. It can be NULL. + /// + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the operation. It can be NULL. + /// + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the value. It can be NULL. + /// /// /// Type: BOOL /// - /// If TRUE and pszPropertyName identifies a virtual property, the resulting node is not a leaf node; instead, it is a + /// If TRUE and pszPropertyName identifies a virtual property, the resulting node is not a leaf node; instead, it is a /// disjunction of leaf condition nodes, each of which corresponds to one expansion of the virtual property. /// /// @@ -387,15 +397,16 @@ public static partial class SearchApi /// /// For more information about leaf node terms (property, value, and operation), see ICondition::GetInputTerms. /// - /// A virtual property has one or more metadata items in which the key is "MapsToRelation" and the value is a property name - /// (which is one expansion of the property). For more information about metadata, see MetaData. + /// A virtual property has one or more metadata items in which the key is "MapsToRelation" and the value is a property name (which is + /// one expansion of the property). For more information about metadata, see MetaData. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-makeleaf HRESULT - // MakeLeaf( LPCWSTR pszPropertyName, CONDITION_OPERATION cop, LPCWSTR pszValueType, const PROPVARIANT *ppropvar, IRichChunk - // *pPropertyNameTerm, IRichChunk *pOperationTerm, IRichChunk *pValueTerm, BOOL fExpand, ICondition **ppcResult ); - ICondition MakeLeaf([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, [In] CONDITION_OPERATION cop, [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType, - [In] PROPVARIANT ppropvar, [Optional] IRichChunk richChunk1, [Optional] IRichChunk richChunk2, [Optional] IRichChunk richChunk3, [In, Optional, MarshalAs(UnmanagedType.Bool)] bool fExpand); + // https://learn.microsoft.com/en-us/windows/win32/api/structuredquery/nf-structuredquery-iconditionfactory-makeleaf HRESULT + // MakeLeaf( [in] LPCWSTR pszPropertyName, [in] CONDITION_OPERATION cop, [in] LPCWSTR pszValueType, [in] const PROPVARIANT *ppropvar, + // [in] IRichChunk *pPropertyNameTerm, [in] IRichChunk *pOperationTerm, [in] IRichChunk *pValueTerm, [in] BOOL fExpand, [out, retval] + // ICondition **ppcResult ); + ICondition MakeLeaf([In, MarshalAs(UnmanagedType.LPWStr)] string? pszPropertyName, [In] CONDITION_OPERATION cop, [In, MarshalAs(UnmanagedType.LPWStr)] string? pszValueType, + [In] PROPVARIANT ppropvar, [Optional] IRichChunk? pPropertyNameTerm, [Optional] IRichChunk? pOperationTerm, [Optional] IRichChunk? pValueTerm, [In, Optional, MarshalAs(UnmanagedType.Bool)] bool fExpand); /// /// Performs a variety of transformations on a condition tree, including the following: resolves conditions with relative @@ -450,7 +461,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-resolve HRESULT // Resolve( ICondition *pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, const SYSTEMTIME *pstReferenceTime, ICondition **ppcResolved ); - ICondition Resolve([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, in SYSTEMTIME pstReferenceTime); + unsafe ICondition Resolve([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, [In, Optional] SYSTEMTIME* pstReferenceTime); } /// @@ -525,7 +536,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-makeandor HRESULT // MakeAndOr( CONDITION_TYPE ct, IEnumUnknown *peuSubs, BOOL fSimplify, ICondition **ppcResult ); - new ICondition MakeAndOr([In] CONDITION_TYPE ct, [In] IEnumUnknown peuSubs, [In, MarshalAs(UnmanagedType.Bool)] bool fSimplify); + new ICondition MakeAndOr([In] CONDITION_TYPE ct, [In] IEnumUnknown? peuSubs, [In, MarshalAs(UnmanagedType.Bool)] bool fSimplify); /// Creates a leaf condition node that represents a comparison of property value and constant value. /// @@ -546,13 +557,22 @@ public static partial class SearchApi /// Type: PROPVARIANT const* /// The constant value against which the property value should be compared. /// - /// The rich chunk1. - /// The rich chunk2. - /// The rich chunk3. + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the property. It can be NULL. + /// + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the operation. It can be NULL. + /// + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the value. It can be NULL. + /// /// /// Type: BOOL /// - /// If TRUE and pszPropertyName identifies a virtual property, the resulting node is not a leaf node; instead, it is a + /// If TRUE and pszPropertyName identifies a virtual property, the resulting node is not a leaf node; instead, it is a /// disjunction of leaf condition nodes, each of which corresponds to one expansion of the virtual property. /// /// @@ -563,15 +583,16 @@ public static partial class SearchApi /// /// For more information about leaf node terms (property, value, and operation), see ICondition::GetInputTerms. /// - /// A virtual property has one or more metadata items in which the key is "MapsToRelation" and the value is a property name - /// (which is one expansion of the property). For more information about metadata, see MetaData. + /// A virtual property has one or more metadata items in which the key is "MapsToRelation" and the value is a property name (which is + /// one expansion of the property). For more information about metadata, see MetaData. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-makeleaf HRESULT - // MakeLeaf( LPCWSTR pszPropertyName, CONDITION_OPERATION cop, LPCWSTR pszValueType, const PROPVARIANT *ppropvar, IRichChunk - // *pPropertyNameTerm, IRichChunk *pOperationTerm, IRichChunk *pValueTerm, BOOL fExpand, ICondition **ppcResult ); - new ICondition MakeLeaf([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, [In] CONDITION_OPERATION cop, [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType, - [In] PROPVARIANT ppropvar, IRichChunk richChunk1, IRichChunk richChunk2, IRichChunk richChunk3, [In, MarshalAs(UnmanagedType.Bool)] bool fExpand); + // https://learn.microsoft.com/en-us/windows/win32/api/structuredquery/nf-structuredquery-iconditionfactory-makeleaf HRESULT + // MakeLeaf( [in] LPCWSTR pszPropertyName, [in] CONDITION_OPERATION cop, [in] LPCWSTR pszValueType, [in] const PROPVARIANT *ppropvar, + // [in] IRichChunk *pPropertyNameTerm, [in] IRichChunk *pOperationTerm, [in] IRichChunk *pValueTerm, [in] BOOL fExpand, [out, retval] + // ICondition **ppcResult ); + new ICondition MakeLeaf([In, MarshalAs(UnmanagedType.LPWStr)] string? pszPropertyName, [In] CONDITION_OPERATION cop, [In, MarshalAs(UnmanagedType.LPWStr)] string? pszValueType, + [In] PROPVARIANT ppropvar, [Optional] IRichChunk? pPropertyNameTerm, [Optional] IRichChunk? pOperationTerm, [Optional] IRichChunk? pValueTerm, [In, Optional, MarshalAs(UnmanagedType.Bool)] bool fExpand); /// /// Performs a variety of transformations on a condition tree, including the following: resolves conditions with relative @@ -593,8 +614,8 @@ public static partial class SearchApi /// /// Type: SYSTEMTIME const* /// - /// A pointer to a SYSTEMTIME value to use as the reference date and time. A null pointer can be passed if - /// is set to SQRO_DONT_RESOLVE_DATETIME. + /// A pointer to a SYSTEMTIME value to use as the reference date and time. A null pointer can be passed if is set to SQRO_DONT_RESOLVE_DATETIME. /// /// /// @@ -626,7 +647,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-resolve HRESULT // Resolve( ICondition *pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, const SYSTEMTIME *pstReferenceTime, ICondition **ppcResolved ); - new ICondition Resolve([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, in SYSTEMTIME pstReferenceTime); + new unsafe ICondition Resolve([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, [In, Optional] SYSTEMTIME* pstReferenceTime); /// /// Creates a search condition that is either TRUE or FALSE. The returned object supports ICondition and ICondition2 @@ -648,7 +669,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createtruefalse // HRESULT CreateTrueFalse( BOOL fVal, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 2)] - object CreateTrueFalse([MarshalAs(UnmanagedType.Bool)] bool fVal, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateTrueFalse([MarshalAs(UnmanagedType.Bool)] bool fVal, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// /// Creates a condition node that is a logical negation (NOT) of another condition (a subnode of this node). @@ -676,7 +697,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createnegation // HRESULT CreateNegation( ICondition *pcSub, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 2)] - object CreateNegation([In] ICondition pcSub, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateNegation([In] ICondition pcSub, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// /// Creates a leaf condition node that is a conjunction (AND) or a disjunction (OR) of a collection of subconditions. The @@ -703,7 +724,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createcompoundfromobjectarray // HRESULT CreateCompoundFromObjectArray( CONDITION_TYPE ct, IObjectArray *poaSubs, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] - object CreateCompoundFromObjectArray(CONDITION_TYPE ct, [In, Optional] IObjectArray poaSubs, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateCompoundFromObjectArray(CONDITION_TYPE ct, [In, Optional] IObjectArray? poaSubs, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// /// Creates a leaf condition node that is a conjunction (AND) or a disjunction (OR) from an array of condition nodes. The @@ -729,7 +750,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createcompoundfromarray // HRESULT CreateCompoundFromArray( CONDITION_TYPE ct, ICondition **ppcondSubs, ULONG cSubs, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 4)] - object CreateCompoundFromArray(CONDITION_TYPE ct, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown)] ICondition[] ppcondSubs, uint cSubs, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateCompoundFromArray(CONDITION_TYPE ct, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown)] ICondition[] ppcondSubs, uint cSubs, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// /// Creates a leaf condition node for a string value that represents a comparison of property value and constant value. The @@ -759,7 +780,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createstringleaf // HRESULT CreateStringLeaf( REFPROPERTYKEY propkey, CONDITION_OPERATION cop, LPCWSTR pszValue, LPCWSTR pszLocaleName, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 5)] - object CreateStringLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, [MarshalAs(UnmanagedType.LPWStr), Optional] string? pszValue, + object? CreateStringLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, [MarshalAs(UnmanagedType.LPWStr), Optional] string? pszValue, [MarshalAs(UnmanagedType.LPWStr), Optional] string? pszLocaleName, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// @@ -785,7 +806,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createintegerleaf // HRESULT CreateIntegerLeaf( REFPROPERTYKEY propkey, CONDITION_OPERATION cop, INT32 lValue, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 4)] - object CreateIntegerLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, int lValue, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateIntegerLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, int lValue, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// /// Creates a search condition that is either TRUE or FALSE. The returned object supports ICondition and ICondition2 @@ -808,7 +829,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createbooleanleaf // HRESULT CreateBooleanLeaf( REFPROPERTYKEY propkey, CONDITION_OPERATION cop, BOOL fValue, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 4)] - object CreateBooleanLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, [MarshalAs(UnmanagedType.Bool)] bool fValue, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateBooleanLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, [MarshalAs(UnmanagedType.Bool)] bool fValue, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// Creates a leaf condition node for any value. The returned object supports ICondition and ICondition2. /// Type: REFPROPERTYKEY @@ -858,9 +879,9 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-createleaf // HRESULT CreateLeaf( REFPROPERTYKEY propkey, CONDITION_OPERATION cop, REFPROPVARIANT propvar, LPCWSTR pszSemanticType, LPCWSTR pszLocaleName, IRichChunk *pPropertyNameTerm, IRichChunk *pOperationTerm, IRichChunk *pValueTerm, CONDITION_CREATION_OPTIONS cco, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 9)] - object CreateLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, [In] PROPVARIANT propvar, [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pszSemanticType, - [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pszLocaleName, [In, Optional] IRichChunk pPropertyNameTerm, [In, Optional] IRichChunk pOperationTerm, - [In, Optional] IRichChunk pValueTerm, CONDITION_CREATION_OPTIONS cco, in Guid riid); + object? CreateLeaf(in PROPERTYKEY propkey, CONDITION_OPERATION cop, [In] PROPVARIANT propvar, [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pszSemanticType, + [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string? pszLocaleName, [In, Optional] IRichChunk? pPropertyNameTerm, [In, Optional] IRichChunk? pOperationTerm, + [In, Optional] IRichChunk? pValueTerm, CONDITION_CREATION_OPTIONS cco, in Guid riid); /// /// Performs a variety of transformations on a condition tree, and thereby the resolved condition for evaluation. The returned @@ -894,7 +915,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory2-resolvecondition // HRESULT ResolveCondition( ICondition *pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, const SYSTEMTIME *pstReferenceTime, REFIID riid, void **ppv ); [return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 3)] - object ResolveCondition([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, in SYSTEMTIME pstReferenceTime, in Guid riid); + unsafe object? ResolveCondition([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, [In] SYSTEMTIME* pstReferenceTime, in Guid riid); } /// Provides methods for retrieving information about an entity type in the schema. @@ -946,7 +967,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ientity-base HRESULT Base( IEntity // **pBaseEntity ); - HRESULT Base(out IEntity pBaseEntity); + HRESULT Base(out IEntity? pBaseEntity); /// Retrieves an enumeration of IRelationship objects, one for each relationship this entity has. /// @@ -960,7 +981,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ientity-relationships HRESULT // Relationships( REFIID riid, void **pRelationships ); [return: MarshalAs(UnmanagedType.IUnknown)] - object Relationships(in Guid riid); + object? Relationships(in Guid riid); /// Retrieves the IRelationship object for this entity as requested by name. /// @@ -976,7 +997,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ientity-getrelationship HRESULT // GetRelationship( LPCWSTR pszRelationName, IRelationship **pRelationship ); - IRelationship GetRelationship([In, MarshalAs(UnmanagedType.LPWStr)] string pszRelationName); + IRelationship? GetRelationship([In, MarshalAs(UnmanagedType.LPWStr)] string pszRelationName); /// /// Retrieves an enumeration of IMetaData objects for this entity. @@ -1021,7 +1042,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ientity-getnamedentity HRESULT // GetNamedEntity( LPCWSTR pszValue, INamedEntity **ppNamedEntity ); - INamedEntity GetNamedEntity([In, MarshalAs(UnmanagedType.LPWStr)] string pszValue); + INamedEntity? GetNamedEntity([In, MarshalAs(UnmanagedType.LPWStr)] string pszValue); /// Retrieves a default phrase to use for this entity in restatements. /// @@ -1128,7 +1149,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iqueryparser-parse HRESULT Parse( // LPCWSTR pszInputString, IEnumUnknown *pCustomProperties, IQuerySolution **ppSolution ); - IQuerySolution Parse([In, MarshalAs(UnmanagedType.LPWStr)] string pszInputString, [In, Optional] IEnumUnknown pCustomProperties); + IQuerySolution Parse([In, MarshalAs(UnmanagedType.LPWStr)] string pszInputString, [In, Optional] IEnumUnknown? pCustomProperties); /// Sets a single option, such as a specified word-breaker, for parsing an input string. /// @@ -1443,13 +1464,22 @@ public static partial class SearchApi /// Type: PROPVARIANT const* /// The constant value against which the property value should be compared. /// - /// The rich chunk1. - /// The rich chunk2. - /// The rich chunk3. + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the property. It can be NULL. + /// + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the operation. It can be NULL. + /// + /// + /// Type: IRichChunk* + /// A pointer to an IRichChunk that identifies the range of the input string that represents the value. It can be NULL. + /// /// /// Type: BOOL /// - /// If TRUE and pszPropertyName identifies a virtual property, the resulting node is not a leaf node; instead, it is a + /// If TRUE and pszPropertyName identifies a virtual property, the resulting node is not a leaf node; instead, it is a /// disjunction of leaf condition nodes, each of which corresponds to one expansion of the virtual property. /// /// @@ -1460,15 +1490,16 @@ public static partial class SearchApi /// /// For more information about leaf node terms (property, value, and operation), see ICondition::GetInputTerms. /// - /// A virtual property has one or more metadata items in which the key is "MapsToRelation" and the value is a property name - /// (which is one expansion of the property). For more information about metadata, see MetaData. + /// A virtual property has one or more metadata items in which the key is "MapsToRelation" and the value is a property name (which is + /// one expansion of the property). For more information about metadata, see MetaData. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-makeleaf HRESULT - // MakeLeaf( LPCWSTR pszPropertyName, CONDITION_OPERATION cop, LPCWSTR pszValueType, const PROPVARIANT *ppropvar, IRichChunk - // *pPropertyNameTerm, IRichChunk *pOperationTerm, IRichChunk *pValueTerm, BOOL fExpand, ICondition **ppcResult ); - new ICondition MakeLeaf([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, [In] CONDITION_OPERATION cop, [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType, - [In] PROPVARIANT ppropvar, IRichChunk richChunk1, IRichChunk richChunk2, IRichChunk richChunk3, [In, MarshalAs(UnmanagedType.Bool)] bool fExpand); + // https://learn.microsoft.com/en-us/windows/win32/api/structuredquery/nf-structuredquery-iconditionfactory-makeleaf HRESULT + // MakeLeaf( [in] LPCWSTR pszPropertyName, [in] CONDITION_OPERATION cop, [in] LPCWSTR pszValueType, [in] const PROPVARIANT *ppropvar, + // [in] IRichChunk *pPropertyNameTerm, [in] IRichChunk *pOperationTerm, [in] IRichChunk *pValueTerm, [in] BOOL fExpand, [out, retval] + // ICondition **ppcResult ); + new ICondition MakeLeaf([In, MarshalAs(UnmanagedType.LPWStr)] string? pszPropertyName, [In] CONDITION_OPERATION cop, [In, MarshalAs(UnmanagedType.LPWStr)] string? pszValueType, + [In] PROPVARIANT ppropvar, [Optional] IRichChunk? pPropertyNameTerm, [Optional] IRichChunk? pOperationTerm, [Optional] IRichChunk? pValueTerm, [In, Optional, MarshalAs(UnmanagedType.Bool)] bool fExpand); /// /// Performs a variety of transformations on a condition tree, including the following: resolves conditions with relative @@ -1523,7 +1554,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iconditionfactory-resolve HRESULT // Resolve( ICondition *pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, const SYSTEMTIME *pstReferenceTime, ICondition **ppcResolved ); - new ICondition Resolve([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, in SYSTEMTIME pstReferenceTime); + new unsafe ICondition Resolve([In] ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro, [In] SYSTEMTIME* pstReferenceTime); /// Retrieves the condition tree and the semantic type of the solution. /// @@ -1540,7 +1571,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iquerysolution-getquery HRESULT // GetQuery( ICondition **ppQueryNode, IEntity **ppMainType ); - void GetQuery(out ICondition ppQueryNode, out IEntity ppMainType); + void GetQuery(out ICondition? ppQueryNode, out IEntity? ppMainType); /// /// Identifies parts of the input string that the parser did not recognize or did not use when constructing the IQuerySolution @@ -1565,7 +1596,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iquerysolution-geterrors HRESULT // GetErrors( REFIID riid, void **ppParseErrors ); [return: MarshalAs(UnmanagedType.IUnknown)] - object GetErrors(in Guid riid); + object? GetErrors(in Guid riid); /// /// Reports the query string, how it was tokenized, and what language code identifier (LCID) and word breaker were used to parse it. @@ -1590,8 +1621,8 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-iquerysolution-getlexicaldata HRESULT // GetLexicalData( LPWSTR *ppszInputString, ITokenCollection **ppTokens, LCID *plcid, IUnknown **ppWordBreaker ); - void GetLexicalData([MarshalAs(UnmanagedType.LPWStr)] out string ppszInputString, [Out] out ITokenCollection ppTokens, [Out] out uint plcid, - [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppWordBreaker); + void GetLexicalData([MarshalAs(UnmanagedType.LPWStr)] out string? ppszInputString, [Out] out ITokenCollection? ppTokens, [Out] out uint plcid, + [Out, MarshalAs(UnmanagedType.IUnknown)] out object? ppWordBreaker); } /// Provides methods for retrieving information about a schema property. @@ -1639,7 +1670,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-irelationship-destination HRESULT // Destination( IEntity **pDestinationEntity ); - IEntity Destination(); + IEntity? Destination(); /// Retrieves an enumeration of IMetaData objects for this relationship. /// @@ -1655,7 +1686,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-irelationship-metadata HRESULT // MetaData( REFIID riid, void **pMetaData ); [return: MarshalAs(UnmanagedType.IUnknown)] - object MetaData(in Guid riid); + object? MetaData(in Guid riid); /// Retrieves the default phrase to use for this relationship in restatements. /// @@ -1697,7 +1728,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ischemalocalizersupport-localize // HRESULT Localize( LPCWSTR pszGlobalString, LPWSTR *ppszLocalString ); [PreserveSig] - HRESULT Localize([MarshalAs(UnmanagedType.LPWStr)] string pszGlobalString, [MarshalAs(UnmanagedType.LPWStr)] out string ppszLocalString); + HRESULT Localize([MarshalAs(UnmanagedType.LPWStr)] string pszGlobalString, [MarshalAs(UnmanagedType.LPWStr)] out string? ppszLocalString); } /// Provides a schema repository that can be browsed. @@ -1745,7 +1776,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ischemaprovider-getentity HRESULT // GetEntity( LPCWSTR pszEntityName, IEntity **pEntity ); - IEntity GetEntity([In, MarshalAs(UnmanagedType.LPWStr)] string pszEntityName); + IEntity GetEntity([In, MarshalAs(UnmanagedType.LPWStr)] string? pszEntityName); /// Retrieves an enumeration of global IMetaData objects for the loaded schema. /// @@ -1762,7 +1793,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-ischemaprovider-metadata HRESULT // MetaData( REFIID riid, void **pMetaData ); [return: MarshalAs(UnmanagedType.IUnknown)] - object MetaData(in Guid riid); + object? MetaData(in Guid riid); /// Localizes the currently loaded schema for a specified locale. /// @@ -1873,7 +1904,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquery/nf-structuredquery-itokencollection-gettoken HRESULT // GetToken( ULONG i, ULONG *pBegin, ULONG *pLength, LPWSTR *ppsz ); - void GetToken(uint i, out uint pBegin, out uint pLength, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppsz); + void GetToken(uint i, out uint pBegin, out uint pLength, [Out, MarshalAs(UnmanagedType.LPWStr)] out string? ppsz); } /// @@ -1923,7 +1954,7 @@ public static partial class SearchApi /// identifying the STRUCTURED_QUERY_PARSE_ERROR enumeration. /// /// - public static IEnumerable GetErrors(this IQuerySolution qs) => ((IEnumUnknown)qs.GetErrors(typeof(IEnumUnknown).GUID)).Enumerate(); + public static IEnumerable GetErrors(this IQuerySolution qs) => ((IEnumUnknown?)qs.GetErrors(typeof(IEnumUnknown).GUID))?.EnumerateNonNulls() ?? Enumerable.Empty(); /// Retrieves an enumeration of IMetaData objects for this entity. /// The desired type of the result, either IID_IEnumUnknown or IID_IEnumVARIANT. @@ -1937,7 +1968,7 @@ public static partial class SearchApi /// /// Receives a pointer to the enumeration of IMetaData objects. There may be multiple pairs with the same key (or the same value). /// - public static T MetaData(this IRelationship r) where T : class => (T)r.MetaData(typeof(T).GUID); + public static T? MetaData(this IRelationship r) where T : class => (T?)r.MetaData(typeof(T).GUID); /// Retrieves an enumeration of global IMetaData objects for the loaded schema. /// The desired type of the result, either IID_IEnumUnknown or IID_IEnumVARIANT. @@ -1946,7 +1977,7 @@ public static partial class SearchApi /// Receives a pointer to an enumeration of the IMetaData objects. The calling application must release it by calling its /// IUnknown::Release method. /// - public static T MetaData(this ISchemaProvider sp) => (T)sp.MetaData(typeof(T).GUID); + public static T? MetaData(this ISchemaProvider sp) => (T?)sp.MetaData(typeof(T).GUID); /// Retrieves an enumeration of INamedEntity objects, one for each known named entity of this type. /// The desired type of the result, either IID_IEnumUnknown or IID_IEnumVARIANT. @@ -1960,7 +1991,7 @@ public static partial class SearchApi /// The desired type of the result, either IID_IEnumUnknown or IID_IEnumVARIANT. /// The instance. /// Receives the address of a pointer to the enumeration of the IRelationship objects. - public static T Relationships(this IEntity e) where T : class => (T)e.Relationships(typeof(T).GUID); + public static T? Relationships(this IEntity e) where T : class => (T?)e.Relationships(typeof(T).GUID); /// /// Performs a variety of transformations on a condition tree, and thereby the resolved condition for evaluation. The returned @@ -1976,10 +2007,36 @@ public static partial class SearchApi /// automatically added to sqro. /// /// - public static T ResolveCondition(this IConditionFactory2 f2, ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro = 0) where T : class + public static T? ResolveCondition(this IConditionFactory2 f2, ICondition pc, STRUCTURED_QUERY_RESOLVE_OPTION sqro = STRUCTURED_QUERY_RESOLVE_OPTION.SQRO_DONT_RESOLVE_DATETIME) where T : class { - Kernel32.GetLocalTime(out var st); - return (T)f2.ResolveCondition(pc, sqro, st, typeof(T).GUID); + unsafe + { + return (T?)f2.ResolveCondition(pc, sqro | STRUCTURED_QUERY_RESOLVE_OPTION.SQRO_DONT_RESOLVE_DATETIME, null, typeof(T).GUID); + } + } + + /// + /// Performs a variety of transformations on a condition tree, and thereby the resolved condition for evaluation. The returned + /// object supports ICondition and ICondition2. + /// + /// The desired type of the result, either ICondition or ICondition2. + /// The IConditionFactory2 instance. + /// Type: ICondition* + /// Pointer to an ICondition object to be resolved. + /// The value to use as the reference date and time. + /// Type: STRUCTURED_QUERY_RESOLVE_OPTION + /// + /// Specifies zero or more of the STRUCTURED_QUERY_RESOLVE_OPTION flags. The SQRO_NULL_VALUE_TYPE_FOR_PLAIN_VALUES flag is + /// automatically added to sqro. + /// + /// + public static T? ResolveCondition(this IConditionFactory2 f2, ICondition pc, DateTime refTime, STRUCTURED_QUERY_RESOLVE_OPTION sqro = 0) where T : class + { + unsafe + { + SYSTEMTIME st = new(refTime); + return (T?)f2.ResolveCondition(pc, sqro, &st, typeof(T).GUID); + } } /// Class interface for ICondition diff --git a/PInvoke/SearchApi/StructuredQueryCondition.cs b/PInvoke/SearchApi/StructuredQueryCondition.cs index b3fdccf5..20c2db41 100644 --- a/PInvoke/SearchApi/StructuredQueryCondition.cs +++ b/PInvoke/SearchApi/StructuredQueryCondition.cs @@ -373,7 +373,7 @@ public static partial class SearchApi /// Any or all of the three parameters can be NULL. // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getcomparisoninfo // HRESULT GetComparisonInfo( LPWSTR *ppszPropertyName, CONDITION_OPERATION *pcop, PROPVARIANT *ppropvar ); - void GetComparisonInfo([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszPropertyName, out CONDITION_OPERATION pcop, [In, Out] PROPVARIANT ppropvar); + void GetComparisonInfo([Out, MarshalAs(UnmanagedType.LPWStr)] out string? ppszPropertyName, out CONDITION_OPERATION pcop, [In, Out] PROPVARIANT ppropvar); /// Retrieves the semantic type of the value of the search condition node. /// @@ -383,7 +383,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getvaluetype // HRESULT GetValueType( LPWSTR *ppszValueTypeName ); [return: MarshalAs(UnmanagedType.LPWStr)] - string GetValueType(); + string? GetValueType(); /// Retrieves the character-normalized value of the search condition node. /// @@ -436,7 +436,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getinputterms // HRESULT GetInputTerms( IRichChunk **ppPropertyTerm, IRichChunk **ppOperationTerm, IRichChunk **ppValueTerm ); - void GetInputTerms(out IRichChunk ppPropertyTerm, out IRichChunk ppOperationTerm, out IRichChunk ppValueTerm); + void GetInputTerms(out IRichChunk? ppPropertyTerm, out IRichChunk? ppOperationTerm, out IRichChunk? ppValueTerm); /// Creates a deep copy of this ICondition object. /// @@ -710,7 +710,7 @@ public static partial class SearchApi /// Any or all of the three parameters can be NULL. // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getcomparisoninfo // HRESULT GetComparisonInfo( LPWSTR *ppszPropertyName, CONDITION_OPERATION *pcop, PROPVARIANT *ppropvar ); - new void GetComparisonInfo([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszPropertyName, out CONDITION_OPERATION pcop, [In, Out] PROPVARIANT ppropvar); + new void GetComparisonInfo([Out, MarshalAs(UnmanagedType.LPWStr)] out string? ppszPropertyName, out CONDITION_OPERATION pcop, [In, Out] PROPVARIANT ppropvar); /// Retrieves the semantic type of the value of the search condition node. /// @@ -720,7 +720,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getvaluetype // HRESULT GetValueType( LPWSTR *ppszValueTypeName ); [return: MarshalAs(UnmanagedType.LPWStr)] - new string GetValueType(); + new string? GetValueType(); /// Retrieves the character-normalized value of the search condition node. /// @@ -773,7 +773,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getinputterms // HRESULT GetInputTerms( IRichChunk **ppPropertyTerm, IRichChunk **ppOperationTerm, IRichChunk **ppValueTerm ); - new void GetInputTerms(out IRichChunk ppPropertyTerm, out IRichChunk ppOperationTerm, out IRichChunk ppValueTerm); + new void GetInputTerms(out IRichChunk? ppPropertyTerm, out IRichChunk? ppOperationTerm, out IRichChunk? ppValueTerm); /// Creates a deep copy of this ICondition object. /// @@ -799,7 +799,7 @@ public static partial class SearchApi // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition2-getlocale // HRESULT GetLocale( LPWSTR *ppszLocaleName ); [PInvokeData("structuredquerycondition.h", MSDNShortId = "")] - string GetLocale(); + string? GetLocale(); /// /// Retrieves the property name, operation, and value from a leaf search condition node. @@ -854,7 +854,7 @@ public static partial class SearchApi /// // https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-irichchunk-getdata // HRESULT GetData( ULONG *pFirstPos, ULONG *pLength, LPWSTR *ppsz, PROPVARIANT *pValue ); - void GetData(out uint pFirstPos, out uint pLength, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppsz, [In, Out] PROPVARIANT pValue); + void GetData(out uint pFirstPos, out uint pLength, [Out, MarshalAs(UnmanagedType.LPWStr)] out string? ppsz, [In, Out] PROPVARIANT pValue); } ///