mirror of https://github.com/dahall/Vanara.git
Updated WinHTTP for usability
parent
459e14f224
commit
f12deb2ec2
|
@ -1268,7 +1268,7 @@ namespace Vanara.PInvoke
|
|||
// https://docs.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpsetoption BOOL WinHttpSetOption( [in] HINTERNET
|
||||
// hInternet, [in] DWORD dwOption, [in] LPVOID lpBuffer, [in] DWORD dwBufferLength );
|
||||
[PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpSetOption")]
|
||||
public static bool WinHttpSetOption<T>(HINTERNET hInternet, WINHTTP_OPTION dwOption, T value) where T : struct
|
||||
public static bool WinHttpSetOption<T>(HINTERNET hInternet, WINHTTP_OPTION dwOption, in T value) where T : struct
|
||||
{
|
||||
using var mem = SafeHGlobalHandle.CreateFromStructure(value);
|
||||
return WinHttpSetOption(hInternet, dwOption, mem, mem.Size);
|
||||
|
|
|
@ -736,6 +736,65 @@ namespace Vanara.PInvoke
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>The <c>WINHTTP_PROXY_INFO</c> structure contains the session or default proxy configuration.</summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This structure is used with WinHttpSetOption and WinHttpQueryOption to get or set the proxy configuration for the current session
|
||||
/// by specifying the WINHTTP_OPTION_PROXY flag.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This structure is used with WinHttpSetDefaultProxyConfiguration and WinHttpGetDefaultProxyConfiguration to get or set the default
|
||||
/// proxy configuration in the registry.
|
||||
/// </para>
|
||||
/// <para>The proxy server list contains one or more of the following strings separated by semicolons or whitespace.</para>
|
||||
/// <para>
|
||||
/// <code>([<scheme>=][<scheme>"://"]<server>[":"<port>])</code>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The proxy bypass list contains one or more server names separated by semicolons or whitespace. The proxy bypass list can also
|
||||
/// contain the string "<local>" to indicate that all local intranet sites are bypassed. Local intranet sites are considered to
|
||||
/// be all servers that do not contain a period in their name.
|
||||
/// </para>
|
||||
/// <para><c>Note</c> For Windows XP and Windows 2000, see the Run-Time Requirements section of the WinHttp start page.</para>
|
||||
/// </remarks>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ns-winhttp-winhttp_proxy_info typedef struct _WINHTTP_PROXY_INFO {
|
||||
// DWORD dwAccessType; LPWSTR lpszProxy; LPWSTR lpszProxyBypass; } WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO, *PWINHTTP_PROXY_INFO;
|
||||
[PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp._WINHTTP_PROXY_INFO")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct WINHTTP_PROXY_INFO_IN
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Unsigned long integer value that contains the access type. This can be one of the following values:</para>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Value</term>
|
||||
/// <term>Meaning</term>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term><c>WINHTTP_ACCESS_TYPE_NO_PROXY</c></term>
|
||||
/// <term>Internet accessed through a direct connection.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term><c>WINHTTP_ACCESS_TYPE_DEFAULT_PROXY</c></term>
|
||||
/// <term>Applies only when setting proxy information.</term>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term><c>WINHTTP_ACCESS_TYPE_NAMED_PROXY</c></term>
|
||||
/// <term>Internet accessed using a proxy.</term>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
public WINHTTP_ACCESS_TYPE dwAccessType;
|
||||
|
||||
/// <summary>Pointer to a string value that contains the proxy server list.</summary>
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string lpszProxy;
|
||||
|
||||
/// <summary>Pointer to a string value that contains the proxy bypass list.</summary>
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string lpszProxyBypass;
|
||||
}
|
||||
|
||||
/// <summary>The <c>WINHTTP_PROXY_RESULT</c> structure contains collection of proxy result entries provided by WinHttpGetProxyResult.</summary>
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ns-winhttp-winhttp_proxy_result typedef struct _WINHTTP_PROXY_RESULT {
|
||||
// DWORD cEntries; WINHTTP_PROXY_RESULT_ENTRY *pEntries; } WINHTTP_PROXY_RESULT;
|
||||
|
|
|
@ -1416,7 +1416,8 @@ namespace Vanara.PInvoke
|
|||
/// structure (if they are non-NULL) using the GlobalFree function. An application can query for the global proxy data (the
|
||||
/// default proxy) by passing a NULL handle.
|
||||
/// </summary>
|
||||
[CorrespondingType(typeof(WINHTTP_PROXY_INFO))]
|
||||
[CorrespondingType(typeof(WINHTTP_PROXY_INFO), CorrespondingAction.Get)]
|
||||
[CorrespondingType(typeof(WINHTTP_PROXY_INFO_IN), CorrespondingAction.Set)]
|
||||
WINHTTP_OPTION_PROXY = 38,
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
|
@ -1432,7 +1433,7 @@ namespace Vanara.PInvoke
|
|||
WINHTTP_OPTION_PROXY_PASSWORD = 0x1003,
|
||||
|
||||
/// <summary>Undocumented.</summary>
|
||||
[CorrespondingType(typeof(uint), CorrespondingAction.Set)]
|
||||
[CorrespondingType(typeof(WINHTTP_PROXY_RESULT_ENTRY), CorrespondingAction.Set)]
|
||||
WINHTTP_OPTION_PROXY_RESULT_ENTRY = 39,
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue