ホーム › System.Diagnostics.Debug.Extensions › SEARCHMEMORY
SEARCHMEMORY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SearchAddress | ULONGLONG | 8 | +0 | +0 | メモリ検索の開始アドレス。 |
| SearchLength | ULONGLONG | 8 | +8 | +8 | 検索対象範囲のバイト長。 |
| FoundAddress | ULONGLONG | 8 | +16 | +16 | パターンが見つかったアドレス(出力)。 |
| PatternLength | DWORD | 4 | +24 | +24 | 検索パターンのバイト長。 |
| Pattern | void* | 8/4 | +32 | +28 | 検索するバイトパターンへのポインタ。 |
各言語での定義
#include <windows.h>
// SEARCHMEMORY (x64 40 / x86 32 バイト)
typedef struct SEARCHMEMORY {
ULONGLONG SearchAddress;
ULONGLONG SearchLength;
ULONGLONG FoundAddress;
DWORD PatternLength;
void* Pattern;
} SEARCHMEMORY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SEARCHMEMORY
{
public ulong SearchAddress;
public ulong SearchLength;
public ulong FoundAddress;
public uint PatternLength;
public IntPtr Pattern;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SEARCHMEMORY
Public SearchAddress As ULong
Public SearchLength As ULong
Public FoundAddress As ULong
Public PatternLength As UInteger
Public Pattern As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class SEARCHMEMORY(ctypes.Structure):
_fields_ = [
("SearchAddress", ctypes.c_ulonglong),
("SearchLength", ctypes.c_ulonglong),
("FoundAddress", ctypes.c_ulonglong),
("PatternLength", wintypes.DWORD),
("Pattern", ctypes.c_void_p),
]#[repr(C)]
pub struct SEARCHMEMORY {
pub SearchAddress: u64,
pub SearchLength: u64,
pub FoundAddress: u64,
pub PatternLength: u32,
pub Pattern: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type SEARCHMEMORY struct {
SearchAddress uint64
SearchLength uint64
FoundAddress uint64
PatternLength uint32
Pattern uintptr
}type
SEARCHMEMORY = record
SearchAddress: UInt64;
SearchLength: UInt64;
FoundAddress: UInt64;
PatternLength: DWORD;
Pattern: Pointer;
end;const SEARCHMEMORY = extern struct {
SearchAddress: u64,
SearchLength: u64,
FoundAddress: u64,
PatternLength: u32,
Pattern: ?*anyopaque,
};type
SEARCHMEMORY {.bycopy.} = object
SearchAddress: uint64
SearchLength: uint64
FoundAddress: uint64
PatternLength: uint32
Pattern: pointerstruct SEARCHMEMORY
{
ulong SearchAddress;
ulong SearchLength;
ulong FoundAddress;
uint PatternLength;
void* Pattern;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SEARCHMEMORY サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; SearchAddress : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; SearchLength : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; FoundAddress : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; PatternLength : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Pattern : void* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SEARCHMEMORY サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; SearchAddress : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; SearchLength : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; FoundAddress : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; PatternLength : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Pattern : void* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SEARCHMEMORY
#field int64 SearchAddress
#field int64 SearchLength
#field int64 FoundAddress
#field int PatternLength
#field intptr Pattern
#endstruct
stdim st, SEARCHMEMORY ; NSTRUCT 変数を確保
st->SearchAddress = 100
mes "SearchAddress=" + st->SearchAddress