From d1eac0578302b52253d41e92d111d20bfc0d499b Mon Sep 17 00:00:00 2001 From: dahall Date: Mon, 8 Mar 2021 20:06:32 -0700 Subject: [PATCH] Fixed ISearchRoot. IDL has property methods in put/get order instead of get/put and wrapping them in properties does not seem to allow that order. --- PInvoke/SearchApi/SearchApi.cs | 300 ++++++++++++++++++++++++++++++++--------- 1 file changed, 238 insertions(+), 62 deletions(-) diff --git a/PInvoke/SearchApi/SearchApi.cs b/PInvoke/SearchApi/SearchApi.cs index 71b8b3b0..4547de5a 100644 --- a/PInvoke/SearchApi/SearchApi.cs +++ b/PInvoke/SearchApi/SearchApi.cs @@ -4347,53 +4347,130 @@ namespace Vanara.PInvoke [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("04C18CCF-1F57-4CBD-88CC-3900F5195CE3"), CoClass(typeof(CSearchRoot))] public interface ISearchRoot { - /// The name of the task to be inserted. - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_schedule HRESULT put_Schedule( + /// Not implemented. + /// + /// Type: LPCWSTR + /// Pointer to a null-terminated, Unicode buffer that contains the name of the task to be inserted. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_schedule HRESULT put_Schedule( // LPCWSTR pszTaskArg ); - [PInvokeData("searchapi.h", MSDNShortId = "")] - [DispId(0x60010000)] - string Schedule { [return: MarshalAs(UnmanagedType.LPWStr)] get; [param: In, MarshalAs(UnmanagedType.LPWStr)] set; } + [PInvokeData("searchapi.h", MSDNShortId = "NF:searchapi.ISearchRoot.put_Schedule")] + void put_Schedule([MarshalAs(UnmanagedType.LPWStr)] string pszTaskArg); + + /// Not implemented. + /// + /// Type: LPWSTR* + /// Returns the address of a pointer to a null-terminated, Unicode buffer that contains the name of the task. + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_schedule HRESULT get_Schedule( + // LPWSTR *ppszTaskArg ); + [PInvokeData("searchapi.h", MSDNShortId = "NF:searchapi.ISearchRoot.get_Schedule")] + [return: MarshalAs(UnmanagedType.LPWStr)] + string get_Schedule(); /// Sets the URL of the current search root. + /// + /// Type: LPCWSTR + /// Pointer to a null-terminated, Unicode buffer that contains the URL of this search root. + /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_rooturl HRESULT put_RootURL( - // LPCWSTR pszURL ); - [PInvokeData("searchapi.h")] - [DispId(0x60010002)] - string RootURL { [return: MarshalAs(UnmanagedType.LPWStr)] get; [param: In, MarshalAs(UnmanagedType.LPWStr)] set; } + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_rooturl + void put_RootURL([MarshalAs(UnmanagedType.LPWStr)] string pszURL); + + /// Gets the URL of the starting point for this search root. + /// + /// Type: LPWSTR* + /// A null-terminated, Unicode buffer that contains the URL. + /// + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_rooturl + [return: MarshalAs(UnmanagedType.LPWStr)] + string get_RootURL(); /// Sets a value that indicates whether the search is rooted on a hierarchical tree structure. + /// + /// Type: BOOL + /// TRUE for hierarchical tree structures, FALSE for non-hierarchical systems such as websites. + /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_ishierarchical HRESULT + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_ishierarchical HRESULT // put_IsHierarchical( BOOL fIsHierarchical ); - [PInvokeData("searchapi.h")] - [DispId(0x60010004)] - bool IsHierarchical { [return: MarshalAs(UnmanagedType.Bool)] get; [param: In, MarshalAs(UnmanagedType.Bool)] set; } + [PInvokeData("searchapi.h", MSDNShortId = "NF:searchapi.ISearchRoot.put_IsHierarchical")] + void put_IsHierarchical([MarshalAs(UnmanagedType.Bool)] bool fIsHierarchical); + + /// Gets a value that indicates whether the search is rooted on a hierarchical tree structure. + /// + /// Type: BOOL* + /// On return, points to TRUE for hierarchical tree structures, and FALSE for other structures such as websites. + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_ishierarchical HRESULT + // get_IsHierarchical( BOOL *pfIsHierarchical ); + [return: MarshalAs(UnmanagedType.Bool)] + bool get_IsHierarchical(); /// /// Sets a value that indicates whether the search engine is notified (by protocol handlers or other applications) about changes /// to the URLs under the search root. /// + /// + /// Type: BOOL + /// TRUE if notifications are provided; otherwise, FALSE. + /// /// /// That value that ISearchRoot::put_ProvidesNotifications sets is not protocol specific. /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_providesnotifications HRESULT + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_providesnotifications HRESULT // put_ProvidesNotifications( BOOL fProvidesNotifications ); - [PInvokeData("searchapi.h")] - [DispId(0x60010006)] - bool ProvidesNotifications { [return: MarshalAs(UnmanagedType.Bool)] get; [param: In, MarshalAs(UnmanagedType.Bool)] set; } + void put_ProvidesNotifications([MarshalAs(UnmanagedType.Bool)] bool fProvidesNotifications); + + /// + /// Gets a value that indicates whether the search engine is notified (by protocol handlers or other applications) about changes + /// to the URLs under the search root. + /// + /// + /// Type: BOOL* + /// On return, points to TRUE if this search root provides notifications; otherwise, FALSE. + /// + /// + /// The value ISearchRoot::get_ProvidesNotifications returns is not protocol specific. + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_providesnotifications HRESULT + // get_ProvidesNotifications( BOOL *pfProvidesNotifications ); + [return: MarshalAs(UnmanagedType.Bool)] + bool get_ProvidesNotifications(); /// Sets a value that indicates whether this search root should be indexed only by notification and not crawled. + /// + /// Type: BOOL + /// TRUE if this search root should be indexed only by notification; otherwise, FALSE. + /// /// /// /// For search root URLs in a custom data store or on a remote system, it can be useful to limit the search engine to indexing @@ -4401,79 +4478,178 @@ namespace Vanara.PInvoke /// the store or across the network by avoiding the incremental crawls when the store is unchanged. /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_usenotificationsonly HRESULT + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_usenotificationsonly HRESULT // put_UseNotificationsOnly( BOOL fUseNotificationsOnly ); - [PInvokeData("searchapi.h")] - [DispId(0x60010008)] - bool UseNotificationsOnly { [return: MarshalAs(UnmanagedType.Bool)] get; [param: In, MarshalAs(UnmanagedType.Bool)] set; } + void put_UseNotificationsOnly([MarshalAs(UnmanagedType.Bool)] bool fUseNotificationsOnly); + + /// Gets a value that indicates whether this search root should be indexed only by notification and not crawled. + /// + /// Type: BOOL* + /// On return, points to TRUE if this search root should be indexed only by notification; otherwise, FALSE. + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_usenotificationsonly HRESULT + // get_UseNotificationsOnly( BOOL *pfUseNotificationsOnly ); + [return: MarshalAs(UnmanagedType.Bool)] + bool get_UseNotificationsOnly(); /// Sets the enumeration depth for this search root. + /// + /// Type: DWORD + /// The depth (number of levels) to enumerate. + /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_enumerationdepth HRESULT + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_enumerationdepth HRESULT // put_EnumerationDepth( DWORD dwDepth ); - [PInvokeData("searchapi.h")] - [DispId(0x6001000a)] - uint EnumerationDepth { get; [param: In] set; } + void put_EnumerationDepth(uint dwDepth); + + /// Gets the enumeration depth for this search root. + /// + /// Type: DWORD* + /// A pointer to the depth (number of levels) to enumerate. + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_enumerationdepth HRESULT + // get_EnumerationDepth( DWORD *pdwDepth ); + uint get_EnumerationDepth(); /// /// [ put_HostDepth may be altered or unavailable in subsequent versions of the operating system or product.] /// Sets a value that indicates how far into a host tree to crawl when indexing. /// + /// + /// Type: DWORD + /// The depth (number of levels) to crawl a host tree. + /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_hostdepth HRESULT put_HostDepth( + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_hostdepth HRESULT put_HostDepth( // DWORD dwDepth ); - [PInvokeData("searchapi.h")] - [DispId(0x6001000c)] - uint HostDepth { get; [param: In] set; } + void put_HostDepth(uint dwDepth); + + /// + /// [ get_HostDepth may be altered or unavailable in subsequent versions of the operating system or product.] + /// Gets a value that indicates how far into a host tree to crawl when indexing. + /// + /// + /// Type: DWORD* + /// On return, points to the depth (number of levels) to crawl in the host tree. + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_hostdepth HRESULT get_HostDepth( + // DWORD *pdwDepth ); + uint get_HostDepth(); /// /// Sets a BOOL value that indicates whether the search engine should follow subdirectories and hierarchical scopes for /// this search root. /// + /// + /// Type: BOOL + /// TRUE to follow directories or hierarchical scopes, otherwise FALSE. The default for this value is TRUE. + /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_followdirectories HRESULT + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_followdirectories HRESULT // put_FollowDirectories( BOOL fFollowDirectories ); - [PInvokeData("searchapi.h")] - [DispId(0x6001000e)] - bool FollowDirectories { [return: MarshalAs(UnmanagedType.Bool)] get; [param: In, MarshalAs(UnmanagedType.Bool)] set; } + void put_FollowDirectories([MarshalAs(UnmanagedType.Bool)] bool fFollowDirectories); + + /// Gets a BOOL value that indicates whether the search engine follows subdirectories and hierarchical scopes. + /// + /// Type: BOOL* + /// On return, points to TRUE if the search engine follows subdirectories and hierarchical scopes; otherwise, FALSE. + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_followdirectories HRESULT + // get_FollowDirectories( BOOL *pfFollowDirectories ); + [return: MarshalAs(UnmanagedType.Bool)] + bool get_FollowDirectories(); /// Sets the type of authentication required to access the URLs under this search root. + /// + /// Type: AUTH_TYPE + /// A value from the AUTH_TYPE enumeration that indicates the authentication type. + /// /// - /// The CrawlScopeCommandLine code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to define command - /// line options for Crawl Scope Manager (CSM) indexing operations. + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. /// - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_authenticationtype HRESULT + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_authenticationtype HRESULT // put_AuthenticationType( AUTH_TYPE authType ); - [PInvokeData("searchapi.h")] - [DispId(0x60010010)] - AUTH_TYPE AuthenticationType { get; [param: In] set; } + void put_AuthenticationType(AUTH_TYPE authType); + + /// Retrieves the type of authentication needed to access the URLs under this this search root. + /// + /// Type: AUTH_TYPE* + /// + /// A pointer to a value from the AUTH_TYPE enumeration that indicates the authentication type required to access URLs under + /// this search root. + /// + /// + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_authenticationtype HRESULT + // get_AuthenticationType( AUTH_TYPE *pAuthType ); + AUTH_TYPE get_AuthenticationType(); /// Not implemented. - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_user HRESULT put_User( LPCWSTR + /// This parameter is unused. + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_user HRESULT put_User( LPCWSTR // pszUser ); - [PInvokeData("searchapi.h")] - [DispId(0x60010012)] - string User { [return: MarshalAs(UnmanagedType.LPWStr)] get; [param: In, MarshalAs(UnmanagedType.LPWStr)] set; } + void put_User([MarshalAs(UnmanagedType.LPWStr)] string pszUser); /// Not implemented. - // https://docs.microsoft.com/en-us/windows/desktop/api/searchapi/nf-searchapi-isearchroot-put_password HRESULT put_Password( + /// This parameter is unused. + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_user HRESULT get_User( LPWSTR + // *ppszUser ); + [return: MarshalAs(UnmanagedType.LPWStr)] + string get_User(); + + /// Not implemented. + /// This parameter is unused. + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-put_password HRESULT put_Password( // LPCWSTR pszPassword ); - [PInvokeData("searchapi.h")] - [DispId(0x60010014)] - string Password { [return: MarshalAs(UnmanagedType.LPWStr)] get; [param: In, MarshalAs(UnmanagedType.LPWStr)] set; } + void put_Password([MarshalAs(UnmanagedType.LPWStr)] string pszPassword); + + /// Not implemented. + /// This parameter is unused. + /// + /// Windows 7 and later: Check out the CrawlScopeCommandLine code sample to see how to define command line options for + /// Crawl Scope Manager (CSM) indexing operations. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/searchapi/nf-searchapi-isearchroot-get_password HRESULT get_Password( + // LPWSTR *ppszPassword ); + [return: MarshalAs(UnmanagedType.LPWStr)] + string get_Password(); } /// Provides methods to define scope rules for crawling and indexing.