ホーム › Storage.FileSystem › NTMS_DRIVETYPEINFORMATIONW
NTMS_DRIVETYPEINFORMATIONW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| szVendor | WCHAR | 256 | +0 | +0 | ドライブのベンダー名。Unicode。 |
| szProduct | WCHAR | 256 | +256 | +256 | ドライブの製品名。Unicode。 |
| NumberOfHeads | DWORD | 4 | +512 | +512 | ドライブのヘッド数。 |
| DeviceType | FILE_DEVICE_TYPE | 4 | +516 | +516 | ドライブのデバイス種別。FILE_DEVICE_*。 |
各言語での定義
#include <windows.h>
// NTMS_DRIVETYPEINFORMATIONW (x64 520 / x86 520 バイト)
typedef struct NTMS_DRIVETYPEINFORMATIONW {
WCHAR szVendor[128];
WCHAR szProduct[128];
DWORD NumberOfHeads;
FILE_DEVICE_TYPE DeviceType;
} NTMS_DRIVETYPEINFORMATIONW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTMS_DRIVETYPEINFORMATIONW
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szVendor;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szProduct;
public uint NumberOfHeads;
public uint DeviceType;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTMS_DRIVETYPEINFORMATIONW
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public szVendor As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public szProduct As String
Public NumberOfHeads As UInteger
Public DeviceType As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NTMS_DRIVETYPEINFORMATIONW(ctypes.Structure):
_fields_ = [
("szVendor", ctypes.c_wchar * 128),
("szProduct", ctypes.c_wchar * 128),
("NumberOfHeads", wintypes.DWORD),
("DeviceType", wintypes.DWORD),
]#[repr(C)]
pub struct NTMS_DRIVETYPEINFORMATIONW {
pub szVendor: [u16; 128],
pub szProduct: [u16; 128],
pub NumberOfHeads: u32,
pub DeviceType: u32,
}import "golang.org/x/sys/windows"
type NTMS_DRIVETYPEINFORMATIONW struct {
szVendor [128]uint16
szProduct [128]uint16
NumberOfHeads uint32
DeviceType uint32
}type
NTMS_DRIVETYPEINFORMATIONW = record
szVendor: array[0..127] of WideChar;
szProduct: array[0..127] of WideChar;
NumberOfHeads: DWORD;
DeviceType: DWORD;
end;const NTMS_DRIVETYPEINFORMATIONW = extern struct {
szVendor: [128]u16,
szProduct: [128]u16,
NumberOfHeads: u32,
DeviceType: u32,
};type
NTMS_DRIVETYPEINFORMATIONW {.bycopy.} = object
szVendor: array[128, uint16]
szProduct: array[128, uint16]
NumberOfHeads: uint32
DeviceType: uint32struct NTMS_DRIVETYPEINFORMATIONW
{
wchar[128] szVendor;
wchar[128] szProduct;
uint NumberOfHeads;
uint DeviceType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NTMS_DRIVETYPEINFORMATIONW サイズ: 520 バイト(x64)
dim st, 130 ; 4byte整数×130(構造体サイズ 520 / 4 切り上げ)
; szVendor : WCHAR (+0, 256byte) varptr(st)+0 を基点に操作(256byte:入れ子/配列)
; szProduct : WCHAR (+256, 256byte) varptr(st)+256 を基点に操作(256byte:入れ子/配列)
; NumberOfHeads : DWORD (+512, 4byte) st.128 = 値 / 値 = st.128 (lpoke/lpeek も可)
; DeviceType : FILE_DEVICE_TYPE (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NTMS_DRIVETYPEINFORMATIONW
#field wchar szVendor 128
#field wchar szProduct 128
#field int NumberOfHeads
#field int DeviceType
#endstruct
stdim st, NTMS_DRIVETYPEINFORMATIONW ; NSTRUCT 変数を確保
st->NumberOfHeads = 100
mes "NumberOfHeads=" + st->NumberOfHeads