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

Wow64SuspendThread

関数
WOW64上の32ビットスレッドを一時停止する。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

DWORD Wow64SuspendThread(
    HANDLE hThread
);

パラメーター

名前方向
hThreadHANDLEin

戻り値の型: DWORD

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

DWORD Wow64SuspendThread(
    HANDLE hThread
);
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern uint Wow64SuspendThread(
    IntPtr hThread   // HANDLE
);
<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function Wow64SuspendThread(
    hThread As IntPtr   ' HANDLE
) As UInteger
End Function
' hThread : HANDLE
Declare PtrSafe Function Wow64SuspendThread Lib "kernel32" ( _
    ByVal hThread As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

Wow64SuspendThread = ctypes.windll.kernel32.Wow64SuspendThread
Wow64SuspendThread.restype = wintypes.DWORD
Wow64SuspendThread.argtypes = [
    wintypes.HANDLE,  # hThread : HANDLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
Wow64SuspendThread = Fiddle::Function.new(
  lib['Wow64SuspendThread'],
  [
    Fiddle::TYPE_VOIDP,  # hThread : HANDLE
  ],
  -Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn Wow64SuspendThread(
        hThread: *mut core::ffi::c_void  // HANDLE
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern uint Wow64SuspendThread(IntPtr hThread);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_Wow64SuspendThread' -Namespace Win32 -PassThru
# $api::Wow64SuspendThread(hThread)
#uselib "KERNEL32.dll"
#func global Wow64SuspendThread "Wow64SuspendThread" sptr
; Wow64SuspendThread hThread   ; 戻り値は stat
; hThread : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global Wow64SuspendThread "Wow64SuspendThread" sptr
; res = Wow64SuspendThread(hThread)
; hThread : HANDLE -> "sptr"
; DWORD Wow64SuspendThread(HANDLE hThread)
#uselib "KERNEL32.dll"
#cfunc global Wow64SuspendThread "Wow64SuspendThread" intptr
; res = Wow64SuspendThread(hThread)
; hThread : HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWow64SuspendThread = kernel32.NewProc("Wow64SuspendThread")
)

// hThread (HANDLE)
r1, _, err := procWow64SuspendThread.Call(
	uintptr(hThread),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function Wow64SuspendThread(
  hThread: THandle   // HANDLE
): DWORD; stdcall;
  external 'KERNEL32.dll' name 'Wow64SuspendThread';
result := DllCall("KERNEL32\Wow64SuspendThread"
    , "Ptr", hThread   ; HANDLE
    , "UInt")   ; return: DWORD
●Wow64SuspendThread(hThread) = DLL("KERNEL32.dll", "dword Wow64SuspendThread(void*)")
# 呼び出し: Wow64SuspendThread(hThread)
# hThread : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。