ホーム › NetworkManagement.WindowsFilteringPlatform › FWPM_FILTER_CONDITION0
FWPM_FILTER_CONDITION0
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fieldKey | GUID | 16 | +0 | +0 | 評価対象のフィールドを識別するGUID。 |
| matchType | FWP_MATCH_TYPE | 4 | +16 | +16 | 一致判定の方法(等値/範囲/フラグなど)を示す列挙値。 |
| conditionValue | FWP_CONDITION_VALUE0 | 16/8 | +24 | +20 | 比較に用いる条件値を保持するFWP_CONDITION_VALUE0。 |
各言語での定義
#include <windows.h>
// FWP_CONDITION_VALUE0 (x64 16 / x86 8 バイト)
typedef struct FWP_CONDITION_VALUE0 {
FWP_DATA_TYPE type;
_Anonymous_e__Union Anonymous;
} FWP_CONDITION_VALUE0;
// FWPM_FILTER_CONDITION0 (x64 40 / x86 28 バイト)
typedef struct FWPM_FILTER_CONDITION0 {
GUID fieldKey;
FWP_MATCH_TYPE matchType;
FWP_CONDITION_VALUE0 conditionValue;
} FWPM_FILTER_CONDITION0;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FWP_CONDITION_VALUE0
{
public int type;
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FWPM_FILTER_CONDITION0
{
public Guid fieldKey;
public int matchType;
public FWP_CONDITION_VALUE0 conditionValue;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FWP_CONDITION_VALUE0
Public type As Integer
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FWPM_FILTER_CONDITION0
Public fieldKey As Guid
Public matchType As Integer
Public conditionValue As FWP_CONDITION_VALUE0
End Structureimport ctypes
from ctypes import wintypes
class FWP_CONDITION_VALUE0(ctypes.Structure):
_fields_ = [
("type", ctypes.c_int),
("Anonymous", _Anonymous_e__Union),
]
class FWPM_FILTER_CONDITION0(ctypes.Structure):
_fields_ = [
("fieldKey", GUID),
("matchType", ctypes.c_int),
("conditionValue", FWP_CONDITION_VALUE0),
]#[repr(C)]
pub struct FWP_CONDITION_VALUE0 {
pub type: i32,
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct FWPM_FILTER_CONDITION0 {
pub fieldKey: GUID,
pub matchType: i32,
pub conditionValue: FWP_CONDITION_VALUE0,
}import "golang.org/x/sys/windows"
type FWP_CONDITION_VALUE0 struct {
type int32
Anonymous _Anonymous_e__Union
}
type FWPM_FILTER_CONDITION0 struct {
fieldKey windows.GUID
matchType int32
conditionValue FWP_CONDITION_VALUE0
}type
FWP_CONDITION_VALUE0 = record
type: Integer;
Anonymous: _Anonymous_e__Union;
end;
FWPM_FILTER_CONDITION0 = record
fieldKey: TGUID;
matchType: Integer;
conditionValue: FWP_CONDITION_VALUE0;
end;const FWP_CONDITION_VALUE0 = extern struct {
type: i32,
Anonymous: _Anonymous_e__Union,
};
const FWPM_FILTER_CONDITION0 = extern struct {
fieldKey: GUID,
matchType: i32,
conditionValue: FWP_CONDITION_VALUE0,
};type
FWP_CONDITION_VALUE0 {.bycopy.} = object
type: int32
Anonymous: _Anonymous_e__Union
FWPM_FILTER_CONDITION0 {.bycopy.} = object
fieldKey: GUID
matchType: int32
conditionValue: FWP_CONDITION_VALUE0struct FWP_CONDITION_VALUE0
{
int type;
_Anonymous_e__Union Anonymous;
}
struct FWPM_FILTER_CONDITION0
{
GUID fieldKey;
int matchType;
FWP_CONDITION_VALUE0 conditionValue;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FWPM_FILTER_CONDITION0 サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; fieldKey : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; matchType : FWP_MATCH_TYPE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; conditionValue : FWP_CONDITION_VALUE0 (+20, 8byte) varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FWPM_FILTER_CONDITION0 サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; fieldKey : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; matchType : FWP_MATCH_TYPE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; conditionValue : FWP_CONDITION_VALUE0 (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global FWP_CONDITION_VALUE0
#field int type
#field byte Anonymous 8
#endstruct
#defstruct global FWPM_FILTER_CONDITION0
#field GUID fieldKey
#field int matchType
#field FWP_CONDITION_VALUE0 conditionValue
#endstruct
stdim st, FWPM_FILTER_CONDITION0 ; NSTRUCT 変数を確保
st->matchType = 100
mes "matchType=" + st->matchType