ホーム › Networking.WinHttp › WINHTTP_CREDS_EX
WINHTTP_CREDS_EX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lpszUserName | LPSTR | 8/4 | +0 | +0 | 認証に用いるユーザー名のANSI文字列。 |
| lpszPassword | LPSTR | 8/4 | +8 | +4 | 認証に用いるパスワードのANSI文字列。 |
| lpszRealm | LPSTR | 8/4 | +16 | +8 | 認証レルム(領域)のANSI文字列。NULL可。 |
| dwAuthScheme | WINHTTP_CREDS_AUTHSCHEME | 4 | +24 | +12 | 使用する認証スキームを示す列挙値(Basic/NTLM/Negotiate等)。 |
| lpszHostName | LPSTR | 8/4 | +32 | +16 | 認証対象ホスト名のANSI文字列。 |
| dwPort | DWORD | 4 | +40 | +20 | 認証対象ホストのポート番号。 |
| lpszUrl | LPSTR | 8/4 | +48 | +24 | 認証対象のURL文字列(ANSI)。拡張版で追加された対象URL指定。 |
各言語での定義
#include <windows.h>
// WINHTTP_CREDS_EX (x64 56 / x86 28 バイト)
typedef struct WINHTTP_CREDS_EX {
LPSTR lpszUserName;
LPSTR lpszPassword;
LPSTR lpszRealm;
WINHTTP_CREDS_AUTHSCHEME dwAuthScheme;
LPSTR lpszHostName;
DWORD dwPort;
LPSTR lpszUrl;
} WINHTTP_CREDS_EX;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WINHTTP_CREDS_EX
{
public IntPtr lpszUserName;
public IntPtr lpszPassword;
public IntPtr lpszRealm;
public uint dwAuthScheme;
public IntPtr lpszHostName;
public uint dwPort;
public IntPtr lpszUrl;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WINHTTP_CREDS_EX
Public lpszUserName As IntPtr
Public lpszPassword As IntPtr
Public lpszRealm As IntPtr
Public dwAuthScheme As UInteger
Public lpszHostName As IntPtr
Public dwPort As UInteger
Public lpszUrl As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class WINHTTP_CREDS_EX(ctypes.Structure):
_fields_ = [
("lpszUserName", ctypes.c_void_p),
("lpszPassword", ctypes.c_void_p),
("lpszRealm", ctypes.c_void_p),
("dwAuthScheme", wintypes.DWORD),
("lpszHostName", ctypes.c_void_p),
("dwPort", wintypes.DWORD),
("lpszUrl", ctypes.c_void_p),
]#[repr(C)]
pub struct WINHTTP_CREDS_EX {
pub lpszUserName: *mut core::ffi::c_void,
pub lpszPassword: *mut core::ffi::c_void,
pub lpszRealm: *mut core::ffi::c_void,
pub dwAuthScheme: u32,
pub lpszHostName: *mut core::ffi::c_void,
pub dwPort: u32,
pub lpszUrl: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type WINHTTP_CREDS_EX struct {
lpszUserName uintptr
lpszPassword uintptr
lpszRealm uintptr
dwAuthScheme uint32
lpszHostName uintptr
dwPort uint32
lpszUrl uintptr
}type
WINHTTP_CREDS_EX = record
lpszUserName: Pointer;
lpszPassword: Pointer;
lpszRealm: Pointer;
dwAuthScheme: DWORD;
lpszHostName: Pointer;
dwPort: DWORD;
lpszUrl: Pointer;
end;const WINHTTP_CREDS_EX = extern struct {
lpszUserName: ?*anyopaque,
lpszPassword: ?*anyopaque,
lpszRealm: ?*anyopaque,
dwAuthScheme: u32,
lpszHostName: ?*anyopaque,
dwPort: u32,
lpszUrl: ?*anyopaque,
};type
WINHTTP_CREDS_EX {.bycopy.} = object
lpszUserName: pointer
lpszPassword: pointer
lpszRealm: pointer
dwAuthScheme: uint32
lpszHostName: pointer
dwPort: uint32
lpszUrl: pointerstruct WINHTTP_CREDS_EX
{
void* lpszUserName;
void* lpszPassword;
void* lpszRealm;
uint dwAuthScheme;
void* lpszHostName;
uint dwPort;
void* lpszUrl;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WINHTTP_CREDS_EX サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; lpszUserName : LPSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lpszPassword : LPSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; lpszRealm : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwAuthScheme : WINHTTP_CREDS_AUTHSCHEME (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpszHostName : LPSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwPort : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lpszUrl : LPSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINHTTP_CREDS_EX サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; lpszUserName : LPSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; lpszPassword : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; lpszRealm : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwAuthScheme : WINHTTP_CREDS_AUTHSCHEME (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; lpszHostName : LPSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; dwPort : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; lpszUrl : LPSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WINHTTP_CREDS_EX
#field intptr lpszUserName
#field intptr lpszPassword
#field intptr lpszRealm
#field int dwAuthScheme
#field intptr lpszHostName
#field int dwPort
#field intptr lpszUrl
#endstruct
stdim st, WINHTTP_CREDS_EX ; NSTRUCT 変数を確保
st->dwAuthScheme = 100
mes "dwAuthScheme=" + st->dwAuthScheme