Win32 API 日本語リファレンス
ホームNetworkManagement.WindowsFilteringPlatform › IPSEC_TOKEN0

IPSEC_TOKEN0

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

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

フィールド

フィールドサイズx64x86説明
typeIPSEC_TOKEN_TYPE4+0+0トークンの種類(マシン/ユーザーなど)を示す列挙値。
principalIPSEC_TOKEN_PRINCIPAL4+4+4トークンが表すプリンシパル(ローカル/リモート)を示す列挙値。
modeIPSEC_TOKEN_MODE4+8+8トークンの認証モード(メイン/拡張モードなど)を示す列挙値。
tokenULONGLONG8+16+16アクセストークンを識別するLUID値。ULONGLONG。

各言語での定義

#include <windows.h>

// IPSEC_TOKEN0  (x64 24 / x86 24 バイト)
typedef struct IPSEC_TOKEN0 {
    IPSEC_TOKEN_TYPE type;
    IPSEC_TOKEN_PRINCIPAL principal;
    IPSEC_TOKEN_MODE mode;
    ULONGLONG token;
} IPSEC_TOKEN0;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_TOKEN0
{
    public int type;
    public int principal;
    public int mode;
    public ulong token;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_TOKEN0
    Public type As Integer
    Public principal As Integer
    Public mode As Integer
    Public token As ULong
End Structure
import ctypes
from ctypes import wintypes

class IPSEC_TOKEN0(ctypes.Structure):
    _fields_ = [
        ("type", ctypes.c_int),
        ("principal", ctypes.c_int),
        ("mode", ctypes.c_int),
        ("token", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct IPSEC_TOKEN0 {
    pub type: i32,
    pub principal: i32,
    pub mode: i32,
    pub token: u64,
}
import "golang.org/x/sys/windows"

type IPSEC_TOKEN0 struct {
	type int32
	principal int32
	mode int32
	token uint64
}
type
  IPSEC_TOKEN0 = record
    type: Integer;
    principal: Integer;
    mode: Integer;
    token: UInt64;
  end;
const IPSEC_TOKEN0 = extern struct {
    type: i32,
    principal: i32,
    mode: i32,
    token: u64,
};
type
  IPSEC_TOKEN0 {.bycopy.} = object
    type: int32
    principal: int32
    mode: int32
    token: uint64
struct IPSEC_TOKEN0
{
    int type;
    int principal;
    int mode;
    ulong token;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IPSEC_TOKEN0 サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; type : IPSEC_TOKEN_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; principal : IPSEC_TOKEN_PRINCIPAL (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; mode : IPSEC_TOKEN_MODE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; token : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IPSEC_TOKEN0
    #field int type
    #field int principal
    #field int mode
    #field int64 token
#endstruct

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