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