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

BCryptDecapsulate

関数
秘密鍵を用いて暗号文から共有秘密を取り出す。
DLLbcrypt.dll呼出規約winapi

シグネチャ

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

NTSTATUS BCryptDecapsulate(
    BCRYPT_KEY_HANDLE hKey,
    BYTE* pbCipherText,
    DWORD cbCipherText,
    BYTE* pbSecretKey,   // optional
    DWORD cbSecretKey,
    DWORD* pcbSecretKey,
    DWORD dwFlags
);

パラメーター

名前方向説明
hKeyBCRYPT_KEY_HANDLEinカプセル解除に使う秘密鍵ハンドル(KEM)。
pbCipherTextBYTE*in復号する暗号文(カプセル)のバッファへのポインタ。
cbCipherTextDWORDin暗号文のバイト数。
pbSecretKeyBYTE*outoptional復元された共有秘密鍵を受け取るバッファへのポインタ。NULLで必要サイズのみ取得できる。
cbSecretKeyDWORDin共有秘密鍵バッファのバイトサイズ。
pcbSecretKeyDWORD*out実際の、または必要な共有秘密鍵バイト数を受け取るポインタ。
dwFlagsDWORDin予約済み。0を指定する。

戻り値の型: NTSTATUS

各言語での呼び出し定義

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

