Win32 API 日本語リファレンス
ホームSystem.Memory › ResetWriteWatch

ResetWriteWatch

関数
指定メモリ領域の書き込み監視状態をリセットする。
DLLKERNEL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

DWORD ResetWriteWatch(
    void* lpBaseAddress,
    UINT_PTR dwRegionSize
);

パラメーター

名前方向
lpBaseAddressvoid*in
dwRegionSizeUINT_PTRin

戻り値の型: DWORD

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

DWORD ResetWriteWatch(
    void* lpBaseAddress,
    UINT_PTR dwRegionSize
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint ResetWriteWatch(
    IntPtr lpBaseAddress,   // void*
    UIntPtr dwRegionSize   // UINT_PTR
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function ResetWriteWatch(
    lpBaseAddress As IntPtr,   ' void*
    dwRegionSize As UIntPtr   ' UINT_PTR
) As UInteger
End Function
' lpBaseAddress : void*
' dwRegionSize : UINT_PTR
Declare PtrSafe Function ResetWriteWatch Lib "kernel32" ( _
    ByVal lpBaseAddress As LongPtr, _
    ByVal dwRegionSize As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResetWriteWatch = ctypes.windll.kernel32.ResetWriteWatch
ResetWriteWatch.restype = wintypes.DWORD
ResetWriteWatch.argtypes = [
    ctypes.POINTER(None),  # lpBaseAddress : void*
    ctypes.c_size_t,  # dwRegionSize : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
ResetWriteWatch = Fiddle::Function.new(
  lib['ResetWriteWatch'],
  [
    Fiddle::TYPE_VOIDP,  # lpBaseAddress : void*
    Fiddle::TYPE_UINTPTR_T,  # dwRegionSize : UINT_PTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn ResetWriteWatch(
        lpBaseAddress: *mut (),  // void*
        dwRegionSize: usize  // UINT_PTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint ResetWriteWatch(IntPtr lpBaseAddress, UIntPtr dwRegionSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_ResetWriteWatch' -Namespace Win32 -PassThru
# $api::ResetWriteWatch(lpBaseAddress, dwRegionSize)
#uselib "KERNEL32.dll"
#func global ResetWriteWatch "ResetWriteWatch" sptr, sptr
; ResetWriteWatch lpBaseAddress, dwRegionSize   ; 戻り値は stat
; lpBaseAddress : void* -> "sptr"
; dwRegionSize : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global ResetWriteWatch "ResetWriteWatch" sptr, sptr
; res = ResetWriteWatch(lpBaseAddress, dwRegionSize)
; lpBaseAddress : void* -> "sptr"
; dwRegionSize : UINT_PTR -> "sptr"
; DWORD ResetWriteWatch(void* lpBaseAddress, UINT_PTR dwRegionSize)
#uselib "KERNEL32.dll"
#cfunc global ResetWriteWatch "ResetWriteWatch" intptr, intptr
; res = ResetWriteWatch(lpBaseAddress, dwRegionSize)
; lpBaseAddress : void* -> "intptr"
; dwRegionSize : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procResetWriteWatch = kernel32.NewProc("ResetWriteWatch")
)

// lpBaseAddress (void*), dwRegionSize (UINT_PTR)
r1, _, err := procResetWriteWatch.Call(
	uintptr(lpBaseAddress),
	uintptr(dwRegionSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ResetWriteWatch(
  lpBaseAddress: Pointer;   // void*
  dwRegionSize: NativeUInt   // UINT_PTR
): DWORD; stdcall;
  external 'KERNEL32.dll' name 'ResetWriteWatch';
result := DllCall("KERNEL32\ResetWriteWatch"
    , "Ptr", lpBaseAddress   ; void*
    , "UPtr", dwRegionSize   ; UINT_PTR
    , "UInt")   ; return: DWORD
●ResetWriteWatch(lpBaseAddress, dwRegionSize) = DLL("KERNEL32.dll", "dword ResetWriteWatch(void*, int)")
# 呼び出し: ResetWriteWatch(lpBaseAddress, dwRegionSize)
# lpBaseAddress : void* -> "void*"
# dwRegionSize : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。