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

UuidEqual

関数
2つのUUIDが等しいかどうかを判定する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

INT UuidEqual(
    GUID* Uuid1,
    GUID* Uuid2,
    RPC_STATUS* Status
);

パラメーター

名前方向
Uuid1GUID*in
Uuid2GUID*in
StatusRPC_STATUS*out

戻り値の型: INT

各言語での呼び出し定義

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

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

UuidEqual = ctypes.windll.rpcrt4.UuidEqual
UuidEqual.restype = ctypes.c_int
UuidEqual.argtypes = [
    ctypes.c_void_p,  # Uuid1 : GUID*
    ctypes.c_void_p,  # Uuid2 : GUID*
    ctypes.c_void_p,  # Status : RPC_STATUS* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procUuidEqual = rpcrt4.NewProc("UuidEqual")
)

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