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

NTMS_LIBREQUESTINFORMATIONW

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

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

フィールド

フィールドサイズx64x86説明
OperationCodeDWORD4+0+0要求された操作のコード。マウント/ディスマウント等。
OperationOptionDWORD4+4+4操作に付随するオプションを示す値。
StateDWORD4+8+8ライブラリ要求の状態を示す値。
PartitionIdGUID16+12+12対象パーティションを識別するGUID。
DriveIdGUID16+28+28対象ドライブを識別するGUID。
PhysMediaIdGUID16+44+44対象物理メディアを識別するGUID。
LibraryGUID16+60+60対象ライブラリを識別するGUID。
SlotIdGUID16+76+76対象スロットを識別するGUID。
TimeQueuedSYSTEMTIME16+92+92要求がキューに入った日時。SYSTEMTIME。
TimeCompletedSYSTEMTIME16+108+108要求が完了した日時。SYSTEMTIME。
szApplicationWCHAR128+124+124要求元アプリケーション名。Unicode。
szUserWCHAR128+252+252要求元ユーザー名。Unicode。
szComputerWCHAR128+380+380要求元コンピュータ名。Unicode。
dwErrorCodeDWORD4+508+508要求のエラーコード。
WorkItemIdGUID16+512+512作業項目を識別するGUID。
dwPriorityDWORD4+528+528要求の優先度。

各言語での定義

#include <windows.h>

// SYSTEMTIME  (x64 16 / x86 16 バイト)
typedef struct SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME;

