NTMS_OPREQUESTINFORMATIONW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Request | DWORD | 4 | +0 | +0 | オペレーター要求の種類です。次のいずれかの値を指定できます。 | ||||||||||||||||||||
| Submitted | SYSTEMTIME | 16 | +4 | +4 | オペレーター要求が送信されたときのシステム時刻です。 | ||||||||||||||||||||
| State | DWORD | 4 | +20 | +20 | オペレーター サービス要求の現在の状態です。次のいずれかの値になります。
| ||||||||||||||||||||
| szMessage | WCHAR | 512 | +24 | +24 | オペレーター メッセージのテキストです。 | ||||||||||||||||||||
| Arg1Type | DWORD | 4 | +536 | +536 | Arg1 オブジェクトの種類です。次のいずれかの値を指定できます。
| ||||||||||||||||||||
| Arg1 | GUID | 16 | +540 | +540 | 移動要求や、参照オブジェクトを必要とするその他のオペレーター要求で使用される Arg1 オブジェクト ID です。このオブジェクトの用途は、オペレーター要求の種類によって異なります。Arg1 の適切な使用方法については、Request の説明を参照してください。 | ||||||||||||||||||||
| Arg2Type | DWORD | 4 | +556 | +556 | Arg2 オブジェクトの種類です。次のいずれかの値を指定できます。
| ||||||||||||||||||||
| Arg2 | GUID | 16 | +560 | +560 | 2 つ目の参照オブジェクトを必要とするオペレーター要求で使用される Arg2 オブジェクト ID です。このオブジェクトの用途は、オペレーター要求の種類によって異なります。Arg2 の適切な使用方法については、Request の説明を参照してください。 | ||||||||||||||||||||
| szApplication | WCHAR | 128 | +576 | +576 | オペレーター要求を送信したアプリケーションです。 | ||||||||||||||||||||
| szUser | WCHAR | 128 | +704 | +704 | オペレーター要求を送信したコンピューターにログオンしている対話ユーザーです。 | ||||||||||||||||||||
| szComputer | WCHAR | 128 | +832 | +832 | オペレーター要求を送信したコンピューターです。 |
公式ドキュメント
[Removable Storage Manager は Windows 7 および Windows Server 2008 R2 以降では利用できません。]
NTMS_OPREQUESTINFORMATION 構造体は、RSM のオペレーター要求システム制御に固有のプロパティを定義します。
解説(Remarks)
NTMS_OPREQUESTINFORMATION 構造体は、 NTMS_OBJECTINFORMATION 構造体に含まれます。
ntmsapi.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして NTMS_OPREQUESTINFORMATION を定義します。エンコーディングに依存しないエイリアスと、エンコーディングに依存するコードを混在させると、不一致が生じてコンパイル エラーや実行時エラーの原因となる可能性があります。詳細については、Conventions for Function Prototypes を参照してください。
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_OPREQUESTINFORMATIONW (x64 960 / x86 960 バイト)
typedef struct NTMS_OPREQUESTINFORMATIONW {
DWORD Request;
SYSTEMTIME Submitted;
DWORD State;
WCHAR szMessage[256];
DWORD Arg1Type;
GUID Arg1;
DWORD Arg2Type;
GUID Arg2;
WCHAR szApplication[64];
WCHAR szUser[64];
WCHAR szComputer[64];
} NTMS_OPREQUESTINFORMATIONW;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_OPREQUESTINFORMATIONW
{
public uint Request;
public SYSTEMTIME Submitted;
public uint State;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string szMessage;
public uint Arg1Type;
public Guid Arg1;
public uint Arg2Type;
public Guid Arg2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szApplication;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szUser;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szComputer;
}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_OPREQUESTINFORMATIONW
Public Request As UInteger
Public Submitted As SYSTEMTIME
Public State As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public szMessage As String
Public Arg1Type As UInteger
Public Arg1 As Guid
Public Arg2Type As UInteger
Public Arg2 As Guid
<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
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_OPREQUESTINFORMATIONW(ctypes.Structure):
_fields_ = [
("Request", wintypes.DWORD),
("Submitted", SYSTEMTIME),
("State", wintypes.DWORD),
("szMessage", ctypes.c_wchar * 256),
("Arg1Type", wintypes.DWORD),
("Arg1", GUID),
("Arg2Type", wintypes.DWORD),
("Arg2", GUID),
("szApplication", ctypes.c_wchar * 64),
("szUser", ctypes.c_wchar * 64),
("szComputer", ctypes.c_wchar * 64),
]#[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_OPREQUESTINFORMATIONW {
pub Request: u32,
pub Submitted: SYSTEMTIME,
pub State: u32,
pub szMessage: [u16; 256],
pub Arg1Type: u32,
pub Arg1: GUID,
pub Arg2Type: u32,
pub Arg2: GUID,
pub szApplication: [u16; 64],
pub szUser: [u16; 64],
pub szComputer: [u16; 64],
}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_OPREQUESTINFORMATIONW struct {
Request uint32
Submitted SYSTEMTIME
State uint32
szMessage [256]uint16
Arg1Type uint32
Arg1 windows.GUID
Arg2Type uint32
Arg2 windows.GUID
szApplication [64]uint16
szUser [64]uint16
szComputer [64]uint16
}type
SYSTEMTIME = record
wYear: Word;
wMonth: Word;
wDayOfWeek: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
wSecond: Word;
wMilliseconds: Word;
end;
NTMS_OPREQUESTINFORMATIONW = record
Request: DWORD;
Submitted: SYSTEMTIME;
State: DWORD;
szMessage: array[0..255] of WideChar;
Arg1Type: DWORD;
Arg1: TGUID;
Arg2Type: DWORD;
Arg2: TGUID;
szApplication: array[0..63] of WideChar;
szUser: array[0..63] of WideChar;
szComputer: array[0..63] of WideChar;
end;const SYSTEMTIME = extern struct {
wYear: u16,
wMonth: u16,
wDayOfWeek: u16,
wDay: u16,
wHour: u16,
wMinute: u16,
wSecond: u16,
wMilliseconds: u16,
};
const NTMS_OPREQUESTINFORMATIONW = extern struct {
Request: u32,
Submitted: SYSTEMTIME,
State: u32,
szMessage: [256]u16,
Arg1Type: u32,
Arg1: GUID,
Arg2Type: u32,
Arg2: GUID,
szApplication: [64]u16,
szUser: [64]u16,
szComputer: [64]u16,
};type
SYSTEMTIME {.bycopy.} = object
wYear: uint16
wMonth: uint16
wDayOfWeek: uint16
wDay: uint16
wHour: uint16
wMinute: uint16
wSecond: uint16
wMilliseconds: uint16
NTMS_OPREQUESTINFORMATIONW {.bycopy.} = object
Request: uint32
Submitted: SYSTEMTIME
State: uint32
szMessage: array[256, uint16]
Arg1Type: uint32
Arg1: GUID
Arg2Type: uint32
Arg2: GUID
szApplication: array[64, uint16]
szUser: array[64, uint16]
szComputer: array[64, uint16]struct SYSTEMTIME
{
ushort wYear;
ushort wMonth;
ushort wDayOfWeek;
ushort wDay;
ushort wHour;
ushort wMinute;
ushort wSecond;
ushort wMilliseconds;
}
struct NTMS_OPREQUESTINFORMATIONW
{
uint Request;
SYSTEMTIME Submitted;
uint State;
wchar[256] szMessage;
uint Arg1Type;
GUID Arg1;
uint Arg2Type;
GUID Arg2;
wchar[64] szApplication;
wchar[64] szUser;
wchar[64] szComputer;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NTMS_OPREQUESTINFORMATIONW サイズ: 960 バイト(x64)
dim st, 240 ; 4byte整数×240(構造体サイズ 960 / 4 切り上げ)
; Request : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Submitted : SYSTEMTIME (+4, 16byte) varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; State : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; szMessage : WCHAR (+24, 512byte) varptr(st)+24 を基点に操作(512byte:入れ子/配列)
; Arg1Type : DWORD (+536, 4byte) st.134 = 値 / 値 = st.134 (lpoke/lpeek も可)
; Arg1 : GUID (+540, 16byte) varptr(st)+540 を基点に操作(16byte:入れ子/配列)
; Arg2Type : DWORD (+556, 4byte) st.139 = 値 / 値 = st.139 (lpoke/lpeek も可)
; Arg2 : GUID (+560, 16byte) varptr(st)+560 を基点に操作(16byte:入れ子/配列)
; szApplication : WCHAR (+576, 128byte) varptr(st)+576 を基点に操作(128byte:入れ子/配列)
; szUser : WCHAR (+704, 128byte) varptr(st)+704 を基点に操作(128byte:入れ子/配列)
; szComputer : WCHAR (+832, 128byte) varptr(st)+832 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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 GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global NTMS_OPREQUESTINFORMATIONW
#field int Request
#field SYSTEMTIME Submitted
#field int State
#field wchar szMessage 256
#field int Arg1Type
#field GUID Arg1
#field int Arg2Type
#field GUID Arg2
#field wchar szApplication 64
#field wchar szUser 64
#field wchar szComputer 64
#endstruct
stdim st, NTMS_OPREQUESTINFORMATIONW ; NSTRUCT 変数を確保
st->Request = 100
mes "Request=" + st->Request