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

SecPkgContext_SessionInfo

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0セッションに関するフラグを示す。SSL_SESSION_RECONNECT等。
cbSessionIdDWORD4+4+4セッションIDのバイト数を示す。
rgbSessionIdBYTE32+8+8セッションIDのバイト配列。

各言語での定義

#include <windows.h>

// SecPkgContext_SessionInfo  (x64 40 / x86 40 バイト)
typedef struct SecPkgContext_SessionInfo {
    DWORD dwFlags;
    DWORD cbSessionId;
    BYTE rgbSessionId[32];
} SecPkgContext_SessionInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_SessionInfo
{
    public uint dwFlags;
    public uint cbSessionId;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] rgbSessionId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_SessionInfo
    Public dwFlags As UInteger
    Public cbSessionId As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public rgbSessionId() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SecPkgContext_SessionInfo(ctypes.Structure):
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("cbSessionId", wintypes.DWORD),
        ("rgbSessionId", ctypes.c_ubyte * 32),
    ]
#[repr(C)]
pub struct SecPkgContext_SessionInfo {
    pub dwFlags: u32,
    pub cbSessionId: u32,
    pub rgbSessionId: [u8; 32],
}
import "golang.org/x/sys/windows"

type SecPkgContext_SessionInfo struct {
	dwFlags uint32
	cbSessionId uint32
	rgbSessionId [32]byte
}
type
  SecPkgContext_SessionInfo = record
    dwFlags: DWORD;
    cbSessionId: DWORD;
    rgbSessionId: array[0..31] of Byte;
  end;
const SecPkgContext_SessionInfo = extern struct {
    dwFlags: u32,
    cbSessionId: u32,
    rgbSessionId: [32]u8,
};
type
  SecPkgContext_SessionInfo {.bycopy.} = object
    dwFlags: uint32
    cbSessionId: uint32
    rgbSessionId: array[32, uint8]
struct SecPkgContext_SessionInfo
{
    uint dwFlags;
    uint cbSessionId;
    ubyte[32] rgbSessionId;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SecPkgContext_SessionInfo サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cbSessionId : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; rgbSessionId : BYTE (+8, 32byte)  varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SecPkgContext_SessionInfo
    #field int dwFlags
    #field int cbSessionId
    #field byte rgbSessionId 32
#endstruct

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