ホーム › System.Memory › AllocateUserPhysicalPages2
AllocateUserPhysicalPages2
関数拡張パラメータを指定してAWE用物理メモリページを割り当てる。
シグネチャ
// api-ms-win-core-memory-l1-1-8.dll
#include <windows.h>
BOOL AllocateUserPhysicalPages2(
HANDLE ObjectHandle,
UINT_PTR* NumberOfPages,
UINT_PTR* PageArray,
MEM_EXTENDED_PARAMETER* ExtendedParameters, // optional
DWORD ExtendedParameterCount
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ObjectHandle | HANDLE | in |
| NumberOfPages | UINT_PTR* | inout |
| PageArray | UINT_PTR* | out |
| ExtendedParameters | MEM_EXTENDED_PARAMETER* | inoutoptional |
| ExtendedParameterCount | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// api-ms-win-core-memory-l1-1-8.dll
#include <windows.h>
BOOL AllocateUserPhysicalPages2(
HANDLE ObjectHandle,
UINT_PTR* NumberOfPages,
UINT_PTR* PageArray,
MEM_EXTENDED_PARAMETER* ExtendedParameters, // optional
DWORD ExtendedParameterCount
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-memory-l1-1-8.dll", ExactSpelling = true)]
static extern bool AllocateUserPhysicalPages2(
IntPtr ObjectHandle, // HANDLE
ref UIntPtr NumberOfPages, // UINT_PTR* in/out
out UIntPtr PageArray, // UINT_PTR* out
IntPtr ExtendedParameters, // MEM_EXTENDED_PARAMETER* optional, in/out
uint ExtendedParameterCount // DWORD
);<DllImport("api-ms-win-core-memory-l1-1-8.dll", ExactSpelling:=True)>
Public Shared Function AllocateUserPhysicalPages2(
ObjectHandle As IntPtr, ' HANDLE
ByRef NumberOfPages As UIntPtr, ' UINT_PTR* in/out
<Out> ByRef PageArray As UIntPtr, ' UINT_PTR* out
ExtendedParameters As IntPtr, ' MEM_EXTENDED_PARAMETER* optional, in/out
ExtendedParameterCount As UInteger ' DWORD
) As Boolean
End Function' ObjectHandle : HANDLE
' NumberOfPages : UINT_PTR* in/out
' PageArray : UINT_PTR* out
' ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out
' ExtendedParameterCount : DWORD
Declare PtrSafe Function AllocateUserPhysicalPages2 Lib "api-ms-win-core-memory-l1-1-8" ( _
ByVal ObjectHandle As LongPtr, _
ByRef NumberOfPages As LongPtr, _
ByRef PageArray As LongPtr, _
ByVal ExtendedParameters As LongPtr, _
ByVal ExtendedParameterCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AllocateUserPhysicalPages2 = ctypes.windll.LoadLibrary("api-ms-win-core-memory-l1-1-8.dll").AllocateUserPhysicalPages2
AllocateUserPhysicalPages2.restype = wintypes.BOOL
AllocateUserPhysicalPages2.argtypes = [
wintypes.HANDLE, # ObjectHandle : HANDLE
ctypes.POINTER(ctypes.c_size_t), # NumberOfPages : UINT_PTR* in/out
ctypes.POINTER(ctypes.c_size_t), # PageArray : UINT_PTR* out
ctypes.c_void_p, # ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out
wintypes.DWORD, # ExtendedParameterCount : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-memory-l1-1-8.dll')
AllocateUserPhysicalPages2 = Fiddle::Function.new(
lib['AllocateUserPhysicalPages2'],
[
Fiddle::TYPE_VOIDP, # ObjectHandle : HANDLE
Fiddle::TYPE_VOIDP, # NumberOfPages : UINT_PTR* in/out
Fiddle::TYPE_VOIDP, # PageArray : UINT_PTR* out
Fiddle::TYPE_VOIDP, # ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out
-Fiddle::TYPE_INT, # ExtendedParameterCount : DWORD
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-core-memory-l1-1-8")]
extern "system" {
fn AllocateUserPhysicalPages2(
ObjectHandle: *mut core::ffi::c_void, // HANDLE
NumberOfPages: *mut usize, // UINT_PTR* in/out
PageArray: *mut usize, // UINT_PTR* out
ExtendedParameters: *mut MEM_EXTENDED_PARAMETER, // MEM_EXTENDED_PARAMETER* optional, in/out
ExtendedParameterCount: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-memory-l1-1-8.dll")]
public static extern bool AllocateUserPhysicalPages2(IntPtr ObjectHandle, ref UIntPtr NumberOfPages, out UIntPtr PageArray, IntPtr ExtendedParameters, uint ExtendedParameterCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-memory-l1-1-8_AllocateUserPhysicalPages2' -Namespace Win32 -PassThru
# $api::AllocateUserPhysicalPages2(ObjectHandle, NumberOfPages, PageArray, ExtendedParameters, ExtendedParameterCount)#uselib "api-ms-win-core-memory-l1-1-8.dll"
#func global AllocateUserPhysicalPages2 "AllocateUserPhysicalPages2" sptr, sptr, sptr, sptr, sptr
; AllocateUserPhysicalPages2 ObjectHandle, varptr(NumberOfPages), varptr(PageArray), varptr(ExtendedParameters), ExtendedParameterCount ; 戻り値は stat
; ObjectHandle : HANDLE -> "sptr"
; NumberOfPages : UINT_PTR* in/out -> "sptr"
; PageArray : UINT_PTR* out -> "sptr"
; ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out -> "sptr"
; ExtendedParameterCount : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "api-ms-win-core-memory-l1-1-8.dll" #cfunc global AllocateUserPhysicalPages2 "AllocateUserPhysicalPages2" sptr, var, var, var, int ; res = AllocateUserPhysicalPages2(ObjectHandle, NumberOfPages, PageArray, ExtendedParameters, ExtendedParameterCount) ; ObjectHandle : HANDLE -> "sptr" ; NumberOfPages : UINT_PTR* in/out -> "var" ; PageArray : UINT_PTR* out -> "var" ; ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out -> "var" ; ExtendedParameterCount : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "api-ms-win-core-memory-l1-1-8.dll" #cfunc global AllocateUserPhysicalPages2 "AllocateUserPhysicalPages2" sptr, sptr, sptr, sptr, int ; res = AllocateUserPhysicalPages2(ObjectHandle, varptr(NumberOfPages), varptr(PageArray), varptr(ExtendedParameters), ExtendedParameterCount) ; ObjectHandle : HANDLE -> "sptr" ; NumberOfPages : UINT_PTR* in/out -> "sptr" ; PageArray : UINT_PTR* out -> "sptr" ; ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out -> "sptr" ; ExtendedParameterCount : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL AllocateUserPhysicalPages2(HANDLE ObjectHandle, UINT_PTR* NumberOfPages, UINT_PTR* PageArray, MEM_EXTENDED_PARAMETER* ExtendedParameters, DWORD ExtendedParameterCount) #uselib "api-ms-win-core-memory-l1-1-8.dll" #cfunc global AllocateUserPhysicalPages2 "AllocateUserPhysicalPages2" intptr, var, var, var, int ; res = AllocateUserPhysicalPages2(ObjectHandle, NumberOfPages, PageArray, ExtendedParameters, ExtendedParameterCount) ; ObjectHandle : HANDLE -> "intptr" ; NumberOfPages : UINT_PTR* in/out -> "var" ; PageArray : UINT_PTR* out -> "var" ; ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out -> "var" ; ExtendedParameterCount : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL AllocateUserPhysicalPages2(HANDLE ObjectHandle, UINT_PTR* NumberOfPages, UINT_PTR* PageArray, MEM_EXTENDED_PARAMETER* ExtendedParameters, DWORD ExtendedParameterCount) #uselib "api-ms-win-core-memory-l1-1-8.dll" #cfunc global AllocateUserPhysicalPages2 "AllocateUserPhysicalPages2" intptr, intptr, intptr, intptr, int ; res = AllocateUserPhysicalPages2(ObjectHandle, varptr(NumberOfPages), varptr(PageArray), varptr(ExtendedParameters), ExtendedParameterCount) ; ObjectHandle : HANDLE -> "intptr" ; NumberOfPages : UINT_PTR* in/out -> "intptr" ; PageArray : UINT_PTR* out -> "intptr" ; ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out -> "intptr" ; ExtendedParameterCount : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_memory_l1_1_8 = windows.NewLazySystemDLL("api-ms-win-core-memory-l1-1-8.dll")
procAllocateUserPhysicalPages2 = api_ms_win_core_memory_l1_1_8.NewProc("AllocateUserPhysicalPages2")
)
// ObjectHandle (HANDLE), NumberOfPages (UINT_PTR* in/out), PageArray (UINT_PTR* out), ExtendedParameters (MEM_EXTENDED_PARAMETER* optional, in/out), ExtendedParameterCount (DWORD)
r1, _, err := procAllocateUserPhysicalPages2.Call(
uintptr(ObjectHandle),
uintptr(NumberOfPages),
uintptr(PageArray),
uintptr(ExtendedParameters),
uintptr(ExtendedParameterCount),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction AllocateUserPhysicalPages2(
ObjectHandle: THandle; // HANDLE
NumberOfPages: Pointer; // UINT_PTR* in/out
PageArray: Pointer; // UINT_PTR* out
ExtendedParameters: Pointer; // MEM_EXTENDED_PARAMETER* optional, in/out
ExtendedParameterCount: DWORD // DWORD
): BOOL; stdcall;
external 'api-ms-win-core-memory-l1-1-8.dll' name 'AllocateUserPhysicalPages2';result := DllCall("api-ms-win-core-memory-l1-1-8\AllocateUserPhysicalPages2"
, "Ptr", ObjectHandle ; HANDLE
, "Ptr", NumberOfPages ; UINT_PTR* in/out
, "Ptr", PageArray ; UINT_PTR* out
, "Ptr", ExtendedParameters ; MEM_EXTENDED_PARAMETER* optional, in/out
, "UInt", ExtendedParameterCount ; DWORD
, "Int") ; return: BOOL●AllocateUserPhysicalPages2(ObjectHandle, NumberOfPages, PageArray, ExtendedParameters, ExtendedParameterCount) = DLL("api-ms-win-core-memory-l1-1-8.dll", "bool AllocateUserPhysicalPages2(void*, void*, void*, void*, dword)")
# 呼び出し: AllocateUserPhysicalPages2(ObjectHandle, NumberOfPages, PageArray, ExtendedParameters, ExtendedParameterCount)
# ObjectHandle : HANDLE -> "void*"
# NumberOfPages : UINT_PTR* in/out -> "void*"
# PageArray : UINT_PTR* out -> "void*"
# ExtendedParameters : MEM_EXTENDED_PARAMETER* optional, in/out -> "void*"
# ExtendedParameterCount : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。