using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using Vanara.InteropServices;
using static Vanara.PInvoke.Ole32;
namespace Vanara.PInvoke
{
public static partial class UrlMon
{
/// Flags used by the IAuthenticateEx::AuthenticateEx method to pass information about the authentication request.
///
///
/// These values are used primarily by the Windows RSS Platform to control automatic authentication of feeds. Proxy authentication
/// is not allowed, nor is basic authentication over HTTP allowed. However, basic over Secure Hypertext Transfer Protocol (HTTPS) is allowed.
///
///
/// Note To allow basic authentication over HTTP, start Group Policy Editor (gpedit.msc), and configure the value for" Turn
/// on Basic feed authentication over HTTP" under Administrative Templates, Windows Components, Windows Internet Explorer, RSS Feeds.
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/cc709431(v=vs.85)
// typedef enum { AUTHENTICATEF_PROXY = 0x00000001, AUTHENTICATEF_BASIC = 0x00000002, AUTHENTICATEF_HTTP = 0x00000004 } AUTHENTICATEF;
[PInvokeData("Urlmon.h")]
[Flags]
public enum AUTHENTICATEF
{
/// The authorization is handled by the proxy server.
AUTHENTICATEF_PROXY = 0x00000001,
/// The authorization will use basic authentication.
AUTHENTICATEF_BASIC = 0x00000002,
/// The authorization will occur over HTTP.
AUTHENTICATEF_HTTP = 0x00000004,
}
/// Provides the URL moniker with information to authenticate the user.
///
///
/// Urlmon.dll uses the QueryInterface method on the client application's implementation of IBindStatusCallback to get a
/// pointer to the client application's IAuthenticate interface. If the client application is hosting Mshtml.dll, Mshtml.dll
/// requests a pointer to the client application's implementation of IAuthenticate interface by calling QueryInterface on the
/// client application's IServiceProvider interface.
///
/// The IID for this interface is
/// IID_IAuthenticate
/// .
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775080(v=vs.85)
[PInvokeData("Urlmon.h")]
[ComImport, Guid("79eac9d0-baf9-11ce-8c82-00aa004ba90b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAuthenticate
{
/// Supplies authentication support to a URL moniker from a client application.
///
/// [out] The address of a client-provided HWND of the parent window for a default user interface. To prevent a user interface
/// from displaying, the client must provide a user name and password in the other parameters, and this handle must be set to zero.
///
///
/// [out] The address of a string value that contains the user name to use for authentication. If the client returns a value
/// here, the client should also set phwnd to zero.
///
///
/// [out] The address of a string value that contains the password to use for authentication. If the client returns a value
/// here, the client should also set phwnd to zero.
///
///
/// Returns one of the following values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// Authentication was successful.
///
/// -
/// E_ACCESSDENIED
/// Authentication failed.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
///
///
/// Applications that implement the IAuthenticate::Authenticate method must allocate the memory of the pszUsername and
/// pszPassword buffers by using CoTaskMemAlloc. Applications that call the IAuthenticate::Authenticate method are
/// responsible for freeing the memory with CoTaskMemFree.
///
///
/// The default user interface can handle any authentication schemes recognized by the Microsoft Win32 Internet API. Currently,
/// the user name and password options handle only the Basic authentication scheme.
///
///
/// This method is related to the InternetErrorDlg function in the Win32 Internet API. For more information about the Win32
/// Internet API, see Introduction to the Microsoft Win32 Internet Functions.
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775079(v=vs.85)
// HRESULT Authenticate( [out] HWND *phwnd, [out] LPWSTR *pszUsername, [out] LPWSTR *pszPassword );
[PreserveSig]
HRESULT Authenticate(out HWND phwnd, [MarshalAs(UnmanagedType.LPWStr)] out string pszUsername, [MarshalAs(UnmanagedType.LPWStr)] out string pszPassword);
}
/// Provides the URL moniker with information to authenticate the user.
///
///
/// Relative to the IAuthenticate interface, the IAuthenticateEx interface provides the additional method
/// IAuthenticateEx::AuthenticateEx. This method is an extension of the IAuthenticate::Authenticate method.
///
/// The IID for this interface is
/// IID_IAuthenticateEx
/// .
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/cc709427(v=vs.85)
[PInvokeData("Urlmon.h")]
[ComImport, Guid("2ad1edaf-d83d-48b5-9adf-03dbe19f53bd"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAuthenticateEx : IAuthenticate
{
/// Supplies authentication support to a URL moniker from a client application.
///
/// [out] The address of a client-provided HWND of the parent window for a default user interface. To prevent a user interface
/// from displaying, the client must provide a user name and password in the other parameters, and this handle must be set to zero.
///
///
/// [out] The address of a string value that contains the user name to use for authentication. If the client returns a value
/// here, the client should also set phwnd to zero.
///
///
/// [out] The address of a string value that contains the password to use for authentication. If the client returns a value
/// here, the client should also set phwnd to zero.
///
///
/// Returns one of the following values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// Authentication was successful.
///
/// -
/// E_ACCESSDENIED
/// Authentication failed.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
///
///
/// Applications that implement the IAuthenticate::Authenticate method must allocate the memory of the pszUsername and
/// pszPassword buffers by using CoTaskMemAlloc. Applications that call the IAuthenticate::Authenticate method are
/// responsible for freeing the memory with CoTaskMemFree.
///
///
/// The default user interface can handle any authentication schemes recognized by the Microsoft Win32 Internet API. Currently,
/// the user name and password options handle only the Basic authentication scheme.
///
///
/// This method is related to the InternetErrorDlg function in the Win32 Internet API. For more information about the Win32
/// Internet API, see Introduction to the Microsoft Win32 Internet Functions.
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775079(v=vs.85)
// HRESULT Authenticate( [out] HWND *phwnd, [out] LPWSTR *pszUsername, [out] LPWSTR *pszPassword );
[PreserveSig]
new HRESULT Authenticate(out HWND phwnd, [MarshalAs(UnmanagedType.LPWStr)] out string pszUsername, [MarshalAs(UnmanagedType.LPWStr)] out string pszPassword);
///
/// Supplies authentication support to a URL moniker from a client application.
///
///
///
///
///
///
///
/// [out] The address of a client-provided HWND of the parent window for a default user interface. To prevent a user interface
/// from displaying, the client must provide a user name and password in the other parameters, and this handle must be set to zero.
///
///
/// [out] The address of a string value that contains the user name to use for authentication. If the client returns a value
/// here, the client should also set phwnd to zero.
///
///
/// [out] The address of a string value that contains the password to use for authentication. If the client returns a value
/// here, the client should also set phwnd to zero.
///
///
/// [in] The address of an AUTHENTICATEINFO structure that provides additional flags for the authentication.
///
///
/// Returns one of the following values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// Authentication was successful.
///
/// -
/// E_ACCESSDENIED
/// Authentication failed.
///
/// -
/// E_INVALIDARG
/// One or more parameters are invalid.
///
///
///
///
///
/// This method exists because the Authenticate method can contain no additional parameters. This method inherits all
/// behaviors of Authenticate and adds some of its own. Therefore, the Remarks section of Authenticate applies to
/// this method in full.
///
///
/// Relative to the Authenticate method, the IAuthenticateEx::AuthenticateEx method provides the additional
/// parameter pauthinfo. The data in pauthinfo provides additional flags for the authentication.
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/cc709426(v=vs.85)
// HRESULT AuthenticateEx( [out] HWND *phwnd, [out] LPWSTR *pszUsername, [out] LPWSTR *pszPassword, [in] AUTHENTICATEINFO
// *pauthinfo );
[PreserveSig]
HRESULT AuthenticateEx(out HWND phwnd, [MarshalAs(UnmanagedType.LPWStr)] out string pszUsername, [MarshalAs(UnmanagedType.LPWStr)] out string pszPassword,
in AUTHENTICATEINFO pauthinfo);
}
/// Provides methods that enable controls to perform asynchronous data transfers through the Microsoft ActiveX container.
///
/// The IID for this interface is
/// IID_IBindHost
/// .
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775076(v=vs.85)
[PInvokeData("Urlmon.h")]
[ComImport, Guid("fc4801a1-2ba9-11cf-a229-00aa003d7352"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IBindHost
{
/// Creates a moniker to bind to a URL.
/// [in] A pointer to a string that contains the URL to bind to.
///
/// [in] A pointer to the IBindCtx interface of the optional bind context that is used when the moniker is created. This
/// parameter is currently ignored, but might be used later for passing additional information.
///
/// [out] A pointer to the IMoniker interface of the moniker that is created.
/// [in] Reserved. Must be set to 0.
///
/// Returns one of the following values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The moniker was successfully obtained, and the caller is responsible for the interface pointer.
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory to create the moniker.
///
/// -
/// E_UNEXPECTED
/// An unknown error occurred.
///
/// -
/// MK_E_SYNTAX
/// The bind host was unable to parse the string into a moniker because the information in the name was unrecognizable.
///
///
///
/// E_NOTIMPL is disallowed—a bind host is responsible for providing moniker parsing services.
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775075(v=vs.85)
// HRESULT CreateMoniker( [in] LPOLESTR szName, [in] IBindCtx *pBC, [out] IMoniker **ppmk, [in] DWORD dwReserved );
[PreserveSig]
HRESULT CreateMoniker([MarshalAs(UnmanagedType.LPWStr)] string szName, [In, Optional] IBindCtx pBC, out IMoniker ppmk, uint dwReserved = 0);
/// Binds a moniker to storage.
/// [in] The address of the IMoniker interface.
/// [in] The address of the IBindCtx interface.
/// [in] The address of the IBindStatusCallback interface.
/// [in] An identifier of the storage interface requested.
///
/// [out] The address of the storage interface. If ppvObj is not NULL, the application must call the AddRef method on the
/// interface, and then call Release when it is finished using the interface.
///
///
/// Returns one of the following values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The bind operation completed synchronously and successfully. The result of the bind operation is available in ppvObj.
///
/// -
/// MK_S_ASYNCHRONOUS
/// The bind operation completes asynchronously. The behavior matches that of IMoniker::BindToStorage.
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory to create the moniker.
///
/// -
/// E_UNEXPECTED
/// An unknown error occurred.
///
///
///
///
///
/// This method behaves the same as IMoniker::BindToStorage, except that it provides the control container (implementor of
/// IBindHost) enough authority over the bind operation so that the control container can take charge of setting bind
/// options and priority, while it delegates all results and callbacks for the bind operation back to the control.
///
///
/// A host or control implementing IBindHost should implement IHttpNegotiate. It should also implement
/// IServiceProvider to provide a pointer to its IHttpNegotiate interface when IHttpNegotiate is requested
/// through QueryService.
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775078(v=vs.85)
// HRESULT MonikerBindToStorage( [in] IMoniker *pMk, [in] IBindCtx *pBC, [in] IBindStatusCallback *pBSC, [in] REFIID riid, [out]
// void **ppvObj );
[PreserveSig]
HRESULT MonikerBindToStorage(IMoniker pMk, IBindCtx pBC, IBindStatusCallback pBSC, in Guid riid,
[MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
/// Binds a moniker to an object.
/// [in] The address of the IMoniker interface of the moniker.
/// [in] The address of the IBindCtx interface of the bind context.
/// [in] The address of the IBindStatusCallback interface.
/// [in] An identifier of the interface that the client application uses to communicate with the object.
///
/// [out] The address of the interface that is identified by riid. If ppvObj is not NULL, the application must call the
/// AddRef method on the interface, and then call Release when it is finished using the interface.
///
///
/// Returns one of the following values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The bind operation completed synchronously and successfully. The result of the bind operation is available in ppvObj.
///
/// -
/// MK_S_ASYNCHRONOUS
/// The bind operation completes asynchronously. The behavior matches that of IMoniker::BindToObject.
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory to create the moniker.
///
/// -
/// E_UNEXPECTED
/// An unknown error occurred.
///
///
///
///
///
/// This method behaves the same as IMoniker::BindToObject, except that it provides the control container (implementor of
/// IBindHost) enough authority over the bind operation so that the control container can take charge of setting bind
/// options and priority, while it delegates all results and callbacks for the bind operation back to the control.
///
///
/// A host or control that implements IBindHost should implement IHttpNegotiate. It should also implement
/// IServiceProvider to provide a pointer to its IHttpNegotiate interface when IHttpNegotiate is requested
/// through QueryService.
///
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775077(v=vs.85)
// HRESULT MonikerBindToObject( [in] IMoniker *pMk, [in] IBindCtx *pBC, [in] IBindStatusCallback *pBSC, [in] REFIID riid, [out]
// void **ppvObj );
[PreserveSig]
HRESULT MonikerBindToObject(IMoniker pMk, IBindCtx pBC, IBindStatusCallback pBSC, in Guid riid,
[MarshalAs(UnmanagedType.IUnknown)] out object ppvObj);
}
///
/// 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);
}
/// Provides methods that offer more control over the binding of persistent data.
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775042(v=vs.85)
[PInvokeData("Urlmon.h")]
[ComImport, Guid("79eac9c9-baf9-11ce-8c82-00aa004ba90b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPersistMoniker
{
/// This method retrieves the class identifier of an object.
/// Address of a variable that receives the CLSID.
/// Returns S_OK if successful or E_FAIL if the CLSID could not be retrieved.
// https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms928879(v=msdn.10)
[PreserveSig]
HRESULT GetClassID(out Guid pClassID);
/// Checks an object for changes since it was last saved.
/// Returns S_OK if the object has changed since it was last saved, or S_FALSE otherwise.
///
/// This method checks whether an object has changed since it was last saved, so that you can avoid losing information in
/// objects that have not yet been saved.
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775043(v=vs.85)
// HRESULT IsDirty();
[PreserveSig]
HRESULT IsDirty();
/// Loads the object from its persistent state as indicated by a supplied moniker.
///
/// [in] A Boolean value that indicates if the data referred to by the moniker has been loaded one time. If TRUE, the
/// subsequent binding to the moniker is synchronous. If FALSE, an asynchronous bind operation is launched.
///
///
/// [in] The address of the IMoniker interface that references the persistent state for the object to be loaded.
///
///
/// [in] The address of the IBindCtx interface for the bind context to be used for any moniker binding during this method.
///
///
/// [in] An unsigned long integer value that contains a combination of values from the STGM Constants enumeration, which
/// indicates the access mode to use when binding to the persistent state. The IPersistMoniker::Load method can treat
/// this value as a suggestion, adding more restrictive permissions, if necessary. If grfMode is zero, the implementation binds
/// to the persistent state using default permissions.
///
/// Returns S_OK if the object was successfully loaded, or E_INVALIDARG if one or more parameters are invalid.
///
/// Typically, the object immediately binds to its persistent state through a call to the source moniker's
/// IMoniker::BindToStorage method, by requesting either the IStream interface or the IStorage interface.
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775044(v=vs.85)
// HRESULT Load( [in] BOOL fFullyAvailable, [in] IMoniker *pimkName, [in] LPBC pibc, [in] DWORD grfMode );
[PreserveSig]
HRESULT Load([MarshalAs(UnmanagedType.Bool)] bool fFullyAvailable, IMoniker pimkName, IBindCtx pibc, STGM grfMode);
/// Tells the object to save itself to a specified location.
///
/// [in] The address of the IMoniker interface that references the location where the object stores itself persistently.
///
///
/// [in] The address of the IBindCtx interface for the bind context to use for any moniker binding during this method.
///
///
/// [in] A Boolean value that indicates whether pimkName is used as the reference to the current persistent state after the
/// save. If TRUE, pimkName becomes the reference to the current persistent state, and the object clears its "dirty" flag
/// after the save. If FALSE, this save operation is a "Save A Copy As ..." operation. In this case, the reference to the
/// current persistent state is unchanged, and the object does not clear its "dirty" flag. If pimkName is NULL, the
/// implementation ignores the fRemember flag.
///
/// Returns S_OK if the object was successfully saved, 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/ms775045(v=vs.85)
// HRESULT Save( [in] IMoniker *pimkName, [in] LPBC pbc, [in] BOOL fRemember );
[PreserveSig]
HRESULT Save(IMoniker pimkName, IBindCtx pbc, [MarshalAs(UnmanagedType.Bool)] bool fRemember);
///
/// Notifies the client application that its persisted state has been completely saved, and points the client to its new
/// persisted state.
///
///
/// [in] The address of the IMoniker interface of the object's new persistent state. This parameter can be NULL, if the
/// moniker to the object's new persistent state is the same as the previous moniker to the object's persistent state. This
/// optimization is allowed only if there was a prior call to IPersistMoniker::Save with the fRemember parameter set to
/// TRUE, in which case the object does not have to rebind to pimkName.
///
/// [in] The address of the IBindCtx interface to use for any moniker binding during this method.
/// 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/ms775046(v=vs.85)
// HRESULT SaveCompleted( [in] IMoniker *pimkName, [in] LPBC pibc );
[PreserveSig]
HRESULT SaveCompleted([In, Optional] IMoniker pimkName, IBindCtx pibc);
/// Gets the moniker that refers to the object's persistent state.
///
/// Returns S_OK if a valid absolute path was successfully returned, or E_INVALIDARG if the ppimkName parameter is invalid.
///
///
/// Typically, this method returns the moniker that was last passed to the object by means of the IPersistMoniker::Load
/// method, the IPersistMoniker::Save method, or the IPersistMoniker::SaveCompleted method.
///
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775041(v=vs.85)
// HRESULT GetCurMoniker( [out] IMoniker **ppimkName );
[PreserveSig]
HRESULT GetCurMoniker(out IMoniker ppimkName);
}
///
/// 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, Optional] 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, Optional] 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 = 0);
/// 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([Optional] 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 -1 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, out StrPtrUni 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, out StrPtrUni 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, out StrPtrUni 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, out StrPtrUni 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, out StrPtrUni 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, out StrPtrUni 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, out StrPtrUni 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();
}
/// Contains additional information on the authentication operation.
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/cc709424(v=vs.85) typedef
// struct _tagAUTHENTICATEINFO { DWORD dwFlags; DWORD dwReserved; } AUTHENTICATEINFO;
[PInvokeData("Urlmon.h")]
[StructLayout(LayoutKind.Sequential)]
public struct AUTHENTICATEINFO
{
/// dwFlags One or more AUTHENTICATEF values that specify the authentication operation.
public AUTHENTICATEF dwFlags;
/// dwReserved
public uint dwReserved;
}
/*
IBindProtocol
IBindStatusCallbackEx
ICatalogFileInfo
ICodeInstall
IHttpNegotiate
IHttpNegotiate2
IHttpNegotiate3
IHttpSecurity
IMonikerProp
ISoftDistExt
IUriBuilderFactory
IUriContainer
IWindowForBindingUI
IWinInetCacheAccess
IWinInetCacheHints
IWinInetCacheHints2
IWinInetFileStream
IWinInetHttpInfo
IWinInetInfo
*/
}
}