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

CryptUnregisterDefaultOIDFunction

関数
既定のOID関数DLLの登録を解除する。
DLLCRYPT32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL CryptUnregisterDefaultOIDFunction(
    DWORD dwEncodingType,
    LPCSTR pszFuncName,
    LPCWSTR pwszDll
);

パラメーター

名前方向
dwEncodingTypeDWORDin
pszFuncNameLPCSTRin
pwszDllLPCWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CryptUnregisterDefaultOIDFunction(
    DWORD dwEncodingType,
    LPCSTR pszFuncName,
    LPCWSTR pwszDll
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", ExactSpelling = true)]
static extern bool CryptUnregisterDefaultOIDFunction(
    uint dwEncodingType,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string pszFuncName,   // LPCSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pwszDll   // LPCWSTR
);
<DllImport("CRYPT32.dll", ExactSpelling:=True)>
Public Shared Function CryptUnregisterDefaultOIDFunction(
    dwEncodingType As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> pszFuncName As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPWStr)> pwszDll As String   ' LPCWSTR
) As Boolean
End Function
' dwEncodingType : DWORD
' pszFuncName : LPCSTR
' pwszDll : LPCWSTR
Declare PtrSafe Function CryptUnregisterDefaultOIDFunction Lib "crypt32" ( _
    ByVal dwEncodingType As Long, _
    ByVal pszFuncName As String, _
    ByVal pwszDll As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CryptUnregisterDefaultOIDFunction = ctypes.windll.crypt32.CryptUnregisterDefaultOIDFunction
CryptUnregisterDefaultOIDFunction.restype = wintypes.BOOL
CryptUnregisterDefaultOIDFunction.argtypes = [
    wintypes.DWORD,  # dwEncodingType : DWORD
    wintypes.LPCSTR,  # pszFuncName : LPCSTR
    wintypes.LPCWSTR,  # pwszDll : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CRYPT32.dll')
CryptUnregisterDefaultOIDFunction = Fiddle::Function.new(
  lib['CryptUnregisterDefaultOIDFunction'],
  [
    -Fiddle::TYPE_INT,  # dwEncodingType : DWORD
    Fiddle::TYPE_VOIDP,  # pszFuncName : LPCSTR
    Fiddle::TYPE_VOIDP,  # pwszDll : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "crypt32")]
extern "system" {
    fn CryptUnregisterDefaultOIDFunction(
        dwEncodingType: u32,  // DWORD
        pszFuncName: *const u8,  // LPCSTR
        pwszDll: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll")]
public static extern bool CryptUnregisterDefaultOIDFunction(uint dwEncodingType, [MarshalAs(UnmanagedType.LPStr)] string pszFuncName, [MarshalAs(UnmanagedType.LPWStr)] string pwszDll);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CryptUnregisterDefaultOIDFunction' -Namespace Win32 -PassThru
# $api::CryptUnregisterDefaultOIDFunction(dwEncodingType, pszFuncName, pwszDll)
#uselib "CRYPT32.dll"
#func global CryptUnregisterDefaultOIDFunction "CryptUnregisterDefaultOIDFunction" sptr, sptr, sptr
; CryptUnregisterDefaultOIDFunction dwEncodingType, pszFuncName, pwszDll   ; 戻り値は stat
; dwEncodingType : DWORD -> "sptr"
; pszFuncName : LPCSTR -> "sptr"
; pwszDll : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CRYPT32.dll"
#cfunc global CryptUnregisterDefaultOIDFunction "CryptUnregisterDefaultOIDFunction" int, str, wstr
; res = CryptUnregisterDefaultOIDFunction(dwEncodingType, pszFuncName, pwszDll)
; dwEncodingType : DWORD -> "int"
; pszFuncName : LPCSTR -> "str"
; pwszDll : LPCWSTR -> "wstr"
; BOOL CryptUnregisterDefaultOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCWSTR pwszDll)
#uselib "CRYPT32.dll"
#cfunc global CryptUnregisterDefaultOIDFunction "CryptUnregisterDefaultOIDFunction" int, str, wstr
; res = CryptUnregisterDefaultOIDFunction(dwEncodingType, pszFuncName, pwszDll)
; dwEncodingType : DWORD -> "int"
; pszFuncName : LPCSTR -> "str"
; pwszDll : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCryptUnregisterDefaultOIDFunction = crypt32.NewProc("CryptUnregisterDefaultOIDFunction")
)

// dwEncodingType (DWORD), pszFuncName (LPCSTR), pwszDll (LPCWSTR)
r1, _, err := procCryptUnregisterDefaultOIDFunction.Call(
	uintptr(dwEncodingType),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszFuncName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszDll))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CryptUnregisterDefaultOIDFunction(
  dwEncodingType: DWORD;   // DWORD
  pszFuncName: PAnsiChar;   // LPCSTR
  pwszDll: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'CRYPT32.dll' name 'CryptUnregisterDefaultOIDFunction';
result := DllCall("CRYPT32\CryptUnregisterDefaultOIDFunction"
    , "UInt", dwEncodingType   ; DWORD
    , "AStr", pszFuncName   ; LPCSTR
    , "WStr", pwszDll   ; LPCWSTR
    , "Int")   ; return: BOOL
●CryptUnregisterDefaultOIDFunction(dwEncodingType, pszFuncName, pwszDll) = DLL("CRYPT32.dll", "bool CryptUnregisterDefaultOIDFunction(dword, char*, char*)")
# 呼び出し: CryptUnregisterDefaultOIDFunction(dwEncodingType, pszFuncName, pwszDll)
# dwEncodingType : DWORD -> "dword"
# pszFuncName : LPCSTR -> "char*"
# pwszDll : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。