ホーム › System.Ioctl › FILE_REGION_OUTPUT
FILE_REGION_OUTPUT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Flags | DWORD | 4 | +0 | +0 | 問い合わせ結果に関するフラグ。 |
| TotalRegionEntryCount | DWORD | 4 | +4 | +4 | 条件に一致する全リージョンエントリの総数。 |
| RegionEntryCount | DWORD | 4 | +8 | +8 | 今回返されたリージョンエントリの数。 |
| Reserved | DWORD | 4 | +12 | +12 | 予約領域。0でなければならない。 |
| Region | FILE_REGION_INFO | 24 | +16 | +16 | 返されたFILE_REGION_INFO配列の先頭。 |
各言語での定義
#include <windows.h>
// FILE_REGION_INFO (x64 24 / x86 24 バイト)
typedef struct FILE_REGION_INFO {
LONGLONG FileOffset;
LONGLONG Length;
DWORD Usage;
DWORD Reserved;
} FILE_REGION_INFO;
// FILE_REGION_OUTPUT (x64 40 / x86 40 バイト)
typedef struct FILE_REGION_OUTPUT {
DWORD Flags;
DWORD TotalRegionEntryCount;
DWORD RegionEntryCount;
DWORD Reserved;
FILE_REGION_INFO Region[1];
} FILE_REGION_OUTPUT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_REGION_INFO
{
public long FileOffset;
public long Length;
public uint Usage;
public uint Reserved;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_REGION_OUTPUT
{
public uint Flags;
public uint TotalRegionEntryCount;
public uint RegionEntryCount;
public uint Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public FILE_REGION_INFO[] Region;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_REGION_INFO
Public FileOffset As Long
Public Length As Long
Public Usage As UInteger
Public Reserved As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_REGION_OUTPUT
Public Flags As UInteger
Public TotalRegionEntryCount As UInteger
Public RegionEntryCount As UInteger
Public Reserved As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Region() As FILE_REGION_INFO
End Structureimport ctypes
from ctypes import wintypes
class FILE_REGION_INFO(ctypes.Structure):
_fields_ = [
("FileOffset", ctypes.c_longlong),
("Length", ctypes.c_longlong),
("Usage", wintypes.DWORD),
("Reserved", wintypes.DWORD),
]
class FILE_REGION_OUTPUT(ctypes.Structure):
_fields_ = [
("Flags", wintypes.DWORD),
("TotalRegionEntryCount", wintypes.DWORD),
("RegionEntryCount", wintypes.DWORD),
("Reserved", wintypes.DWORD),
("Region", FILE_REGION_INFO * 1),
]#[repr(C)]
pub struct FILE_REGION_INFO {
pub FileOffset: i64,
pub Length: i64,
pub Usage: u32,
pub Reserved: u32,
}
#[repr(C)]
pub struct FILE_REGION_OUTPUT {
pub Flags: u32,
pub TotalRegionEntryCount: u32,
pub RegionEntryCount: u32,
pub Reserved: u32,
pub Region: [FILE_REGION_INFO; 1],
}import "golang.org/x/sys/windows"
type FILE_REGION_INFO struct {
FileOffset int64
Length int64
Usage uint32
Reserved uint32
}
type FILE_REGION_OUTPUT struct {
Flags uint32
TotalRegionEntryCount uint32
RegionEntryCount uint32
Reserved uint32
Region [1]FILE_REGION_INFO
}type
FILE_REGION_INFO = record
FileOffset: Int64;
Length: Int64;
Usage: DWORD;
Reserved: DWORD;
end;
FILE_REGION_OUTPUT = record
Flags: DWORD;
TotalRegionEntryCount: DWORD;
RegionEntryCount: DWORD;
Reserved: DWORD;
Region: array[0..0] of FILE_REGION_INFO;
end;const FILE_REGION_INFO = extern struct {
FileOffset: i64,
Length: i64,
Usage: u32,
Reserved: u32,
};
const FILE_REGION_OUTPUT = extern struct {
Flags: u32,
TotalRegionEntryCount: u32,
RegionEntryCount: u32,
Reserved: u32,
Region: [1]FILE_REGION_INFO,
};type
FILE_REGION_INFO {.bycopy.} = object
FileOffset: int64
Length: int64
Usage: uint32
Reserved: uint32
FILE_REGION_OUTPUT {.bycopy.} = object
Flags: uint32
TotalRegionEntryCount: uint32
RegionEntryCount: uint32
Reserved: uint32
Region: array[1, FILE_REGION_INFO]struct FILE_REGION_INFO
{
long FileOffset;
long Length;
uint Usage;
uint Reserved;
}
struct FILE_REGION_OUTPUT
{
uint Flags;
uint TotalRegionEntryCount;
uint RegionEntryCount;
uint Reserved;
FILE_REGION_INFO[1] Region;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILE_REGION_OUTPUT サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; TotalRegionEntryCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; RegionEntryCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Reserved : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Region : FILE_REGION_INFO (+16, 24byte) varptr(st)+16 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILE_REGION_INFO
#field int64 FileOffset
#field int64 Length
#field int Usage
#field int Reserved
#endstruct
#defstruct global FILE_REGION_OUTPUT
#field int Flags
#field int TotalRegionEntryCount
#field int RegionEntryCount
#field int Reserved
#field FILE_REGION_INFO Region 1
#endstruct
stdim st, FILE_REGION_OUTPUT ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags