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

INET_FIREWALL_APP_CONTAINER

構造体
サイズx64: 88 バイト / x86: 44 バイト

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

フィールド

フィールドサイズx64x86説明
appContainerSidSID*8/4+0+0AppContainerのSIDへのポインター。
userSidSID*8/4+8+4AppContainerを所有するユーザーのSIDへのポインター。
appContainerNameLPWSTR8/4+16+8AppContainerのモニカー(内部名)。
displayNameLPWSTR8/4+24+12AppContainerの表示名。
descriptionLPWSTR8/4+32+16AppContainerの説明文。
capabilitiesINET_FIREWALL_AC_CAPABILITIES16/8+40+20AppContainerが要求するケーパビリティの集合。
binariesINET_FIREWALL_AC_BINARIES16/8+56+28AppContainerに関連付くバイナリの集合。
workingDirectoryLPWSTR8/4+72+36AppContainerの作業ディレクトリパス。
packageFullNameLPWSTR8/4+80+40アプリパッケージの完全名。

各言語での定義

#include <windows.h>

// INET_FIREWALL_AC_CAPABILITIES  (x64 16 / x86 8 バイト)
typedef struct INET_FIREWALL_AC_CAPABILITIES {
    DWORD count;
    SID_AND_ATTRIBUTES* capabilities;
} INET_FIREWALL_AC_CAPABILITIES;

// INET_FIREWALL_AC_BINARIES  (x64 16 / x86 8 バイト)
typedef struct INET_FIREWALL_AC_BINARIES {
    DWORD count;
    LPWSTR* binaries;
} INET_FIREWALL_AC_BINARIES;

