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

CryptFreeOIDFunctionAddress

関数
取得したOID関数アドレスのハンドルを解放する。
DLLCRYPT32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL CryptFreeOIDFunctionAddress(
    void* hFuncAddr,
    DWORD dwFlags
);

パラメーター

名前方向
hFuncAddrvoid*in
dwFlagsDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CryptFreeOIDFunctionAddress(
    void* hFuncAddr,
    DWORD dwFlags
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("CRYPT32.dll", ExactSpelling = true)]
static extern bool CryptFreeOIDFunctionAddress(
    IntPtr hFuncAddr,   // void*
    uint dwFlags   // DWORD
);
<DllImport("CRYPT32.dll", ExactSpelling:=True)>
Public Shared Function CryptFreeOIDFunctionAddress(
    hFuncAddr As IntPtr,   ' void*
    dwFlags As UInteger   ' DWORD
) As Boolean
End Function
' hFuncAddr : void*
' dwFlags : DWORD
Declare PtrSafe Function CryptFreeOIDFunctionAddress Lib "crypt32" ( _
    ByVal hFuncAddr As LongPtr, _
    ByVal dwFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CryptFreeOIDFunctionAddress = ctypes.windll.crypt32.CryptFreeOIDFunctionAddress
CryptFreeOIDFunctionAddress.restype = wintypes.BOOL
CryptFreeOIDFunctionAddress.argtypes = [
    ctypes.POINTER(None),  # hFuncAddr : void*
    wintypes.DWORD,  # dwFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	crypt32 = windows.NewLazySystemDLL("CRYPT32.dll")
	procCryptFreeOIDFunctionAddress = crypt32.NewProc("CryptFreeOIDFunctionAddress")
)

// hFuncAddr (void*), dwFlags (DWORD)
r1, _, err := procCryptFreeOIDFunctionAddress.Call(
	uintptr(hFuncAddr),
	uintptr(dwFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CryptFreeOIDFunctionAddress(
  hFuncAddr: Pointer;   // void*
  dwFlags: DWORD   // DWORD
): BOOL; stdcall;
  external 'CRYPT32.dll' name 'CryptFreeOIDFunctionAddress';
result := DllCall("CRYPT32\CryptFreeOIDFunctionAddress"
    , "Ptr", hFuncAddr   ; void*
    , "UInt", dwFlags   ; DWORD
    , "Int")   ; return: BOOL
●CryptFreeOIDFunctionAddress(hFuncAddr, dwFlags) = DLL("CRYPT32.dll", "bool CryptFreeOIDFunctionAddress(void*, dword)")
# 呼び出し: CryptFreeOIDFunctionAddress(hFuncAddr, dwFlags)
# hFuncAddr : void* -> "void*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。