ホーム › NetworkManagement.WindowsFilteringPlatform › FWP_TOKEN_INFORMATION
FWP_TOKEN_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| sidCount | DWORD | 4 | +0 | +0 | sids配列に含まれるSIDの数。 |
| sids | SID_AND_ATTRIBUTES* | 8/4 | +8 | +4 | 通常SIDと属性の配列へのポインター。 |
| restrictedSidCount | DWORD | 4 | +16 | +8 | restrictedSids配列に含まれる制限SIDの数。 |
| restrictedSids | SID_AND_ATTRIBUTES* | 8/4 | +24 | +12 | 制限付きSIDと属性の配列へのポインター。NULL可。 |
各言語での定義
#include <windows.h>
// FWP_TOKEN_INFORMATION (x64 32 / x86 16 バイト)
typedef struct FWP_TOKEN_INFORMATION {
DWORD sidCount;
SID_AND_ATTRIBUTES* sids;
DWORD restrictedSidCount;
SID_AND_ATTRIBUTES* restrictedSids;
} FWP_TOKEN_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FWP_TOKEN_INFORMATION
{
public uint sidCount;
public IntPtr sids;
public uint restrictedSidCount;
public IntPtr restrictedSids;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FWP_TOKEN_INFORMATION
Public sidCount As UInteger
Public sids As IntPtr
Public restrictedSidCount As UInteger
Public restrictedSids As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class FWP_TOKEN_INFORMATION(ctypes.Structure):
_fields_ = [
("sidCount", wintypes.DWORD),
("sids", ctypes.c_void_p),
("restrictedSidCount", wintypes.DWORD),
("restrictedSids", ctypes.c_void_p),
]#[repr(C)]
pub struct FWP_TOKEN_INFORMATION {
pub sidCount: u32,
pub sids: *mut core::ffi::c_void,
pub restrictedSidCount: u32,
pub restrictedSids: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type FWP_TOKEN_INFORMATION struct {
sidCount uint32
sids uintptr
restrictedSidCount uint32
restrictedSids uintptr
}type
FWP_TOKEN_INFORMATION = record
sidCount: DWORD;
sids: Pointer;
restrictedSidCount: DWORD;
restrictedSids: Pointer;
end;const FWP_TOKEN_INFORMATION = extern struct {
sidCount: u32,
sids: ?*anyopaque,
restrictedSidCount: u32,
restrictedSids: ?*anyopaque,
};type
FWP_TOKEN_INFORMATION {.bycopy.} = object
sidCount: uint32
sids: pointer
restrictedSidCount: uint32
restrictedSids: pointerstruct FWP_TOKEN_INFORMATION
{
uint sidCount;
void* sids;
uint restrictedSidCount;
void* restrictedSids;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FWP_TOKEN_INFORMATION サイズ: 16 バイト(x86)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; sidCount : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; sids : SID_AND_ATTRIBUTES* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; restrictedSidCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; restrictedSids : SID_AND_ATTRIBUTES* (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FWP_TOKEN_INFORMATION サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; sidCount : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; sids : SID_AND_ATTRIBUTES* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; restrictedSidCount : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; restrictedSids : SID_AND_ATTRIBUTES* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FWP_TOKEN_INFORMATION
#field int sidCount
#field intptr sids
#field int restrictedSidCount
#field intptr restrictedSids
#endstruct
stdim st, FWP_TOKEN_INFORMATION ; NSTRUCT 変数を確保
st->sidCount = 100
mes "sidCount=" + st->sidCount