using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; using Vanara.InteropServices; using static Vanara.PInvoke.Ole32; namespace Vanara.PInvoke { /// /// Functions and interfaces from UrlMon.dll. URL monikers allow an application to bind a resource, specified by a URL, to a moniker. /// Asynchronous pluggable protocols enable developers to create pluggable protocol handlers, MIME filters, and namespace handlers. /// public static partial class UrlMon { /// Contains the values that determine how a resource is bound to a moniker. /// /// /// These values are passed to the Urlmon.dll from the client application's implementation of the /// IBindStatusCallback::GetBindInfo method. /// /// /// Note The gopher protocol is turned off by default in Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2). /// The protocol has been removed from WinInet in Windows Internet Explorer 7. /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775130(v=vs.85) typedef // enum { BINDF_ASYNCHRONOUS = 0x00000001, BINDF_ASYNCSTORAGE = 0x00000002, BINDF_NOPROGRESSIVERENDERING = 0x00000004, // BINDF_OFFLINEOPERATION = 0x00000008, BINDF_GETNEWESTVERSION = 0x00000010, BINDF_NOWRITECACHE = 0x00000020, BINDF_NEEDFILE = // 0x00000040, BINDF_PULLDATA = 0x00000080, BINDF_IGNORESECURITYPROBLEM = 0x00000100, BINDF_RESYNCHRONIZE = 0x00000200, // BINDF_HYPERLINK = 0x00000400, BINDF_NO_UI = 0x00000800, BINDF_SILENTOPERATION = 0x00001000, BINDF_PRAGMA_NO_CACHE = 0x00002000, // BINDF_GETCLASSOBJECT = 0x00004000, BINDF_RESERVED_1 = 0x00008000, BINDF_FREE_THREADED = 0x00010000, BINDF_DIRECT_READ = // 0x00020000, BINDF_FORMS_SUBMIT = 0x00040000, BINDF_GETFROMCACHE_IF_NET_FAIL = 0x00080000, BINDF_FROMURLMON = 0x00100000, // BINDF_FWD_BACK = 0x00200000, BINDF_PREFERDEFAULTHANDLER = 0x00400000, BINDF_ENFORCERESTRICTED = 0x00800000 } BINDF; [PInvokeData("Urlmon.h")] [Flags] public enum BINDF : uint { /// /// Value that indicates that the moniker will return immediately from a call to the IMoniker::BindToStorage method or the /// IMoniker::BindToObject method. The actual result of the bind to an object or the bind to storage returns asynchronously. The /// client application is notified by a call to the IBindStatusCallback::OnDataAvailable method or the /// IBindStatusCallback::OnObjectAvailable method. If the client does not specify this flag, the bind operation is /// synchronous, and the client receives no data from the bind operation until the IMoniker::BindToStorage call or the /// IMoniker::BindToObject call returns. /// BINDF_ASYNCHRONOUS = 0x00000001, /// /// /// Value that indicates that the client application calling the IMoniker::BindToStorage method specifies that the storage /// objects and stream objects returned from the IBindStatusCallback::OnDataAvailable method return E_PENDING when the /// objects reference data that is not yet available through the IStream::Read method, instead of blocking until the data /// becomes available. This flag applies only to BINDF_ASYNCHRONOUS operations. /// /// /// Note Asynchronous stream objects return E_PENDING while data is still downloading and return S_FALSE for the end of /// the file. /// /// BINDF_ASYNCSTORAGE = 0x00000002, /// Value that indicates that progressive rendering is not be allowed. BINDF_NOPROGRESSIVERENDERING = 0x00000004, /// Value that indicates that the moniker is bound to the cached version of the resource. BINDF_OFFLINEOPERATION = 0x00000008, /// /// Value that indicates that the bind operation retrieves the newest version of the data or object available. In URL monikers, /// this flag maps to the WinInet flag, INTERNET_FLAG_RELOAD, which forces a download of the requested resource. /// BINDF_GETNEWESTVERSION = 0x00000010, /// /// Value that indicates that the bind operation does not store retrieved data in the disk cache. The client must specify /// BINDF_PULLDATA to turn off the cache file generation when the IMoniker::BindToStorage method is called. /// BINDF_NOWRITECACHE = 0x00000020, /// Value that indicates that the downloaded resource must be saved in the cache or a local file. BINDF_NEEDFILE = 0x00000040, /// /// Value that indicates that the asynchronous moniker enables the client of the IMoniker::BindToStorage method to drive the /// bind operation by pulling the data, instead of using the moniker to drive the operation by pushing the data to the client. /// When this flag is specified, new data is read or downloaded after the client finishes downloading all data that is currently /// available. This means data is only downloaded for the client after the client calls an IStream::Read operation that blocks /// or returns E_PENDING. When this flag is specified, the client must read all the data it can, even data that is not /// necessarily available yet. When this flag is not specified, the moniker continues downloading data and calls the client with /// IBindStatusCallback::OnDataAvailable whenever new data is available. This flag applies only to /// BINDF_ASYNCHRONOUS bind operations. /// BINDF_PULLDATA = 0x00000080, /// /// Value that indicates that security problems related to bad certificates and redirects between HTTP and HTTPS servers should /// be ignored. For URL monikers, this flag corresponds to the following WinInet flags: INTERNET_FLAG_IGNORE_CERT_CN_INVALID, /// INTERNET_FLAG_IGNORE_CERT_DATE_INVALID, INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP, and INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS. /// /// Security Warning: Using this value incorrectly can compromise the security of your application. If you implement the /// IBindStatusCallback::GetBindInfo method to ignore security problems with certificates and redirection, users may be /// susceptible to unwanted information disclosure. You should not implement IBindStatusCallback::GetBindInfo with a return /// value of BINDF_IGNORESECURITYPROBLEM because it prevents Internet Explorer from notifying users of security concerns. For /// more information, see Security Considerations: URL Monikers. /// /// BINDF_IGNORESECURITYPROBLEM = 0x00000100, /// /// Value that indicates that the resource should be resynchronized. For URL monikers, this flag maps to the WinInet flag, /// INTERNET_FLAG_RESYNCHRONIZE, which reloads an HTTP resource if the resource has been modified since the last time it was /// downloaded. All FTP and Gopher resources are reloaded. /// BINDF_RESYNCHRONIZE = 0x00000200, /// Value that indicates that hyperlinks are allowed. BINDF_HYPERLINK = 0x00000400, /// Value that indicates that the bind operation will not display any user interfaces. BINDF_NO_UI = 0x00000800, /// /// Value that indicates the bind operation will be completed silently. No user interface or user notification will occur. /// BINDF_SILENTOPERATION = 0x00001000, /// Value that indicates that the resource will not be stored in the Internet cache. BINDF_PRAGMA_NO_CACHE = 0x00002000, /// Value that indicates that the class object will be retrieved. Typically the class instance is retrieved. BINDF_GETCLASSOBJECT = 0x00004000, /// Reserved. BINDF_RESERVED_1 = 0x00008000, /// Reserved. BINDF_FREE_THREADED = 0x00010000, /// /// Value that indicates that the client application does not have to know the exact size of the data available, so the /// information is read directly from the source. /// BINDF_DIRECT_READ = 0x00020000, /// Value that indicates that this transaction is handled as a forms submittal. BINDF_FORMS_SUBMIT = 0x00040000, /// /// Value that indicates the resource is retrieved from the cache if the attempt to download the resource from the network fails. /// BINDF_GETFROMCACHE_IF_NET_FAIL = 0x00080000, /// Value that indicates the binding is from a URL moniker. This value was added for Internet Explorer 5. BINDF_FROMURLMON = 0x00100000, /// /// Value that indicates that the moniker will bind to the copy of the resource that is currently in the Internet cache. If the /// requested item is not found in the Internet cache, the system will attempt to locate the resource on the network. This value /// maps to the Win32 Internet API flag, INTERNET_FLAG_USE_CACHED_COPY. /// BINDF_FWD_BACK = 0x00200000, /// /// Value that indicates that the moniker client will specify that Urlmon.dll should look for and use the default system /// protocol first, instead of searching for temporary or permanent namespace handlers before it uses the default registered /// handler for particular protocols. /// BINDF_PREFERDEFAULTHANDLER = 0x00400000, /// /// Value that indicates that this transaction will be treated as taking place in the Restricted Sites Zone. For URL monikers, /// this flag maps to the Win32 Internet API flag, INTERNET_FLAG_RESTRICTED_ZONE. /// BINDF_ENFORCERESTRICTED = 0x00800000 } /// /// Contains values that are passed to the client application's implementation of the IBindStatusCallback::OnProgress method. /// These values indicate the progress of the bind operation. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775133(v=vs.85) typedef // enum tagBINDSTATUS { BINDSTATUS_FINDINGRESOURCE = 1, BINDSTATUS_CONNECTING, BINDSTATUS_REDIRECTING, BINDSTATUS_BEGINDOWNLOADDATA, // BINDSTATUS_DOWNLOADINGDATA, BINDSTATUS_ENDDOWNLOADDATA, BINDSTATUS_BEGINDOWNLOADCOMPONENTS, BINDSTATUS_INSTALLINGCOMPONENTS, // BINDSTATUS_ENDDOWNLOADCOMPONENTS, BINDSTATUS_USINGCACHEDCOPY, BINDSTATUS_SENDINGREQUEST, BINDSTATUS_CLASSIDAVAILABLE, // BINDSTATUS_MIMETYPEAVAILABLE, BINDSTATUS_CACHEFILENAMEAVAILABLE, BINDSTATUS_BEGINSYNCOPERATION, BINDSTATUS_ENDSYNCOPERATION, // BINDSTATUS_BEGINUPLOADDATA, BINDSTATUS_UPLOADINGDATA, BINDSTATUS_ENDUPLOADINGDATA, BINDSTATUS_PROTOCOLCLASSID, // BINDSTATUS_ENCODING, BINDSTATUS_VERFIEDMIMETYPEAVAILABLE, BINDSTATUS_CLASSINSTALLLOCATION, BINDSTATUS_DECODING, // BINDSTATUS_LOADINGMIMEHANDLER, BINDSTATUS_CONTENTDISPOSITIONATTACH, BINDSTATUS_FILTERREPORTMIMETYPE, // BINDSTATUS_CLSIDCANINSTANTIATE, BINDSTATUS_IUNKNOWNAVAILABLE, BINDSTATUS_DIRECTBIND, BINDSTATUS_RAWMIMETYPE, // BINDSTATUS_PROXYDETECTING, BINDSTATUS_ACCEPTRANGES, BINDSTATUS_COOKIE_SENT, BINDSTATUS_COMPACT_POLICY_RECEIVED, // BINDSTATUS_COOKIE_SUPPRESSED, BINDSTATUS_COOKIE_STATE_UNKNOWN, BINDSTATUS_COOKIE_STATE_ACCEPT, BINDSTATUS_COOKIE_STATE_REJECT, // BINDSTATUS_COOKIE_STATE_PROMPT, BINDSTATUS_COOKIE_STATE_LEASH, BINDSTATUS_COOKIE_STATE_DOWNGRADE, BINDSTATUS_POLICY_HREF, // BINDSTATUS_P3P_HEADER, BINDSTATUS_SESSION_COOKIE_RECEIVED, BINDSTATUS_PERSISTENT_COOKIE_RECEIVED, // BINDSTATUS_SESSION_COOKIES_ALLOWED, BINDSTATUS_CACHECONTROL, BINDSTATUS_CONTENTDISPOSITIONFILENAME, // BINDSTATUS_MIMETEXTPLAINMISMATCH, BINDSTATUS_PUBLISHERAVAILABLE, BINDSTATUS_DISPLAYNAMEAVAILABLE, BINDSTATUS_SSLUX_NAVBLOCKED, // BINDSTATUS_SERVER_MIMETYPEAVAILABLE, BINDSTATUS_SNIFFED_CLASSIDAVAILABLE, BINDSTATUS_64BIT_PROGRESS, BINDSTATUS_LAST = // BINDSTATUS_64BIT_PROGRESS, BINDSTATUS_RESERVED_0, BINDSTATUS_RESERVED_1, BINDSTATUS_RESERVED_2, BINDSTATUS_RESERVED_3, // BINDSTATUS_RESERVED_4, BINDSTATUS_RESERVED_5, BINDSTATUS_RESERVED_6, BINDSTATUS_RESERVED_7, BINDSTATUS_RESERVED_8, // BINDSTATUS_RESERVED_9, BINDSTATUS_LAST_PRIVATE = BINDSTATUS_RESERVED_9 } BINDSTATUS; [PInvokeData("Urlmon.h")] public enum BINDSTATUS { /// /// Notifies the client application that the bind operation is finding the resource that holds the object or storage. The /// szStatusText parameter to the IBindStatusCallback::OnProgress method provides the display name of the resource that /// the bind operation is looking for (for example, "www.microsoft.com"). /// BINDSTATUS_FINDINGRESOURCE = 1, /// /// Notifies the client application that the bind operation is connecting to the resource that holds the object or storage. The /// szStatusText parameter to the IBindStatusCallback::OnProgress method provides the display name of the resource that /// the bind operation is connecting to (for example, an IP address). /// BINDSTATUS_CONNECTING, /// /// Notifies the client application that the bind operation has been redirected to a different data location. The szStatusText /// parameter to the IBindStatusCallback::OnProgress method provides the display name of the new data location. /// BINDSTATUS_REDIRECTING, /// /// Notifies the client application that the bind operation has begun receiving the object or storage. The szStatusText /// parameter to the IBindStatusCallback::OnProgress method provides the display name of the data location . /// BINDSTATUS_BEGINDOWNLOADDATA, /// /// Notifies the client application that the bind operation continues to receive the object or storage. The szStatusText /// parameter to the IBindStatusCallback::OnProgress method provides the display name of the data location. /// BINDSTATUS_DOWNLOADINGDATA, /// /// Notifies the client application that the bind operation has finished receiving the object or storage. The szStatusText /// parameter to the IBindStatusCallback::OnProgress method provides the display name of the data location. /// BINDSTATUS_ENDDOWNLOADDATA, /// Notifies the client application that the bind operation is beginning to download the component. BINDSTATUS_BEGINDOWNLOADCOMPONENTS, /// Notifies the client application that the bind operation is installing the component. BINDSTATUS_INSTALLINGCOMPONENTS, /// Notifies the client application that the bind operation has finished downloading the component. BINDSTATUS_ENDDOWNLOADCOMPONENTS, /// /// Notifies the client application that the bind operation is retrieving the requested object or storage from a cached copy. /// The szStatusText parameter to the IBindStatusCallback::OnProgress method is NULL. /// BINDSTATUS_USINGCACHEDCOPY, /// /// Notifies the client application that the bind operation is requesting the object or storage. The szStatusText parameter to /// the IBindStatusCallback::OnProgress method provides the display name of the object (for example, a file name). /// BINDSTATUS_SENDINGREQUEST, /// Notifies the client application that the CLSID of the resource is available. BINDSTATUS_CLASSIDAVAILABLE, /// /// Notifies the client application that the MIME type of the resource is available. /// /// Note Internet Explorer 7. Not used if Internet Explorer feature FEATURE_DISABLE_LEGACY_COMPRESSION is enabled. /// /// BINDSTATUS_MIMETYPEAVAILABLE, /// /// Notifies the client application that the temporary or cache file name of the resource is available. The temporary file name /// might be returned if BINDF_NOWRITECACHE is called. The temporary file will be deleted after the storage is released. /// BINDSTATUS_CACHEFILENAMEAVAILABLE, /// Notifies the client application that a synchronous operation has started. BINDSTATUS_BEGINSYNCOPERATION, /// Notifies the client application that the synchronous operation has completed. BINDSTATUS_ENDSYNCOPERATION, /// Notifies the client application that the file upload has started. BINDSTATUS_BEGINUPLOADDATA, /// Notifies the client application that the file upload is in progress. BINDSTATUS_UPLOADINGDATA, /// Notifies the client application that the file upload has completed. BINDSTATUS_ENDUPLOADINGDATA, /// Notifies the client application that the CLSID of the protocol handler being used is available. BINDSTATUS_PROTOCOLCLASSID, /// /// Notifies the client application that the Urlmon.dll is encoding data. /// Note Internet Explorer 9. Urlmon no longer performs compression. /// BINDSTATUS_ENCODING, /// Notifies the client application that the verified MIME type is available. BINDSTATUS_VERFIEDMIMETYPEAVAILABLE, /// Notifies the client application that the class install location is available. BINDSTATUS_CLASSINSTALLLOCATION, /// Notifies the client application that the bind operation is decoding data. BINDSTATUS_DECODING, /// /// Notifies the client application that a pluggable MIME handler is being loaded. This value was added for Internet Explorer 5. /// BINDSTATUS_LOADINGMIMEHANDLER, /// /// /// Notifies the client application that this resource contained a Content-Disposition header that indicates that this resource /// is an attachment. The content of this resource should not be automatically displayed. Client applications should request /// permission from the user. This value was added for Internet Explorer 5. /// /// /// Note Internet Explorer 7. Not used if Internet Explorer feature FEATURE_DISABLE_LEGACY_COMPRESSION is enabled. /// /// BINDSTATUS_CONTENTDISPOSITIONATTACH, /// /// Notifies the client application of the new MIME type of the resource. This is used by a pluggable MIME filter to report a /// change in the MIME type after it has processed the resource. This value was added for Internet Explorer 5. /// BINDSTATUS_FILTERREPORTMIMETYPE, /// /// Notifies the Urlmon.dll that this CLSID is for the class that the Urlmon.dll should return to the client on a call to /// IMoniker::BindToObject. This value was added for Internet Explorer 5. /// BINDSTATUS_CLSIDCANINSTANTIATE, /// Reports that the IUnknown interface has been released. This value was added for Internet Explorer 5. BINDSTATUS_IUNKNOWNAVAILABLE, /// /// Reports whether the client application is connected directly to the pluggable protocol handler. This value was added for /// Internet Explorer 5. /// BINDSTATUS_DIRECTBIND, /// /// Reports the MIME type of the resource, before any data sniffing is done. This value was added for Internet Explorer 5. For /// more information, see MIME Type Detection in Internet Explorer. /// BINDSTATUS_RAWMIMETYPE, /// Reports that a proxy server has been detected. This value was added for Internet Explorer 5. BINDSTATUS_PROXYDETECTING, /// Reports the valid types of range requests for a resource. This value was added for Internet Explorer 5. BINDSTATUS_ACCEPTRANGES, /// Notifies the client application that a cookie was sent with the web request. BINDSTATUS_COOKIE_SENT, /// /// Notifies the client application that a P3P v1 compact policy was received. A compact policy can be sent only in the P3P HTTP /// response header. For example, /// BINDSTATUS_COMPACT_POLICY_RECEIVED, /// Notifies the client application that a cookie was suppressed from being sent to the web server. BINDSTATUS_COOKIE_SUPPRESSED, /// /// Notifies the client application that a cookie has been initialized. This is a default initialization state for cookie operations. /// BINDSTATUS_COOKIE_STATE_UNKNOWN, /// Notifies the client application that a cookie sent by the server was accepted on the client. BINDSTATUS_COOKIE_STATE_ACCEPT, /// Notifies the client application that a cookie sent by the server was rejected based on privacy and user settings. BINDSTATUS_COOKIE_STATE_REJECT, /// Notifies the client application that the user settings require a prompt before performing a cookie operation. BINDSTATUS_COOKIE_STATE_PROMPT, /// /// Notifies the client application that the cookie is a leashed cookie. A leashed cookie is only sent on requests to download /// first-party content. When requests are made for third-party content, leashed cookies are suppressed, that is, they are not sent. /// BINDSTATUS_COOKIE_STATE_LEASH, /// /// Notifies the client application that the cookie is a downgraded cookie. A downgraded cookie is a persistent cookie that is /// deleted when the browsing session ends or the cookie expires, whichever comes first. In other words, the persistent cookie /// becomes a session cookie. /// BINDSTATUS_COOKIE_STATE_DOWNGRADE, /// Notifies the client application that the HTTP headers contain a link to the full privacy policy. BINDSTATUS_POLICY_HREF, /// Notifies the client application that an HTTP response from the server contains the P3P privacy header. BINDSTATUS_P3P_HEADER, /// Notifies the client application that a session cookie was received. BINDSTATUS_SESSION_COOKIE_RECEIVED, /// Notifies the client application that a persistent cookie was received. BINDSTATUS_PERSISTENT_COOKIE_RECEIVED, /// Notifies the client application that session cookies are allowed. BINDSTATUS_SESSION_COOKIES_ALLOWED, /// /// /// Notifies the client application that a response from the server was written to memory only. No temporary file was created in /// the WinInet cache. /// /// /// Note Internet Explorer 7. Not used if Internet Explorer feature control FEATURE_DISABLE_LEGACY_COMPRESSION is enabled. /// /// BINDSTATUS_CACHECONTROL, /// /// /// Internet Explorer 6 for Windows XP SP2 and later. Notifies the client application that the Content-Disposition header /// contains a file name rather than an attachment. See BINDSTATUS_CONTENTDISPOSITIONATTACH for more information. /// /// /// Note Internet Explorer 7. Not used if Internet Explorer feature control FEATURE_DISABLE_LEGACY_COMPRESSION is enabled. /// /// BINDSTATUS_CONTENTDISPOSITIONFILENAME, /// /// Internet Explorer 6 for Windows XP SP2 and later. Notifies the client application that the reported Content-Type of the file /// does not match the content. This notification is sent only for files whose Content-Type is text/plain. /// BINDSTATUS_MIMETEXTPLAINMISMATCH, /// /// Internet Explorer 6 for Windows XP SP2 and later. Notifies the client application that the name of the publisher whose /// control is being downloaded is available. The name is extracted from the file's signature. /// BINDSTATUS_PUBLISHERAVAILABLE, /// /// Internet Explorer 6 for Windows XP SP2 and later. Notifies the client application that the display name of the control that /// is being downloaded is available. The name is extracted from the file's signature, otherwise, the file name (without the /// extension) is used. /// BINDSTATUS_DISPLAYNAMEAVAILABLE, /// /// Internet Explorer 7. Notifies the client application that there was a problem with the SSL certificate, and the security /// handshake was interrupted. These problems include invalid certificate authority, invalid date, invalid common name, and /// certificate revocation failure. The szStatusText parameter to the IBindStatusCallback::OnProgress method provides the /// error code. /// BINDSTATUS_SSLUX_NAVBLOCKED, /// /// /// Internet Explorer 8. Reports the server's authoritative MIME type. Sending an authoritative header prevents Internet /// Explorer from data sniffing a response away from the declared type. (For a detailed explanation of data sniffing, see MIME /// Type Detection in Internet Explorer.) To be considered authoritative, the server must provide in the HTTP response header, /// as follows: /// /// /// The authoritative type is not reported if the HTTP response header is present. The szStatusText parameter to the /// IBindStatusCallback::OnProgress method provides the MIME type. /// /// BINDSTATUS_SERVER_MIMETYPEAVAILABLE, /// /// Internet Explorer 8. Reports CLSID generated from authoritative HTTP response header. Value is reported in canonical GUID /// format in the szStatusText parameter. /// BINDSTATUS_SNIFFED_CLASSIDAVAILABLE, /// /// Internet Explorer 8. Notifies the client application of download progress values above the maximum 32-bit file size limit. /// Value is reported as two 64-bit numbers separated by a comma (current progress and total bytes) in the szStatusText /// parameter. For example, given the string , 857 is the current progress and 500000000 is the maximum progress. /// BINDSTATUS_64BIT_PROGRESS, /// The count of public BINDSTATUS enumeration values. BINDSTATUS_LAST = BINDSTATUS_64BIT_PROGRESS, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_0, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_1, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_2, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_3, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_4, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_5, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_6, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_7, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_8, /// Internet Explorer 9. Reserved. Do not use. BINDSTATUS_RESERVED_9, /// Internet Explorer 9. Used to calculate the count of private enumeration values. BINDSTATUS_LAST_PRIVATE = BINDSTATUS_RESERVED_9, } /// /// /// This enumeration's values are passed to the client in the IBindStatusCallback::OnDataAvailable method to indicate the type of /// data that is available. /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/embedded/aa452105(v=msdn.10) [PInvokeData("Urlmon.h")] [Flags] public enum BSCF : uint { /// Identify the first call to IBindStatusCallback::OnDataAvailable for a given bind operation. BSCF_FIRSTDATANOTIFICATION = 0x00000001, /// Identify an intermediate call to IBindStatusCallback::OnDataAvailable for a bind operation. BSCF_INTERMEDIATEDATANOTIFICATION = 0x00000002, /// Identify the last call to IBindStatusCallback::OnDataAvailable for a bind operation. BSCF_LASTDATANOTIFICATION = 0x00000004, /// All of the requested data is available. BSCF_DATAFULLYAVAILABLE = 0x00000008, /// Size of the data available is unknown. BSCF_AVAILABLEDATASIZEUNKNOWN = 0x00000010, /// /// Internet Explorer 8. Flag sent to IBindStatusCallback::OnDataAvailable to bypass cache downloads for file:// URLs. Normally, /// the cache file is emptied when new data is available. Specify this flag when it is not necessary to read the data and throw /// it away, such as when downloading a file through a UNC path. /// BSCF_SKIPDRAINDATAFORFILEURLS = 0x00000020, /// /// Internet Explorer 8. Notification to the IInternetProtocolSink::ReportProgress that the size cannot be expressed in 32-bit /// terms for downloads exceeding 4 GB. /// BSCF_64BITLENGTHDOWNLOAD = 0x00000040 } /// The following flags determine the behavior of registered Microsoft ActiveX controls. /// /// These enumeration members are bit masks that determine how ActiveX controls are used in Internet Explorer. Values are stored in /// the registry key HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Internet Explorer\ ActiveX Compatibility. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768234%28v%3dvs.85%29 // typedef enum { COMPAT_AGGREGATE = 0x00000001, COMPAT_NO_OBJECTSAFETY = 0x00000002, COMPAT_NO_PROPNOTIFYSINK = 0x00000004, // COMPAT_SEND_SHOW = 0x00000008, COMPAT_SEND_HIDE = 0x00000010, COMPAT_ALWAYS_INPLACEACTIVATE = 0x00000020, COMPAT_NO_SETEXTENT = // 0x00000040, COMPAT_NO_UIACTIVATE = 0x00000080, COMPAT_NO_QUICKACTIVATE = 0x00000100, COMPAT_NO_BINDF_OFFLINEOPERATION = // 0x00000200, COMPAT_EVIL_DONT_LOAD = 0x00000400, COMPAT_PROGSINK_UNTIL_ACTIVATED = 0x00000800, COMPAT_USE_PROPBAG_AND_STREAM = // 0x00001000, COMPAT_DISABLEWINDOWLESS = 0x00002000, COMPAT_SETWINDOWRGN = 0x00004000, COMPAT_PRINTPLUGINSITE = 0x00008000, // COMPAT_INPLACEACTIVATEEVENWHENINVISIBLE = 0x00010000, COMPAT_NEVERFOCUSSABLE = 0x00020000, COMPAT_ALWAYSDEFERSETWINDOWRGN = // 0x00040000, COMPAT_INPLACEACTIVATESYNCHRONOUSLY = 0x00080000, COMPAT_NEEDSZEROBASEDDRAWRECT = 0x00100000, COMPAT_HWNDPRIVATE = // 0x00200000, COMPAT_SECURITYCHECKONREDIRECT = 0x00400000, COMPAT_SAFEFOR_LOADING = 0x00800000 } COMPAT; [Flags] public enum COMPAT { /// This control is aggregated. COMPAT_AGGREGATE = 0x00000001, /// This control is not safe for scripting, even if it implements IObjectSafety. COMPAT_NO_OBJECTSAFETY = 0x00000002, /// A property notify sink is not attached to this control. COMPAT_NO_PROPNOTIFYSINK = 0x00000004, /// For this control, IOleObject::DoVerb is called with OLEIVERB_SHOW before IOleObject::DoVerb is called with OLEIVERB_INPLACEACTIVATE. COMPAT_SEND_SHOW = 0x00000008, /// /// For this control, IOleObject::DoVerb is called with OLEIVERB_HIDE before IOleInPlaceObject::InPlaceDeactivate is called. /// COMPAT_SEND_HIDE = 0x00000010, /// For this control, IOleObject::DoVerb is called with OLEIVERB_INPLACEACTIVATE. COMPAT_ALWAYS_INPLACEACTIVATE = 0x00000020, /// The amount of space required by this control's container is not specified. COMPAT_NO_SETEXTENT = 0x00000040, /// This control cannot activate the UI elements of the current document host. COMPAT_NO_UIACTIVATE = 0x00000080, /// This control does not implement IQuickActivate or should not be activated quickly. COMPAT_NO_QUICKACTIVATE = 0x00000100, /// A cached version of this control is never used. COMPAT_NO_BINDF_OFFLINEOPERATION = 0x00000200, /// This control is never used. COMPAT_EVIL_DONT_LOAD = 0x00000400, /// This control cannot be used for scripting until in-place activation is complete. COMPAT_PROGSINK_UNTIL_ACTIVATED = 0x00000800, /// Both IPersistPropertyBag::Load and IPersistStreamInit::Load are called when using this control. COMPAT_USE_PROPBAG_AND_STREAM = 0x00001000, /// This control cannot be in-place activated without a window. COMPAT_DISABLEWINDOWLESS = 0x00002000, /// This control cannot have UI outside of the window. COMPAT_SETWINDOWRGN = 0x00004000, /// This control has printing capabilities that should be used instead of those provided by Internet Explorer. COMPAT_PRINTPLUGINSITE = 0x00008000, /// This control is in-place activated whether or not it is visible. COMPAT_INPLACEACTIVATEEVENWHENINVISIBLE = 0x00010000, /// This control can never receive focus. COMPAT_NEVERFOCUSSABLE = 0x00020000, /// This control is allowed to have, at most, one pending resize request. COMPAT_ALWAYSDEFERSETWINDOWRGN = 0x00040000, /// This control is in-place activated syncronously. COMPAT_INPLACEACTIVATESYNCHRONOUSLY = 0x00080000, /// This control is positioned in the upper-left corner of the host window. COMPAT_NEEDSZEROBASEDDRAWRECT = 0x00100000, /// This control does not provide access to its window handle. COMPAT_HWNDPRIVATE = 0x00200000, /// This control is prevented from accessing content from another domain when redirected by the original server. COMPAT_SECURITYCHECKONREDIRECT = 0x00400000, /// /// Internet Explorer 7 and later. In the Internet zone, Internet Explorer checks every control for IObjectSafety to determine /// safety status quickly and abort instantiation as soon as possible. If a particular control doesn't implement IObjectSafety /// or component categories yet still needs to be instantiated in Internet Explorer without data or scripting, this /// compatibility flag can be used to disable the frontloaded safety check and revert back to Internet Explorer 6 behavior. See /// Safe Initialization and Scripting for ActiveX Controls. /// 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. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775138%28v%3dvs.85%29 // typedef enum _tagPARSEACTION { PARSE_CANONICALIZE = 1, PARSE_FRIENDLY, PARSE_SECURITY_URL, PARSE_ROOTDOCUMENT, PARSE_DOCUMENT, // PARSE_ANCHOR, PARSE_ENCODE, PARSE_DECODE, PARSE_PATH_FROM_URL, PARSE_URL_FROM_PATH, PARSE_MIME, PARSE_SERVER, PARSE_SCHEMA, // PARSE_SITE, PARSE_DOMAIN, PARSE_LOCATION, PARSE_SECURITY_DOMAIN, PARSE_ESCAPE, PARSE_UNESCAPE } PARSEACTION; [PInvokeData("Urlmon.h")] public enum PARSEACTION { /// Canonicalize the URL. PARSE_CANONICALIZE = 1, /// Retrieve a URL suitable for display. PARSE_FRIENDLY, /// /// Retrieve the URL that should be used by a security manager to make security decisions. The method should either return a /// security domain or map the input URL to a known protocol (such as HTTP). See also PARSE_SECURITY_DOMAIN. /// PARSE_SECURITY_URL, /// /// Retrieve the scheme and hostname, only. /// Internet Explorer 7 and later. CoInternetParseIUri also returns user name, password, and port. /// PARSE_ROOTDOCUMENT, /// Retrieve everything prior to the fragment (named anchor) part of the URL. PARSE_DOCUMENT, /// Retrieve the fragment (named anchor), including the delimiting number sign (#). PARSE_ANCHOR, /// /// Unescape the URL. Deprecated in Internet Explorer 8; use PARSE_UNESCAPE instead. To enforce deprecation, #define URLMON_STRICT. /// PARSE_ENCODE, /// /// Escape the URL. Deprecated in Internet Explorer 8; use PARSE_ESCAPE instead. To enforce deprecation, #define URLMON_STRICT. /// PARSE_DECODE, /// Retrieve a DOS file path from a file:// URL. PARSE_PATH_FROM_URL, /// Create a file:// URL from the specified DOS file path. PARSE_URL_FROM_PATH, /// Return the MIME type of this URL based on its file name extension. Not supported by CoInternetParseUrl or CoInternetParseIUri. PARSE_MIME, /// Return the server name. Not supported by CoInternetParseUrl or CoInternetParseIUri. PARSE_SERVER, /// Retrieve the URL scheme for this URL, for example http. PARSE_SCHEMA, /// Retrieve the hostname associated with this URL, for example www.microsoft.com. PARSE_SITE, /// Retrieve the domain associated with this URL. PARSE_DOMAIN, /// Same as PARSE_ANCHOR. PARSE_LOCATION, /// Retrieve the security form of the URL, as scheme:host. PARSE_SECURITY_DOMAIN, /// Percent-encode the URL. Convert reserved characters to escape sequences. PARSE_ESCAPE, /// Decode a percent-encoded URL. Convert escape sequences to the characters they represent. PARSE_UNESCAPE } /// Contains the available query options for CoInternetQueryInfo. // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775139%28v%3dvs.85%29 // typedef enum _tagQUERYOPTION { QUERY_EXPIRATION_DATE = 1, QUERY_TIME_OF_LAST_CHANGE, QUERY_CONTENT_ENCODING, QUERY_CONTENT_TYPE, // QUERY_REFRESH, QUERY_RECOMBINE, QUERY_CAN_NAVIGATE, QUERY_USES_NETWORK, QUERY_IS_CACHED, QUERY_IS_INSTALLEDENTRY, // QUERY_IS_CACHED_OR_MAPPED, QUERY_USES_CACHE, QUERY_IS_SECURE, QUERY_IS_SAFE, QUERY_USES_HISTORYFOLDER, // QUERY_IS_CACHED_AND_USABLE_OFFLINE } QUERYOPTION; [PInvokeData("Urlmon.h")] public enum QUERYOPTION { /// Request the expiration date in a SYSTEMTIME format. QUERY_EXPIRATION_DATE = 1, /// Request the last changed date in a SYSTEMTIME format. QUERY_TIME_OF_LAST_CHANGE, /// Request the content encoding schema. QUERY_CONTENT_ENCODING, /// Request the content type header. QUERY_CONTENT_TYPE, /// Request a refresh. QUERY_REFRESH, /// Combine the page URL with the nearest base URL if TRUE. QUERY_RECOMBINE, /// Check if the protocol can navigate. QUERY_CAN_NAVIGATE, /// Check if the URL needs to access the network. QUERY_USES_NETWORK, /// Check if the resource is cached locally. QUERY_IS_CACHED, /// Check if this resource is installed locally on a CD-ROM. QUERY_IS_INSTALLEDENTRY, /// Check if this resource is stored in the cache or if it is on a mapped drive (in a cache container). QUERY_IS_CACHED_OR_MAPPED, /// Check if the specified protocol uses the Internet cache. QUERY_USES_CACHE, /// Check if the protocol is encrypted. QUERY_IS_SECURE, /// Check if the protocol only serves trusted content. QUERY_IS_SAFE, /// Internet Explorer 7. Check whether the URLs from this protocol appear in history. QUERY_USES_HISTORYFOLDER, /// /// Internet Explorer 9. If the cache entry is available and can be used offline (not expired or flagged to revalidate), then /// CoInternetQueryInfo returns TRUE in pvBuffer; FALSE otherwise. /// QUERY_IS_CACHED_AND_USABLE_OFFLINE } /// Flags used by . [PInvokeData("Urlmon.h")] public enum Uri_CREATE { /// Default. If the scheme is unspecified and not implicitly "file," assume relative. Uri_CREATE_ALLOW_RELATIVE = 0x0001, /// If the scheme is unspecified and not implicitly "file," assume wildcard. Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME = 0x0002, /// Default. If the scheme is unspecified and URI starts with a drive letter (X:) or UNC path (\\), assume "file." Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME = 0x0004, /// If there is a query string, don't look for a fragment. Uri_CREATE_NOFRAG = 0x0008, /// Do not canonicalize the scheme, host, authority, path, query, or fragment. Uri_CREATE_NO_CANONICALIZE = 0x0010, /// Default. Canonicalize the scheme, host, authority, path, query, and fragment. Uri_CREATE_CANONICALIZE = 0x0100, /// Use DOS path compatibility mode to create "file" URIs. Uri_CREATE_FILE_USE_DOS_PATH = 0x0020, /// /// Default. Perform the percent-encoding and percent-decoding canonicalizations on the query and fragment. This flag takes /// precedence over Uri_CREATE_NO_CANONICALIZE. /// Uri_CREATE_DECODE_EXTRA_INFO = 0x0040, /// /// Do not perform the percent-encoding or percent-decoding canonicalizations on the query and fragment. This flag takes /// precedence over Uri_CREATE_CANONICALIZE. /// Uri_CREATE_NO_DECODE_EXTRA_INFO = 0x0080, /// Default. Hierarchical URIs with unrecognized schemes will be treated like hierarchical URIs. Uri_CREATE_CRACK_UNKNOWN_SCHEMES = 0x0200, /// Hierarchical URIs with unrecognized schemes will be treated like opaque URIs. Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES = 0x0400, /// /// Default. Perform preprocessing on the URI to remove control characters and white space, as if the URI had come from the raw /// href value of an HTML page. /// Uri_CREATE_PRE_PROCESS_HTML_URI = 0x0800, /// Do not perform preprocessing to remove control characters and white space as appropriate. Uri_CREATE_NO_PRE_PROCESS_HTML_URI = 0x1000, /// Use Internet Explorer registry settings to determine default URL-parsing behavior. Uri_CREATE_IE_SETTINGS = 0x2000, /// Default. Do not use Internet Explorer registry settings. Uri_CREATE_NO_IE_SETTINGS = 0x4000, /// /// Do not percent-encode characters that are forbidden by RFC-3986. Use with Uri_CREATE_FILE_USE_DOS_PATH to create file monikers. /// Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS = 0x8000, /// /// Default. Percent encode all extended Unicode characters, then decode all percent encoded extended Unicode characters (except /// those identified as dangerous). /// Uri_CREATE_NORMALIZE_INTL_CHARACTERS = 0x00010000, } /// Used by . [PInvokeData("Urlmon.h")] [Flags] public enum Uri_DISPLAY { /// Uri_PROPERTY_DISPLAY_URI: Exclude the fragment portion of the URI, if any. Uri_DISPLAY_NO_FRAGMENT = 0x00000001, /// /// Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_DOMAIN, Uri_PROPERTY_HOST: If the URI is an IDN, always display the hostname encoded /// as punycode. /// Uri_PUNYCODE_IDN_HOST = 0x00000002, /// /// 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. /// Uri_DISPLAY_IDN_HOST = 0x00000004, } /// Specify the encoding of all applicable components, except the scheme and the port. [PInvokeData("Urlmon.h")] [Flags] public enum Uri_ENCODING { /// Default. The user info component and path component use percent encoded UTF-8. Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 = 0x00000001, /// The user info component and path component use the codepage specified in dwCodePage. Uri_ENCODING_USER_INFO_AND_PATH_IS_CP = 0x00000002, /// Default. The host component uses IDN (Punycode) format. Uri_ENCODING_HOST_IS_IDN = 0x00000004, /// The host component uses percent encoded UTF-8. Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 = 0x00000008, /// The host component uses the codepage specified in dwCodePage. Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP = 0x00000010, /// Default. The query and fragment components use percent encoded UTF-8. Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 = 0x00000020, /// The query and fragment components use the codepage specified in dwCodePage. Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP = 0x00000040, /// /// The URI meets the requirements of RFC 3490. This flag combines the preceding default flags: Uri_ENCODING_HOST_IS_IDN, /// Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8, and Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8. /// Uri_ENCODING_RFC = Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 | Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 | Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 } /// Used by . [PInvokeData("Urlmon.h")] [Flags] public enum Uri_HAS : uint { /// Uri_PROPERTY_ABSOLUTE_URI exists. Uri_HAS_ABSOLUTE_URI = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_ABSOLUTE_URI, /// Uri_PROPERTY_AUTHORITY exists. Uri_HAS_AUTHORITY = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_AUTHORITY, /// Uri_PROPERTY_DISPLAY_URI exists. Uri_HAS_DISPLAY_URI = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_DISPLAY_URI, /// Uri_PROPERTY_DOMAIN exists. Uri_HAS_DOMAIN = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_DOMAIN, /// Uri_PROPERTY_EXTENSION exists. Uri_HAS_EXTENSION = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_EXTENSION, /// Uri_PROPERTY_FRAGMENT exists. Uri_HAS_FRAGMENT = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_FRAGMENT, /// Uri_PROPERTY_HOST exists. Uri_HAS_HOST = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_HOST, /// Uri_PROPERTY_PASSWORD exists. Uri_HAS_PASSWORD = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_PASSWORD, /// Uri_PROPERTY_PATH exists. Uri_HAS_PATH = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_PATH, /// Uri_PROPERTY_QUERY exists. Uri_HAS_QUERY = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_QUERY, /// Uri_PROPERTY_RAW_URI exists. Uri_HAS_RAW_URI = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_RAW_URI, /// Uri_PROPERTY_SCHEME_NAME exists. Uri_HAS_SCHEME_NAME = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_SCHEME_NAME, /// Uri_PROPERTY_USER_NAME exists. Uri_HAS_USER_NAME = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_USER_NAME, /// Uri_PROPERTY_PATH_AND_QUERY exists. Uri_HAS_PATH_AND_QUERY = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_PATH_AND_QUERY, /// Uri_PROPERTY_USER_INFO exists. Uri_HAS_USER_INFO = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_USER_INFO, /// Uri_PROPERTY_HOST_TYPE exists. Uri_HAS_HOST_TYPE = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_HOST_TYPE, /// Uri_PROPERTY_PORT exists. Uri_HAS_PORT = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_PORT, /// Uri_PROPERTY_SCHEME exists. Uri_HAS_SCHEME = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_SCHEME, /// Uri_PROPERTY_ZONE exists. Uri_HAS_ZONE = 1 << (int)Uri_PROPERTY.Uri_PROPERTY_ZONE, } /// Describes the format of the specified host in a Uniform Resource Identifier (URI). // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775140%28v%3dvs.85%29 // typedef enum { Uri_HOST_UNKNOWN = 0, Uri_HOST_DNS = 1, Uri_HOST_IPV4 = 2, Uri_HOST_IPV6 = 3, Uri_HOST_IDN = 4 } Uri_HOST_TYPE; [PInvokeData("Urlmon.h")] public enum Uri_HOST_TYPE { /// Indicates an unrecognized (or future version) format. Uri_HOST_UNKNOWN = 0, /// Indicates a textual DNS naming convention. Uri_HOST_DNS = 1, /// Indicates an IPv4 host format. Uri_HOST_IPV4 = 2, /// Indicates an IPv6 host format. Uri_HOST_IPV6 = 3, /// Indicates an IDN. Uri_HOST_IDN = 4 } /// /// Represents properties that an IUri can contain. The properties in the range Uri_PROPERTY_STRING_START to /// Uri_PROPERTY_STRING_LAST are strings and the rest are DWORD values. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775141%28v%3dvs.85%29 // typedef enum { Uri_PROPERTY_ABSOLUTE_URI = 0, Uri_PROPERTY_STRING_START = Uri_PROPERTY_ABSOLUTE_URI, Uri_PROPERTY_AUTHORITY = 1, // Uri_PROPERTY_DISPLAY_URI = 2, Uri_PROPERTY_DOMAIN = 3, Uri_PROPERTY_EXTENSION = 4, Uri_PROPERTY_FRAGMENT = 5, Uri_PROPERTY_HOST = // 6, Uri_PROPERTY_PASSWORD = 7, Uri_PROPERTY_PATH = 8, Uri_PROPERTY_PATH_AND_QUERY = 9, Uri_PROPERTY_QUERY = 10, // Uri_PROPERTY_RAW_URI = 11, Uri_PROPERTY_SCHEME_NAME = 12, Uri_PROPERTY_USER_INFO = 13, Uri_PROPERTY_USER_NAME = 14, // Uri_PROPERTY_STRING_LAST = Uri_PROPERTY_USER_NAME, Uri_PROPERTY_HOST_TYPE = 15, Uri_PROPERTY_DWORD_START = // Uri_PROPERTY_HOST_TYPE, Uri_PROPERTY_PORT = 16, Uri_PROPERTY_SCHEME = 17, Uri_PROPERTY_ZONE = 18, Uri_PROPERTY_DWORD_LAST = // Uri_PROPERTY_ZONE } Uri_PROPERTY; [PInvokeData("Urlmon.h")] public enum Uri_PROPERTY : uint { /// Includes the entire canonicalized URI. This property is not defined for relative URLs. See also Uri_PROPERTY_RAW_URI. Uri_PROPERTY_ABSOLUTE_URI = 0, /// Designates the first string property. Uri_PROPERTY_STRING_START = 0, /// /// Combines user name, password, fully qualified domain name, and port number. 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. /// Uri_PROPERTY_AUTHORITY = 1, /// /// Combines protocol scheme, fully qualified domain name, port number, full path, query string, and (optionally) fragment. /// (Pass the Uri_DISPLAY_NO_FRAGMENT flag to get one or more of the following methods to hide the fragment portion: /// IUri::GetPropertyBSTR and IUri::GetPropertyLength.) If the scheme is unrecognized, the user name and password will also be displayed. /// /// 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. /// /// Uri_PROPERTY_DISPLAY_URI = 2, /// /// Indicates the private domain name and public suffix (top-level domain) only. If the URL contains only a plain hostname (for /// example, "http://example/") or public suffix (for example, "http://co.uk/"), then Uri_PROPERTY_DOMAIN is NULL; use /// Uri_PROPERTY_HOST instead. /// Uri_PROPERTY_DOMAIN = 3, /// Indicates the file name extension only. Uri_PROPERTY_EXTENSION = 4, /// Indicates the fragment (secondary resource, or named anchor identifier) only. Uri_PROPERTY_FRAGMENT = 5, /// Indicates the fully qualified domain name or plain hostname. See also Uri_PROPERTY_DOMAIN. Uri_PROPERTY_HOST = 6, /// Indicates the password only, as parsed from the URI. Prompted credentials do not appear here. Uri_PROPERTY_PASSWORD = 7, /// Indicates the path and resource. Uri_PROPERTY_PATH = 8, /// Combines full path to resource with URI query string. Uri_PROPERTY_PATH_AND_QUERY = 9, /// /// Indicates the query (or search) string. The search string may be canonicalized by CreateUri if the Uri_CREATE_DECODE_EXTRA /// flag was used; however, no other encoding or decoding is performed. /// Uri_PROPERTY_QUERY = 10, /// /// Includes the entire original URI as entered. Note that character %61 is lowercase A in the following example. See also Uri_PROPERTY_ABSOLUTE_URI. /// Uri_PROPERTY_RAW_URI = 11, /// Indicates the protocol scheme name. See also Uri_PROPERTY_SCHEME. Uri_PROPERTY_SCHEME_NAME = 12, /// /// Combines user name and password as parsed from the URI. String does not include colon (:) if password is not present. /// Uri_PROPERTY_USER_INFO = 13, /// Designates the final string property. Uri_PROPERTY_STRING_LAST = 14, /// Indicates the user name only, as parsed from the URI. Prompted credentials do not appear here. Uri_PROPERTY_USER_NAME = 14, /// Designates the first numerical property. Uri_PROPERTY_DWORD_START = 15, /// Returns a value from the Uri_HOST_TYPE enumeration. Uri_PROPERTY_HOST_TYPE = 15, /// Indicates the port number only. Uri_PROPERTY_PORT = 16, /// Returns a value from the URL_SCHEME enumeration. See also Uri_PROPERTY_SCHEME_NAME. Uri_PROPERTY_SCHEME = 17, /// Designates the final numerical property. Uri_PROPERTY_DWORD_LAST = 18, /// /// Not implemented. To calculate the zone of a URI object, pass the URI to the IInternetSecurityManagerEx2::MapUrlToZoneEx2 method. /// Uri_PROPERTY_ZONE = 18 } /// Specifies which URL parser to use. [PInvokeData("Urlmon.h")] public enum URL_MK { /// Use the same URL parser as CreateURLMoniker. URL_MK_LEGACY = 0, /// Use the updated URL parser. URL_MK_UNIFORM = 1, /// Do not attempt to convert the URL moniker to the standard format. URL_MK_NO_CANONICALIZE = 2, } /// Used to specify URL schemes. // https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/ne-shlwapi-url_scheme typedef enum { URL_SCHEME_INVALID, // URL_SCHEME_UNKNOWN, URL_SCHEME_FTP, URL_SCHEME_HTTP, URL_SCHEME_GOPHER, URL_SCHEME_MAILTO, URL_SCHEME_NEWS, URL_SCHEME_NNTP, // URL_SCHEME_TELNET, URL_SCHEME_WAIS, URL_SCHEME_FILE, URL_SCHEME_MK, URL_SCHEME_HTTPS, URL_SCHEME_SHELL, URL_SCHEME_SNEWS, // URL_SCHEME_LOCAL, URL_SCHEME_JAVASCRIPT, URL_SCHEME_VBSCRIPT, URL_SCHEME_ABOUT, URL_SCHEME_RES, URL_SCHEME_MSSHELLROOTED, // URL_SCHEME_MSSHELLIDLIST, URL_SCHEME_MSHELP, URL_SCHEME_MSSHELLDEVICE, URL_SCHEME_WILDCARD, URL_SCHEME_SEARCH_MS, // URL_SCHEME_SEARCH, URL_SCHEME_KNOWNFOLDER, URL_SCHEME_MAXVALUE } ; [PInvokeData("shlwapi.h", MSDNShortId = "45686920-356d-4dd7-8482-2427854a92ed")] public enum URL_SCHEME { /// An invalid scheme. URL_SCHEME_INVALID, /// An unknown scheme. URL_SCHEME_UNKNOWN, /// FTP (ftp:). URL_SCHEME_FTP, /// HTTP (http:). URL_SCHEME_HTTP, /// Gopher (gopher:). URL_SCHEME_GOPHER, /// Mail-to (mailto:). URL_SCHEME_MAILTO, /// Usenet news (news:). URL_SCHEME_NEWS, /// Usenet news with NNTP (nntp:). URL_SCHEME_NNTP, /// Telnet (telnet:). URL_SCHEME_TELNET, /// Wide Area Information Server (wais:). URL_SCHEME_WAIS, /// File (file:). URL_SCHEME_FILE, /// URL moniker (mk:). URL_SCHEME_MK, /// URL HTTPS (https:). URL_SCHEME_HTTPS, /// Shell (shell:). URL_SCHEME_SHELL, /// NNTP news postings with SSL (snews:). URL_SCHEME_SNEWS, /// Local (local:). URL_SCHEME_LOCAL, /// JavaScript (javascript:). URL_SCHEME_JAVASCRIPT, /// VBScript (vbscript:). URL_SCHEME_VBSCRIPT, /// About (about:). URL_SCHEME_ABOUT, /// Res (res:). URL_SCHEME_RES, /// Internet Explorer 6 and later only. Shell-rooted (ms-shell-rooted:) URL_SCHEME_MSSHELLROOTED, /// Internet Explorer 6 and later only. Shell ID-list (ms-shell-idlist:). URL_SCHEME_MSSHELLIDLIST, /// Internet Explorer 6 and later only. MSHelp (hcp:). URL_SCHEME_MSHELP, /// Not supported. URL_SCHEME_MSSHELLDEVICE, /// Internet Explorer 7 and later only. Wildcard (*:). URL_SCHEME_WILDCARD, /// Windows Vista and later only. Search-MS (search-ms:). URL_SCHEME_SEARCH_MS, /// Windows Vista with SP1 and later only. Search (search:). URL_SCHEME_SEARCH, /// Windows 7 and later. Known folder (knownfolder:). URL_SCHEME_KNOWNFOLDER, /// The highest legitimate value in the enumeration, used for validation purposes. URL_SCHEME_MAXVALUE, } /// Installs the specified component. /// A pointer to a string that specifies the name of the component. /// /// A pointer to a string that specifies the MIME type of the component. This parameter is used to generate a CLSID for the component. /// /// /// A pointer to a string that specifies the extension. If szTYPE is not specified, this parameter is used to generate a CLSID for /// this component. /// /// /// A value of type DWORD that specifies the major version number of the component. When the version is indicated by four /// words, ; dwFileVersionMS indicates with the high-order word and with the low-order word. /// /// /// A value of type DWORD that specifies the minor version number of the component. When the version is indicated by four /// words, ; dwFileVersionLS indicates with the high-order word and with the low-order word. /// /// A pointer to a string that specifies the URL of the component. /// A pointer to an IBindCtx interface that specifies the binding context for this operation. /// /// /// A value of type DWORD that specifies one of the following flags. /// 0x00 (0x00) /// /// Download the component if the version specified by dwFileVersionMS and dwFileVersionLS is more recent then the currently /// installed version. /// /// 0x01 (0x01) /// Download the component regardless of the currently installed version. /// /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775082(v%3Dvs.85) // HRESULT AsyncInstallDistributionUnit( LPCWSTR szDistUnit, LPCWSTR szTYPE, LPCWSTR szExt, DWORD dwFileVersionMS, DWORD // dwFileVersionLS, LPCWSTR szURL, IBindCtx *pbc, _Reserved_ LPVOID pvReserved, DWORD flags ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT AsyncInstallDistributionUnit([MarshalAs(UnmanagedType.LPWStr)] string szDistUnit, [Optional, MarshalAs(UnmanagedType.LPWStr)] string szTYPE, [Optional, MarshalAs(UnmanagedType.LPWStr)] string szExt, uint dwFileVersionMS, uint dwFileVersionLS, [Optional, MarshalAs(UnmanagedType.LPWStr)] string szURL, IBindCtx pbc, [Optional] IntPtr pvReserved, uint flags); /// Returns a factory object for a given CLSID. /// /// The CLSID of the ActiveX object to install. If the value is CLSID_NULL, szContentType is used to determine the CLSID. /// /// The address of a string value that contains the full URL of the code for the ActiveX object. /// /// An unsigned long integer value that contains the major version number for the object to be installed. If this value and the /// value for dwFileVersionLS are both 0xFFFFFFFF, the latest version of the code should always be installed. This means that /// Internet Component Download will always attempt to download new code. /// /// /// An unsigned long integer value that contains the minor version number for the object to be installed. If this value and the /// value for dwFileVersionMS are both 0xFFFFFFFF, the latest version of the code should always be installed. This means that /// Internet Component Download will always attempt to download new code. /// /// /// A pointer to a string value that contains the MIME type to be understood by the installed ActiveX object. If rclsid is /// CLSID_NULL, this string is used to determine the CLSID of the object to install. Note that this parameter is useful only when /// you try to download a viewer for a particular media type; when the MIME type of media is known, but the CLSID is not. /// /// /// A pointer to the bind context to use for downloading or installing component code. An implementation of IBindStatusCallback must /// be registered on this bind context before you can call this function. /// /// /// An unsigned long integer value that specifies the execution context for the class object. This can be one of the values taken /// from the CLSCTX enumeration. /// /// Reserved. Must be set to NULL. /// The reference identifier of the interface to obtain on the factory object. Usually, this interface is IClassFactory. /// The interface pointer for synchronous calls, or NULL otherwise. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// The operation completed successfully, and the ppv parameter contains the requested interface pointer. /// /// /// E_NOINTERFACE /// The requested interface pointer is not available. /// /// /// MK_S_ASYNCHRONOUS /// /// Component code will be downloaded and installed asynchronously. The client will receive notifications through the /// IBindStatusCallback interface registered on pBindCtx. /// /// /// /// /// /// /// If no CLSID is specified (CLSID_NULL), the CoGetClassObjectFromURL function chooses the appropriate CLSID /// for interpreting the MIME type specified in szContentType. If the specified object is installed on the system, it is /// instantiated. Otherwise, the necessary code is downloaded and installed from the location specified in szCodeURL. /// /// /// The CoGetClassObjectFromURL function was designed to be used by MSHTML to retrieve the code for objects on a Web page. /// When the requested object is available for use on the user's computer, this function returns synchronously with a valid object /// reference. For objects that aren't available on the user's computer and must be downloaded from szCodeURL, the /// CoGetClassObjectFromURL function returns asynchronously with MK_S_ASNYNCHRONOUS and notifies the calling application /// through the IBindStatusCallback interface that was registered on pBindCtx. /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775083(v=vs.85) HRESULT // CoGetClassObjectFromURL( _In_ REFCLSID rclsid, _In_ LPCWSTR szCodeURL, _In_ DWORD dwFileVersionMS, _In_ DWORD dwFileVersionLS, // _In_ LPCWSTR szContentType, _In_ LPBINDCTX pBindCtx, _In_ DWORD dwClsContext, _Reserved_ LPVOID pvReserved, _In_ REFIID riid, // _Out_ VOID **ppv ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoGetClassObjectFromURL(in Guid rclsid, [MarshalAs(UnmanagedType.LPWStr)] string szCodeURL, uint dwFileVersionMS, uint dwFileVersionLS, [MarshalAs(UnmanagedType.LPWStr)] string szContentType, IBindCtx pBindCtx, CLSCTX dwClsContext, [Optional] IntPtr pvReserved, in Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); /// Combines a base Uniform Resource Identifier (URI) and a relative URI into a full URI. /// A pointer to the IUri interface of the base URI. /// A pointer to the IUri interface of the relative URI. /// /// An unsigned long integer value that combines one or more of the following flags. /// URL_DONT_SIMPLIFY /// Equivalent to Uri_CREATE_NO_CANONICALIZE. /// URL_DONT_UNESCAPE_EXTRA_INFO /// Equivalent to Uri_CREATE_NO_DECODE_EXTRA_INFO. /// URL_FILE_USE_PATHURL /// Equivalent to Uri_CREATE_FILE_USE_DOS_PATH. /// /// /// A pointer to an IUri interface that receives the newly created combined URI. The client must call Release on the returned pointer. /// /// Reserved. Must be set to 0. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// E_OUTOFMEMORY /// There is insufficient memory to create the new IUri. /// /// /// /// /// /// The following examples demonstrate the effect of combining a base URI and a relative URI. Note that the first example ends in a /// resource, and the second example ends in a path segment. /// /// /// For more information on the algorithm used to combine a base URI and a relative URI, refer to RFC-3986 Section 5.2, "Relative Resolution." /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775084(v=vs.85) HRESULT // CoInternetCombineIUri( IUri *pBaseUri, IUri *pRelativeUri, DWORD dwCombineFlags, IUri **ppCombinedUri, _Reserved_ DWORD_PTR // dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetCombineIUri(IUri pBaseUri, IUri pRelativeUri, Uri_CREATE dwCombineFlags, out IUri ppCombinedUri, [Optional] IntPtr dwReserved); /// Combines a base URL and a relative URL into a full URL. /// A pointer to a string value containing the base URL. /// A pointer to a string value containing the relative URL. /// /// An unsigned long integer value that combines one or more of the following flags. /// URL_DONT_SIMPLIFY /// Equivalent to Uri_CREATE_NO_CANONICALIZE. /// URL_DONT_UNESCAPE_EXTRA_INFO /// Equivalent to Uri_CREATE_NO_DECODE_EXTRA_INFO. /// URL_FILE_USE_PATHURL /// Equivalent to Uri_CREATE_FILE_USE_DOS_PATH. /// /// A pointer to a string variable where the full URL will be stored. /// An unsigned long integer value that contains the size of the buffer. /// /// A pointer to an unsigned long integer value that receives the number of characters returned in pwzResult. Count does not include /// the terminating NULL character. /// /// Reserved. Must be set to 0. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// S_FALSE /// The buffer is too small to contain the resulting URL. /// /// /// E_POINTER /// pwzResult is NULL, or the buffer is too small. /// /// /// /// /// The return value of this function differs depending on the protocol handler implementation used to perform the combine /// operation. If the function fails because the output buffer is too small, the number returned in pcchResult is the length in /// bytes required to hold the result, including the terminating NULL character. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775085(v=vs.85) HRESULT // CoInternetCombineUrl( LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD // *pcchResult, _Reserved_ DWORD dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetCombineUrl([MarshalAs(UnmanagedType.LPWStr)] string pwzBaseUrl, [MarshalAs(UnmanagedType.LPWStr)] string pwzRelativeUrl, Uri_CREATE dwCombineFlags, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzResult, uint cchResult, out uint pcchResult, [Optional] uint dwReserved); /// Combines a base URL and a relative URL into a full Uniform Resource Identifier (URI). /// A pointer to an IUri interface containing the base URI. /// A pointer to a string value containing the relative URL. /// /// An unsigned long integer value that combines one or more of the following flags. /// URL_DONT_SIMPLIFY /// Equivalent to Uri_CREATE_NO_CANONICALIZE. /// URL_DONT_UNESCAPE_EXTRA_INFO /// Equivalent to Uri_CREATE_NO_DECODE_EXTRA_INFO. /// URL_FILE_USE_PATHURL /// Equivalent to Uri_CREATE_FILE_USE_DOS_PATH. /// /// /// A pointer to an IUri interface that receives the newly created combined URI. The client must call Release on the returned pointer. /// /// Reserved. Must be set to 0. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// INET_E_INVALID_URL /// URI syntax error in pwzRelativeUrl. /// /// /// E_OUTOFMEMORY /// There is insufficient memory to create the new IUri. /// /// /// /// /// Use this function to combine an IUri and a relative URL stored as a Unicode string value. To combine two IUri /// objects, use the CoInternetCombineIUri function. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775086(v=vs.85) HRESULT // CoInternetCombineUrlEx( IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, IUri **ppCombinedUri, _Reserved_ DWORD_PTR // dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetCombineUrlEx(IUri pBaseUri, [MarshalAs(UnmanagedType.LPWStr)] string pwzRelativeUrl, Uri_CREATE dwCombineFlags, out IUri ppCombinedUri, [Optional] IntPtr dwReserved); /// Compares two URLs and determines if they are equal. /// The address of a string value that contains the first URL. /// The address of a string value that contains the second URL. /// /// An unsigned long integer value that controls how the comparison should be done. This is set to TRUE to ignore slash marks, or /// FALSE otherwise. /// /// Returns S_OK if equal, or S_FALSE otherwise. // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775087(v=vs.85) HRESULT // CoInternetCompareUrl( _In_ LPCWSTR pwzUrl1, _In_ LPCWSTR pwzUrl2, _In_ DWORD dwCompareFlags ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetCompareUrl([MarshalAs(UnmanagedType.LPWStr)] string pwzUrl1, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl2, [MarshalAs(UnmanagedType.Bool)] bool dwCompareFlags); /// /// Creates a session that allows temporary asynchronous pluggable protocols to be implemented and returns the /// IInternetSession interface of the session. /// /// Reserved. Must be set to 0. /// The address of a pointer to the IInternetSession interface. /// Reserved. Must be set to 0. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// E_OUTOFMEMORY /// Not enough memory to create a session. /// /// /// E_INVALIDARG /// One of the arguments is invalid. /// /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767908(v=vs.85) STDAPI // CoInternetGetSession( _Reserved_ DWORD dwSessionMode, IInternetSession **ppIInternetSession, _Reserved_ DWORD dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetGetSession([Optional] uint dwSessionMode, out IInternetSession ppIInternetSession, [Optional] uint dwReserved); /// Transforms and identifies parts of URLs. Compare to CoInternetParseUrl. /// /// [in] /// The address of an IUri interface to be parsed. /// /// /// [in] /// One of the following PARSEACTION values: /// (PARSE_CANONICALIZE) /// Canonicalize the URL. /// (PARSE_FRIENDLY) /// Retrieve a URL suitable for display. /// (PARSE_ROOTDOCUMENT) /// Retrieve the scheme and authority (including user name, password, and port if available) of the URL; for example, . /// (PARSE_DOCUMENT) /// Retrieve the portion of the URL prior to the fragment; for example, . /// (PARSE_ENCODE or PARSE_UNESCAPE) /// Percent-encode reserved characters in the URL. /// (PARSE_DECODE or PARSE_ESCAPE) /// Decode percent-encoded character sequences in the URL. /// (PARSE_PATH_FROM_URL) /// Convert a URL scheme into a DOS file path. /// (PARSE_URL_FROM_PATH) /// Convert a DOS path into a URL. /// (PARSE_SCHEMA) /// Retrieve the URL scheme; for example, . /// (PARSE_SITE) /// Retrieve the hostname; for example, . /// (PARSE_DOMAIN) /// Retrieve the top-level domain; for example, . /// (PARSE_LOCATION or PARSE_ANCHOR) /// Retrieve the URL fragment (named anchor); for example, . /// /// /// [in] /// /// A DWORD value that controls the parsing operation, based on the value passed as the ParseAction parameter. For valid /// flags, see Remarks section. /// /// /// /// [in] /// A pointer to a Unicode string buffer that receives the result of the parsing operation. /// /// /// [in] /// /// An unsigned long integer value that contains the size of the buffer in pwzResult, including the terminating NULL character. /// /// /// /// [out] /// /// The address of a DWORD value that receives the number of characters returned in pwzResult. Count does not include the /// terminating NULL character. /// /// /// /// [in] /// Reserved. Must be set to 0. /// /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// S_FALSE /// The buffer is too small to contain the resulting URL. /// /// /// INET_E_DEFAULT_ACTION /// Use the default action. /// /// /// E_INVALID_ARG /// Missing input arguments or incompatible dwFlags and ParseAction. /// /// /// E_FAIL /// Used for compatibility with CoInternetParseUrl behavior for some ParseAction requests. /// /// /// /// /// /// Much of the functionality of the string-based CoInternetParseUrl function is not necessary with a preparsed IUri /// object. Encode operations and decode operations are discouraged because an IUri stores its data in a normalized /// (canonical) form. /// /// /// The possible values for dwFlags are determined by ParseAction. For example, if PARSE_CANONICALIZE is passed as the /// ParseAction parameter, the flags that are valid for the UrlCanonicalize function can also be passed to this function to control /// the parsing operation. The following table lists the parsing actions and related flags. /// /// /// /// ParseAction /// Related dwFlags /// /// /// PARSE_CANONICALIZE /// UrlCanonicalize /// /// /// PARSE_UNESCAPE, PARSE_ENCODE /// UrlUnescape /// /// /// PARSE_ESCAPE, PARSE_DECODE /// UrlEscape /// /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775088(v=vs.85) STDAPI // CoInternetParseIUri( _In_ IUri *pIUri, _In_ PARSEACTION ParseAction, _In_ DWORD dwFlags, _In_ LPWSTR pwzResult, _In_ DWORD // cchResult, _Out_ DWORD *pcchResult, _Reserved_ DWORD_PTR dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetParseIUri(IUri pIUri, PARSEACTION ParseAction, uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pwzResult, uint cchResult, out uint pcchResult, [Optional] IntPtr dwReserved); /// Transforms and identifies parts of URLs. Compare to CoInternetParseIUri. /// String value that contains the URL to parse. /// /// One of the following PARSEACTION values: /// (PARSE_CANONICALIZE) /// Canonicalize the URL. /// (PARSE_ROOTDOCUMENT) /// Retrieve the scheme and hostname of the URL; for example, . /// (PARSE_ENCODE or PARSE_ESCAPE) /// Percent-encode reserved characters in the URL. /// (PARSE_DECODE or PARSE_UNESCAPE) /// Decode percent-encoded character sequences in the URL. /// (PARSE_PATH_FROM_URL) /// Convert a URL scheme into a DOS file path. /// (PARSE_URL_FROM_PATH) /// Convert a DOS path into a URL. /// (PARSE_SCHEMA) /// Retrieve the URL scheme; for example, . /// (PARSE_DOMAIN) /// Retrieve the hostname; for example, . /// (PARSE_LOCATION) /// Retrieve the URL fragment (named anchor); for example, . /// /// /// Unsigned long integer value that controls the parsing operation, based on the value passed as the ParseAction parameter. For /// valid flags, see Remarks section. /// /// String value that contains the information parsed from the URL. /// Unsigned long integer value that contains the size of the buffer. /// /// Pointer to an unsigned long integer value that contains the size of the information stored in the buffer. /// /// Reserved. Must be set to 0. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// S_FALSE /// The buffer was too small to contain the resulting URL. /// /// /// E_POINTER /// The buffer was too small to contain the resulting URL. See Remarks. /// /// /// INET_E_DEFAULT_ACTION /// Use the default action. /// /// /// /// /// /// When ParseAction is PARSE_UNESCAPE, PARSE_ENCODE, PARSE_ESCAPE, or PARSE_DECODE, CoInternetParseUrl will return E_POINTER /// if pszResult is too small to hold the result. When ParseAction is PARSE_URL_FROM_PATH, this function will return S_FALSE if /// pwzUrl does not contain a DOS file path. /// /// /// The possible values for dwFlags are determined by ParseAction. For example, if PARSE_CANONICALIZE is passed as the /// ParseAction parameter, the flags that are valid for the UrlCanonicalize function can also be passed to this function to control /// the parsing operation. The following table lists the parsing actions and related flags. /// /// /// /// ParseAction /// Related dwFlags /// /// /// PARSE_CANONICALIZE /// UrlCanonicalize /// /// /// PARSE_UNESCAPE, PARSE_ENCODE /// UrlUnescape /// /// /// PARSE_ESCAPE, PARSE_DECODE /// UrlEscape /// /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775089(v=vs.85) STDAPI // CoInternetParseUrl( LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, // _Reserved_ DWORD dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetParseUrl([MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, PARSEACTION ParseAction, uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszResult, uint cchResult, out uint pcchResult, [Optional] uint dwReserved); /// Retrieves information related to the specified URL. /// The PWZ URL. /// The query option. /// The dw query flags. /// The pv buffer. /// The cb buffer. /// The PCB buffer. /// The dw reserved. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// The operation completed successfully. /// /// /// E_FAIL /// The operation failed. /// /// /// S_FALSE /// The buffer is too small to store the information. /// /// /// INET_E_QUERYOPTION_UNKNOWN /// The option requested is unknown. /// /// /// /// /// The CoInternetQueryInfo function is a wrapper around the IInternetProtocolInfo::QueryInfo method. Pluggable /// protocol handlers should return and error codes, as described above. For URLs not handled by a pluggable protocol handler, this /// function returns for both "buffer too small" and "option unknown" errors. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775090(v=vs.85) HRESULT // CoInternetQueryInfo( LPCWSTR pwzUrl, QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pvBuffer, DWORD cbBuffer, DWORD // *pcbBuffer, _Reserved_ DWORD dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CoInternetQueryInfo([MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, QUERYOPTION QueryOption, uint dwQueryFlags, IntPtr pvBuffer, uint cbBuffer, out uint pcbBuffer, [Optional] uint dwReserved); /// Compares two security identifiers (SIDs) for equivalence. /// A pointer to a byte value that identifies the first SID. /// An unsigned long integer value that contains the first SID array length. /// A pointer to a byte value that identifies the second SID. /// An unsigned long integer value that contains the second SID array length. /// Reserved. Must be set to 0. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// The SIDs match. /// /// /// S_FALSE /// The SIDs do not match. /// /// /// E_INVALIDARG /// Not a valid SID. /// /// /// /// /// /// Only the domain names of both SIDs are considered for a match. You can compare Domain Name System (DNS) or Internationalized /// Domain Name (IDN) URLs, but not SIDs generated from an IP address or intranet sites. /// /// If one SID is derived from a Mark of the Web, both must be. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa359661(v=vs.85) HRESULT // CompareSecurityIds( BYTE *pbSecurityId1, DWORD dwLen1, BYTE *pbSecurityId2, DWORD dwLen2, _Reserved_ DWORD dwReserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CompareSecurityIds(byte[] pbSecurityId1, uint dwLen1, byte[] pbSecurityId2, uint dwLen2, [Optional] uint dwReserved); /// Reads the Microsoft ActiveX Compatibility registry entries for the specified ActiveX control. /// A pointer to the CLSID of the ActiveX control. /// /// Receives a value from the COMPAT enumeration. This parameter returns a value of zero if the entry is missing from the registry. /// /// /// Receives a value from the OLEMISC enumeration. This parameter returns a value of zero if the entry is missing from the registry. /// /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Indicates that zone elevation is disallowed. /// /// /// S_FALSE /// Indicates that the registry entry cannot be found. /// /// /// E_INVALIDARG /// Indicates that pclsid, pdwCompatFlags, or pdwMiscStatusFlags is NULL. /// /// /// /// /// /// The CompatFlagsFromClsid function was introduced in Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2). /// /// /// The compatibility registry keys for ActiveX controls can be found at HKEY_LOCAL_MACHINE\ Software\ /// Microsoft\ Internet Explorer\ ActiveX Compatibility in the registry. /// /// This function is used by IMoniker::BindToObject to determine whether an ActiveX control can be created. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775091(v=vs.85) HRESULT // CompatFlagsFromClsid( CLSID *pclsid, LPDWORD pdwCompatFlags, LPDWORD pdwMiscStatusFlags ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CompatFlagsFromClsid(in Guid pclsid, out COMPAT pdwCompatFlags, out OLEMISC pdwMiscStatusFlags); /// Copies the given BINDINFO structure. /// The address of the BINDINFO structure to be copied. /// The address of the BINDINFO structure to store the copy. /// 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/ms775092(v=vs.85) HRESULT // CopyBindInfo( const BINDINFO *pcbiSrc, BINDINFO *pcbiDest ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CopyBindInfo(in BINDINFO pcbiSrc, out BINDINFO pcbiDest); /// Copies the given STGMEDIUM structure. /// The address of the STGMEDIUM structure to copy. /// The address of the STGMEDIUM structure in which to store the copy. /// 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/ms775093(v=vs.85) HRESULT // CopyStgMedium( const STGMEDIUM *pcstgmedSrc, STGMEDIUM *pstgmedDest ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CopyStgMedium(in STGMEDIUM pcstgmedSrc, out STGMEDIUM pstgmedDest); /// Creates an asynchronous bind context for use with asynchronous monikers. /// This parameter is reserved and must be 0. /// A pointer to the IBindStatusCallback interface used for receiving data availability and progress notification. /// /// A pointer to the IEnumFORMATETC interface that can be used to enumerate formats for format negotiation during binding. This /// parameter can be NULL, in which case the caller is not interested in format negotiation during binding, and the default /// format of the object will be bound to. /// /// Address of an IBindCtx* pointer variable that receives the interface pointer to the new bind context. /// /// This function can return the following values. /// /// /// Return code /// Description /// /// /// S_OK /// The operation completed successfully. /// /// /// E_OUTOFMEMORY /// The method ran out of memory and did not complete. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// /// /// /// This function automatically registers the IBindStatusCallback and IEnumFORMATETC interfaces with the bind context. The client /// can specify flags from BSCO_OPTION to indicate which callback notifications the client is capable of receiving. If the client /// does not wish to receive certain notification, it can choose to implement those callback methods as empty function stubs /// (returning E_NOTIMPL), and they should not be called. /// /// The RegisterBindStatusCallback function can also be used to register callback interfaces in the bind context. /// // https://docs.microsoft.com/en-us/windows/win32/api/urlmon/nf-urlmon-createasyncbindctx HRESULT CreateAsyncBindCtx( DWORD // reserved, IBindStatusCallback *pBSCb, IEnumFORMATETC *pEFetc, IBindCtx **ppBC ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("urlmon.h", MSDNShortId = "0c79b61b-d3d6-48fd-aaee-21cddad09208")] public static extern HRESULT CreateAsyncBindCtx([Optional] uint reserved, IBindStatusCallback pBSCb, [In, Optional] IEnumFORMATETC pEFetc, out IBindCtx ppBC); /// Creates an asynchronous bind context for use with asynchronous monikers. /// A pointer to the IBindCtx interface. /// An unsigned long integer value that contains the option values. /// A pointer to the IBindStatusCallback interface. /// A pointer to the IEnumFORMATETC interface. /// A pointer to the IBindCtx interface that is returned. /// Reserved. Must be set to 0. /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775095(v=vs.85) HRESULT // CreateAsyncBindCtxEx( IBindCtx *pbc, DWORD dwOptions, IBindStatusCallback *pBSCb, IEnumFORMATETC *pEnum, IBindCtx **ppBC, // _Reserved_ DWORD reserved ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CreateAsyncBindCtxEx(IBindCtx pbc, uint dwOptions, IBindStatusCallback pBSCb, IEnumFORMATETC pEnum, out IBindCtx ppBC, uint reserved = 0); /// Creates an object that implements IEnumFORMATETC over a static array of FORMATETC structures. /// /// Number of FORMATETC structures in the static array specified by the rgfmtetc parameter. The cfmtetc parameter cannot be zero. /// /// Pointer to a static array of FORMATETC structures. /// /// Address of IEnumFORMATETC pointer variable that receives the interface pointer to the enumerator object. /// /// /// This function returns S_OK on success. Other possible return values include the following. /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// /// /// The CreateFormatEnumerator function creates an enumerator object that implements IEnumFORMATETC over a static array of /// FORMATETC structures. The cfmtetc parameter specifies the number of these structures. With the pointer, you can call the /// standard enumeration methods to enumerate the structures. /// // https://docs.microsoft.com/en-us/windows/win32/api/urlmon/nf-urlmon-createformatenumerator HRESULT CreateFormatEnumerator( UINT // cfmtetc, FORMATETC *rgfmtetc, IEnumFORMATETC **ppenumfmtetc ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("urlmon.h", MSDNShortId = "302418e5-48b6-46ee-bb96-2a8170c4af5e")] public static extern HRESULT CreateFormatEnumerator(uint cfmtetc, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] FORMATETC[] rgfmtetc, out IEnumFORMATETC ppenumfmtetc); /// Creates a new IUriBuilder instance, and initializes it from an optional IUri. /// /// [in, optional]Pointer to an existing IUri with which to initialize the object, or NULL to create an uninitialized object. /// /// [in]Currently unused. Set to 0. /// [in]Reserved. Must be set to 0. /// [out]Address of a pointer variable of type IUriBuilder that receives the new object. /// 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/ms775097(v=vs.85) STDAPI // CreateIUriBuilder( _In_opt_ IUri *pIUri, _In_ DWORD dwFlags, _Reserved_ DWORD_PTR dwReserved, _Out_ IUriBuilder **ppIUriBuilder ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CreateIUriBuilder([Optional] IUri pIUri, [Optional] uint dwFlags, [Optional] IntPtr dwReserved, out IUriBuilder ppIUriBuilder); /// /// Creates a new IUri instance, and initializes it from a Uniform Resource Identifier (URI) string. CreateUri also /// normalizes and validates the URI. /// /// /// [in] /// A constant pointer to a UTF-16 character string that specifies the URI. /// /// /// [in] /// A valid combination of the following flags. /// Uri_CREATE_ALLOW_RELATIVE (0x0001) /// Default. If the scheme is unspecified and not implicitly "file," assume relative. /// Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME (0x0002) /// If the scheme is unspecified and not implicitly "file," assume wildcard. /// Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME (0x0004) /// Default. If the scheme is unspecified and URI starts with a drive letter (X:) or UNC path (\\), assume "file." /// Uri_CREATE_NOFRAG (0x0008) /// If there is a query string, don't look for a fragment. /// Uri_CREATE_NO_CANONICALIZE (0x0010) /// Do not canonicalize the scheme, host, authority, path, query, or fragment. /// Uri_CREATE_CANONICALIZE (0x0100) /// Default. Canonicalize the scheme, host, authority, path, query, and fragment. /// Uri_CREATE_FILE_USE_DOS_PATH (0x0020) /// Use DOS path compatibility mode to create "file" URIs. /// Uri_CREATE_DECODE_EXTRA_INFO (0x0040) /// /// Default. Perform the percent-encoding and percent-decoding canonicalizations on the query and fragment. This flag takes /// precedence over Uri_CREATE_NO_CANONICALIZE. /// /// Uri_CREATE_NO_DECODE_EXTRA_INFO (0x0080) /// /// Do not perform the percent-encoding or percent-decoding canonicalizations on the query and fragment. This flag takes precedence /// over Uri_CREATE_CANONICALIZE. /// /// Uri_CREATE_CRACK_UNKNOWN_SCHEMES (0x0200) /// Default. Hierarchical URIs with unrecognized schemes will be treated like hierarchical URIs. /// Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES (0x0400) /// Hierarchical URIs with unrecognized schemes will be treated like opaque URIs. /// Uri_CREATE_PRE_PROCESS_HTML_URI (0x0800) /// /// Default. Perform preprocessing on the URI to remove control characters and white space, as if the URI had come from the raw href /// value of an HTML page. /// /// Uri_CREATE_NO_PRE_PROCESS_HTML_URI (0x1000) /// Do not perform preprocessing to remove control characters and white space as appropriate. /// Uri_CREATE_IE_SETTINGS (0x2000) /// Use Internet Explorer registry settings to determine default URL-parsing behavior. /// Uri_CREATE_NO_IE_SETTINGS (0x4000) /// Default. Do not use Internet Explorer registry settings. /// Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS (0x8000) /// /// Do not percent-encode characters that are forbidden by RFC-3986. Use with Uri_CREATE_FILE_USE_DOS_PATH to create file monikers. /// /// Uri_CREATE_NORMALIZE_INTL_CHARACTERS (0x00010000) /// /// Default. Percent encode all extended Unicode characters, then decode all percent encoded extended Unicode characters (except /// those identified as dangerous). /// /// /// /// [in] /// Reserved. Must be set to 0. /// /// /// [out] /// An IUri interface pointer that receives the new instance. /// /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// E_INVALIDARG /// dwFlags conflict, or ppURI is NULL. /// /// /// E_OUTOFMEMORY /// There is insufficient memory to create the IUri. /// /// /// INET_E_INVALID_URL /// The string does not contain a recognized URI format. /// /// /// INET_E_SECURITY_PROBLEM /// The URI contains syntax that attempts to bypass security. /// /// /// E_FAIL /// Unknown error while parsing the URI. /// /// /// /// /// /// CreateUri returns E_INVALIDARGS if conflicting flags are specified in dwFlags. For example, /// Uri_CREATE_DECODE_EXTRA_INFO and Uri_CREATE_NO_DECODE_EXTRA_INFO, or Uri_CREATE_ALLOW_RELATIVE and /// Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME. INET_E_SECURITY_PROBLEM is returned if the URI specifies userinfo but the /// Windows Internet Explorer feature control FEATURE_HTTP_USERNAME_PASSWORD_DISABLE is enabled. /// /// Hierarchical vs. Opaque Protocol Schemes /// /// Hierarchical URIs and opaque URIs are mutually exclusive. A hierarchical URI conforms to the RFC-defined syntax for URIs. (Refer /// to RFC3986: Uniform Resource Identifier (URI), Generic Syntax.) An opaque URI is parsed without an authority in the following manner. /// /// /// By default, all URIs are treated as hierarchical unless the Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES is set. (Unknown protocol /// schemes are those not defined in the URL_SCHEME enumeration.) The two flags Uri_CREATE_ALLOW_RELATIVE and /// Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME only apply if the string input is not an implicit file path or an absolute /// (hierarchical) URI. The syntax for relative URIs is a shortened form of the syntax for absolute URIs, where some prefix of the /// URI is missing and path segments ("." and "..") are allowed to remain until combined with a base URI. The wildcard URI scheme /// might be explicitly stated as "*:[[//]authority][path]," or implicitly stated by the "authority[path]" form. /// /// /// CreateUri can parse URIs in both the URL syntax and the Uniform Resource Name (URN) syntax. The difference between URLs /// and URNs is whether there is a protocol that enables access to the identified resource. Accessing the resource identified by an /// IUri is outside the scope of the Consolidated URL (cURL) API. /// /// Creating File Schemes from File Paths /// /// There are two kinds of file scheme URIs. The first is the well-formed, or "healthy," URL style that supports query strings, /// fragments, percent-encoded octets, and so on. The other is basically a DOS file path with "file://" prepended to the front. This /// latter form is generated when Uri_CREATE_FILE_USE_DOS_PATH is set and should be used only for legacy communication. /// /// /// Warning Legacy file scheme URIs should be used only with legacy APIs that will not accept healthy file scheme URIs. /// Legacy file scheme URIs do not allow percent encoded octets, which can lead to ambiguity. Therefore, legacy file scheme URIs /// should not be used unless absolutely necessary. /// /// The following is a comparison of the two forms of file scheme URIs. /// /// The Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME flag allows the creation of a file scheme URI from a Microsoft Win32 file path. /// It doesn't change the interpretation of the input string; that is, if a Win32 file path is passed in, CreateUri either /// succeeds or fails based on the Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME flag; it won't change the interpretation of the /// input string. /// /// Understanding Canonicalization /// Canonicalization, or conversion into the standard URI format, involves the following steps. /// /// The scheme is changed to lowercase. /// If the host is an IPv4 or IPv6 address, it is converted to normal form. /// /// If the host is a named host, it is changed to lowercase. Internationalized Domain Names (IDNs) with labels in Punycode are /// converted to Unicode. /// /// If the explicit port is the same as the default port for the scheme, it is removed. /// /// Backslash (\) characters in the path are changed to forward slash characters (/) in http, https, ftp, news, nntp, snews, and /// telnet schemes. /// /// If the URI has an authority but no path, the path is set to "/". /// Relative path segments "./" and "../" are removed, and the path is shortened as appropriate. /// Percent-encoded characters in the format "%XX," (where X is a hexadecimal digit) are decoded, if they are unreserved. /// /// Characters that are forbidden to appear in a URI are percent encoded. Forbidden characters are those that are neither in the /// "reserved" nor "unreserved" sets. The percent sign (%), which is used for percent encoding, is allowed. Refer to the following /// table for details. /// /// /// The following is a raw URI value. /// /// hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters /// /// After canonicalization, the absolute URI appears as follows. /// /// http://usEr%3Ainfo@example.com/path/a/Forbidden%60%3C%7C%3E%20Characters /// /// /// In the username component, the %45 is decoded to "E" because it is in the unreserved set, while the %3A (@) is not. - /// In the host component, the %4C is first decoded to "L," and then changed to lowercase. - /// The port "80" (the default port for http) is removed. - /// The "./" in the path is removed. - /// The "../" following the "c/" in the path is removed along with its logical parent, the "c/" path segment. - /// /// The %2E characters are in the unreserved set and are converted to "." forming "../". This new "../" is removed along with its /// logical parent path segment, which in this case is "b/." - /// /// /// All of the characters between "Forbidden" and "Characters" (including the space) are percent encoded because they are forbidden /// to appear in a URI. - /// /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775098(v%3Dvs.85) // STDAPI CreateUri( _In_ LPCWSTR pwzURI, _In_ DWORD dwFlags = Uri_CREATE_CANONICALIZE, _Reserved_ DWORD_PTR dwReserved, _Out_ IUri // **ppURI ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CreateUri([MarshalAs(UnmanagedType.LPWStr)] string pwzURI, Uri_CREATE dwFlags, [Optional] IntPtr dwReserved, out IUri ppURI); /// Converts an ANSI URL with components in various multibyte character set (MBCS) encodings to an IUri object. /// /// [in] /// A constant pointer to an ANSI character string that specifies the URI. /// /// /// [in] /// /// A valid combination of the following flags, which allows the caller to specify the encoding of all applicable components, except /// the scheme and the port. /// /// Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 (0x00000001) /// Default. The user info component and path component use percent encoded UTF-8. /// Uri_ENCODING_USER_INFO_AND_PATH_IS_CP (0x00000002) /// The user info component and path component use the codepage specified in dwCodePage. /// Uri_ENCODING_HOST_IS_IDN (0x00000004) /// Default. The host component uses IDN (Punycode) format. /// Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 (0x00000008) /// The host component uses percent encoded UTF-8. /// Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP (0x00000010) /// The host component uses the codepage specified in dwCodePage. /// Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 (0x00000020) /// Default. The query and fragment components use percent encoded UTF-8. /// Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP (0x00000040) /// The query and fragment components use the codepage specified in dwCodePage. /// Uri_ENCODING_RFC (0x00000025) /// /// The URI meets the requirements of RFC 3490. This flag combines the preceding default flags: Uri_ENCODING_HOST_IS_IDN, /// Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8, and Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8. /// /// /// /// [in] /// An unsigned long integer value that contains the codepage identifier value for the multibyte URI. /// /// /// [in] /// A valid combination of flags. Refer to CreateUri for a complete list of flags and values. /// /// /// [in] /// Reserved. Must be set to 0. /// /// /// [out] /// An IUri interface pointer that will receive the new instance. /// /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// E_INVALIDARG /// Flags conflict, or ppURI is NULL. /// /// /// E_OUTOFMEMORY /// There is insufficient memory to create the IUri. /// /// /// INET_E_INVALID_URL /// The string does not contain a recognized URI format. /// /// /// INET_E_SECURITY_PROBLEM /// The URI contains syntax that attempts to bypass security. /// /// /// /// /// /// This function fails with E_INVALIDARG, if the flags specified in dwEncodingFlags conflict. For example, if both /// Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 and Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP are set, this function will fail. /// /// /// The dwEncodingFlags for host are ignored if Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES is specified in dwCreateFlags. Use the /// encoding flags for userinfo and path instead. /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775099(v=vs.85) HRESULT // CreateUriFromMultiByteString( _In_ LPCSTR pszANSIInputUri, _In_ DWORD dwEncodingFlags = // Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8, _In_ DWORD dwCodePage, _In_ DWORD dwCreateFlags, _Reserved_ DWORD_PTR // dwReserved, _Out_ IUri **ppURI ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CreateUriFromMultiByteString([MarshalAs(UnmanagedType.LPStr)] string pszANSIInputUri, Uri_ENCODING dwEncodingFlags, uint dwCodePage, Uri_CREATE dwCreateFlags, [Optional] IntPtr dwReserved, out IUri ppURI); /// /// Creates a new IUri instance (and optional fragment), and initializes the instance from a Uniform Resource Identifier /// (URI) string. /// /// [in]A constant pointer to an UTF-8 character string that specifies the URI. /// [in]A constant pointer to a UTF-8 character string that specifies the explicit fragment, or NULL. /// [in]A valid combination of flags. Refer to CreateUri for a complete list of flags and values. /// [in]Reserved. Must be set to 0. /// [out]An IUri interface pointer that will receive the new instance. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// E_INVALIDARG /// dwFlags conflict, or ppURI is NULL. /// /// /// E_OUTOFMEMORY /// There is insufficient memory to create the IUri. /// /// /// INET_E_INVALID_URL /// The string does not contain a recognized URI format. /// /// /// INET_E_SECURITY_PROBLEM /// The URI contains syntax that attempts to bypass security. /// /// /// /// /// This function is identical to CreateUri, except that an explicit fragment can be specified. You cannot specify an /// explicit fragment and an implicit fragment in the URI; the function will fail with E_INVALIDARG. The explicit fragment can start /// with the delimiting "#," but it will be removed. /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775100(v=vs.85) STDAPI // CreateUriWithFragment( _In_ LPCWSTR pwzURI, _In_ LPCWSTR pwzFragment, _In_ DWORD dwFlags, _Reserved_ DWORD_PTR dwReserved, _Out_ // IUri **ppURI ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CreateUriWithFragment([MarshalAs(UnmanagedType.LPWStr)] string pwzURI, [MarshalAs(UnmanagedType.LPWStr)] string pwzFragment, Uri_CREATE dwFlags, [Optional] IntPtr dwReserved, out IUri ppURI); /// Deprecated in Windows Internet Explorer 7. Use CreateURLMonikerEx instead. /// /// [in]The address of the IMoniker interface for the URL moniker to use as the base context when the szURL parameter is a partial /// URL string. The pMkCtx parameter can be NULL. /// /// [in]The address of a string value that contains the display name to be parsed. /// [out]Pointer to an IMoniker interface for the new URL moniker. /// /// Returns one of the following values. /// /// /// Return code /// Description /// /// /// S_OK /// Success. /// /// /// E_OUTOFMEMORY /// The operation ran out of memory. /// /// /// MK_E_SYNTAX /// /// A moniker cannot be created because szURL does not correspond to valid URL syntax for a full or partial URL. This is uncommon, /// because most parsing of the URL occurs during binding, and the syntax for URLs is extremely flexible. /// /// /// /// /// /// /// The CreateURLMoniker function creates a URL moniker from a full URL string, or from a base context URL moniker and a /// partial URL string. /// /// /// Security Warning: This function does not correctly interpret percent encoded octets in Windows file paths or "file://" /// scheme Uniform Resource Identifiers (URIs). On systems with Microsoft Internet Explorer 6 and earlier, calling /// CreateURLMoniker with the output of a previous call might produce a result that is not equivalent. Since /// CreateURLMoniker can produce results that are not equivalent to the input, its use can result in security problems. /// /// /// Use CreateURLMonikerEx with the URL_MK_UNIFORM flag to ensure that Windows file paths and "file://" URIs are /// interpreted correctly with regard to percent encoded octets; and that the result is equivalent to the input. To correctly /// extract a Windows file path from the result of CreateURLMoniker, use the PathCreateFromUrl function. /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775102(v=vs.85) HRESULT // CreateURLMoniker( _In_ IMoniker *pMkCtx, _In_ LPCWSTR szURL, _Out_ IMoniker **ppmk ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h"), Obsolete("Use CreateURLMonikerEx.")] public static extern HRESULT CreateURLMoniker([In, Optional] IMoniker pMkCtx, [MarshalAs(UnmanagedType.LPWStr)] string szURL, out IMoniker ppmk); /// Creates a URL moniker from a full URL, or from a base context URL moniker and a partial URL. /// /// A pointer to an IMoniker interface of the URL moniker to use as the base context when the szURL parameter is a partial URL /// string. The pMkCtx parameter can be NULL. /// /// A string value that contains the URL to be parsed. /// A pointer to an IMoniker interface for the new URL moniker. /// /// A DWORD value that specifies which URL parser to use. This can be one of the following values. /// URL_MK_LEGACY /// Use the same URL parser as CreateURLMoniker. /// URL_MK_UNIFORM /// Use the updated URL parser. /// /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// /// Use CreateURLMonikerEx with the URL_MK_UNIFORM flag to ensure that a Windows file path and "file://" Uniform /// Resource Identifier (URI) is interpreted correctly with regard to percent encoded octets, and that the result is equivalent to /// the input. To correctly extract a Windows file path from the result of CreateURLMonikerEx, use PathCreateFromUrl. /// /// /// For compatibility reasons, it might be possible to create a URL moniker from an invalid URL; however, such a base moniker cannot /// be combined with a relative URL. Any attempt to do so will fail with E_INVALIDARG. /// /// // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775103(v=vs.85) HRESULT // CreateURLMonikerEx( IMoniker *pMkCtx, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags ); [DllImport(Lib.UrlMon, SetLastError = false, ExactSpelling = true)] [PInvokeData("Urlmon.h")] public static extern HRESULT CreateURLMonikerEx([In, Optional] 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([In, Optional] 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, Optional] IBindCtx pBC, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, IntPtr pBuffer, uint cbSize, [MarshalAs(UnmanagedType.LPWStr)] string pwzMimeProposed, FMFD dwMimeFlags, [MarshalAs(UnmanagedType.LPWStr)] out string 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. /// /// /// The size of this 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 writing 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/ms774966%28v%3dvs.85%29 // typedef struct _tagBINDINFO { unsigned long cbSize; LPWSTR szExtraInfo; STGMEDIUM stgmedData; DWORD grfBindInfoF; DWORD // dwBindVerb; LPWSTR szCustomVerb; DWORD cbStgmedData; DWORD dwOptions; DWORD dwOptionsFlags; DWORD dwCodePage; SECURITY_ATTRIBUTES // securityAttributes; IID iid; IUnknown *pUnk; DWORD dwReserved; } BINDINFO; [PInvokeData("Urlmon.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct BINDINFO { /// Size of the structure, in bytes. public uint cbSize; /// /// Behavior of this field is moniker-specific. For URL monikers, this string is appended to the URL when the bind operation is /// started. Like other OLE strings, this value is a Unicode string that the client should allocate using CoTaskMemAlloc. The /// URL moniker frees the memory later. /// [MarshalAs(UnmanagedType.LPWStr)] public string szExtraInfo; /// Data to be used in a PUT or POST operation specified by the dwBindVerb member. public STGMEDIUM stgmedData; /// /// Flag from the BINDINFOF enumeration that determines the use of URL encoding during the bind operation. This member is /// specific to URL monikers. /// public uint grfBindInfoF; /// Value from the BINDVERB enumeration specifying an action to be performed during the bind operation. public uint dwBindVerb; /// /// specifying a protocol-specific custom action to be performed during the bind operation (only if dwBindVerb is set to BINDVERB_CUSTOM). /// [MarshalAs(UnmanagedType.LPWStr)] public string szCustomVerb; /// Size of the data provided in the stgmedData member. public uint cbStgmedData; /// Value from the BINDINFO_OPTIONS enumeration specifying flags for the bind operation. public uint dwOptions; /// Additional Win32 Internet API flags. Must also set BINDINFO_OPTIONS_WININETFLAG in dwOptions. public uint dwOptionsFlags; /// /// Unsigned long integer value that contains the code page used to perform the conversion. This can be one of the following values: /// public uint dwCodePage; /// /// SECURITY_ATTRIBUTES structure that contains the descriptor for the object being bound to and indicates whether the handle /// retrieved by specifying this structure is inheritable. /// public tagSECURITY_ATTRIBUTES securityAttributes; /// Interface identifier of the IUnknown interface referred to by pUnk. public Guid iid; /// Pointer to the IUnknown interface. public IntPtr pUnk; /// Reserved. Must be zero. public uint dwReserved; /// 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 }; } } }