Win32 API 日本語リファレンス
ホームSystem.WinRT › WindowsInspectString2

WindowsInspectString2

関数
別プロセス内のHSTRINGを64ビット対応で調査する。
DLLapi-ms-win-core-winrt-string-l1-1-1.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-core-winrt-string-l1-1-1.dll
#include <windows.h>

HRESULT WindowsInspectString2(
    ULONGLONG targetHString,
    WORD machine,
    PINSPECT_HSTRING_CALLBACK2 callback,
    void* context,   // optional
    DWORD* length,
    ULONGLONG* targetStringAddress
);

パラメーター

名前方向
targetHStringULONGLONGin
machineWORDin
callbackPINSPECT_HSTRING_CALLBACK2in
contextvoid*inoptional
lengthDWORD*out
targetStringAddressULONGLONG*out

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-core-winrt-string-l1-1-1.dll
#include <windows.h>

HRESULT WindowsInspectString2(
    ULONGLONG targetHString,
    WORD machine,
    PINSPECT_HSTRING_CALLBACK2 callback,
    void* context,   // optional
    DWORD* length,
    ULONGLONG* targetStringAddress
);
[DllImport("api-ms-win-core-winrt-string-l1-1-1.dll", ExactSpelling = true)]
static extern int WindowsInspectString2(
    ulong targetHString,   // ULONGLONG
    ushort machine,   // WORD
    IntPtr callback,   // PINSPECT_HSTRING_CALLBACK2
    IntPtr context,   // void* optional
    out uint length,   // DWORD* out
    out ulong targetStringAddress   // ULONGLONG* out
);
<DllImport("api-ms-win-core-winrt-string-l1-1-1.dll", ExactSpelling:=True)>
Public Shared Function WindowsInspectString2(
    targetHString As ULong,   ' ULONGLONG
    machine As UShort,   ' WORD
    callback As IntPtr,   ' PINSPECT_HSTRING_CALLBACK2
    context As IntPtr,   ' void* optional
    <Out> ByRef length As UInteger,   ' DWORD* out
    <Out> ByRef targetStringAddress As ULong   ' ULONGLONG* out
) As Integer
End Function
' targetHString : ULONGLONG
' machine : WORD
' callback : PINSPECT_HSTRING_CALLBACK2
' context : void* optional
' length : DWORD* out
' targetStringAddress : ULONGLONG* out
Declare PtrSafe Function WindowsInspectString2 Lib "api-ms-win-core-winrt-string-l1-1-1" ( _
    ByVal targetHString As LongLong, _
    ByVal machine As Integer, _
    ByVal callback As LongPtr, _
    ByVal context As LongPtr, _
    ByRef length As Long, _
    ByRef targetStringAddress As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WindowsInspectString2 = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-string-l1-1-1.dll").WindowsInspectString2
WindowsInspectString2.restype = ctypes.c_int
WindowsInspectString2.argtypes = [
    ctypes.c_ulonglong,  # targetHString : ULONGLONG
    ctypes.c_ushort,  # machine : WORD
    ctypes.c_void_p,  # callback : PINSPECT_HSTRING_CALLBACK2
    ctypes.POINTER(None),  # context : void* optional
    ctypes.POINTER(wintypes.DWORD),  # length : DWORD* out
    ctypes.POINTER(ctypes.c_ulonglong),  # targetStringAddress : ULONGLONG* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-core-winrt-string-l1-1-1.dll')
WindowsInspectString2 = Fiddle::Function.new(
  lib['WindowsInspectString2'],
  [
    -Fiddle::TYPE_LONG_LONG,  # targetHString : ULONGLONG
    -Fiddle::TYPE_SHORT,  # machine : WORD
    Fiddle::TYPE_VOIDP,  # callback : PINSPECT_HSTRING_CALLBACK2
    Fiddle::TYPE_VOIDP,  # context : void* optional
    Fiddle::TYPE_VOIDP,  # length : DWORD* out
    Fiddle::TYPE_VOIDP,  # targetStringAddress : ULONGLONG* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-core-winrt-string-l1-1-1")]
extern "system" {
    fn WindowsInspectString2(
        targetHString: u64,  // ULONGLONG
        machine: u16,  // WORD
        callback: *const core::ffi::c_void,  // PINSPECT_HSTRING_CALLBACK2
        context: *mut (),  // void* optional
        length: *mut u32,  // DWORD* out
        targetStringAddress: *mut u64  // ULONGLONG* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-core-winrt-string-l1-1-1.dll")]
public static extern int WindowsInspectString2(ulong targetHString, ushort machine, IntPtr callback, IntPtr context, out uint length, out ulong targetStringAddress);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-winrt-string-l1-1-1_WindowsInspectString2' -Namespace Win32 -PassThru
# $api::WindowsInspectString2(targetHString, machine, callback, context, length, targetStringAddress)
#uselib "api-ms-win-core-winrt-string-l1-1-1.dll"
#func global WindowsInspectString2 "WindowsInspectString2" sptr, sptr, sptr, sptr, sptr, sptr
; WindowsInspectString2 targetHString, machine, callback, context, varptr(length), varptr(targetStringAddress)   ; 戻り値は stat
; targetHString : ULONGLONG -> "sptr"
; machine : WORD -> "sptr"
; callback : PINSPECT_HSTRING_CALLBACK2 -> "sptr"
; context : void* optional -> "sptr"
; length : DWORD* out -> "sptr"
; targetStringAddress : ULONGLONG* out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "api-ms-win-core-winrt-string-l1-1-1.dll"
#cfunc global WindowsInspectString2 "WindowsInspectString2" int64, int, sptr, sptr, var, var
; res = WindowsInspectString2(targetHString, machine, callback, context, length, targetStringAddress)
; targetHString : ULONGLONG -> "int64"
; machine : WORD -> "int"
; callback : PINSPECT_HSTRING_CALLBACK2 -> "sptr"
; context : void* optional -> "sptr"
; length : DWORD* out -> "var"
; targetStringAddress : ULONGLONG* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; HRESULT WindowsInspectString2(ULONGLONG targetHString, WORD machine, PINSPECT_HSTRING_CALLBACK2 callback, void* context, DWORD* length, ULONGLONG* targetStringAddress)
#uselib "api-ms-win-core-winrt-string-l1-1-1.dll"
#cfunc global WindowsInspectString2 "WindowsInspectString2" int64, int, intptr, intptr, var, var
; res = WindowsInspectString2(targetHString, machine, callback, context, length, targetStringAddress)
; targetHString : ULONGLONG -> "int64"
; machine : WORD -> "int"
; callback : PINSPECT_HSTRING_CALLBACK2 -> "intptr"
; context : void* optional -> "intptr"
; length : DWORD* out -> "var"
; targetStringAddress : ULONGLONG* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_core_winrt_string_l1_1_1 = windows.NewLazySystemDLL("api-ms-win-core-winrt-string-l1-1-1.dll")
	procWindowsInspectString2 = api_ms_win_core_winrt_string_l1_1_1.NewProc("WindowsInspectString2")
)

// targetHString (ULONGLONG), machine (WORD), callback (PINSPECT_HSTRING_CALLBACK2), context (void* optional), length (DWORD* out), targetStringAddress (ULONGLONG* out)
r1, _, err := procWindowsInspectString2.Call(
	uintptr(targetHString),
	uintptr(machine),
	uintptr(callback),
	uintptr(context),
	uintptr(length),
	uintptr(targetStringAddress),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WindowsInspectString2(
  targetHString: UInt64;   // ULONGLONG
  machine: Word;   // WORD
  callback: Pointer;   // PINSPECT_HSTRING_CALLBACK2
  context: Pointer;   // void* optional
  length: Pointer;   // DWORD* out
  targetStringAddress: Pointer   // ULONGLONG* out
): Integer; stdcall;
  external 'api-ms-win-core-winrt-string-l1-1-1.dll' name 'WindowsInspectString2';
result := DllCall("api-ms-win-core-winrt-string-l1-1-1\WindowsInspectString2"
    , "Int64", targetHString   ; ULONGLONG
    , "UShort", machine   ; WORD
    , "Ptr", callback   ; PINSPECT_HSTRING_CALLBACK2
    , "Ptr", context   ; void* optional
    , "Ptr", length   ; DWORD* out
    , "Ptr", targetStringAddress   ; ULONGLONG* out
    , "Int")   ; return: HRESULT
●WindowsInspectString2(targetHString, machine, callback, context, length, targetStringAddress) = DLL("api-ms-win-core-winrt-string-l1-1-1.dll", "int WindowsInspectString2(qword, int, void*, void*, void*, void*)")
# 呼び出し: WindowsInspectString2(targetHString, machine, callback, context, length, targetStringAddress)
# targetHString : ULONGLONG -> "qword"
# machine : WORD -> "int"
# callback : PINSPECT_HSTRING_CALLBACK2 -> "void*"
# context : void* optional -> "void*"
# length : DWORD* out -> "void*"
# targetStringAddress : ULONGLONG* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。