ホーム › System.Memory › MEMORY_BASIC_INFORMATION64
MEMORY_BASIC_INFORMATION64
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| BaseAddress | ULONGLONG | 8 | +0 | +0 | リージョン内ページの基底アドレス(64ビット)。 |
| AllocationBase | ULONGLONG | 8 | +8 | +8 | リージョンの割り当て基底アドレス(64ビット)。 |
| AllocationProtect | PAGE_PROTECTION_FLAGS | 4 | +16 | +16 | リージョン確保時に指定された保護フラグ。 |
| __alignment1 | DWORD | 4 | +20 | +20 | 64ビット整列のためのパディング領域。 |
| RegionSize | ULONGLONG | 8 | +24 | +24 | 同一属性ページ群のバイト単位サイズ(64ビット)。 |
| State | VIRTUAL_ALLOCATION_TYPE | 4 | +32 | +32 | ページの状態(MEM_COMMIT/MEM_FREE/MEM_RESERVE)。 |
| Protect | PAGE_PROTECTION_FLAGS | 4 | +36 | +36 | リージョン内ページの現在のアクセス保護フラグ。 |
| Type | PAGE_TYPE | 4 | +40 | +40 | ページの種類(MEM_IMAGE/MEM_MAPPED/MEM_PRIVATE)。 |
| __alignment2 | DWORD | 4 | +44 | +44 | 64ビット整列のためのパディング領域。 |
各言語での定義
#include <windows.h>
// MEMORY_BASIC_INFORMATION64 (x64 48 / x86 48 バイト)
typedef struct MEMORY_BASIC_INFORMATION64 {
ULONGLONG BaseAddress;
ULONGLONG AllocationBase;
PAGE_PROTECTION_FLAGS AllocationProtect;
DWORD __alignment1;
ULONGLONG RegionSize;
VIRTUAL_ALLOCATION_TYPE State;
PAGE_PROTECTION_FLAGS Protect;
PAGE_TYPE Type;
DWORD __alignment2;
} MEMORY_BASIC_INFORMATION64;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MEMORY_BASIC_INFORMATION64
{
public ulong BaseAddress;
public ulong AllocationBase;
public uint AllocationProtect;
public uint __alignment1;
public ulong RegionSize;
public uint State;
public uint Protect;
public uint Type;
public uint __alignment2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MEMORY_BASIC_INFORMATION64
Public BaseAddress As ULong
Public AllocationBase As ULong
Public AllocationProtect As UInteger
Public __alignment1 As UInteger
Public RegionSize As ULong
Public State As UInteger
Public Protect As UInteger
Public Type As UInteger
Public __alignment2 As UInteger
End Structureimport ctypes
from ctypes import wintypes
class MEMORY_BASIC_INFORMATION64(ctypes.Structure):
_fields_ = [
("BaseAddress", ctypes.c_ulonglong),
("AllocationBase", ctypes.c_ulonglong),
("AllocationProtect", wintypes.DWORD),
("__alignment1", wintypes.DWORD),
("RegionSize", ctypes.c_ulonglong),
("State", wintypes.DWORD),
("Protect", wintypes.DWORD),
("Type", wintypes.DWORD),
("__alignment2", wintypes.DWORD),
]#[repr(C)]
pub struct MEMORY_BASIC_INFORMATION64 {
pub BaseAddress: u64,
pub AllocationBase: u64,
pub AllocationProtect: u32,
pub __alignment1: u32,
pub RegionSize: u64,
pub State: u32,
pub Protect: u32,
pub Type: u32,
pub __alignment2: u32,
}import "golang.org/x/sys/windows"
type MEMORY_BASIC_INFORMATION64 struct {
BaseAddress uint64
AllocationBase uint64
AllocationProtect uint32
__alignment1 uint32
RegionSize uint64
State uint32
Protect uint32
Type uint32
__alignment2 uint32
}type
MEMORY_BASIC_INFORMATION64 = record
BaseAddress: UInt64;
AllocationBase: UInt64;
AllocationProtect: DWORD;
__alignment1: DWORD;
RegionSize: UInt64;
State: DWORD;
Protect: DWORD;
Type: DWORD;
__alignment2: DWORD;
end;const MEMORY_BASIC_INFORMATION64 = extern struct {
BaseAddress: u64,
AllocationBase: u64,
AllocationProtect: u32,
__alignment1: u32,
RegionSize: u64,
State: u32,
Protect: u32,
Type: u32,
__alignment2: u32,
};type
MEMORY_BASIC_INFORMATION64 {.bycopy.} = object
BaseAddress: uint64
AllocationBase: uint64
AllocationProtect: uint32
__alignment1: uint32
RegionSize: uint64
State: uint32
Protect: uint32
Type: uint32
__alignment2: uint32struct MEMORY_BASIC_INFORMATION64
{
ulong BaseAddress;
ulong AllocationBase;
uint AllocationProtect;
uint __alignment1;
ulong RegionSize;
uint State;
uint Protect;
uint Type;
uint __alignment2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MEMORY_BASIC_INFORMATION64 サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; BaseAddress : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; AllocationBase : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; AllocationProtect : PAGE_PROTECTION_FLAGS (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; __alignment1 : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; RegionSize : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; State : VIRTUAL_ALLOCATION_TYPE (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Protect : PAGE_PROTECTION_FLAGS (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; Type : PAGE_TYPE (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; __alignment2 : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MEMORY_BASIC_INFORMATION64
#field int64 BaseAddress
#field int64 AllocationBase
#field int AllocationProtect
#field int __alignment1
#field int64 RegionSize
#field int State
#field int Protect
#field int Type
#field int __alignment2
#endstruct
stdim st, MEMORY_BASIC_INFORMATION64 ; NSTRUCT 変数を確保
st->BaseAddress = 100
mes "BaseAddress=" + st->BaseAddress