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

RpcObjectSetType

関数
オブジェクトUUIDに型UUIDを関連付ける。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcObjectSetType(
    GUID* ObjUuid,
    GUID* TypeUuid   // optional
);

パラメーター

名前方向
ObjUuidGUID*in
TypeUuidGUID*inoptional

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcObjectSetType = ctypes.windll.rpcrt4.RpcObjectSetType
RpcObjectSetType.restype = ctypes.c_int
RpcObjectSetType.argtypes = [
    ctypes.c_void_p,  # ObjUuid : GUID*
    ctypes.c_void_p,  # TypeUuid : GUID* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcObjectSetType = Fiddle::Function.new(
  lib['RpcObjectSetType'],
  [
    Fiddle::TYPE_VOIDP,  # ObjUuid : GUID*
    Fiddle::TYPE_VOIDP,  # TypeUuid : GUID* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcObjectSetType(
        ObjUuid: *mut GUID,  // GUID*
        TypeUuid: *mut GUID  // GUID* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int RpcObjectSetType(ref Guid ObjUuid, IntPtr TypeUuid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcObjectSetType' -Namespace Win32 -PassThru
# $api::RpcObjectSetType(ObjUuid, TypeUuid)
#uselib "RPCRT4.dll"
#func global RpcObjectSetType "RpcObjectSetType" sptr, sptr
; RpcObjectSetType varptr(ObjUuid), varptr(TypeUuid)   ; 戻り値は stat
; ObjUuid : GUID* -> "sptr"
; TypeUuid : GUID* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global RpcObjectSetType "RpcObjectSetType" var, var
; res = RpcObjectSetType(ObjUuid, TypeUuid)
; ObjUuid : GUID* -> "var"
; TypeUuid : GUID* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcObjectSetType(GUID* ObjUuid, GUID* TypeUuid)
#uselib "RPCRT4.dll"
#cfunc global RpcObjectSetType "RpcObjectSetType" var, var
; res = RpcObjectSetType(ObjUuid, TypeUuid)
; ObjUuid : GUID* -> "var"
; TypeUuid : GUID* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcObjectSetType = rpcrt4.NewProc("RpcObjectSetType")
)

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