// NTMS_LIBREQUESTINFORMATIONW  (x64 532 / x86 532 バイト)
typedef struct NTMS_LIBREQUESTINFORMATIONW {
    DWORD OperationCode;
    DWORD OperationOption;
    DWORD State;
    GUID PartitionId;
    GUID DriveId;
    GUID PhysMediaId;
    GUID Library;
    GUID SlotId;
    SYSTEMTIME TimeQueued;
    SYSTEMTIME TimeCompleted;
    WCHAR szApplication[64];
    WCHAR szUser[64];
    WCHAR szComputer[64];
    DWORD dwErrorCode;
    GUID WorkItemId;
    DWORD dwPriority;
} NTMS_LIBREQUESTINFORMATIONW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEMTIME
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDayOfWeek;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTMS_LIBREQUESTINFORMATIONW
{
    public uint OperationCode;
    public uint OperationOption;
    public uint State;
    public Guid PartitionId;
    public Guid DriveId;
    public Guid PhysMediaId;
    public Guid Library;
    public Guid SlotId;
    public SYSTEMTIME TimeQueued;
    public SYSTEMTIME TimeCompleted;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szApplication;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szUser;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szComputer;
    public uint dwErrorCode;
    public Guid WorkItemId;
    public uint dwPriority;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEMTIME
    Public wYear As UShort
    Public wMonth As UShort
    Public wDayOfWeek As UShort
    Public wDay As UShort
    Public wHour As UShort
    Public wMinute As UShort
    Public wSecond As UShort
    Public wMilliseconds As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTMS_LIBREQUESTINFORMATIONW
    Public OperationCode As UInteger
    Public OperationOption As UInteger
    Public State As UInteger
    Public PartitionId As Guid
    Public DriveId As Guid
    Public PhysMediaId As Guid
    Public Library As Guid
    Public SlotId As Guid
    Public TimeQueued As SYSTEMTIME
    Public TimeCompleted As SYSTEMTIME
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szApplication As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szUser As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szComputer As String
    Public dwErrorCode As UInteger
    Public WorkItemId As Guid
    Public dwPriority As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SYSTEMTIME(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", ctypes.c_ushort),
        ("wDayOfWeek", ctypes.c_ushort),
        ("wDay", ctypes.c_ushort),
        ("wHour", ctypes.c_ushort),
        ("wMinute", ctypes.c_ushort),
        ("wSecond", ctypes.c_ushort),
        ("wMilliseconds", ctypes.c_ushort),
    ]

class NTMS_LIBREQUESTINFORMATIONW(ctypes.Structure):
    _fields_ = [
        ("OperationCode", wintypes.DWORD),
        ("OperationOption", wintypes.DWORD),
        ("State", wintypes.DWORD),
        ("PartitionId", GUID),
        ("DriveId", GUID),
        ("PhysMediaId", GUID),
        ("Library", GUID),
        ("SlotId", GUID),
        ("TimeQueued", SYSTEMTIME),
        ("TimeCompleted", SYSTEMTIME),
        ("szApplication", ctypes.c_wchar * 64),
        ("szUser", ctypes.c_wchar * 64),
        ("szComputer", ctypes.c_wchar * 64),
        ("dwErrorCode", wintypes.DWORD),
        ("WorkItemId", GUID),
        ("dwPriority", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SYSTEMTIME {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDayOfWeek: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}

#[repr(C)]
pub struct NTMS_LIBREQUESTINFORMATIONW {
    pub OperationCode: u32,
    pub OperationOption: u32,
    pub State: u32,
    pub PartitionId: GUID,
    pub DriveId: GUID,
    pub PhysMediaId: GUID,
    pub Library: GUID,
    pub SlotId: GUID,
    pub TimeQueued: SYSTEMTIME,
    pub TimeCompleted: SYSTEMTIME,
    pub szApplication: [u16; 64],
    pub szUser: [u16; 64],
    pub szComputer: [u16; 64],
    pub dwErrorCode: u32,
    pub WorkItemId: GUID,
    pub dwPriority: u32,
}
import "golang.org/x/sys/windows"

type SYSTEMTIME struct {
	wYear uint16
	wMonth uint16
	wDayOfWeek uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}

type NTMS_LIBREQUESTINFORMATIONW struct {
	OperationCode uint32
	OperationOption uint32
	State uint32
	PartitionId windows.GUID
	DriveId windows.GUID
	PhysMediaId windows.GUID
	Library windows.GUID
	SlotId windows.GUID
	TimeQueued SYSTEMTIME
	TimeCompleted SYSTEMTIME
	szApplication [64]uint16
	szUser [64]uint16
	szComputer [64]uint16
	dwErrorCode uint32
	WorkItemId windows.GUID
	dwPriority uint32
}
type
  SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;

  NTMS_LIBREQUESTINFORMATIONW = record
    OperationCode: DWORD;
    OperationOption: DWORD;
    State: DWORD;
    PartitionId: TGUID;
    DriveId: TGUID;
    PhysMediaId: TGUID;
    Library: TGUID;
    SlotId: TGUID;
    TimeQueued: SYSTEMTIME;
    TimeCompleted: SYSTEMTIME;
    szApplication: array[0..63] of WideChar;
    szUser: array[0..63] of WideChar;
    szComputer: array[0..63] of WideChar;
    dwErrorCode: DWORD;
    WorkItemId: TGUID;
    dwPriority: DWORD;
  end;
const SYSTEMTIME = extern struct {
    wYear: u16,
    wMonth: u16,
    wDayOfWeek: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};

const NTMS_LIBREQUESTINFORMATIONW = extern struct {
    OperationCode: u32,
    OperationOption: u32,
    State: u32,
    PartitionId: GUID,
    DriveId: GUID,
    PhysMediaId: GUID,
    Library: GUID,
    SlotId: GUID,
    TimeQueued: SYSTEMTIME,
    TimeCompleted: SYSTEMTIME,
    szApplication: [64]u16,
    szUser: [64]u16,
    szComputer: [64]u16,
    dwErrorCode: u32,
    WorkItemId: GUID,
    dwPriority: u32,
};
type
  SYSTEMTIME {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDayOfWeek: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16

  NTMS_LIBREQUESTINFORMATIONW {.bycopy.} = object
    OperationCode: uint32
    OperationOption: uint32
    State: uint32
    PartitionId: GUID
    DriveId: GUID
    PhysMediaId: GUID
    Library: GUID
    SlotId: GUID
    TimeQueued: SYSTEMTIME
    TimeCompleted: SYSTEMTIME
    szApplication: array[64, uint16]
    szUser: array[64, uint16]
    szComputer: array[64, uint16]
    dwErrorCode: uint32
    WorkItemId: GUID
    dwPriority: uint32
struct SYSTEMTIME
{
    ushort wYear;
    ushort wMonth;
    ushort wDayOfWeek;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
}

struct NTMS_LIBREQUESTINFORMATIONW
{
    uint OperationCode;
    uint OperationOption;
    uint State;
    GUID PartitionId;
    GUID DriveId;
    GUID PhysMediaId;
    GUID Library;
    GUID SlotId;
    SYSTEMTIME TimeQueued;
    SYSTEMTIME TimeCompleted;
    wchar[64] szApplication;
    wchar[64] szUser;
    wchar[64] szComputer;
    uint dwErrorCode;
    GUID WorkItemId;
    uint dwPriority;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NTMS_LIBREQUESTINFORMATIONW サイズ: 532 バイト(x64)
dim st, 133    ; 4byte整数×133(構造体サイズ 532 / 4 切り上げ)
; OperationCode : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; OperationOption : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; State : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; PartitionId : GUID (+12, 16byte)  varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; DriveId : GUID (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; PhysMediaId : GUID (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; Library : GUID (+60, 16byte)  varptr(st)+60 を基点に操作(16byte:入れ子/配列)
; SlotId : GUID (+76, 16byte)  varptr(st)+76 を基点に操作(16byte:入れ子/配列)
; TimeQueued : SYSTEMTIME (+92, 16byte)  varptr(st)+92 を基点に操作(16byte:入れ子/配列)
; TimeCompleted : SYSTEMTIME (+108, 16byte)  varptr(st)+108 を基点に操作(16byte:入れ子/配列)
; szApplication : WCHAR (+124, 128byte)  varptr(st)+124 を基点に操作(128byte:入れ子/配列)
; szUser : WCHAR (+252, 128byte)  varptr(st)+252 を基点に操作(128byte:入れ子/配列)
; szComputer : WCHAR (+380, 128byte)  varptr(st)+380 を基点に操作(128byte:入れ子/配列)
; dwErrorCode : DWORD (+508, 4byte)  st.127 = 値  /  値 = st.127   (lpoke/lpeek も可)
; WorkItemId : GUID (+512, 16byte)  varptr(st)+512 を基点に操作(16byte:入れ子/配列)
; dwPriority : DWORD (+528, 4byte)  st.132 = 値  /  値 = st.132   (lpoke/lpeek も可)
; ※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 SYSTEMTIME
    #field short wYear
    #field short wMonth
    #field short wDayOfWeek
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
#endstruct

#defstruct global NTMS_LIBREQUESTINFORMATIONW
    #field int OperationCode
    #field int OperationOption
    #field int State
    #field GUID PartitionId
    #field GUID DriveId
    #field GUID PhysMediaId
    #field GUID Library
    #field GUID SlotId
    #field SYSTEMTIME TimeQueued
    #field SYSTEMTIME TimeCompleted
    #field wchar szApplication 64
    #field wchar szUser 64
    #field wchar szComputer 64
    #field int dwErrorCode
    #field GUID WorkItemId
    #field int dwPriority
#endstruct

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