This commit is contained in:
Yu Leng
2025-05-16 09:57:05 +08:00
parent be385bab47
commit eba008dda0
9 changed files with 34 additions and 47 deletions

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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,