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

SecPkgContext_ConnectionInfoEx

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

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0この構造体のバージョン番号を示す。
dwProtocolDWORD4+4+4接続のプロトコルを示すビット値(SP_PROT_*)。
szCipherWCHAR128+8+8使用される暗号アルゴリズム名のUnicode文字列。
dwCipherStrengthDWORD4+136+136対称暗号の強度をビット数で示す。
szHashWCHAR128+140+140使用されるハッシュアルゴリズム名のUnicode文字列。
dwHashStrengthDWORD4+268+268ハッシュの強度をビット数で示す。
szExchangeWCHAR128+272+272鍵交換アルゴリズム名のUnicode文字列。
dwExchStrengthDWORD4+400+400鍵交換の強度をビット数で示す。

各言語での定義

#include <windows.h>

// SecPkgContext_ConnectionInfoEx  (x64 404 / x86 404 バイト)
typedef struct SecPkgContext_ConnectionInfoEx {
    DWORD dwVersion;
    DWORD dwProtocol;
    WCHAR szCipher[64];
    DWORD dwCipherStrength;
    WCHAR szHash[64];
    DWORD dwHashStrength;
    WCHAR szExchange[64];
    DWORD dwExchStrength;
} SecPkgContext_ConnectionInfoEx;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_ConnectionInfoEx
{
    public uint dwVersion;
    public uint dwProtocol;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCipher;
    public uint dwCipherStrength;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szHash;
    public uint dwHashStrength;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szExchange;
    public uint dwExchStrength;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_ConnectionInfoEx
    Public dwVersion As UInteger
    Public dwProtocol As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCipher As String
    Public dwCipherStrength As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szHash As String
    Public dwHashStrength As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szExchange As String
    Public dwExchStrength As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SecPkgContext_ConnectionInfoEx(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("dwProtocol", wintypes.DWORD),
        ("szCipher", ctypes.c_wchar * 64),
        ("dwCipherStrength", wintypes.DWORD),
        ("szHash", ctypes.c_wchar * 64),
        ("dwHashStrength", wintypes.DWORD),
        ("szExchange", ctypes.c_wchar * 64),
        ("dwExchStrength", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SecPkgContext_ConnectionInfoEx {
    pub dwVersion: u32,
    pub dwProtocol: u32,
    pub szCipher: [u16; 64],
    pub dwCipherStrength: u32,
    pub szHash: [u16; 64],
    pub dwHashStrength: u32,
    pub szExchange: [u16; 64],
    pub dwExchStrength: u32,
}
import "golang.org/x/sys/windows"

type SecPkgContext_ConnectionInfoEx struct {
	dwVersion uint32
	dwProtocol uint32
	szCipher [64]uint16
	dwCipherStrength uint32
	szHash [64]uint16
	dwHashStrength uint32
	szExchange [64]uint16
	dwExchStrength uint32
}
type
  SecPkgContext_ConnectionInfoEx = record
    dwVersion: DWORD;
    dwProtocol: DWORD;
    szCipher: array[0..63] of WideChar;
    dwCipherStrength: DWORD;
    szHash: array[0..63] of WideChar;
    dwHashStrength: DWORD;
    szExchange: array[0..63] of WideChar;
    dwExchStrength: DWORD;
  end;
const SecPkgContext_ConnectionInfoEx = extern struct {
    dwVersion: u32,
    dwProtocol: u32,
    szCipher: [64]u16,
    dwCipherStrength: u32,
    szHash: [64]u16,
    dwHashStrength: u32,
    szExchange: [64]u16,
    dwExchStrength: u32,
};
type
  SecPkgContext_ConnectionInfoEx {.bycopy.} = object
    dwVersion: uint32
    dwProtocol: uint32
    szCipher: array[64, uint16]
    dwCipherStrength: uint32
    szHash: array[64, uint16]
    dwHashStrength: uint32
    szExchange: array[64, uint16]
    dwExchStrength: uint32
struct SecPkgContext_ConnectionInfoEx
{
    uint dwVersion;
    uint dwProtocol;
    wchar[64] szCipher;
    uint dwCipherStrength;
    wchar[64] szHash;
    uint dwHashStrength;
    wchar[64] szExchange;
    uint dwExchStrength;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SecPkgContext_ConnectionInfoEx サイズ: 404 バイト(x64)
dim st, 101    ; 4byte整数×101(構造体サイズ 404 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwProtocol : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; szCipher : WCHAR (+8, 128byte)  varptr(st)+8 を基点に操作(128byte:入れ子/配列)
; dwCipherStrength : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; szHash : WCHAR (+140, 128byte)  varptr(st)+140 を基点に操作(128byte:入れ子/配列)
; dwHashStrength : DWORD (+268, 4byte)  st.67 = 値  /  値 = st.67   (lpoke/lpeek も可)
; szExchange : WCHAR (+272, 128byte)  varptr(st)+272 を基点に操作(128byte:入れ子/配列)
; dwExchStrength : DWORD (+400, 4byte)  st.100 = 値  /  値 = st.100   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SecPkgContext_ConnectionInfoEx
    #field int dwVersion
    #field int dwProtocol
    #field wchar szCipher 64
    #field int dwCipherStrength
    #field wchar szHash 64
    #field int dwHashStrength
    #field wchar szExchange 64
    #field int dwExchStrength
#endstruct

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