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