サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
コピー #include <windows.h>
// PRJ_FILE_BASIC_INFO (x64 56 / x86 56 バイト)
typedef struct PRJ_FILE_BASIC_INFO {
BOOLEAN IsDirectory;
LONGLONG FileSize;
LONGLONG CreationTime;
LONGLONG LastAccessTime;
LONGLONG LastWriteTime;
LONGLONG ChangeTime;
DWORD FileAttributes;
} PRJ_FILE_BASIC_INFO;
// PRJ_PLACEHOLDER_VERSION_INFO (x64 256 / x86 256 バイト)
typedef struct PRJ_PLACEHOLDER_VERSION_INFO {
BYTE ProviderID[128];
BYTE ContentID[128];
} PRJ_PLACEHOLDER_VERSION_INFO;
// PRJ_PLACEHOLDER_INFO (x64 344 / x86 344 バイト)
typedef struct PRJ_PLACEHOLDER_INFO {
PRJ_FILE_BASIC_INFO FileBasicInfo;
_EaInformation_e__Struct EaInformation;
_SecurityInformation_e__Struct SecurityInformation;
_StreamsInformation_e__Struct StreamsInformation;
PRJ_PLACEHOLDER_VERSION_INFO VersionInfo;
BYTE VariableData[1];
} PRJ_PLACEHOLDER_INFO;コピー using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRJ_FILE_BASIC_INFO
{
[MarshalAs(UnmanagedType.U1)] public bool IsDirectory;
public long FileSize;
public long CreationTime;
public long LastAccessTime;
public long LastWriteTime;
public long ChangeTime;
public uint FileAttributes;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRJ_PLACEHOLDER_VERSION_INFO
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] ProviderID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] ContentID;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRJ_PLACEHOLDER_INFO
{
public PRJ_FILE_BASIC_INFO FileBasicInfo;
public _EaInformation_e__Struct EaInformation;
public _SecurityInformation_e__Struct SecurityInformation;
public _StreamsInformation_e__Struct StreamsInformation;
public PRJ_PLACEHOLDER_VERSION_INFO VersionInfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] VariableData;
}コピー Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRJ_FILE_BASIC_INFO
<MarshalAs(UnmanagedType.U1)> Public IsDirectory As Boolean
Public FileSize As Long
Public CreationTime As Long
Public LastAccessTime As Long
Public LastWriteTime As Long
Public ChangeTime As Long
Public FileAttributes As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRJ_PLACEHOLDER_VERSION_INFO
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=128)> Public ProviderID() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=128)> Public ContentID() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRJ_PLACEHOLDER_INFO
Public FileBasicInfo As PRJ_FILE_BASIC_INFO
Public EaInformation As _EaInformation_e__Struct
Public SecurityInformation As _SecurityInformation_e__Struct
Public StreamsInformation As _StreamsInformation_e__Struct
Public VersionInfo As PRJ_PLACEHOLDER_VERSION_INFO
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public VariableData() As Byte
End Structureコピー import ctypes
from ctypes import wintypes
class PRJ_FILE_BASIC_INFO(ctypes.Structure):
_fields_ = [
("IsDirectory", ctypes.c_byte),
("FileSize", ctypes.c_longlong),
("CreationTime", ctypes.c_longlong),
("LastAccessTime", ctypes.c_longlong),
("LastWriteTime", ctypes.c_longlong),
("ChangeTime", ctypes.c_longlong),
("FileAttributes", wintypes.DWORD),
]
class PRJ_PLACEHOLDER_VERSION_INFO(ctypes.Structure):
_fields_ = [
("ProviderID", ctypes.c_ubyte * 128),
("ContentID", ctypes.c_ubyte * 128),
]
class PRJ_PLACEHOLDER_INFO(ctypes.Structure):
_fields_ = [
("FileBasicInfo", PRJ_FILE_BASIC_INFO),
("EaInformation", _EaInformation_e__Struct),
("SecurityInformation", _SecurityInformation_e__Struct),
("StreamsInformation", _StreamsInformation_e__Struct),
("VersionInfo", PRJ_PLACEHOLDER_VERSION_INFO),
("VariableData", ctypes.c_ubyte * 1),
]コピー #[repr(C)]
pub struct PRJ_FILE_BASIC_INFO {
pub IsDirectory: u8,
pub FileSize: i64,
pub CreationTime: i64,
pub LastAccessTime: i64,
pub LastWriteTime: i64,
pub ChangeTime: i64,
pub FileAttributes: u32,
}
#[repr(C)]
pub struct PRJ_PLACEHOLDER_VERSION_INFO {
pub ProviderID: [u8; 128],
pub ContentID: [u8; 128],
}
#[repr(C)]
pub struct PRJ_PLACEHOLDER_INFO {
pub FileBasicInfo: PRJ_FILE_BASIC_INFO,
pub EaInformation: _EaInformation_e__Struct,
pub SecurityInformation: _SecurityInformation_e__Struct,
pub StreamsInformation: _StreamsInformation_e__Struct,
pub VersionInfo: PRJ_PLACEHOLDER_VERSION_INFO,
pub VariableData: [u8; 1],
}コピー import "golang.org/x/sys/windows"
type PRJ_FILE_BASIC_INFO struct {
IsDirectory byte
FileSize int64
CreationTime int64
LastAccessTime int64
LastWriteTime int64
ChangeTime int64
FileAttributes uint32
}
type PRJ_PLACEHOLDER_VERSION_INFO struct {
ProviderID [128]byte
ContentID [128]byte
}
type PRJ_PLACEHOLDER_INFO struct {
FileBasicInfo PRJ_FILE_BASIC_INFO
EaInformation _EaInformation_e__Struct
SecurityInformation _SecurityInformation_e__Struct
StreamsInformation _StreamsInformation_e__Struct
VersionInfo PRJ_PLACEHOLDER_VERSION_INFO
VariableData [1]byte
}コピー type
PRJ_FILE_BASIC_INFO = record
IsDirectory: ByteBool;
FileSize: Int64;
CreationTime: Int64;
LastAccessTime: Int64;
LastWriteTime: Int64;
ChangeTime: Int64;
FileAttributes: DWORD;
end;
PRJ_PLACEHOLDER_VERSION_INFO = record
ProviderID: array[0..127] of Byte;
ContentID: array[0..127] of Byte;
end;
PRJ_PLACEHOLDER_INFO = record
FileBasicInfo: PRJ_FILE_BASIC_INFO;
EaInformation: _EaInformation_e__Struct;
SecurityInformation: _SecurityInformation_e__Struct;
StreamsInformation: _StreamsInformation_e__Struct;
VersionInfo: PRJ_PLACEHOLDER_VERSION_INFO;
VariableData: array[0..0] of Byte;
end;コピー const PRJ_FILE_BASIC_INFO = extern struct {
IsDirectory: u8,
FileSize: i64,
CreationTime: i64,
LastAccessTime: i64,
LastWriteTime: i64,
ChangeTime: i64,
FileAttributes: u32,
};
const PRJ_PLACEHOLDER_VERSION_INFO = extern struct {
ProviderID: [128]u8,
ContentID: [128]u8,
};
const PRJ_PLACEHOLDER_INFO = extern struct {
FileBasicInfo: PRJ_FILE_BASIC_INFO,
EaInformation: _EaInformation_e__Struct,
SecurityInformation: _SecurityInformation_e__Struct,
StreamsInformation: _StreamsInformation_e__Struct,
VersionInfo: PRJ_PLACEHOLDER_VERSION_INFO,
VariableData: [1]u8,
};コピー type
PRJ_FILE_BASIC_INFO {.bycopy.} = object
IsDirectory: uint8
FileSize: int64
CreationTime: int64
LastAccessTime: int64
LastWriteTime: int64
ChangeTime: int64
FileAttributes: uint32
PRJ_PLACEHOLDER_VERSION_INFO {.bycopy.} = object
ProviderID: array[128, uint8]
ContentID: array[128, uint8]
PRJ_PLACEHOLDER_INFO {.bycopy.} = object
FileBasicInfo: PRJ_FILE_BASIC_INFO
EaInformation: _EaInformation_e__Struct
SecurityInformation: _SecurityInformation_e__Struct
StreamsInformation: _StreamsInformation_e__Struct
VersionInfo: PRJ_PLACEHOLDER_VERSION_INFO
VariableData: array[1, uint8]コピー struct PRJ_FILE_BASIC_INFO
{
ubyte IsDirectory;
long FileSize;
long CreationTime;
long LastAccessTime;
long LastWriteTime;
long ChangeTime;
uint FileAttributes;
}
struct PRJ_PLACEHOLDER_VERSION_INFO
{
ubyte[128] ProviderID;
ubyte[128] ContentID;
}
struct PRJ_PLACEHOLDER_INFO
{
PRJ_FILE_BASIC_INFO FileBasicInfo;
_EaInformation_e__Struct EaInformation;
_SecurityInformation_e__Struct SecurityInformation;
_StreamsInformation_e__Struct StreamsInformation;
PRJ_PLACEHOLDER_VERSION_INFO VersionInfo;
ubyte[1] VariableData;
}HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT (#defstruct/stdim/->)で32/64bit共通。
コピー ; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PRJ_PLACEHOLDER_INFO サイズ: 344 バイト(x64)
dim st, 86 ; 4byte整数×86(構造体サイズ 344 / 4 切り上げ)
; FileBasicInfo : PRJ_FILE_BASIC_INFO (+0, 56byte) varptr(st)+0 を基点に操作(56byte:入れ子/配列)
; EaInformation : _EaInformation_e__Struct (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; SecurityInformation : _SecurityInformation_e__Struct (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; StreamsInformation : _StreamsInformation_e__Struct (+72, 8byte) varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; VersionInfo : PRJ_PLACEHOLDER_VERSION_INFO (+80, 256byte) varptr(st)+80 を基点に操作(256byte:入れ子/配列)
; VariableData : BYTE (+336, 1byte) varptr(st)+336 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。コピー ; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PRJ_FILE_BASIC_INFO
#field bool1 IsDirectory
#field int64 FileSize
#field int64 CreationTime
#field int64 LastAccessTime
#field int64 LastWriteTime
#field int64 ChangeTime
#field int FileAttributes
#endstruct
#defstruct global PRJ_PLACEHOLDER_VERSION_INFO
#field byte ProviderID 128
#field byte ContentID 128
#endstruct
#defstruct global PRJ_PLACEHOLDER_INFO
#field PRJ_FILE_BASIC_INFO FileBasicInfo
#field _EaInformation_e__Struct EaInformation
#field _SecurityInformation_e__Struct SecurityInformation
#field _StreamsInformation_e__Struct StreamsInformation
#field PRJ_PLACEHOLDER_VERSION_INFO VersionInfo
#field byte VariableData 1
#endstruct
stdim st, PRJ_PLACEHOLDER_INFO ; NSTRUCT 変数を確保