Win32 API 日本語リファレンス
ホームNetworking.WinHttp › WINHTTP_PROXY_SETTINGS_EX

WINHTTP_PROXY_SETTINGS_EX

構造体
サイズx64: 64 バイト / x86: 44 バイトパッキング4

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ullGenerationIdULONGLONG8+0+0プロキシ設定の世代ID。設定更新を検出する単調増加値。
ullFlagsULONGLONG8+8+8プロキシ設定の種類や状態を示すフラグビット。
pcwszAutoconfigUrlLPWSTR8/4+16+16自動構成スクリプト(PAC)のURL文字列。NULL可。
pcwszProxyLPWSTR8/4+24+20使用するプロキシサーバーのアドレス文字列。NULL可。
pcwszSecureProxyLPWSTR8/4+32+24HTTPS用のセキュアプロキシアドレス文字列。NULL可。
cProxyBypassesDWORD4+40+28rgpcwszProxyBypasses配列の要素数。
rgpcwszProxyBypassesLPWSTR*8/4+44+32プロキシをバイパスするホスト名/パターンの文字列配列へのポインタ。
dwInterfaceIndexDWORD4+52+36この設定が適用されるネットワークインターフェイスのインデックス。
pcwszConnectionNameLPWSTR8/4+56+40対象とする接続の名前文字列。NULLで既定の接続を指す。

各言語での定義

#include <windows.h>

