ホーム › System.Memory › MapViewOfFileNuma2
MapViewOfFileNuma2
関数NUMAノードを指定してファイルマッピングのビューをマップする。
シグネチャ
// api-ms-win-core-memory-l1-1-5.dll
#include <windows.h>
MEMORY_MAPPED_VIEW_ADDRESS MapViewOfFileNuma2(
HANDLE FileMappingHandle,
HANDLE ProcessHandle,
ULONGLONG Offset,
void* BaseAddress, // optional
UINT_PTR ViewSize,
DWORD AllocationType,
DWORD PageProtection,
DWORD PreferredNode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FileMappingHandle | HANDLE | in |
| ProcessHandle | HANDLE | in |
| Offset | ULONGLONG | in |
| BaseAddress | void* | inoptional |
| ViewSize | UINT_PTR | in |
| AllocationType | DWORD | in |
| PageProtection | DWORD | in |
| PreferredNode | DWORD | in |
戻り値の型: MEMORY_MAPPED_VIEW_ADDRESS
各言語での呼び出し定義
// api-ms-win-core-memory-l1-1-5.dll
#include <windows.h>
MEMORY_MAPPED_VIEW_ADDRESS MapViewOfFileNuma2(
HANDLE FileMappingHandle,
HANDLE ProcessHandle,
ULONGLONG Offset,
void* BaseAddress, // optional
UINT_PTR ViewSize,
DWORD AllocationType,
DWORD PageProtection,
DWORD PreferredNode
);[DllImport("api-ms-win-core-memory-l1-1-5.dll", SetLastError = true, ExactSpelling = true)]
static extern MEMORY_MAPPED_VIEW_ADDRESS MapViewOfFileNuma2(
IntPtr FileMappingHandle, // HANDLE
IntPtr ProcessHandle, // HANDLE
ulong Offset, // ULONGLONG
IntPtr BaseAddress, // void* optional
UIntPtr ViewSize, // UINT_PTR
uint AllocationType, // DWORD
uint PageProtection, // DWORD
uint PreferredNode // DWORD
);<DllImport("api-ms-win-core-memory-l1-1-5.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function MapViewOfFileNuma2(
FileMappingHandle As IntPtr, ' HANDLE
ProcessHandle As IntPtr, ' HANDLE
Offset As ULong, ' ULONGLONG
BaseAddress As IntPtr, ' void* optional
ViewSize As UIntPtr, ' UINT_PTR
AllocationType As UInteger, ' DWORD
PageProtection As UInteger, ' DWORD
PreferredNode As UInteger ' DWORD
) As MEMORY_MAPPED_VIEW_ADDRESS
End Function' FileMappingHandle : HANDLE
' ProcessHandle : HANDLE
' Offset : ULONGLONG
' BaseAddress : void* optional
' ViewSize : UINT_PTR
' AllocationType : DWORD
' PageProtection : DWORD
' PreferredNode : DWORD
Declare PtrSafe Function MapViewOfFileNuma2 Lib "api-ms-win-core-memory-l1-1-5" ( _
ByVal FileMappingHandle As LongPtr, _
ByVal ProcessHandle As LongPtr, _
ByVal Offset As LongLong, _
ByVal BaseAddress As LongPtr, _
ByVal ViewSize As LongPtr, _
ByVal AllocationType As Long, _
ByVal PageProtection As Long, _
ByVal PreferredNode As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MapViewOfFileNuma2 = ctypes.windll.LoadLibrary("api-ms-win-core-memory-l1-1-5.dll").MapViewOfFileNuma2
MapViewOfFileNuma2.restype = ctypes.c_void_p
MapViewOfFileNuma2.argtypes = [
wintypes.HANDLE, # FileMappingHandle : HANDLE
wintypes.HANDLE, # ProcessHandle : HANDLE
ctypes.c_ulonglong, # Offset : ULONGLONG
ctypes.POINTER(None), # BaseAddress : void* optional
ctypes.c_size_t, # ViewSize : UINT_PTR
wintypes.DWORD, # AllocationType : DWORD
wintypes.DWORD, # PageProtection : DWORD
wintypes.DWORD, # PreferredNode : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-memory-l1-1-5.dll')
MapViewOfFileNuma2 = Fiddle::Function.new(
lib['MapViewOfFileNuma2'],
[
Fiddle::TYPE_VOIDP, # FileMappingHandle : HANDLE
Fiddle::TYPE_VOIDP, # ProcessHandle : HANDLE
-Fiddle::TYPE_LONG_LONG, # Offset : ULONGLONG
Fiddle::TYPE_VOIDP, # BaseAddress : void* optional
Fiddle::TYPE_UINTPTR_T, # ViewSize : UINT_PTR
-Fiddle::TYPE_INT, # AllocationType : DWORD
-Fiddle::TYPE_INT, # PageProtection : DWORD
-Fiddle::TYPE_INT, # PreferredNode : DWORD
],
Fiddle::TYPE_VOIDP)#[link(name = "api-ms-win-core-memory-l1-1-5")]
extern "system" {
fn MapViewOfFileNuma2(
FileMappingHandle: *mut core::ffi::c_void, // HANDLE
ProcessHandle: *mut core::ffi::c_void, // HANDLE
Offset: u64, // ULONGLONG
BaseAddress: *mut (), // void* optional
ViewSize: usize, // UINT_PTR
AllocationType: u32, // DWORD
PageProtection: u32, // DWORD
PreferredNode: u32 // DWORD
) -> MEMORY_MAPPED_VIEW_ADDRESS;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-memory-l1-1-5.dll", SetLastError = true)]
public static extern MEMORY_MAPPED_VIEW_ADDRESS MapViewOfFileNuma2(IntPtr FileMappingHandle, IntPtr ProcessHandle, ulong Offset, IntPtr BaseAddress, UIntPtr ViewSize, uint AllocationType, uint PageProtection, uint PreferredNode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-memory-l1-1-5_MapViewOfFileNuma2' -Namespace Win32 -PassThru
# $api::MapViewOfFileNuma2(FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, PreferredNode)#uselib "api-ms-win-core-memory-l1-1-5.dll"
#func global MapViewOfFileNuma2 "MapViewOfFileNuma2" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; MapViewOfFileNuma2 FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, PreferredNode ; 戻り値は stat
; FileMappingHandle : HANDLE -> "sptr"
; ProcessHandle : HANDLE -> "sptr"
; Offset : ULONGLONG -> "sptr"
; BaseAddress : void* optional -> "sptr"
; ViewSize : UINT_PTR -> "sptr"
; AllocationType : DWORD -> "sptr"
; PageProtection : DWORD -> "sptr"
; PreferredNode : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-core-memory-l1-1-5.dll"
#cfunc global MapViewOfFileNuma2 "MapViewOfFileNuma2" sptr, sptr, int64, sptr, sptr, int, int, int
; res = MapViewOfFileNuma2(FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, PreferredNode)
; FileMappingHandle : HANDLE -> "sptr"
; ProcessHandle : HANDLE -> "sptr"
; Offset : ULONGLONG -> "int64"
; BaseAddress : void* optional -> "sptr"
; ViewSize : UINT_PTR -> "sptr"
; AllocationType : DWORD -> "int"
; PageProtection : DWORD -> "int"
; PreferredNode : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。; MEMORY_MAPPED_VIEW_ADDRESS MapViewOfFileNuma2(HANDLE FileMappingHandle, HANDLE ProcessHandle, ULONGLONG Offset, void* BaseAddress, UINT_PTR ViewSize, DWORD AllocationType, DWORD PageProtection, DWORD PreferredNode)
#uselib "api-ms-win-core-memory-l1-1-5.dll"
#cfunc global MapViewOfFileNuma2 "MapViewOfFileNuma2" intptr, intptr, int64, intptr, intptr, int, int, int
; res = MapViewOfFileNuma2(FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, PreferredNode)
; FileMappingHandle : HANDLE -> "intptr"
; ProcessHandle : HANDLE -> "intptr"
; Offset : ULONGLONG -> "int64"
; BaseAddress : void* optional -> "intptr"
; ViewSize : UINT_PTR -> "intptr"
; AllocationType : DWORD -> "int"
; PageProtection : DWORD -> "int"
; PreferredNode : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_memory_l1_1_5 = windows.NewLazySystemDLL("api-ms-win-core-memory-l1-1-5.dll")
procMapViewOfFileNuma2 = api_ms_win_core_memory_l1_1_5.NewProc("MapViewOfFileNuma2")
)
// FileMappingHandle (HANDLE), ProcessHandle (HANDLE), Offset (ULONGLONG), BaseAddress (void* optional), ViewSize (UINT_PTR), AllocationType (DWORD), PageProtection (DWORD), PreferredNode (DWORD)
r1, _, err := procMapViewOfFileNuma2.Call(
uintptr(FileMappingHandle),
uintptr(ProcessHandle),
uintptr(Offset),
uintptr(BaseAddress),
uintptr(ViewSize),
uintptr(AllocationType),
uintptr(PageProtection),
uintptr(PreferredNode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // MEMORY_MAPPED_VIEW_ADDRESSfunction MapViewOfFileNuma2(
FileMappingHandle: THandle; // HANDLE
ProcessHandle: THandle; // HANDLE
Offset: UInt64; // ULONGLONG
BaseAddress: Pointer; // void* optional
ViewSize: NativeUInt; // UINT_PTR
AllocationType: DWORD; // DWORD
PageProtection: DWORD; // DWORD
PreferredNode: DWORD // DWORD
): MEMORY_MAPPED_VIEW_ADDRESS; stdcall;
external 'api-ms-win-core-memory-l1-1-5.dll' name 'MapViewOfFileNuma2';result := DllCall("api-ms-win-core-memory-l1-1-5\MapViewOfFileNuma2"
, "Ptr", FileMappingHandle ; HANDLE
, "Ptr", ProcessHandle ; HANDLE
, "Int64", Offset ; ULONGLONG
, "Ptr", BaseAddress ; void* optional
, "UPtr", ViewSize ; UINT_PTR
, "UInt", AllocationType ; DWORD
, "UInt", PageProtection ; DWORD
, "UInt", PreferredNode ; DWORD
, "Ptr") ; return: MEMORY_MAPPED_VIEW_ADDRESS●MapViewOfFileNuma2(FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, PreferredNode) = DLL("api-ms-win-core-memory-l1-1-5.dll", "void* MapViewOfFileNuma2(void*, void*, qword, void*, int, dword, dword, dword)")
# 呼び出し: MapViewOfFileNuma2(FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, PreferredNode)
# FileMappingHandle : HANDLE -> "void*"
# ProcessHandle : HANDLE -> "void*"
# Offset : ULONGLONG -> "qword"
# BaseAddress : void* optional -> "void*"
# ViewSize : UINT_PTR -> "int"
# AllocationType : DWORD -> "dword"
# PageProtection : DWORD -> "dword"
# PreferredNode : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。