GetWriteWatch
関数シグネチャ
// KERNEL32.dll
#include <windows.h>
DWORD GetWriteWatch(
DWORD dwFlags,
void* lpBaseAddress,
UINT_PTR dwRegionSize,
void** lpAddresses, // optional
UINT_PTR* lpdwCount, // optional
DWORD* lpdwGranularity // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dwFlags | DWORD | in | 関数が書き込み追跡の状態をリセットするかどうかを指定します。 書き込み追跡の状態をリセットするには、このパラメーターに WRITE_WATCH_FLAG_RESET を設定します。このパラメーターが 0 (ゼロ) の場合、GetWriteWatch は書き込み追跡の状態をリセットしません。詳細については、このトピックの「解説」セクションを参照してください。 |
| lpBaseAddress | void* | in | 書き込み追跡情報を取得する対象のメモリ領域の基底アドレスです。 このアドレスは、VirtualAlloc 関数によって MEM_WRITE_WATCH を使用して割り当てられたメモリ領域内になければなりません。 |
| dwRegionSize | UINT_PTR | in | 書き込み追跡情報を取得する対象のメモリ領域のサイズ (バイト単位) です。 |
| lpAddresses | void** | outoptional | メモリ領域内のページアドレスの配列を受け取るバッファーへのポインターです。 これらのアドレスは、領域が割り当てられてから、または書き込み追跡の状態がリセットされてから書き込みが行われたページを示します。 |
| lpdwCount | UINT_PTR* | inoutoptional | 入力時には、この変数は lpAddresses 配列のサイズを配列要素数で示します。 出力時には、この変数は配列に返されたページアドレスの数を受け取ります。 |
| lpdwGranularity | DWORD* | outoptional | ページサイズ (バイト単位) を受け取る変数へのポインターです。 |
戻り値の型: DWORD
公式ドキュメント
仮想メモリの領域内で書き込みが行われたページのアドレスを取得します。
戻り値
関数が成功した場合、戻り値は 0 (ゼロ) です。
関数が失敗した場合、戻り値は 0 以外の値になります。
解説(Remarks)
VirtualAlloc 関数を呼び出してメモリを予約またはコミットする際に、MEM_WRITE_WATCH を指定できます。この値を指定すると、システムはコミットされたメモリ領域内で書き込みが行われたページを追跡します。GetWriteWatch 関数を呼び出すと、領域が割り当てられてから、または書き込み追跡の状態がリセットされてから書き込みが行われたページのアドレスを取得できます。
書き込み追跡の状態をリセットするには、dwFlags パラメーターに WRITE_WATCH_FLAG_RESET 値を設定します。あるいは、ResetWriteWatch 関数を呼び出して書き込み追跡の状態をリセットすることもできます。ただし、ResetWriteWatch を使用する場合は、GetWriteWatch と ResetWriteWatch の呼び出しの間に、どのスレッドもその領域に書き込みを行わないようにする必要があります。そうしないと、検出されない書き込み済みページが生じる可能性があります。
GetWriteWatch 関数は、プロファイラー、デバッグツール、またはガベージコレクターにとって役立ちます。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
DWORD GetWriteWatch(
DWORD dwFlags,
void* lpBaseAddress,
UINT_PTR dwRegionSize,
void** lpAddresses, // optional
UINT_PTR* lpdwCount, // optional
DWORD* lpdwGranularity // optional
);[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint GetWriteWatch(
uint dwFlags, // DWORD
IntPtr lpBaseAddress, // void*
UIntPtr dwRegionSize, // UINT_PTR
IntPtr lpAddresses, // void** optional, out
IntPtr lpdwCount, // UINT_PTR* optional, in/out
IntPtr lpdwGranularity // DWORD* optional, out
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GetWriteWatch(
dwFlags As UInteger, ' DWORD
lpBaseAddress As IntPtr, ' void*
dwRegionSize As UIntPtr, ' UINT_PTR
lpAddresses As IntPtr, ' void** optional, out
lpdwCount As IntPtr, ' UINT_PTR* optional, in/out
lpdwGranularity As IntPtr ' DWORD* optional, out
) As UInteger
End Function' dwFlags : DWORD
' lpBaseAddress : void*
' dwRegionSize : UINT_PTR
' lpAddresses : void** optional, out
' lpdwCount : UINT_PTR* optional, in/out
' lpdwGranularity : DWORD* optional, out
Declare PtrSafe Function GetWriteWatch Lib "kernel32" ( _
ByVal dwFlags As Long, _
ByVal lpBaseAddress As LongPtr, _
ByVal dwRegionSize As LongPtr, _
ByVal lpAddresses As LongPtr, _
ByVal lpdwCount As LongPtr, _
ByVal lpdwGranularity As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetWriteWatch = ctypes.windll.kernel32.GetWriteWatch
GetWriteWatch.restype = wintypes.DWORD
GetWriteWatch.argtypes = [
wintypes.DWORD, # dwFlags : DWORD
ctypes.POINTER(None), # lpBaseAddress : void*
ctypes.c_size_t, # dwRegionSize : UINT_PTR
ctypes.c_void_p, # lpAddresses : void** optional, out
ctypes.POINTER(ctypes.c_size_t), # lpdwCount : UINT_PTR* optional, in/out
ctypes.POINTER(wintypes.DWORD), # lpdwGranularity : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetWriteWatch = Fiddle::Function.new(
lib['GetWriteWatch'],
[
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # lpBaseAddress : void*
Fiddle::TYPE_UINTPTR_T, # dwRegionSize : UINT_PTR
Fiddle::TYPE_VOIDP, # lpAddresses : void** optional, out
Fiddle::TYPE_VOIDP, # lpdwCount : UINT_PTR* optional, in/out
Fiddle::TYPE_VOIDP, # lpdwGranularity : DWORD* optional, out
],
-Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn GetWriteWatch(
dwFlags: u32, // DWORD
lpBaseAddress: *mut (), // void*
dwRegionSize: usize, // UINT_PTR
lpAddresses: *mut *mut (), // void** optional, out
lpdwCount: *mut usize, // UINT_PTR* optional, in/out
lpdwGranularity: *mut u32 // DWORD* optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint GetWriteWatch(uint dwFlags, IntPtr lpBaseAddress, UIntPtr dwRegionSize, IntPtr lpAddresses, IntPtr lpdwCount, IntPtr lpdwGranularity);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetWriteWatch' -Namespace Win32 -PassThru
# $api::GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity)#uselib "KERNEL32.dll"
#func global GetWriteWatch "GetWriteWatch" sptr, sptr, sptr, sptr, sptr, sptr
; GetWriteWatch dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, varptr(lpdwCount), varptr(lpdwGranularity) ; 戻り値は stat
; dwFlags : DWORD -> "sptr"
; lpBaseAddress : void* -> "sptr"
; dwRegionSize : UINT_PTR -> "sptr"
; lpAddresses : void** optional, out -> "sptr"
; lpdwCount : UINT_PTR* optional, in/out -> "sptr"
; lpdwGranularity : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll" #cfunc global GetWriteWatch "GetWriteWatch" int, sptr, sptr, sptr, var, var ; res = GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity) ; dwFlags : DWORD -> "int" ; lpBaseAddress : void* -> "sptr" ; dwRegionSize : UINT_PTR -> "sptr" ; lpAddresses : void** optional, out -> "sptr" ; lpdwCount : UINT_PTR* optional, in/out -> "var" ; lpdwGranularity : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global GetWriteWatch "GetWriteWatch" int, sptr, sptr, sptr, sptr, sptr ; res = GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, varptr(lpdwCount), varptr(lpdwGranularity)) ; dwFlags : DWORD -> "int" ; lpBaseAddress : void* -> "sptr" ; dwRegionSize : UINT_PTR -> "sptr" ; lpAddresses : void** optional, out -> "sptr" ; lpdwCount : UINT_PTR* optional, in/out -> "sptr" ; lpdwGranularity : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
; DWORD GetWriteWatch(DWORD dwFlags, void* lpBaseAddress, UINT_PTR dwRegionSize, void** lpAddresses, UINT_PTR* lpdwCount, DWORD* lpdwGranularity) #uselib "KERNEL32.dll" #cfunc global GetWriteWatch "GetWriteWatch" int, intptr, intptr, intptr, var, var ; res = GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity) ; dwFlags : DWORD -> "int" ; lpBaseAddress : void* -> "intptr" ; dwRegionSize : UINT_PTR -> "intptr" ; lpAddresses : void** optional, out -> "intptr" ; lpdwCount : UINT_PTR* optional, in/out -> "var" ; lpdwGranularity : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD GetWriteWatch(DWORD dwFlags, void* lpBaseAddress, UINT_PTR dwRegionSize, void** lpAddresses, UINT_PTR* lpdwCount, DWORD* lpdwGranularity) #uselib "KERNEL32.dll" #cfunc global GetWriteWatch "GetWriteWatch" int, intptr, intptr, intptr, intptr, intptr ; res = GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, varptr(lpdwCount), varptr(lpdwGranularity)) ; dwFlags : DWORD -> "int" ; lpBaseAddress : void* -> "intptr" ; dwRegionSize : UINT_PTR -> "intptr" ; lpAddresses : void** optional, out -> "intptr" ; lpdwCount : UINT_PTR* optional, in/out -> "intptr" ; lpdwGranularity : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetWriteWatch = kernel32.NewProc("GetWriteWatch")
)
// dwFlags (DWORD), lpBaseAddress (void*), dwRegionSize (UINT_PTR), lpAddresses (void** optional, out), lpdwCount (UINT_PTR* optional, in/out), lpdwGranularity (DWORD* optional, out)
r1, _, err := procGetWriteWatch.Call(
uintptr(dwFlags),
uintptr(lpBaseAddress),
uintptr(dwRegionSize),
uintptr(lpAddresses),
uintptr(lpdwCount),
uintptr(lpdwGranularity),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetWriteWatch(
dwFlags: DWORD; // DWORD
lpBaseAddress: Pointer; // void*
dwRegionSize: NativeUInt; // UINT_PTR
lpAddresses: Pointer; // void** optional, out
lpdwCount: Pointer; // UINT_PTR* optional, in/out
lpdwGranularity: Pointer // DWORD* optional, out
): DWORD; stdcall;
external 'KERNEL32.dll' name 'GetWriteWatch';result := DllCall("KERNEL32\GetWriteWatch"
, "UInt", dwFlags ; DWORD
, "Ptr", lpBaseAddress ; void*
, "UPtr", dwRegionSize ; UINT_PTR
, "Ptr", lpAddresses ; void** optional, out
, "Ptr", lpdwCount ; UINT_PTR* optional, in/out
, "Ptr", lpdwGranularity ; DWORD* optional, out
, "UInt") ; return: DWORD●GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity) = DLL("KERNEL32.dll", "dword GetWriteWatch(dword, void*, int, void*, void*, void*)")
# 呼び出し: GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity)
# dwFlags : DWORD -> "dword"
# lpBaseAddress : void* -> "void*"
# dwRegionSize : UINT_PTR -> "int"
# lpAddresses : void** optional, out -> "void*"
# lpdwCount : UINT_PTR* optional, in/out -> "void*"
# lpdwGranularity : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "kernel32" fn GetWriteWatch(
dwFlags: u32, // DWORD
lpBaseAddress: ?*anyopaque, // void*
dwRegionSize: usize, // UINT_PTR
lpAddresses: ?*anyopaque, // void** optional, out
lpdwCount: [*c]usize, // UINT_PTR* optional, in/out
lpdwGranularity: [*c]u32 // DWORD* optional, out
) callconv(std.os.windows.WINAPI) u32;proc GetWriteWatch(
dwFlags: uint32, # DWORD
lpBaseAddress: pointer, # void*
dwRegionSize: uint, # UINT_PTR
lpAddresses: pointer, # void** optional, out
lpdwCount: ptr uint, # UINT_PTR* optional, in/out
lpdwGranularity: ptr uint32 # DWORD* optional, out
): uint32 {.importc: "GetWriteWatch", stdcall, dynlib: "KERNEL32.dll".}pragma(lib, "kernel32");
extern(Windows)
uint GetWriteWatch(
uint dwFlags, // DWORD
void* lpBaseAddress, // void*
size_t dwRegionSize, // UINT_PTR
void** lpAddresses, // void** optional, out
size_t* lpdwCount, // UINT_PTR* optional, in/out
uint* lpdwGranularity // DWORD* optional, out
);ccall((:GetWriteWatch, "KERNEL32.dll"), stdcall, UInt32,
(UInt32, Ptr{Cvoid}, Csize_t, Ptr{Cvoid}, Ptr{Csize_t}, Ptr{UInt32}),
dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity)
# dwFlags : DWORD -> UInt32
# lpBaseAddress : void* -> Ptr{Cvoid}
# dwRegionSize : UINT_PTR -> Csize_t
# lpAddresses : void** optional, out -> Ptr{Cvoid}
# lpdwCount : UINT_PTR* optional, in/out -> Ptr{Csize_t}
# lpdwGranularity : DWORD* optional, out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t GetWriteWatch(
uint32_t dwFlags,
void* lpBaseAddress,
uintptr_t dwRegionSize,
void** lpAddresses,
uintptr_t* lpdwCount,
uint32_t* lpdwGranularity);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity)
-- dwFlags : DWORD
-- lpBaseAddress : void*
-- dwRegionSize : UINT_PTR
-- lpAddresses : void** optional, out
-- lpdwCount : UINT_PTR* optional, in/out
-- lpdwGranularity : DWORD* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const GetWriteWatch = lib.func('__stdcall', 'GetWriteWatch', 'uint32_t', ['uint32_t', 'void *', 'uintptr_t', 'void *', 'uintptr_t *', 'uint32_t *']);
// GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity)
// dwFlags : DWORD -> 'uint32_t'
// lpBaseAddress : void* -> 'void *'
// dwRegionSize : UINT_PTR -> 'uintptr_t'
// lpAddresses : void** optional, out -> 'void *'
// lpdwCount : UINT_PTR* optional, in/out -> 'uintptr_t *'
// lpdwGranularity : DWORD* optional, out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("KERNEL32.dll", {
GetWriteWatch: { parameters: ["u32", "pointer", "usize", "pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity)
// dwFlags : DWORD -> "u32"
// lpBaseAddress : void* -> "pointer"
// dwRegionSize : UINT_PTR -> "usize"
// lpAddresses : void** optional, out -> "pointer"
// lpdwCount : UINT_PTR* optional, in/out -> "pointer"
// lpdwGranularity : DWORD* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t GetWriteWatch(
uint32_t dwFlags,
void* lpBaseAddress,
size_t dwRegionSize,
void** lpAddresses,
size_t* lpdwCount,
uint32_t* lpdwGranularity);
C, "KERNEL32.dll");
// $ffi->GetWriteWatch(dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity);
// dwFlags : DWORD
// lpBaseAddress : void*
// dwRegionSize : UINT_PTR
// lpAddresses : void** optional, out
// lpdwCount : UINT_PTR* optional, in/out
// lpdwGranularity : DWORD* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Kernel32 extends StdCallLibrary {
Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class);
int GetWriteWatch(
int dwFlags, // DWORD
Pointer lpBaseAddress, // void*
long dwRegionSize, // UINT_PTR
Pointer lpAddresses, // void** optional, out
LongByReference lpdwCount, // UINT_PTR* optional, in/out
IntByReference lpdwGranularity // DWORD* optional, out
);
}@[Link("kernel32")]
lib LibKERNEL32
fun GetWriteWatch = GetWriteWatch(
dwFlags : UInt32, # DWORD
lpBaseAddress : Void*, # void*
dwRegionSize : LibC::SizeT, # UINT_PTR
lpAddresses : Void**, # void** optional, out
lpdwCount : LibC::SizeT*, # UINT_PTR* optional, in/out
lpdwGranularity : UInt32* # DWORD* optional, out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetWriteWatchNative = Uint32 Function(Uint32, Pointer<Void>, UintPtr, Pointer<Void>, Pointer<UintPtr>, Pointer<Uint32>);
typedef GetWriteWatchDart = int Function(int, Pointer<Void>, int, Pointer<Void>, Pointer<UintPtr>, Pointer<Uint32>);
final GetWriteWatch = DynamicLibrary.open('KERNEL32.dll')
.lookupFunction<GetWriteWatchNative, GetWriteWatchDart>('GetWriteWatch');
// dwFlags : DWORD -> Uint32
// lpBaseAddress : void* -> Pointer<Void>
// dwRegionSize : UINT_PTR -> UintPtr
// lpAddresses : void** optional, out -> Pointer<Void>
// lpdwCount : UINT_PTR* optional, in/out -> Pointer<UintPtr>
// lpdwGranularity : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetWriteWatch(
dwFlags: DWORD; // DWORD
lpBaseAddress: Pointer; // void*
dwRegionSize: NativeUInt; // UINT_PTR
lpAddresses: Pointer; // void** optional, out
lpdwCount: Pointer; // UINT_PTR* optional, in/out
lpdwGranularity: Pointer // DWORD* optional, out
): DWORD; stdcall;
external 'KERNEL32.dll' name 'GetWriteWatch';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetWriteWatch"
c_GetWriteWatch :: Word32 -> Ptr () -> CUIntPtr -> Ptr () -> Ptr CUIntPtr -> Ptr Word32 -> IO Word32
-- dwFlags : DWORD -> Word32
-- lpBaseAddress : void* -> Ptr ()
-- dwRegionSize : UINT_PTR -> CUIntPtr
-- lpAddresses : void** optional, out -> Ptr ()
-- lpdwCount : UINT_PTR* optional, in/out -> Ptr CUIntPtr
-- lpdwGranularity : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let getwritewatch =
foreign "GetWriteWatch"
(uint32_t @-> (ptr void) @-> size_t @-> (ptr void) @-> (ptr size_t) @-> (ptr uint32_t) @-> returning uint32_t)
(* dwFlags : DWORD -> uint32_t *)
(* lpBaseAddress : void* -> (ptr void) *)
(* dwRegionSize : UINT_PTR -> size_t *)
(* lpAddresses : void** optional, out -> (ptr void) *)
(* lpdwCount : UINT_PTR* optional, in/out -> (ptr size_t) *)
(* lpdwGranularity : DWORD* optional, out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)
(cffi:defcfun ("GetWriteWatch" get-write-watch :convention :stdcall) :uint32
(dw-flags :uint32) ; DWORD
(lp-base-address :pointer) ; void*
(dw-region-size :uint64) ; UINT_PTR
(lp-addresses :pointer) ; void** optional, out
(lpdw-count :pointer) ; UINT_PTR* optional, in/out
(lpdw-granularity :pointer)) ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetWriteWatch = Win32::API::More->new('KERNEL32',
'DWORD GetWriteWatch(DWORD dwFlags, LPVOID lpBaseAddress, WPARAM dwRegionSize, LPVOID lpAddresses, LPVOID lpdwCount, LPVOID lpdwGranularity)');
# my $ret = $GetWriteWatch->Call($dwFlags, $lpBaseAddress, $dwRegionSize, $lpAddresses, $lpdwCount, $lpdwGranularity);
# dwFlags : DWORD -> DWORD
# lpBaseAddress : void* -> LPVOID
# dwRegionSize : UINT_PTR -> WPARAM
# lpAddresses : void** optional, out -> LPVOID
# lpdwCount : UINT_PTR* optional, in/out -> LPVOID
# lpdwGranularity : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f ResetWriteWatch — 指定メモリ領域の書き込み監視状態をリセットする。
- f VirtualAlloc — プロセスの仮想アドレス空間にメモリを確保する。