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

NTMS_IEPORTINFORMATION

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

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

フィールド

フィールドサイズx64x86説明
NumberDWORD4+0+0I/Eポート番号。
ContentDWORD4+4+4ポートの内容状態を示す値。空/メディアあり等。
PositionDWORD4+8+8ポートの位置状態を示す値。挿入/取り出し位置等。
MaxExtendSecsWORD2+12+12ポートを引き出したままにできる最大時間。秒単位。
LibraryGUID16+16+16ポートが属するライブラリのGUID。

各言語での定義

#include <windows.h>

// NTMS_IEPORTINFORMATION  (x64 32 / x86 32 バイト)
typedef struct NTMS_IEPORTINFORMATION {
    DWORD Number;
    DWORD Content;
    DWORD Position;
    WORD MaxExtendSecs;
    GUID Library;
} NTMS_IEPORTINFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTMS_IEPORTINFORMATION
{
    public uint Number;
    public uint Content;
    public uint Position;
    public ushort MaxExtendSecs;
    public Guid Library;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTMS_IEPORTINFORMATION
    Public Number As UInteger
    Public Content As UInteger
    Public Position As UInteger
    Public MaxExtendSecs As UShort
    Public Library As Guid
End Structure
import ctypes
from ctypes import wintypes

class NTMS_IEPORTINFORMATION(ctypes.Structure):
    _fields_ = [
        ("Number", wintypes.DWORD),
        ("Content", wintypes.DWORD),
        ("Position", wintypes.DWORD),
        ("MaxExtendSecs", ctypes.c_ushort),
        ("Library", GUID),
    ]
#[repr(C)]
pub struct NTMS_IEPORTINFORMATION {
    pub Number: u32,
    pub Content: u32,
    pub Position: u32,
    pub MaxExtendSecs: u16,
    pub Library: GUID,
}
import "golang.org/x/sys/windows"

type NTMS_IEPORTINFORMATION struct {
	Number uint32
	Content uint32
	Position uint32
	MaxExtendSecs uint16
	Library windows.GUID
}
type
  NTMS_IEPORTINFORMATION = record
    Number: DWORD;
    Content: DWORD;
    Position: DWORD;
    MaxExtendSecs: Word;
    Library: TGUID;
  end;
const NTMS_IEPORTINFORMATION = extern struct {
    Number: u32,
    Content: u32,
    Position: u32,
    MaxExtendSecs: u16,
    Library: GUID,
};
type
  NTMS_IEPORTINFORMATION {.bycopy.} = object
    Number: uint32
    Content: uint32
    Position: uint32
    MaxExtendSecs: uint16
    Library: GUID
struct NTMS_IEPORTINFORMATION
{
    uint Number;
    uint Content;
    uint Position;
    ushort MaxExtendSecs;
    GUID Library;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NTMS_IEPORTINFORMATION サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Number : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Content : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Position : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; MaxExtendSecs : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; Library : GUID (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global NTMS_IEPORTINFORMATION
    #field int Number
    #field int Content
    #field int Position
    #field short MaxExtendSecs
    #field GUID Library
#endstruct

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