Win32 API 日本語リファレンス
ホームSecurity.Cryptography.UI › CryptUIDlgViewContext

CryptUIDlgViewContext

関数
証明書やCRLなどのコンテキストを表示するダイアログを開く。
DLLCRYPTUI.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL CryptUIDlgViewContext(
    DWORD dwContextType,
    const void* pvContext,
    HWND hwnd,   // optional
    LPCWSTR pwszTitle,   // optional
    DWORD dwFlags,
    void* pvReserved
);

パラメーター

名前方向
dwContextTypeDWORDin
pvContextvoid*in
hwndHWNDinoptional
pwszTitleLPCWSTRinoptional
dwFlagsDWORDin
pvReservedvoid*in

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CryptUIDlgViewContext(
    DWORD dwContextType,
    const void* pvContext,
    HWND hwnd,   // optional
    LPCWSTR pwszTitle,   // optional
    DWORD dwFlags,
    void* pvReserved
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPTUI.dll", ExactSpelling = true)]
static extern bool CryptUIDlgViewContext(
    uint dwContextType,   // DWORD
    IntPtr pvContext,   // void*
    IntPtr hwnd,   // HWND optional
    [MarshalAs(UnmanagedType.LPWStr)] string pwszTitle,   // LPCWSTR optional
    uint dwFlags,   // DWORD
    IntPtr pvReserved   // void*
);
<DllImport("CRYPTUI.dll", ExactSpelling:=True)>
Public Shared Function CryptUIDlgViewContext(
    dwContextType As UInteger,   ' DWORD
    pvContext As IntPtr,   ' void*
    hwnd As IntPtr,   ' HWND optional
    <MarshalAs(UnmanagedType.LPWStr)> pwszTitle As String,   ' LPCWSTR optional
    dwFlags As UInteger,   ' DWORD
    pvReserved As IntPtr   ' void*
) As Boolean
End Function
' dwContextType : DWORD
' pvContext : void*
' hwnd : HWND optional
' pwszTitle : LPCWSTR optional
' dwFlags : DWORD
' pvReserved : void*
Declare PtrSafe Function CryptUIDlgViewContext Lib "cryptui" ( _
    ByVal dwContextType As Long, _
    ByVal pvContext As LongPtr, _
    ByVal hwnd As LongPtr, _
    ByVal pwszTitle As LongPtr, _
    ByVal dwFlags As Long, _
    ByVal pvReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CryptUIDlgViewContext = ctypes.windll.cryptui.CryptUIDlgViewContext
CryptUIDlgViewContext.restype = wintypes.BOOL
CryptUIDlgViewContext.argtypes = [
    wintypes.DWORD,  # dwContextType : DWORD
    ctypes.POINTER(None),  # pvContext : void*
    wintypes.HANDLE,  # hwnd : HWND optional
    wintypes.LPCWSTR,  # pwszTitle : LPCWSTR optional
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.POINTER(None),  # pvReserved : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CRYPTUI.dll')
CryptUIDlgViewContext = Fiddle::Function.new(
  lib['CryptUIDlgViewContext'],
  [
    -Fiddle::TYPE_INT,  # dwContextType : DWORD
    Fiddle::TYPE_VOIDP,  # pvContext : void*
    Fiddle::TYPE_VOIDP,  # hwnd : HWND optional
    Fiddle::TYPE_VOIDP,  # pwszTitle : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # pvReserved : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "cryptui")]
extern "system" {
    fn CryptUIDlgViewContext(
        dwContextType: u32,  // DWORD
        pvContext: *const (),  // void*
        hwnd: *mut core::ffi::c_void,  // HWND optional
        pwszTitle: *const u16,  // LPCWSTR optional
        dwFlags: u32,  // DWORD
        pvReserved: *mut ()  // void*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPTUI.dll")]
public static extern bool CryptUIDlgViewContext(uint dwContextType, IntPtr pvContext, IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pwszTitle, uint dwFlags, IntPtr pvReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPTUI_CryptUIDlgViewContext' -Namespace Win32 -PassThru
# $api::CryptUIDlgViewContext(dwContextType, pvContext, hwnd, pwszTitle, dwFlags, pvReserved)
#uselib "CRYPTUI.dll"
#func global CryptUIDlgViewContext "CryptUIDlgViewContext" sptr, sptr, sptr, sptr, sptr, sptr
; CryptUIDlgViewContext dwContextType, pvContext, hwnd, pwszTitle, dwFlags, pvReserved   ; 戻り値は stat
; dwContextType : DWORD -> "sptr"
; pvContext : void* -> "sptr"
; hwnd : HWND optional -> "sptr"
; pwszTitle : LPCWSTR optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; pvReserved : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CRYPTUI.dll"
#cfunc global CryptUIDlgViewContext "CryptUIDlgViewContext" int, sptr, sptr, wstr, int, sptr
; res = CryptUIDlgViewContext(dwContextType, pvContext, hwnd, pwszTitle, dwFlags, pvReserved)
; dwContextType : DWORD -> "int"
; pvContext : void* -> "sptr"
; hwnd : HWND optional -> "sptr"
; pwszTitle : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; pvReserved : void* -> "sptr"
; BOOL CryptUIDlgViewContext(DWORD dwContextType, void* pvContext, HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, void* pvReserved)
#uselib "CRYPTUI.dll"
#cfunc global CryptUIDlgViewContext "CryptUIDlgViewContext" int, intptr, intptr, wstr, int, intptr
; res = CryptUIDlgViewContext(dwContextType, pvContext, hwnd, pwszTitle, dwFlags, pvReserved)
; dwContextType : DWORD -> "int"
; pvContext : void* -> "intptr"
; hwnd : HWND optional -> "intptr"
; pwszTitle : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; pvReserved : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cryptui = windows.NewLazySystemDLL("CRYPTUI.dll")
	procCryptUIDlgViewContext = cryptui.NewProc("CryptUIDlgViewContext")
)

// dwContextType (DWORD), pvContext (void*), hwnd (HWND optional), pwszTitle (LPCWSTR optional), dwFlags (DWORD), pvReserved (void*)
r1, _, err := procCryptUIDlgViewContext.Call(
	uintptr(dwContextType),
	uintptr(pvContext),
	uintptr(hwnd),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszTitle))),
	uintptr(dwFlags),
	uintptr(pvReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CryptUIDlgViewContext(
  dwContextType: DWORD;   // DWORD
  pvContext: Pointer;   // void*
  hwnd: THandle;   // HWND optional
  pwszTitle: PWideChar;   // LPCWSTR optional
  dwFlags: DWORD;   // DWORD
  pvReserved: Pointer   // void*
): BOOL; stdcall;
  external 'CRYPTUI.dll' name 'CryptUIDlgViewContext';
result := DllCall("CRYPTUI\CryptUIDlgViewContext"
    , "UInt", dwContextType   ; DWORD
    , "Ptr", pvContext   ; void*
    , "Ptr", hwnd   ; HWND optional
    , "WStr", pwszTitle   ; LPCWSTR optional
    , "UInt", dwFlags   ; DWORD
    , "Ptr", pvReserved   ; void*
    , "Int")   ; return: BOOL
●CryptUIDlgViewContext(dwContextType, pvContext, hwnd, pwszTitle, dwFlags, pvReserved) = DLL("CRYPTUI.dll", "bool CryptUIDlgViewContext(dword, void*, void*, char*, dword, void*)")
# 呼び出し: CryptUIDlgViewContext(dwContextType, pvContext, hwnd, pwszTitle, dwFlags, pvReserved)
# dwContextType : DWORD -> "dword"
# pvContext : void* -> "void*"
# hwnd : HWND optional -> "void*"
# pwszTitle : LPCWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# pvReserved : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。