ホーム › Security.Cryptography › BCryptDeleteContext
BCryptDeleteContext
関数CNG構成テーブルから指定したコンテキストを削除する。
シグネチャ
// bcrypt.dll
#include <windows.h>
NTSTATUS BCryptDeleteContext(
BCRYPT_TABLE dwTable,
LPCWSTR pszContext
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwTable | BCRYPT_TABLE | in |
| pszContext | LPCWSTR | in |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// bcrypt.dll
#include <windows.h>
NTSTATUS BCryptDeleteContext(
BCRYPT_TABLE dwTable,
LPCWSTR pszContext
);[DllImport("bcrypt.dll", ExactSpelling = true)]
static extern int BCryptDeleteContext(
uint dwTable, // BCRYPT_TABLE
[MarshalAs(UnmanagedType.LPWStr)] string pszContext // LPCWSTR
);<DllImport("bcrypt.dll", ExactSpelling:=True)>
Public Shared Function BCryptDeleteContext(
dwTable As UInteger, ' BCRYPT_TABLE
<MarshalAs(UnmanagedType.LPWStr)> pszContext As String ' LPCWSTR
) As Integer
End Function' dwTable : BCRYPT_TABLE
' pszContext : LPCWSTR
Declare PtrSafe Function BCryptDeleteContext Lib "bcrypt" ( _
ByVal dwTable As Long, _
ByVal pszContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BCryptDeleteContext = ctypes.windll.bcrypt.BCryptDeleteContext
BCryptDeleteContext.restype = ctypes.c_int
BCryptDeleteContext.argtypes = [
wintypes.DWORD, # dwTable : BCRYPT_TABLE
wintypes.LPCWSTR, # pszContext : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('bcrypt.dll')
BCryptDeleteContext = Fiddle::Function.new(
lib['BCryptDeleteContext'],
[
-Fiddle::TYPE_INT, # dwTable : BCRYPT_TABLE
Fiddle::TYPE_VOIDP, # pszContext : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "bcrypt")]
extern "system" {
fn BCryptDeleteContext(
dwTable: u32, // BCRYPT_TABLE
pszContext: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("bcrypt.dll")]
public static extern int BCryptDeleteContext(uint dwTable, [MarshalAs(UnmanagedType.LPWStr)] string pszContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'bcrypt_BCryptDeleteContext' -Namespace Win32 -PassThru
# $api::BCryptDeleteContext(dwTable, pszContext)#uselib "bcrypt.dll"
#func global BCryptDeleteContext "BCryptDeleteContext" sptr, sptr
; BCryptDeleteContext dwTable, pszContext ; 戻り値は stat
; dwTable : BCRYPT_TABLE -> "sptr"
; pszContext : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "bcrypt.dll"
#cfunc global BCryptDeleteContext "BCryptDeleteContext" int, wstr
; res = BCryptDeleteContext(dwTable, pszContext)
; dwTable : BCRYPT_TABLE -> "int"
; pszContext : LPCWSTR -> "wstr"; NTSTATUS BCryptDeleteContext(BCRYPT_TABLE dwTable, LPCWSTR pszContext)
#uselib "bcrypt.dll"
#cfunc global BCryptDeleteContext "BCryptDeleteContext" int, wstr
; res = BCryptDeleteContext(dwTable, pszContext)
; dwTable : BCRYPT_TABLE -> "int"
; pszContext : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bcrypt = windows.NewLazySystemDLL("bcrypt.dll")
procBCryptDeleteContext = bcrypt.NewProc("BCryptDeleteContext")
)
// dwTable (BCRYPT_TABLE), pszContext (LPCWSTR)
r1, _, err := procBCryptDeleteContext.Call(
uintptr(dwTable),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszContext))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction BCryptDeleteContext(
dwTable: DWORD; // BCRYPT_TABLE
pszContext: PWideChar // LPCWSTR
): Integer; stdcall;
external 'bcrypt.dll' name 'BCryptDeleteContext';result := DllCall("bcrypt\BCryptDeleteContext"
, "UInt", dwTable ; BCRYPT_TABLE
, "WStr", pszContext ; LPCWSTR
, "Int") ; return: NTSTATUS●BCryptDeleteContext(dwTable, pszContext) = DLL("bcrypt.dll", "int BCryptDeleteContext(dword, char*)")
# 呼び出し: BCryptDeleteContext(dwTable, pszContext)
# dwTable : BCRYPT_TABLE -> "dword"
# pszContext : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。