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