Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › SspiCopyAuthIdentity

SspiCopyAuthIdentity

関数
認証情報構造体を複製して新しいコピーを作成する。
DLLSECUR32.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT SspiCopyAuthIdentity(
    void* AuthData,
    void** AuthDataCopy
);

パラメーター

名前方向
AuthDatavoid*in
AuthDataCopyvoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT SspiCopyAuthIdentity(
    void* AuthData,
    void** AuthDataCopy
);
[DllImport("SECUR32.dll", ExactSpelling = true)]
static extern int SspiCopyAuthIdentity(
    IntPtr AuthData,   // void*
    IntPtr AuthDataCopy   // void** out
);
<DllImport("SECUR32.dll", ExactSpelling:=True)>
Public Shared Function SspiCopyAuthIdentity(
    AuthData As IntPtr,   ' void*
    AuthDataCopy As IntPtr   ' void** out
) As Integer
End Function
' AuthData : void*
' AuthDataCopy : void** out
Declare PtrSafe Function SspiCopyAuthIdentity Lib "secur32" ( _
    ByVal AuthData As LongPtr, _
    ByVal AuthDataCopy As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SspiCopyAuthIdentity = ctypes.windll.secur32.SspiCopyAuthIdentity
SspiCopyAuthIdentity.restype = ctypes.c_int
SspiCopyAuthIdentity.argtypes = [
    ctypes.POINTER(None),  # AuthData : void*
    ctypes.c_void_p,  # AuthDataCopy : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SECUR32.dll')
SspiCopyAuthIdentity = Fiddle::Function.new(
  lib['SspiCopyAuthIdentity'],
  [
    Fiddle::TYPE_VOIDP,  # AuthData : void*
    Fiddle::TYPE_VOIDP,  # AuthDataCopy : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "secur32")]
extern "system" {
    fn SspiCopyAuthIdentity(
        AuthData: *mut (),  // void*
        AuthDataCopy: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SECUR32.dll")]
public static extern int SspiCopyAuthIdentity(IntPtr AuthData, IntPtr AuthDataCopy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SECUR32_SspiCopyAuthIdentity' -Namespace Win32 -PassThru
# $api::SspiCopyAuthIdentity(AuthData, AuthDataCopy)
#uselib "SECUR32.dll"
#func global SspiCopyAuthIdentity "SspiCopyAuthIdentity" sptr, sptr
; SspiCopyAuthIdentity AuthData, AuthDataCopy   ; 戻り値は stat
; AuthData : void* -> "sptr"
; AuthDataCopy : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SECUR32.dll"
#cfunc global SspiCopyAuthIdentity "SspiCopyAuthIdentity" sptr, sptr
; res = SspiCopyAuthIdentity(AuthData, AuthDataCopy)
; AuthData : void* -> "sptr"
; AuthDataCopy : void** out -> "sptr"
; HRESULT SspiCopyAuthIdentity(void* AuthData, void** AuthDataCopy)
#uselib "SECUR32.dll"
#cfunc global SspiCopyAuthIdentity "SspiCopyAuthIdentity" intptr, intptr
; res = SspiCopyAuthIdentity(AuthData, AuthDataCopy)
; AuthData : void* -> "intptr"
; AuthDataCopy : void** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	secur32 = windows.NewLazySystemDLL("SECUR32.dll")
	procSspiCopyAuthIdentity = secur32.NewProc("SspiCopyAuthIdentity")
)

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