ホーム › System.Memory.NonVolatile › RtlFillNonVolatileMemory
RtlFillNonVolatileMemory
関数不揮発性メモリの指定範囲を指定値で埋める。
シグネチャ
// ntdll.dll
#include <windows.h>
DWORD RtlFillNonVolatileMemory(
void* NvToken,
void* NvDestination,
UINT_PTR Size,
BYTE Value,
DWORD Flags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| NvToken | void* | in |
| NvDestination | void* | out |
| Size | UINT_PTR | in |
| Value | BYTE | in |
| Flags | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// ntdll.dll
#include <windows.h>
DWORD RtlFillNonVolatileMemory(
void* NvToken,
void* NvDestination,
UINT_PTR Size,
BYTE Value,
DWORD Flags
);[DllImport("ntdll.dll", ExactSpelling = true)]
static extern uint RtlFillNonVolatileMemory(
IntPtr NvToken, // void*
IntPtr NvDestination, // void* out
UIntPtr Size, // UINT_PTR
byte Value, // BYTE
uint Flags // DWORD
);<DllImport("ntdll.dll", ExactSpelling:=True)>
Public Shared Function RtlFillNonVolatileMemory(
NvToken As IntPtr, ' void*
NvDestination As IntPtr, ' void* out
Size As UIntPtr, ' UINT_PTR
Value As Byte, ' BYTE
Flags As UInteger ' DWORD
) As UInteger
End Function' NvToken : void*
' NvDestination : void* out
' Size : UINT_PTR
' Value : BYTE
' Flags : DWORD
Declare PtrSafe Function RtlFillNonVolatileMemory Lib "ntdll" ( _
ByVal NvToken As LongPtr, _
ByVal NvDestination As LongPtr, _
ByVal Size As LongPtr, _
ByVal Value As Byte, _
ByVal Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RtlFillNonVolatileMemory = ctypes.windll.ntdll.RtlFillNonVolatileMemory
RtlFillNonVolatileMemory.restype = wintypes.DWORD
RtlFillNonVolatileMemory.argtypes = [
ctypes.POINTER(None), # NvToken : void*
ctypes.POINTER(None), # NvDestination : void* out
ctypes.c_size_t, # Size : UINT_PTR
ctypes.c_ubyte, # Value : BYTE
wintypes.DWORD, # Flags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ntdll.dll')
RtlFillNonVolatileMemory = Fiddle::Function.new(
lib['RtlFillNonVolatileMemory'],
[
Fiddle::TYPE_VOIDP, # NvToken : void*
Fiddle::TYPE_VOIDP, # NvDestination : void* out
Fiddle::TYPE_UINTPTR_T, # Size : UINT_PTR
-Fiddle::TYPE_CHAR, # Value : BYTE
-Fiddle::TYPE_INT, # Flags : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "ntdll")]
extern "system" {
fn RtlFillNonVolatileMemory(
NvToken: *mut (), // void*
NvDestination: *mut (), // void* out
Size: usize, // UINT_PTR
Value: u8, // BYTE
Flags: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ntdll.dll")]
public static extern uint RtlFillNonVolatileMemory(IntPtr NvToken, IntPtr NvDestination, UIntPtr Size, byte Value, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ntdll_RtlFillNonVolatileMemory' -Namespace Win32 -PassThru
# $api::RtlFillNonVolatileMemory(NvToken, NvDestination, Size, Value, Flags)#uselib "ntdll.dll"
#func global RtlFillNonVolatileMemory "RtlFillNonVolatileMemory" sptr, sptr, sptr, sptr, sptr
; RtlFillNonVolatileMemory NvToken, NvDestination, Size, Value, Flags ; 戻り値は stat
; NvToken : void* -> "sptr"
; NvDestination : void* out -> "sptr"
; Size : UINT_PTR -> "sptr"
; Value : BYTE -> "sptr"
; Flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ntdll.dll"
#cfunc global RtlFillNonVolatileMemory "RtlFillNonVolatileMemory" sptr, sptr, sptr, int, int
; res = RtlFillNonVolatileMemory(NvToken, NvDestination, Size, Value, Flags)
; NvToken : void* -> "sptr"
; NvDestination : void* out -> "sptr"
; Size : UINT_PTR -> "sptr"
; Value : BYTE -> "int"
; Flags : DWORD -> "int"; DWORD RtlFillNonVolatileMemory(void* NvToken, void* NvDestination, UINT_PTR Size, BYTE Value, DWORD Flags)
#uselib "ntdll.dll"
#cfunc global RtlFillNonVolatileMemory "RtlFillNonVolatileMemory" intptr, intptr, intptr, int, int
; res = RtlFillNonVolatileMemory(NvToken, NvDestination, Size, Value, Flags)
; NvToken : void* -> "intptr"
; NvDestination : void* out -> "intptr"
; Size : UINT_PTR -> "intptr"
; Value : BYTE -> "int"
; Flags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ntdll = windows.NewLazySystemDLL("ntdll.dll")
procRtlFillNonVolatileMemory = ntdll.NewProc("RtlFillNonVolatileMemory")
)
// NvToken (void*), NvDestination (void* out), Size (UINT_PTR), Value (BYTE), Flags (DWORD)
r1, _, err := procRtlFillNonVolatileMemory.Call(
uintptr(NvToken),
uintptr(NvDestination),
uintptr(Size),
uintptr(Value),
uintptr(Flags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RtlFillNonVolatileMemory(
NvToken: Pointer; // void*
NvDestination: Pointer; // void* out
Size: NativeUInt; // UINT_PTR
Value: Byte; // BYTE
Flags: DWORD // DWORD
): DWORD; stdcall;
external 'ntdll.dll' name 'RtlFillNonVolatileMemory';result := DllCall("ntdll\RtlFillNonVolatileMemory"
, "Ptr", NvToken ; void*
, "Ptr", NvDestination ; void* out
, "UPtr", Size ; UINT_PTR
, "UChar", Value ; BYTE
, "UInt", Flags ; DWORD
, "UInt") ; return: DWORD●RtlFillNonVolatileMemory(NvToken, NvDestination, Size, Value, Flags) = DLL("ntdll.dll", "dword RtlFillNonVolatileMemory(void*, void*, int, byte, dword)")
# 呼び出し: RtlFillNonVolatileMemory(NvToken, NvDestination, Size, Value, Flags)
# NvToken : void* -> "void*"
# NvDestination : void* out -> "void*"
# Size : UINT_PTR -> "int"
# Value : BYTE -> "byte"
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。