ホーム › System.Com › STATSTG
STATSTG
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pwcsName | LPWSTR | 8/4 | +0 | +0 | ストレージ/ストリームの名前文字列。不要時はNULL。 |
| type | DWORD | 4 | +8 | +4 | オブジェクト種別(STGTY_STORAGE/STREAM等)を示す値。 |
| cbSize | ULONGLONG | 8 | +16 | +8 | ストリームのバイトサイズ。 |
| mtime | FILETIME | 8 | +24 | +16 | 最終変更日時(FILETIME)。 |
| ctime | FILETIME | 8 | +32 | +24 | 作成日時(FILETIME)。 |
| atime | FILETIME | 8 | +40 | +32 | 最終アクセス日時(FILETIME)。 |
| grfMode | STGM | 4 | +48 | +40 | オブジェクトを開いたアクセスモード(STGM)。 |
| grfLocksSupported | DWORD | 4 | +52 | +44 | サポートするロック種別(LOCKTYPE系)。 |
| clsid | GUID | 16 | +56 | +48 | ストレージに関連付けられたクラスID。 |
| grfStateBits | DWORD | 4 | +72 | +64 | オブジェクトの現在の状態ビット。 |
| reserved | DWORD | 4 | +76 | +68 | 予約済みフィールド。 |
各言語での定義
#include <windows.h>
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// STATSTG (x64 80 / x86 72 バイト)
typedef struct STATSTG {
LPWSTR pwcsName;
DWORD type;
ULONGLONG cbSize;
FILETIME mtime;
FILETIME ctime;
FILETIME atime;
STGM grfMode;
DWORD grfLocksSupported;
GUID clsid;
DWORD grfStateBits;
DWORD reserved;
} STATSTG;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STATSTG
{
public IntPtr pwcsName;
public uint type;
public ulong cbSize;
public FILETIME mtime;
public FILETIME ctime;
public FILETIME atime;
public uint grfMode;
public uint grfLocksSupported;
public Guid clsid;
public uint grfStateBits;
public uint reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
Public dwLowDateTime As UInteger
Public dwHighDateTime As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STATSTG
Public pwcsName As IntPtr
Public type As UInteger
Public cbSize As ULong
Public mtime As FILETIME
Public ctime As FILETIME
Public atime As FILETIME
Public grfMode As UInteger
Public grfLocksSupported As UInteger
Public clsid As Guid
Public grfStateBits As UInteger
Public reserved As UInteger
End Structureimport ctypes
from ctypes import wintypes
class FILETIME(ctypes.Structure):
_fields_ = [
("dwLowDateTime", wintypes.DWORD),
("dwHighDateTime", wintypes.DWORD),
]
class STATSTG(ctypes.Structure):
_fields_ = [
("pwcsName", ctypes.c_void_p),
("type", wintypes.DWORD),
("cbSize", ctypes.c_ulonglong),
("mtime", FILETIME),
("ctime", FILETIME),
("atime", FILETIME),
("grfMode", wintypes.DWORD),
("grfLocksSupported", wintypes.DWORD),
("clsid", GUID),
("grfStateBits", wintypes.DWORD),
("reserved", wintypes.DWORD),
]#[repr(C)]
pub struct FILETIME {
pub dwLowDateTime: u32,
pub dwHighDateTime: u32,
}
#[repr(C)]
pub struct STATSTG {
pub pwcsName: *mut core::ffi::c_void,
pub type: u32,
pub cbSize: u64,
pub mtime: FILETIME,
pub ctime: FILETIME,
pub atime: FILETIME,
pub grfMode: u32,
pub grfLocksSupported: u32,
pub clsid: GUID,
pub grfStateBits: u32,
pub reserved: u32,
}import "golang.org/x/sys/windows"
type FILETIME struct {
dwLowDateTime uint32
dwHighDateTime uint32
}
type STATSTG struct {
pwcsName uintptr
type uint32
cbSize uint64
mtime FILETIME
ctime FILETIME
atime FILETIME
grfMode uint32
grfLocksSupported uint32
clsid windows.GUID
grfStateBits uint32
reserved uint32
}type
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
STATSTG = record
pwcsName: Pointer;
type: DWORD;
cbSize: UInt64;
mtime: FILETIME;
ctime: FILETIME;
atime: FILETIME;
grfMode: DWORD;
grfLocksSupported: DWORD;
clsid: TGUID;
grfStateBits: DWORD;
reserved: DWORD;
end;const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const STATSTG = extern struct {
pwcsName: ?*anyopaque,
type: u32,
cbSize: u64,
mtime: FILETIME,
ctime: FILETIME,
atime: FILETIME,
grfMode: u32,
grfLocksSupported: u32,
clsid: GUID,
grfStateBits: u32,
reserved: u32,
};type
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
STATSTG {.bycopy.} = object
pwcsName: pointer
type: uint32
cbSize: uint64
mtime: FILETIME
ctime: FILETIME
atime: FILETIME
grfMode: uint32
grfLocksSupported: uint32
clsid: GUID
grfStateBits: uint32
reserved: uint32struct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
struct STATSTG
{
void* pwcsName;
uint type;
ulong cbSize;
FILETIME mtime;
FILETIME ctime;
FILETIME atime;
uint grfMode;
uint grfLocksSupported;
GUID clsid;
uint grfStateBits;
uint reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STATSTG サイズ: 72 バイト(x86)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; pwcsName : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; type : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cbSize : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; mtime : FILETIME (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ctime : FILETIME (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; atime : FILETIME (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; grfMode : STGM (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; grfLocksSupported : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; clsid : GUID (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; grfStateBits : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; reserved : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STATSTG サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; pwcsName : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; type : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cbSize : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; mtime : FILETIME (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ctime : FILETIME (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; atime : FILETIME (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; grfMode : STGM (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; grfLocksSupported : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; clsid : GUID (+56, 16byte) varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; grfStateBits : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; reserved : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILETIME
#field int dwLowDateTime
#field int dwHighDateTime
#endstruct
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global STATSTG
#field intptr pwcsName
#field int type
#field int64 cbSize
#field FILETIME mtime
#field FILETIME ctime
#field FILETIME atime
#field int grfMode
#field int grfLocksSupported
#field GUID clsid
#field int grfStateBits
#field int reserved
#endstruct
stdim st, STATSTG ; NSTRUCT 変数を確保
st->type = 100
mes "type=" + st->type