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