ホーム › System.Diagnostics.ToolHelp › HEAPENTRY32
HEAPENTRY32
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | UINT_PTR | 8/4 | +0 | +0 | 本構造体のバイトサイズ。使用前に設定が必要。 |
| hHandle | HANDLE | 8/4 | +8 | +4 | ヒープブロックのハンドル。 |
| dwAddress | UINT_PTR | 8/4 | +16 | +8 | ヒープブロックの線形アドレス。 |
| dwBlockSize | UINT_PTR | 8/4 | +24 | +12 | ヒープブロックのサイズ。単位はバイト。 |
| dwFlags | HEAPENTRY32_FLAGS | 4 | +32 | +16 | ブロックの状態フラグ(LF32_FIXED/FREE/MOVEABLE)。 |
| dwLockCount | DWORD | 4 | +36 | +20 | ブロックのロックカウント。 |
| dwResvd | DWORD | 4 | +40 | +24 | 予約フィールド。0であること。 |
| th32ProcessID | DWORD | 4 | +44 | +28 | ヒープが属するプロセスのID。 |
| th32HeapID | UINT_PTR | 8/4 | +48 | +32 | ヒープの識別子。 |
各言語での定義
#include <windows.h>
// HEAPENTRY32 (x64 56 / x86 36 バイト)
typedef struct HEAPENTRY32 {
UINT_PTR dwSize;
HANDLE hHandle;
UINT_PTR dwAddress;
UINT_PTR dwBlockSize;
HEAPENTRY32_FLAGS dwFlags;
DWORD dwLockCount;
DWORD dwResvd;
DWORD th32ProcessID;
UINT_PTR th32HeapID;
} HEAPENTRY32;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HEAPENTRY32
{
public UIntPtr dwSize;
public IntPtr hHandle;
public UIntPtr dwAddress;
public UIntPtr dwBlockSize;
public uint dwFlags;
public uint dwLockCount;
public uint dwResvd;
public uint th32ProcessID;
public UIntPtr th32HeapID;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HEAPENTRY32
Public dwSize As UIntPtr
Public hHandle As IntPtr
Public dwAddress As UIntPtr
Public dwBlockSize As UIntPtr
Public dwFlags As UInteger
Public dwLockCount As UInteger
Public dwResvd As UInteger
Public th32ProcessID As UInteger
Public th32HeapID As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class HEAPENTRY32(ctypes.Structure):
_fields_ = [
("dwSize", ctypes.c_size_t),
("hHandle", ctypes.c_void_p),
("dwAddress", ctypes.c_size_t),
("dwBlockSize", ctypes.c_size_t),
("dwFlags", wintypes.DWORD),
("dwLockCount", wintypes.DWORD),
("dwResvd", wintypes.DWORD),
("th32ProcessID", wintypes.DWORD),
("th32HeapID", ctypes.c_size_t),
]#[repr(C)]
pub struct HEAPENTRY32 {
pub dwSize: usize,
pub hHandle: *mut core::ffi::c_void,
pub dwAddress: usize,
pub dwBlockSize: usize,
pub dwFlags: u32,
pub dwLockCount: u32,
pub dwResvd: u32,
pub th32ProcessID: u32,
pub th32HeapID: usize,
}import "golang.org/x/sys/windows"
type HEAPENTRY32 struct {
dwSize uintptr
hHandle uintptr
dwAddress uintptr
dwBlockSize uintptr
dwFlags uint32
dwLockCount uint32
dwResvd uint32
th32ProcessID uint32
th32HeapID uintptr
}type
HEAPENTRY32 = record
dwSize: NativeUInt;
hHandle: Pointer;
dwAddress: NativeUInt;
dwBlockSize: NativeUInt;
dwFlags: DWORD;
dwLockCount: DWORD;
dwResvd: DWORD;
th32ProcessID: DWORD;
th32HeapID: NativeUInt;
end;const HEAPENTRY32 = extern struct {
dwSize: usize,
hHandle: ?*anyopaque,
dwAddress: usize,
dwBlockSize: usize,
dwFlags: u32,
dwLockCount: u32,
dwResvd: u32,
th32ProcessID: u32,
th32HeapID: usize,
};type
HEAPENTRY32 {.bycopy.} = object
dwSize: uint
hHandle: pointer
dwAddress: uint
dwBlockSize: uint
dwFlags: uint32
dwLockCount: uint32
dwResvd: uint32
th32ProcessID: uint32
th32HeapID: uintstruct HEAPENTRY32
{
size_t dwSize;
void* hHandle;
size_t dwAddress;
size_t dwBlockSize;
uint dwFlags;
uint dwLockCount;
uint dwResvd;
uint th32ProcessID;
size_t th32HeapID;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; HEAPENTRY32 サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; dwSize : UINT_PTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hHandle : HANDLE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwAddress : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwBlockSize : UINT_PTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwFlags : HEAPENTRY32_FLAGS (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwLockCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwResvd : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; th32ProcessID : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; th32HeapID : UINT_PTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HEAPENTRY32 サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwSize : UINT_PTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; hHandle : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwAddress : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwBlockSize : UINT_PTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwFlags : HEAPENTRY32_FLAGS (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwLockCount : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwResvd : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; th32ProcessID : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; th32HeapID : UINT_PTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HEAPENTRY32
#field intptr dwSize
#field intptr hHandle
#field intptr dwAddress
#field intptr dwBlockSize
#field int dwFlags
#field int dwLockCount
#field int dwResvd
#field int th32ProcessID
#field intptr th32HeapID
#endstruct
stdim st, HEAPENTRY32 ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize