ホーム › Devices.DeviceAndDriverInstallation › MEM_LARGE_RESOURCE
MEM_LARGE_RESOURCE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MEM_LARGE_Header | MEM_LARGE_DES | 32 | +0 | +0 | 大容量メモリリソースの記述子ヘッダ(MEM_LARGE_DES)。 |
| MEM_LARGE_Data | MEM_LARGE_RANGE | 40 | +32 | +32 | 大容量メモリ範囲データの先頭(MEM_LARGE_RANGE)。可変長配列の起点。 |
各言語での定義
#include <windows.h>
// MEM_LARGE_DES (x64 32 / x86 32 バイト)
#pragma pack(push, 1)
typedef struct MEM_LARGE_DES {
DWORD MLD_Count;
DWORD MLD_Type;
ULONGLONG MLD_Alloc_Base;
ULONGLONG MLD_Alloc_End;
DWORD MLD_Flags;
DWORD MLD_Reserved;
} MEM_LARGE_DES;
#pragma pack(pop)
// MEM_LARGE_RANGE (x64 40 / x86 40 バイト)
#pragma pack(push, 1)
typedef struct MEM_LARGE_RANGE {
ULONGLONG MLR_Align;
ULONGLONG MLR_nBytes;
ULONGLONG MLR_Min;
ULONGLONG MLR_Max;
DWORD MLR_Flags;
DWORD MLR_Reserved;
} MEM_LARGE_RANGE;
#pragma pack(pop)
// MEM_LARGE_RESOURCE (x64 72 / x86 72 バイト)
#pragma pack(push, 1)
typedef struct MEM_LARGE_RESOURCE {
MEM_LARGE_DES MEM_LARGE_Header;
MEM_LARGE_RANGE MEM_LARGE_Data[1];
} MEM_LARGE_RESOURCE;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MEM_LARGE_DES
{
public uint MLD_Count;
public uint MLD_Type;
public ulong MLD_Alloc_Base;
public ulong MLD_Alloc_End;
public uint MLD_Flags;
public uint MLD_Reserved;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MEM_LARGE_RANGE
{
public ulong MLR_Align;
public ulong MLR_nBytes;
public ulong MLR_Min;
public ulong MLR_Max;
public uint MLR_Flags;
public uint MLR_Reserved;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MEM_LARGE_RESOURCE
{
public MEM_LARGE_DES MEM_LARGE_Header;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public MEM_LARGE_RANGE[] MEM_LARGE_Data;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MEM_LARGE_DES
Public MLD_Count As UInteger
Public MLD_Type As UInteger
Public MLD_Alloc_Base As ULong
Public MLD_Alloc_End As ULong
Public MLD_Flags As UInteger
Public MLD_Reserved As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MEM_LARGE_RANGE
Public MLR_Align As ULong
Public MLR_nBytes As ULong
Public MLR_Min As ULong
Public MLR_Max As ULong
Public MLR_Flags As UInteger
Public MLR_Reserved As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MEM_LARGE_RESOURCE
Public MEM_LARGE_Header As MEM_LARGE_DES
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public MEM_LARGE_Data() As MEM_LARGE_RANGE
End Structureimport ctypes
from ctypes import wintypes
class MEM_LARGE_DES(ctypes.Structure):
_pack_ = 1
_fields_ = [
("MLD_Count", wintypes.DWORD),
("MLD_Type", wintypes.DWORD),
("MLD_Alloc_Base", ctypes.c_ulonglong),
("MLD_Alloc_End", ctypes.c_ulonglong),
("MLD_Flags", wintypes.DWORD),
("MLD_Reserved", wintypes.DWORD),
]
class MEM_LARGE_RANGE(ctypes.Structure):
_pack_ = 1
_fields_ = [
("MLR_Align", ctypes.c_ulonglong),
("MLR_nBytes", ctypes.c_ulonglong),
("MLR_Min", ctypes.c_ulonglong),
("MLR_Max", ctypes.c_ulonglong),
("MLR_Flags", wintypes.DWORD),
("MLR_Reserved", wintypes.DWORD),
]
class MEM_LARGE_RESOURCE(ctypes.Structure):
_pack_ = 1
_fields_ = [
("MEM_LARGE_Header", MEM_LARGE_DES),
("MEM_LARGE_Data", MEM_LARGE_RANGE * 1),
]#[repr(C, packed(1))]
pub struct MEM_LARGE_DES {
pub MLD_Count: u32,
pub MLD_Type: u32,
pub MLD_Alloc_Base: u64,
pub MLD_Alloc_End: u64,
pub MLD_Flags: u32,
pub MLD_Reserved: u32,
}
#[repr(C, packed(1))]
pub struct MEM_LARGE_RANGE {
pub MLR_Align: u64,
pub MLR_nBytes: u64,
pub MLR_Min: u64,
pub MLR_Max: u64,
pub MLR_Flags: u32,
pub MLR_Reserved: u32,
}
#[repr(C, packed(1))]
pub struct MEM_LARGE_RESOURCE {
pub MEM_LARGE_Header: MEM_LARGE_DES,
pub MEM_LARGE_Data: [MEM_LARGE_RANGE; 1],
}import "golang.org/x/sys/windows"
type MEM_LARGE_DES struct {
MLD_Count uint32
MLD_Type uint32
MLD_Alloc_Base uint64
MLD_Alloc_End uint64
MLD_Flags uint32
MLD_Reserved uint32
}
type MEM_LARGE_RANGE struct {
MLR_Align uint64
MLR_nBytes uint64
MLR_Min uint64
MLR_Max uint64
MLR_Flags uint32
MLR_Reserved uint32
}
type MEM_LARGE_RESOURCE struct {
MEM_LARGE_Header MEM_LARGE_DES
MEM_LARGE_Data [1]MEM_LARGE_RANGE
}type
MEM_LARGE_DES = packed record
MLD_Count: DWORD;
MLD_Type: DWORD;
MLD_Alloc_Base: UInt64;
MLD_Alloc_End: UInt64;
MLD_Flags: DWORD;
MLD_Reserved: DWORD;
end;
MEM_LARGE_RANGE = packed record
MLR_Align: UInt64;
MLR_nBytes: UInt64;
MLR_Min: UInt64;
MLR_Max: UInt64;
MLR_Flags: DWORD;
MLR_Reserved: DWORD;
end;
MEM_LARGE_RESOURCE = packed record
MEM_LARGE_Header: MEM_LARGE_DES;
MEM_LARGE_Data: array[0..0] of MEM_LARGE_RANGE;
end;const MEM_LARGE_DES = extern struct {
MLD_Count: u32,
MLD_Type: u32,
MLD_Alloc_Base: u64,
MLD_Alloc_End: u64,
MLD_Flags: u32,
MLD_Reserved: u32,
};
const MEM_LARGE_RANGE = extern struct {
MLR_Align: u64,
MLR_nBytes: u64,
MLR_Min: u64,
MLR_Max: u64,
MLR_Flags: u32,
MLR_Reserved: u32,
};
const MEM_LARGE_RESOURCE = extern struct {
MEM_LARGE_Header: MEM_LARGE_DES,
MEM_LARGE_Data: [1]MEM_LARGE_RANGE,
};type
MEM_LARGE_DES {.packed.} = object
MLD_Count: uint32
MLD_Type: uint32
MLD_Alloc_Base: uint64
MLD_Alloc_End: uint64
MLD_Flags: uint32
MLD_Reserved: uint32
MEM_LARGE_RANGE {.packed.} = object
MLR_Align: uint64
MLR_nBytes: uint64
MLR_Min: uint64
MLR_Max: uint64
MLR_Flags: uint32
MLR_Reserved: uint32
MEM_LARGE_RESOURCE {.packed.} = object
MEM_LARGE_Header: MEM_LARGE_DES
MEM_LARGE_Data: array[1, MEM_LARGE_RANGE]align(1)
struct MEM_LARGE_DES
{
uint MLD_Count;
uint MLD_Type;
ulong MLD_Alloc_Base;
ulong MLD_Alloc_End;
uint MLD_Flags;
uint MLD_Reserved;
}
align(1)
struct MEM_LARGE_RANGE
{
ulong MLR_Align;
ulong MLR_nBytes;
ulong MLR_Min;
ulong MLR_Max;
uint MLR_Flags;
uint MLR_Reserved;
}
align(1)
struct MEM_LARGE_RESOURCE
{
MEM_LARGE_DES MEM_LARGE_Header;
MEM_LARGE_RANGE[1] MEM_LARGE_Data;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MEM_LARGE_RESOURCE サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; MEM_LARGE_Header : MEM_LARGE_DES (+0, 32byte) varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; MEM_LARGE_Data : MEM_LARGE_RANGE (+32, 40byte) varptr(st)+32 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MEM_LARGE_DES, pack=1
#field int MLD_Count
#field int MLD_Type
#field int64 MLD_Alloc_Base
#field int64 MLD_Alloc_End
#field int MLD_Flags
#field int MLD_Reserved
#endstruct
#defstruct global MEM_LARGE_RANGE, pack=1
#field int64 MLR_Align
#field int64 MLR_nBytes
#field int64 MLR_Min
#field int64 MLR_Max
#field int MLR_Flags
#field int MLR_Reserved
#endstruct
#defstruct global MEM_LARGE_RESOURCE, pack=1
#field MEM_LARGE_DES MEM_LARGE_Header
#field MEM_LARGE_RANGE MEM_LARGE_Data 1
#endstruct
stdim st, MEM_LARGE_RESOURCE ; NSTRUCT 変数を確保