ホーム › System.Memory › MEM_ADDRESS_REQUIREMENTS
MEM_ADDRESS_REQUIREMENTS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| LowestStartingAddress | void* | 8/4 | +0 | +0 | 割り当てに許容される最小の開始アドレス。 |
| HighestEndingAddress | void* | 8/4 | +8 | +4 | 割り当てに許容される最大の終了アドレス。 |
| Alignment | UINT_PTR | 8/4 | +16 | +8 | 割り当てに要求されるアドレス境界整列バイト数。 |
各言語での定義
#include <windows.h>
// MEM_ADDRESS_REQUIREMENTS (x64 24 / x86 12 バイト)
typedef struct MEM_ADDRESS_REQUIREMENTS {
void* LowestStartingAddress;
void* HighestEndingAddress;
UINT_PTR Alignment;
} MEM_ADDRESS_REQUIREMENTS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MEM_ADDRESS_REQUIREMENTS
{
public IntPtr LowestStartingAddress;
public IntPtr HighestEndingAddress;
public UIntPtr Alignment;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MEM_ADDRESS_REQUIREMENTS
Public LowestStartingAddress As IntPtr
Public HighestEndingAddress As IntPtr
Public Alignment As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class MEM_ADDRESS_REQUIREMENTS(ctypes.Structure):
_fields_ = [
("LowestStartingAddress", ctypes.c_void_p),
("HighestEndingAddress", ctypes.c_void_p),
("Alignment", ctypes.c_size_t),
]#[repr(C)]
pub struct MEM_ADDRESS_REQUIREMENTS {
pub LowestStartingAddress: *mut core::ffi::c_void,
pub HighestEndingAddress: *mut core::ffi::c_void,
pub Alignment: usize,
}import "golang.org/x/sys/windows"
type MEM_ADDRESS_REQUIREMENTS struct {
LowestStartingAddress uintptr
HighestEndingAddress uintptr
Alignment uintptr
}type
MEM_ADDRESS_REQUIREMENTS = record
LowestStartingAddress: Pointer;
HighestEndingAddress: Pointer;
Alignment: NativeUInt;
end;const MEM_ADDRESS_REQUIREMENTS = extern struct {
LowestStartingAddress: ?*anyopaque,
HighestEndingAddress: ?*anyopaque,
Alignment: usize,
};type
MEM_ADDRESS_REQUIREMENTS {.bycopy.} = object
LowestStartingAddress: pointer
HighestEndingAddress: pointer
Alignment: uintstruct MEM_ADDRESS_REQUIREMENTS
{
void* LowestStartingAddress;
void* HighestEndingAddress;
size_t Alignment;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MEM_ADDRESS_REQUIREMENTS サイズ: 12 バイト(x86)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; LowestStartingAddress : void* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; HighestEndingAddress : void* (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Alignment : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MEM_ADDRESS_REQUIREMENTS サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; LowestStartingAddress : void* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; HighestEndingAddress : void* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Alignment : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MEM_ADDRESS_REQUIREMENTS
#field intptr LowestStartingAddress
#field intptr HighestEndingAddress
#field intptr Alignment
#endstruct
stdim st, MEM_ADDRESS_REQUIREMENTS ; NSTRUCT 変数を確保
st->Alignment = 100
mes "Alignment=" + st->Alignment