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

BCryptGetFipsAlgorithmMode

関数
FIPS準拠アルゴリズムモードが有効かどうかを取得する。
DLLbcrypt.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

NTSTATUS BCryptGetFipsAlgorithmMode(
    BYTE* pfEnabled
);

パラメーター

名前方向
pfEnabledBYTE*out

戻り値の型: NTSTATUS

各言語での呼び出し定義

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

NTSTATUS BCryptGetFipsAlgorithmMode(
    BYTE* pfEnabled
);
[DllImport("bcrypt.dll", ExactSpelling = true)]
static extern int BCryptGetFipsAlgorithmMode(
    IntPtr pfEnabled   // BYTE* out
);
<DllImport("bcrypt.dll", ExactSpelling:=True)>
Public Shared Function BCryptGetFipsAlgorithmMode(
    pfEnabled As IntPtr   ' BYTE* out
) As Integer
End Function
' pfEnabled : BYTE* out
Declare PtrSafe Function BCryptGetFipsAlgorithmMode Lib "bcrypt" ( _
    ByVal pfEnabled As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BCryptGetFipsAlgorithmMode = ctypes.windll.bcrypt.BCryptGetFipsAlgorithmMode
BCryptGetFipsAlgorithmMode.restype = ctypes.c_int
BCryptGetFipsAlgorithmMode.argtypes = [
    ctypes.POINTER(ctypes.c_ubyte),  # pfEnabled : BYTE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('bcrypt.dll')
BCryptGetFipsAlgorithmMode = Fiddle::Function.new(
  lib['BCryptGetFipsAlgorithmMode'],
  [
    Fiddle::TYPE_VOIDP,  # pfEnabled : BYTE* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "bcrypt")]
extern "system" {
    fn BCryptGetFipsAlgorithmMode(
        pfEnabled: *mut u8  // BYTE* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("bcrypt.dll")]
public static extern int BCryptGetFipsAlgorithmMode(IntPtr pfEnabled);
"@
$api = Add-Type -MemberDefinition $sig -Name 'bcrypt_BCryptGetFipsAlgorithmMode' -Namespace Win32 -PassThru
# $api::BCryptGetFipsAlgorithmMode(pfEnabled)
#uselib "bcrypt.dll"
#func global BCryptGetFipsAlgorithmMode "BCryptGetFipsAlgorithmMode" sptr
; BCryptGetFipsAlgorithmMode varptr(pfEnabled)   ; 戻り値は stat
; pfEnabled : BYTE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "bcrypt.dll"
#cfunc global BCryptGetFipsAlgorithmMode "BCryptGetFipsAlgorithmMode" var
; res = BCryptGetFipsAlgorithmMode(pfEnabled)
; pfEnabled : BYTE* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; NTSTATUS BCryptGetFipsAlgorithmMode(BYTE* pfEnabled)
#uselib "bcrypt.dll"
#cfunc global BCryptGetFipsAlgorithmMode "BCryptGetFipsAlgorithmMode" var
; res = BCryptGetFipsAlgorithmMode(pfEnabled)
; pfEnabled : BYTE* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	bcrypt = windows.NewLazySystemDLL("bcrypt.dll")
	procBCryptGetFipsAlgorithmMode = bcrypt.NewProc("BCryptGetFipsAlgorithmMode")
)

// pfEnabled (BYTE* out)
r1, _, err := procBCryptGetFipsAlgorithmMode.Call(
	uintptr(pfEnabled),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // NTSTATUS
function BCryptGetFipsAlgorithmMode(
  pfEnabled: Pointer   // BYTE* out
): Integer; stdcall;
  external 'bcrypt.dll' name 'BCryptGetFipsAlgorithmMode';
result := DllCall("bcrypt\BCryptGetFipsAlgorithmMode"
    , "Ptr", pfEnabled   ; BYTE* out
    , "Int")   ; return: NTSTATUS
●BCryptGetFipsAlgorithmMode(pfEnabled) = DLL("bcrypt.dll", "int BCryptGetFipsAlgorithmMode(void*)")
# 呼び出し: BCryptGetFipsAlgorithmMode(pfEnabled)
# pfEnabled : BYTE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。