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

SEC_CHANNEL_BINDINGS

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

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

フィールド

フィールドサイズx64x86説明
dwInitiatorAddrTypeDWORD4+0+0イニシエーター側アドレスの種別を示す値。
cbInitiatorLengthDWORD4+4+4イニシエーターアドレスデータの長さ(バイト数)。
dwInitiatorOffsetDWORD4+8+8構造体先頭からイニシエーターアドレスまでのオフセット(バイト)。
dwAcceptorAddrTypeDWORD4+12+12アクセプター側アドレスの種別を示す値。
cbAcceptorLengthDWORD4+16+16アクセプターアドレスデータの長さ(バイト数)。
dwAcceptorOffsetDWORD4+20+20構造体先頭からアクセプターアドレスまでのオフセット(バイト)。
cbApplicationDataLengthDWORD4+24+24アプリケーション固有データの長さ(バイト数)。
dwApplicationDataOffsetDWORD4+28+28構造体先頭からアプリケーションデータまでのオフセット(バイト)。

各言語での定義

#include <windows.h>

// SEC_CHANNEL_BINDINGS  (x64 32 / x86 32 バイト)
typedef struct SEC_CHANNEL_BINDINGS {
    DWORD dwInitiatorAddrType;
    DWORD cbInitiatorLength;
    DWORD dwInitiatorOffset;
    DWORD dwAcceptorAddrType;
    DWORD cbAcceptorLength;
    DWORD dwAcceptorOffset;
    DWORD cbApplicationDataLength;
    DWORD dwApplicationDataOffset;
} SEC_CHANNEL_BINDINGS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SEC_CHANNEL_BINDINGS
{
    public uint dwInitiatorAddrType;
    public uint cbInitiatorLength;
    public uint dwInitiatorOffset;
    public uint dwAcceptorAddrType;
    public uint cbAcceptorLength;
    public uint dwAcceptorOffset;
    public uint cbApplicationDataLength;
    public uint dwApplicationDataOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SEC_CHANNEL_BINDINGS
    Public dwInitiatorAddrType As UInteger
    Public cbInitiatorLength As UInteger
    Public dwInitiatorOffset As UInteger
    Public dwAcceptorAddrType As UInteger
    Public cbAcceptorLength As UInteger
    Public dwAcceptorOffset As UInteger
    Public cbApplicationDataLength As UInteger
    Public dwApplicationDataOffset As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SEC_CHANNEL_BINDINGS(ctypes.Structure):
    _fields_ = [
        ("dwInitiatorAddrType", wintypes.DWORD),
        ("cbInitiatorLength", wintypes.DWORD),
        ("dwInitiatorOffset", wintypes.DWORD),
        ("dwAcceptorAddrType", wintypes.DWORD),
        ("cbAcceptorLength", wintypes.DWORD),
        ("dwAcceptorOffset", wintypes.DWORD),
        ("cbApplicationDataLength", wintypes.DWORD),
        ("dwApplicationDataOffset", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SEC_CHANNEL_BINDINGS {
    pub dwInitiatorAddrType: u32,
    pub cbInitiatorLength: u32,
    pub dwInitiatorOffset: u32,
    pub dwAcceptorAddrType: u32,
    pub cbAcceptorLength: u32,
    pub dwAcceptorOffset: u32,
    pub cbApplicationDataLength: u32,
    pub dwApplicationDataOffset: u32,
}
import "golang.org/x/sys/windows"

type SEC_CHANNEL_BINDINGS struct {
	dwInitiatorAddrType uint32
	cbInitiatorLength uint32
	dwInitiatorOffset uint32
	dwAcceptorAddrType uint32
	cbAcceptorLength uint32
	dwAcceptorOffset uint32
	cbApplicationDataLength uint32
	dwApplicationDataOffset uint32
}
type
  SEC_CHANNEL_BINDINGS = record
    dwInitiatorAddrType: DWORD;
    cbInitiatorLength: DWORD;
    dwInitiatorOffset: DWORD;
    dwAcceptorAddrType: DWORD;
    cbAcceptorLength: DWORD;
    dwAcceptorOffset: DWORD;
    cbApplicationDataLength: DWORD;
    dwApplicationDataOffset: DWORD;
  end;
const SEC_CHANNEL_BINDINGS = extern struct {
    dwInitiatorAddrType: u32,
    cbInitiatorLength: u32,
    dwInitiatorOffset: u32,
    dwAcceptorAddrType: u32,
    cbAcceptorLength: u32,
    dwAcceptorOffset: u32,
    cbApplicationDataLength: u32,
    dwApplicationDataOffset: u32,
};
type
  SEC_CHANNEL_BINDINGS {.bycopy.} = object
    dwInitiatorAddrType: uint32
    cbInitiatorLength: uint32
    dwInitiatorOffset: uint32
    dwAcceptorAddrType: uint32
    cbAcceptorLength: uint32
    dwAcceptorOffset: uint32
    cbApplicationDataLength: uint32
    dwApplicationDataOffset: uint32
struct SEC_CHANNEL_BINDINGS
{
    uint dwInitiatorAddrType;
    uint cbInitiatorLength;
    uint dwInitiatorOffset;
    uint dwAcceptorAddrType;
    uint cbAcceptorLength;
    uint dwAcceptorOffset;
    uint cbApplicationDataLength;
    uint dwApplicationDataOffset;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SEC_CHANNEL_BINDINGS サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwInitiatorAddrType : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cbInitiatorLength : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwInitiatorOffset : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwAcceptorAddrType : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; cbAcceptorLength : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwAcceptorOffset : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; cbApplicationDataLength : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwApplicationDataOffset : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SEC_CHANNEL_BINDINGS
    #field int dwInitiatorAddrType
    #field int cbInitiatorLength
    #field int dwInitiatorOffset
    #field int dwAcceptorAddrType
    #field int cbAcceptorLength
    #field int dwAcceptorOffset
    #field int cbApplicationDataLength
    #field int dwApplicationDataOffset
#endstruct

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