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