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

WS_CUSTOM_CERT_CREDENTIAL

構造体
サイズx64: 40 バイト / x86: 20 バイト

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

フィールド

フィールドサイズx64x86説明
credentialWS_CERT_CREDENTIAL4+0+0基底の証明書資格情報構造体。種別はカスタム取得を示す。
getCertCallbackWS_GET_CERT_CALLBACK8/4+8+4使用する証明書を動的に取得するコールバック関数。
getCertCallbackStatevoid*8/4+16+8getCertCallbackへ渡されるユーザー定義の状態ポインタ。NULL可。
certIssuerListNotificationCallbackWS_CERT_ISSUER_LIST_NOTIFICATION_CALLBACK8/4+24+12サーバーが要求する証明書発行者一覧を通知するコールバック関数。
certIssuerListNotificationCallbackStatevoid*8/4+32+16発行者一覧通知コールバックへ渡される状態ポインタ。NULL可。

各言語での定義

#include <windows.h>

// WS_CERT_CREDENTIAL  (x64 4 / x86 4 バイト)
typedef struct WS_CERT_CREDENTIAL {
    WS_CERT_CREDENTIAL_TYPE credentialType;
} WS_CERT_CREDENTIAL;

// WS_CUSTOM_CERT_CREDENTIAL  (x64 40 / x86 20 バイト)
typedef struct WS_CUSTOM_CERT_CREDENTIAL {
    WS_CERT_CREDENTIAL credential;
    WS_GET_CERT_CALLBACK getCertCallback;
    void* getCertCallbackState;
    WS_CERT_ISSUER_LIST_NOTIFICATION_CALLBACK certIssuerListNotificationCallback;
    void* certIssuerListNotificationCallbackState;
} WS_CUSTOM_CERT_CREDENTIAL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_CERT_CREDENTIAL
{
    public int credentialType;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_CUSTOM_CERT_CREDENTIAL
{
    public WS_CERT_CREDENTIAL credential;
    public IntPtr getCertCallback;
    public IntPtr getCertCallbackState;
    public IntPtr certIssuerListNotificationCallback;
    public IntPtr certIssuerListNotificationCallbackState;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_CERT_CREDENTIAL
    Public credentialType As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_CUSTOM_CERT_CREDENTIAL
    Public credential As WS_CERT_CREDENTIAL
    Public getCertCallback As IntPtr
    Public getCertCallbackState As IntPtr
    Public certIssuerListNotificationCallback As IntPtr
    Public certIssuerListNotificationCallbackState As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class WS_CERT_CREDENTIAL(ctypes.Structure):
    _fields_ = [
        ("credentialType", ctypes.c_int),
    ]

class WS_CUSTOM_CERT_CREDENTIAL(ctypes.Structure):
    _fields_ = [
        ("credential", WS_CERT_CREDENTIAL),
        ("getCertCallback", ctypes.c_void_p),
        ("getCertCallbackState", ctypes.c_void_p),
        ("certIssuerListNotificationCallback", ctypes.c_void_p),
        ("certIssuerListNotificationCallbackState", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct WS_CERT_CREDENTIAL {
    pub credentialType: i32,
}

#[repr(C)]
pub struct WS_CUSTOM_CERT_CREDENTIAL {
    pub credential: WS_CERT_CREDENTIAL,
    pub getCertCallback: *mut core::ffi::c_void,
    pub getCertCallbackState: *mut core::ffi::c_void,
    pub certIssuerListNotificationCallback: *mut core::ffi::c_void,
    pub certIssuerListNotificationCallbackState: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type WS_CERT_CREDENTIAL struct {
	credentialType int32
}

type WS_CUSTOM_CERT_CREDENTIAL struct {
	credential WS_CERT_CREDENTIAL
	getCertCallback uintptr
	getCertCallbackState uintptr
	certIssuerListNotificationCallback uintptr
	certIssuerListNotificationCallbackState uintptr
}
type
  WS_CERT_CREDENTIAL = record
    credentialType: Integer;
  end;

  WS_CUSTOM_CERT_CREDENTIAL = record
    credential: WS_CERT_CREDENTIAL;
    getCertCallback: Pointer;
    getCertCallbackState: Pointer;
    certIssuerListNotificationCallback: Pointer;
    certIssuerListNotificationCallbackState: Pointer;
  end;
const WS_CERT_CREDENTIAL = extern struct {
    credentialType: i32,
};

const WS_CUSTOM_CERT_CREDENTIAL = extern struct {
    credential: WS_CERT_CREDENTIAL,
    getCertCallback: ?*anyopaque,
    getCertCallbackState: ?*anyopaque,
    certIssuerListNotificationCallback: ?*anyopaque,
    certIssuerListNotificationCallbackState: ?*anyopaque,
};
type
  WS_CERT_CREDENTIAL {.bycopy.} = object
    credentialType: int32

  WS_CUSTOM_CERT_CREDENTIAL {.bycopy.} = object
    credential: WS_CERT_CREDENTIAL
    getCertCallback: pointer
    getCertCallbackState: pointer
    certIssuerListNotificationCallback: pointer
    certIssuerListNotificationCallbackState: pointer
struct WS_CERT_CREDENTIAL
{
    int credentialType;
}

struct WS_CUSTOM_CERT_CREDENTIAL
{
    WS_CERT_CREDENTIAL credential;
    void* getCertCallback;
    void* getCertCallbackState;
    void* certIssuerListNotificationCallback;
    void* certIssuerListNotificationCallbackState;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WS_CUSTOM_CERT_CREDENTIAL サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; credential : WS_CERT_CREDENTIAL (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; getCertCallback : WS_GET_CERT_CALLBACK (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; getCertCallbackState : void* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; certIssuerListNotificationCallback : WS_CERT_ISSUER_LIST_NOTIFICATION_CALLBACK (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; certIssuerListNotificationCallbackState : void* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_CUSTOM_CERT_CREDENTIAL サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; credential : WS_CERT_CREDENTIAL (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; getCertCallback : WS_GET_CERT_CALLBACK (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; getCertCallbackState : void* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; certIssuerListNotificationCallback : WS_CERT_ISSUER_LIST_NOTIFICATION_CALLBACK (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; certIssuerListNotificationCallbackState : void* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WS_CERT_CREDENTIAL
    #field int credentialType
#endstruct

#defstruct global WS_CUSTOM_CERT_CREDENTIAL
    #field WS_CERT_CREDENTIAL credential
    #field intptr getCertCallback
    #field intptr getCertCallbackState
    #field intptr certIssuerListNotificationCallback
    #field intptr certIssuerListNotificationCallbackState
#endstruct

stdim st, WS_CUSTOM_CERT_CREDENTIAL        ; NSTRUCT 変数を確保