// WINHTTP_PROXY_SETTINGS_EX  (x64 64 / x86 44 バイト)
#pragma pack(push, 4)
typedef struct WINHTTP_PROXY_SETTINGS_EX {
    ULONGLONG ullGenerationId;
    ULONGLONG ullFlags;
    LPWSTR pcwszAutoconfigUrl;
    LPWSTR pcwszProxy;
    LPWSTR pcwszSecureProxy;
    DWORD cProxyBypasses;
    LPWSTR* rgpcwszProxyBypasses;
    DWORD dwInterfaceIndex;
    LPWSTR pcwszConnectionName;
} WINHTTP_PROXY_SETTINGS_EX;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct WINHTTP_PROXY_SETTINGS_EX
{
    public ulong ullGenerationId;
    public ulong ullFlags;
    public IntPtr pcwszAutoconfigUrl;
    public IntPtr pcwszProxy;
    public IntPtr pcwszSecureProxy;
    public uint cProxyBypasses;
    public IntPtr rgpcwszProxyBypasses;
    public uint dwInterfaceIndex;
    public IntPtr pcwszConnectionName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure WINHTTP_PROXY_SETTINGS_EX
    Public ullGenerationId As ULong
    Public ullFlags As ULong
    Public pcwszAutoconfigUrl As IntPtr
    Public pcwszProxy As IntPtr
    Public pcwszSecureProxy As IntPtr
    Public cProxyBypasses As UInteger
    Public rgpcwszProxyBypasses As IntPtr
    Public dwInterfaceIndex As UInteger
    Public pcwszConnectionName As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class WINHTTP_PROXY_SETTINGS_EX(ctypes.Structure):
    _pack_ = 4
    _fields_ = [
        ("ullGenerationId", ctypes.c_ulonglong),
        ("ullFlags", ctypes.c_ulonglong),
        ("pcwszAutoconfigUrl", ctypes.c_void_p),
        ("pcwszProxy", ctypes.c_void_p),
        ("pcwszSecureProxy", ctypes.c_void_p),
        ("cProxyBypasses", wintypes.DWORD),
        ("rgpcwszProxyBypasses", ctypes.c_void_p),
        ("dwInterfaceIndex", wintypes.DWORD),
        ("pcwszConnectionName", ctypes.c_void_p),
    ]
#[repr(C, packed(4))]
pub struct WINHTTP_PROXY_SETTINGS_EX {
    pub ullGenerationId: u64,
    pub ullFlags: u64,
    pub pcwszAutoconfigUrl: *mut core::ffi::c_void,
    pub pcwszProxy: *mut core::ffi::c_void,
    pub pcwszSecureProxy: *mut core::ffi::c_void,
    pub cProxyBypasses: u32,
    pub rgpcwszProxyBypasses: *mut core::ffi::c_void,
    pub dwInterfaceIndex: u32,
    pub pcwszConnectionName: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type WINHTTP_PROXY_SETTINGS_EX struct {
	ullGenerationId uint64
	ullFlags uint64
	pcwszAutoconfigUrl uintptr
	pcwszProxy uintptr
	pcwszSecureProxy uintptr
	cProxyBypasses uint32
	rgpcwszProxyBypasses uintptr
	dwInterfaceIndex uint32
	pcwszConnectionName uintptr
}
type
  WINHTTP_PROXY_SETTINGS_EX = packed record
    ullGenerationId: UInt64;
    ullFlags: UInt64;
    pcwszAutoconfigUrl: Pointer;
    pcwszProxy: Pointer;
    pcwszSecureProxy: Pointer;
    cProxyBypasses: DWORD;
    rgpcwszProxyBypasses: Pointer;
    dwInterfaceIndex: DWORD;
    pcwszConnectionName: Pointer;
  end;
const WINHTTP_PROXY_SETTINGS_EX = extern struct {
    ullGenerationId: u64,
    ullFlags: u64,
    pcwszAutoconfigUrl: ?*anyopaque,
    pcwszProxy: ?*anyopaque,
    pcwszSecureProxy: ?*anyopaque,
    cProxyBypasses: u32,
    rgpcwszProxyBypasses: ?*anyopaque,
    dwInterfaceIndex: u32,
    pcwszConnectionName: ?*anyopaque,
};
type
  WINHTTP_PROXY_SETTINGS_EX {.packed.} = object
    ullGenerationId: uint64
    ullFlags: uint64
    pcwszAutoconfigUrl: pointer
    pcwszProxy: pointer
    pcwszSecureProxy: pointer
    cProxyBypasses: uint32
    rgpcwszProxyBypasses: pointer
    dwInterfaceIndex: uint32
    pcwszConnectionName: pointer
align(4)
struct WINHTTP_PROXY_SETTINGS_EX
{
    ulong ullGenerationId;
    ulong ullFlags;
    void* pcwszAutoconfigUrl;
    void* pcwszProxy;
    void* pcwszSecureProxy;
    uint cProxyBypasses;
    void* rgpcwszProxyBypasses;
    uint dwInterfaceIndex;
    void* pcwszConnectionName;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WINHTTP_PROXY_SETTINGS_EX サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; ullGenerationId : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ullFlags : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pcwszAutoconfigUrl : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pcwszProxy : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; pcwszSecureProxy : LPWSTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; cProxyBypasses : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; rgpcwszProxyBypasses : LPWSTR* (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwInterfaceIndex : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; pcwszConnectionName : LPWSTR (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINHTTP_PROXY_SETTINGS_EX サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; ullGenerationId : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ullFlags : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pcwszAutoconfigUrl : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pcwszProxy : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pcwszSecureProxy : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; cProxyBypasses : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; rgpcwszProxyBypasses : LPWSTR* (+44, 8byte)  qpoke st,44,値 / qpeek(st,44)  ※IronHSPのみ。3.7/3.8は lpoke st,44,下位 : lpoke st,48,上位
; dwInterfaceIndex : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; pcwszConnectionName : LPWSTR (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WINHTTP_PROXY_SETTINGS_EX, pack=4
    #field int64 ullGenerationId
    #field int64 ullFlags
    #field intptr pcwszAutoconfigUrl
    #field intptr pcwszProxy
    #field intptr pcwszSecureProxy
    #field int cProxyBypasses
    #field intptr rgpcwszProxyBypasses
    #field int dwInterfaceIndex
    #field intptr pcwszConnectionName
#endstruct

stdim st, WINHTTP_PROXY_SETTINGS_EX        ; NSTRUCT 変数を確保
st->ullGenerationId = 100
mes "ullGenerationId=" + st->ullGenerationId