ホーム › Security.Cryptography › CryptGetDefaultOIDDllList
CryptGetDefaultOIDDllList
関数OID関数の既定DLLの一覧を取得する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CryptGetDefaultOIDDllList(
void* hFuncSet,
DWORD dwEncodingType,
LPWSTR pwszDllList, // optional
DWORD* pcchDllList
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hFuncSet | void* | in |
| dwEncodingType | DWORD | in |
| pwszDllList | LPWSTR | outoptional |
| pcchDllList | DWORD* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CryptGetDefaultOIDDllList(
void* hFuncSet,
DWORD dwEncodingType,
LPWSTR pwszDllList, // optional
DWORD* pcchDllList
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CryptGetDefaultOIDDllList(
IntPtr hFuncSet, // void*
uint dwEncodingType, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pwszDllList, // LPWSTR optional, out
ref uint pcchDllList // DWORD* in/out
);<DllImport("CRYPT32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CryptGetDefaultOIDDllList(
hFuncSet As IntPtr, ' void*
dwEncodingType As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pwszDllList As System.Text.StringBuilder, ' LPWSTR optional, out
ByRef pcchDllList As UInteger ' DWORD* in/out
) As Boolean
End Function' hFuncSet : void*
' dwEncodingType : DWORD
' pwszDllList : LPWSTR optional, out
' pcchDllList : DWORD* in/out
Declare PtrSafe Function CryptGetDefaultOIDDllList Lib "crypt32" ( _
ByVal hFuncSet As LongPtr, _
ByVal dwEncodingType As Long, _
ByVal pwszDllList As LongPtr, _
ByRef pcchDllList As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptGetDefaultOIDDllList = ctypes.windll.crypt32.CryptGetDefaultOIDDllList
CryptGetDefaultOIDDllList.restype = wintypes.BOOL
CryptGetDefaultOIDDllList.argtypes = [
ctypes.POINTER(None), # hFuncSet : void*
wintypes.DWORD, # dwEncodingType : DWORD
wintypes.LPWSTR, # pwszDllList : LPWSTR optional, out
ctypes.POINTER(wintypes.DWORD), # pcchDllList : DWORD* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CryptGetDefaultOIDDllList = Fiddle::Function.new(
lib['CryptGetDefaultOIDDllList'],
[
Fiddle::TYPE_VOIDP, # hFuncSet : void*
-Fiddle::TYPE_INT, # dwEncodingType : DWORD
Fiddle::TYPE_VOIDP, # pwszDllList : LPWSTR optional, out
Fiddle::TYPE_VOIDP, # pcchDllList : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CryptGetDefaultOIDDllList(
hFuncSet: *mut (), // void*
dwEncodingType: u32, // DWORD
pwszDllList: *mut u16, // LPWSTR optional, out
pcchDllList: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", SetLastError = true)]
public static extern bool CryptGetDefaultOIDDllList(IntPtr hFuncSet, uint dwEncodingType, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pwszDllList, ref uint pcchDllList);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CryptGetDefaultOIDDllList' -Namespace Win32 -PassThru
# $api::CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, pwszDllList, pcchDllList)#uselib "CRYPT32.dll"
#func global CryptGetDefaultOIDDllList "CryptGetDefaultOIDDllList" sptr, sptr, sptr, sptr
; CryptGetDefaultOIDDllList hFuncSet, dwEncodingType, varptr(pwszDllList), varptr(pcchDllList) ; 戻り値は stat
; hFuncSet : void* -> "sptr"
; dwEncodingType : DWORD -> "sptr"
; pwszDllList : LPWSTR optional, out -> "sptr"
; pcchDllList : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CRYPT32.dll" #cfunc global CryptGetDefaultOIDDllList "CryptGetDefaultOIDDllList" sptr, int, var, var ; res = CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, pwszDllList, pcchDllList) ; hFuncSet : void* -> "sptr" ; dwEncodingType : DWORD -> "int" ; pwszDllList : LPWSTR optional, out -> "var" ; pcchDllList : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CRYPT32.dll" #cfunc global CryptGetDefaultOIDDllList "CryptGetDefaultOIDDllList" sptr, int, sptr, sptr ; res = CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, varptr(pwszDllList), varptr(pcchDllList)) ; hFuncSet : void* -> "sptr" ; dwEncodingType : DWORD -> "int" ; pwszDllList : LPWSTR optional, out -> "sptr" ; pcchDllList : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CryptGetDefaultOIDDllList(void* hFuncSet, DWORD dwEncodingType, LPWSTR pwszDllList, DWORD* pcchDllList) #uselib "CRYPT32.dll" #cfunc global CryptGetDefaultOIDDllList "CryptGetDefaultOIDDllList" intptr, int, var, var ; res = CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, pwszDllList, pcchDllList) ; hFuncSet : void* -> "intptr" ; dwEncodingType : DWORD -> "int" ; pwszDllList : LPWSTR optional, out -> "var" ; pcchDllList : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CryptGetDefaultOIDDllList(void* hFuncSet, DWORD dwEncodingType, LPWSTR pwszDllList, DWORD* pcchDllList) #uselib "CRYPT32.dll" #cfunc global CryptGetDefaultOIDDllList "CryptGetDefaultOIDDllList" intptr, int, intptr, intptr ; res = CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, varptr(pwszDllList), varptr(pcchDllList)) ; hFuncSet : void* -> "intptr" ; dwEncodingType : DWORD -> "int" ; pwszDllList : LPWSTR optional, out -> "intptr" ; pcchDllList : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCryptGetDefaultOIDDllList = crypt32.NewProc("CryptGetDefaultOIDDllList")
)
// hFuncSet (void*), dwEncodingType (DWORD), pwszDllList (LPWSTR optional, out), pcchDllList (DWORD* in/out)
r1, _, err := procCryptGetDefaultOIDDllList.Call(
uintptr(hFuncSet),
uintptr(dwEncodingType),
uintptr(pwszDllList),
uintptr(pcchDllList),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CryptGetDefaultOIDDllList(
hFuncSet: Pointer; // void*
dwEncodingType: DWORD; // DWORD
pwszDllList: PWideChar; // LPWSTR optional, out
pcchDllList: Pointer // DWORD* in/out
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CryptGetDefaultOIDDllList';result := DllCall("CRYPT32\CryptGetDefaultOIDDllList"
, "Ptr", hFuncSet ; void*
, "UInt", dwEncodingType ; DWORD
, "Ptr", pwszDllList ; LPWSTR optional, out
, "Ptr", pcchDllList ; DWORD* in/out
, "Int") ; return: BOOL●CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, pwszDllList, pcchDllList) = DLL("CRYPT32.dll", "bool CryptGetDefaultOIDDllList(void*, dword, char*, void*)")
# 呼び出し: CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, pwszDllList, pcchDllList)
# hFuncSet : void* -> "void*"
# dwEncodingType : DWORD -> "dword"
# pwszDllList : LPWSTR optional, out -> "char*"
# pcchDllList : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。