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

FWPM_FIELD0

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

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

フィールド

フィールドサイズx64x86説明
fieldKeyGUID*8/4+0+0フィールド(分類条件)を識別するGUIDへのポインター。
typeFWPM_FIELD_TYPE4+8+4フィールドの種類(RAWデータ/IPアドレス/フラグなど)を示す列挙値。
dataTypeFWP_DATA_TYPE4+12+8フィールド値のデータ型を示すFWP_DATA_TYPE。

各言語での定義

#include <windows.h>

// FWPM_FIELD0  (x64 16 / x86 12 バイト)
typedef struct FWPM_FIELD0 {
    GUID* fieldKey;
    FWPM_FIELD_TYPE type;
    FWP_DATA_TYPE dataType;
} FWPM_FIELD0;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FWPM_FIELD0
{
    public IntPtr fieldKey;
    public int type;
    public int dataType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FWPM_FIELD0
    Public fieldKey As IntPtr
    Public type As Integer
    Public dataType As Integer
End Structure
import ctypes
from ctypes import wintypes

class FWPM_FIELD0(ctypes.Structure):
    _fields_ = [
        ("fieldKey", ctypes.c_void_p),
        ("type", ctypes.c_int),
        ("dataType", ctypes.c_int),
    ]
#[repr(C)]
pub struct FWPM_FIELD0 {
    pub fieldKey: *mut core::ffi::c_void,
    pub type: i32,
    pub dataType: i32,
}
import "golang.org/x/sys/windows"

type FWPM_FIELD0 struct {
	fieldKey uintptr
	type int32
	dataType int32
}
type
  FWPM_FIELD0 = record
    fieldKey: Pointer;
    type: Integer;
    dataType: Integer;
  end;
const FWPM_FIELD0 = extern struct {
    fieldKey: ?*anyopaque,
    type: i32,
    dataType: i32,
};
type
  FWPM_FIELD0 {.bycopy.} = object
    fieldKey: pointer
    type: int32
    dataType: int32
struct FWPM_FIELD0
{
    void* fieldKey;
    int type;
    int dataType;
}

HSP用 定義

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

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

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