ホーム › System.Diagnostics.Debug › FlushInstructionCache
FlushInstructionCache
関数指定プロセスの命令キャッシュをフラッシュする。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL FlushInstructionCache(
HANDLE hProcess,
const void* lpBaseAddress, // optional
UINT_PTR dwSize
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProcess | HANDLE | in |
| lpBaseAddress | void* | inoptional |
| dwSize | UINT_PTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL FlushInstructionCache(
HANDLE hProcess,
const void* lpBaseAddress, // optional
UINT_PTR dwSize
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool FlushInstructionCache(
IntPtr hProcess, // HANDLE
IntPtr lpBaseAddress, // void* optional
UIntPtr dwSize // UINT_PTR
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FlushInstructionCache(
hProcess As IntPtr, ' HANDLE
lpBaseAddress As IntPtr, ' void* optional
dwSize As UIntPtr ' UINT_PTR
) As Boolean
End Function' hProcess : HANDLE
' lpBaseAddress : void* optional
' dwSize : UINT_PTR
Declare PtrSafe Function FlushInstructionCache Lib "kernel32" ( _
ByVal hProcess As LongPtr, _
ByVal lpBaseAddress As LongPtr, _
ByVal dwSize As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FlushInstructionCache = ctypes.windll.kernel32.FlushInstructionCache
FlushInstructionCache.restype = wintypes.BOOL
FlushInstructionCache.argtypes = [
wintypes.HANDLE, # hProcess : HANDLE
ctypes.POINTER(None), # lpBaseAddress : void* optional
ctypes.c_size_t, # dwSize : UINT_PTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
FlushInstructionCache = Fiddle::Function.new(
lib['FlushInstructionCache'],
[
Fiddle::TYPE_VOIDP, # hProcess : HANDLE
Fiddle::TYPE_VOIDP, # lpBaseAddress : void* optional
Fiddle::TYPE_UINTPTR_T, # dwSize : UINT_PTR
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn FlushInstructionCache(
hProcess: *mut core::ffi::c_void, // HANDLE
lpBaseAddress: *const (), // void* optional
dwSize: usize // UINT_PTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool FlushInstructionCache(IntPtr hProcess, IntPtr lpBaseAddress, UIntPtr dwSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_FlushInstructionCache' -Namespace Win32 -PassThru
# $api::FlushInstructionCache(hProcess, lpBaseAddress, dwSize)#uselib "KERNEL32.dll"
#func global FlushInstructionCache "FlushInstructionCache" sptr, sptr, sptr
; FlushInstructionCache hProcess, lpBaseAddress, dwSize ; 戻り値は stat
; hProcess : HANDLE -> "sptr"
; lpBaseAddress : void* optional -> "sptr"
; dwSize : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global FlushInstructionCache "FlushInstructionCache" sptr, sptr, sptr
; res = FlushInstructionCache(hProcess, lpBaseAddress, dwSize)
; hProcess : HANDLE -> "sptr"
; lpBaseAddress : void* optional -> "sptr"
; dwSize : UINT_PTR -> "sptr"; BOOL FlushInstructionCache(HANDLE hProcess, void* lpBaseAddress, UINT_PTR dwSize)
#uselib "KERNEL32.dll"
#cfunc global FlushInstructionCache "FlushInstructionCache" intptr, intptr, intptr
; res = FlushInstructionCache(hProcess, lpBaseAddress, dwSize)
; hProcess : HANDLE -> "intptr"
; lpBaseAddress : void* optional -> "intptr"
; dwSize : UINT_PTR -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procFlushInstructionCache = kernel32.NewProc("FlushInstructionCache")
)
// hProcess (HANDLE), lpBaseAddress (void* optional), dwSize (UINT_PTR)
r1, _, err := procFlushInstructionCache.Call(
uintptr(hProcess),
uintptr(lpBaseAddress),
uintptr(dwSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FlushInstructionCache(
hProcess: THandle; // HANDLE
lpBaseAddress: Pointer; // void* optional
dwSize: NativeUInt // UINT_PTR
): BOOL; stdcall;
external 'KERNEL32.dll' name 'FlushInstructionCache';result := DllCall("KERNEL32\FlushInstructionCache"
, "Ptr", hProcess ; HANDLE
, "Ptr", lpBaseAddress ; void* optional
, "UPtr", dwSize ; UINT_PTR
, "Int") ; return: BOOL●FlushInstructionCache(hProcess, lpBaseAddress, dwSize) = DLL("KERNEL32.dll", "bool FlushInstructionCache(void*, void*, int)")
# 呼び出し: FlushInstructionCache(hProcess, lpBaseAddress, dwSize)
# hProcess : HANDLE -> "void*"
# lpBaseAddress : void* optional -> "void*"
# dwSize : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。