ホーム › System.Rpc › UuidHash
UuidHash
関数UUIDからハッシュ値を計算して返す。
シグネチャ
// RPCRT4.dll
#include <windows.h>
WORD UuidHash(
GUID* Uuid,
RPC_STATUS* Status
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Uuid | GUID* | in |
| Status | RPC_STATUS* | out |
戻り値の型: WORD
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
WORD UuidHash(
GUID* Uuid,
RPC_STATUS* Status
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern ushort UuidHash(
ref Guid Uuid, // GUID*
out int Status // RPC_STATUS* out
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function UuidHash(
ByRef Uuid As Guid, ' GUID*
<Out> ByRef Status As Integer ' RPC_STATUS* out
) As UShort
End Function' Uuid : GUID*
' Status : RPC_STATUS* out
Declare PtrSafe Function UuidHash Lib "rpcrt4" ( _
ByVal Uuid As LongPtr, _
ByRef Status As Long) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
UuidHash = ctypes.windll.rpcrt4.UuidHash
UuidHash.restype = ctypes.c_ushort
UuidHash.argtypes = [
ctypes.c_void_p, # Uuid : GUID*
ctypes.c_void_p, # Status : RPC_STATUS* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
UuidHash = Fiddle::Function.new(
lib['UuidHash'],
[
Fiddle::TYPE_VOIDP, # Uuid : GUID*
Fiddle::TYPE_VOIDP, # Status : RPC_STATUS* out
],
-Fiddle::TYPE_SHORT)#[link(name = "rpcrt4")]
extern "system" {
fn UuidHash(
Uuid: *mut GUID, // GUID*
Status: *mut i32 // RPC_STATUS* out
) -> u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern ushort UuidHash(ref Guid Uuid, out int Status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_UuidHash' -Namespace Win32 -PassThru
# $api::UuidHash(Uuid, Status)#uselib "RPCRT4.dll"
#func global UuidHash "UuidHash" sptr, sptr
; UuidHash varptr(Uuid), Status ; 戻り値は stat
; Uuid : GUID* -> "sptr"
; Status : RPC_STATUS* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global UuidHash "UuidHash" var, int ; res = UuidHash(Uuid, Status) ; Uuid : GUID* -> "var" ; Status : RPC_STATUS* out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global UuidHash "UuidHash" sptr, int ; res = UuidHash(varptr(Uuid), Status) ; Uuid : GUID* -> "sptr" ; Status : RPC_STATUS* out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WORD UuidHash(GUID* Uuid, RPC_STATUS* Status) #uselib "RPCRT4.dll" #cfunc global UuidHash "UuidHash" var, int ; res = UuidHash(Uuid, Status) ; Uuid : GUID* -> "var" ; Status : RPC_STATUS* out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WORD UuidHash(GUID* Uuid, RPC_STATUS* Status) #uselib "RPCRT4.dll" #cfunc global UuidHash "UuidHash" intptr, int ; res = UuidHash(varptr(Uuid), Status) ; Uuid : GUID* -> "intptr" ; Status : RPC_STATUS* out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procUuidHash = rpcrt4.NewProc("UuidHash")
)
// Uuid (GUID*), Status (RPC_STATUS* out)
r1, _, err := procUuidHash.Call(
uintptr(Uuid),
uintptr(Status),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORDfunction UuidHash(
Uuid: PGUID; // GUID*
Status: Pointer // RPC_STATUS* out
): Word; stdcall;
external 'RPCRT4.dll' name 'UuidHash';result := DllCall("RPCRT4\UuidHash"
, "Ptr", Uuid ; GUID*
, "Ptr", Status ; RPC_STATUS* out
, "UShort") ; return: WORD●UuidHash(Uuid, Status) = DLL("RPCRT4.dll", "int UuidHash(void*, void*)")
# 呼び出し: UuidHash(Uuid, Status)
# Uuid : GUID* -> "void*"
# Status : RPC_STATUS* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。