ホーム › Security.Credentials › KeyCredentialManagerShowUIOperation
KeyCredentialManagerShowUIOperation
関数鍵資格情報マネージャーの操作UIを表示する。
シグネチャ
// KeyCredMgr.dll
#include <windows.h>
HRESULT KeyCredentialManagerShowUIOperation(
HWND hWndOwner,
KeyCredentialManagerOperationType keyCredentialManagerOperationType
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hWndOwner | HWND | in | 呼び出し元アプリのウィンドウ ハンドルです。 |
| keyCredentialManagerOperationType | KeyCredentialManagerOperationType | in | KeyCredentialManagerOperationType で指定する、実行対象の操作です。 |
戻り値の型: HRESULT
公式ドキュメント
要求された WHFB 操作を実行する API です。
戻り値
HRESULT を返します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// KeyCredMgr.dll
#include <windows.h>
HRESULT KeyCredentialManagerShowUIOperation(
HWND hWndOwner,
KeyCredentialManagerOperationType keyCredentialManagerOperationType
);[DllImport("KeyCredMgr.dll", ExactSpelling = true)]
static extern int KeyCredentialManagerShowUIOperation(
IntPtr hWndOwner, // HWND
int keyCredentialManagerOperationType // KeyCredentialManagerOperationType
);<DllImport("KeyCredMgr.dll", ExactSpelling:=True)>
Public Shared Function KeyCredentialManagerShowUIOperation(
hWndOwner As IntPtr, ' HWND
keyCredentialManagerOperationType As Integer ' KeyCredentialManagerOperationType
) As Integer
End Function' hWndOwner : HWND
' keyCredentialManagerOperationType : KeyCredentialManagerOperationType
Declare PtrSafe Function KeyCredentialManagerShowUIOperation Lib "keycredmgr" ( _
ByVal hWndOwner As LongPtr, _
ByVal keyCredentialManagerOperationType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
KeyCredentialManagerShowUIOperation = ctypes.windll.keycredmgr.KeyCredentialManagerShowUIOperation
KeyCredentialManagerShowUIOperation.restype = ctypes.c_int
KeyCredentialManagerShowUIOperation.argtypes = [
wintypes.HANDLE, # hWndOwner : HWND
ctypes.c_int, # keyCredentialManagerOperationType : KeyCredentialManagerOperationType
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KeyCredMgr.dll')
KeyCredentialManagerShowUIOperation = Fiddle::Function.new(
lib['KeyCredentialManagerShowUIOperation'],
[
Fiddle::TYPE_VOIDP, # hWndOwner : HWND
Fiddle::TYPE_INT, # keyCredentialManagerOperationType : KeyCredentialManagerOperationType
],
Fiddle::TYPE_INT)#[link(name = "keycredmgr")]
extern "system" {
fn KeyCredentialManagerShowUIOperation(
hWndOwner: *mut core::ffi::c_void, // HWND
keyCredentialManagerOperationType: i32 // KeyCredentialManagerOperationType
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KeyCredMgr.dll")]
public static extern int KeyCredentialManagerShowUIOperation(IntPtr hWndOwner, int keyCredentialManagerOperationType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KeyCredMgr_KeyCredentialManagerShowUIOperation' -Namespace Win32 -PassThru
# $api::KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)#uselib "KeyCredMgr.dll"
#func global KeyCredentialManagerShowUIOperation "KeyCredentialManagerShowUIOperation" sptr, sptr
; KeyCredentialManagerShowUIOperation hWndOwner, keyCredentialManagerOperationType ; 戻り値は stat
; hWndOwner : HWND -> "sptr"
; keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KeyCredMgr.dll"
#cfunc global KeyCredentialManagerShowUIOperation "KeyCredentialManagerShowUIOperation" sptr, int
; res = KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)
; hWndOwner : HWND -> "sptr"
; keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "int"; HRESULT KeyCredentialManagerShowUIOperation(HWND hWndOwner, KeyCredentialManagerOperationType keyCredentialManagerOperationType)
#uselib "KeyCredMgr.dll"
#cfunc global KeyCredentialManagerShowUIOperation "KeyCredentialManagerShowUIOperation" intptr, int
; res = KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)
; hWndOwner : HWND -> "intptr"
; keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
keycredmgr = windows.NewLazySystemDLL("KeyCredMgr.dll")
procKeyCredentialManagerShowUIOperation = keycredmgr.NewProc("KeyCredentialManagerShowUIOperation")
)
// hWndOwner (HWND), keyCredentialManagerOperationType (KeyCredentialManagerOperationType)
r1, _, err := procKeyCredentialManagerShowUIOperation.Call(
uintptr(hWndOwner),
uintptr(keyCredentialManagerOperationType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction KeyCredentialManagerShowUIOperation(
hWndOwner: THandle; // HWND
keyCredentialManagerOperationType: Integer // KeyCredentialManagerOperationType
): Integer; stdcall;
external 'KeyCredMgr.dll' name 'KeyCredentialManagerShowUIOperation';result := DllCall("KeyCredMgr\KeyCredentialManagerShowUIOperation"
, "Ptr", hWndOwner ; HWND
, "Int", keyCredentialManagerOperationType ; KeyCredentialManagerOperationType
, "Int") ; return: HRESULT●KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType) = DLL("KeyCredMgr.dll", "int KeyCredentialManagerShowUIOperation(void*, int)")
# 呼び出し: KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)
# hWndOwner : HWND -> "void*"
# keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "keycredmgr" fn KeyCredentialManagerShowUIOperation(
hWndOwner: ?*anyopaque, // HWND
keyCredentialManagerOperationType: i32 // KeyCredentialManagerOperationType
) callconv(std.os.windows.WINAPI) i32;proc KeyCredentialManagerShowUIOperation(
hWndOwner: pointer, # HWND
keyCredentialManagerOperationType: int32 # KeyCredentialManagerOperationType
): int32 {.importc: "KeyCredentialManagerShowUIOperation", stdcall, dynlib: "KeyCredMgr.dll".}pragma(lib, "keycredmgr");
extern(Windows)
int KeyCredentialManagerShowUIOperation(
void* hWndOwner, // HWND
int keyCredentialManagerOperationType // KeyCredentialManagerOperationType
);ccall((:KeyCredentialManagerShowUIOperation, "KeyCredMgr.dll"), stdcall, Int32,
(Ptr{Cvoid}, Int32),
hWndOwner, keyCredentialManagerOperationType)
# hWndOwner : HWND -> Ptr{Cvoid}
# keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t KeyCredentialManagerShowUIOperation(
void* hWndOwner,
int32_t keyCredentialManagerOperationType);
]]
local keycredmgr = ffi.load("keycredmgr")
-- keycredmgr.KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)
-- hWndOwner : HWND
-- keyCredentialManagerOperationType : KeyCredentialManagerOperationType
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('KeyCredMgr.dll');
const KeyCredentialManagerShowUIOperation = lib.func('__stdcall', 'KeyCredentialManagerShowUIOperation', 'int32_t', ['void *', 'int32_t']);
// KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)
// hWndOwner : HWND -> 'void *'
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("KeyCredMgr.dll", {
KeyCredentialManagerShowUIOperation: { parameters: ["pointer", "i32"], result: "i32" },
});
// lib.symbols.KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType)
// hWndOwner : HWND -> "pointer"
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t KeyCredentialManagerShowUIOperation(
void* hWndOwner,
int32_t keyCredentialManagerOperationType);
C, "KeyCredMgr.dll");
// $ffi->KeyCredentialManagerShowUIOperation(hWndOwner, keyCredentialManagerOperationType);
// hWndOwner : HWND
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType
// 構造体/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 KeyCredentialManagerShowUIOperation(
Pointer hWndOwner, // HWND
int keyCredentialManagerOperationType // KeyCredentialManagerOperationType
);
}@[Link("keycredmgr")]
lib LibKeyCredMgr
fun KeyCredentialManagerShowUIOperation = KeyCredentialManagerShowUIOperation(
hWndOwner : Void*, # HWND
keyCredentialManagerOperationType : Int32 # KeyCredentialManagerOperationType
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef KeyCredentialManagerShowUIOperationNative = Int32 Function(Pointer<Void>, Int32);
typedef KeyCredentialManagerShowUIOperationDart = int Function(Pointer<Void>, int);
final KeyCredentialManagerShowUIOperation = DynamicLibrary.open('KeyCredMgr.dll')
.lookupFunction<KeyCredentialManagerShowUIOperationNative, KeyCredentialManagerShowUIOperationDart>('KeyCredentialManagerShowUIOperation');
// hWndOwner : HWND -> Pointer<Void>
// keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function KeyCredentialManagerShowUIOperation(
hWndOwner: THandle; // HWND
keyCredentialManagerOperationType: Integer // KeyCredentialManagerOperationType
): Integer; stdcall;
external 'KeyCredMgr.dll' name 'KeyCredentialManagerShowUIOperation';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "KeyCredentialManagerShowUIOperation"
c_KeyCredentialManagerShowUIOperation :: Ptr () -> Int32 -> IO Int32
-- hWndOwner : HWND -> Ptr ()
-- keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let keycredentialmanagershowuioperation =
foreign "KeyCredentialManagerShowUIOperation"
((ptr void) @-> int32_t @-> returning int32_t)
(* hWndOwner : HWND -> (ptr void) *)
(* keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library keycredmgr (t "KeyCredMgr.dll"))
(cffi:use-foreign-library keycredmgr)
(cffi:defcfun ("KeyCredentialManagerShowUIOperation" key-credential-manager-show-uioperation :convention :stdcall) :int32
(h-wnd-owner :pointer) ; HWND
(key-credential-manager-operation-type :int32)) ; KeyCredentialManagerOperationType
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $KeyCredentialManagerShowUIOperation = Win32::API::More->new('KeyCredMgr',
'int KeyCredentialManagerShowUIOperation(HANDLE hWndOwner, int keyCredentialManagerOperationType)');
# my $ret = $KeyCredentialManagerShowUIOperation->Call($hWndOwner, $keyCredentialManagerOperationType);
# hWndOwner : HWND -> HANDLE
# keyCredentialManagerOperationType : KeyCredentialManagerOperationType -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。