NTSTATUS BCryptDecapsulate(
    BCRYPT_KEY_HANDLE hKey,
    BYTE* pbCipherText,
    DWORD cbCipherText,
    BYTE* pbSecretKey,   // optional
    DWORD cbSecretKey,
    DWORD* pcbSecretKey,
    DWORD dwFlags
);
[DllImport("bcrypt.dll", ExactSpelling = true)]
static extern int BCryptDecapsulate(
    IntPtr hKey,   // BCRYPT_KEY_HANDLE
    IntPtr pbCipherText,   // BYTE*
    uint cbCipherText,   // DWORD
    IntPtr pbSecretKey,   // BYTE* optional, out
    uint cbSecretKey,   // DWORD
    out uint pcbSecretKey,   // DWORD* out
    uint dwFlags   // DWORD
);
<DllImport("bcrypt.dll", ExactSpelling:=True)>
Public Shared Function BCryptDecapsulate(
    hKey As IntPtr,   ' BCRYPT_KEY_HANDLE
    pbCipherText As IntPtr,   ' BYTE*
    cbCipherText As UInteger,   ' DWORD
    pbSecretKey As IntPtr,   ' BYTE* optional, out
    cbSecretKey As UInteger,   ' DWORD
    <Out> ByRef pcbSecretKey As UInteger,   ' DWORD* out
    dwFlags As UInteger   ' DWORD
) As Integer
End Function
' hKey : BCRYPT_KEY_HANDLE
' pbCipherText : BYTE*
' cbCipherText : DWORD
' pbSecretKey : BYTE* optional, out
' cbSecretKey : DWORD
' pcbSecretKey : DWORD* out
' dwFlags : DWORD
Declare PtrSafe Function BCryptDecapsulate Lib "bcrypt" ( _
    ByVal hKey As LongPtr, _
    ByVal pbCipherText As LongPtr, _
    ByVal cbCipherText As Long, _
    ByVal pbSecretKey As LongPtr, _
    ByVal cbSecretKey As Long, _
    ByRef pcbSecretKey As Long, _
    ByVal dwFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BCryptDecapsulate = ctypes.windll.bcrypt.BCryptDecapsulate
BCryptDecapsulate.restype = ctypes.c_int
BCryptDecapsulate.argtypes = [
    wintypes.HANDLE,  # hKey : BCRYPT_KEY_HANDLE
    ctypes.POINTER(ctypes.c_ubyte),  # pbCipherText : BYTE*
    wintypes.DWORD,  # cbCipherText : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # pbSecretKey : BYTE* optional, out
    wintypes.DWORD,  # cbSecretKey : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pcbSecretKey : DWORD* out
    wintypes.DWORD,  # dwFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	bcrypt = windows.NewLazySystemDLL("bcrypt.dll")
	procBCryptDecapsulate = bcrypt.NewProc("BCryptDecapsulate")
)

// hKey (BCRYPT_KEY_HANDLE), pbCipherText (BYTE*), cbCipherText (DWORD), pbSecretKey (BYTE* optional, out), cbSecretKey (DWORD), pcbSecretKey (DWORD* out), dwFlags (DWORD)
r1, _, err := procBCryptDecapsulate.Call(
	uintptr(hKey),
	uintptr(pbCipherText),
	uintptr(cbCipherText),
	uintptr(pbSecretKey),
	uintptr(cbSecretKey),
	uintptr(pcbSecretKey),
	uintptr(dwFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // NTSTATUS
function BCryptDecapsulate(
  hKey: THandle;   // BCRYPT_KEY_HANDLE
  pbCipherText: Pointer;   // BYTE*
  cbCipherText: DWORD;   // DWORD
  pbSecretKey: Pointer;   // BYTE* optional, out
  cbSecretKey: DWORD;   // DWORD
  pcbSecretKey: Pointer;   // DWORD* out
  dwFlags: DWORD   // DWORD
): Integer; stdcall;
  external 'bcrypt.dll' name 'BCryptDecapsulate';
result := DllCall("bcrypt\BCryptDecapsulate"
    , "Ptr", hKey   ; BCRYPT_KEY_HANDLE
    , "Ptr", pbCipherText   ; BYTE*
    , "UInt", cbCipherText   ; DWORD
    , "Ptr", pbSecretKey   ; BYTE* optional, out
    , "UInt", cbSecretKey   ; DWORD
    , "Ptr", pcbSecretKey   ; DWORD* out
    , "UInt", dwFlags   ; DWORD
    , "Int")   ; return: NTSTATUS
●BCryptDecapsulate(hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags) = DLL("bcrypt.dll", "int BCryptDecapsulate(void*, void*, dword, void*, dword, void*, dword)")
# 呼び出し: BCryptDecapsulate(hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags)
# hKey : BCRYPT_KEY_HANDLE -> "void*"
# pbCipherText : BYTE* -> "void*"
# cbCipherText : DWORD -> "dword"
# pbSecretKey : BYTE* optional, out -> "void*"
# cbSecretKey : DWORD -> "dword"
# pcbSecretKey : DWORD* out -> "void*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "bcrypt" fn BCryptDecapsulate(
    hKey: ?*anyopaque, // BCRYPT_KEY_HANDLE
    pbCipherText: [*c]u8, // BYTE*
    cbCipherText: u32, // DWORD
    pbSecretKey: [*c]u8, // BYTE* optional, out
    cbSecretKey: u32, // DWORD
    pcbSecretKey: [*c]u32, // DWORD* out
    dwFlags: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
proc BCryptDecapsulate(
    hKey: pointer,  # BCRYPT_KEY_HANDLE
    pbCipherText: ptr uint8,  # BYTE*
    cbCipherText: uint32,  # DWORD
    pbSecretKey: ptr uint8,  # BYTE* optional, out
    cbSecretKey: uint32,  # DWORD
    pcbSecretKey: ptr uint32,  # DWORD* out
    dwFlags: uint32  # DWORD
): int32 {.importc: "BCryptDecapsulate", stdcall, dynlib: "bcrypt.dll".}
pragma(lib, "bcrypt");
extern(Windows)
int BCryptDecapsulate(
    void* hKey,   // BCRYPT_KEY_HANDLE
    ubyte* pbCipherText,   // BYTE*
    uint cbCipherText,   // DWORD
    ubyte* pbSecretKey,   // BYTE* optional, out
    uint cbSecretKey,   // DWORD
    uint* pcbSecretKey,   // DWORD* out
    uint dwFlags   // DWORD
);
ccall((:BCryptDecapsulate, "bcrypt.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{UInt8}, UInt32, Ptr{UInt8}, UInt32, Ptr{UInt32}, UInt32),
      hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags)
# hKey : BCRYPT_KEY_HANDLE -> Ptr{Cvoid}
# pbCipherText : BYTE* -> Ptr{UInt8}
# cbCipherText : DWORD -> UInt32
# pbSecretKey : BYTE* optional, out -> Ptr{UInt8}
# cbSecretKey : DWORD -> UInt32
# pcbSecretKey : DWORD* out -> Ptr{UInt32}
# dwFlags : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t BCryptDecapsulate(
    void* hKey,
    uint8_t* pbCipherText,
    uint32_t cbCipherText,
    uint8_t* pbSecretKey,
    uint32_t cbSecretKey,
    uint32_t* pcbSecretKey,
    uint32_t dwFlags);
]]
local bcrypt = ffi.load("bcrypt")
-- bcrypt.BCryptDecapsulate(hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags)
-- hKey : BCRYPT_KEY_HANDLE
-- pbCipherText : BYTE*
-- cbCipherText : DWORD
-- pbSecretKey : BYTE* optional, out
-- cbSecretKey : DWORD
-- pcbSecretKey : DWORD* out
-- dwFlags : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('bcrypt.dll');
const BCryptDecapsulate = lib.func('__stdcall', 'BCryptDecapsulate', 'int32_t', ['void *', 'uint8_t *', 'uint32_t', 'uint8_t *', 'uint32_t', 'uint32_t *', 'uint32_t']);
// BCryptDecapsulate(hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags)
// hKey : BCRYPT_KEY_HANDLE -> 'void *'
// pbCipherText : BYTE* -> 'uint8_t *'
// cbCipherText : DWORD -> 'uint32_t'
// pbSecretKey : BYTE* optional, out -> 'uint8_t *'
// cbSecretKey : DWORD -> 'uint32_t'
// pcbSecretKey : DWORD* out -> 'uint32_t *'
// dwFlags : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("bcrypt.dll", {
  BCryptDecapsulate: { parameters: ["pointer", "pointer", "u32", "pointer", "u32", "pointer", "u32"], result: "i32" },
});
// lib.symbols.BCryptDecapsulate(hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags)
// hKey : BCRYPT_KEY_HANDLE -> "pointer"
// pbCipherText : BYTE* -> "pointer"
// cbCipherText : DWORD -> "u32"
// pbSecretKey : BYTE* optional, out -> "pointer"
// cbSecretKey : DWORD -> "u32"
// pcbSecretKey : DWORD* out -> "pointer"
// dwFlags : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t BCryptDecapsulate(
    void* hKey,
    uint8_t* pbCipherText,
    uint32_t cbCipherText,
    uint8_t* pbSecretKey,
    uint32_t cbSecretKey,
    uint32_t* pcbSecretKey,
    uint32_t dwFlags);
