Win32 API 日本語リファレンス
ホームNetworking.WinSock › SOCKET_SECURITY_QUERY_INFO

SOCKET_SECURITY_QUERY_INFO

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

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

フィールド

フィールドサイズx64x86説明
SecurityProtocolSOCKET_SECURITY_PROTOCOL4+0+0適用されているSOCKET_SECURITY_PROTOCOL列挙値。
FlagsDWORD4+4+4セキュリティ状態を示すフラグのビットマスク。
PeerApplicationAccessTokenHandleULONGLONG8+8+8ピアアプリケーションのアクセストークンハンドルを示す64ビット値。
PeerMachineAccessTokenHandleULONGLONG8+16+16ピアマシンのアクセストークンハンドルを示す64ビット値。

各言語での定義

#include <windows.h>

// SOCKET_SECURITY_QUERY_INFO  (x64 24 / x86 24 バイト)
typedef struct SOCKET_SECURITY_QUERY_INFO {
    SOCKET_SECURITY_PROTOCOL SecurityProtocol;
    DWORD Flags;
    ULONGLONG PeerApplicationAccessTokenHandle;
    ULONGLONG PeerMachineAccessTokenHandle;
} SOCKET_SECURITY_QUERY_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SOCKET_SECURITY_QUERY_INFO
{
    public int SecurityProtocol;
    public uint Flags;
    public ulong PeerApplicationAccessTokenHandle;
    public ulong PeerMachineAccessTokenHandle;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SOCKET_SECURITY_QUERY_INFO
    Public SecurityProtocol As Integer
    Public Flags As UInteger
    Public PeerApplicationAccessTokenHandle As ULong
    Public PeerMachineAccessTokenHandle As ULong
End Structure
import ctypes
from ctypes import wintypes

class SOCKET_SECURITY_QUERY_INFO(ctypes.Structure):
    _fields_ = [
        ("SecurityProtocol", ctypes.c_int),
        ("Flags", wintypes.DWORD),
        ("PeerApplicationAccessTokenHandle", ctypes.c_ulonglong),
        ("PeerMachineAccessTokenHandle", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct SOCKET_SECURITY_QUERY_INFO {
    pub SecurityProtocol: i32,
    pub Flags: u32,
    pub PeerApplicationAccessTokenHandle: u64,
    pub PeerMachineAccessTokenHandle: u64,
}
import "golang.org/x/sys/windows"

type SOCKET_SECURITY_QUERY_INFO struct {
	SecurityProtocol int32
	Flags uint32
	PeerApplicationAccessTokenHandle uint64
	PeerMachineAccessTokenHandle uint64
}
type
  SOCKET_SECURITY_QUERY_INFO = record
    SecurityProtocol: Integer;
    Flags: DWORD;
    PeerApplicationAccessTokenHandle: UInt64;
    PeerMachineAccessTokenHandle: UInt64;
  end;
const SOCKET_SECURITY_QUERY_INFO = extern struct {
    SecurityProtocol: i32,
    Flags: u32,
    PeerApplicationAccessTokenHandle: u64,
    PeerMachineAccessTokenHandle: u64,
};
type
  SOCKET_SECURITY_QUERY_INFO {.bycopy.} = object
    SecurityProtocol: int32
    Flags: uint32
    PeerApplicationAccessTokenHandle: uint64
    PeerMachineAccessTokenHandle: uint64
struct SOCKET_SECURITY_QUERY_INFO
{
    int SecurityProtocol;
    uint Flags;
    ulong PeerApplicationAccessTokenHandle;
    ulong PeerMachineAccessTokenHandle;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SOCKET_SECURITY_QUERY_INFO サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; SecurityProtocol : SOCKET_SECURITY_PROTOCOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Flags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; PeerApplicationAccessTokenHandle : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; PeerMachineAccessTokenHandle : 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 SOCKET_SECURITY_QUERY_INFO
    #field int SecurityProtocol
    #field int Flags
    #field int64 PeerApplicationAccessTokenHandle
    #field int64 PeerMachineAccessTokenHandle
#endstruct

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