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

INET_FIREWALL_AC_CHANGE

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

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

フィールド

フィールドサイズx64x86説明
changeTypeINET_FIREWALL_AC_CHANGE_TYPE4+0+0AppContainerに発生した変更の種類を示す列挙値。
createTypeINET_FIREWALL_AC_CREATION_TYPE4+4+4AppContainerの作成方法を示す列挙値。
appContainerSidSID*8/4+8+8対象AppContainerのSIDへのポインター。
userSidSID*8/4+16+12AppContainerを所有するユーザーのSIDへのポインター。
displayNameLPWSTR8/4+24+16AppContainerの表示名。
Anonymous_Anonymous_e__Union16/8+32+20変更種別に応じた追加情報を保持する共用体。

共用体: _Anonymous_e__Union x64 16B / x86 8B

フィールドサイズx64x86
capabilitiesINET_FIREWALL_AC_CAPABILITIES16/8+0+0
binariesINET_FIREWALL_AC_BINARIES16/8+0+0

各言語での定義

#include <windows.h>

// INET_FIREWALL_AC_CHANGE  (x64 48 / x86 28 バイト)
typedef struct INET_FIREWALL_AC_CHANGE {
    INET_FIREWALL_AC_CHANGE_TYPE changeType;
    INET_FIREWALL_AC_CREATION_TYPE createType;
    SID* appContainerSid;
    SID* userSid;
    LPWSTR displayName;
    _Anonymous_e__Union Anonymous;
} INET_FIREWALL_AC_CHANGE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INET_FIREWALL_AC_CHANGE
{
    public int changeType;
    public int createType;
    public IntPtr appContainerSid;
    public IntPtr userSid;
    public IntPtr displayName;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INET_FIREWALL_AC_CHANGE
    Public changeType As Integer
    Public createType As Integer
    Public appContainerSid As IntPtr
    Public userSid As IntPtr
    Public displayName As IntPtr
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class INET_FIREWALL_AC_CHANGE(ctypes.Structure):
    _fields_ = [
        ("changeType", ctypes.c_int),
        ("createType", ctypes.c_int),
        ("appContainerSid", ctypes.c_void_p),
        ("userSid", ctypes.c_void_p),
        ("displayName", ctypes.c_void_p),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct INET_FIREWALL_AC_CHANGE {
    pub changeType: i32,
    pub createType: i32,
    pub appContainerSid: *mut core::ffi::c_void,
    pub userSid: *mut core::ffi::c_void,
    pub displayName: *mut core::ffi::c_void,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type INET_FIREWALL_AC_CHANGE struct {
	changeType int32
	createType int32
	appContainerSid uintptr
	userSid uintptr
	displayName uintptr
	Anonymous _Anonymous_e__Union
}
type
  INET_FIREWALL_AC_CHANGE = record
    changeType: Integer;
    createType: Integer;
    appContainerSid: Pointer;
    userSid: Pointer;
    displayName: Pointer;
    Anonymous: _Anonymous_e__Union;
  end;
const INET_FIREWALL_AC_CHANGE = extern struct {
    changeType: i32,
    createType: i32,
    appContainerSid: ?*anyopaque,
    userSid: ?*anyopaque,
    displayName: ?*anyopaque,
    Anonymous: _Anonymous_e__Union,
};
type
  INET_FIREWALL_AC_CHANGE {.bycopy.} = object
    changeType: int32
    createType: int32
    appContainerSid: pointer
    userSid: pointer
    displayName: pointer
    Anonymous: _Anonymous_e__Union
struct INET_FIREWALL_AC_CHANGE
{
    int changeType;
    int createType;
    void* appContainerSid;
    void* userSid;
    void* displayName;
    _Anonymous_e__Union Anonymous;
}

HSP用 定義

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

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

stdim st, INET_FIREWALL_AC_CHANGE        ; NSTRUCT 変数を確保
st->changeType = 100
mes "changeType=" + st->changeType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。