C, "bcrypt.dll");
// $ffi->BCryptDecapsulate(hKey, pbCipherText, cbCipherText, pbSecretKey, cbSecretKey, pcbSecretKey, dwFlags);
// hKey : BCRYPT_KEY_HANDLE
// pbCipherText : BYTE*
// cbCipherText : DWORD
// pbSecretKey : BYTE* optional, out
// cbSecretKey : DWORD
// pcbSecretKey : DWORD* out
// dwFlags : DWORD
// 構造体/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 Bcrypt extends StdCallLibrary {
    Bcrypt INSTANCE = Native.load("bcrypt", Bcrypt.class);
    int BCryptDecapsulate(
        Pointer hKey,   // BCRYPT_KEY_HANDLE
        byte[] pbCipherText,   // BYTE*
        int cbCipherText,   // DWORD
        byte[] pbSecretKey,   // BYTE* optional, out
        int cbSecretKey,   // DWORD
        IntByReference pcbSecretKey,   // DWORD* out
        int dwFlags   // DWORD
    );
}
@[Link("bcrypt")]
lib Libbcrypt
  fun BCryptDecapsulate = BCryptDecapsulate(
    hKey : Void*,   # BCRYPT_KEY_HANDLE
    pbCipherText : UInt8*,   # BYTE*
    cbCipherText : UInt32,   # DWORD
    pbSecretKey : UInt8*,   # BYTE* optional, out
    cbSecretKey : UInt32,   # DWORD
    pcbSecretKey : UInt32*,   # DWORD* out
    dwFlags : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef BCryptDecapsulateNative = Int32 Function(Pointer<Void>, Pointer<Uint8>, Uint32, Pointer<Uint8>, Uint32, Pointer<Uint32>, Uint32);
typedef BCryptDecapsulateDart = int Function(Pointer<Void>, Pointer<Uint8>, int, Pointer<Uint8>, int, Pointer<Uint32>, int);
final BCryptDecapsulate = DynamicLibrary.open('bcrypt.dll')
    .lookupFunction<BCryptDecapsulateNative, BCryptDecapsulateDart>('BCryptDecapsulate');
// hKey : BCRYPT_KEY_HANDLE -> Pointer<Void>
// pbCipherText : BYTE* -> Pointer<Uint8>
// cbCipherText : DWORD -> Uint32
// pbSecretKey : BYTE* optional, out -> Pointer<Uint8>
// cbSecretKey : DWORD -> Uint32
// pcbSecretKey : DWORD* out -> Pointer<Uint32>
// dwFlags : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function BCryptDecapsulate(
  hKey: THandle;   // BCRYPT_KEY_HANDLE
  pbCipherText: Pointer;   // BYTE*
  cbCipherText: DWORD;   // DWORD
  pbSecretKey: Pointer;   // BYTE* optional, out
  cbSecretKey: DWORD;   // DWORD
  pcbSecretKey: Pointer;   // DWORD* out
  dwFlags: DWORD   // DWORD
): Integer; stdcall;
  external 'bcrypt.dll' name 'BCryptDecapsulate';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "BCryptDecapsulate"
  c_BCryptDecapsulate :: Ptr () -> Ptr Word8 -> Word32 -> Ptr Word8 -> Word32 -> Ptr Word32 -> Word32 -> IO Int32
