ホーム › Security.Authentication.Identity › SecPkgContext_ApplicationProtocol
SecPkgContext_ApplicationProtocol
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ProtoNegoStatus | SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS | 4 | +0 | +0 | アプリケーションプロトコルネゴシエーションの結果を示す列挙値(成功/未選択等)。 |
| ProtoNegoExt | SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT | 4 | +4 | +4 | 用いられたネゴシエーション拡張の種別を示す列挙値(ALPN/NPN等)。 |
| ProtocolIdSize | BYTE | 1 | +8 | +8 | ProtocolIdの長さ(バイト数)。 |
| ProtocolId | BYTE | 255 | +9 | +9 | 選択されたアプリケーションプロトコル識別子を保持する可変長バイト配列の先頭要素。 |
各言語での定義
#include <windows.h>
// SecPkgContext_ApplicationProtocol (x64 264 / x86 264 バイト)
typedef struct SecPkgContext_ApplicationProtocol {
SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS ProtoNegoStatus;
SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT ProtoNegoExt;
BYTE ProtocolIdSize;
BYTE ProtocolId[255];
} SecPkgContext_ApplicationProtocol;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_ApplicationProtocol
{
public int ProtoNegoStatus;
public int ProtoNegoExt;
public byte ProtocolIdSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)] public byte[] ProtocolId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_ApplicationProtocol
Public ProtoNegoStatus As Integer
Public ProtoNegoExt As Integer
Public ProtocolIdSize As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=255)> Public ProtocolId() As Byte
End Structureimport ctypes
from ctypes import wintypes
class SecPkgContext_ApplicationProtocol(ctypes.Structure):
_fields_ = [
("ProtoNegoStatus", ctypes.c_int),
("ProtoNegoExt", ctypes.c_int),
("ProtocolIdSize", ctypes.c_ubyte),
("ProtocolId", ctypes.c_ubyte * 255),
]#[repr(C)]
pub struct SecPkgContext_ApplicationProtocol {
pub ProtoNegoStatus: i32,
pub ProtoNegoExt: i32,
pub ProtocolIdSize: u8,
pub ProtocolId: [u8; 255],
}import "golang.org/x/sys/windows"
type SecPkgContext_ApplicationProtocol struct {
ProtoNegoStatus int32
ProtoNegoExt int32
ProtocolIdSize byte
ProtocolId [255]byte
}type
SecPkgContext_ApplicationProtocol = record
ProtoNegoStatus: Integer;
ProtoNegoExt: Integer;
ProtocolIdSize: Byte;
ProtocolId: array[0..254] of Byte;
end;const SecPkgContext_ApplicationProtocol = extern struct {
ProtoNegoStatus: i32,
ProtoNegoExt: i32,
ProtocolIdSize: u8,
ProtocolId: [255]u8,
};type
SecPkgContext_ApplicationProtocol {.bycopy.} = object
ProtoNegoStatus: int32
ProtoNegoExt: int32
ProtocolIdSize: uint8
ProtocolId: array[255, uint8]struct SecPkgContext_ApplicationProtocol
{
int ProtoNegoStatus;
int ProtoNegoExt;
ubyte ProtocolIdSize;
ubyte[255] ProtocolId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SecPkgContext_ApplicationProtocol サイズ: 264 バイト(x64)
dim st, 66 ; 4byte整数×66(構造体サイズ 264 / 4 切り上げ)
; ProtoNegoStatus : SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ProtoNegoExt : SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ProtocolIdSize : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; ProtocolId : BYTE (+9, 255byte) varptr(st)+9 を基点に操作(255byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SecPkgContext_ApplicationProtocol
#field int ProtoNegoStatus
#field int ProtoNegoExt
#field byte ProtocolIdSize
#field byte ProtocolId 255
#endstruct
stdim st, SecPkgContext_ApplicationProtocol ; NSTRUCT 変数を確保
st->ProtoNegoStatus = 100
mes "ProtoNegoStatus=" + st->ProtoNegoStatus