ホーム › Security.Cryptography › CryptInitOIDFunctionSet
CryptInitOIDFunctionSet
関数指定名のOID関数セットを初期化してハンドルを取得する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
void* CryptInitOIDFunctionSet(
LPCSTR pszFuncName,
DWORD dwFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszFuncName | LPCSTR | in |
| dwFlags | DWORD | in |
戻り値の型: void*
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
void* CryptInitOIDFunctionSet(
LPCSTR pszFuncName,
DWORD dwFlags
);[DllImport("CRYPT32.dll", ExactSpelling = true)]
static extern IntPtr CryptInitOIDFunctionSet(
[MarshalAs(UnmanagedType.LPStr)] string pszFuncName, // LPCSTR
uint dwFlags // DWORD
);<DllImport("CRYPT32.dll", ExactSpelling:=True)>
Public Shared Function CryptInitOIDFunctionSet(
<MarshalAs(UnmanagedType.LPStr)> pszFuncName As String, ' LPCSTR
dwFlags As UInteger ' DWORD
) As IntPtr
End Function' pszFuncName : LPCSTR
' dwFlags : DWORD
Declare PtrSafe Function CryptInitOIDFunctionSet Lib "crypt32" ( _
ByVal pszFuncName As String, _
ByVal dwFlags As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptInitOIDFunctionSet = ctypes.windll.crypt32.CryptInitOIDFunctionSet
CryptInitOIDFunctionSet.restype = ctypes.c_void_p
CryptInitOIDFunctionSet.argtypes = [
wintypes.LPCSTR, # pszFuncName : LPCSTR
wintypes.DWORD, # dwFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CryptInitOIDFunctionSet = Fiddle::Function.new(
lib['CryptInitOIDFunctionSet'],
[
Fiddle::TYPE_VOIDP, # pszFuncName : LPCSTR
-Fiddle::TYPE_INT, # dwFlags : DWORD
],
Fiddle::TYPE_VOIDP)#[link(name = "crypt32")]
extern "system" {
fn CryptInitOIDFunctionSet(
pszFuncName: *const u8, // LPCSTR
dwFlags: u32 // DWORD
) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CRYPT32.dll")]
public static extern IntPtr CryptInitOIDFunctionSet([MarshalAs(UnmanagedType.LPStr)] string pszFuncName, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CryptInitOIDFunctionSet' -Namespace Win32 -PassThru
# $api::CryptInitOIDFunctionSet(pszFuncName, dwFlags)#uselib "CRYPT32.dll"
#func global CryptInitOIDFunctionSet "CryptInitOIDFunctionSet" sptr, sptr
; CryptInitOIDFunctionSet pszFuncName, dwFlags ; 戻り値は stat
; pszFuncName : LPCSTR -> "sptr"
; dwFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CRYPT32.dll"
#cfunc global CryptInitOIDFunctionSet "CryptInitOIDFunctionSet" str, int
; res = CryptInitOIDFunctionSet(pszFuncName, dwFlags)
; pszFuncName : LPCSTR -> "str"
; dwFlags : DWORD -> "int"; void* CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
#uselib "CRYPT32.dll"
#cfunc global CryptInitOIDFunctionSet "CryptInitOIDFunctionSet" str, int
; res = CryptInitOIDFunctionSet(pszFuncName, dwFlags)
; pszFuncName : LPCSTR -> "str"
; dwFlags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCryptInitOIDFunctionSet = crypt32.NewProc("CryptInitOIDFunctionSet")
)
// pszFuncName (LPCSTR), dwFlags (DWORD)
r1, _, err := procCryptInitOIDFunctionSet.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszFuncName))),
uintptr(dwFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // void*function CryptInitOIDFunctionSet(
pszFuncName: PAnsiChar; // LPCSTR
dwFlags: DWORD // DWORD
): Pointer; stdcall;
external 'CRYPT32.dll' name 'CryptInitOIDFunctionSet';result := DllCall("CRYPT32\CryptInitOIDFunctionSet"
, "AStr", pszFuncName ; LPCSTR
, "UInt", dwFlags ; DWORD
, "Ptr") ; return: void*●CryptInitOIDFunctionSet(pszFuncName, dwFlags) = DLL("CRYPT32.dll", "void* CryptInitOIDFunctionSet(char*, dword)")
# 呼び出し: CryptInitOIDFunctionSet(pszFuncName, dwFlags)
# pszFuncName : LPCSTR -> "char*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。