Win32 API 日本語リファレンス
ホームSystem.Com.StructuredStorage › STATPROPSETSTG

STATPROPSETSTG

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

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

フィールド

フィールドサイズx64x86説明
fmtidGUID16+0+0プロパティセットを識別するフォーマットID(FMTID)。
clsidGUID16+16+16プロパティセットに関連付けられたクラスID(CLSID)。
grfFlagsDWORD4+32+32プロパティセットの属性フラグ。ANSI格納や非単純などの特性を表す。
mtimeFILETIME8+36+36プロパティセットの最終更新日時(FILETIME)。
ctimeFILETIME8+44+44プロパティセットの作成日時(FILETIME)。
atimeFILETIME8+52+52プロパティセットの最終アクセス日時(FILETIME)。
dwOSVersionDWORD4+60+60プロパティセットを作成したOSのバージョン情報。

各言語での定義

#include <windows.h>

// FILETIME  (x64 8 / x86 8 バイト)
typedef struct FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;

// STATPROPSETSTG  (x64 64 / x86 64 バイト)
typedef struct STATPROPSETSTG {
    GUID fmtid;
    GUID clsid;
    DWORD grfFlags;
    FILETIME mtime;
    FILETIME ctime;
    FILETIME atime;
    DWORD dwOSVersion;
} STATPROPSETSTG;
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 STATPROPSETSTG
{
    public Guid fmtid;
    public Guid clsid;
    public uint grfFlags;
    public FILETIME mtime;
    public FILETIME ctime;
    public FILETIME atime;
    public uint dwOSVersion;
}
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 STATPROPSETSTG
    Public fmtid As Guid
    Public clsid As Guid
    Public grfFlags As UInteger
    Public mtime As FILETIME
    Public ctime As FILETIME
    Public atime As FILETIME
    Public dwOSVersion As UInteger
End Structure
import ctypes
from ctypes import wintypes

class FILETIME(ctypes.Structure):
    _fields_ = [
        ("dwLowDateTime", wintypes.DWORD),
        ("dwHighDateTime", wintypes.DWORD),
    ]

class STATPROPSETSTG(ctypes.Structure):
    _fields_ = [
        ("fmtid", GUID),
        ("clsid", GUID),
        ("grfFlags", wintypes.DWORD),
        ("mtime", FILETIME),
        ("ctime", FILETIME),
        ("atime", FILETIME),
        ("dwOSVersion", wintypes.DWORD),
    ]
#[repr(C)]
pub struct FILETIME {
    pub dwLowDateTime: u32,
    pub dwHighDateTime: u32,
}

#[repr(C)]
pub struct STATPROPSETSTG {
    pub fmtid: GUID,
    pub clsid: GUID,
    pub grfFlags: u32,
    pub mtime: FILETIME,
    pub ctime: FILETIME,
    pub atime: FILETIME,
    pub dwOSVersion: u32,
}
import "golang.org/x/sys/windows"

type FILETIME struct {
	dwLowDateTime uint32
	dwHighDateTime uint32
}

type STATPROPSETSTG struct {
	fmtid windows.GUID
	clsid windows.GUID
	grfFlags uint32
	mtime FILETIME
	ctime FILETIME
	atime FILETIME
	dwOSVersion uint32
}
type
  FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;

  STATPROPSETSTG = record
    fmtid: TGUID;
    clsid: TGUID;
    grfFlags: DWORD;
    mtime: FILETIME;
    ctime: FILETIME;
    atime: FILETIME;
    dwOSVersion: DWORD;
  end;
const FILETIME = extern struct {
    dwLowDateTime: u32,
    dwHighDateTime: u32,
};

const STATPROPSETSTG = extern struct {
    fmtid: GUID,
    clsid: GUID,
    grfFlags: u32,
    mtime: FILETIME,
    ctime: FILETIME,
    atime: FILETIME,
    dwOSVersion: u32,
};
type
  FILETIME {.bycopy.} = object
    dwLowDateTime: uint32
    dwHighDateTime: uint32

  STATPROPSETSTG {.bycopy.} = object
    fmtid: GUID
    clsid: GUID
    grfFlags: uint32
    mtime: FILETIME
    ctime: FILETIME
    atime: FILETIME
    dwOSVersion: uint32
struct FILETIME
{
    uint dwLowDateTime;
    uint dwHighDateTime;
}

struct STATPROPSETSTG
{
    GUID fmtid;
    GUID clsid;
    uint grfFlags;
    FILETIME mtime;
    FILETIME ctime;
    FILETIME atime;
    uint dwOSVersion;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STATPROPSETSTG サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; fmtid : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; clsid : GUID (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; grfFlags : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; mtime : FILETIME (+36, 8byte)  varptr(st)+36 を基点に操作(8byte:入れ子/配列)
; ctime : FILETIME (+44, 8byte)  varptr(st)+44 を基点に操作(8byte:入れ子/配列)
; atime : FILETIME (+52, 8byte)  varptr(st)+52 を基点に操作(8byte:入れ子/配列)
; dwOSVersion : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (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 FILETIME
    #field int dwLowDateTime
    #field int dwHighDateTime
#endstruct

#defstruct global STATPROPSETSTG
    #field GUID fmtid
    #field GUID clsid
    #field int grfFlags
    #field FILETIME mtime
    #field FILETIME ctime
    #field FILETIME atime
    #field int dwOSVersion
#endstruct

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