Added basic support for Windows Search

pull/30/head
David Hall 2019-01-04 15:19:49 -07:00
parent 76fa7e0eac
commit 0f725183f0
5 changed files with 2587 additions and 0 deletions

View File

@ -188,6 +188,65 @@ namespace Vanara.PInvoke
IEnumSTATSTG Clone();
}
/// <summary>
/// Enumerates objects with the IUnknown interface. It can be used to enumerate through the objects in a component containing
/// multiple objects.
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nn-objidl-ienumunknown
[PInvokeData("objidl.h", MSDNShortId = "5aaed96f-39c1-4201-80d0-a2a8a177b65e")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("00000100-0000-0000-C000-000000000046")]
public interface IEnumUnknown
{
/// <summary>Retrieves the specified number of items in the enumeration sequence.</summary>
/// <param name="celt">
/// The number of items to be retrieved. If there are fewer than the requested number of items left in the sequence, this method
/// retrieves the remaining elements.
/// </param>
/// <param name="rgelt">
/// <para>An array of enumerated items.</para>
/// <para>
/// The enumerator is responsible for calling AddRef, and the caller is responsible for calling Release through each pointer
/// enumerated. If celt is greater than 1, the caller must also pass a non-NULL pointer passed to pceltFetched to know how many
/// pointers to release.
/// </para>
/// </param>
/// <param name="pceltFetched">
/// The number of items that were retrieved. This parameter is always less than or equal to the number of items requested.
/// </param>
/// <returns>If the method retrieves the number of items requested, the return value is S_OK. Otherwise, it is S_FALSE.</returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ienumunknown-next HRESULT Next( ULONG celt, IUnknown
// **rgelt, ULONG *pceltFetched );
[PreserveSig]
HRESULT Next(uint celt, ref IntPtr rgelt, out uint pceltFetched);
/// <summary>Skips over the specified number of items in the enumeration sequence.</summary>
/// <param name="celt">The number of items to be skipped.</param>
/// <returns>If the method skips the number of items requested, the return value is S_OK. Otherwise, it is S_FALSE.</returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ienumunknown-skip HRESULT Skip( ULONG celt );
[PreserveSig]
HRESULT Skip(uint celt);
/// <summary>Resets the enumeration sequence to the beginning.</summary>
/// <remarks>
/// There is no guarantee that the same set of objects will be enumerated after the reset operation has completed. A static
/// collection is reset to the beginning, but it can be too expensive for some collections, such as files in a directory, to
/// guarantee this condition.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ienumunknown-reset HRESULT Reset( );
void Reset();
/// <summary>
/// <para>Creates a new enumerator that contains the same enumeration state as the current one.</para>
/// <para>
/// This method makes it possible to record a point in the enumeration sequence in order to return to that point at a later time.
/// The caller must release this new enumerator separately from the first enumerator.
/// </para>
/// </summary>
/// <returns>A pointer to the cloned enumerator object.</returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ienumunknown-clone HRESULT Clone( IEnumUnknown **ppenum );
IEnumUnknown Clone();
}
/// <summary>
/// The IStorage interface supports the creation and management of structured storage objects. Structured storage allows hierarchical
/// storage of information within a single file, and is often referred to as "a file system within a file". Elements of a structured

