Win32 API 日本語リファレンス
ホームSystem.Com.Urlmon › ZONEATTRIBUTES

ZONEATTRIBUTES

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のバイトサイズ。
szDisplayNameWCHAR520+4+4セキュリティゾーンの表示名(ワイド文字配列)。
szDescriptionWCHAR400+524+524セキュリティゾーンの説明文(ワイド文字配列)。
szIconPathWCHAR520+924+924ゾーンを表すアイコンのパス(ワイド文字配列)。
dwTemplateMinLevelDWORD4+1444+1444適用可能な最小セキュリティテンプレートレベル。
dwTemplateRecommendedDWORD4+1448+1448推奨されるセキュリティテンプレートレベル。
dwTemplateCurrentLevelDWORD4+1452+1452現在設定されているセキュリティテンプレートレベル。
dwFlagsDWORD4+1456+1456ゾーンの表示・動作を制御するフラグ。

各言語での定義

#include <windows.h>

// ZONEATTRIBUTES  (x64 1460 / x86 1460 バイト)
typedef struct ZONEATTRIBUTES {
    DWORD cbSize;
    WCHAR szDisplayName[260];
    WCHAR szDescription[200];
    WCHAR szIconPath[260];
    DWORD dwTemplateMinLevel;
    DWORD dwTemplateRecommended;
    DWORD dwTemplateCurrentLevel;
    DWORD dwFlags;
} ZONEATTRIBUTES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ZONEATTRIBUTES
{
    public uint cbSize;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDisplayName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 200)] public string szDescription;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szIconPath;
    public uint dwTemplateMinLevel;
    public uint dwTemplateRecommended;
    public uint dwTemplateCurrentLevel;
    public uint dwFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ZONEATTRIBUTES
    Public cbSize As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDisplayName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=200)> Public szDescription As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szIconPath As String
    Public dwTemplateMinLevel As UInteger
    Public dwTemplateRecommended As UInteger
    Public dwTemplateCurrentLevel As UInteger
    Public dwFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class ZONEATTRIBUTES(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("szDisplayName", ctypes.c_wchar * 260),
        ("szDescription", ctypes.c_wchar * 200),
        ("szIconPath", ctypes.c_wchar * 260),
        ("dwTemplateMinLevel", wintypes.DWORD),
        ("dwTemplateRecommended", wintypes.DWORD),
        ("dwTemplateCurrentLevel", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct ZONEATTRIBUTES {
    pub cbSize: u32,
    pub szDisplayName: [u16; 260],
    pub szDescription: [u16; 200],
    pub szIconPath: [u16; 260],
    pub dwTemplateMinLevel: u32,
    pub dwTemplateRecommended: u32,
    pub dwTemplateCurrentLevel: u32,
    pub dwFlags: u32,
}
import "golang.org/x/sys/windows"

type ZONEATTRIBUTES struct {
	cbSize uint32
	szDisplayName [260]uint16
	szDescription [200]uint16
	szIconPath [260]uint16
	dwTemplateMinLevel uint32
	dwTemplateRecommended uint32
	dwTemplateCurrentLevel uint32
	dwFlags uint32
}
type
  ZONEATTRIBUTES = record
    cbSize: DWORD;
    szDisplayName: array[0..259] of WideChar;
    szDescription: array[0..199] of WideChar;
    szIconPath: array[0..259] of WideChar;
    dwTemplateMinLevel: DWORD;
    dwTemplateRecommended: DWORD;
    dwTemplateCurrentLevel: DWORD;
    dwFlags: DWORD;
  end;
const ZONEATTRIBUTES = extern struct {
    cbSize: u32,
    szDisplayName: [260]u16,
    szDescription: [200]u16,
    szIconPath: [260]u16,
    dwTemplateMinLevel: u32,
    dwTemplateRecommended: u32,
    dwTemplateCurrentLevel: u32,
    dwFlags: u32,
};
type
  ZONEATTRIBUTES {.bycopy.} = object
    cbSize: uint32
    szDisplayName: array[260, uint16]
    szDescription: array[200, uint16]
    szIconPath: array[260, uint16]
    dwTemplateMinLevel: uint32
    dwTemplateRecommended: uint32
    dwTemplateCurrentLevel: uint32
    dwFlags: uint32
struct ZONEATTRIBUTES
{
    uint cbSize;
    wchar[260] szDisplayName;
    wchar[200] szDescription;
    wchar[260] szIconPath;
    uint dwTemplateMinLevel;
    uint dwTemplateRecommended;
    uint dwTemplateCurrentLevel;
    uint dwFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ZONEATTRIBUTES サイズ: 1460 バイト(x64)
dim st, 365    ; 4byte整数×365(構造体サイズ 1460 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; szDisplayName : WCHAR (+4, 520byte)  varptr(st)+4 を基点に操作(520byte:入れ子/配列)
; szDescription : WCHAR (+524, 400byte)  varptr(st)+524 を基点に操作(400byte:入れ子/配列)
; szIconPath : WCHAR (+924, 520byte)  varptr(st)+924 を基点に操作(520byte:入れ子/配列)
; dwTemplateMinLevel : DWORD (+1444, 4byte)  st.361 = 値  /  値 = st.361   (lpoke/lpeek も可)
; dwTemplateRecommended : DWORD (+1448, 4byte)  st.362 = 値  /  値 = st.362   (lpoke/lpeek も可)
; dwTemplateCurrentLevel : DWORD (+1452, 4byte)  st.363 = 値  /  値 = st.363   (lpoke/lpeek も可)
; dwFlags : DWORD (+1456, 4byte)  st.364 = 値  /  値 = st.364   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ZONEATTRIBUTES
    #field int cbSize
    #field wchar szDisplayName 260
    #field wchar szDescription 200
    #field wchar szIconPath 260
    #field int dwTemplateMinLevel
    #field int dwTemplateRecommended
    #field int dwTemplateCurrentLevel
    #field int dwFlags
#endstruct

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