Win32 API 日本語リファレンス
ホームStorage.FileSystem › VOLUME_SET_GPT_ATTRIBUTES_INFORMATION

VOLUME_SET_GPT_ATTRIBUTES_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
GptAttributesULONGLONG8+0+0設定するGPTパーティション属性のビットフラグ。64ビット。
RevertOnCloseBOOLEAN1+8+8ハンドルクローズ時に属性を元に戻すかを示すブール値。
ApplyToAllConnectedVolumesBOOLEAN1+9+9接続中の全ボリュームに適用するかを示すブール値。
Reserved1WORD2+10+10予約フィールド。0を指定する。
Reserved2DWORD4+12+12予約フィールド。0を指定する。

各言語での定義

#include <windows.h>

// VOLUME_SET_GPT_ATTRIBUTES_INFORMATION  (x64 16 / x86 16 バイト)
typedef struct VOLUME_SET_GPT_ATTRIBUTES_INFORMATION {
    ULONGLONG GptAttributes;
    BOOLEAN RevertOnClose;
    BOOLEAN ApplyToAllConnectedVolumes;
    WORD Reserved1;
    DWORD Reserved2;
} VOLUME_SET_GPT_ATTRIBUTES_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VOLUME_SET_GPT_ATTRIBUTES_INFORMATION
{
    public ulong GptAttributes;
    [MarshalAs(UnmanagedType.U1)] public bool RevertOnClose;
    [MarshalAs(UnmanagedType.U1)] public bool ApplyToAllConnectedVolumes;
    public ushort Reserved1;
    public uint Reserved2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VOLUME_SET_GPT_ATTRIBUTES_INFORMATION
    Public GptAttributes As ULong
    <MarshalAs(UnmanagedType.U1)> Public RevertOnClose As Boolean
    <MarshalAs(UnmanagedType.U1)> Public ApplyToAllConnectedVolumes As Boolean
    Public Reserved1 As UShort
    Public Reserved2 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class VOLUME_SET_GPT_ATTRIBUTES_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("GptAttributes", ctypes.c_ulonglong),
        ("RevertOnClose", ctypes.c_byte),
        ("ApplyToAllConnectedVolumes", ctypes.c_byte),
        ("Reserved1", ctypes.c_ushort),
        ("Reserved2", wintypes.DWORD),
    ]
#[repr(C)]
pub struct VOLUME_SET_GPT_ATTRIBUTES_INFORMATION {
    pub GptAttributes: u64,
    pub RevertOnClose: u8,
    pub ApplyToAllConnectedVolumes: u8,
    pub Reserved1: u16,
    pub Reserved2: u32,
}
import "golang.org/x/sys/windows"

type VOLUME_SET_GPT_ATTRIBUTES_INFORMATION struct {
	GptAttributes uint64
	RevertOnClose byte
	ApplyToAllConnectedVolumes byte
	Reserved1 uint16
	Reserved2 uint32
}
type
  VOLUME_SET_GPT_ATTRIBUTES_INFORMATION = record
    GptAttributes: UInt64;
    RevertOnClose: ByteBool;
    ApplyToAllConnectedVolumes: ByteBool;
    Reserved1: Word;
    Reserved2: DWORD;
  end;
const VOLUME_SET_GPT_ATTRIBUTES_INFORMATION = extern struct {
    GptAttributes: u64,
    RevertOnClose: u8,
    ApplyToAllConnectedVolumes: u8,
    Reserved1: u16,
    Reserved2: u32,
};
type
  VOLUME_SET_GPT_ATTRIBUTES_INFORMATION {.bycopy.} = object
    GptAttributes: uint64
    RevertOnClose: uint8
    ApplyToAllConnectedVolumes: uint8
    Reserved1: uint16
    Reserved2: uint32
struct VOLUME_SET_GPT_ATTRIBUTES_INFORMATION
{
    ulong GptAttributes;
    ubyte RevertOnClose;
    ubyte ApplyToAllConnectedVolumes;
    ushort Reserved1;
    uint Reserved2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VOLUME_SET_GPT_ATTRIBUTES_INFORMATION サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; GptAttributes : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; RevertOnClose : BOOLEAN (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; ApplyToAllConnectedVolumes : BOOLEAN (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; Reserved1 : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; Reserved2 : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VOLUME_SET_GPT_ATTRIBUTES_INFORMATION
    #field int64 GptAttributes
    #field bool1 RevertOnClose
    #field bool1 ApplyToAllConnectedVolumes
    #field short Reserved1
    #field int Reserved2
#endstruct

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