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

RpcSsContextLockExclusive

関数
コンテキストハンドルを排他ロックする。
DLLRPCRT4.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

RPC_STATUS RpcSsContextLockExclusive(
    void* ServerBindingHandle,   // optional
    void* UserContext
);

パラメーター

名前方向
ServerBindingHandlevoid*inoptional
UserContextvoid*in

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

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

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcSsContextLockExclusive = rpcrt4.NewProc("RpcSsContextLockExclusive")
)

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