ホーム › System.Ioctl › SET_DISK_ATTRIBUTES
SET_DISK_ATTRIBUTES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | この構造体のバージョン番号。 |
| Persist | BOOLEAN | 1 | +4 | +4 | 属性変更を永続化するかどうかを示す真偽値。 |
| Reserved1 | BYTE | 3 | +5 | +5 | 予約領域。ゼロを設定する。 |
| Attributes | ULONGLONG | 8 | +8 | +8 | 設定するディスク属性のビットマスク。 |
| AttributesMask | ULONGLONG | 8 | +16 | +16 | 変更対象とする属性ビットを指定するマスク。 |
| Reserved2 | DWORD | 16 | +24 | +24 | 予約領域。ゼロを設定する。 |
各言語での定義
#include <windows.h>
// SET_DISK_ATTRIBUTES (x64 40 / x86 40 バイト)
typedef struct SET_DISK_ATTRIBUTES {
DWORD Version;
BOOLEAN Persist;
BYTE Reserved1[3];
ULONGLONG Attributes;
ULONGLONG AttributesMask;
DWORD Reserved2[4];
} SET_DISK_ATTRIBUTES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SET_DISK_ATTRIBUTES
{
public uint Version;
[MarshalAs(UnmanagedType.U1)] public bool Persist;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved1;
public ulong Attributes;
public ulong AttributesMask;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] Reserved2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SET_DISK_ATTRIBUTES
Public Version As UInteger
<MarshalAs(UnmanagedType.U1)> Public Persist As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved1() As Byte
Public Attributes As ULong
Public AttributesMask As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Reserved2() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SET_DISK_ATTRIBUTES(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Persist", ctypes.c_byte),
("Reserved1", ctypes.c_ubyte * 3),
("Attributes", ctypes.c_ulonglong),
("AttributesMask", ctypes.c_ulonglong),
("Reserved2", wintypes.DWORD * 4),
]#[repr(C)]
pub struct SET_DISK_ATTRIBUTES {
pub Version: u32,
pub Persist: u8,
pub Reserved1: [u8; 3],
pub Attributes: u64,
pub AttributesMask: u64,
pub Reserved2: [u32; 4],
}import "golang.org/x/sys/windows"
type SET_DISK_ATTRIBUTES struct {
Version uint32
Persist byte
Reserved1 [3]byte
Attributes uint64
AttributesMask uint64
Reserved2 [4]uint32
}type
SET_DISK_ATTRIBUTES = record
Version: DWORD;
Persist: ByteBool;
Reserved1: array[0..2] of Byte;
Attributes: UInt64;
AttributesMask: UInt64;
Reserved2: array[0..3] of DWORD;
end;const SET_DISK_ATTRIBUTES = extern struct {
Version: u32,
Persist: u8,
Reserved1: [3]u8,
Attributes: u64,
AttributesMask: u64,
Reserved2: [4]u32,
};type
SET_DISK_ATTRIBUTES {.bycopy.} = object
Version: uint32
Persist: uint8
Reserved1: array[3, uint8]
Attributes: uint64
AttributesMask: uint64
Reserved2: array[4, uint32]struct SET_DISK_ATTRIBUTES
{
uint Version;
ubyte Persist;
ubyte[3] Reserved1;
ulong Attributes;
ulong AttributesMask;
uint[4] Reserved2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SET_DISK_ATTRIBUTES サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Persist : BOOLEAN (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; Reserved1 : BYTE (+5, 3byte) varptr(st)+5 を基点に操作(3byte:入れ子/配列)
; Attributes : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; AttributesMask : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Reserved2 : DWORD (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SET_DISK_ATTRIBUTES
#field int Version
#field bool1 Persist
#field byte Reserved1 3
#field int64 Attributes
#field int64 AttributesMask
#field int Reserved2 4
#endstruct
stdim st, SET_DISK_ATTRIBUTES ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version