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