NTMS_LIBREQUESTINFORMATIONW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OperationCode | DWORD | 4 | +0 | +0 | 項目の操作です。次のいずれかの値を指定できます。 | ||||||||||||||||
| OperationOption | DWORD | 4 | +4 | +4 | 作業項目のオプションです (コマンド固有)。 | ||||||||||||||||
| State | DWORD | 4 | +8 | +8 | この作業項目の現在の状態です。次のいずれかの値になります。
| ||||||||||||||||
| PartitionId | GUID | 16 | +12 | +12 | 処理対象のサイドの一意な識別子です。 | ||||||||||||||||
| DriveId | GUID | 16 | +28 | +28 | 処理対象のドライブの一意な識別子です。 | ||||||||||||||||
| PhysMediaId | GUID | 16 | +44 | +44 | 処理対象の物理メディアの一意な識別子です。 | ||||||||||||||||
| Library | GUID | 16 | +60 | +60 | この要求の対象となるライブラリです。 | ||||||||||||||||
| SlotId | GUID | 16 | +76 | +76 | 処理対象の物理メディアが格納されているスロットの一意な識別子です。 | ||||||||||||||||
| TimeQueued | SYSTEMTIME | 16 | +92 | +92 | この要求が RSM にキューイングされたシステム時刻です。 | ||||||||||||||||
| TimeCompleted | SYSTEMTIME | 16 | +108 | +108 | この要求が RSM によって完了したシステム時刻です。 | ||||||||||||||||
| szApplication | WCHAR | 128 | +124 | +124 | オペレーター要求を送信したアプリケーションです。 | ||||||||||||||||
| szUser | WCHAR | 128 | +252 | +252 | オペレーター要求を送信したコンピューターにログオンしている対話ユーザーです。 | ||||||||||||||||
| szComputer | WCHAR | 128 | +380 | +380 | オペレーター要求を送信したコンピューターです。 | ||||||||||||||||
| dwErrorCode | DWORD | 4 | +508 | +508 | 状態 NTMS_LM_FAILED で返された要求のエラー戻り値です。これは システム エラー コード です。 | ||||||||||||||||
| WorkItemId | GUID | 16 | +512 | +512 | この要求に関連付けられた作業項目 ID です。現在は、NTMS_LM_REMOVE 要求でキャンセルする作業項目 ID を格納するために使用されます。 | ||||||||||||||||
| dwPriority | DWORD | 4 | +528 | +528 | 作業項目の優先度です。 |
公式ドキュメント
[リムーバブル記憶域マネージャー は Windows 7 および Windows Server 2008 R2 以降では利用できません。]
NTMS_LIBREQUESTINFORMATION 構造体は、RSM にキューイングされる作業要求に固有のプロパティを定義します。
解説(Remarks)
NTMS_LIBREQUESTINFORMATION 構造体は NTMS_OBJECTINFORMATION 構造体に含まれます。
作業項目内の GUID は、時間の経過とともに無効になることがあります。たとえば、空きメディアの取り出しでは、メディアの取り出し後に PMID が削除されます。しかし、取り出しの完了時に作業項目は更新されません。
ntmsapi.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版と Unicode 版を自動的に選択するエイリアスとして NTMS_LIBREQUESTINFORMATION を定義します。エンコーディング中立のエイリアスと、エンコーディング中立でないコードを混在させて使用すると、不一致が生じ、コンパイル エラーや実行時エラーの原因となることがあります。詳細については、関数プロトタイプの規則 を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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 Structureimport 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: uint32struct 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