Win32 API 日本語リファレンス
ホームSecurity.Credentials › KeyCredentialManagerGetOperationErrorStates

KeyCredentialManagerGetOperationErrorStates

関数
鍵資格情報マネージャーの操作可否とエラー状態を取得する。
DLLKeyCredMgr.dll呼出規約winapi

シグネチャ

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

HRESULT KeyCredentialManagerGetOperationErrorStates(
    KeyCredentialManagerOperationType keyCredentialManagerOperationType,
    BOOL* isReady,
    KeyCredentialManagerOperationErrorStates* keyCredentialManagerOperationErrorStates
);

パラメーター

名前方向
keyCredentialManagerOperationTypeKeyCredentialManagerOperationTypein
isReadyBOOL*out
keyCredentialManagerOperationErrorStatesKeyCredentialManagerOperationErrorStates*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT KeyCredentialManagerGetOperationErrorStates(
    KeyCredentialManagerOperationType keyCredentialManagerOperationType,
    BOOL* isReady,
    KeyCredentialManagerOperationErrorStates* keyCredentialManagerOperationErrorStates
);
[DllImport("KeyCredMgr.dll", ExactSpelling = true)]
static extern int KeyCredentialManagerGetOperationErrorStates(
    int keyCredentialManagerOperationType,   // KeyCredentialManagerOperationType
    out int isReady,   // BOOL* out
    out int keyCredentialManagerOperationErrorStates   // KeyCredentialManagerOperationErrorStates* out
);
<DllImport("KeyCredMgr.dll", ExactSpelling:=True)>
Public Shared Function KeyCredentialManagerGetOperationErrorStates(
    keyCredentialManagerOperationType As Integer,   ' KeyCredentialManagerOperationType
    <Out> ByRef isReady As Integer,   ' BOOL* out
    <Out> ByRef keyCredentialManagerOperationErrorStates As Integer   ' KeyCredentialManagerOperationErrorStates* out
) As Integer
End Function
' keyCredentialManagerOperationType : KeyCredentialManagerOperationType
' isReady : BOOL* out
' keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out
Declare PtrSafe Function KeyCredentialManagerGetOperationErrorStates Lib "keycredmgr" ( _
    ByVal keyCredentialManagerOperationType As Long, _
    ByRef isReady As Long, _
    ByRef keyCredentialManagerOperationErrorStates As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

KeyCredentialManagerGetOperationErrorStates = ctypes.windll.keycredmgr.KeyCredentialManagerGetOperationErrorStates
KeyCredentialManagerGetOperationErrorStates.restype = ctypes.c_int
KeyCredentialManagerGetOperationErrorStates.argtypes = [
    ctypes.c_int,  # keyCredentialManagerOperationType : KeyCredentialManagerOperationType
    ctypes.c_void_p,  # isReady : BOOL* out
    ctypes.c_void_p,  # keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	keycredmgr = windows.NewLazySystemDLL("KeyCredMgr.dll")
	procKeyCredentialManagerGetOperationErrorStates = keycredmgr.NewProc("KeyCredentialManagerGetOperationErrorStates")
)

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