ホーム › Security.Cryptography › CryptUnregisterOIDFunction
CryptUnregisterOIDFunction
関数登録済みのOID関数をレジストリから解除する。
シグネチャ
// CRYPT32.dll
#include <windows.h>
BOOL CryptUnregisterOIDFunction(
DWORD dwEncodingType,
LPCSTR pszFuncName,
LPCSTR pszOID
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dwEncodingType | DWORD | in | 一致させるエンコード タイプを指定します。現在は X509_ASN_ENCODING と PKCS_7_ASN_ENCODING のみが使用されますが、将来的にエンコード タイプが追加される可能性があります。現在の両方のエンコード タイプに一致させるには、次を使用します。 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING エンコード タイプを使用しない関数の場合は、このパラメーターをゼロに設定します。 |
| pszFuncName | LPCSTR | in | 登録を解除する関数の名前。 |
| pszOID | LPCSTR | in | 登録を解除する関数の名前に対応するオブジェクト識別子 (OID) へのポインター。OID の上位ワードがゼロ以外の場合、pszOID は "2.5.29.1" のような OID 文字列、または "file" のような ASCII 文字列へのポインターです。OID の上位ワードがゼロの場合、下位ワードはオブジェクト識別子として使用される整数識別子を指定します。 |
戻り値の型: BOOL
公式ドキュメント
指定したエンコード タイプ、関数名、および OID に対して呼び出される関数を含む DLL の登録を解除します。
戻り値
関数が成功すると、戻り値はゼロ以外 (TRUE) になります。
関数が失敗すると、戻り値はゼロ (FALSE) になります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// CRYPT32.dll
#include <windows.h>
BOOL CryptUnregisterOIDFunction(
DWORD dwEncodingType,
LPCSTR pszFuncName,
LPCSTR pszOID
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", ExactSpelling = true)]
static extern bool CryptUnregisterOIDFunction(
uint dwEncodingType, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string pszFuncName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string pszOID // LPCSTR
);<DllImport("CRYPT32.dll", ExactSpelling:=True)>
Public Shared Function CryptUnregisterOIDFunction(
dwEncodingType As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> pszFuncName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> pszOID As String ' LPCSTR
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' dwEncodingType : DWORD
' pszFuncName : LPCSTR
' pszOID : LPCSTR
Declare PtrSafe Function CryptUnregisterOIDFunction Lib "crypt32" ( _
ByVal dwEncodingType As Long, _
ByVal pszFuncName As String, _
ByVal pszOID As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CryptUnregisterOIDFunction = ctypes.windll.crypt32.CryptUnregisterOIDFunction
CryptUnregisterOIDFunction.restype = wintypes.BOOL
CryptUnregisterOIDFunction.argtypes = [
wintypes.DWORD, # dwEncodingType : DWORD
wintypes.LPCSTR, # pszFuncName : LPCSTR
wintypes.LPCSTR, # pszOID : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CRYPT32.dll')
CryptUnregisterOIDFunction = Fiddle::Function.new(
lib['CryptUnregisterOIDFunction'],
[
-Fiddle::TYPE_INT, # dwEncodingType : DWORD
Fiddle::TYPE_VOIDP, # pszFuncName : LPCSTR
Fiddle::TYPE_VOIDP, # pszOID : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "crypt32")]
extern "system" {
fn CryptUnregisterOIDFunction(
dwEncodingType: u32, // DWORD
pszFuncName: *const u8, // LPCSTR
pszOID: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll")]
public static extern bool CryptUnregisterOIDFunction(uint dwEncodingType, [MarshalAs(UnmanagedType.LPStr)] string pszFuncName, [MarshalAs(UnmanagedType.LPStr)] string pszOID);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CRYPT32_CryptUnregisterOIDFunction' -Namespace Win32 -PassThru
# $api::CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)#uselib "CRYPT32.dll"
#func global CryptUnregisterOIDFunction "CryptUnregisterOIDFunction" sptr, sptr, sptr
; CryptUnregisterOIDFunction dwEncodingType, pszFuncName, pszOID ; 戻り値は stat
; dwEncodingType : DWORD -> "sptr"
; pszFuncName : LPCSTR -> "sptr"
; pszOID : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CRYPT32.dll"
#cfunc global CryptUnregisterOIDFunction "CryptUnregisterOIDFunction" int, str, str
; res = CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)
; dwEncodingType : DWORD -> "int"
; pszFuncName : LPCSTR -> "str"
; pszOID : LPCSTR -> "str"; BOOL CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID)
#uselib "CRYPT32.dll"
#cfunc global CryptUnregisterOIDFunction "CryptUnregisterOIDFunction" int, str, str
; res = CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)
; dwEncodingType : DWORD -> "int"
; pszFuncName : LPCSTR -> "str"
; pszOID : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
procCryptUnregisterOIDFunction = crypt32.NewProc("CryptUnregisterOIDFunction")
)
// dwEncodingType (DWORD), pszFuncName (LPCSTR), pszOID (LPCSTR)
r1, _, err := procCryptUnregisterOIDFunction.Call(
uintptr(dwEncodingType),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszFuncName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszOID))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CryptUnregisterOIDFunction(
dwEncodingType: DWORD; // DWORD
pszFuncName: PAnsiChar; // LPCSTR
pszOID: PAnsiChar // LPCSTR
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CryptUnregisterOIDFunction';result := DllCall("CRYPT32\CryptUnregisterOIDFunction"
, "UInt", dwEncodingType ; DWORD
, "AStr", pszFuncName ; LPCSTR
, "AStr", pszOID ; LPCSTR
, "Int") ; return: BOOL●CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID) = DLL("CRYPT32.dll", "bool CryptUnregisterOIDFunction(dword, char*, char*)")
# 呼び出し: CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)
# dwEncodingType : DWORD -> "dword"
# pszFuncName : LPCSTR -> "char*"
# pszOID : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "crypt32" fn CryptUnregisterOIDFunction(
dwEncodingType: u32, // DWORD
pszFuncName: [*c]const u8, // LPCSTR
pszOID: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) i32;proc CryptUnregisterOIDFunction(
dwEncodingType: uint32, # DWORD
pszFuncName: cstring, # LPCSTR
pszOID: cstring # LPCSTR
): int32 {.importc: "CryptUnregisterOIDFunction", stdcall, dynlib: "CRYPT32.dll".}pragma(lib, "crypt32");
extern(Windows)
int CryptUnregisterOIDFunction(
uint dwEncodingType, // DWORD
const(char)* pszFuncName, // LPCSTR
const(char)* pszOID // LPCSTR
);ccall((:CryptUnregisterOIDFunction, "CRYPT32.dll"), stdcall, Int32,
(UInt32, Cstring, Cstring),
dwEncodingType, pszFuncName, pszOID)
# dwEncodingType : DWORD -> UInt32
# pszFuncName : LPCSTR -> Cstring
# pszOID : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CryptUnregisterOIDFunction(
uint32_t dwEncodingType,
const char* pszFuncName,
const char* pszOID);
]]
local crypt32 = ffi.load("crypt32")
-- crypt32.CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)
-- dwEncodingType : DWORD
-- pszFuncName : LPCSTR
-- pszOID : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CRYPT32.dll');
const CryptUnregisterOIDFunction = lib.func('__stdcall', 'CryptUnregisterOIDFunction', 'int32_t', ['uint32_t', 'str', 'str']);
// CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)
// dwEncodingType : DWORD -> 'uint32_t'
// pszFuncName : LPCSTR -> 'str'
// pszOID : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CRYPT32.dll", {
CryptUnregisterOIDFunction: { parameters: ["u32", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID)
// dwEncodingType : DWORD -> "u32"
// pszFuncName : LPCSTR -> "buffer"
// pszOID : LPCSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CryptUnregisterOIDFunction(
uint32_t dwEncodingType,
const char* pszFuncName,
const char* pszOID);
C, "CRYPT32.dll");
// $ffi->CryptUnregisterOIDFunction(dwEncodingType, pszFuncName, pszOID);
// dwEncodingType : DWORD
// pszFuncName : LPCSTR
// pszOID : LPCSTR
// 構造体/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 Crypt32 extends StdCallLibrary {
Crypt32 INSTANCE = Native.load("crypt32", Crypt32.class);
boolean CryptUnregisterOIDFunction(
int dwEncodingType, // DWORD
String pszFuncName, // LPCSTR
String pszOID // LPCSTR
);
}@[Link("crypt32")]
lib LibCRYPT32
fun CryptUnregisterOIDFunction = CryptUnregisterOIDFunction(
dwEncodingType : UInt32, # DWORD
pszFuncName : UInt8*, # LPCSTR
pszOID : UInt8* # LPCSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CryptUnregisterOIDFunctionNative = Int32 Function(Uint32, Pointer<Utf8>, Pointer<Utf8>);
typedef CryptUnregisterOIDFunctionDart = int Function(int, Pointer<Utf8>, Pointer<Utf8>);
final CryptUnregisterOIDFunction = DynamicLibrary.open('CRYPT32.dll')
.lookupFunction<CryptUnregisterOIDFunctionNative, CryptUnregisterOIDFunctionDart>('CryptUnregisterOIDFunction');
// dwEncodingType : DWORD -> Uint32
// pszFuncName : LPCSTR -> Pointer<Utf8>
// pszOID : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CryptUnregisterOIDFunction(
dwEncodingType: DWORD; // DWORD
pszFuncName: PAnsiChar; // LPCSTR
pszOID: PAnsiChar // LPCSTR
): BOOL; stdcall;
external 'CRYPT32.dll' name 'CryptUnregisterOIDFunction';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CryptUnregisterOIDFunction"
c_CryptUnregisterOIDFunction :: Word32 -> CString -> CString -> IO CInt
-- dwEncodingType : DWORD -> Word32
-- pszFuncName : LPCSTR -> CString
-- pszOID : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cryptunregisteroidfunction =
foreign "CryptUnregisterOIDFunction"
(uint32_t @-> string @-> string @-> returning int32_t)
(* dwEncodingType : DWORD -> uint32_t *)
(* pszFuncName : LPCSTR -> string *)
(* pszOID : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library crypt32 (t "CRYPT32.dll"))
(cffi:use-foreign-library crypt32)
(cffi:defcfun ("CryptUnregisterOIDFunction" crypt-unregister-oidfunction :convention :stdcall) :int32
(dw-encoding-type :uint32) ; DWORD
(psz-func-name :string) ; LPCSTR
(psz-oid :string)) ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CryptUnregisterOIDFunction = Win32::API::More->new('CRYPT32',
'BOOL CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID)');
# my $ret = $CryptUnregisterOIDFunction->Call($dwEncodingType, $pszFuncName, $pszOID);
# dwEncodingType : DWORD -> DWORD
# pszFuncName : LPCSTR -> LPCSTR
# pszOID : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。