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