diff --git a/PInvoke/UrlMon/UrlMon.Interfaces.cs b/PInvoke/UrlMon/UrlMon.Interfaces.cs new file mode 100644 index 00000000..5a37c9f0 --- /dev/null +++ b/PInvoke/UrlMon/UrlMon.Interfaces.cs @@ -0,0 +1,1324 @@ +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; +using static Vanara.PInvoke.Ole32; + +namespace Vanara.PInvoke +{ + public static partial class UrlMon + { + /// + /// Provides methods that enable the client program that is using an asynchronous moniker to control the progress of the bind operation. + /// + /// + /// + /// An asynchronous moniker calls the client's IBindStatusCallback::OnStartBinding method to provide the client program with + /// a pointer to the IBinding interface. + /// + /// The IID for this interface is . + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775071(v%3Dvs.85) + [PInvokeData("Urlmon.h")] + [ComImport, Guid("79EAC9C0-BAF9-11CE-8C82-00AA004BA90B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IBinding + { + /// Ends the bind operation. + /// + /// This method cannot be called from an implementation of the OnStartBinding method. + /// + /// After it aborts the bind operation, the client must release any pointers that were obtained during the binding. No + /// IBindStatusCallback notifications are called, except OnStopBinding. + /// + /// The bind operation does not terminate by releasing the last IBinding interface. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775068(v=vs.85) + // HRESULT Abort(); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Abort(); + + /// Suspends the bind operation. + /// + /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Windows Internet Explorer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775074(v=vs.85) + // HRESULT Suspend(); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Suspend(); + + /// + /// This method resumes the bind operation. + /// Parameters + /// None. + /// Return Values + /// Returns S_OK if successful or an error value otherwise. + /// Remarks + /// + /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Microsoft Internet Explorer. + /// + /// Requirements + /// OS Versions: Windows CE .NET 4.0 and later. Header: Urlmon.h, Urlmon.idl. Link Library: Urlmon.lib. + /// Last updated on Saturday, April 10, 2004 + /// © 1992-2003 Microsoft Corporation. All rights reserved. + /// + /// + /// + /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Microsoft Internet Explorer. + /// + /// Requirements + /// OS Versions: Windows CE .NET 4.0 and later. Header: Urlmon.h, Urlmon.idl. Link Library: Urlmon.lib. + /// Last updated on Saturday, April 10, 2004 + /// © 1992-2003 Microsoft Corporation. All rights reserved. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms928797(v=msdn.10) + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void Resume(); + + /// Sets the priority of the bind operation. + /// + /// A long integer value that contains the priority to set. This can be one of the values used by GetThreadPriority and SetThreadPriority. + /// + /// + /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Windows Internet Explorer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775073(v=vs.85) + // HRESULT SetPriority( long nPriority ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void SetPriority([In] int nPriority); + + /// Gets the priority of the bind operation. + /// + /// The address of a long integer value that receives the current priority of the bind operation. This can be one of the values + /// used by GetThreadPriority and SetThreadPriority. + /// + /// + /// This method is not currently implemented by the default asynchronous pluggable protocols that are provided by Windows + /// Internet Explorer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775070(v=vs.85) + // HRESULT GetPriority( [out] long *pnPriority ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + int GetPriority(); + + /// Gets the protocol-specific outcome of a bind operation. + /// [out]A pointer to the CLSID variable for the protocol used. + /// + /// [out]A pointer to an unsigned long integer variable that contains the protocol-specific bind result string. + /// + /// [out]A pointer to the string variable that contains the protocol-specific bind result. + /// [in, out]Reserved. Must be set to 0. + /// Returns S_OK if successful, or E_INVALIDARG if one of the parameters is not valid. + /// + /// This method typically is called by the client of an asynchronous moniker when the client's OnStopBinding method is called. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775069(v=vs.85) + // HRESULT GetBindResult( [out] CLSID *pclsidProtocol, [out] DWORD *pdwResult, [out] LPOLESTR *pszResult, [in, out] DWORD + // *pdwReserved ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetBindResult(out Guid pclsidProtocol, out uint pdwResult, [MarshalAs(UnmanagedType.LPWStr)] out string pszResult, [In, Out] ref uint dwReserved); + } + + /// Accepts information on an asynchronous bind operation. + /// + /// + /// A client that requests an asynchronous bind operation must provide a notification object, which exposes the + /// IBindStatusCallback interface. The asynchronous moniker provides information on the bind operation to the client by + /// calling notification methods on the client's IBindStatusCallback interface. This interface enables the client to pass + /// additional bind information to the moniker by calling the IBindStatusCallback::GetBindInfo and + /// IBindStatusCallback::GetPriority methods after receiving a call from IMoniker::BindToObject or IMoniker::BindToStorage. + /// + /// Only the last IBindStatusCallback interface that was registered is called. + /// The IID for this interface is . + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775060%28v%3dvs.85%29 + [PInvokeData("Urlmon.h")] + [ComImport, Guid("79eac9c1-baf9-11ce-8c82-00aa004ba90b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IBindStatusCallback + { + /// + /// Notifies the client about the callback methods that it is registered to receive. This notification is a response to the + /// flags the client requested in the RegisterBindStatusCallback function. + /// + /// Reserved. Must be set to 0. + /// + /// A pointer to the IBinding interface of the current bind operation. This cannot be NULL. The client can call AddRef on this + /// pointer to keep a reference to the binding object. + /// + /// + /// + /// Typically, asynchronous monikers call this method before the call to the IMoniker::BindToStorage method or the + /// IMoniker::BindToObject method has returned. + /// + /// + /// In the call to this method, the moniker also provides the client with a pointer to the IBinding interface for the + /// binding object associated with the current bind operation. The client can use the IBinding interface to control the + /// progress of the bind operation. + /// + /// + /// To keep a reference to the binding object, the client must store the pointer to the IBinding interface and call + /// AddRef on it. When the client no longer requires the reference, it must call Release on it. Note that calling Release does + /// not cancel the bind operation; it frees the reference to the IBinding interface sent in the callback. + /// + /// + /// Client applications that implement the IBindStatusCallback interface can return E_NOTIMPL or S_OK, if they don't want + /// to receive this notification. + /// + /// + /// The Abort method does not work properly in an implementation of IBindStatusCallback::OnStartBinding. To abort + /// the binding, IBindStatusCallback::OnStartBinding should return E_FAIL. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775065%28v%3dvs.85%29 + // HRESULT OnStartBinding( DWORD dwReserved, IBinding *pib ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnStartBinding([Optional] uint dwReserved, [In, MarshalAs(UnmanagedType.Interface)] IBinding pib); + + /// Gets the priority for the bind operation when it is called by an asynchronous moniker. + /// + /// A long integer value that indicates the priority of this bind operation. Priorities can be any of the constants defined for + /// prioritizing threads. For details, see the Win32 documentation for SetThreadPriority and GetThreadPriority. + /// + /// + /// + /// The moniker calls this method prior to initiating the bind operation, to get the priority for the bind operation. This + /// method can be called at any time during the bind operation, if the moniker has to make new priority decisions. + /// + /// + /// The moniker can use pnPriority to set the priority of a thread that is associated with a bind operation. Typically, it + /// interprets the priority to perform its own scheduling among multiple bind operations. Note that the policy for determining + /// priority for URL monikers is not yet determined. The moniker must not change the priority of the thread that is used to call + /// IMoniker::BindToStorage or IMoniker::BindToObject. + /// + /// + /// Applications that implement the IBindStatusCallback interface can return E_UNIMPL or S_OK, if they don't want to + /// receive this notification. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775059(v=vs.85) + // HRESULT GetPriority( [out] long *pnPriority ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + int GetPriority(); + + /// This method is not implemented. + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnLowResource([Optional] uint reserved); + + /// Indicates the progress of the bind operation. + /// + /// An unsigned long integer that contains the current progress of the bind operation relative to the expected maximum that is + /// indicated in the ulProgressMax parameter. + /// + /// + /// An unsigned long integer that contains the expected maximum value of the ulProgress parameter for the duration of calls to + /// IBindStatusCallback::OnProgress for this bind operation. Note that this value might change across calls to this method. A + /// value of zero means that the maximum value of ulProgress is unknown; for example, in the IMoniker::BindToStorage method when + /// the data download size is unknown. + /// + /// + /// An unsigned long integer that Additional information regarding the progress of the bind operation. This can be any of the + /// BINDSTATUS values. + /// + /// + /// The address of a string value that contains the textual information that indicates the current progress of the bind + /// operation. The text reflects the BINDSTATUS value of the ulStatusCode parameter and is appropriate for display in the user + /// interface of the client. + /// + /// + /// + /// The moniker calls this method repeatedly to indicate the current progress of the bind operation, typically, at reasonable + /// intervals during a lengthy operation. + /// + /// + /// The client can use the progress notification to provide progress information to the user from the ulProgress, ulProgressMax, + /// and szStatusText parameters, or to make programmatic decisions based on the ulStatusCode parameter. + /// + /// + /// Client applications that implement the IBindStatusCallback interface can return E_NOTIMPL or S_OK, if they don't have + /// to receive this notification. + /// + /// + /// Windows Internet Explorer 8. If ulStatusCode is set to BINDSTATUS_64BIT_PROGRESS, then szStatusText contains a string + /// representing the progress of the download as two 64-bit numbers (representing ulProgress and ulProgressMax) separated by a comma. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775064(v=vs.85) + // HRESULT OnProgress( unsigned long ulProgress, unsigned long ulProgressMax, unsigned long ulStatusCode, // LPCWSTR + // szStatusText ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnProgress([In] uint ulProgress, [In] uint ulProgressMax, [In] BINDSTATUS ulStatusCode, [In, MarshalAs(UnmanagedType.LPWStr)] string szStatusText); + + /// This method indicates the end of the bind operation. + /// Status code returned from the bind operation. + /// + /// Address of a string value that contains the status text. In case of error, this text describes the error. In the current + /// implementation of URL monikers, this string is empty. + /// + /// + /// + /// This method is always called, whether the bind operation succeeded, failed, or was aborted by a client. At this point the + /// moniker client can use IBinding::GetBindResult to query for protocol-specific information about the outcome of the + /// bind operation. When this method has completed, the moniker client must call Release on the IBinding pointer + /// it received in IBindStatusCallback::OnStartBinding. + /// + /// + /// Because URL monikers work asynchronously, the status code returned by IBindStatusCallback::OnStopBinding and the + /// status code returned by the binding methods, such as IMoniker::BindToStorage and IMoniker::BindToObject, might differ. + /// + /// + /// Client applications that implement the IBindStatusCallback interface can return E_UNIMPL or S_OK if they are not + /// interested in receiving this notification. + /// + /// + /// https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms928805(v=msdn.10) + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnStopBinding([In] HRESULT hresult, [In, MarshalAs(UnmanagedType.LPWStr)] string szError); + + /// Provides information about how the bind operation is handled when it is called by an asynchronous moniker. + /// + /// [out]The address of an unsigned integer value that contains a combination of values that are taken from the BINDF + /// enumeration and indicate how the bind process is handled. + /// + /// + /// [in, out]The address of the BINDINFO structure, which describes the client application's requirements for binding. + /// + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. + /// + /// + /// The moniker calls this method in its implementations of the IMoniker::BindToObject method and the IMoniker::BindToStorage + /// method to get information about the specific bind operation. + /// + /// + /// Asynchronous moniker clients should be aware that a moniker might call this method more than one time during a bind + /// operation. A proper implementation of IBindStatusCallback::GetBindInfo prepares for this possibility. If data is + /// returned in the pbindinfo parameter, the implementation should allocate the appropriate data (szExtraInfo or stgmedData) at + /// the time of each call. In this way, if the callback isn't called, data isn't allocated; if the callback is called more than + /// one time, it works correctly. The first time this callback is received by the asynchronous moniker client is prior to the + /// call to IMoniker::BindToStorage or IMoniker::BindToObject. + /// + /// + /// Even when the value of grfBindInfoF is BINDF_ASYNCHRONOUS, it is possible that the original call to IMoniker::BindToStorage + /// or IMoniker::BindToObject might return synchronously, instead of returning the MK_S_ASYNCHRONOUS flag. Clients of + /// asynchronous monikers should always prepare for this possibility. Specifically, to avoid memory leaks, it is important to + /// make sure to release the pointer that is returned by a call to either method. + /// + /// + /// One way to deal with this issue is to call your own implementation of IBindStatusCallback::OnDataAvailable or + /// IBindStatusCallback::OnObjectAvailable to use the same code path (regardless of whether you bind synchronously or asynchronously). + /// + /// + /// If the BINDF_PULLDATA value is not set in the grfBindInfoF parameter, Urlmon.dll sets the BINDF_NEEDFILE + /// value. If BINDF_NEEDFILE is set, the binding of resources that cannot be cached (such as an HTTPS resource) fail. + /// + /// + /// Warning The size of the BINDINFO structure changed with the release of Microsoft Internet Explorer 4.0. + /// Developers must write code that checks the size of the BINDINFO structure that is passed into their implementation of + /// this method before it writes to members of the structure. For more information, see Handling BINDINFO Structures. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775058(v=vs.85) + // HRESULT GetBindInfo( [out] DWORD *grfBINDF, [in, out] BINDINFO *pbindinfo ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void GetBindInfo(out BINDF grfBINDF, [In, Out] ref BINDINFO pbindinfo); + + /// Provides data to the client as it becomes available during asynchronous bind operations. + /// + /// [in]An unsigned long integer value from the BSCF enumeration that indicates the kind of data available. + /// + /// + /// [in]An unsigned long integer value that contains the size, in bytes, of the total data available from the current bind operation. + /// + /// + /// [in]The address of the FORMATETC structure that indicates the format of the available data. This parameter is used when the + /// bind operation results from the IMoniker::BindToStorage method. If there is no format associated with the available data, + /// pformatetc might contain CF_NULL. Each different call to IBindStatusCallback::OnDataAvailable can pass in a new value + /// for this parameter; every call always points to the same data. + /// + /// + /// [in]The address of the STGMEDIUM structure that contains pointers to the interfaces (such as IStream and IStorage) that can + /// be used to access the data. In the asynchronous case, client applications might receive a second pointer to the IStream or + /// IStorage interface from the IMoniker::BindToStorage method. The client application must call Release on the interfaces to + /// avoid memory leaks. + /// + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. + /// + /// + /// During asynchronous IMoniker::BindToStorage bind operations, an asynchronous moniker calls this method to provide data to + /// the client as it becomes available. + /// + /// + /// Note that the behavior of the storage returned in pstgmed depends on the BINDF flags returned in the + /// IBindStatusCallback::GetBindInfo method. This storage can be asynchronous or blocking, and the bind operation can + /// follow a data pull model or a data push model. For BINDF bind operations, it is not possible to seek backward into + /// data streams that are provided in IBindStatusCallback::OnDataAvailable. On the other hand, for data push model bind + /// operations, it is possible to seek back into a data stream, and to read any data that has been downloaded for an ongoing + /// IMoniker::BindToStorage operation. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775061(v=vs.85) + // HRESULT OnDataAvailable( DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnDataAvailable([In] BSCF grfBSCF, [In] uint dwSize, in FORMATETC pFormatetc, in STGMEDIUM pStgmed); + + /// Passes the requested object interface pointer to the client. + /// [in]The interface identifier of the requested interface. + /// + /// [in]The address of the IUnknown interface on the object that is requested in the call to IMoniker::BindToObject. The client + /// should call AddRef on this pointer to maintain a reference to the object. + /// + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. + /// + /// This method is called in response to an IMoniker::BindToObject operation. The method is never called for + /// IMoniker::BindToStorage operations. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775063(v=vs.85) + // HRESULT OnObjectAvailable( REFIID riid, IUnknown *punk ); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] + void OnObjectAvailable(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object punk); + } + + /// Implemented by the client application to create temporary pluggable protocol handlers. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767757(v%3Dvs.85) + [PInvokeData("Urlmon.h")] + [ComImport, Guid("79eac9e7-baf9-11ce-8c82-00aa004ba90b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IInternetSession + { + /// Registers a temporary pluggable namespace handler on the current process. + /// + /// A pointer to an IClassFactory interface where an IInternetProtocol object can be created. The object's reference count is increased. + /// + /// A reference to the CLSID of the namespace. Passing CLSID_NULL is discouraged. + /// A string value that contains the protocol to be handled. + /// Unused. Set to 0. + /// Unused. Set to NULL. + /// Reserved. Must be set to 0. + /// + /// + /// The IInternetSession::RegisterNameSpace method enables an interface to handle requests for the specified protocol + /// namespace. A single interface can be registered multiple times for each namespace that it can handle. Because pluggable + /// protocol handlers are not chained, only the last handler to be registered will be active; therefore, it is better to create + /// a new namespace, rather than reuse an existing one. + /// + /// + /// This method registers a pluggable namespace handler only on the current process; no other processes are affected by this + /// method. An application can register a pluggable namespace handler for a particular period of time. When finished, it should + /// call IInternetSession::UnregisterNameSpace to remove the registration. + /// + /// + /// Note Registering namespace handlers for HTTP and HTTPS protocols is not recommended. Doing so within the Internet + /// Explorer process incurs a performance penalty when browsing. + /// + /// + /// The ppwzPatterns and cPatterns parameters are unused; the registered pluggable namespace handler is called for all protocol requests. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767759%28v%3dvs.85%29 + // HRESULT retVal = object.RegisterNameSpace(pCF, rclsid, pwzProtocol, cPatterns, ppwzPatterns, dwReserved); + void RegisterNameSpace(IClassFactory pCF, in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string pwzProtocol, [Optional] uint cPatterns, [Optional, MarshalAs(UnmanagedType.LPWStr)] string ppwzPatterns, [Optional] uint dwReserved); + + /// Unregisters a temporary pluggable namespace handler. + /// The address of the IClassFactory interface that created the handler. + /// The address of a string value that contains the protocol that was handled. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767763(v=vs.85) + // HRESULT retVal = object.UnregisterNameSpace(pCF, pszProtocol); + void UnregisterNameSpace(IClassFactory pCF, [MarshalAs(UnmanagedType.LPWStr)] string pszProtocol); + + /// Registers a temporary pluggable MIME filter on the current process. + /// The address of an IClassFactory interface where an IInternetProtocol object can be created. + /// A reference to the CLSID of the MIME handler. + /// A string value that contains the MIME to register. + /// + /// + /// This method registers a pluggable MIME filter only on the current process. No other processes are affected by this method. + /// + /// + /// An application can register a pluggable MIME filter for a particular period of time so that it can handle requests for some + /// MIMEs by calling IInternetSession::RegisterMimeFilter. This method can be called multiple times by using the same + /// interface to register the different MIME types it can handle. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767758(v=vs.85) + // HRESULT retVal = object.RegisterMimeFilter(pCF, rclsid, pwzType); + void RegisterMimeFilter(IClassFactory pCF, in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string pwzType); + + /// Unregisters a temporary pluggable MIME filter. + /// The address of the IClassFactory interface that created the filter. + /// A string value that indicates the MIME that the filter was handling. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767762(v=vs.85) + // HRESULT retVal = object.UnregisterMimeFilter(pCF, pwzType); + void UnregisterMimeFilter(IClassFactory pCF, [MarshalAs(UnmanagedType.LPWStr)] string pwzType); + + /// This method is not implemented. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767754(v=vs.85) + void CreateBinding(IntPtr pBC, [MarshalAs(UnmanagedType.LPWStr)] string szUrl, [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [MarshalAs(UnmanagedType.IUnknown)] out object ppUnk, [MarshalAs(UnmanagedType.IUnknown)] out object ppOInetProt, uint dwOption); + + /// This method is not implemented. + void SetSessionOption(uint dwOption, IntPtr pBuffer, uint dwBufferLength, uint dwReserved); + + /// This method is not implemented. + void GetSessionOption(uint dwOption, IntPtr pBuffer, ref uint pdwBufferLength, uint dwReserved); + } + + /// + /// Exposes methods and properties used to parse and build Uniform Resource Identifiers (URIs) in Windows Internet Explorer 7. + /// + /// + /// Once an IUri has been created, it cannot change its properties. Property values do not change between calls to the same object. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775038(v=vs.85)?redirectedfrom=MSDN + [PInvokeData("Urlmon.h")] + [ComImport, Guid("A39EE748-6A27-4817-A6F2-13914BEF5890"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IUri + { + /// Returns the specified Uniform Resource Identifier (URI) property value in a new BSTR. + /// + /// [in] + /// A value from the Uri_PROPERTY enumeration. + /// + /// + /// [out] + /// Address of a BSTR that receives the property value. + /// + /// + /// [in] + /// One of the following property-specific flags, or zero. + /// Uri_DISPLAY_NO_FRAGMENT (0x00000001) + /// Uri_PROPERTY_DISPLAY_URI: Exclude the fragment portion of the URI, if any. + /// Uri_PUNYCODE_IDN_HOST (0x00000002) + /// + /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: If the URI is an IDN, always display + /// the hostname encoded as punycode. + /// + /// Uri_DISPLAY_IDN_HOST (0x00000004) + /// + /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: Display the hostname in punycode or + /// Unicode as it would appear in the Uri_PROPERTY_DISPLAY_URI property. + /// + /// + /// + /// IUri::GetPropertyBSTR was introduced in Windows Internet Explorer 7. + /// + /// The uriProp parameter must be a string property. This method will fail if the specified property isn't a BSTR property. + /// + /// + /// The pbstrProperty parameter will be set to a new BSTR containing the value of the specified string property. The + /// caller should use SysFreeString to free the string. + /// + /// This method will return and set pbstrProperty to an empty string if the URI doesn't contain the specified property. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775026(v=vs.85) + // HRESULT GetPropertyBSTR( Uri_PROPERTY uriProp, [out] BSTR *pbstrProperty, DWORD dwFlags ); + void GetPropertyBSTR([In] Uri_PROPERTY uriProp, [MarshalAs(UnmanagedType.BStr)] out string pbstrProperty, [In] Uri_DISPLAY dwFlags); + + /// + /// Returns the string length of the specified Uniform Resource Identifier (URI) property. Call this function if you want the + /// length but don't necessarily want to create a new BSTR. + /// + /// + /// [in] + /// A value from the Uri_PROPERTY enumeration. + /// + /// + /// [out] + /// + /// Address of a DWORD that is set to the length of the value of the string property excluding the NULL terminator. + /// + /// + /// + /// [in] + /// One of the following property-specific flags, or zero. + /// Uri_DISPLAY_NO_FRAGMENT (0x00000001) + /// Uri_PROPERTY_DISPLAY_URI: Exclude the fragment portion of the URI, if any. + /// Uri_PUNYCODE_IDN_HOST (0x00000002) + /// + /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: If the URI is an IDN, always display + /// the hostname encoded as punycode. + /// + /// Uri_DISPLAY_IDN_HOST (0x00000004) + /// + /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: Display the hostname in punycode or + /// Unicode as it would appear in the Uri_PROPERTY_DISPLAY_URI property. + /// + /// + /// + /// IUri::GetPropertyLength was introduced in Windows Internet Explorer 7. + /// + /// The uriProp parameter must be a string property. This method will fail if the specified property isn't a BSTR property. + /// + /// This method will return and set pcchProperty to if the URI doesn't contain the specified property. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775028(v=vs.85) + // HRESULT GetPropertyLength( Uri_PROPERTY uriProp, [out] DWORD *pcchProperty, DWORD dwFlags ); + void GetPropertyLength([In] Uri_PROPERTY uriProp, out uint pcchProperty, [In] Uri_DISPLAY dwFlags); + + /// Returns the specified numeric Uniform Resource Identifier (URI) property value. + /// + /// [in] + /// A value from the Uri_PROPERTY enumeration. + /// + /// Address of a DWORD that is set to the value of the specified property. + /// Property-specific flags. Must be set to 0. + /// + /// IUri::GetPropertyDWORD was introduced in Windows Internet Explorer 7. + /// + /// The uriProp parameter must be a numeric property. This method will fail if the specified property isn't a DWORD property. + /// + /// This method will return and set pdwProperty to if the specified property doesn't exist in the URI. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775027(v=vs.85) + // HRESULT GetPropertyDWORD( Uri_PROPERTY uriProp, [out] DWORD *pdwProperty, DWORD dwFlags ); + void GetPropertyDWORD([In] Uri_PROPERTY uriProp, out uint pdwProperty, [In] uint dwFlags); + + /// Determines if the specified property exists in the Uniform Resource Identifier (URI). + /// Address of a BOOL value. Set to TRUE if the specified property exists in the URI. + /// IUri::HasProperty was introduced in Windows Internet Explorer 7. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775036(v=vs.85) + // HRESULT HasProperty( Uri_PROPERTY uriProp, [out] BOOL *pfHasProperty ); + [return: MarshalAs(UnmanagedType.Bool)] + bool HasProperty([In] Uri_PROPERTY uriProp); + + /// Returns the entire canonicalized Uniform Resource Identifier (URI). + /// Address of a string that receives the property value. + /// + /// IUri::GetAbsoluteUri was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_ABSOLUTE_URI property. + /// + /// This property is not defined for relative URIs. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775013%28v%3dvs.85%29 + // HRESULT GetAbsoluteUri( [out] BSTR *pbstrAbsoluteUri ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetAbsoluteUri(); + + /// Returns the user name, password, domain, and port. + /// Address of a string that receives the property value. + /// + /// IUri::GetAuthority was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_AUTHORITY property. + /// + /// + /// If user name and password are not specified, the separator characters (: and @) are removed. The trailing colon is also + /// removed if the port number is not specified or is the default for the protocol scheme. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775014(v=vs.85) + // HRESULT GetAuthority( [out] BSTR *pbstrAuthority ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetAuthority(); + + /// Returns a Uniform Resource Identifier (URI) that can be used for display purposes. + /// Address of a string that receives the property value. + /// + /// IUri::GetDisplayUri was introduced in Windows Internet Explorer 7. + /// + /// The display URI combines protocol scheme, fully qualified domain name, port number (if not the default for the scheme), full + /// resource path, query string, and fragment. + /// + /// + /// Note The display URI may have additional formatting applied to it, such that the string produced by + /// IUri::GetDisplayUri isn't necessarily a valid URI. For this reason, and since the userinfo is not present, the + /// display URI should be used for viewing only; it should not be used for edit by the user, or as a form of transfer for URIs + /// inside or between applications. + /// + /// + /// If the scheme is known (for example, http, ftp, or file) then the display URI will hide credentials. However, if the URI + /// uses an unknown scheme and supplies user name and password, the display URI will also contain the user name and password. + /// + /// + /// Security Warning: Storing sensitive information as clear text in a URI is not recommended. According to RFC3986: + /// Uniform Resource Identifier (URI), Generic Syntax, Section 7.5, "A password appearing within the userinfo component is + /// deprecated and should be considered an error except in those rare cases where the 'password' parameter is intended to be public." + /// + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_DISPLAY_URI property and no flags. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775015(v=vs.85) + // HRESULT GetDisplayUri( [out] BSTR *pbstrDisplayString ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetDisplayUri(); + + /// Returns the domain name (including top-level domain) only. + /// Address of a string that receives the property value. + /// + /// IUri::GetDomain was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_DOMAIN property. + /// + /// + /// If the URL contains only a plain hostname (for example, "http://example/") or a public suffix (for example, + /// "http://co.uk/"), then IUri::GetDomain returns NULL. Use IUri::GetHost instead. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775016(v=vs.85) + // HRESULT GetDomain( [out] BSTR *pbstrDomain ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetDomain(); + + /// Returns the file name extension of the resource. + /// Address of a string that receives the property value. + /// + /// IUri::GetExtension was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_EXTENSION property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775017(v=vs.85) + // HRESULT GetExtension( [out] BSTR *pbstrExtension ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetExtension(); + + /// Returns the text following a fragment marker (#), including the fragment marker itself. + /// Address of a string that receives the property value. + /// + /// IUri::GetFragment was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_FRAGMENT property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775018(v=vs.85) + // HRESULT GetFragment( [out] BSTR *pbstrFragment ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetFragment(); + + /// Returns the fully qualified domain name. + /// Address of a string that receives the property value. + /// + /// IUri::GetHost was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_HOST property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775019(v=vs.85) + // HRESULT GetHost( [out] BSTR *pbstrHost ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetHost(); + + /// Returns the password, as parsed from the Uniform Resource Identifier (URI). + /// Address of a string that receives the property value. + /// + /// IUri::GetPassword was introduced in Windows Internet Explorer 7. + /// + /// Security Warning: Storing sensitive information as clear text in a URI is not recommended. According to RFC3986: + /// Uniform Resource Identifier (URI), Generic Syntax, Section 7.5, "A password appearing within the userinfo component is + /// deprecated and should be considered an error except in those rare cases where the 'password' parameter is intended to be public." + /// + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_PASSWORD property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775021(v=vs.85) + // HRESULT GetPassword( [out] BSTR *pbstrPassword ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetPassword(); + + /// Returns the path and resource name. + /// Address of a string that receives the property value. + /// + /// IUri::GetPath was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_PATH property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775022(v=vs.85) + // HRESULT GetPath( [out] BSTR *pbstrPath ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetPath(); + + /// Returns the path, resource name, and query string. + /// Address of a string that receives the property value. + /// + /// IUri::GetPathAndQuery was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_PATH_AND_QUERY property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775023(v=vs.85) + // HRESULT GetPathAndQuery( [out] BSTR *pbstrPathAndQuery ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetPathAndQuery(); + + /// Returns the query string. + /// Address of a string that receives the property value. + /// + /// IUri::GetQuery was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_QUERY property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775029(v=vs.85) + // HRESULT GetQuery( [out] BSTR *pbstrQuery ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetQuery(); + + /// Returns the entire original Uniform Resource Identifier (URI) input string. + /// Address of a string that receives the property value. + /// + /// IUri::GetRawUri was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_RAW_URI property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775030(v=vs.85) + // HRESULT GetRawUri( [out] BSTR *pbstrRawUri ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetRawUri(); + + /// Returns the protocol scheme name. + /// Address of a string that receives the property value. + /// + /// IUri::GetSchemeName was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_SCHEME_NAME property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775032(v=vs.85) + // HRESULT GetSchemeName( [out] BSTR *pbstrSchemeName ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetSchemeName(); + + /// Returns the user name and password, as parsed from the Uniform Resource Identifier (URI). + /// Address of a string that receives the property value. + /// + /// IUri::GetUserInfo was introduced in Windows Internet Explorer 7. + /// + /// Security Warning: Storing sensitive information as clear text in a URI is not recommended. According to RFC3986: + /// Uniform Resource Identifier (URI), Generic Syntax, Section 7.5, "A password appearing within the userinfo component is + /// deprecated and should be considered an error except in those rare cases where the 'password' parameter is intended to be public." + /// + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_USER_INFO property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775033(v=vs.85) + // HRESULT GetUserInfo( [out] BSTR *pbstrUserInfo ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetUserInfo(); + + /// Returns the user name as parsed from the Uniform Resource Identifier (URI). + /// Address of a string that receives the property value. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the + /// Uri_PROPERTY_USER_NAME property. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775034(v=vs.85) + // HRESULT GetUserName( [out] BSTR *pbstrUserName ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetUserName(); + + /// Returns a value from the Uri_HOST_TYPE enumeration. + /// Address of a DWORD that receives a value from the Uri_HOST_TYPE enumeration. + /// + /// IUri::GetHostType was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyDWORD with the + /// Uri_PROPERTY_HOST_TYPE property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775020(v=vs.85) + // HRESULT GetHostType( [out] DWORD *pdwHostType ); + Uri_HOST_TYPE GetHostType(); + + /// Returns the port number. + /// Address of a DWORD that receives the port number value. + /// + /// IUri::GetPort was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyDWORD with the Uri_PROPERTY_PORT property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775024(v=vs.85) + // HRESULT GetPort( [out] DWORD *pdwPort ); + uint GetPort(); + + /// Returns a value from the URL_SCHEME enumeration. + /// Address of a DWORD that receives a value from the URL_SCHEME enumeration. + /// + /// IUri::GetScheme was introduced in Windows Internet Explorer 7. + /// + /// This function is for convenience. It is the same as calling IUri::GetPropertyDWORD with the + /// Uri_PROPERTY_SCHEME property. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775031(v=vs.85) + // HRESULT GetScheme( [out] DWORD *pdwScheme ); + URL_SCHEME GetScheme(); + + /// This method is not implemented. + /// + URLZONE GetZone(); + + /// Returns a bitmap of flags that indicate which Uniform Resource Identifier (URI) properties have been set. + /// + /// [out] + /// Address of a DWORD that receives a combination of the following flags: + /// Uri_HAS_ABSOLUTE_URI (0x00000000) + /// Uri_PROPERTY_ABSOLUTE_URI exists. + /// Uri_HAS_AUTHORITY (0x00000001) + /// Uri_PROPERTY_AUTHORITY exists. + /// Uri_HAS_DISPLAY_URI (0x00000002) + /// Uri_PROPERTY_DISPLAY_URI exists. + /// Uri_HAS_DOMAIN (0x00000004) + /// Uri_PROPERTY_DOMAIN exists. + /// Uri_HAS_EXTENSION (0x00000008) + /// Uri_PROPERTY_EXTENSION exists. + /// Uri_HAS_FRAGMENT (0x00000010) + /// Uri_PROPERTY_FRAGMENT exists. + /// Uri_HAS_HOST (0x00000020) + /// Uri_PROPERTY_HOST exists. + /// Uri_HAS_HOST_TYPE (0x00004000) + /// Uri_PROPERTY_HOST_TYPE exists. + /// Uri_HAS_PASSWORD (0x00000040) + /// Uri_PROPERTY_PASSWORD exists. + /// Uri_HAS_PATH (0x00000080) + /// Uri_PROPERTY_PATH exists. + /// Uri_HAS_PATH_AND_QUERY (0x00001000) + /// Uri_PROPERTY_PATH_AND_QUERY exists. + /// Uri_HAS_PORT (0x00008000) + /// Uri_PROPERTY_PORT exists. + /// Uri_HAS_QUERY (0x00000100) + /// Uri_PROPERTY_QUERY exists. + /// Uri_HAS_RAW_URI (0x00000200) + /// Uri_PROPERTY_RAW_URI exists. + /// Uri_HAS_SCHEME (0x00010000) + /// Uri_PROPERTY_SCHEME exists. + /// Uri_HAS_SCHEME_NAME (0x00000400) + /// Uri_PROPERTY_SCHEME_NAME exists. + /// Uri_HAS_USER_NAME (0x00000800) + /// Uri_PROPERTY_USER_NAME exists. + /// Uri_HAS_USER_INFO (0x00002000) + /// Uri_PROPERTY_USER_INFO exists. + /// Uri_HAS_ZONE (0x00020000) + /// Uri_PROPERTY_ZONE exists. + /// + /// IUri::GetProperties was introduced in Windows Internet Explorer 7. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775025(v=vs.85) + // HRESULT GetProperties( [out] LPDWORD pdwFlags ); + Uri_HAS GetProperties(); + + /// Compares the logical content of two IUri objects. + /// Address of a BOOL that is set to TRUE if the logical content of pUri is the same. + /// + /// IUri::IsEqual was introduced in Windows Internet Explorer 7. + /// The comparison is case-insensitive. Comparing an IUri to itself will always return TRUE. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775037(v=vs.85) + // HRESULT IsEqual( IUri *pUri, [out] BOOL *pfEqual ); + [return: MarshalAs(UnmanagedType.Bool)] + bool IsEqual([In] IUri pUri); + } + + /// Exposes methods used to create a new IUri from an existing one. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775002(v=vs.85) + [PInvokeData("Urlmon.h")] + [ComImport, Guid("4221B2E1-8955-46c0-BD5B-DE9897565DE7"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IUriBuilder + { + /// Returns a new IUri object based on modifications to the original IUri, using the original flags. + /// + /// [in] + /// + /// DWORD that may contain a combination of the following flags, or zero. Reserved characters in these properties may be + /// percent encoded, if required. + /// + /// Uri_HAS_USER_NAME (0x00000800) + /// Allow encoding of Uri_PROPERTY_USER_NAME. + /// Uri_HAS_PASSWORD (0x00000040) + /// Allow encoding of Uri_PROPERTY_PASSWORD. + /// Uri_HAS_HOST (0x00000020) + /// Allow encoding of Uri_PROPERTY_HOST. + /// Uri_HAS_PATH (0x00000080) + /// Allow encoding of Uri_PROPERTY_PATH. + /// Uri_HAS_QUERY (0x00000100) + /// Allow encoding of Uri_PROPERTY_QUERY. + /// Uri_HAS_FRAGMENT (0x00000010) + /// Allow encoding of Uri_PROPERTY_FRAGMENT. + /// + /// + /// [in] + /// Reserved. Must be set to 0. + /// + /// + /// [out] + /// Address of pointer variable of type IUri that receives the new object. + /// + /// + /// CreateUriSimple was introduced in Windows Internet Explorer 7. + /// + /// If no changes are made, this method may return a pointer to the original IUri object (after incrementing the + /// reference count). + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774988(v=vs.85) + // HRESULT CreateUriSimple( [in] DWORD dwAllowEncodingPropertyMask, [in] DWORD_PTR dwReserved, [out] IUri **ppIUri ); + IUri CreateUriSimple(Uri_HAS dwAllowEncodingPropertyMask, IntPtr dwReserved = default); + + /// Returns a new IUri object based on modifications to the original IUri. + /// + /// [in] DWORD that combines flags, which control the creation of the IUri object. Refer to the CreateUri + /// function for a description of these flags. Pass the value of to use the same flags as were specified when the original + /// IUri object was created. + /// + /// [in]Reserved. Must be set to 0. + /// [in]Reserved. Must be set to 0. + /// [out]Address of pointer variable of type IUri that receives the new object. + /// + /// CreateUri was introduced in Windows Internet Explorer 7. + /// + /// If no changes are made, this method may return a pointer to the original IUri object (after incrementing the + /// reference count). + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774987(v=vs.85) + // HRESULT CreateUri( [in] DWORD dwCreateFlags, [in] DWORD dwAllowEncodingPropertyMask, [in] DWORD_PTR dwReserved, [out] IUri + // **ppIUri ); + IUri CreateUri(Uri_CREATE dwCreateFlags, uint dwAllowEncodingPropertyMask = 0, IntPtr dwReserved = default); + + /// Returns a new IUri object based on modifications to the original IUri. + /// + /// [in] + /// + /// DWORD that combines flags, which control the creation of the IUri object. Refer to the CreateUri + /// function for a description of these flags. + /// + /// + /// + /// [in] + /// DWORD for flags specific to IUriBuilder, or zero. + /// UriBuilder_USE_ORIGINAL_FLAGS (0x00000001) + /// Use the create flags from the original IUri, if they are available. + /// + /// + /// [in] + /// + /// DWORD that may contain a combination of the following flags, or zero. Reserved characters in the specified properties + /// may be percent encoded, if required. + /// + /// Uri_HAS_USER_NAME (0x00000800) + /// Allow encoding of Uri_PROPERTY_USER_NAME. + /// Uri_HAS_PASSWORD (0x00000040) + /// Allow encoding of Uri_PROPERTY_PASSWORD. + /// Uri_HAS_HOST (0x00000020) + /// Allow encoding of Uri_PROPERTY_HOST. + /// Uri_HAS_PATH (0x00000080) + /// Allow encoding of Uri_PROPERTY_PATH. + /// Uri_HAS_QUERY (0x00000100) + /// Allow encoding of Uri_PROPERTY_QUERY. + /// Uri_HAS_FRAGMENT (0x00000010) + /// Allow encoding of Uri_PROPERTY_FRAGMENT. + /// + /// + /// [in] + /// Reserved. Must be set to 0. + /// + /// + /// [out] + /// Address of pointer variable of type IUri that receives the new object. + /// + /// + /// CreateUriWithFlags was introduced in Windows Internet Explorer 7. + /// + /// If no changes are made, this method may return a pointer to the original IUri object (after incrementing the + /// reference count). + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774989(v=vs.85) + // HRESULT CreateUriWithFlags( [in] DWORD dwCreateFlags, [in] DWORD dwUriBuilderFlags, [in] DWORD dwAllowEncodingPropertyMask, + // [in] DWORD_PTR dwReserved, [out] IUri **ppIUri ); + IUri CreateUriWithFlags(Uri_CREATE dwCreateFlags, uint dwUriBuilderFlags, Uri_HAS dwAllowEncodingPropertyMask, IntPtr dwReserved = default); + + /// Returns the original IUri. + /// + /// Address to a pointer variable that receives the original IUri. The calling context must Release the interface when it is no + /// longer needed. + /// + /// GetIUri was introduced in Windows Internet Explorer 7. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774992(v=vs.85) + // HRESULT GetIUri( [out] IUri **ppIUri ); + IUri GetIUri(); + + /// Sets the current IUri. + /// Pointer to an existing IUri interface. + /// + /// SetIUri was introduced in Windows Internet Explorer 7. + /// Setting the current IUri invalidates all properties. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775006(v=vs.85) + // HRESULT SetIUri( [in] IUri *pIUri ); + void SetIUri([In] IUri pIUri); + + /// Retrieves the value of the fragment component. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzFragment. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetFragment was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774990(v=vs.85) + // HRESULT GetFragment( [out] DWORD *pcchFragment, [out] LPCWSTR *ppwzFragment ); + void GetFragment(out uint pcchFragment, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzFragment); + + /// Retrieves the value of the host component. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzHost. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetHost was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774991(v=vs.85) + // HRESULT GetHost( [out] DWORD *pcchHost, [out] LPCWSTR *ppwzHost ); + void GetHost(out uint pcchHost, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzHost); + + /// Retrieves the value of the password component. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzPassword. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetPassword was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774993(v=vs.85) + // HRESULT GetPassword( [out] DWORD *pcchPassword, [out] LPCWSTR *ppwzPassword ); + void GetPassword(out uint pcchPassword, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzPassword); + + /// Retrieves the value of the path component. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzPath. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetPath was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774994(v=vs.85) + // HRESULT GetPath( [out] DWORD *pcchPath, [out] LPCWSTR *ppwzPath ); + void GetPath(out uint pcchPath, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzPath); + + /// Retrieves the value of the port component. + /// + /// [out]Address of a variable of type BOOL that receives TRUE if the port property has been set, or FALSE otherwise. + /// + /// [out]Address of a variable of type DWORD that receives the current value. + /// GetPort was introduced in Windows Internet Explorer 7. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774995(v=vs.85) + // HRESULT GetPort( [out] BOOL *pfHasPort, [out] DWORD *pdwPort ); + void GetPort([MarshalAs(UnmanagedType.Bool)] out bool pfHasPort, out uint pdwPort); + + /// Retrieves the value of the query component. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzQuery. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetQuery was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774996(v=vs.85) + // HRESULT GetQuery( [out] DWORD *pcchQuery, [out] LPCWSTR *ppwzQuery ); + void GetQuery(out uint pcchQuery, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzQuery); + + /// Retrieves the value of the protocol scheme name. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzSchemeName. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetSchemeName was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774997(v=vs.85) + // HRESULT GetSchemeName( [out] DWORD *pcchSchemeName, [out] LPCWSTR *ppwzSchemeName ); + void GetSchemeName(out uint pcchSchemeName, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzSchemeName); + + /// Retrieves the value of the username component. + /// + /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzUserName. + /// + /// [out]Address of a string variable that receives the current value. + /// + /// GetUserName was introduced in Windows Internet Explorer 7. + /// The calling context must not free the returned pointer. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774998(v=vs.85) + // HRESULT GetUserName( [out] DWORD *pcchUserName, [out] LPCWSTR *ppwzUserName ); + void GetUserName(out uint pcchUserName, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzUserName); + + /// Sets the fragment component. + /// String variable that contains the new value, or NULL to remove the fragment component. + /// + /// SetFragment was introduced in Windows Internet Explorer 7. + /// Setting the fragment component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_DISPLAY_URI. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775004(v=vs.85) + // HRESULT SetFragment( [in] LPCWSTR pwzNewValue ); + void SetFragment([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Sets the host (fully qualify domain) component. + /// String variable that contains the new value. Must be neither empty nor NULL. + /// + /// SetHost was introduced in Windows Internet Explorer 7. + /// Setting the host component invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_AUTHORITY, and Uri_PROPERTY_DOMAIN. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775005(v=vs.85) + // HRESULT SetHost( [in] LPCWSTR pwzNewValue ); + void SetHost([MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Sets the password component. + /// String variable the contains the new value, or NULL to remove the password component. + /// + /// SetPassword was introduced in Windows Internet Explorer 7. + /// Setting the password component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_AUTHORITY. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775007(v=vs.85) + // HRESULT SetPassword( [in] LPCWSTR pwzNewValue ); + void SetPassword([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Sets the path component. + /// + /// String variable that contains the new value, or NULL to remove the path component. Must specify an absolute path if not NULL. + /// + /// + /// SetPath was introduced in Windows Internet Explorer 7. + /// The path component also includes the resource (filename and extension). + /// To specify a relative path, use CoInternetCombineIUri. + /// Setting the path component invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DISPLAY_URI, and Uri_PROPERTY_PATH_AND_QUERY. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775008(v=vs.85) + // HRESULT SetPath( [in] LPCWSTR pwzNewValue ); + void SetPath([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Sets the port component. + /// + /// [in] BOOL that contains TRUE if a new port number is specified, or FALSE to use the default port for + /// the protocol scheme. + /// + /// [in] DWORD that contains the new port value. + /// + /// SetPort was introduced in Windows Internet Explorer 7. + /// Setting the port number invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DISPLAY_URI, and Uri_PROPERTY_AUTHORITY. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775009(v=vs.85) + // HRESULT SetPort( [in] BOOL fHasPort, [in] DWORD dwNewValue ); + void SetPort([MarshalAs(UnmanagedType.Bool)] bool fHasPort, uint dwNewValue); + + /// Sets the query component. + /// String variable that contains the new value, or NULL to remove the query component. + /// + /// SetQuery was introduced in Windows Internet Explorer 7. + /// Setting the query component invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DISPLAY_URI, and Uri_PROPERTY_PATH_AND_QUERY. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775010(v=vs.85) + // HRESULT SetQuery( [in] LPCWSTR pwzNewValue ); + void SetQuery([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Sets the protocol scheme name. + /// String variable that contains the new value. Must be neither empty nor NULL. + /// + /// SetSchemeName was introduced in Windows Internet Explorer 7. + /// Setting the scheme name component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_DISPLAY_URI. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775011(v=vs.85) + // HRESULT SetSchemeName( [in] LPCWSTR pwzNewValue ); + void SetSchemeName([MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Sets the username component. + /// String variable that contains the new value, or NULL to remove the username component. + /// + /// SetUserName was introduced in Windows Internet Explorer 7. + /// Setting the username component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_AUTHORITY. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775012(v=vs.85) + // HRESULT SetUserName( [in] LPCWSTR pwzNewValue ); + void SetUserName([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); + + /// Removes the specified properties as well as any derived properties. + /// + /// [in] + /// DWORD that contains a combination of the following flags: + /// Uri_HAS_USER_NAME (0x00000800) + /// Remove Uri_PROPERTY_USER_NAME. + /// Uri_HAS_PASSWORD (0x00000040) + /// Remove Uri_PROPERTY_PASSWORD. + /// Uri_HAS_HOST (0x00000020) + /// Remove Uri_PROPERTY_HOST. + /// Uri_HAS_PORT (0x00008000) + /// Remove Uri_PROPERTY_PORT. + /// Uri_HAS_PATH (0x00000080) + /// Remove Uri_PROPERTY_PATH. + /// Uri_HAS_QUERY (0x00000100) + /// Remove Uri_PROPERTY_QUERY. + /// Uri_HAS_FRAGMENT (0x00000010) + /// Remove Uri_PROPERTY_FRAGMENT. + /// + /// + /// RemoveProperties was introduced in Windows Internet Explorer 7. + /// + /// Compound properties (such as Uri_PROPERTY_AUTHORITY, Uri_PROPERTY_USER_INFO, and + /// Uri_PROPERTY_PATH_AND_QUERY) and sub-properties (such as Uri_PROPERTY_DOMAIN and + /// Uri_PROPERTY_EXTENSION) are also removed when their associated property primitives are removed. + /// Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_DISPLAY_URI are also invalidated when subcomponents are modified. + /// + /// + /// Uri_PROPERTY_SCHEME and Uri_PROPERTY_SCHEME_NAME cannot be removed. Use SetSchemeName to modify the + /// scheme component. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775003(v=vs.85) + // HRESULT RemoveProperties( [in] DWORD dwPropertyMask ); + void RemoveProperties(Uri_HAS dwPropertyMask); + + /// Returns TRUE if component values have been modified. + /// A variable of type BOOL that receives TRUE if components have been modified, or FALSE otherwise. + /// HasBeenModified was introduced in Windows Internet Explorer 7. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775001(v=vs.85) + // HRESULT HasBeenModified( [out] BOOL *pfModified ); + [return: MarshalAs(UnmanagedType.Bool)] + bool HasBeenModified(); + } + + /* + IAuthenticate + IAuthenticateEx + IBindHost + IBinding + IBindProtocol + IBindStatusCallback + IBindStatusCallbackEx + ICatalogFileInfo + ICodeInstall + IHttpNegotiate + IHttpNegotiate2 + IHttpNegotiate3 + IHttpSecurity + IMonikerProp + IPersistMoniker + ISoftDistExt + IUri + IUriBuilderFactory + IUriContainer + IWindowForBindingUI + IWinInetCacheAccess + IWinInetCacheHints + IWinInetCacheHints2 + IWinInetFileStream + IWinInetHttpInfo + IWinInetInfo + */ + } +} \ No newline at end of file diff --git a/PInvoke/UrlMon/UrlMon.cs b/PInvoke/UrlMon/UrlMon.cs index 375174f2..aa293cfa 100644 --- a/PInvoke/UrlMon/UrlMon.cs +++ b/PInvoke/UrlMon/UrlMon.cs @@ -1,8 +1,8 @@ using System; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; +using Vanara.InteropServices; using static Vanara.PInvoke.Ole32; namespace Vanara.PInvoke @@ -665,6 +665,59 @@ namespace Vanara.PInvoke COMPAT_SAFEFOR_LOADING = 0x00800000 } + /// Flags for . + [PInvokeData("Urlmon.h")] + [Flags] + public enum FIEF_FLAG + { + /// + /// Force JIT, even if the user has canceled a previous JIT in the same session, or has specified to this feature. Note: For + /// Internet Explorer 7, this flag is not respected; it is overridden by E_ACCESSDENIED. + /// + FIEF_FLAG_FORCE_JITUI = 0x1, + + /// + /// Do not faultin, just peek. Note: Peek also returns the currently installed version in the QUERYCONTEXT. For Internet + /// Explorer 7, it disables the Java dialog box. + /// + FIEF_FLAG_PEEK = 0x2, + + /// + /// Ignores local version as being satisfactory and forces JIT download. Typically, this is called by code download, or by + /// another caller after a CoCreateInstance call has failed with REGDB_E_CLASSNOTREG or ERROR_MOD_NOT_FOUND (missing a + /// dependency DLL). Note: The registry might show that this feature is installed when it is not, or when it is damaged. For + /// Internet Explorer 7, this flag is not respected; it is overridden by E_ACCESSDENIED. + /// + FIEF_FLAG_SKIP_INSTALLED_VERSION_CHECK = 0x4 + } + + /// Mime flags. + [PInvokeData("Urlmon.h")] + [Flags] + public enum FMFD + { + /// The FMFD default + FMFD_DEFAULT = 0x00000000, + + /// The FMFD urlasfilename + FMFD_URLASFILENAME = 0x00000001, + + /// The FMFD enablemimesniffing + FMFD_ENABLEMIMESNIFFING = 0x00000002, + + /// The FMFD ignoremimetextplain + FMFD_IGNOREMIMETEXTPLAIN = 0x00000004, + + /// The FMFD servermime + FMFD_SERVERMIME = 0x00000008, + + /// The FMFD respecttextplain + FMFD_RESPECTTEXTPLAIN = 0x00000010, + + /// The FMFD returnupdatedimgmimes + FMFD_RETURNUPDATEDIMGMIMES = 0x00000020, + } + /// /// Contains options for URL parsing operations. Used by CoInternetParseUrl, CoInternetParseIUri, and implementations /// of IInternetProtocolInfo::ParseUrl. @@ -1136,7 +1189,7 @@ namespace Vanara.PInvoke /// Use the updated URL parser. URL_MK_UNIFORM = 1, - /// Undocumented. + /// Do not attempt to convert the URL moniker to the standard format. URL_MK_NO_CANONICALIZE = 2, } @@ -1238,1290 +1291,6 @@ namespace Vanara.PInvoke URL_SCHEME_MAXVALUE, } - /// - /// Provides methods that enable the client program that is using an asynchronous moniker to control the progress of the bind operation. - /// - /// - /// - /// An asynchronous moniker calls the client's IBindStatusCallback::OnStartBinding method to provide the client program with - /// a pointer to the IBinding interface. - /// - /// The IID for this interface is . - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775071(v%3Dvs.85) - [PInvokeData("Urlmon.h")] - [ComImport, Guid("79EAC9C0-BAF9-11CE-8C82-00AA004BA90B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IBinding - { - /// Ends the bind operation. - /// - /// This method cannot be called from an implementation of the OnStartBinding method. - /// - /// After it aborts the bind operation, the client must release any pointers that were obtained during the binding. No - /// IBindStatusCallback notifications are called, except OnStopBinding. - /// - /// The bind operation does not terminate by releasing the last IBinding interface. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775068(v=vs.85) - // HRESULT Abort(); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void Abort(); - - /// Suspends the bind operation. - /// - /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Windows Internet Explorer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775074(v=vs.85) - // HRESULT Suspend(); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void Suspend(); - - /// - /// This method resumes the bind operation. - /// Parameters - /// None. - /// Return Values - /// Returns S_OK if successful or an error value otherwise. - /// Remarks - /// - /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Microsoft Internet Explorer. - /// - /// Requirements - /// OS Versions: Windows CE .NET 4.0 and later. Header: Urlmon.h, Urlmon.idl. Link Library: Urlmon.lib. - /// Last updated on Saturday, April 10, 2004 - /// © 1992-2003 Microsoft Corporation. All rights reserved. - /// - /// - /// - /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Microsoft Internet Explorer. - /// - /// Requirements - /// OS Versions: Windows CE .NET 4.0 and later. Header: Urlmon.h, Urlmon.idl. Link Library: Urlmon.lib. - /// Last updated on Saturday, April 10, 2004 - /// © 1992-2003 Microsoft Corporation. All rights reserved. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms928797(v=msdn.10) - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void Resume(); - - /// Sets the priority of the bind operation. - /// - /// A long integer value that contains the priority to set. This can be one of the values used by GetThreadPriority and SetThreadPriority. - /// - /// - /// This method is not currently implemented by the default asynchronous pluggable protocols provided by Windows Internet Explorer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775073(v=vs.85) - // HRESULT SetPriority( long nPriority ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void SetPriority([In] int nPriority); - - /// Gets the priority of the bind operation. - /// - /// The address of a long integer value that receives the current priority of the bind operation. This can be one of the values - /// used by GetThreadPriority and SetThreadPriority. - /// - /// - /// This method is not currently implemented by the default asynchronous pluggable protocols that are provided by Windows - /// Internet Explorer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775070(v=vs.85) - // HRESULT GetPriority( [out] long *pnPriority ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - int GetPriority(); - - /// Gets the protocol-specific outcome of a bind operation. - /// [out]A pointer to the CLSID variable for the protocol used. - /// - /// [out]A pointer to an unsigned long integer variable that contains the protocol-specific bind result string. - /// - /// [out]A pointer to the string variable that contains the protocol-specific bind result. - /// [in, out]Reserved. Must be set to 0. - /// Returns S_OK if successful, or E_INVALIDARG if one of the parameters is not valid. - /// - /// This method typically is called by the client of an asynchronous moniker when the client's OnStopBinding method is called. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775069(v=vs.85) - // HRESULT GetBindResult( [out] CLSID *pclsidProtocol, [out] DWORD *pdwResult, [out] LPOLESTR *pszResult, [in, out] DWORD - // *pdwReserved ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void GetBindResult(out Guid pclsidProtocol, out uint pdwResult, [MarshalAs(UnmanagedType.LPWStr)] out string pszResult, [In, Out] ref uint dwReserved); - } - - /// Accepts information on an asynchronous bind operation. - /// - /// - /// A client that requests an asynchronous bind operation must provide a notification object, which exposes the - /// IBindStatusCallback interface. The asynchronous moniker provides information on the bind operation to the client by - /// calling notification methods on the client's IBindStatusCallback interface. This interface enables the client to pass - /// additional bind information to the moniker by calling the IBindStatusCallback::GetBindInfo and - /// IBindStatusCallback::GetPriority methods after receiving a call from IMoniker::BindToObject or IMoniker::BindToStorage. - /// - /// Only the last IBindStatusCallback interface that was registered is called. - /// The IID for this interface is . - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775060%28v%3dvs.85%29 - [PInvokeData("Urlmon.h")] - [ComImport, Guid("79eac9c1-baf9-11ce-8c82-00aa004ba90b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IBindStatusCallback - { - /// - /// Notifies the client about the callback methods that it is registered to receive. This notification is a response to the - /// flags the client requested in the RegisterBindStatusCallback function. - /// - /// Reserved. Must be set to 0. - /// - /// A pointer to the IBinding interface of the current bind operation. This cannot be NULL. The client can call AddRef on this - /// pointer to keep a reference to the binding object. - /// - /// - /// - /// Typically, asynchronous monikers call this method before the call to the IMoniker::BindToStorage method or the - /// IMoniker::BindToObject method has returned. - /// - /// - /// In the call to this method, the moniker also provides the client with a pointer to the IBinding interface for the - /// binding object associated with the current bind operation. The client can use the IBinding interface to control the - /// progress of the bind operation. - /// - /// - /// To keep a reference to the binding object, the client must store the pointer to the IBinding interface and call - /// AddRef on it. When the client no longer requires the reference, it must call Release on it. Note that calling Release does - /// not cancel the bind operation; it frees the reference to the IBinding interface sent in the callback. - /// - /// - /// Client applications that implement the IBindStatusCallback interface can return E_NOTIMPL or S_OK, if they don't want - /// to receive this notification. - /// - /// - /// The Abort method does not work properly in an implementation of IBindStatusCallback::OnStartBinding. To abort - /// the binding, IBindStatusCallback::OnStartBinding should return E_FAIL. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775065%28v%3dvs.85%29 - // HRESULT OnStartBinding( DWORD dwReserved, IBinding *pib ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void OnStartBinding([Optional] uint dwReserved, [In, MarshalAs(UnmanagedType.Interface)] IBinding pib); - - /// Gets the priority for the bind operation when it is called by an asynchronous moniker. - /// - /// A long integer value that indicates the priority of this bind operation. Priorities can be any of the constants defined for - /// prioritizing threads. For details, see the Win32 documentation for SetThreadPriority and GetThreadPriority. - /// - /// - /// - /// The moniker calls this method prior to initiating the bind operation, to get the priority for the bind operation. This - /// method can be called at any time during the bind operation, if the moniker has to make new priority decisions. - /// - /// - /// The moniker can use pnPriority to set the priority of a thread that is associated with a bind operation. Typically, it - /// interprets the priority to perform its own scheduling among multiple bind operations. Note that the policy for determining - /// priority for URL monikers is not yet determined. The moniker must not change the priority of the thread that is used to call - /// IMoniker::BindToStorage or IMoniker::BindToObject. - /// - /// - /// Applications that implement the IBindStatusCallback interface can return E_UNIMPL or S_OK, if they don't want to - /// receive this notification. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775059(v=vs.85) - // HRESULT GetPriority( [out] long *pnPriority ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - int GetPriority(); - - /// This method is not implemented. - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void OnLowResource([Optional] uint reserved); - - /// Indicates the progress of the bind operation. - /// - /// An unsigned long integer that contains the current progress of the bind operation relative to the expected maximum that is - /// indicated in the ulProgressMax parameter. - /// - /// - /// An unsigned long integer that contains the expected maximum value of the ulProgress parameter for the duration of calls to - /// IBindStatusCallback::OnProgress for this bind operation. Note that this value might change across calls to this method. A - /// value of zero means that the maximum value of ulProgress is unknown; for example, in the IMoniker::BindToStorage method when - /// the data download size is unknown. - /// - /// - /// An unsigned long integer that Additional information regarding the progress of the bind operation. This can be any of the - /// BINDSTATUS values. - /// - /// - /// The address of a string value that contains the textual information that indicates the current progress of the bind - /// operation. The text reflects the BINDSTATUS value of the ulStatusCode parameter and is appropriate for display in the user - /// interface of the client. - /// - /// - /// - /// The moniker calls this method repeatedly to indicate the current progress of the bind operation, typically, at reasonable - /// intervals during a lengthy operation. - /// - /// - /// The client can use the progress notification to provide progress information to the user from the ulProgress, ulProgressMax, - /// and szStatusText parameters, or to make programmatic decisions based on the ulStatusCode parameter. - /// - /// - /// Client applications that implement the IBindStatusCallback interface can return E_NOTIMPL or S_OK, if they don't have - /// to receive this notification. - /// - /// - /// Windows Internet Explorer 8. If ulStatusCode is set to BINDSTATUS_64BIT_PROGRESS, then szStatusText contains a string - /// representing the progress of the download as two 64-bit numbers (representing ulProgress and ulProgressMax) separated by a comma. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775064(v=vs.85) - // HRESULT OnProgress( unsigned long ulProgress, unsigned long ulProgressMax, unsigned long ulStatusCode, // LPCWSTR - // szStatusText ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void OnProgress([In] uint ulProgress, [In] uint ulProgressMax, [In] BINDSTATUS ulStatusCode, [In, MarshalAs(UnmanagedType.LPWStr)] string szStatusText); - - /// This method indicates the end of the bind operation. - /// Status code returned from the bind operation. - /// - /// Address of a string value that contains the status text. In case of error, this text describes the error. In the current - /// implementation of URL monikers, this string is empty. - /// - /// - /// - /// This method is always called, whether the bind operation succeeded, failed, or was aborted by a client. At this point the - /// moniker client can use IBinding::GetBindResult to query for protocol-specific information about the outcome of the - /// bind operation. When this method has completed, the moniker client must call Release on the IBinding pointer - /// it received in IBindStatusCallback::OnStartBinding. - /// - /// - /// Because URL monikers work asynchronously, the status code returned by IBindStatusCallback::OnStopBinding and the - /// status code returned by the binding methods, such as IMoniker::BindToStorage and IMoniker::BindToObject, might differ. - /// - /// - /// Client applications that implement the IBindStatusCallback interface can return E_UNIMPL or S_OK if they are not - /// interested in receiving this notification. - /// - /// - /// https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms928805(v=msdn.10) - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void OnStopBinding([In] HRESULT hresult, [In, MarshalAs(UnmanagedType.LPWStr)] string szError); - - /// Provides information about how the bind operation is handled when it is called by an asynchronous moniker. - /// - /// [out]The address of an unsigned integer value that contains a combination of values that are taken from the BINDF - /// enumeration and indicate how the bind process is handled. - /// - /// - /// [in, out]The address of the BINDINFO structure, which describes the client application's requirements for binding. - /// - /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. - /// - /// - /// The moniker calls this method in its implementations of the IMoniker::BindToObject method and the IMoniker::BindToStorage - /// method to get information about the specific bind operation. - /// - /// - /// Asynchronous moniker clients should be aware that a moniker might call this method more than one time during a bind - /// operation. A proper implementation of IBindStatusCallback::GetBindInfo prepares for this possibility. If data is - /// returned in the pbindinfo parameter, the implementation should allocate the appropriate data (szExtraInfo or stgmedData) at - /// the time of each call. In this way, if the callback isn't called, data isn't allocated; if the callback is called more than - /// one time, it works correctly. The first time this callback is received by the asynchronous moniker client is prior to the - /// call to IMoniker::BindToStorage or IMoniker::BindToObject. - /// - /// - /// Even when the value of grfBindInfoF is BINDF_ASYNCHRONOUS, it is possible that the original call to IMoniker::BindToStorage - /// or IMoniker::BindToObject might return synchronously, instead of returning the MK_S_ASYNCHRONOUS flag. Clients of - /// asynchronous monikers should always prepare for this possibility. Specifically, to avoid memory leaks, it is important to - /// make sure to release the pointer that is returned by a call to either method. - /// - /// - /// One way to deal with this issue is to call your own implementation of IBindStatusCallback::OnDataAvailable or - /// IBindStatusCallback::OnObjectAvailable to use the same code path (regardless of whether you bind synchronously or asynchronously). - /// - /// - /// If the BINDF_PULLDATA value is not set in the grfBindInfoF parameter, Urlmon.dll sets the BINDF_NEEDFILE - /// value. If BINDF_NEEDFILE is set, the binding of resources that cannot be cached (such as an HTTPS resource) fail. - /// - /// - /// Warning The size of the BINDINFO structure changed with the release of Microsoft Internet Explorer 4.0. - /// Developers must write code that checks the size of the BINDINFO structure that is passed into their implementation of - /// this method before it writes to members of the structure. For more information, see Handling BINDINFO Structures. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775058(v=vs.85) - // HRESULT GetBindInfo( [out] DWORD *grfBINDF, [in, out] BINDINFO *pbindinfo ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void GetBindInfo(out BINDF grfBINDF, [In, Out] ref BINDINFO pbindinfo); - - /// Provides data to the client as it becomes available during asynchronous bind operations. - /// - /// [in]An unsigned long integer value from the BSCF enumeration that indicates the kind of data available. - /// - /// - /// [in]An unsigned long integer value that contains the size, in bytes, of the total data available from the current bind operation. - /// - /// - /// [in]The address of the FORMATETC structure that indicates the format of the available data. This parameter is used when the - /// bind operation results from the IMoniker::BindToStorage method. If there is no format associated with the available data, - /// pformatetc might contain CF_NULL. Each different call to IBindStatusCallback::OnDataAvailable can pass in a new value - /// for this parameter; every call always points to the same data. - /// - /// - /// [in]The address of the STGMEDIUM structure that contains pointers to the interfaces (such as IStream and IStorage) that can - /// be used to access the data. In the asynchronous case, client applications might receive a second pointer to the IStream or - /// IStorage interface from the IMoniker::BindToStorage method. The client application must call Release on the interfaces to - /// avoid memory leaks. - /// - /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. - /// - /// - /// During asynchronous IMoniker::BindToStorage bind operations, an asynchronous moniker calls this method to provide data to - /// the client as it becomes available. - /// - /// - /// Note that the behavior of the storage returned in pstgmed depends on the BINDF flags returned in the - /// IBindStatusCallback::GetBindInfo method. This storage can be asynchronous or blocking, and the bind operation can - /// follow a data pull model or a data push model. For BINDF bind operations, it is not possible to seek backward into - /// data streams that are provided in IBindStatusCallback::OnDataAvailable. On the other hand, for data push model bind - /// operations, it is possible to seek back into a data stream, and to read any data that has been downloaded for an ongoing - /// IMoniker::BindToStorage operation. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775061(v=vs.85) - // HRESULT OnDataAvailable( DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void OnDataAvailable([In] BSCF grfBSCF, [In] uint dwSize, in FORMATETC pFormatetc, in STGMEDIUM pStgmed); - - /// Passes the requested object interface pointer to the client. - /// [in]The interface identifier of the requested interface. - /// - /// [in]The address of the IUnknown interface on the object that is requested in the call to IMoniker::BindToObject. The client - /// should call AddRef on this pointer to maintain a reference to the object. - /// - /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. - /// - /// This method is called in response to an IMoniker::BindToObject operation. The method is never called for - /// IMoniker::BindToStorage operations. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775063(v=vs.85) - // HRESULT OnObjectAvailable( REFIID riid, IUnknown *punk ); - [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] - void OnObjectAvailable(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object punk); - } - - /// Implemented by the client application to create temporary pluggable protocol handlers. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767757(v%3Dvs.85) - [PInvokeData("Urlmon.h")] - [ComImport, Guid("79eac9e7-baf9-11ce-8c82-00aa004ba90b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IInternetSession - { - /// Registers a temporary pluggable namespace handler on the current process. - /// - /// A pointer to an IClassFactory interface where an IInternetProtocol object can be created. The object's reference count is increased. - /// - /// A reference to the CLSID of the namespace. Passing CLSID_NULL is discouraged. - /// A string value that contains the protocol to be handled. - /// Unused. Set to 0. - /// Unused. Set to NULL. - /// Reserved. Must be set to 0. - /// - /// - /// The IInternetSession::RegisterNameSpace method enables an interface to handle requests for the specified protocol - /// namespace. A single interface can be registered multiple times for each namespace that it can handle. Because pluggable - /// protocol handlers are not chained, only the last handler to be registered will be active; therefore, it is better to create - /// a new namespace, rather than reuse an existing one. - /// - /// - /// This method registers a pluggable namespace handler only on the current process; no other processes are affected by this - /// method. An application can register a pluggable namespace handler for a particular period of time. When finished, it should - /// call IInternetSession::UnregisterNameSpace to remove the registration. - /// - /// - /// Note Registering namespace handlers for HTTP and HTTPS protocols is not recommended. Doing so within the Internet - /// Explorer process incurs a performance penalty when browsing. - /// - /// - /// The ppwzPatterns and cPatterns parameters are unused; the registered pluggable namespace handler is called for all protocol requests. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767759%28v%3dvs.85%29 - // HRESULT retVal = object.RegisterNameSpace(pCF, rclsid, pwzProtocol, cPatterns, ppwzPatterns, dwReserved); - void RegisterNameSpace(IClassFactory pCF, in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string pwzProtocol, [Optional] uint cPatterns, [Optional, MarshalAs(UnmanagedType.LPWStr)] string ppwzPatterns, [Optional] uint dwReserved); - - /// Unregisters a temporary pluggable namespace handler. - /// The address of the IClassFactory interface that created the handler. - /// The address of a string value that contains the protocol that was handled. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767763(v=vs.85) - // HRESULT retVal = object.UnregisterNameSpace(pCF, pszProtocol); - void UnregisterNameSpace(IClassFactory pCF, [MarshalAs(UnmanagedType.LPWStr)] string pszProtocol); - - /// Registers a temporary pluggable MIME filter on the current process. - /// The address of an IClassFactory interface where an IInternetProtocol object can be created. - /// A reference to the CLSID of the MIME handler. - /// A string value that contains the MIME to register. - /// - /// - /// This method registers a pluggable MIME filter only on the current process. No other processes are affected by this method. - /// - /// - /// An application can register a pluggable MIME filter for a particular period of time so that it can handle requests for some - /// MIMEs by calling IInternetSession::RegisterMimeFilter. This method can be called multiple times by using the same - /// interface to register the different MIME types it can handle. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767758(v=vs.85) - // HRESULT retVal = object.RegisterMimeFilter(pCF, rclsid, pwzType); - void RegisterMimeFilter(IClassFactory pCF, in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string pwzType); - - /// Unregisters a temporary pluggable MIME filter. - /// The address of the IClassFactory interface that created the filter. - /// A string value that indicates the MIME that the filter was handling. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767762(v=vs.85) - // HRESULT retVal = object.UnregisterMimeFilter(pCF, pwzType); - void UnregisterMimeFilter(IClassFactory pCF, [MarshalAs(UnmanagedType.LPWStr)] string pwzType); - - /// This method is not implemented. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767754(v=vs.85) - void CreateBinding(IntPtr pBC, [MarshalAs(UnmanagedType.LPWStr)] string szUrl, [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [MarshalAs(UnmanagedType.IUnknown)] out object ppUnk, [MarshalAs(UnmanagedType.IUnknown)] out object ppOInetProt, uint dwOption); - - /// This method is not implemented. - void SetSessionOption(uint dwOption, IntPtr pBuffer, uint dwBufferLength, uint dwReserved); - - /// This method is not implemented. - void GetSessionOption(uint dwOption, IntPtr pBuffer, ref uint pdwBufferLength, uint dwReserved); - } - - /// - /// Exposes methods and properties used to parse and build Uniform Resource Identifiers (URIs) in Windows Internet Explorer 7. - /// - /// - /// Once an IUri has been created, it cannot change its properties. Property values do not change between calls to the same object. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775038(v=vs.85)?redirectedfrom=MSDN - [PInvokeData("Urlmon.h")] - [ComImport, Guid("A39EE748-6A27-4817-A6F2-13914BEF5890"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IUri - { - /// Returns the specified Uniform Resource Identifier (URI) property value in a new BSTR. - /// - /// [in] - /// A value from the Uri_PROPERTY enumeration. - /// - /// - /// [out] - /// Address of a BSTR that receives the property value. - /// - /// - /// [in] - /// One of the following property-specific flags, or zero. - /// Uri_DISPLAY_NO_FRAGMENT (0x00000001) - /// Uri_PROPERTY_DISPLAY_URI: Exclude the fragment portion of the URI, if any. - /// Uri_PUNYCODE_IDN_HOST (0x00000002) - /// - /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: If the URI is an IDN, always display - /// the hostname encoded as punycode. - /// - /// Uri_DISPLAY_IDN_HOST (0x00000004) - /// - /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: Display the hostname in punycode or - /// Unicode as it would appear in the Uri_PROPERTY_DISPLAY_URI property. - /// - /// - /// - /// IUri::GetPropertyBSTR was introduced in Windows Internet Explorer 7. - /// - /// The uriProp parameter must be a string property. This method will fail if the specified property isn't a BSTR property. - /// - /// - /// The pbstrProperty parameter will be set to a new BSTR containing the value of the specified string property. The - /// caller should use SysFreeString to free the string. - /// - /// This method will return and set pbstrProperty to an empty string if the URI doesn't contain the specified property. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775026(v=vs.85) - // HRESULT GetPropertyBSTR( Uri_PROPERTY uriProp, [out] BSTR *pbstrProperty, DWORD dwFlags ); - void GetPropertyBSTR([In] Uri_PROPERTY uriProp, [MarshalAs(UnmanagedType.BStr)] out string pbstrProperty, [In] Uri_DISPLAY dwFlags); - - /// - /// Returns the string length of the specified Uniform Resource Identifier (URI) property. Call this function if you want the - /// length but don't necessarily want to create a new BSTR. - /// - /// - /// [in] - /// A value from the Uri_PROPERTY enumeration. - /// - /// - /// [out] - /// - /// Address of a DWORD that is set to the length of the value of the string property excluding the NULL terminator. - /// - /// - /// - /// [in] - /// One of the following property-specific flags, or zero. - /// Uri_DISPLAY_NO_FRAGMENT (0x00000001) - /// Uri_PROPERTY_DISPLAY_URI: Exclude the fragment portion of the URI, if any. - /// Uri_PUNYCODE_IDN_HOST (0x00000002) - /// - /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: If the URI is an IDN, always display - /// the hostname encoded as punycode. - /// - /// Uri_DISPLAY_IDN_HOST (0x00000004) - /// - /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: Display the hostname in punycode or - /// Unicode as it would appear in the Uri_PROPERTY_DISPLAY_URI property. - /// - /// - /// - /// IUri::GetPropertyLength was introduced in Windows Internet Explorer 7. - /// - /// The uriProp parameter must be a string property. This method will fail if the specified property isn't a BSTR property. - /// - /// This method will return and set pcchProperty to if the URI doesn't contain the specified property. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775028(v=vs.85) - // HRESULT GetPropertyLength( Uri_PROPERTY uriProp, [out] DWORD *pcchProperty, DWORD dwFlags ); - void GetPropertyLength([In] Uri_PROPERTY uriProp, out uint pcchProperty, [In] Uri_DISPLAY dwFlags); - - /// Returns the specified numeric Uniform Resource Identifier (URI) property value. - /// - /// [in] - /// A value from the Uri_PROPERTY enumeration. - /// - /// Address of a DWORD that is set to the value of the specified property. - /// Property-specific flags. Must be set to 0. - /// - /// IUri::GetPropertyDWORD was introduced in Windows Internet Explorer 7. - /// - /// The uriProp parameter must be a numeric property. This method will fail if the specified property isn't a DWORD property. - /// - /// This method will return and set pdwProperty to if the specified property doesn't exist in the URI. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775027(v=vs.85) - // HRESULT GetPropertyDWORD( Uri_PROPERTY uriProp, [out] DWORD *pdwProperty, DWORD dwFlags ); - void GetPropertyDWORD([In] Uri_PROPERTY uriProp, out uint pdwProperty, [In] uint dwFlags); - - /// Determines if the specified property exists in the Uniform Resource Identifier (URI). - /// Address of a BOOL value. Set to TRUE if the specified property exists in the URI. - /// IUri::HasProperty was introduced in Windows Internet Explorer 7. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775036(v=vs.85) - // HRESULT HasProperty( Uri_PROPERTY uriProp, [out] BOOL *pfHasProperty ); - [return: MarshalAs(UnmanagedType.Bool)] - bool HasProperty([In] Uri_PROPERTY uriProp); - - /// Returns the entire canonicalized Uniform Resource Identifier (URI). - /// Address of a string that receives the property value. - /// - /// IUri::GetAbsoluteUri was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_ABSOLUTE_URI property. - /// - /// This property is not defined for relative URIs. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775013%28v%3dvs.85%29 - // HRESULT GetAbsoluteUri( [out] BSTR *pbstrAbsoluteUri ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetAbsoluteUri(); - - /// Returns the user name, password, domain, and port. - /// Address of a string that receives the property value. - /// - /// IUri::GetAuthority was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_AUTHORITY property. - /// - /// - /// If user name and password are not specified, the separator characters (: and @) are removed. The trailing colon is also - /// removed if the port number is not specified or is the default for the protocol scheme. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775014(v=vs.85) - // HRESULT GetAuthority( [out] BSTR *pbstrAuthority ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetAuthority(); - - /// Returns a Uniform Resource Identifier (URI) that can be used for display purposes. - /// Address of a string that receives the property value. - /// - /// IUri::GetDisplayUri was introduced in Windows Internet Explorer 7. - /// - /// The display URI combines protocol scheme, fully qualified domain name, port number (if not the default for the scheme), full - /// resource path, query string, and fragment. - /// - /// - /// Note The display URI may have additional formatting applied to it, such that the string produced by - /// IUri::GetDisplayUri isn't necessarily a valid URI. For this reason, and since the userinfo is not present, the - /// display URI should be used for viewing only; it should not be used for edit by the user, or as a form of transfer for URIs - /// inside or between applications. - /// - /// - /// If the scheme is known (for example, http, ftp, or file) then the display URI will hide credentials. However, if the URI - /// uses an unknown scheme and supplies user name and password, the display URI will also contain the user name and password. - /// - /// - /// Security Warning: Storing sensitive information as clear text in a URI is not recommended. According to RFC3986: - /// Uniform Resource Identifier (URI), Generic Syntax, Section 7.5, "A password appearing within the userinfo component is - /// deprecated and should be considered an error except in those rare cases where the 'password' parameter is intended to be public." - /// - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_DISPLAY_URI property and no flags. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775015(v=vs.85) - // HRESULT GetDisplayUri( [out] BSTR *pbstrDisplayString ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetDisplayUri(); - - /// Returns the domain name (including top-level domain) only. - /// Address of a string that receives the property value. - /// - /// IUri::GetDomain was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_DOMAIN property. - /// - /// - /// If the URL contains only a plain hostname (for example, "http://example/") or a public suffix (for example, - /// "http://co.uk/"), then IUri::GetDomain returns NULL. Use IUri::GetHost instead. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775016(v=vs.85) - // HRESULT GetDomain( [out] BSTR *pbstrDomain ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetDomain(); - - /// Returns the file name extension of the resource. - /// Address of a string that receives the property value. - /// - /// IUri::GetExtension was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_EXTENSION property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775017(v=vs.85) - // HRESULT GetExtension( [out] BSTR *pbstrExtension ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetExtension(); - - /// Returns the text following a fragment marker (#), including the fragment marker itself. - /// Address of a string that receives the property value. - /// - /// IUri::GetFragment was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_FRAGMENT property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775018(v=vs.85) - // HRESULT GetFragment( [out] BSTR *pbstrFragment ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetFragment(); - - /// Returns the fully qualified domain name. - /// Address of a string that receives the property value. - /// - /// IUri::GetHost was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_HOST property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775019(v=vs.85) - // HRESULT GetHost( [out] BSTR *pbstrHost ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetHost(); - - /// Returns the password, as parsed from the Uniform Resource Identifier (URI). - /// Address of a string that receives the property value. - /// - /// IUri::GetPassword was introduced in Windows Internet Explorer 7. - /// - /// Security Warning: Storing sensitive information as clear text in a URI is not recommended. According to RFC3986: - /// Uniform Resource Identifier (URI), Generic Syntax, Section 7.5, "A password appearing within the userinfo component is - /// deprecated and should be considered an error except in those rare cases where the 'password' parameter is intended to be public." - /// - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_PASSWORD property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775021(v=vs.85) - // HRESULT GetPassword( [out] BSTR *pbstrPassword ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetPassword(); - - /// Returns the path and resource name. - /// Address of a string that receives the property value. - /// - /// IUri::GetPath was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_PATH property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775022(v=vs.85) - // HRESULT GetPath( [out] BSTR *pbstrPath ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetPath(); - - /// Returns the path, resource name, and query string. - /// Address of a string that receives the property value. - /// - /// IUri::GetPathAndQuery was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_PATH_AND_QUERY property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775023(v=vs.85) - // HRESULT GetPathAndQuery( [out] BSTR *pbstrPathAndQuery ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetPathAndQuery(); - - /// Returns the query string. - /// Address of a string that receives the property value. - /// - /// IUri::GetQuery was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the Uri_PROPERTY_QUERY property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775029(v=vs.85) - // HRESULT GetQuery( [out] BSTR *pbstrQuery ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetQuery(); - - /// Returns the entire original Uniform Resource Identifier (URI) input string. - /// Address of a string that receives the property value. - /// - /// IUri::GetRawUri was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_RAW_URI property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775030(v=vs.85) - // HRESULT GetRawUri( [out] BSTR *pbstrRawUri ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetRawUri(); - - /// Returns the protocol scheme name. - /// Address of a string that receives the property value. - /// - /// IUri::GetSchemeName was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_SCHEME_NAME property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775032(v=vs.85) - // HRESULT GetSchemeName( [out] BSTR *pbstrSchemeName ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetSchemeName(); - - /// Returns the user name and password, as parsed from the Uniform Resource Identifier (URI). - /// Address of a string that receives the property value. - /// - /// IUri::GetUserInfo was introduced in Windows Internet Explorer 7. - /// - /// Security Warning: Storing sensitive information as clear text in a URI is not recommended. According to RFC3986: - /// Uniform Resource Identifier (URI), Generic Syntax, Section 7.5, "A password appearing within the userinfo component is - /// deprecated and should be considered an error except in those rare cases where the 'password' parameter is intended to be public." - /// - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_USER_INFO property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775033(v=vs.85) - // HRESULT GetUserInfo( [out] BSTR *pbstrUserInfo ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetUserInfo(); - - /// Returns the user name as parsed from the Uniform Resource Identifier (URI). - /// Address of a string that receives the property value. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyBSTR with the - /// Uri_PROPERTY_USER_NAME property. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775034(v=vs.85) - // HRESULT GetUserName( [out] BSTR *pbstrUserName ); - [return: MarshalAs(UnmanagedType.BStr)] - string GetUserName(); - - /// Returns a value from the Uri_HOST_TYPE enumeration. - /// Address of a DWORD that receives a value from the Uri_HOST_TYPE enumeration. - /// - /// IUri::GetHostType was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyDWORD with the - /// Uri_PROPERTY_HOST_TYPE property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775020(v=vs.85) - // HRESULT GetHostType( [out] DWORD *pdwHostType ); - Uri_HOST_TYPE GetHostType(); - - /// Returns the port number. - /// Address of a DWORD that receives the port number value. - /// - /// IUri::GetPort was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyDWORD with the Uri_PROPERTY_PORT property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775024(v=vs.85) - // HRESULT GetPort( [out] DWORD *pdwPort ); - uint GetPort(); - - /// Returns a value from the URL_SCHEME enumeration. - /// Address of a DWORD that receives a value from the URL_SCHEME enumeration. - /// - /// IUri::GetScheme was introduced in Windows Internet Explorer 7. - /// - /// This function is for convenience. It is the same as calling IUri::GetPropertyDWORD with the - /// Uri_PROPERTY_SCHEME property. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775031(v=vs.85) - // HRESULT GetScheme( [out] DWORD *pdwScheme ); - URL_SCHEME GetScheme(); - - /// This method is not implemented. - /// - URLZONE GetZone(); - - /// Returns a bitmap of flags that indicate which Uniform Resource Identifier (URI) properties have been set. - /// - /// [out] - /// Address of a DWORD that receives a combination of the following flags: - /// Uri_HAS_ABSOLUTE_URI (0x00000000) - /// Uri_PROPERTY_ABSOLUTE_URI exists. - /// Uri_HAS_AUTHORITY (0x00000001) - /// Uri_PROPERTY_AUTHORITY exists. - /// Uri_HAS_DISPLAY_URI (0x00000002) - /// Uri_PROPERTY_DISPLAY_URI exists. - /// Uri_HAS_DOMAIN (0x00000004) - /// Uri_PROPERTY_DOMAIN exists. - /// Uri_HAS_EXTENSION (0x00000008) - /// Uri_PROPERTY_EXTENSION exists. - /// Uri_HAS_FRAGMENT (0x00000010) - /// Uri_PROPERTY_FRAGMENT exists. - /// Uri_HAS_HOST (0x00000020) - /// Uri_PROPERTY_HOST exists. - /// Uri_HAS_HOST_TYPE (0x00004000) - /// Uri_PROPERTY_HOST_TYPE exists. - /// Uri_HAS_PASSWORD (0x00000040) - /// Uri_PROPERTY_PASSWORD exists. - /// Uri_HAS_PATH (0x00000080) - /// Uri_PROPERTY_PATH exists. - /// Uri_HAS_PATH_AND_QUERY (0x00001000) - /// Uri_PROPERTY_PATH_AND_QUERY exists. - /// Uri_HAS_PORT (0x00008000) - /// Uri_PROPERTY_PORT exists. - /// Uri_HAS_QUERY (0x00000100) - /// Uri_PROPERTY_QUERY exists. - /// Uri_HAS_RAW_URI (0x00000200) - /// Uri_PROPERTY_RAW_URI exists. - /// Uri_HAS_SCHEME (0x00010000) - /// Uri_PROPERTY_SCHEME exists. - /// Uri_HAS_SCHEME_NAME (0x00000400) - /// Uri_PROPERTY_SCHEME_NAME exists. - /// Uri_HAS_USER_NAME (0x00000800) - /// Uri_PROPERTY_USER_NAME exists. - /// Uri_HAS_USER_INFO (0x00002000) - /// Uri_PROPERTY_USER_INFO exists. - /// Uri_HAS_ZONE (0x00020000) - /// Uri_PROPERTY_ZONE exists. - /// - /// IUri::GetProperties was introduced in Windows Internet Explorer 7. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775025(v=vs.85) - // HRESULT GetProperties( [out] LPDWORD pdwFlags ); - Uri_HAS GetProperties(); - - /// Compares the logical content of two IUri objects. - /// Address of a BOOL that is set to TRUE if the logical content of pUri is the same. - /// - /// IUri::IsEqual was introduced in Windows Internet Explorer 7. - /// The comparison is case-insensitive. Comparing an IUri to itself will always return TRUE. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775037(v=vs.85) - // HRESULT IsEqual( IUri *pUri, [out] BOOL *pfEqual ); - [return: MarshalAs(UnmanagedType.Bool)] - bool IsEqual([In] IUri pUri); - } - - /// Exposes methods used to create a new IUri from an existing one. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775002(v=vs.85) - [PInvokeData("Urlmon.h")] - [ComImport, Guid("4221B2E1-8955-46c0-BD5B-DE9897565DE7"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IUriBuilder - { - /// Returns a new IUri object based on modifications to the original IUri, using the original flags. - /// - /// [in] - /// - /// DWORD that may contain a combination of the following flags, or zero. Reserved characters in these properties may be - /// percent encoded, if required. - /// - /// Uri_HAS_USER_NAME (0x00000800) - /// Allow encoding of Uri_PROPERTY_USER_NAME. - /// Uri_HAS_PASSWORD (0x00000040) - /// Allow encoding of Uri_PROPERTY_PASSWORD. - /// Uri_HAS_HOST (0x00000020) - /// Allow encoding of Uri_PROPERTY_HOST. - /// Uri_HAS_PATH (0x00000080) - /// Allow encoding of Uri_PROPERTY_PATH. - /// Uri_HAS_QUERY (0x00000100) - /// Allow encoding of Uri_PROPERTY_QUERY. - /// Uri_HAS_FRAGMENT (0x00000010) - /// Allow encoding of Uri_PROPERTY_FRAGMENT. - /// - /// - /// [in] - /// Reserved. Must be set to 0. - /// - /// - /// [out] - /// Address of pointer variable of type IUri that receives the new object. - /// - /// - /// CreateUriSimple was introduced in Windows Internet Explorer 7. - /// - /// If no changes are made, this method may return a pointer to the original IUri object (after incrementing the - /// reference count). - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774988(v=vs.85) - // HRESULT CreateUriSimple( [in] DWORD dwAllowEncodingPropertyMask, [in] DWORD_PTR dwReserved, [out] IUri **ppIUri ); - IUri CreateUriSimple(Uri_HAS dwAllowEncodingPropertyMask, IntPtr dwReserved = default); - - /// Returns a new IUri object based on modifications to the original IUri. - /// - /// [in] DWORD that combines flags, which control the creation of the IUri object. Refer to the CreateUri - /// function for a description of these flags. Pass the value of to use the same flags as were specified when the original - /// IUri object was created. - /// - /// [in]Reserved. Must be set to 0. - /// [in]Reserved. Must be set to 0. - /// [out]Address of pointer variable of type IUri that receives the new object. - /// - /// CreateUri was introduced in Windows Internet Explorer 7. - /// - /// If no changes are made, this method may return a pointer to the original IUri object (after incrementing the - /// reference count). - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774987(v=vs.85) - // HRESULT CreateUri( [in] DWORD dwCreateFlags, [in] DWORD dwAllowEncodingPropertyMask, [in] DWORD_PTR dwReserved, [out] IUri - // **ppIUri ); - IUri CreateUri(Uri_CREATE dwCreateFlags, uint dwAllowEncodingPropertyMask = 0, IntPtr dwReserved = default); - - /// Returns a new IUri object based on modifications to the original IUri. - /// - /// [in] - /// - /// DWORD that combines flags, which control the creation of the IUri object. Refer to the CreateUri - /// function for a description of these flags. - /// - /// - /// - /// [in] - /// DWORD for flags specific to IUriBuilder, or zero. - /// UriBuilder_USE_ORIGINAL_FLAGS (0x00000001) - /// Use the create flags from the original IUri, if they are available. - /// - /// - /// [in] - /// - /// DWORD that may contain a combination of the following flags, or zero. Reserved characters in the specified properties - /// may be percent encoded, if required. - /// - /// Uri_HAS_USER_NAME (0x00000800) - /// Allow encoding of Uri_PROPERTY_USER_NAME. - /// Uri_HAS_PASSWORD (0x00000040) - /// Allow encoding of Uri_PROPERTY_PASSWORD. - /// Uri_HAS_HOST (0x00000020) - /// Allow encoding of Uri_PROPERTY_HOST. - /// Uri_HAS_PATH (0x00000080) - /// Allow encoding of Uri_PROPERTY_PATH. - /// Uri_HAS_QUERY (0x00000100) - /// Allow encoding of Uri_PROPERTY_QUERY. - /// Uri_HAS_FRAGMENT (0x00000010) - /// Allow encoding of Uri_PROPERTY_FRAGMENT. - /// - /// - /// [in] - /// Reserved. Must be set to 0. - /// - /// - /// [out] - /// Address of pointer variable of type IUri that receives the new object. - /// - /// - /// CreateUriWithFlags was introduced in Windows Internet Explorer 7. - /// - /// If no changes are made, this method may return a pointer to the original IUri object (after incrementing the - /// reference count). - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774989(v=vs.85) - // HRESULT CreateUriWithFlags( [in] DWORD dwCreateFlags, [in] DWORD dwUriBuilderFlags, [in] DWORD dwAllowEncodingPropertyMask, - // [in] DWORD_PTR dwReserved, [out] IUri **ppIUri ); - IUri CreateUriWithFlags(Uri_CREATE dwCreateFlags, uint dwUriBuilderFlags, Uri_HAS dwAllowEncodingPropertyMask, IntPtr dwReserved = default); - - /// Returns the original IUri. - /// - /// Address to a pointer variable that receives the original IUri. The calling context must Release the interface when it is no - /// longer needed. - /// - /// GetIUri was introduced in Windows Internet Explorer 7. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774992(v=vs.85) - // HRESULT GetIUri( [out] IUri **ppIUri ); - IUri GetIUri(); - - /// Sets the current IUri. - /// Pointer to an existing IUri interface. - /// - /// SetIUri was introduced in Windows Internet Explorer 7. - /// Setting the current IUri invalidates all properties. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775006(v=vs.85) - // HRESULT SetIUri( [in] IUri *pIUri ); - void SetIUri([In] IUri pIUri); - - /// Retrieves the value of the fragment component. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzFragment. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetFragment was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774990(v=vs.85) - // HRESULT GetFragment( [out] DWORD *pcchFragment, [out] LPCWSTR *ppwzFragment ); - void GetFragment(out uint pcchFragment, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzFragment); - - /// Retrieves the value of the host component. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzHost. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetHost was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774991(v=vs.85) - // HRESULT GetHost( [out] DWORD *pcchHost, [out] LPCWSTR *ppwzHost ); - void GetHost(out uint pcchHost, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzHost); - - /// Retrieves the value of the password component. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzPassword. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetPassword was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774993(v=vs.85) - // HRESULT GetPassword( [out] DWORD *pcchPassword, [out] LPCWSTR *ppwzPassword ); - void GetPassword(out uint pcchPassword, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzPassword); - - /// Retrieves the value of the path component. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzPath. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetPath was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774994(v=vs.85) - // HRESULT GetPath( [out] DWORD *pcchPath, [out] LPCWSTR *ppwzPath ); - void GetPath(out uint pcchPath, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzPath); - - /// Retrieves the value of the port component. - /// - /// [out]Address of a variable of type BOOL that receives TRUE if the port property has been set, or FALSE otherwise. - /// - /// [out]Address of a variable of type DWORD that receives the current value. - /// GetPort was introduced in Windows Internet Explorer 7. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774995(v=vs.85) - // HRESULT GetPort( [out] BOOL *pfHasPort, [out] DWORD *pdwPort ); - void GetPort([MarshalAs(UnmanagedType.Bool)] out bool pfHasPort, out uint pdwPort); - - /// Retrieves the value of the query component. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzQuery. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetQuery was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774996(v=vs.85) - // HRESULT GetQuery( [out] DWORD *pcchQuery, [out] LPCWSTR *ppwzQuery ); - void GetQuery(out uint pcchQuery, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzQuery); - - /// Retrieves the value of the protocol scheme name. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzSchemeName. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetSchemeName was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774997(v=vs.85) - // HRESULT GetSchemeName( [out] DWORD *pcchSchemeName, [out] LPCWSTR *ppwzSchemeName ); - void GetSchemeName(out uint pcchSchemeName, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzSchemeName); - - /// Retrieves the value of the username component. - /// - /// [out]Address of a variable of type DWORD that receives the length of the string returned in ppwzUserName. - /// - /// [out]Address of a string variable that receives the current value. - /// - /// GetUserName was introduced in Windows Internet Explorer 7. - /// The calling context must not free the returned pointer. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774998(v=vs.85) - // HRESULT GetUserName( [out] DWORD *pcchUserName, [out] LPCWSTR *ppwzUserName ); - void GetUserName(out uint pcchUserName, [MarshalAs(UnmanagedType.LPWStr)] out string ppwzUserName); - - /// Sets the fragment component. - /// String variable that contains the new value, or NULL to remove the fragment component. - /// - /// SetFragment was introduced in Windows Internet Explorer 7. - /// Setting the fragment component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_DISPLAY_URI. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775004(v=vs.85) - // HRESULT SetFragment( [in] LPCWSTR pwzNewValue ); - void SetFragment([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Sets the host (fully qualify domain) component. - /// String variable that contains the new value. Must be neither empty nor NULL. - /// - /// SetHost was introduced in Windows Internet Explorer 7. - /// Setting the host component invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_AUTHORITY, and Uri_PROPERTY_DOMAIN. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775005(v=vs.85) - // HRESULT SetHost( [in] LPCWSTR pwzNewValue ); - void SetHost([MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Sets the password component. - /// String variable the contains the new value, or NULL to remove the password component. - /// - /// SetPassword was introduced in Windows Internet Explorer 7. - /// Setting the password component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_AUTHORITY. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775007(v=vs.85) - // HRESULT SetPassword( [in] LPCWSTR pwzNewValue ); - void SetPassword([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Sets the path component. - /// - /// String variable that contains the new value, or NULL to remove the path component. Must specify an absolute path if not NULL. - /// - /// - /// SetPath was introduced in Windows Internet Explorer 7. - /// The path component also includes the resource (filename and extension). - /// To specify a relative path, use CoInternetCombineIUri. - /// Setting the path component invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DISPLAY_URI, and Uri_PROPERTY_PATH_AND_QUERY. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775008(v=vs.85) - // HRESULT SetPath( [in] LPCWSTR pwzNewValue ); - void SetPath([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Sets the port component. - /// - /// [in] BOOL that contains TRUE if a new port number is specified, or FALSE to use the default port for - /// the protocol scheme. - /// - /// [in] DWORD that contains the new port value. - /// - /// SetPort was introduced in Windows Internet Explorer 7. - /// Setting the port number invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DISPLAY_URI, and Uri_PROPERTY_AUTHORITY. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775009(v=vs.85) - // HRESULT SetPort( [in] BOOL fHasPort, [in] DWORD dwNewValue ); - void SetPort([MarshalAs(UnmanagedType.Bool)] bool fHasPort, uint dwNewValue); - - /// Sets the query component. - /// String variable that contains the new value, or NULL to remove the query component. - /// - /// SetQuery was introduced in Windows Internet Explorer 7. - /// Setting the query component invalidates Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DISPLAY_URI, and Uri_PROPERTY_PATH_AND_QUERY. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775010(v=vs.85) - // HRESULT SetQuery( [in] LPCWSTR pwzNewValue ); - void SetQuery([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Sets the protocol scheme name. - /// String variable that contains the new value. Must be neither empty nor NULL. - /// - /// SetSchemeName was introduced in Windows Internet Explorer 7. - /// Setting the scheme name component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_DISPLAY_URI. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775011(v=vs.85) - // HRESULT SetSchemeName( [in] LPCWSTR pwzNewValue ); - void SetSchemeName([MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Sets the username component. - /// String variable that contains the new value, or NULL to remove the username component. - /// - /// SetUserName was introduced in Windows Internet Explorer 7. - /// Setting the username component invalidates Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_AUTHORITY. - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775012(v=vs.85) - // HRESULT SetUserName( [in] LPCWSTR pwzNewValue ); - void SetUserName([Optional, MarshalAs(UnmanagedType.LPWStr)] string pwzNewValue); - - /// Removes the specified properties as well as any derived properties. - /// - /// [in] - /// DWORD that contains a combination of the following flags: - /// Uri_HAS_USER_NAME (0x00000800) - /// Remove Uri_PROPERTY_USER_NAME. - /// Uri_HAS_PASSWORD (0x00000040) - /// Remove Uri_PROPERTY_PASSWORD. - /// Uri_HAS_HOST (0x00000020) - /// Remove Uri_PROPERTY_HOST. - /// Uri_HAS_PORT (0x00008000) - /// Remove Uri_PROPERTY_PORT. - /// Uri_HAS_PATH (0x00000080) - /// Remove Uri_PROPERTY_PATH. - /// Uri_HAS_QUERY (0x00000100) - /// Remove Uri_PROPERTY_QUERY. - /// Uri_HAS_FRAGMENT (0x00000010) - /// Remove Uri_PROPERTY_FRAGMENT. - /// - /// - /// RemoveProperties was introduced in Windows Internet Explorer 7. - /// - /// Compound properties (such as Uri_PROPERTY_AUTHORITY, Uri_PROPERTY_USER_INFO, and - /// Uri_PROPERTY_PATH_AND_QUERY) and sub-properties (such as Uri_PROPERTY_DOMAIN and - /// Uri_PROPERTY_EXTENSION) are also removed when their associated property primitives are removed. - /// Uri_PROPERTY_ABSOLUTE_URI and Uri_PROPERTY_DISPLAY_URI are also invalidated when subcomponents are modified. - /// - /// - /// Uri_PROPERTY_SCHEME and Uri_PROPERTY_SCHEME_NAME cannot be removed. Use SetSchemeName to modify the - /// scheme component. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775003(v=vs.85) - // HRESULT RemoveProperties( [in] DWORD dwPropertyMask ); - void RemoveProperties(Uri_HAS dwPropertyMask); - - /// Returns TRUE if component values have been modified. - /// A variable of type BOOL that receives TRUE if components have been modified, or FALSE otherwise. - /// HasBeenModified was introduced in Windows Internet Explorer 7. - // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775001(v=vs.85) - // HRESULT HasBeenModified( [out] BOOL *pfModified ); - [return: MarshalAs(UnmanagedType.Bool)] - bool HasBeenModified(); - } - /// Installs the specified component. /// A pointer to a string that specifies the name of the component. /// @@ -3748,6 +2517,1036 @@ namespace Vanara.PInvoke [PInvokeData("Urlmon.h")] public static extern HRESULT CreateURLMonikerEx(IMoniker pMkCtx, [MarshalAs(UnmanagedType.LPWStr)] string szURL, out IMoniker ppmk, URL_MK dwFlags); + /// + /// Creates a new URL moniker from a full Uniform Resource Identifier (URI), or from a base context URL moniker and a relative URI. + /// + /// + /// A pointer to an IMoniker interface of the URL moniker to use as the base context. The pMkCtx parameter can be NULL. + /// + /// A pointer to an IUri interface that contains a full or relative URI. + /// A pointer to an IMoniker interface for the new URL moniker. + /// + /// An unsigned long integer value that contains a combination of the following flags. + /// URL_MK_LEGACY (0) + /// Create legacy file URLs. Equivalent to Uri_CREATE_FILE_USE_DOS_PATH. + /// URL_MK_UNIFORM (1) + /// Use the updated URL parser. + /// URL_MK_NO_CANONICALIZE (2) + /// Do not attempt to convert the URL moniker to the standard format. + /// + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// Any two URIs can be combined. The base URI and context URI can be any combination of relative and absolute. This is also true + /// for the CoInternetCombineUrl function, the CoInternetCombineUrlEx function, and the CoInternetCombineIUri function. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775104(v=vs.85) HRESULT + // CreateURLMonikerEx2( IMoniker *pMkCtx, IUri *pUri, IMoniker **ppmk, DWORD dwFlags ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT CreateURLMonikerEx2(IMoniker pMkCtx, IUri pUri, out IMoniker ppmk, URL_MK dwFlags); + + /// + /// This synchronous function is invoked by the client of a Windows Internet Explorer feature before the client accesses the feature. + /// + /// + /// [in] + /// A handle to the parent window of the HTML dialog box. + /// + /// + /// [in] + /// A pointer to a union that provides ways of mapping to a CLSID. Note that is defined in . + /// + /// + /// [in, out] + /// + /// A ointer to a structure that contains a list of attributes used to look up a class implementation. The installed version number + /// is returned in , which is passed in. + /// + /// + /// + /// [in] + /// The control behavior. The following values are valid. + /// FIEF_FLAG_FORCE_JITUI (0x0001) + /// + /// Force JIT, even if the user has canceled a previous JIT in the same session, or has specified to this feature. Note: For + /// Internet Explorer 7, this flag is not respected; it is overridden by E_ACCESSDENIED. + /// + /// FIEF_FLAG_PEEK (0x0002) + /// + /// Do not faultin, just peek. Note: Peek also returns the currently installed version in the QUERYCONTEXT. For Internet Explorer 7, + /// it disables the Java dialog box. + /// + /// FIEF_FLAG_SKIP_INSTALLED_VERSION_CHECK (0x0004) + /// + /// Ignores local version as being satisfactory and forces JIT download. Typically, this is called by code download, or by another + /// caller after a CoCreateInstance call has failed with or (missing a dependency DLL). Note: The registry might show that this + /// feature is installed when it is not, or when it is damaged. For Internet Explorer 7, this flag is not respected; it is + /// overridden by . + /// + /// + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// + /// Behavior is installed. Call CoCreateInstance or IMoniker::BindToObject or another system service to invoke the class or MIME handler. + /// + /// + /// + /// S_FALSE + /// + /// The class or MIME handler is not part of an Internet Explorer feature. Call CoCreateInstance, IMoniker::BindToObject, or some + /// other system service to invoke the class or MIME handler. Active setup settings are not found in registry. + /// + /// + /// + /// E_ACCESSDENIED + /// The administrator has turned off the JIT feature. + /// + /// + /// + /// + /// + /// If the feature is already installed, then the function succeeds and the client should attempt to access the feature. Successful + /// return does not guarantee that the feature is fully installed, or that the feature will work. The client should still provide + /// access to the feature with proper error checking. + /// + /// + /// Note The importance of this function degraded significantly after Microsoft Internet Explorer 6 SP1b and Windows XP, due + /// to a lack of dependence on JIT in components. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa359663(v=vs.85) HRESULT + // FaultInIEFeature( _In_ HWND hWnd, _In_ uCLSSPEC *pClassSpec, _Inout_ QUERYCONTEXT *pQuery, _In_ DWORD dwFlags ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT FaultInIEFeature(HWND hWnd, in uCLSSPEC pClassSpec, ref QUERYCONTEXT pQuery, FIEF_FLAG dwFlags); + + /// Retrieves the 32-bit value assigned to the specified media type. + /// The address of a string value that identifies the media type. + /// The address of the CLIPFORMAT value assigned to the specified media type. + /// Returns S_OK if successful, or an error value otherwise. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775105(v=vs.85) HRESULT + // FindMediaType( LPCSTR rgszTypes, CLIPFORMAT *rgcfTypes ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT FindMediaType([MarshalAs(UnmanagedType.LPStr)] string rgszTypes, out CLIPFORMAT rgcfTypes); + + /// Retrieves the CLSID for the specified media type. + /// [in]A pointer to the bind context on which the media type is registered. + /// [in]A string identifying the media types. This parameter cannot be NULL. + /// [out]A pointer to the CLSID corresponding to the specified media types in szType. + /// [in]Reserved. Must be set to 0. + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775106(v=vs.85) HRESULT + // FindMediaTypeClass( _In_ LPBC pbc, _In_ LPCSTR szType, _Out_ CLSID *pclsID, _Reserved_ DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT FindMediaTypeClass([In] IBindCtx pbc, [MarshalAs(UnmanagedType.LPStr)] string szType, out Guid pclsID, uint dwReserved = 0); + + /// Determines the MIME type from the data provided. + /// A pointer to the IBindCtx interface. Can be set to NULL. + /// + /// A pointer to a string value that contains the URL of the data. Can be set to NULL if pBuffer contains the data to be sniffed. + /// + /// + /// A pointer to the buffer that contains the data to be sniffed. Can be set to NULL if pwzUrl contains a valid URL. + /// + /// An unsigned long integer value that contains the size of the buffer. + /// + /// A pointer to a string value that contains the proposed MIME type. This value is authoritative if type cannot be determined from + /// the data. If the proposed type contains a semi-colon (;) it is removed. This parameter can be set to NULL. + /// + /// + /// FMFD_DEFAULT (0x00000000) + /// No flags specified. Use default behavior for the function. + /// FMFD_URLASFILENAME (0x00000001) + /// Treat the specified pwzUrl as a file name. + /// FMFD_ENABLEMIMESNIFFING (0x00000002) + /// + /// Internet Explorer 6 for Windows XP SP2 and later. Use MIME-type detection even if FEATURE_MIME_SNIFFING is detected. + /// Usually, this feature control key would disable MIME-type detection. + /// + /// FMFD_IGNOREMIMETEXTPLAIN (0x00000004) + /// + /// Internet Explorer 6 for Windows XP SP2 and later. Perform MIME-type detection if "text/plain" is proposed, even if data sniffing + /// is otherwise disabled. Plain text may be converted to if HTML tags are detected. + /// + /// FMFD_SERVERMIME (0x00000008) + /// + /// Internet Explorer 8. Use the authoritative MIME type specified in pwzMimeProposed. Unless FMFD_IGNOREMIMETEXTPLAIN is + /// specified, no data sniffing is performed. + /// + /// FMFD_RESPECTTEXTPLAIN (0x00000010) + /// Internet Explorer 9. Do not perform detection if "text/plain" is specified in pwzMimeProposed. + /// FMFD_RETURNUPDATEDIMGMIMES (0x00000020) + /// Internet Explorer 9. Returns and instead of and . + /// + /// The address of a string value that receives the suggested MIME type. + /// Reserved. Must be set to 0. + /// + /// This function can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The operation completed successfully. + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_INVALIDARG + /// One or more arguments are invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory to complete the operation. + /// + /// + /// + /// + /// + /// MIME type detection, or "data sniffing," refers to the process of determining an appropriate MIME type from binary data. The + /// final result depends on a combination of server-supplied MIME type headers, file name extension, and/or the data itself. + /// Usually, only the first 256 bytes of data are significant. For more information and a complete list of recognized MIME types, + /// see MIME Type Detection in Internet Explorer. + /// + /// + /// If pwzUrl is specified without data to be sniffed (pBuffer), the file name extension determines the MIME type. If the file name + /// extension cannot be mapped to a MIME type, this method returns E_FAIL unless a proposed MIME type is supplied in pwzMimeProposed. + /// + /// After ppwzMimeOut returns and is read, the memory allocated for it should be freed with the operator delete function. + /// + /// Internet Explorer 8 and later. FindMimeFromData will not promote image types to "text/html" even if the data lacks + /// signature bytes. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775107(v=vs.85) HRESULT + // FindMimeFromData( LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags, LPWSTR + // *ppwzMimeOut, _Reserved_ DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT FindMimeFromData([In] IBindCtx pBC, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, IntPtr pBuffer, uint cbSize, + [MarshalAs(UnmanagedType.LPWStr)] string pwzMimeProposed, FMFD dwMimeFlags, out SafeCoTaskMemString ppwzMimeOut, uint dwReserved = 0); + + /// Gets the CLSID of the object to instantiate for the specified file. + /// + /// A pointer to a bind context that can affect the mapping to a CLSID. This parameter is usually NULL. It can be used + /// to override system CLSID mappings when it is used with RegisterMediaTypeClass. + /// + /// A pointer to a string variable that contains the file name. Can be set to NULL. + /// A pointer to a buffer that contains data from the beginning of the file. Can be set to NULL. + /// An unsigned long integer value that contains the size of pBuffer. + /// A pointer to a string variable that contains the MIME type of the file. Can be set to NULL. + /// Reserved. Must be set to 0. + /// + /// A pointer to a CLSID that receives the CLSID of the object to instantiate for the specified file. + /// + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// Windows Internet Explorer 9. This function can also return a class identifier (CLSID) from structured storage files if sniffing + /// is allowed for the security zone ( URLACTION_ALLOW_STRUCTURED_STORAGE_SNIFFING is enabled) and sniffing is not disabled + /// for the process by using . Structured storage sniffing is enabled by default in the Local intranet and Trusted sites zones. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775108(v=vs.85) HRESULT + // GetClassFileOrMime( LPBC pBC, LPCWSTR szFilename, LPVOID pBuffer, DWORD cbSize, LPCWSTR szMime, _Reserved_ DWORD dwReserved, + // CLSID *pclsid ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT GetClassFileOrMime([In, Optional] IBindCtx pBC, [Optional, MarshalAs(UnmanagedType.LPWStr)] string szFilename, IntPtr pBuffer, uint cbSize, + [Optional, MarshalAs(UnmanagedType.LPWStr)] string szMime, [Optional] uint dwReserved, out Guid pclsid); + + /// Gets a string component ID from information contained in a union . + /// [in]A pointer to a union that provides ways of mapping to a CLSID. + /// + /// [out]A pointer to a string containing a component ID that is based on a , which is defined in . + /// + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The component ID was successfuly retrieved. + /// + /// + /// S_FALSE + /// The class or Mime is not part of an Internet Explorer feature. + /// + /// + /// E_INVALIDARG + /// The parameter contains invalid data. + /// + /// + /// E_OUTOFMEMORY + /// The program does not have enough memory for successful operation. + /// + /// + /// + /// + /// Note The importance of this function degraded significantly after Microsoft Internet Explorer 6 SP1b and Windows XP, due + /// to a lack of dependence on just-in-time (JIT) in components. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa359665(v=vs.85) HRESULT + // GetComponentIDFromCLSSPEC( _In_ uCLSSPEC *pClassSpec, _Out_ LPSTR *ppszComponentID ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT GetComponentIDFromCLSSPEC(in uCLSSPEC pClassSpec, out SafeCoTaskMemHandle ppszComponentID); + + /// This function provides the current Install Scope to a Microsoft ActiveX DLL. + /// + /// [out] + /// A pointer to a DWORD which contains one of the Install Scope values. + /// (INSTALL_SCOPE_USER) + /// The ActiveX control should register in the current user profile. + /// (INSTALL_SCOPE_MACHINE) + /// The ActiveX control should register machine-wide. + /// (INSTALL_SCOPE_INVALID) + /// The Install Scope could not be retrieved. The ActiveX control should not install. + /// + /// + /// This function can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The Install Scope was successfully retrieved. + /// + /// + /// E_FAIL + /// An error occurred. + /// + /// + /// + /// + /// + /// This function call is intended to be used by an ActiveX DLL during its install-time registration. It provides the current + /// Install Scope to the ActiveX DLL. The ActiveX package developer can choose to install or not, depending on the returned scope. + /// For example, if the ActiveX package requires machine scope, but only user scope is available, the developer can choose not to + /// install the package. + /// + /// Registration is done using DllRegisterServer or DllUnregisterServer. + /// + /// Important The ActiveX package should install and register only if both S_OK and a valid value for pdwScope have been returned. + /// + /// + /// S_OK is also returned when the configuration does not support Windows Internet Explorer Install Scope. Therefore, when Windows + /// Internet Explorer 8 is running on an operating system that is earlier than Windows Vista, the function will return + /// INSTALL_SCOPE_MACHINE. The ActiveX control should install machine-wide in this case. + /// + /// Only one Install Scopes value will be returned by this function. + /// The ActiveX templates in Active Template Library (ATL) 7 and earlier do not support per-user ActiveX Install Scope. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/cc197030(v=vs.85) HRESULT + // IEInstallScope( _Out_ LPDWORD pdwScope ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT IEInstallScope(out uint pdwScope); + + /// Tests to determine whether a moniker supports asynchronous binding. + /// The PMK. + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// E_INVALIDARG + /// The pmk parameter is invalid. + /// + /// + /// S_FALSE + /// The specified moniker is not asynchronous. + /// + /// + /// S_OK + /// The specified moniker is asynchronous. + /// + /// + /// + /// + /// + /// A moniker implementation is asynchronous if it supports the interface, which is an empty interface that is an implementation of + /// IUnknown. The IsAsyncMoniker function tests for support of and handles composite monikers correctly. + /// + /// + /// No public headers define the interface; however, you can support the interface by returning a pointer to your object in response + /// to QueryInterface for , which is defined as follows: + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775110(v=vs.85) HRESULT + // IsAsyncMoniker( _In_ IMoniker *pmk ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT IsAsyncMoniker(IMoniker pmk); + + /// Determines if a specified string is a valid URL. + /// [in]A pointer to the IBindCtx interface. This parameter is currently ignored. It should be set to NULL. + /// [in]A pointer to a string value that contains the full URL to check. + /// [in]Reserved. Must be set to 0. + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The szURL parameter contains a valid URL. + /// + /// + /// S_FALSE + /// The szURL parameter does not contain a valid URL. + /// + /// + /// E_INVALIDARG + /// One of the parameters is invalid. + /// + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775112(v=vs.85) HRESULT + // IsValidURL( _In_ LPBC pBC, _In_ LPCWSTR szURL, _Reserved_ DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT IsValidURL([Optional] IBindCtx pBC, [MarshalAs(UnmanagedType.LPWStr)] string szURL, uint dwReserved = 0); + + /// Creates a moniker to the object that is specified by the given string. + /// [in]The address of the IBindCtx interface of the bind context in which to accumulate bound objects. + /// [in]The address of the string value to parse. + /// + /// [out]The address of an unsigned long integer value that indicates the number of characters successfully parsed. + /// + /// [out]A pointer to the IMoniker interface of the resulting moniker. + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// Successful. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory to complete the operation. + /// + /// + /// INET_E_UNKNOWN_PROTOCOL + /// The szDisplayName parameter contains a protocol (other than telnet) that does not have a valid protocol handler assigned. + /// + /// + /// MK_E_SYNTAX + /// + /// Parsing failed because szDisplayName can only be partially resolved into a moniker. In this case, pcchEaten receives the number + /// of characters that are successfully parsed into a moniker prefix. + /// + /// + /// + /// NOERROR + /// The szDisplayName uses a telnet protocol, for which the function does not have a valid protocol handler. + /// + /// + /// + /// + /// + /// When MK_E_SYNTAX is returned and pcchEaten contains a nonzero value, a subsequent call to MkParseDisplayNameEx with the + /// same pbc parameter and a shortened szDisplayName parameter returns a valid moniker. + /// + /// + /// Security Warning: Calling MkParseDisplayName or MkParseDisplayNameEx with a szDisplayName parameter from a + /// non-trusted source is unsafe. Not only can an arbitrary class be instantiated but some moniker implementations might act on the + /// string during parsing instead of deferring this to binding. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775113(v=vs.85) HRESULT + // MkParseDisplayNameEx( _In_ IBindCtx *pbc, _In_ LPWSTR szDisplayName, _Out_ unsigned long *pcchEaten, _Out_ IMoniker **ppmk ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT MkParseDisplayNameEx(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string szDisplayName, out uint pcchEaten, out IMoniker ppmk); + + /// Retrieves the User-Agent HTTP request header string that is currently being used. + /// + /// [in] + /// 7 | UAS_EXACTLEGACY (0x1000) + /// Internet Explorer 7 in exact legacy mode. + /// 7 + /// Internet Explorer 7 in compatible mode. + /// 8 + /// Internet Explorer 8. + /// 0 + /// Default. As currently set. + /// + /// + /// [out] + /// Pointer to a string value that contains the User-Agent request header string that is currently being used. + /// + /// + /// [out] + /// Pointer to an unsigned long integer value that contains the length of the User-Agent request header string. + /// + /// + /// Returns one of the following values: + /// + /// + /// Return code + /// Description + /// + /// + /// E_INVALIDARG + /// One of the parameters is invalid. + /// + /// + /// E_OUTOFMEMORY + /// The operation ran out of memory. + /// + /// + /// NOERROR + /// The function completed successfully. + /// + /// + /// + /// + /// + /// Passing a bitwise OR of 7 | UAS_EXACTLEGACY to dwOption specifies Internet Explorer 7 running in exact legacy mode, as + /// opposed to compatible mode. + /// + /// Internet Explorer 8. dwOption is no longer reserved and must have one of the required values. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775114(v=vs.85) HRESULT + // ObtainUserAgentString( _In_ DWORD dwOption = 0, _Out_ LPCSTR *pcszUAOut, _Out_ DWORD *cbSize ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT ObtainUserAgentString(uint dwOption, [MarshalAs(UnmanagedType.LPStr)] StringBuilder pcszUAOut, ref uint cbSize); + + /// Registers a callback interface with an existing bind context. + /// [in]A pointer to the IBindCtx interface from which to receive callbacks. + /// [in]A pointer to the IBindStatusCallback interface implementation to be registered. + /// [out]A pointer to a previously registered instance of IBindStatusCallback. May be NULL. + /// [in]Reserved. Must be set to 0. + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// Successful. + /// + /// + /// E_FAIL + /// No new callbacks allowed after binding has started. + /// + /// + /// E_INVALIDARG + /// One or more parameters is invalid. + /// + /// + /// E_OUTOFMEMORY + /// There is insufficient memory to register the callback with the bind context. + /// + /// + /// + /// + /// + /// The IBindStatusCallback interface passed into the pbsc parameter receives callbacks on any binding operations that uses + /// the bind context passed into the pbc parameter. + /// + /// + /// More than one IBindStatusCallback can be registered at a time. Each callback is notified in sequence. If the + /// ppbscPrevious parameter is specified, the previously registered IBindStatusCallback interface is removed from the list + /// and returned. The caller would then be responsible for forwarding any binding events it receives to the previous handler, if wanted. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775115(v=vs.85) HRESULT + // RegisterBindStatusCallback( _In_ IBindCtx *pbc, _In_ IBindStatusCallback *pbsc, _Out_ IBindStatusCallback **ppbscPrevious, + // _Reserved_ DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT RegisterBindStatusCallback(IBindCtx pbc, IBindStatusCallback pbsc, out IBindStatusCallback ppbscPrevious, uint dwReserved = 0); + + /// Registers a FORMATETC enumerator object on the given bind context. + /// [in]A pointer to the IBindCtx interface for the bind context on which to register the enumerator. + /// [in]A pointer to the IEnumFORMATETC interface for the enumerator to register. + /// [in]Reserved. Must be set to 0. + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters is invalid. + /// + /// The enumerator is used to determine the format types that are preferred for the bind operation. Typically, the pEFetc parameter + /// is the pointer obtained through a call to CreateFormatEnumerator. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775116(v=vs.85) HRESULT + // RegisterFormatEnumerator( _In_ LPBC pBC, _In_ IEnumFORMATETC *pEFetc, _Reserved_ DWORD reserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT RegisterFormatEnumerator(IBindCtx pBC, IEnumFORMATETC pEFetc, uint reserved = 0); + + /// Registers a mapping of media types to CLSID s to override the default mapping specified in the registry. + /// [in]A pointer to the IBindCtx interface for the bind context on which the media types are registered. + /// + /// [in]An unsigned integer value that contains the number of media type strings in the rgszTypes array. This parameter cannot be zero. + /// + /// + /// [in]A pointer to an array of strings that identify the media types to register. None of these strings can be NULL. See + /// Clipboard Formats for a list of valid values. + /// + /// + /// [in]A pointer to an array of CLSID s to associate with the media type strings in the rgszTypes array. + /// + /// [in]Reserved. Must be set to 0. + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters is invalid. + /// + /// The new mapping is used in calls to IMoniker::BindToObject when binding objects on the specified bind context. + /// + /// This function is used by moniker clients calling IMoniker::BindToObject to override the default registry mapping between MIME + /// types and CLSID s. Typically, the default mapping provided in the registry is used. However, a browser might require the + /// CLSID for its HTML viewer to be associated with .txt files, without changing the default registry association for text + /// files. The override is used for all bind operations using the specified bind context. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775117(v=vs.85) HRESULT + // RegisterMediaTypeClass( _In_ LPBC pbc, _In_ UINT ctypes, _In_ LPCSTR *rgszTypes, _In_ CLSID *rgclsID, _Reserved_ DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT RegisterMediaTypeClass(IBindCtx pbc, uint ctypes, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] rgszTypes, [MarshalAs(UnmanagedType.LPArray)] Guid[] rgclsID, uint dwReserved = 0); + + /// Registers media type strings. + /// [in]The number of media type strings in the rgszTypes array. This parameter cannot be zero. + /// + /// [in]The address of an array of strings identifying the media types to be registered. None of the strings in the array can be + /// NULL. See Clipboard Formats for a list of valid values. + /// + /// + /// [out]The address of an array of the 32-bit values assigned to corresponding media types in rgszTypes. See the following Remarks + /// section for the definition of CLIPFORMAT. + /// + /// Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775118(v=vs.85) HRESULT + // RegisterMediaTypes( _In_ UINT ctypes, _In_ LPCSTR *rgszTypes, _Out_ CLIPFORMAT *rgcfTypes ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT RegisterMediaTypes(uint ctypes, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] rgszTypes, [Out] CLIPFORMAT[] rgcfTypes); + + /// Releases the resources used by the specified BINDINFO structure. + /// This function does not return a value. + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775119(v=vs.85) void + // ReleaseBindInfo( BINDINFO *pbindinfo ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern void ReleaseBindInfo(ref BINDINFO pbindinfo); + + /// Revokes a bind status callback interface previously registered on a bind context. + /// [in]The address of the IBindCtx interface for the bind context from which the callback interface is revoked. + /// [in]The address of the IBindStatusCallback interface to revoke. + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// Successful. + /// + /// + /// E_FAIL + /// The callback interface specified is not registered on the specified bind context. + /// + /// + /// E_INVALIDARG + /// One or more parameters is invalid. + /// + /// + /// + /// + /// This function will not succeed if it is made during a bind operation. + /// + /// Note You don't have to make this call for every use of a bind context. Although it is not recommended, it is possible to + /// reuse the same bind context and the same callback for several bind operations. After the Release method is called, all + /// registered objects on that bind context are revoked, including the callback interfaces. Releasing a bind context implicitly + /// releases all registered callbacks. If you want to reuse a bind context, you can use RevokeBindStatusCallback to remove a + /// registered callback so that it is not reused. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775120(v=vs.85) HRESULT + // RevokeBindStatusCallback( _In_ IBindCtx *pbc, _In_ IBindStatusCallback *pbsc ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT RevokeBindStatusCallback(IBindCtx pbc, IBindStatusCallback pbsc); + + /// Removes a format enumerator from the given bind context. + /// [in]The address of the IBindCtx interface for the bind context from which the enumerator is to be revoked. + /// [in]The address of the IEnumFORMATETC interface for the enumerator to revoke. + /// Returns S_OK if the enumerator is successfully removed, or E_INVALIDARG if one or more parameters is invalid. + /// + /// + /// This function removes a format enumerator from the bind context specified in pbc. The format enumerator must have been + /// registered previously with a call to RegisterFormatEnumerator. + /// + /// + /// Note You don't have to make this call for every use of a bind context. Although it is not recommended it is possible to + /// reuse the same bind context and the same format enumerator for several bind operations. After the Release method is called, all + /// registered objects on that bind context are revoked, including the format enumerator interfaces. Releasing a bind context + /// implicitly releases all registered format enumerators. If you want to reuse a bind context, you can use + /// RevokeFormatEnumerator to remove a registered format enumerator so that it is not reused. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775121(v=vs.85) HRESULT + // RevokeFormatEnumerator( _In_ LPBC pbc, _In_ IEnumFORMATETC *pEFetc ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT RevokeFormatEnumerator(IBindCtx pbc, IEnumFORMATETC pEFetc); + + /// Downloads data to the Internet cache and returns the file name of the cache location for retrieving the bits. + /// + /// [in]A pointer to the controlling IUnknown interface of the calling ActiveX component, if the caller is an ActiveX component. If + /// the caller is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a COM object that is + /// contained in another component, such as an ActiveX control in the context of an HTML page. This parameter represents the + /// outermost IUnknown of the calling component. The function attempts the download in the context of the ActiveX client framework, + /// and allows the caller container to receive callbacks on the progress of the download. + /// + /// [in]A pointer to a string value that contains the URL to download. Cannot be set to NULL. + /// [out]A pointer to a string value that contains the name of the downloaded file. Cannot be set to NULL. + /// [in]An unsigned long integer value that contains the number of characters of the szFileName value. + /// Reserved. Must be set to 0. + /// + /// [in, optional]A pointer to the IBindStatusCallback interface of the caller. By using + /// IBindStatusCallback::OnProgress, a caller can receive download status. URLDownloadToCacheFile calls the + /// IBindStatusCallback::OnProgress and IBindStatusCallback::OnDataAvailable methods as data is received. The download + /// operation can be canceled by returning E_ABORT from any callback. This parameter can be set to NULL if status is not required. + /// + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// E_FAIL + /// The operation failed. + /// + /// + /// E_OUTOFMEMORY + /// The buffer length is invalid, or there is insufficient memory to complete the operation. + /// + /// + /// S_OK + /// The operation succeeded. + /// + /// + /// + /// + /// The client can choose to be notified of progress through a notification callback. + /// + /// This function always returns a file name, if the download operation succeeds. If the given URL is a "file:" URL, + /// URLDownloadToCacheFile directly returns the file name for the "file:" URL, instead of making a copy to the cache. If the + /// given URL is an Internet URL, such as "http:" or "ftp:," URLDownloadToCacheFile downloads this file and returns the local + /// file name of the cached copy. Use this function to ensure that a file name is returned without unnecessary copying of data. + /// + /// + /// Windows Internet Explorer 8. URLDownloadToCacheFile does not support IBindStatusCallbackEx and cannot be used to + /// download files over 4 gigabytes (GB) in size. Refer instead to IBindStatusCallbackEx::GetBindInfoEx for a code example. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775122(v=vs.85) HRESULT + // URLDownloadToCacheFile( _In_ LPUNKNOWN lpUnkcaller, _In_ LPCSTR szURL, _Out_ LPTSTR szFileName, _In_ DWORD cchFileName, + // _Reserved_ DWORD dwReserved, _In_opt_ IBindStatusCallback *pBSC ); + [DllImport(Lib.UrlMon, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT URLDownloadToCacheFile([Optional, MarshalAs(UnmanagedType.IUnknown)] object lpUnkcaller, [MarshalAs(UnmanagedType.LPTStr)] string szURL, StringBuilder szFileName, uint cchFileName, [Optional] uint dwReserved, [Optional] IBindStatusCallback pBSC); + + /// Downloads bits from the Internet and saves them to a file. + /// + /// A pointer to the controlling IUnknown interface of the calling ActiveX component, if the caller is an ActiveX component. If the + /// calling application is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a COM object + /// that is contained in another component, such as an ActiveX control in the context of an HTML page. This parameter represents the + /// outermost IUnknown of the calling component. The function attempts the download in the context of the ActiveX client framework, + /// and allows the caller container to receive callbacks on the progress of the download. + /// + /// + /// A pointer to a string value that contains the URL to download. Cannot be set to NULL. If the URL is invalid, + /// INET_E_DOWNLOAD_FAILURE is returned. + /// + /// + /// A pointer to a string value containing the name or full path of the file to create for the download. If szFileName includes a + /// path, the target directory must already exist. + /// + /// Reserved. Must be set to 0. + /// + /// A pointer to the IBindStatusCallback interface of the caller. By using IBindStatusCallback::OnProgress, a caller + /// can receive download status. URLDownloadToFile calls the IBindStatusCallback::OnProgress and + /// IBindStatusCallback::OnDataAvailable methods as data is received. The download operation can be canceled by returning + /// E_ABORT from any callback. This parameter can be set to NULL if status is not required. + /// + /// + /// This function can return one of these values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The download started successfully. + /// + /// + /// E_OUTOFMEMORY + /// The buffer length is invalid, or there is insufficient memory to complete the operation. + /// + /// + /// INET_E_DOWNLOAD_FAILURE + /// The specified resource or callback interface was invalid. + /// + /// + /// + /// + /// + /// URLDownloadToFile binds to a host that supports IBindHost to perform the download. To do this, it first queries + /// the controlling IUnknown passed as pCaller for IServiceProvider, then calls IServiceProvider::QueryService with + /// SID_SBindHost. If pCaller does not support IServiceProvider, IOleObject or IObjectWithSite is used to query the + /// object's host container. If no IBindHost interface is supported, or pCaller is NULL, URLDownloadToFile + /// creates its own bind context to intercept download notifications. + /// + /// + /// URLDownloadToFile returns S_OK even if the file cannot be created and the download is canceled. If the szFileName + /// parameter contains a file path, ensure that the destination directory exists before calling URLDownloadToFile. For best + /// control over the download and its progress, an IBindStatusCallback interface is recommended. + /// + /// + /// Windows Internet Explorer 8. URLDownloadToFile does not support IBindStatusCallbackEx and cannot be used to + /// download files over 4 gigabytes (GB) in size. Refer instead to IBindStatusCallbackEx::GetBindInfoEx for a code example. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775123(v=vs.85) HRESULT + // URLDownloadToFile( LPUNKNOWN pCaller, LPCTSTR szURL, LPCTSTR szFileName, _Reserved_ DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB ); + [DllImport(Lib.UrlMon, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT URLDownloadToFile([Optional, MarshalAs(UnmanagedType.IUnknown)] object pCaller, string szURL, StringBuilder szFileName, [Optional] uint dwReserved, [Optional] IBindStatusCallback lpfnCB); + + /// Gets options for the current Internet session. + /// + /// [in] + /// An unsigned long integer value containing the session options to retrieve. This can be one of the following values. + /// URLMON_OPTION_URL_ENCODING + /// Gets the Internet Explorer default encoding policy. This value was introduced in Internet Explorer 5. + /// URLMON_OPTION_USERAGENT + /// Gets the current user agent string. + /// URLMON_OPTION_USE_BINDSTRINGCREDS + /// Gets a value that indicates whether it is safe to pass credentials to URLMON. Always returns 1. + /// URLMON_OPTION_USE_BROWSERAPPSDOCUMENTS + /// Gets a value that indicates whether URLMON accepts browser application documents. Always returns 1. + /// + /// + /// [in] + /// A pointer to the buffer containing the new session settings. + /// + /// + /// [in] + /// An unsigned long integer value containing the size of pBuffer. + /// + /// + /// [out] + /// + /// A pointer to an unsigned long integer value containing the size of the data stored in the buffer, or the size required to store + /// the data, if the buffer size is insufficient. + /// + /// + /// + /// [in] + /// Reserved. Must be set to 0. + /// + /// + /// Returns one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// S_OK + /// The option was successfully set. + /// + /// + /// E_INVALIDARG + /// The option is not supported, or there is an invalid parameter. + /// + /// + /// E_FAIL + /// The option cannot be set. + /// + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775124(v=vs.85) HRESULT + // UrlMkGetSessionOption( _In_ DWORD dwOption, _In_ __out_bcount_part_opt(dwBufferLength,*pdwBufferLengthOut) LPVOID pBuffer, _In_ + // DWORD dwBufferLength, _Out_ __out DWORD *pdwBufferLengthOut, _Reserved_ __reserved DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT UrlMkGetSessionOption(uint dwOption, IntPtr pBuffer, uint dwBufferLength, out uint pdwBufferLengthOut, uint dwReserved = 0); + + /// Sets options for the current Internet session. + /// + /// [in] + /// An unsigned long integer value that contains the option to set. This can be one of the following values. + /// INTERNET_OPTION_PROXY + /// + /// Sets the proxy settings. pBuffer must contain an INTERNET_PROXY_INFO structure. INTERNET_OPTION_PROXY and INTERNET_PROXY_INFO + /// are defined in the file. For more information, see Introduction to the Microsoft Win32 Internet Functions. + /// + /// INTERNET_OPTION_REFRESH + /// + /// Sets the value that determines if the proxy information can be reread from the registry. The value TRUE indicates that + /// the proxy information can be reread from the registry. For more information, see Introduction to the Microsoft Win32 Internet Functions. + /// + /// URLMON_OPTION_USERAGENT + /// Sets the user agent string for this process. + /// URLMON_OPTION_USERAGENT_REFRESH + /// Refreshes the user agent string from the registry for this process. + /// + /// + /// [in] + /// A pointer to the buffer containing the new session settings. + /// + /// + /// [in] + /// An unsigned long integer value that contains the size of pBuffer. + /// + /// + /// [in] + /// Reserved. Must be set to 0. + /// + /// Returns S_OK if options are successfully set, or E_INVALIDARG if one of the parameters is invalid. + /// + /// + /// This function maps directly to the Windows Internet function InternetSetOption, although UrlMkSetSessionOption allows + /// only global options to be set. + /// + /// + /// To use this function, the client code must include the header file, which declares values for the dwOption parameter and + /// structures for the pBuffer parameter. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775125(v=vs.85) HRESULT + // UrlMkSetSessionOption( _In_ DWORD dwOption, _In_ __in_bcount_opt(dwBufferLength) LPVOID pBuffer, _In_ DWORD dwBufferLength, + // _Reserved_ __reserved DWORD dwReserved ); + [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT UrlMkSetSessionOption(uint dwOption, IntPtr pBuffer, uint dwBufferLength, uint dwReserved = 0); + + /// + /// Creates a blocking type stream object from a URL and downloads the data from the Internet. When the data is downloaded, the + /// client application or control can read it by using the IStream::Read method. + /// + /// + /// A pointer to the controlling IUnknown interface. If the client application or control is not a COM object or a ActiveX control, + /// the parameter can be set to NULL. + /// + /// A pointer to a string value containing the URL to convert to a stream object. Cannot be set to NULL. + /// + /// A pointer to the IStream interface on the stream object created by this function. The caller can read from the stream as soon as + /// it has this pointer. + /// + /// Reserved. Must be set to 0. + /// A pointer to the caller IBindStatusCallback interface. Can be set to NULL. + /// Returns S_OK if the operation succeeded, or E_OUTOFMEMORY if there is insufficient memory to complete the operation. + /// + /// This function is synchronous and returns only after all the data has been downloaded from the Internet. + /// + /// If the IBindStatusCallback::OnProgress method is provided, URLOpenBlockingStream calls the method on a connection + /// activity, including the arrival of data. IBindStatusCallback::OnDataAvailable is never called. By using + /// IBindStatusCallback::OnProgress, a caller can implement a user interface or other progress monitoring functionality. The + /// download operation can be canceled by returning E_ABORT from the IBindStatusCallback::OnProgress call. + /// + /// NoteURLOpenBlockingStream should not be used with protocols that do not return content, such as mailto. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775127(v=vs.85) HRESULT + // URLOpenBlockingStream( LPUNKNOWN pCaller, LPCSTR szURL, LPSTREAM *ppStream, _Reserved_ DWORD dwReserved, LPBINDSTATUSCALLBACK + // lpfnCB ); + [DllImport(Lib.UrlMon, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT URLOpenBlockingStream([Optional, MarshalAs(UnmanagedType.IUnknown)] object pCaller, [MarshalAs(UnmanagedType.LPTStr)] string szURL, out IStream ppStream, [Optional] uint dwReserved, [Optional] IBindStatusCallback lpfnCB); + + /// Creates a pull type stream object from a URL. + /// + /// A pointer to the controlling IUnknown interface of the calling ActiveX component, if the caller is an ActiveX component. If the + /// caller is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a COM object that is + /// contained in another component, such as an ActiveX control in the context of an HTML page. This parameter represents the + /// outermost IUnknown of the calling component. The function attempts the download in the context of the ActiveX client framework, + /// and allows the caller container to receive callbacks on the progress of the download. + /// + /// A string containing the URL to be converted to a stream object. Cannot be set to NULL. + /// Reserved. Must be set to 0. + /// + /// A pointer to the caller IBindStatusCallback interface, on which URLOpenPullStream calls + /// IBindStatusCallback::OnDataAvailable when data arrives from the Internet. The download operation can be canceled by + /// returning E_ABORT from the IBindStatusCallback::OnDataAvailable call. + /// + /// Returns S_OK if the operation succeeded, or E_OUTOFMEMORY if there is insufficient memory to complete the operation. + /// + /// + /// The pull model is more cumbersome than the push model, but it allows the client to control the amount of Internet access for the download. + /// + /// + /// The data is downloaded from the Internet on demand. If not enough data is available locally to satisfy the requests, the + /// IStream::Read call will not block until enough data arrives. Instead, IStream::Read immediately returns E_PENDING, and + /// URLOpenPullStream requests the next packet of data from the Internet server. + /// + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775128(v=vs.85) HRESULT + // URLOpenPullStream( LPUNKNOWN pCaller, LPCSTR szURL, _Reserved_ DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB ); + [DllImport(Lib.UrlMon, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT URLOpenPullStream([Optional, MarshalAs(UnmanagedType.IUnknown)] object pCaller, [MarshalAs(UnmanagedType.LPTStr)] string szURL, [Optional] uint dwReserved, [Optional] IBindStatusCallback lpfnCB); + + /// Creates a push type stream object from a URL. + /// + /// A pointer to the controlling IUnknown interface of the calling ActiveX component, if the caller is an ActiveX component. If the + /// caller is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a COM object that is + /// contained in another component, such as an ActiveX control in the context of an HTML page). This parameter represents the + /// outermost IUnknown of the calling component. The function attempts the download in the context of the ActiveX client framework, + /// and allows the caller container to receive callbacks on the progress of the download. + /// + /// A string containing the URL to be converted to a stream object. Cannot be set to NULL. + /// Reserved. Must be set to 0. + /// + /// A pointer to the caller IBindStatusCallback interface, on which URLOpenStream calls + /// IBindStatusCallback::OnDataAvailable when data arrives from the Internet. The download operation can be canceled by + /// returning E_ABORT from the IBindStatusCallback::OnDataAvailable call. + /// + /// Returns S_OK if the operation succeeded, or E_OUTOFMEMORY if there is insufficient memory to complete the operation. + /// + /// The data is downloaded from the Internet as fast as possible. When data is available, it is pushed at the client through a + /// notification callback. + /// + // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775129(v=vs.85) HRESULT + // URLOpenStream( LPUNKNOWN pCaller, LPCSTR szURL, _Reserved_ DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB ); + [DllImport(Lib.UrlMon, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("Urlmon.h")] + public static extern HRESULT URLOpenStream([Optional, MarshalAs(UnmanagedType.IUnknown)] object pCaller, [MarshalAs(UnmanagedType.LPTStr)] string szURL, [Optional] uint dwReserved, [Optional] IBindStatusCallback lpfnCB); + /// /// Contains additional information on the requested binding operation. The meaning of this structure is specific to the type of /// asynchronous moniker. @@ -3826,61 +3625,5 @@ namespace Vanara.PInvoke /// A default instance of this structure with the size set. public static readonly BINDINFO Default = new BINDINFO { cbSize = (uint)Marshal.SizeOf(typeof(BINDINFO)), securityAttributes = tagSECURITY_ATTRIBUTES.Default }; } - - /* CreateURLMonikerEx2 - FaultInIEFeature - FindMediaType - FindMediaTypeClass - FindMimeFromData - GetClassFileOrMime - GetClassURL - GetComponentIDFromCLSSPEC - IEInstallScope - IsAsyncMoniker - IsValidURL - MkParseDisplayNameEx - ObtainUserAgentString - RegisterBindStatusCallback - RegisterFormatEnumerator - RegisterMediaTypeClass - RegisterMediaTypes - ReleaseBindInfo - RevokeBindStatusCallback - RevokeFormatEnumerator - URLDownloadToCacheFile - URLDownloadToFile - UrlMkGetSessionOption - UrlMkSetSessionOption - URLOpenBlockingStream - URLOpenPullStream - URLOpenStream - - IAuthenticate - IAuthenticateEx - IBindHost - IBinding - IBindProtocol - IBindStatusCallback - IBindStatusCallbackEx - ICatalogFileInfo - ICodeInstall - IHttpNegotiate - IHttpNegotiate2 - IHttpNegotiate3 - IHttpSecurity - IMonikerProp - IPersistMoniker - ISoftDistExt - IUri - IUriBuilderFactory - IUriContainer - IWindowForBindingUI - IWinInetCacheAccess - IWinInetCacheHints - IWinInetCacheHints2 - IWinInetFileStream - IWinInetHttpInfo - IWinInetInfo - */ } } \ No newline at end of file