ホーム › System.Ioctl › SCM_REGIONS
SCM_REGIONS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | この構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のバイト単位のサイズ。 |
| RegionCount | DWORD | 4 | +8 | +8 | Regions配列に含まれる領域の数。 |
| Regions | SCM_REGION | 96 | +16 | +16 | SCM_REGIONの可変長配列。先頭要素。 |
各言語での定義
#include <windows.h>
// SCM_REGION (x64 96 / x86 96 バイト)
typedef struct SCM_REGION {
DWORD Version;
DWORD Size;
DWORD Flags;
DWORD NfitHandle;
GUID LogicalDeviceGuid;
GUID AddressRangeType;
DWORD AssociatedId;
ULONGLONG Length;
ULONGLONG StartingDPA;
ULONGLONG BaseSPA;
ULONGLONG SPAOffset;
ULONGLONG RegionOffset;
} SCM_REGION;
// SCM_REGIONS (x64 112 / x86 112 バイト)
typedef struct SCM_REGIONS {
DWORD Version;
DWORD Size;
DWORD RegionCount;
SCM_REGION Regions[1];
} SCM_REGIONS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCM_REGION
{
public uint Version;
public uint Size;
public uint Flags;
public uint NfitHandle;
public Guid LogicalDeviceGuid;
public Guid AddressRangeType;
public uint AssociatedId;
public ulong Length;
public ulong StartingDPA;
public ulong BaseSPA;
public ulong SPAOffset;
public ulong RegionOffset;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCM_REGIONS
{
public uint Version;
public uint Size;
public uint RegionCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public SCM_REGION[] Regions;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCM_REGION
Public Version As UInteger
Public Size As UInteger
Public Flags As UInteger
Public NfitHandle As UInteger
Public LogicalDeviceGuid As Guid
Public AddressRangeType As Guid
Public AssociatedId As UInteger
Public Length As ULong
Public StartingDPA As ULong
Public BaseSPA As ULong
Public SPAOffset As ULong
Public RegionOffset As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCM_REGIONS
Public Version As UInteger
Public Size As UInteger
Public RegionCount As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Regions() As SCM_REGION
End Structureimport ctypes
from ctypes import wintypes
class SCM_REGION(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("Flags", wintypes.DWORD),
("NfitHandle", wintypes.DWORD),
("LogicalDeviceGuid", GUID),
("AddressRangeType", GUID),
("AssociatedId", wintypes.DWORD),
("Length", ctypes.c_ulonglong),
("StartingDPA", ctypes.c_ulonglong),
("BaseSPA", ctypes.c_ulonglong),
("SPAOffset", ctypes.c_ulonglong),
("RegionOffset", ctypes.c_ulonglong),
]
class SCM_REGIONS(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("RegionCount", wintypes.DWORD),
("Regions", SCM_REGION * 1),
]#[repr(C)]
pub struct SCM_REGION {
pub Version: u32,
pub Size: u32,
pub Flags: u32,
pub NfitHandle: u32,
pub LogicalDeviceGuid: GUID,
pub AddressRangeType: GUID,
pub AssociatedId: u32,
pub Length: u64,
pub StartingDPA: u64,
pub BaseSPA: u64,
pub SPAOffset: u64,
pub RegionOffset: u64,
}
#[repr(C)]
pub struct SCM_REGIONS {
pub Version: u32,
pub Size: u32,
pub RegionCount: u32,
pub Regions: [SCM_REGION; 1],
}import "golang.org/x/sys/windows"
type SCM_REGION struct {
Version uint32
Size uint32
Flags uint32
NfitHandle uint32
LogicalDeviceGuid windows.GUID
AddressRangeType windows.GUID
AssociatedId uint32
Length uint64
StartingDPA uint64
BaseSPA uint64
SPAOffset uint64
RegionOffset uint64
}
type SCM_REGIONS struct {
Version uint32
Size uint32
RegionCount uint32
Regions [1]SCM_REGION
}type
SCM_REGION = record
Version: DWORD;
Size: DWORD;
Flags: DWORD;
NfitHandle: DWORD;
LogicalDeviceGuid: TGUID;
AddressRangeType: TGUID;
AssociatedId: DWORD;
Length: UInt64;
StartingDPA: UInt64;
BaseSPA: UInt64;
SPAOffset: UInt64;
RegionOffset: UInt64;
end;
SCM_REGIONS = record
Version: DWORD;
Size: DWORD;
RegionCount: DWORD;
Regions: array[0..0] of SCM_REGION;
end;const SCM_REGION = extern struct {
Version: u32,
Size: u32,
Flags: u32,
NfitHandle: u32,
LogicalDeviceGuid: GUID,
AddressRangeType: GUID,
AssociatedId: u32,
Length: u64,
StartingDPA: u64,
BaseSPA: u64,
SPAOffset: u64,
RegionOffset: u64,
};
const SCM_REGIONS = extern struct {
Version: u32,
Size: u32,
RegionCount: u32,
Regions: [1]SCM_REGION,
};type
SCM_REGION {.bycopy.} = object
Version: uint32
Size: uint32
Flags: uint32
NfitHandle: uint32
LogicalDeviceGuid: GUID
AddressRangeType: GUID
AssociatedId: uint32
Length: uint64
StartingDPA: uint64
BaseSPA: uint64
SPAOffset: uint64
RegionOffset: uint64
SCM_REGIONS {.bycopy.} = object
Version: uint32
Size: uint32
RegionCount: uint32
Regions: array[1, SCM_REGION]struct SCM_REGION
{
uint Version;
uint Size;
uint Flags;
uint NfitHandle;
GUID LogicalDeviceGuid;
GUID AddressRangeType;
uint AssociatedId;
ulong Length;
ulong StartingDPA;
ulong BaseSPA;
ulong SPAOffset;
ulong RegionOffset;
}
struct SCM_REGIONS
{
uint Version;
uint Size;
uint RegionCount;
SCM_REGION[1] Regions;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCM_REGIONS サイズ: 112 バイト(x64)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; RegionCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Regions : SCM_REGION (+16, 96byte) varptr(st)+16 を基点に操作(96byte:入れ子/配列)
; ※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 SCM_REGION
#field int Version
#field int Size
#field int Flags
#field int NfitHandle
#field GUID LogicalDeviceGuid
#field GUID AddressRangeType
#field int AssociatedId
#field int64 Length
#field int64 StartingDPA
#field int64 BaseSPA
#field int64 SPAOffset
#field int64 RegionOffset
#endstruct
#defstruct global SCM_REGIONS
#field int Version
#field int Size
#field int RegionCount
#field SCM_REGION Regions 1
#endstruct
stdim st, SCM_REGIONS ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version