diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SearchQuery.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SearchQuery.cs index 3bfc0133bc..e92f3866f2 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SearchQuery.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SearchQuery.cs @@ -295,11 +295,10 @@ internal sealed partial class SearchQuery : IDisposable try { - var cw = new StrategyBasedComWrappers(); var session = (IDBCreateSession)DataSourceManager.GetDataSource(); var guid = new Guid("0C733A8B-2A1C-11CE-ADE5-00AA0044773D"); - var hr = session.CreateSession(IntPtr.Zero, ref guid, out sessionPtr); + session.CreateSession(IntPtr.Zero, ref guid, out sessionPtr); if (sessionPtr == IntPtr.Zero) { diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ICommandText.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ICommandText.cs index 9a1a563f01..743cf79fce 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ICommandText.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ICommandText.cs @@ -15,7 +15,7 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("0C733A8B-2A1C-11CE-ADE5-00AA0044773D")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] public partial interface ICommandText { void Cancel(); @@ -26,5 +26,5 @@ public partial interface ICommandText void GetCommandText([Optional] Guid pguidDialect, out IntPtr ppwszCommand); - void SetCommandText(Guid rguidDialect, [MarshalAs(UnmanagedType.LPWStr)]string pwszCommand); + void SetCommandText(Guid rguidDialect, string pwszCommand); } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateCommand.cs index 507a2c4281..a97901e4a3 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateCommand.cs @@ -10,7 +10,7 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("0C733A8B-2A1C-11CE-ADE5-00AA0044773D")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] public partial interface IDBCreateCommand { void CreateCommand(IntPtr pUnkOuter, Guid riid, [MarshalAs(UnmanagedType.Interface)] out ICommandText ppCommand); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateSession.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateSession.cs index 771eb2de2b..82b1b4c9aa 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateSession.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBCreateSession.cs @@ -14,8 +14,8 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("0C733A5D-2A1C-11CE-ADE5-00AA0044773D")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] public partial interface IDBCreateSession { - int CreateSession(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppDBSession); + void CreateSession(IntPtr pUnkOuter, ref Guid riid, out IntPtr ppDBSession); } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBInitialize.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBInitialize.cs index f9de837651..eaa6993628 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBInitialize.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IDBInitialize.cs @@ -14,7 +14,7 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("0C733A8B-2A1C-11CE-ADE5-00AA0044773D")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] public partial interface IDBInitialize { void Initialize(); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IGetRow.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IGetRow.cs index b243861bee..7794a4550d 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IGetRow.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/IGetRow.cs @@ -15,10 +15,10 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("0C733A8B-2A1C-11CE-ADE5-00AA0044773D")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] public partial interface IGetRow { unsafe void GetRowFromHROW(IntPtr pUnkOuter, nuint hRow, Guid riid, out NativeMethods.IPropertyStore ppUnk); - unsafe void GetURLFromHROW(nuint hRow, [MarshalAs(UnmanagedType.LPWStr)] out string ppwszURL); + unsafe void GetURLFromHROW(nuint hRow, out string ppwszURL); } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchCatalogManager.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchCatalogManager.cs index 0d30068b5c..82f2642428 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchCatalogManager.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchCatalogManager.cs @@ -11,16 +11,15 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("AB310581-AC80-11D1-8DF3-00C04FB6EF50")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Please do not change the function name")] public partial interface ISearchCatalogManager { - [return: MarshalAs(UnmanagedType.BStr)] string get_Name(); - void GetParameter([MarshalAs(UnmanagedType.LPWStr)] string pszName, out IntPtr pValue); + void GetParameter(string pszName, out IntPtr pValue); - void SetParameter([MarshalAs(UnmanagedType.LPWStr)] string pszName, ref IntPtr pValue); + void SetParameter(string pszName, ref IntPtr pValue); void GetCatalogStatus(out uint pdwStatus, out uint pdwPausedReason); @@ -28,9 +27,9 @@ public partial interface ISearchCatalogManager void Reindex(); - void ReindexMatchingURLs([MarshalAs(UnmanagedType.LPWStr)] string pszPattern); + void ReindexMatchingURLs(string pszPattern); - void ReindexSearchRoot([MarshalAs(UnmanagedType.LPWStr)] string pszRoot); + void ReindexSearchRoot(string pszRoot); uint get_ConnectTimeout(); @@ -47,17 +46,17 @@ public partial interface ISearchCatalogManager [return: MarshalAs(UnmanagedType.LPWStr)] string URLBeingIndexed(); - void GetURLIndexingState([MarshalAs(UnmanagedType.LPWStr)] string pszURL, out uint pdwState); + void GetURLIndexingState(string pszURL, out uint pdwState); IntPtr GetPersistentItemsChangedSink(); - void RegisterViewForNotification([MarshalAs(UnmanagedType.LPWStr)] string pszView, IntPtr pViewNotify, out uint pdwCookie); + void RegisterViewForNotification(string pszView, IntPtr pViewNotify, out uint pdwCookie); IntPtr GetItemsChangedSink(); void UnregisterViewForNotification(uint dwCookie); - void SetExtensionClusion([MarshalAs(UnmanagedType.LPWStr)] string pszExtension, [MarshalAs(UnmanagedType.Bool)] bool fExclude); + void SetExtensionClusion(string pszExtension, [MarshalAs(UnmanagedType.Bool)] bool fExclude); void EnumerateExcludedExtensions(); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchManager.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchManager.cs index 981d485bfe..1c7f72bf9e 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchManager.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchManager.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.Marshalling; @@ -11,44 +10,40 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("AB310581-AC80-11D1-8DF3-00C04FB6EF69")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Please do not change the function name")] public partial interface ISearchManager { - void GetIndexerVersion(out uint pdwMajor, out uint pdwMinor); - - [return: MarshalAs(UnmanagedType.BStr)] string GetIndexerVersionStr(); - void GetParameter([MarshalAs(UnmanagedType.LPWStr)] string pszName, [MarshalAs(UnmanagedType.Struct)] out object pValue); + void GetIndexerVersion(out uint pdwMajor, out uint pdwMinor); - void SetParameter([MarshalAs(UnmanagedType.LPWStr)] string pszName, [MarshalAs(UnmanagedType.Struct)] ref object pValue); + void GetParameter(string pszName, [MarshalAs(UnmanagedType.Struct)] out object pValue); + + void SetParameter(string pszName, [MarshalAs(UnmanagedType.Struct)] ref object pValue); [return: MarshalAs(UnmanagedType.Bool)] bool get_UseProxy(); - [return: MarshalAs(UnmanagedType.BStr)] string get_BypassList(); void SetProxy( - [MarshalAs(UnmanagedType.BStr)] string pszProxyName, + string pszProxyName, [MarshalAs(UnmanagedType.Bool)] bool fLocalBypass, - [MarshalAs(UnmanagedType.BStr)] string pszBypassList, + string pszBypassList, uint dwPortNumber); [return: MarshalAs(UnmanagedType.Interface)] - ISearchCatalogManager GetCatalog([MarshalAs(UnmanagedType.LPWStr)] string pszCatalog); + ISearchCatalogManager GetCatalog(string pszCatalog); - [return: MarshalAs(UnmanagedType.BStr)] string get_UserAgent(); - void put_UserAgent([MarshalAs(UnmanagedType.BStr)] string pszUserAgent); + void put_UserAgent(string pszUserAgent); - [return: MarshalAs(UnmanagedType.BStr)] string get_ProxyName(); - uint get_PortNumber(); - [return: MarshalAs(UnmanagedType.Bool)] bool get_LocalBypass(); + + uint get_PortNumber(); } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchQueryHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchQueryHelper.cs index 1f66fe03e0..93bf188bf1 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchQueryHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Indexer/SystemSearch/ISearchQueryHelper.cs @@ -11,11 +11,10 @@ namespace Microsoft.CmdPal.Ext.Indexer.Indexer.SystemSearch; [Guid("AB310581-AC80-11D1-8DF3-00C04FB6EF63")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] -[GeneratedComInterface] +[GeneratedComInterface(StringMarshalling = StringMarshalling.Utf16)] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1212:Property accessors should follow order", Justification = "The order of the property accessors must match the order in which the methods were defined in the vtable")] public partial interface ISearchQueryHelper { - [return: MarshalAs(UnmanagedType.LPWStr)] string GetConnectionString(); uint GetQueryContentLocale(); @@ -28,28 +27,23 @@ public partial interface ISearchQueryHelper [return: MarshalAs(UnmanagedType.Interface)] object GetQuerySyntax(); - [return: MarshalAs(UnmanagedType.LPWStr)] string GetQueryContentProperties(); - void SetQueryContentProperties([MarshalAs(UnmanagedType.LPWStr)] string pszProperties); + void SetQueryContentProperties(string pszProperties); - [return: MarshalAs(UnmanagedType.LPWStr)] string GetQuerySelectColumns(); - void SetQuerySelectColumns([MarshalAs(UnmanagedType.LPWStr)] string pszColumns); + void SetQuerySelectColumns(string pszColumns); - [return: MarshalAs(UnmanagedType.LPWStr)] string GetQueryWhereRestrictions(); - void SetQueryWhereRestrictions([MarshalAs(UnmanagedType.LPWStr)] string pszRestrictions); + void SetQueryWhereRestrictions(string pszRestrictions); - [return: MarshalAs(UnmanagedType.LPWStr)] string GetQuerySorting(); - void SetQuerySorting([MarshalAs(UnmanagedType.LPWStr)] string pszSorting); + void SetQuerySorting(string pszSorting); - [return: MarshalAs(UnmanagedType.LPWStr)] - string GenerateSQLFromUserQuery([MarshalAs(UnmanagedType.LPWStr)] string pszQuery); + string GenerateSQLFromUserQuery(string pszQuery); void WriteProperties( int itemID,