-- hKey : BCRYPT_KEY_HANDLE -> Ptr ()
-- pbCipherText : BYTE* -> Ptr Word8
-- cbCipherText : DWORD -> Word32
-- pbSecretKey : BYTE* optional, out -> Ptr Word8
-- cbSecretKey : DWORD -> Word32
-- pcbSecretKey : DWORD* out -> Ptr Word32
-- dwFlags : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let bcryptdecapsulate =
  foreign "BCryptDecapsulate"
    ((ptr void) @-> (ptr uint8_t) @-> uint32_t @-> (ptr uint8_t) @-> uint32_t @-> (ptr uint32_t) @-> uint32_t @-> returning int32_t)
(* hKey : BCRYPT_KEY_HANDLE -> (ptr void) *)
(* pbCipherText : BYTE* -> (ptr uint8_t) *)
(* cbCipherText : DWORD -> uint32_t *)
(* pbSecretKey : BYTE* optional, out -> (ptr uint8_t) *)
(* cbSecretKey : DWORD -> uint32_t *)
(* pcbSecretKey : DWORD* out -> (ptr uint32_t) *)
(* dwFlags : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library bcrypt (t "bcrypt.dll"))
(cffi:use-foreign-library bcrypt)

(cffi:defcfun ("BCryptDecapsulate" bcrypt-decapsulate :convention :stdcall) :int32
  (h-key :pointer)   ; BCRYPT_KEY_HANDLE
  (pb-cipher-text :pointer)   ; BYTE*
  (cb-cipher-text :uint32)   ; DWORD
  (pb-secret-key :pointer)   ; BYTE* optional, out
  (cb-secret-key :uint32)   ; DWORD
  (pcb-secret-key :pointer)   ; DWORD* out
  (dw-flags :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $BCryptDecapsulate = Win32::API::More->new('bcrypt',
    'int BCryptDecapsulate(HANDLE hKey, LPVOID pbCipherText, DWORD cbCipherText, LPVOID pbSecretKey, DWORD cbSecretKey, LPVOID pcbSecretKey, DWORD dwFlags)');
# my $ret = $BCryptDecapsulate->Call($hKey, $pbCipherText, $cbCipherText, $pbSecretKey, $cbSecretKey, $pcbSecretKey, $dwFlags);
# hKey : BCRYPT_KEY_HANDLE -> HANDLE
# pbCipherText : BYTE* -> LPVOID
# cbCipherText : DWORD -> DWORD
# pbSecretKey : BYTE* optional, out -> LPVOID
# cbSecretKey : DWORD -> DWORD
# pcbSecretKey : DWORD* out -> LPVOID
# dwFlags : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。