View File

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
namespace Vanara.PInvoke
{
@ -222,6 +223,473 @@ namespace Vanara.PInvoke
void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode);
}
/// <summary>
/// <para>
/// Provides the CLSID of an object that can be stored persistently in the system. Allows the object to specify which object handler
/// to use in the client process, as it is used in the default implementation of marshaling.
/// </para>
/// <para>
/// <c>IPersist</c> is the base interface for three other interfaces: IPersistStorage, IPersistStream, and IPersistFile. Each of
/// these interfaces, therefore, includes the GetClassID method, and the appropriate one of these three interfaces is implemented on
/// objects that can be serialized to a storage, a stream, or a file. The methods of these interfaces allow the state of these
/// objects to be saved for later instantiations, and load the object using the saved state. Typically, the persistence interfaces
/// are implemented by an embedded or linked object, and are called by the container application or the default object handler.
/// </para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nn-objidl-ipersist
[PInvokeData("objidl.h", MSDNShortId = "932eb0e2-35a6-482e-9138-00cff30508a9")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000010c-0000-0000-C000-000000000046")]
public interface IPersist
{
/// <summary>Retrieves the class identifier (CLSID) of the object.</summary>
/// <returns>
/// <para>
/// A pointer to the location that receives the CLSID on return. The CLSID is a globally unique identifier (GUID) that uniquely
/// represents an object class that defines the code that can manipulate the object's data.
/// </para>
/// <para>If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>GetClassID</c> method retrieves the class identifier (CLSID) for an object, used in later operations to load
/// object-specific code into the caller's context.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// A container application might call this method to retrieve the original CLSID of an object that it is treating as a different
/// class. Such a call would be necessary if a user performed an editing operation that required the object to be saved. If the
/// container were to save it using the treat-as CLSID, the original application would no longer be able to edit the object.
/// Typically, in this case, the container calls the OleSave helper function, which performs all the necessary steps. For this
/// reason, most container applications have no need to call this method directly.
/// </para>
/// <para>
/// The exception would be a container that provides an object handler for certain objects. In particular, a container
/// application should not get an object's CLSID and then use it to retrieve class specific information from the registry.
/// Instead, the container should use IOleObject and IDataObject interfaces to retrieve such class-specific information directly
/// from the object.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// Typically, implementations of this method simply supply a constant CLSID for an object. If, however, the object's
/// <c>TreatAs</c> registry key has been set by an application that supports emulation (and so is treating the object as one of a
/// different class), a call to <c>GetClassID</c> must supply the CLSID specified in the <c>TreatAs</c> key. For more information
/// on emulation, see CoTreatAsClass.
/// </para>
/// <para>
/// When an object is in the running state, the default handler calls an implementation of <c>GetClassID</c> that delegates the
/// call to the implementation in the object. When the object is not running, the default handler instead calls the ReadClassStg
/// function to read the CLSID that is saved in the object's storage.
/// </para>
/// <para>
/// If you are writing a custom object handler for your object, you might want to simply delegate this method to the default
/// handler implementation (see OleCreateDefaultHandler).
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>This method returns CLSID_StdURLMoniker.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersist-getclassid HRESULT GetClassID( CLSID *pClassID );
Guid GetClassID();
}
/// <summary>Enables the saving and loading of objects that use a simple serial stream for their storage needs.</summary>
/// <remarks>
/// <para>
/// One way in which this interface is used is to support OLE moniker implementations. Each of the OLE-provided moniker interfaces
/// provides an <c>IPersistStream</c> implementation through which the moniker saves or loads itself. An instance of the OLE generic
/// composite moniker class calls the <c>IPersistStream</c> methods of its component monikers to load or save the components in the
/// proper sequence in a single stream.
/// </para>
/// <para>IPersistStream URL Moniker Implementation</para>
/// <para>
/// The URL moniker implementation of <c>IPersistStream</c> is found on an URL moniker object, which supports IUnknown,
/// <c>IAsyncMoniker</c>, and IMoniker. The <c>IMoniker</c> interface inherits its definition from <c>IPersistStream</c> and thus,
/// the URL moniker also provides an implementation of <c>IPersistStream</c> as part of its implementation of <c>IMoniker</c>.
/// </para>
/// <para>
/// The IAsyncMoniker interface on an URL moniker is simply IUnknown (there are no additional methods); it is used to allow clients
/// to determine if a moniker supports asynchronous binding. To get a pointer to the IMoniker interface on this object, call the
/// <c>CreateURLMonikerEx</c> function. Then, to get a pointer to <c>IPersistStream</c>, call the QueryInterface method.
/// </para>
/// <para>
/// <c>IPersistStream</c>, in addition to inheriting its definition from IUnknown, also inherits the single method of IPersist, GetClassID.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nn-objidl-ipersiststream
[PInvokeData("objidl.h", MSDNShortId = "97ea64ee-d950-4872-add6-1f532a6eb33f")]
[ComImport, Guid("00000109-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPersistStream : IPersist
{
/// <summary>Retrieves the class identifier (CLSID) of the object.</summary>
/// <returns>
/// <para>
/// A pointer to the location that receives the CLSID on return. The CLSID is a globally unique identifier (GUID) that uniquely
/// represents an object class that defines the code that can manipulate the object's data.
/// </para>
/// <para>If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>GetClassID</c> method retrieves the class identifier (CLSID) for an object, used in later operations to load
/// object-specific code into the caller's context.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// A container application might call this method to retrieve the original CLSID of an object that it is treating as a different
/// class. Such a call would be necessary if a user performed an editing operation that required the object to be saved. If the
/// container were to save it using the treat-as CLSID, the original application would no longer be able to edit the object.
/// Typically, in this case, the container calls the OleSave helper function, which performs all the necessary steps. For this
/// reason, most container applications have no need to call this method directly.
/// </para>
/// <para>
/// The exception would be a container that provides an object handler for certain objects. In particular, a container
/// application should not get an object's CLSID and then use it to retrieve class specific information from the registry.
/// Instead, the container should use IOleObject and IDataObject interfaces to retrieve such class-specific information directly
/// from the object.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// Typically, implementations of this method simply supply a constant CLSID for an object. If, however, the object's
/// <c>TreatAs</c> registry key has been set by an application that supports emulation (and so is treating the object as one of a
/// different class), a call to <c>GetClassID</c> must supply the CLSID specified in the <c>TreatAs</c> key. For more information
/// on emulation, see CoTreatAsClass.
/// </para>
/// <para>
/// When an object is in the running state, the default handler calls an implementation of <c>GetClassID</c> that delegates the
/// call to the implementation in the object. When the object is not running, the default handler instead calls the ReadClassStg
/// function to read the CLSID that is saved in the object's storage.
/// </para>
/// <para>
/// If you are writing a custom object handler for your object, you might want to simply delegate this method to the default
/// handler implementation (see OleCreateDefaultHandler).
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>This method returns CLSID_StdURLMoniker.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersist-getclassid HRESULT GetClassID( CLSID *pClassID );
new Guid GetClassID();
/// <summary>Determines whether an object has changed since it was last saved to its stream.</summary>
/// <returns>This method returns S_OK to indicate that the object has changed. Otherwise, it returns S_FALSE.</returns>
/// <remarks>
/// <para>
/// Use this method to determine whether an object should be saved before closing it. The dirty flag for an object is
/// conditionally cleared in the IPersistStream::Save method.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// You should treat any error return codes as an indication that the object has changed. Unless this method explicitly returns
/// S_FALSE, assume that the object must be saved.
/// </para>
/// <para>
/// Note that the OLE-provided implementations of the <c>IPersistStream::IsDirty</c> method in the OLE-provided moniker
/// interfaces always return S_FALSE because their internal state never changes.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-isdirty HRESULT IsDirty( );
[PreserveSig]
HRESULT IsDirty();
/// <summary>Initializes an object from the stream where it was saved previously.</summary>
/// <param name="pstm">The PSTM.</param>
/// <remarks>
/// <para>
/// This method loads an object from its associated stream. The seek pointer is set as it was in the most recent
/// IPersistStream::Save method. This method can seek and read from the stream, but cannot write to it.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// Rather than calling <c>IPersistStream::Load</c> directly, you typically call the OleLoadFromStream function does the following:
/// </para>
/// <list type="number">
/// <item>
/// <term>Calls the ReadClassStm function to get the class identifier from the stream.</term>
/// </item>
/// <item>
/// <term>Calls the CoCreateInstance function to create an instance of the object.</term>
/// </item>
/// <item>
/// <term>Queries the instance for IPersistStream.</term>
/// </item>
/// <item>
/// <term>Calls <c>IPersistStream::Load</c>.</term>
/// </item>
/// </list>
/// <para>
/// The OleLoadFromStream function assumes that objects are stored in the stream with a class identifier followed by the object
/// data. This storage pattern is used by the generic, composite-moniker implementation provided by OLE.
/// </para>
/// <para>If the objects are not stored using this pattern, you must call the methods separately yourself.</para>
/// <para>URL Moniker Notes</para>
/// <para>
/// Initializes an URL moniker from data within a stream, usually stored there previously using its IPersistStream::Save (using
/// OleSaveToStream). The binary format of the URL moniker is its URL string in Unicode (may be a full or partial URL string, see
/// CreateURLMonikerEx for details). This is represented as a <c>ULONG</c> count of characters followed by that many Unicode characters.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-load HRESULT Load( IStream *pStm );
void Load([In, MarshalAs(UnmanagedType.Interface)] IStream pstm);
/// <summary>Saves an object to the specified stream.</summary>
/// <param name="pstm">The PSTM.</param>
/// <param name="fClearDirty">
/// Indicates whether to clear the dirty flag after the save is complete. If <c>TRUE</c>, the flag should be cleared. If
/// <c>FALSE</c>, the flag should be left unchanged.
/// </param>
/// <remarks>
/// <para>
/// <c>IPersistStream::Save</c> saves an object into the specified stream and indicates whether the object should reset its dirty flag.
/// </para>
/// <para>
/// The seek pointer is positioned at the location in the stream at which the object should begin writing its data. The object
/// calls the ISequentialStream::Write method to write its data.
/// </para>
/// <para>
/// On exit, the seek pointer must be positioned immediately past the object data. The position of the seek pointer is undefined
/// if an error returns.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// Rather than calling <c>IPersistStream::Save</c> directly, you typically call the OleSaveToStream helper function which does
/// the following:
/// </para>
/// <list type="number">
/// <item>
/// <term>Calls GetClassID to get the object's CLSID.</term>
/// </item>
/// <item>
/// <term>Calls the WriteClassStm function to write the object's CLSID to the stream.</term>
/// </item>
/// <item>
/// <term>Calls <c>IPersistStream::Save</c>.</term>
/// </item>
/// </list>
/// <para>If you call these methods directly, you can write other data into the stream after the CLSID before calling <c>IPersistStream::Save</c>.</para>
/// <para>The OLE-provided implementation of IPersistStream follows this same pattern.</para>
/// <para>Notes to Implementers</para>
/// <para>
/// The <c>IPersistStream::Save</c> method does not write the CLSID to the stream. The caller is responsible for writing the CLSID.
/// </para>
/// <para>
/// The <c>IPersistStream::Save</c> method can read from, write to, and seek in the stream; but it must not seek to a location in
/// the stream before that of the seek pointer on entry.
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>
/// Saves an URL moniker to a stream. The binary format of URL moniker is its URL string in Unicode (may be a full or partial URL
/// string, see CreateURLMonikerEx for details). This is represented as a <c>ULONG</c> count of characters followed by that many
/// Unicode characters.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-save HRESULT Save( IStream *pStm, BOOL
// fClearDirty );
void Save([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty);
/// <summary>Retrieves the size of the stream needed to save the object.</summary>
/// <returns>The size in bytes of the stream needed to save this object, in bytes.</returns>
/// <remarks>
/// <para>
/// This method returns the size needed to save an object. You can call this method to determine the size and set the necessary
/// buffers before calling the IPersistStream::Save method.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// The <c>GetSizeMax</c> implementation should return a conservative estimate of the necessary size because the caller might
/// call the IPersistStream::Save method with a non-growable stream.
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>
/// This method retrieves the maximum number of bytes in the stream that will be required by a subsequent call to
/// IPersistStream::Save. This value is sizeof(ULONG)==4 plus sizeof(WCHAR)*n where n is the length of the full or partial URL
/// string, including the NULL terminator.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-getsizemax HRESULT GetSizeMax(
// ULARGE_INTEGER *pcbSize );
ulong GetSizeMax();
}
/// <summary>
/// <para>A replacement for IPersistStream that adds an initialization method.</para>
/// <para>
/// This interface is not derived from IPersistStream; it is mutually exclusive with <c>IPersistStream</c>. An object chooses to
/// support only one of the two interfaces, based on whether it requires the InitNew method.
/// </para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nn-ocidl-ipersiststreaminit
[PInvokeData("ocidl.h", MSDNShortId = "49c413b3-3523-4602-9ec1-19f4e0fe5651")]
[ComImport, Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPersistStreamInit : IPersist
{
/// <summary>Retrieves the class identifier (CLSID) of the object.</summary>
/// <returns>
/// <para>
/// A pointer to the location that receives the CLSID on return. The CLSID is a globally unique identifier (GUID) that uniquely
/// represents an object class that defines the code that can manipulate the object's data.
/// </para>
/// <para>If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>GetClassID</c> method retrieves the class identifier (CLSID) for an object, used in later operations to load
/// object-specific code into the caller's context.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// A container application might call this method to retrieve the original CLSID of an object that it is treating as a different
/// class. Such a call would be necessary if a user performed an editing operation that required the object to be saved. If the
/// container were to save it using the treat-as CLSID, the original application would no longer be able to edit the object.
/// Typically, in this case, the container calls the OleSave helper function, which performs all the necessary steps. For this
/// reason, most container applications have no need to call this method directly.
/// </para>
/// <para>
/// The exception would be a container that provides an object handler for certain objects. In particular, a container
/// application should not get an object's CLSID and then use it to retrieve class specific information from the registry.
/// Instead, the container should use IOleObject and IDataObject interfaces to retrieve such class-specific information directly
/// from the object.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// Typically, implementations of this method simply supply a constant CLSID for an object. If, however, the object's
/// <c>TreatAs</c> registry key has been set by an application that supports emulation (and so is treating the object as one of a
/// different class), a call to <c>GetClassID</c> must supply the CLSID specified in the <c>TreatAs</c> key. For more information
/// on emulation, see CoTreatAsClass.
/// </para>
/// <para>
/// When an object is in the running state, the default handler calls an implementation of <c>GetClassID</c> that delegates the
/// call to the implementation in the object. When the object is not running, the default handler instead calls the ReadClassStg
/// function to read the CLSID that is saved in the object's storage.
/// </para>
/// <para>
/// If you are writing a custom object handler for your object, you might want to simply delegate this method to the default
/// handler implementation (see OleCreateDefaultHandler).
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>This method returns CLSID_StdURLMoniker.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersist-getclassid HRESULT GetClassID( CLSID *pClassID );
new Guid GetClassID();
/// <summary>
/// <para>Determines whether an object has changed since it was last saved to its stream.</para>
/// </summary>
/// <returns>
/// <para>This method returns S_OK to indicate that the object has changed. Otherwise, it returns S_FALSE.</para>
/// </returns>
/// <remarks>
/// <para>
/// Use this method to determine whether an object should be saved before closing it. The dirty flag for an object is
/// conditionally cleared in the IPersistStreamInit::Save method.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// You should treat any error return codes as an indication that the object has changed. Unless this method explicitly returns
/// S_FALSE, assume that the object must be saved.
/// </para>
/// <para>
/// Note that the OLE-provided implementations of the <c>IPersistStreamInit::IsDirty</c> method in the OLE-provided moniker
/// interfaces always return S_FALSE because their internal state never changes.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nf-ocidl-ipersiststreaminit-isdirty HRESULT IsDirty( );
[PreserveSig]
HRESULT IsDirty();
/// <summary>Initializes an object from the stream where it was saved previously.</summary>
/// <param name="pstm">The PSTM.</param>
/// <remarks>
/// <para>
/// This method loads an object from its associated stream. The seek pointer is set as it was in the most recent
/// IPersistStreamInit::Save method. This method can seek and read from the stream, but cannot write to it.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// Rather than calling <c>IPersistStreamInit::Load</c> directly, you typically call the OleLoadFromStream function does the following:
/// </para>
/// <list type="number">
/// <item>
/// <term>Calls the ReadClassStm function to get the class identifier from the stream.</term>
/// </item>
/// <item>
/// <term>Calls the CoCreateInstance function to create an instance of the object.</term>
/// </item>
/// <item>
/// <term>Queries the instance for IPersistStreamInit.</term>
/// </item>
/// <item>
/// <term>Calls <c>IPersistStreamInit::Load</c>.</term>
/// </item>
/// </list>
/// <para>
/// The OleLoadFromStream function assumes that objects are stored in the stream with a class identifier followed by the object
/// data. This storage pattern is used by the generic, composite-moniker implementation provided by OLE.
/// </para>
/// <para>If the objects are not stored using this pattern, you must call the methods separately yourself.</para>
/// <para>URL Moniker Notes</para>
/// <para>
/// Initializes an URL moniker from data within a stream, usually stored there previously using its IPersistStreamInit::Save
/// (using OleSaveToStream). The binary format of the URL moniker is its URL string in Unicode (may be a full or partial URL
/// string, see CreateURLMonikerEx for details). This is represented as a <c>ULONG</c> count of characters followed by that many
/// Unicode characters.
/// </para>
/// </remarks>
// HRESULT Load( LPSTREAM pStm ); https://msdn.microsoft.com/en-us/library/ms864774.aspx
void Load([In, MarshalAs(UnmanagedType.Interface)] IStream pstm);
/// <summary>Saves an object to the specified stream.</summary>
/// <param name="pstm">The PSTM.</param>
/// <param name="fClearDirty">
/// Indicates whether to clear the dirty flag after the save is complete. If <c>TRUE</c>, the flag should be cleared. If
/// <c>FALSE</c>, the flag should be left unchanged.
/// </param>
/// <remarks>
/// <para>
/// <c>IPersistStreamInit::Save</c> saves an object into the specified stream and indicates whether the object should reset its
/// dirty flag.
/// </para>
/// <para>
/// The seek pointer is positioned at the location in the stream at which the object should begin writing its data. The object
/// calls the ISequentialStream::Write method to write its data.
/// </para>
/// <para>
/// On exit, the seek pointer must be positioned immediately past the object data. The position of the seek pointer is undefined
/// if an error returns.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// The <c>IPersistStreamInit::Save</c> method does not write the CLSID to the stream. The caller is responsible for writing the CLSID.
/// </para>
/// <para>
/// The <c>IPersistStreamInit::Save</c> method can read from, write to, and seek in the stream; but it must not seek to a
/// location in the stream before that of the seek pointer on entry.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nf-ocidl-ipersiststreaminit-save HRESULT Save( LPSTREAM pStm, BOOL
// fClearDirty );
void Save([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty);
/// <summary>Retrieves the size of the stream needed to save the object.</summary>
/// <returns>The size in bytes of the stream needed to save this object, in bytes.</returns>
/// <remarks>
/// <para>
/// This method returns the size needed to save an object. You can call this method to determine the size and set the necessary
/// buffers before calling the IPersistStreamInit::Save method.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// The <c>GetSizeMax</c> implementation should return a conservative estimate of the necessary size because the caller might
/// call the IPersistStreamInit::Save method with a non-growable stream.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nf-ocidl-ipersiststreaminit-getsizemax HRESULT GetSizeMax(
// ULARGE_INTEGER *pCbSize );
ulong GetSizeMax();
/// <summary>Initializes an object to a default state. This method is to be called instead of IPersistStreamInit::Load.</summary>
/// <remarks>If the object has already been initialized with IPersistStreamInit::Load, then this method must return E_UNEXPECTED.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/ocidl/nf-ocidl-ipersiststreaminit-initnew HRESULT InitNew( );
void InitNew();
}
/// <summary>
/// Indicates the number of menu items in each of the six menu groups of a menu shared between a container and an object server
/// during an in-place editing session. This is the mechanism for building a shared menu.

View File

@ -0,0 +1,199 @@
using System;
using System.Runtime.InteropServices;
using static Vanara.PInvoke.Ole32;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>
/// <para>Used by IFolderViewSettings::GetViewMode and ISearchFolderItemFactory::SetFolderLogicalViewMode to describe the view mode.</para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ne-shobjidl_core-folderlogicalviewmode typedef enum
// FOLDERLOGICALVIEWMODE { FLVM_UNSPECIFIED, FLVM_FIRST, FLVM_DETAILS, FLVM_TILES, FLVM_ICONS, FLVM_LIST, FLVM_CONTENT, FLVM_LAST } ;
[PInvokeData("shobjidl_core.h", MSDNShortId = "4b30a335-ed80-4774-82d4-bc93c95ee80c")]
public enum FOLDERLOGICALVIEWMODE
{
/// <summary>The view is not specified.</summary>
FLVM_UNSPECIFIED,
/// <summary>The minimum valid enumeration value. Used for validation purposes only.</summary>
FLVM_FIRST,
/// <summary>Details view.</summary>
FLVM_DETAILS,
/// <summary>Tiles view.</summary>
FLVM_TILES,
/// <summary>Icons view.</summary>
FLVM_ICONS,
/// <summary>Windows 7 and later. List view.</summary>
FLVM_LIST,
/// <summary>Windows 7 and later. Content view.</summary>
FLVM_CONTENT,
/// <summary>The maximum valid enumeration value. Used for validation purposes only.</summary>
FLVM_LAST,
}
/// <summary>
/// Exposes methods that create and modify search folders. The Set methods are called first to set up the parameters of the search.
/// When not called, default values will be used instead. ISearchFolderItemFactory::GetIDList and
/// ISearchFolderItemFactory::GetShellItem return the two forms of the search specified by these parameters.
/// </summary>
/// <remarks>To implement this interface use class ID <c>CLSID_SearchFolderItemFactory</c>.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-isearchfolderitemfactory
[PInvokeData("shobjidl_core.h", MSDNShortId = "a684b373-6de4-4b4a-bbae-85e1c5a7e04a")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("a0ffbc28-5482-4366-be27-3e81e78e06c2"), CoClass(typeof(SearchFolderItemFactory))]
public interface ISearchFolderItemFactory
{
/// <summary>Sets the search folder display name, as specified.</summary>
/// <param name="pszDisplayName">
/// <para>Type: <c>LPCWSTR</c></para>
/// <para>A pointer to a folder display name as a Unicode string.</para>
/// </param>
/// <remarks>Calling this method is required. A display name must be set.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setdisplayname
// HRESULT SetDisplayName( LPCWSTR pszDisplayName );
void SetDisplayName([MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName);
/// <summary>Sets a search folder type ID, as specified.</summary>
/// <param name="ftid">
/// <para>Type: <c>FOLDERTYPEID</c></para>
/// <para>The FOLDERTYPEID, which is a <c>GUID</c> used to identify folder types within the system. The default is <c>FOLDERTYPID_Library</c></para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setfoldertypeid
// HRESULT SetFolderTypeID( FOLDERTYPEID ftid );
void SetFolderTypeID(FOLDERTYPEID ftid);
/// <summary>
/// Sets folder logical view mode. The default settings are based on the which is set by the
/// ISearchFolderItemFactory::SetFolderTypeID method.
/// </summary>
/// <param name="flvm">
/// <para>Type: <c>FOLDERLOGICALVIEWMODE</c></para>
/// <para>The FOLDERLOGICALVIEWMODE value.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setfolderlogicalviewmode
// HRESULT SetFolderLogicalViewMode( FOLDERLOGICALVIEWMODE flvm );
void SetFolderLogicalViewMode(FOLDERLOGICALVIEWMODE flvm);
/// <summary>
/// Sets the search folder icon size, as specified. The default settings are based on the which is set by the
/// ISearchFolderItemFactory::SetFolderTypeID method.
/// </summary>
/// <param name="iIconSize">
/// <para>Type: <c>int</c></para>
/// <para>The icon size.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-seticonsize
// HRESULT SetIconSize( int iIconSize );
void SetIconSize(int iIconSize);
/// <summary>
/// Creates a new column list whose columns are all visible, given an array of PROPERTYKEY structures. The default is based on <c>FolderTypeID</c>.
/// </summary>
/// <param name="cVisibleColumns">
/// <para>Type: <c>UINT</c></para>
/// <para>The number of array elements.</para>
/// </param>
/// <param name="rgKey">
/// <para>Type: <c>const PROPERTYKEY*</c></para>
/// <para>A pointer to an array of PROPERTYKEY structures.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setvisiblecolumns
// HRESULT SetVisibleColumns( UINT cVisibleColumns, const PROPERTYKEY *rgKey );
void SetVisibleColumns(uint cVisibleColumns, [In] PROPERTYKEY[] rgKey);
/// <summary>Creates a list of sort column directions, as specified.</summary>
/// <param name="cSortColumns">
/// <para>Type: <c>UINT</c></para>
/// <para>The number of sort columns.</para>
/// </param>
/// <param name="rgSortColumns">
/// <para>Type: <c>SORTCOLUMN*</c></para>
/// <para>A pointer to an array of SORTCOLUMN structures containing sort direction. The default is <c>PKEY_ItemNameDisplay</c>.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setsortcolumns
// HRESULT SetSortColumns( UINT cSortColumns, SORTCOLUMN *rgSortColumns );
void SetSortColumns(uint cSortColumns, [In] SORTCOLUMN[] rgSortColumns);
/// <summary>Sets a group column, as specified. If no group column is specified, no grouping occurs.</summary>
/// <param name="keyGroup">
/// <para>Type: <c>REFPROPERTYKEY</c></para>
/// <para>A reference to a group column PROPERTYKEY.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setgroupcolumn
// HRESULT SetGroupColumn( REFPROPERTYKEY keyGroup );
void SetGroupColumn(in PROPERTYKEY keyGroup);
/// <summary>
/// Creates a list of stack keys, as specified. If this method is not called, by default the folder will not be stacked.
/// </summary>
/// <param name="cStackKeys">
/// <para>Type: <c>UINT</c></para>
/// <para>The number of stacks keys.</para>
/// </param>
/// <param name="rgStackKeys">
/// <para>Type: <c>PROPERTYKEY*</c></para>
/// <para>A pointer to an array of PROPERTYKEY structures containing stack key information.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setstacks HRESULT
// SetStacks( UINT cStackKeys, PROPERTYKEY *rgStackKeys );
void SetStacks(uint cStackKeys, [In] PROPERTYKEY[] rgStackKeys);
/// <summary>Sets search scope, as specified.</summary>
/// <param name="psiaScope">
/// <para>Type: <c>IShellItemArray*</c></para>
/// <para>
/// A pointer to the list of locations to search. The search will include this location and all its subcontainers. The default is <c>FOLDERID_Profile</c>
/// </para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setscope HRESULT
// SetScope( IShellItemArray *psiaScope );
void SetScope([In] IShellItemArray psiaScope);
/// <summary>
/// Sets the ICondition of the search. When this method is not called, the resulting search will have no filters applied.
/// </summary>
/// <param name="pCondition">
/// <para>Type: <c>ICondition*</c></para>
/// <para>A pointer to an ICondition interface.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-setcondition
// HRESULT SetCondition( ICondition *pCondition );
void SetCondition([In] ICondition pCondition);
/// <summary>Gets the search folder as a IShellItem.</summary>
/// <param name="riid">
/// <para>Type: <c>REFIID</c></para>
/// <para>A reference to the desired IID.</para>
/// </param>
/// <param name="ppv">
/// <para>Type: <c>void**</c></para>
/// <para>The IShellItem interface pointer specified in riid.</para>
/// </param>
/// <remarks>When the retrieved IShellItem is enumerated, it returns the search results.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-getshellitem
// HRESULT GetShellItem( REFIID riid, void **ppv );
void GetShellItem(in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
/// <summary>Gets the search folder as an ITEMIDLIST.</summary>
/// <returns>
/// <para>Type: <c>PIDLIST_ABSOLUTE*</c></para>
/// <para>When this method returns successfully, contains a PIDL.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-isearchfolderitemfactory-getidlist HRESULT
// GetIDList( PIDLIST_ABSOLUTE *ppidl );
PIDL GetIDList();
}
/// <summary>CLSID_SearchFolderItemFactory</summary>
[PInvokeData("shobjidl_core.h", MSDNShortId = "a684b373-6de4-4b4a-bbae-85e1c5a7e04a")]
[ComImport, Guid("14010e02-bbbd-41f0-88e3-eda371216584"), ClassInterface(ClassInterfaceType.None)]
public class SearchFolderItemFactory { }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,499 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using static Vanara.PInvoke.Ole32;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// <summary>
/// Provides a set of flags to be used with following methods to indicate the operation in ICondition::GetComparisonInfo,
/// ICondition2::GetLeafConditionInfo, IConditionFactory::MakeLeaf, IConditionFactory2::CreateBooleanLeaf,
/// IConditionFactory2::CreateIntegerLeaf, IConditionFactory2::MakeLeaf, IConditionFactory2::CreateStringLeaf, and IConditionGenerator::GenerateForLeaf.
/// </summary>
/// <remarks>
/// <para>
/// Provides a set of flags to be used with following methods to indicate the operation in ICondition::GetComparisonInfo,
/// ICondition2::GetLeafConditionInfo, IConditionFactory::MakeLeaf, IConditionFactory2::CreateBooleanLeaf,
/// IConditionFactory2::CreateIntegerLeaf, IConditionFactory2::MakeLeaf, IConditionFactory2::CreateStringLeaf, and IConditionGenerator::GenerateForLeaf.
/// </para>
/// <para>
/// In Windows 7, this enumeration is defined in structuredquerycondition.idl and structuredquerycondition.h. Prior to Windows 7 this
/// enumeration was declared in structuredquery.h and structuredquery.idl.
/// </para>
/// </remarks>
[PInvokeData("structuredquerycondition.h")]
public enum CONDITION_OPERATION
{
/// <summary>
/// An implicit comparison between the value of the property and the value of the constant. For an unresolved condition,
/// COP_IMPLICIT means that a user did not type an operation. In contrast, a resolved condition will always have a condition
/// other than the COP_IMPLICIT operation.
/// </summary>
COP_IMPLICIT,
/// <summary>The value of the property and the value of the constant must be equal.</summary>
COP_EQUAL,
/// <summary>The value of the property and the value of the constant must not be equal.</summary>
COP_NOTEQUAL,
/// <summary>The value of the property must be less than the value of the constant.</summary>
COP_LESSTHAN,
/// <summary>The value of the property must be greater than the value of the constant.</summary>
COP_GREATERTHAN,
/// <summary>The value of the property must be less than or equal to the value of the constant.</summary>
COP_LESSTHANOREQUAL,
/// <summary>The value of the property must be greater than or equal to the value of the constant.</summary>
COP_GREATERTHANOREQUAL,
/// <summary>The value of the property must begin with the value of the constant.</summary>
COP_VALUE_STARTSWITH,
/// <summary>The value of the property must end with the value of the constant.</summary>
COP_VALUE_ENDSWITH,
/// <summary>The value of the property must contain the value of the constant.</summary>
COP_VALUE_CONTAINS,
/// <summary>The value of the property must not contain the value of the constant.</summary>
COP_VALUE_NOTCONTAINS,
/// <summary>
/// The value of the property must match the value of the constant, where '?' matches any single character and '*' matches any
/// sequence of characters.
/// </summary>
COP_DOSWILDCARDS,
/// <summary>The value of the property must contain a word that is the value of the constant.</summary>
COP_WORD_EQUAL,
/// <summary>The value of the property must contain a word that begins with the value of the constant.</summary>
COP_WORD_STARTSWITH,
/// <summary>The application is free to interpret this in any suitable way.</summary>
COP_APPLICATION_SPECIFIC,
}
/// <summary>
/// Provides a set of flags to be used with the following methods to indicate the type of condition tree node:
/// ICondition::GetConditionType, IConditionFactory::MakeAndOr, IConditionFactory2::CreateCompoundFromArray, and IConditionFactory2::CreateCompoundFromObjectArray.
/// </summary>
/// <remarks>
/// <para>
/// In Windows 7, this enumeration is defined in structuredquerycondition.idl and structuredquerycondition.h. Prior to Windows 7 this
/// enumeration was declared in structuredquery.h and structuredquery.idl.
/// </para>
/// <para>
/// The StructuredQuerySample code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to read lines from the
/// console, parse them using the system schema, and display the resulting condition trees.
/// </para>
/// </remarks>
[PInvokeData("structuredquerycondition.h")]
public enum CONDITION_TYPE
{
/// <summary>Indicates that the values of the subterms are combined by "AND".</summary>
CT_AND_CONDITION,
/// <summary>Indicates that the values of the subterms are combined by "OR".</summary>
CT_OR_CONDITION,
/// <summary>Indicates a "NOT" comparison of subterms.</summary>
CT_NOT_CONDITION,
/// <summary>Indicates that the node is a comparison between a property and a constant value using a CONDITION_OPERATION.</summary>
CT_LEAF_CONDITION,
}
/// <summary>
/// Provides methods for retrieving information about a search condition. An <c>ICondition</c> object represents the result of
/// parsing an input string (using methods such as IQueryParser::Parse or IQuerySolution::GetQuery) into a tree of search condition
/// nodes. A node can be a logical AND, OR, or NOT for comparing subnodes, or it can be a leaf node comparing a property and a
/// constant value.
/// </summary>
/// <remarks>
/// <para>
/// Prior to Windows 7, this interface was only declared in structuredquery.h and structuredquery.idl. In Windows 7, this interface
/// is also defined in structuredquerycondition.idl and structuredquerycondition.h.
/// </para>
/// <para>
/// The StructuredQuerySample code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to read lines from the
/// console, parse them using the system schema, and display the resulting condition trees.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nn-structuredquerycondition-icondition
[PInvokeData("structuredquerycondition.h")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0FC988D4-C935-4b97-A973-46282EA175C8")]
public interface ICondition : IPersistStream
{
/// <summary>Retrieves the class identifier (CLSID) of the object.</summary>
/// <returns>
/// <para>
/// A pointer to the location that receives the CLSID on return. The CLSID is a globally unique identifier (GUID) that uniquely
/// represents an object class that defines the code that can manipulate the object's data.
/// </para>
/// <para>If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>GetClassID</c> method retrieves the class identifier (CLSID) for an object, used in later operations to load
/// object-specific code into the caller's context.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// A container application might call this method to retrieve the original CLSID of an object that it is treating as a different
/// class. Such a call would be necessary if a user performed an editing operation that required the object to be saved. If the
/// container were to save it using the treat-as CLSID, the original application would no longer be able to edit the object.
/// Typically, in this case, the container calls the OleSave helper function, which performs all the necessary steps. For this
/// reason, most container applications have no need to call this method directly.
/// </para>
/// <para>
/// The exception would be a container that provides an object handler for certain objects. In particular, a container
/// application should not get an object's CLSID and then use it to retrieve class specific information from the registry.
/// Instead, the container should use IOleObject and IDataObject interfaces to retrieve such class-specific information directly
/// from the object.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// Typically, implementations of this method simply supply a constant CLSID for an object. If, however, the object's
/// <c>TreatAs</c> registry key has been set by an application that supports emulation (and so is treating the object as one of a
/// different class), a call to <c>GetClassID</c> must supply the CLSID specified in the <c>TreatAs</c> key. For more information
/// on emulation, see CoTreatAsClass.
/// </para>
/// <para>
/// When an object is in the running state, the default handler calls an implementation of <c>GetClassID</c> that delegates the
/// call to the implementation in the object. When the object is not running, the default handler instead calls the ReadClassStg
/// function to read the CLSID that is saved in the object's storage.
/// </para>
/// <para>
/// If you are writing a custom object handler for your object, you might want to simply delegate this method to the default
/// handler implementation (see OleCreateDefaultHandler).
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>This method returns CLSID_StdURLMoniker.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersist-getclassid HRESULT GetClassID( CLSID *pClassID );
new Guid GetClassID();
/// <summary>Determines whether an object has changed since it was last saved to its stream.</summary>
/// <returns>This method returns S_OK to indicate that the object has changed. Otherwise, it returns S_FALSE.</returns>
/// <remarks>
/// <para>
/// Use this method to determine whether an object should be saved before closing it. The dirty flag for an object is
/// conditionally cleared in the IPersistStream::Save method.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// You should treat any error return codes as an indication that the object has changed. Unless this method explicitly returns
/// S_FALSE, assume that the object must be saved.
/// </para>
/// <para>
/// Note that the OLE-provided implementations of the <c>IPersistStream::IsDirty</c> method in the OLE-provided moniker
/// interfaces always return S_FALSE because their internal state never changes.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-isdirty HRESULT IsDirty( );
[PreserveSig]
new HRESULT IsDirty();
/// <summary>Initializes an object from the stream where it was saved previously.</summary>
/// <param name="pstm">The PSTM.</param>
/// <remarks>
/// <para>
/// This method loads an object from its associated stream. The seek pointer is set as it was in the most recent
/// IPersistStream::Save method. This method can seek and read from the stream, but cannot write to it.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// Rather than calling <c>IPersistStream::Load</c> directly, you typically call the OleLoadFromStream function does the following:
/// </para>
/// <list type="number">
/// <item>
/// <term>Calls the ReadClassStm function to get the class identifier from the stream.</term>
/// </item>
/// <item>
/// <term>Calls the CoCreateInstance function to create an instance of the object.</term>
/// </item>
/// <item>
/// <term>Queries the instance for IPersistStream.</term>
/// </item>
/// <item>
/// <term>Calls <c>IPersistStream::Load</c>.</term>
/// </item>
/// </list>
/// <para>
/// The OleLoadFromStream function assumes that objects are stored in the stream with a class identifier followed by the object
/// data. This storage pattern is used by the generic, composite-moniker implementation provided by OLE.
/// </para>
/// <para>If the objects are not stored using this pattern, you must call the methods separately yourself.</para>
/// <para>URL Moniker Notes</para>
/// <para>
/// Initializes an URL moniker from data within a stream, usually stored there previously using its IPersistStream::Save (using
/// OleSaveToStream). The binary format of the URL moniker is its URL string in Unicode (may be a full or partial URL string, see
/// CreateURLMonikerEx for details). This is represented as a <c>ULONG</c> count of characters followed by that many Unicode characters.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-load HRESULT Load( IStream *pStm );
new void Load([In, MarshalAs(UnmanagedType.Interface)] IStream pstm);
/// <summary>Saves an object to the specified stream.</summary>
/// <param name="pstm">The PSTM.</param>
/// <param name="fClearDirty">
/// Indicates whether to clear the dirty flag after the save is complete. If <c>TRUE</c>, the flag should be cleared. If
/// <c>FALSE</c>, the flag should be left unchanged.
/// </param>
/// <remarks>
/// <para>
/// <c>IPersistStream::Save</c> saves an object into the specified stream and indicates whether the object should reset its dirty flag.
/// </para>
/// <para>
/// The seek pointer is positioned at the location in the stream at which the object should begin writing its data. The object
/// calls the ISequentialStream::Write method to write its data.
/// </para>
/// <para>
/// On exit, the seek pointer must be positioned immediately past the object data. The position of the seek pointer is undefined
/// if an error returns.
/// </para>
/// <para>Notes to Callers</para>
/// <para>
/// Rather than calling <c>IPersistStream::Save</c> directly, you typically call the OleSaveToStream helper function which does
/// the following:
/// </para>
/// <list type="number">
/// <item>
/// <term>Calls GetClassID to get the object's CLSID.</term>
/// </item>
/// <item>
/// <term>Calls the WriteClassStm function to write the object's CLSID to the stream.</term>
/// </item>
/// <item>
/// <term>Calls <c>IPersistStream::Save</c>.</term>
/// </item>
/// </list>
/// <para>If you call these methods directly, you can write other data into the stream after the CLSID before calling <c>IPersistStream::Save</c>.</para>
/// <para>The OLE-provided implementation of IPersistStream follows this same pattern.</para>
/// <para>Notes to Implementers</para>
/// <para>
/// The <c>IPersistStream::Save</c> method does not write the CLSID to the stream. The caller is responsible for writing the CLSID.
/// </para>
/// <para>
/// The <c>IPersistStream::Save</c> method can read from, write to, and seek in the stream; but it must not seek to a location in
/// the stream before that of the seek pointer on entry.
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>
/// Saves an URL moniker to a stream. The binary format of URL moniker is its URL string in Unicode (may be a full or partial URL
/// string, see CreateURLMonikerEx for details). This is represented as a <c>ULONG</c> count of characters followed by that many
/// Unicode characters.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-save HRESULT Save( IStream *pStm, BOOL
// fClearDirty );
new void Save([In, MarshalAs(UnmanagedType.Interface)] IStream pstm, [In, MarshalAs(UnmanagedType.Bool)] bool fClearDirty);
/// <summary>Retrieves the size of the stream needed to save the object.</summary>
/// <returns>The size in bytes of the stream needed to save this object, in bytes.</returns>
/// <remarks>
/// <para>
/// This method returns the size needed to save an object. You can call this method to determine the size and set the necessary
/// buffers before calling the IPersistStream::Save method.
/// </para>
/// <para>Notes to Implementers</para>
/// <para>
/// The <c>GetSizeMax</c> implementation should return a conservative estimate of the necessary size because the caller might
/// call the IPersistStream::Save method with a non-growable stream.
/// </para>
/// <para>URL Moniker Notes</para>
/// <para>
/// This method retrieves the maximum number of bytes in the stream that will be required by a subsequent call to
/// IPersistStream::Save. This value is sizeof(ULONG)==4 plus sizeof(WCHAR)*n where n is the length of the full or partial URL
/// string, including the NULL terminator.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/nf-objidl-ipersiststream-getsizemax HRESULT GetSizeMax(
// ULARGE_INTEGER *pcbSize );
new ulong GetSizeMax();
/// <summary>
/// Retrieves the condition type for this search condition node, identifying it as a logical AND, OR, or NOT, or as a leaf node.
/// </summary>
/// <returns>
/// <para>Type: <c>CONDITION_TYPE*</c></para>
/// <para>Receives the CONDITION_TYPE enumeration for this node.</para>
/// </returns>
/// <remarks>
/// The StructuredQuerySample code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to read lines from
/// the console, parse them using the system schema, and display the resulting condition trees.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getconditiontype
// HRESULT GetConditionType( CONDITION_TYPE *pNodeType );
CONDITION_TYPE GetConditionType();
/// <summary>
/// Retrieves a collection of the subconditions of the search condition node and the IID of the interface for enumerating the collection.
/// </summary>
/// <param name="riid">
/// <para>Type: <c>REFIID</c></para>
/// <para>
/// The desired IID of the enumerating interface: either IID_IEnumUnknown, IID_IEnumVARIANT or (for a negation condition) IID_ICondition.
/// </para>
/// </param>
/// <param name="ppv">
/// <para>Type: <c>void**</c></para>
/// <para>
/// Receives a collection of zero or more ICondition objects. Each object is a subcondition of this condition node. If <paramref
/// name="riid"/> was IID_ICondition and this is a negation condition, this parameter receives the single subcondition.
/// </para>
/// </param>
/// <remarks>
/// <para>
/// The <paramref name="riid"/> parameter must be the <c>GUID</c> of an IEnumUnknown or IEnumVARIANT interface or in the case of
/// a negation node, IID_ICondition.
/// </para>
/// <para>If the subcondition is a negation node, <paramref name="ppv"/> is set to an enumeration of one element.</para>
/// <para>If the node is a conjunction or disjunction node, <paramref name="ppv"/> is set to an enumeration of the subconditions.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getsubconditions
// HRESULT GetSubConditions( REFIID riid, void **ppv );
void GetSubConditions(in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
/// <summary>Retrieves the property name, operation, and value from a leaf search condition node.</summary>
/// <param name="ppszPropertyName">
/// <para>Type: <c>LPWSTR*</c></para>
/// <para>Receives the name of the property of the leaf condition as a Unicode string.</para>
/// </param>
/// <param name="pcop">
/// <para>Type: <c>CONDITION_OPERATION*</c></para>
/// <para>Receives the operation of the leaf condition as a CONDITION_OPERATION enumeration.</para>
/// </param>
/// <param name="ppropvar">
/// <para>Type: <c>PROPVARIANT*</c></para>
/// <para>Receives the value of the leaf condition as a PROPVARIANT.</para>
/// </param>
/// <remarks>Any or all of the three parameters can be <c>NULL</c>.</remarks>
// 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);
/// <summary>Retrieves the semantic type of the value of the search condition node.</summary>
/// <param name="ppszValueTypeName">
/// <para>Type: <c>LPWSTR*</c></para>
/// <para>Receives either a pointer to the semantic type of the value as a Unicode string or <c>NULL</c>.</para>
/// </param>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getvaluetype
// HRESULT GetValueType( LPWSTR *ppszValueTypeName );
void GetValueType([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszValueTypeName);
/// <summary>Retrieves the character-normalized value of the search condition node.</summary>
/// <param name="ppszNormalization">
/// <para>Type: <c>LPWSTR*</c></para>
/// <para>Receives a pointer to a Unicode string representation of the value.</para>
/// </param>
/// <remarks>
/// In <c>Windows 7 and later</c>, if the value of the leaf node is <c>VT_EMPTY</c>, ppwszNormalization points to an empty
/// string. If the value is a string, such as VT_LPWSTR, VT_BSTR or VT_LPSTR, then ppwszNormalization is set to a
/// character-normalized form of the value. In other cases, ppwszNormalization is set to some other character-normalized string
/// representation of the value.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-getvaluenormalization
// HRESULT GetValueNormalization( LPWSTR *ppszNormalization );
void GetValueNormalization([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszNormalization);
/// <summary>
/// For a leaf node, <c>ICondition::GetInputTerms</c> retrieves information about what parts (or ranges) of the input string
/// produced the property, the operation, and the value for the search condition node.
/// </summary>
/// <param name="ppPropertyTerm">
/// <para>Type: <c>IRichChunk**</c></para>
/// <para>
/// Receives a pointer to an IRichChunk interface that provides information about what part of the input string produced the
/// property of the leaf node, if that can be determined; otherwise, this parameter is set to <c>NULL</c>.
/// </para>
/// </param>
/// <param name="ppOperationTerm">
/// <para>Type: <c>IRichChunk**</c></para>
/// <para>
/// Receives a pointer to an IRichChunk interface that provides information about what part of the input string produced the
/// operation of the leaf node, if that can be determined; otherwise, this parameter is set to <c>NULL</c>.
/// </para>
/// </param>
/// <param name="ppValueTerm">
/// <para>Type: <c>IRichChunk**</c></para>
/// <para>
/// Receives a pointer to an IRichChunk interface that provides information about what part of the input string produced the
/// value of the leaf node, if that can be determined; otherwise, this parameter is set to <c>NULL</c>.
/// </para>
/// </param>
/// <remarks>
/// <para>Any or all of the parameters ppPropertyTerm, ppOperationTerm and ppValueTerm can be <c>NULL</c>.</para>
/// <para>
/// Each IRichChunk object retrieved by this method represents a range of tokens from the input string. The range tokens
/// identifies the substring that produced the property, operation, or value of the input string. The <c>IRichChunk</c>'s
/// PROPVARIANT out parameter is not used.
/// </para>
/// </remarks>
// 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);
/// <summary>Creates a deep copy of this ICondition object.</summary>
/// <returns>
/// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns>
/// <remarks>
/// Because there are no methods for modifying an ICondition, there are few occasions when this method is necessary. In many
/// cases it is adequate to call the IUnknown::QueryInterface method on the <c>ICondition</c> to obtain an additional reference
/// to the same object.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nf-structuredquerycondition-icondition-clone
// HRESULT Clone( ICondition **ppc );
ICondition Clone();
}
/// <summary>Represents a chunk of data as a string and a PROPVARIANT value.</summary>
/// <remarks>
/// In Windows 7, this interface is defined in structuredquerycondition.idl and structuredquerycondition.h. Prior to Windows 7 this
/// interface was declared in structuredquery.h and structuredquery.idl.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/structuredquerycondition/nn-structuredquerycondition-irichchunk
[PInvokeData("structuredquerycondition.h")]
[ComImport, Guid("4FDEF69C-DBC9-454e-9910-B34F3C64B510"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IRichChunk
{
/// <summary>
/// <para>Retrieves the PROPVARIANT and input string that represents a chunk of data.</para>
/// </summary>
/// <param name="pFirstPos">
/// <para>Type: <c>ULONG*</c></para>
/// <para>Receives the zero-based starting position of the range. This parameter can be <c>NULL</c>.</para>
/// </param>
/// <param name="pLength">
/// <para>Type: <c>ULONG*</c></para>
/// <para>Receives the length of the range. This parameter can be <c>NULL</c>.</para>
/// </param>
/// <param name="ppsz">
/// <para>Type: <c>LPWSTR*</c></para>
/// <para>Receives the associated Unicode string value, or <c>NULL</c> if not available.</para>
/// </param>
/// <param name="pValue">
/// <para>Type: <c>PROPVARIANT*</c></para>
/// <para>Receives the associated PROPVARIANT value, or <c>VT_EMPTY</c> if not available. This parameter can be <c>NULL</c>.</para>
/// </param>
/// <returns>
/// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns>
/// <remarks>
/// <para>Prior to Windows 7, this was declared in structuredquery.idl and structuredquery.h.</para>
/// </remarks>
// 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);
}
}
}