// INET_FIREWALL_APP_CONTAINER  (x64 88 / x86 44 バイト)
typedef struct INET_FIREWALL_APP_CONTAINER {
    SID* appContainerSid;
    SID* userSid;
    LPWSTR appContainerName;
    LPWSTR displayName;
    LPWSTR description;
    INET_FIREWALL_AC_CAPABILITIES capabilities;
    INET_FIREWALL_AC_BINARIES binaries;
    LPWSTR workingDirectory;
    LPWSTR packageFullName;
} INET_FIREWALL_APP_CONTAINER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INET_FIREWALL_AC_CAPABILITIES
{
    public uint count;
    public IntPtr capabilities;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INET_FIREWALL_AC_BINARIES
{
    public uint count;
    public IntPtr binaries;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INET_FIREWALL_APP_CONTAINER
{
    public IntPtr appContainerSid;
    public IntPtr userSid;
    public IntPtr appContainerName;
    public IntPtr displayName;
    public IntPtr description;
    public INET_FIREWALL_AC_CAPABILITIES capabilities;
    public INET_FIREWALL_AC_BINARIES binaries;
    public IntPtr workingDirectory;
    public IntPtr packageFullName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INET_FIREWALL_AC_CAPABILITIES
    Public count As UInteger
    Public capabilities As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INET_FIREWALL_AC_BINARIES
    Public count As UInteger
    Public binaries As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INET_FIREWALL_APP_CONTAINER
    Public appContainerSid As IntPtr
    Public userSid As IntPtr
    Public appContainerName As IntPtr
    Public displayName As IntPtr
    Public description As IntPtr
    Public capabilities As INET_FIREWALL_AC_CAPABILITIES
    Public binaries As INET_FIREWALL_AC_BINARIES
    Public workingDirectory As IntPtr
    Public packageFullName As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class INET_FIREWALL_AC_CAPABILITIES(ctypes.Structure):
    _fields_ = [
        ("count", wintypes.DWORD),
        ("capabilities", ctypes.c_void_p),
    ]

class INET_FIREWALL_AC_BINARIES(ctypes.Structure):
    _fields_ = [
        ("count", wintypes.DWORD),
        ("binaries", ctypes.c_void_p),
    ]

class INET_FIREWALL_APP_CONTAINER(ctypes.Structure):
    _fields_ = [
        ("appContainerSid", ctypes.c_void_p),
        ("userSid", ctypes.c_void_p),
        ("appContainerName", ctypes.c_void_p),
        ("displayName", ctypes.c_void_p),
        ("description", ctypes.c_void_p),
        ("capabilities", INET_FIREWALL_AC_CAPABILITIES),
        ("binaries", INET_FIREWALL_AC_BINARIES),
        ("workingDirectory", ctypes.c_void_p),
        ("packageFullName", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct INET_FIREWALL_AC_CAPABILITIES {
    pub count: u32,
    pub capabilities: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct INET_FIREWALL_AC_BINARIES {
    pub count: u32,
    pub binaries: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct INET_FIREWALL_APP_CONTAINER {
    pub appContainerSid: *mut core::ffi::c_void,
    pub userSid: *mut core::ffi::c_void,
    pub appContainerName: *mut core::ffi::c_void,
    pub displayName: *mut core::ffi::c_void,
    pub description: *mut core::ffi::c_void,
    pub capabilities: INET_FIREWALL_AC_CAPABILITIES,
    pub binaries: INET_FIREWALL_AC_BINARIES,
    pub workingDirectory: *mut core::ffi::c_void,
    pub packageFullName: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type INET_FIREWALL_AC_CAPABILITIES struct {
	count uint32
	capabilities uintptr
}

type INET_FIREWALL_AC_BINARIES struct {
	count uint32
	binaries uintptr
}

type INET_FIREWALL_APP_CONTAINER struct {
	appContainerSid uintptr
	userSid uintptr
	appContainerName uintptr
	displayName uintptr
	description uintptr
	capabilities INET_FIREWALL_AC_CAPABILITIES
	binaries INET_FIREWALL_AC_BINARIES
	workingDirectory uintptr
	packageFullName uintptr
}
type
  INET_FIREWALL_AC_CAPABILITIES = record
    count: DWORD;
    capabilities: Pointer;
  end;

  INET_FIREWALL_AC_BINARIES = record
    count: DWORD;
    binaries: Pointer;
  end;

  INET_FIREWALL_APP_CONTAINER = record
    appContainerSid: Pointer;
    userSid: Pointer;
    appContainerName: Pointer;
    displayName: Pointer;
    description: Pointer;
    capabilities: INET_FIREWALL_AC_CAPABILITIES;
    binaries: INET_FIREWALL_AC_BINARIES;
    workingDirectory: Pointer;
    packageFullName: Pointer;
  end;
const INET_FIREWALL_AC_CAPABILITIES = extern struct {
    count: u32,
    capabilities: ?*anyopaque,
};

const INET_FIREWALL_AC_BINARIES = extern struct {
    count: u32,
    binaries: ?*anyopaque,
};

const INET_FIREWALL_APP_CONTAINER = extern struct {
    appContainerSid: ?*anyopaque,
    userSid: ?*anyopaque,
    appContainerName: ?*anyopaque,
    displayName: ?*anyopaque,
    description: ?*anyopaque,
    capabilities: INET_FIREWALL_AC_CAPABILITIES,
    binaries: INET_FIREWALL_AC_BINARIES,
    workingDirectory: ?*anyopaque,
    packageFullName: ?*anyopaque,
};
type
  INET_FIREWALL_AC_CAPABILITIES {.bycopy.} = object
    count: uint32
    capabilities: pointer

  INET_FIREWALL_AC_BINARIES {.bycopy.} = object
    count: uint32
    binaries: pointer

  INET_FIREWALL_APP_CONTAINER {.bycopy.} = object
    appContainerSid: pointer
    userSid: pointer
    appContainerName: pointer
    displayName: pointer
    description: pointer
    capabilities: INET_FIREWALL_AC_CAPABILITIES
    binaries: INET_FIREWALL_AC_BINARIES
    workingDirectory: pointer
    packageFullName: pointer
struct INET_FIREWALL_AC_CAPABILITIES
{
    uint count;
    void* capabilities;
}

struct INET_FIREWALL_AC_BINARIES
{
    uint count;
    void* binaries;
}

struct INET_FIREWALL_APP_CONTAINER
{
    void* appContainerSid;
    void* userSid;
    void* appContainerName;
    void* displayName;
    void* description;
    INET_FIREWALL_AC_CAPABILITIES capabilities;
    INET_FIREWALL_AC_BINARIES binaries;
    void* workingDirectory;
    void* packageFullName;
}

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_APP_CONTAINER サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; appContainerSid : SID* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; userSid : SID* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; appContainerName : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; displayName : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; description : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; capabilities : INET_FIREWALL_AC_CAPABILITIES (+20, 8byte)  varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; binaries : INET_FIREWALL_AC_BINARIES (+28, 8byte)  varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; workingDirectory : LPWSTR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; packageFullName : LPWSTR (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; INET_FIREWALL_APP_CONTAINER サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; appContainerSid : SID* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; userSid : SID* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; appContainerName : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; displayName : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; description : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; capabilities : INET_FIREWALL_AC_CAPABILITIES (+40, 16byte)  varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; binaries : INET_FIREWALL_AC_BINARIES (+56, 16byte)  varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; workingDirectory : LPWSTR (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; packageFullName : LPWSTR (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global INET_FIREWALL_AC_CAPABILITIES
    #field int count
    #field intptr capabilities
#endstruct

#defstruct global INET_FIREWALL_AC_BINARIES
    #field int count
    #field intptr binaries
#endstruct

#defstruct global INET_FIREWALL_APP_CONTAINER
    #field intptr appContainerSid
    #field intptr userSid
    #field intptr appContainerName
    #field intptr displayName
    #field intptr description
    #field INET_FIREWALL_AC_CAPABILITIES capabilities
    #field INET_FIREWALL_AC_BINARIES binaries
    #field intptr workingDirectory
    #field intptr packageFullName
#endstruct

stdim st, INET_FIREWALL_APP_CONTAINER        ; NSTRUCT 変数を確保