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

RpcSmGetThreadHandle

関数
現在のスレッドのRPCメモリ管理ハンドルを取得する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

void* RpcSmGetThreadHandle(
    RPC_STATUS* pStatus
);

パラメーター

名前方向
pStatusRPC_STATUS*out

戻り値の型: void*

各言語での呼び出し定義

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

void* RpcSmGetThreadHandle(
    RPC_STATUS* pStatus
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern IntPtr RpcSmGetThreadHandle(
    out int pStatus   // RPC_STATUS* out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcSmGetThreadHandle(
    <Out> ByRef pStatus As Integer   ' RPC_STATUS* out
) As IntPtr
End Function
' pStatus : RPC_STATUS* out
Declare PtrSafe Function RpcSmGetThreadHandle Lib "rpcrt4" ( _
    ByRef pStatus As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcSmGetThreadHandle = ctypes.windll.rpcrt4.RpcSmGetThreadHandle
RpcSmGetThreadHandle.restype = ctypes.c_void_p
RpcSmGetThreadHandle.argtypes = [
    ctypes.c_void_p,  # pStatus : RPC_STATUS* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcSmGetThreadHandle = Fiddle::Function.new(
  lib['RpcSmGetThreadHandle'],
  [
    Fiddle::TYPE_VOIDP,  # pStatus : RPC_STATUS* out
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcSmGetThreadHandle(
        pStatus: *mut i32  // RPC_STATUS* out
    ) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern IntPtr RpcSmGetThreadHandle(out int pStatus);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcSmGetThreadHandle' -Namespace Win32 -PassThru
# $api::RpcSmGetThreadHandle(pStatus)
#uselib "RPCRT4.dll"
#func global RpcSmGetThreadHandle "RpcSmGetThreadHandle" sptr
; RpcSmGetThreadHandle pStatus   ; 戻り値は stat
; pStatus : RPC_STATUS* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCRT4.dll"
#cfunc global RpcSmGetThreadHandle "RpcSmGetThreadHandle" int
; res = RpcSmGetThreadHandle(pStatus)
; pStatus : RPC_STATUS* out -> "int"
; void* RpcSmGetThreadHandle(RPC_STATUS* pStatus)
#uselib "RPCRT4.dll"
#cfunc global RpcSmGetThreadHandle "RpcSmGetThreadHandle" int
; res = RpcSmGetThreadHandle(pStatus)
; pStatus : RPC_STATUS* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcSmGetThreadHandle = rpcrt4.NewProc("RpcSmGetThreadHandle")
)

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