Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › SCH_CREDENTIALS

SCH_CREDENTIALS

構造体
サイズx64: 72 バイト / x86: 44 バイト

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0この構造体のバージョン。SCH_CREDENTIALS_VERSIONを設定する。
dwCredFormatDWORD4+4+4資格情報の形式を示す値。
cCredsDWORD4+8+8paCred配列内の証明書の個数を示す。
paCredCERT_CONTEXT**8/4+16+12使用する証明書コンテキストの配列へのポインタ。
hRootStoreHCERTSTORE8/4+24+16ルート証明書ストアのハンドル。NULL可。
cMappersDWORD4+32+20aphMappers配列のマッパー個数を示す。
aphMappers_HMAPPER**8/4+40+24資格情報マッパーの配列へのポインタ。
dwSessionLifespanDWORD4+48+28セッションキャッシュの有効期間をミリ秒で示す。0で既定。
dwFlagsDWORD4+52+32Schannel資格情報の動作を制御するフラグ群。
cTlsParametersDWORD4+56+36pTlsParameters配列の要素数を示す。
pTlsParametersTLS_PARAMETERS*8/4+64+40TLSパラメータ(TLS_PARAMETERS)配列へのポインタ。

各言語での定義

#include <windows.h>

// SCH_CREDENTIALS  (x64 72 / x86 44 バイト)
typedef struct SCH_CREDENTIALS {
    DWORD dwVersion;
    DWORD dwCredFormat;
    DWORD cCreds;
    CERT_CONTEXT** paCred;
    HCERTSTORE hRootStore;
    DWORD cMappers;
    _HMAPPER** aphMappers;
    DWORD dwSessionLifespan;
    DWORD dwFlags;
    DWORD cTlsParameters;
    TLS_PARAMETERS* pTlsParameters;
} SCH_CREDENTIALS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCH_CREDENTIALS
{
    public uint dwVersion;
    public uint dwCredFormat;
    public uint cCreds;
    public IntPtr paCred;
    public IntPtr hRootStore;
    public uint cMappers;
    public IntPtr aphMappers;
    public uint dwSessionLifespan;
    public uint dwFlags;
    public uint cTlsParameters;
    public IntPtr pTlsParameters;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCH_CREDENTIALS
    Public dwVersion As UInteger
    Public dwCredFormat As UInteger
    Public cCreds As UInteger
    Public paCred As IntPtr
    Public hRootStore As IntPtr
    Public cMappers As UInteger
    Public aphMappers As IntPtr
    Public dwSessionLifespan As UInteger
    Public dwFlags As UInteger
    Public cTlsParameters As UInteger
    Public pTlsParameters As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SCH_CREDENTIALS(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("dwCredFormat", wintypes.DWORD),
        ("cCreds", wintypes.DWORD),
        ("paCred", ctypes.c_void_p),
        ("hRootStore", ctypes.c_void_p),
        ("cMappers", wintypes.DWORD),
        ("aphMappers", ctypes.c_void_p),
        ("dwSessionLifespan", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("cTlsParameters", wintypes.DWORD),
        ("pTlsParameters", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SCH_CREDENTIALS {
    pub dwVersion: u32,
    pub dwCredFormat: u32,
    pub cCreds: u32,
    pub paCred: *mut core::ffi::c_void,
    pub hRootStore: *mut core::ffi::c_void,
    pub cMappers: u32,
    pub aphMappers: *mut core::ffi::c_void,
    pub dwSessionLifespan: u32,
    pub dwFlags: u32,
    pub cTlsParameters: u32,
    pub pTlsParameters: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SCH_CREDENTIALS struct {
	dwVersion uint32
	dwCredFormat uint32
	cCreds uint32
	paCred uintptr
	hRootStore uintptr
	cMappers uint32
	aphMappers uintptr
	dwSessionLifespan uint32
	dwFlags uint32
	cTlsParameters uint32
	pTlsParameters uintptr
}
type
  SCH_CREDENTIALS = record
    dwVersion: DWORD;
    dwCredFormat: DWORD;
    cCreds: DWORD;
    paCred: Pointer;
    hRootStore: Pointer;
    cMappers: DWORD;
    aphMappers: Pointer;
    dwSessionLifespan: DWORD;
    dwFlags: DWORD;
    cTlsParameters: DWORD;
    pTlsParameters: Pointer;
  end;
const SCH_CREDENTIALS = extern struct {
    dwVersion: u32,
    dwCredFormat: u32,
    cCreds: u32,
    paCred: ?*anyopaque,
    hRootStore: ?*anyopaque,
    cMappers: u32,
    aphMappers: ?*anyopaque,
    dwSessionLifespan: u32,
    dwFlags: u32,
    cTlsParameters: u32,
    pTlsParameters: ?*anyopaque,
};
type
  SCH_CREDENTIALS {.bycopy.} = object
    dwVersion: uint32
    dwCredFormat: uint32
    cCreds: uint32
    paCred: pointer
    hRootStore: pointer
    cMappers: uint32
    aphMappers: pointer
    dwSessionLifespan: uint32
    dwFlags: uint32
    cTlsParameters: uint32
    pTlsParameters: pointer
struct SCH_CREDENTIALS
{
    uint dwVersion;
    uint dwCredFormat;
    uint cCreds;
    void* paCred;
    void* hRootStore;
    uint cMappers;
    void* aphMappers;
    uint dwSessionLifespan;
    uint dwFlags;
    uint cTlsParameters;
    void* pTlsParameters;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SCH_CREDENTIALS サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwCredFormat : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cCreds : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; paCred : CERT_CONTEXT** (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; hRootStore : HCERTSTORE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; cMappers : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; aphMappers : _HMAPPER** (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwSessionLifespan : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwFlags : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; cTlsParameters : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; pTlsParameters : TLS_PARAMETERS* (+40, 4byte)  varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCH_CREDENTIALS サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwCredFormat : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cCreds : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; paCred : CERT_CONTEXT** (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; hRootStore : HCERTSTORE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cMappers : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; aphMappers : _HMAPPER** (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dwSessionLifespan : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwFlags : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; cTlsParameters : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; pTlsParameters : TLS_PARAMETERS* (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SCH_CREDENTIALS
    #field int dwVersion
    #field int dwCredFormat
    #field int cCreds
    #field intptr paCred
    #field intptr hRootStore
    #field int cMappers
    #field intptr aphMappers
    #field int dwSessionLifespan
    #field int dwFlags
    #field int cTlsParameters
    #field intptr pTlsParameters
#endstruct

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