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