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

KeyCredentialManagerGetOperationErrorStates

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

シグネチャ

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

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

パラメーター

名前方向説明
keyCredentialManagerOperationTypeKeyCredentialManagerOperationTypeinKeyCredentialManagerOperationType で指定する、実行を意図する操作。
isReadyBOOL*out操作の前提条件が満たされる場合は True、満たされない場合は False。
keyCredentialManagerOperationErrorStatesKeyCredentialManagerOperationErrorStates*outKeyCredentialManagerOperationErrorStates で表される、isReady に関する追加情報。

戻り値の型: HRESULT

公式ドキュメント

操作が成功するかどうかを事前に判定するために呼び出す前提条件 API です。

戻り値

HRESULT を返します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// 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 bool 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 Boolean,   ' 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 bool 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, varptr(isReady), varptr(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, var, var
; res = KeyCredentialManagerGetOperationErrorStates(keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates)
; keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "int"
; isReady : BOOL* out -> "var"
; keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT KeyCredentialManagerGetOperationErrorStates(KeyCredentialManagerOperationType keyCredentialManagerOperationType, BOOL* isReady, KeyCredentialManagerOperationErrorStates* keyCredentialManagerOperationErrorStates)
#uselib "KeyCredMgr.dll"
#cfunc global KeyCredentialManagerGetOperationErrorStates "KeyCredentialManagerGetOperationErrorStates" int, var, var
; res = KeyCredentialManagerGetOperationErrorStates(keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates)
; keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "int"
; isReady : BOOL* out -> "var"
; keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
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)。
const std = @import("std");

extern "keycredmgr" fn KeyCredentialManagerGetOperationErrorStates(
    keyCredentialManagerOperationType: i32, // KeyCredentialManagerOperationType
    isReady: [*c]i32, // BOOL* out
    keyCredentialManagerOperationErrorStates: [*c]i32 // KeyCredentialManagerOperationErrorStates* out
) callconv(std.os.windows.WINAPI) i32;
proc KeyCredentialManagerGetOperationErrorStates(
    keyCredentialManagerOperationType: int32,  # KeyCredentialManagerOperationType
    isReady: ptr int32,  # BOOL* out
    keyCredentialManagerOperationErrorStates: ptr int32  # KeyCredentialManagerOperationErrorStates* out
): int32 {.importc: "KeyCredentialManagerGetOperationErrorStates", stdcall, dynlib: "KeyCredMgr.dll".}
pragma(lib, "keycredmgr");
extern(Windows)
int KeyCredentialManagerGetOperationErrorStates(
    int keyCredentialManagerOperationType,   // KeyCredentialManagerOperationType
    int* isReady,   // BOOL* out
    int* keyCredentialManagerOperationErrorStates   // KeyCredentialManagerOperationErrorStates* out
);
ccall((:KeyCredentialManagerGetOperationErrorStates, "KeyCredMgr.dll"), stdcall, Int32,
      (Int32, Ptr{Int32}, Ptr{Int32}),
      keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates)
# keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> Int32
# isReady : BOOL* out -> Ptr{Int32}
# keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t KeyCredentialManagerGetOperationErrorStates(
    int32_t keyCredentialManagerOperationType,
    int32_t* isReady,
    int32_t* keyCredentialManagerOperationErrorStates);
]]
local keycredmgr = ffi.load("keycredmgr")
-- keycredmgr.KeyCredentialManagerGetOperationErrorStates(keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates)
-- keyCredentialManagerOperationType : KeyCredentialManagerOperationType
-- isReady : BOOL* out
-- keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('KeyCredMgr.dll');
const KeyCredentialManagerGetOperationErrorStates = lib.func('__stdcall', 'KeyCredentialManagerGetOperationErrorStates', 'int32_t', ['int32_t', 'int32_t *', 'int32_t *']);
// KeyCredentialManagerGetOperationErrorStates(keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates)
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> 'int32_t'
// isReady : BOOL* out -> 'int32_t *'
// keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("KeyCredMgr.dll", {
  KeyCredentialManagerGetOperationErrorStates: { parameters: ["i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.KeyCredentialManagerGetOperationErrorStates(keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates)
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "i32"
// isReady : BOOL* out -> "pointer"
// keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t KeyCredentialManagerGetOperationErrorStates(
    int32_t keyCredentialManagerOperationType,
    int32_t* isReady,
    int32_t* keyCredentialManagerOperationErrorStates);
C, "KeyCredMgr.dll");
// $ffi->KeyCredentialManagerGetOperationErrorStates(keyCredentialManagerOperationType, isReady, keyCredentialManagerOperationErrorStates);
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType
// isReady : BOOL* out
// keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Keycredmgr extends StdCallLibrary {
    Keycredmgr INSTANCE = Native.load("keycredmgr", Keycredmgr.class);
    int KeyCredentialManagerGetOperationErrorStates(
        int keyCredentialManagerOperationType,   // KeyCredentialManagerOperationType
        IntByReference isReady,   // BOOL* out
        IntByReference keyCredentialManagerOperationErrorStates   // KeyCredentialManagerOperationErrorStates* out
    );
}
@[Link("keycredmgr")]
lib LibKeyCredMgr
  fun KeyCredentialManagerGetOperationErrorStates = KeyCredentialManagerGetOperationErrorStates(
    keyCredentialManagerOperationType : Int32,   # KeyCredentialManagerOperationType
    isReady : Int32*,   # BOOL* out
    keyCredentialManagerOperationErrorStates : Int32*   # KeyCredentialManagerOperationErrorStates* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef KeyCredentialManagerGetOperationErrorStatesNative = Int32 Function(Int32, Pointer<Int32>, Pointer<Int32>);
typedef KeyCredentialManagerGetOperationErrorStatesDart = int Function(int, Pointer<Int32>, Pointer<Int32>);
final KeyCredentialManagerGetOperationErrorStates = DynamicLibrary.open('KeyCredMgr.dll')
    .lookupFunction<KeyCredentialManagerGetOperationErrorStatesNative, KeyCredentialManagerGetOperationErrorStatesDart>('KeyCredentialManagerGetOperationErrorStates');
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> Int32
// isReady : BOOL* out -> Pointer<Int32>
// keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function KeyCredentialManagerGetOperationErrorStates(
  keyCredentialManagerOperationType: Integer;   // KeyCredentialManagerOperationType
  isReady: Pointer;   // BOOL* out
  keyCredentialManagerOperationErrorStates: Pointer   // KeyCredentialManagerOperationErrorStates* out
): Integer; stdcall;
  external 'KeyCredMgr.dll' name 'KeyCredentialManagerGetOperationErrorStates';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "KeyCredentialManagerGetOperationErrorStates"
  c_KeyCredentialManagerGetOperationErrorStates :: Int32 -> Ptr CInt -> Ptr Int32 -> IO Int32
-- keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> Int32
-- isReady : BOOL* out -> Ptr CInt
-- keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let keycredentialmanagergetoperationerrorstates =
  foreign "KeyCredentialManagerGetOperationErrorStates"
    (int32_t @-> (ptr int32_t) @-> (ptr int32_t) @-> returning int32_t)
(* keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> int32_t *)
(* isReady : BOOL* out -> (ptr int32_t) *)
(* keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library keycredmgr (t "KeyCredMgr.dll"))
(cffi:use-foreign-library keycredmgr)

(cffi:defcfun ("KeyCredentialManagerGetOperationErrorStates" key-credential-manager-get-operation-error-states :convention :stdcall) :int32
  (key-credential-manager-operation-type :int32)   ; KeyCredentialManagerOperationType
  (is-ready :pointer)   ; BOOL* out
  (key-credential-manager-operation-error-states :pointer))   ; KeyCredentialManagerOperationErrorStates* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $KeyCredentialManagerGetOperationErrorStates = Win32::API::More->new('KeyCredMgr',
    'int KeyCredentialManagerGetOperationErrorStates(int keyCredentialManagerOperationType, LPVOID isReady, LPVOID keyCredentialManagerOperationErrorStates)');
# my $ret = $KeyCredentialManagerGetOperationErrorStates->Call($keyCredentialManagerOperationType, $isReady, $keyCredentialManagerOperationErrorStates);
# keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> int
# isReady : BOOL* out -> LPVOID
# keyCredentialManagerOperationErrorStates : KeyCredentialManagerOperationErrorStates* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型