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

WTSCloudAuthDuplicateSerializedUserCredential

関数
シリアル化済みユーザー資格情報を複製する。
DLLWTSAPI32.dll呼出規約winapi

シグネチャ

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

BOOL WTSCloudAuthDuplicateSerializedUserCredential(
    const WTS_SERIALIZED_USER_CREDENTIAL* userCredential,
    WTS_SERIALIZED_USER_CREDENTIAL** duplicatedUserCredential
);

パラメーター

名前方向
userCredentialWTS_SERIALIZED_USER_CREDENTIAL*in
duplicatedUserCredentialWTS_SERIALIZED_USER_CREDENTIAL**out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL WTSCloudAuthDuplicateSerializedUserCredential(
    const WTS_SERIALIZED_USER_CREDENTIAL* userCredential,
    WTS_SERIALIZED_USER_CREDENTIAL** duplicatedUserCredential
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WTSAPI32.dll", ExactSpelling = true)]
static extern bool WTSCloudAuthDuplicateSerializedUserCredential(
    IntPtr userCredential,   // WTS_SERIALIZED_USER_CREDENTIAL*
    IntPtr duplicatedUserCredential   // WTS_SERIALIZED_USER_CREDENTIAL** out
);
<DllImport("WTSAPI32.dll", ExactSpelling:=True)>
Public Shared Function WTSCloudAuthDuplicateSerializedUserCredential(
    userCredential As IntPtr,   ' WTS_SERIALIZED_USER_CREDENTIAL*
    duplicatedUserCredential As IntPtr   ' WTS_SERIALIZED_USER_CREDENTIAL** out
) As Boolean
End Function
' userCredential : WTS_SERIALIZED_USER_CREDENTIAL*
' duplicatedUserCredential : WTS_SERIALIZED_USER_CREDENTIAL** out
Declare PtrSafe Function WTSCloudAuthDuplicateSerializedUserCredential Lib "wtsapi32" ( _
    ByVal userCredential As LongPtr, _
    ByVal duplicatedUserCredential As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WTSCloudAuthDuplicateSerializedUserCredential = ctypes.windll.wtsapi32.WTSCloudAuthDuplicateSerializedUserCredential
WTSCloudAuthDuplicateSerializedUserCredential.restype = wintypes.BOOL
WTSCloudAuthDuplicateSerializedUserCredential.argtypes = [
    ctypes.c_void_p,  # userCredential : WTS_SERIALIZED_USER_CREDENTIAL*
    ctypes.c_void_p,  # duplicatedUserCredential : WTS_SERIALIZED_USER_CREDENTIAL** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wtsapi32 = windows.NewLazySystemDLL("WTSAPI32.dll")
	procWTSCloudAuthDuplicateSerializedUserCredential = wtsapi32.NewProc("WTSCloudAuthDuplicateSerializedUserCredential")
)

// userCredential (WTS_SERIALIZED_USER_CREDENTIAL*), duplicatedUserCredential (WTS_SERIALIZED_USER_CREDENTIAL** out)
r1, _, err := procWTSCloudAuthDuplicateSerializedUserCredential.Call(
	uintptr(userCredential),
	uintptr(duplicatedUserCredential),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function WTSCloudAuthDuplicateSerializedUserCredential(
  userCredential: Pointer;   // WTS_SERIALIZED_USER_CREDENTIAL*
  duplicatedUserCredential: Pointer   // WTS_SERIALIZED_USER_CREDENTIAL** out
): BOOL; stdcall;
  external 'WTSAPI32.dll' name 'WTSCloudAuthDuplicateSerializedUserCredential';
result := DllCall("WTSAPI32\WTSCloudAuthDuplicateSerializedUserCredential"
    , "Ptr", userCredential   ; WTS_SERIALIZED_USER_CREDENTIAL*
    , "Ptr", duplicatedUserCredential   ; WTS_SERIALIZED_USER_CREDENTIAL** out
    , "Int")   ; return: BOOL
●WTSCloudAuthDuplicateSerializedUserCredential(userCredential, duplicatedUserCredential) = DLL("WTSAPI32.dll", "bool WTSCloudAuthDuplicateSerializedUserCredential(void*, void*)")
# 呼び出し: WTSCloudAuthDuplicateSerializedUserCredential(userCredential, duplicatedUserCredential)
# userCredential : WTS_SERIALIZED_USER_CREDENTIAL* -> "void*"
# duplicatedUserCredential : WTS_SERIALIZED_USER_CREDENTIAL** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。