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

FWPM_SYSTEM_PORTS0

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

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

フィールド

フィールドサイズx64x86説明
numTypesDWORD4+0+0types配列の要素数。
typesFWPM_SYSTEM_PORTS_BY_TYPE0*8/4+8+4種別ごとのシステムポート情報の配列へのポインター。

各言語での定義

#include <windows.h>

// FWPM_SYSTEM_PORTS0  (x64 16 / x86 8 バイト)
typedef struct FWPM_SYSTEM_PORTS0 {
    DWORD numTypes;
    FWPM_SYSTEM_PORTS_BY_TYPE0* types;
} FWPM_SYSTEM_PORTS0;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FWPM_SYSTEM_PORTS0
{
    public uint numTypes;
    public IntPtr types;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FWPM_SYSTEM_PORTS0
    Public numTypes As UInteger
    Public types As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class FWPM_SYSTEM_PORTS0(ctypes.Structure):
    _fields_ = [
        ("numTypes", wintypes.DWORD),
        ("types", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct FWPM_SYSTEM_PORTS0 {
    pub numTypes: u32,
    pub types: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type FWPM_SYSTEM_PORTS0 struct {
	numTypes uint32
	types uintptr
}
type
  FWPM_SYSTEM_PORTS0 = record
    numTypes: DWORD;
    types: Pointer;
  end;
const FWPM_SYSTEM_PORTS0 = extern struct {
    numTypes: u32,
    types: ?*anyopaque,
};
type
  FWPM_SYSTEM_PORTS0 {.bycopy.} = object
    numTypes: uint32
    types: pointer
struct FWPM_SYSTEM_PORTS0
{
    uint numTypes;
    void* types;
}

HSP用 定義

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

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

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