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

RpcSmSetThreadHandle

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

シグネチャ

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

RPC_STATUS RpcSmSetThreadHandle(
    void* Id
);

パラメーター

名前方向
Idvoid*in

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcSmSetThreadHandle = ctypes.windll.rpcrt4.RpcSmSetThreadHandle
RpcSmSetThreadHandle.restype = ctypes.c_int
RpcSmSetThreadHandle.argtypes = [
    ctypes.POINTER(None),  # Id : void*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcSmSetThreadHandle = rpcrt4.NewProc("RpcSmSetThreadHandle")
)

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