ホーム › Security.Authentication.Identity › SLGetPKeyId
SLGetPKeyId
関数プロダクトキー文字列に対応するプロダクトキーIDを取得する。
シグネチャ
// SLC.dll
#include <windows.h>
HRESULT SLGetPKeyId(
void* hSLC,
LPCWSTR pwszPKeyAlgorithm,
LPCWSTR pwszPKeyString,
DWORD cbPKeySpecificData,
const BYTE* pbPKeySpecificData, // optional
GUID* pPKeyId
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hSLC | void* | in | SLOpenで取得したSLCハンドル。 |
| pwszPKeyAlgorithm | LPCWSTR | in | プロダクトキーのアルゴリズムを示すUnicode文字列(GUID表現)。 |
| pwszPKeyString | LPCWSTR | in | 対象のプロダクトキー文字列を指すUnicode文字列。 |
| cbPKeySpecificData | DWORD | in | pbPKeySpecificDataのバイト長。データが無い場合は0。 |
| pbPKeySpecificData | BYTE* | inoptional | プロダクトキー固有の追加データへのポインタ。NULL可。 |
| pPKeyId | GUID* | out | 算出されたプロダクトキーIDのGUIDを受け取るポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// SLC.dll
#include <windows.h>
HRESULT SLGetPKeyId(
void* hSLC,
LPCWSTR pwszPKeyAlgorithm,
LPCWSTR pwszPKeyString,
DWORD cbPKeySpecificData,
const BYTE* pbPKeySpecificData, // optional
GUID* pPKeyId
);[DllImport("SLC.dll", ExactSpelling = true)]
static extern int SLGetPKeyId(
IntPtr hSLC, // void*
[MarshalAs(UnmanagedType.LPWStr)] string pwszPKeyAlgorithm, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pwszPKeyString, // LPCWSTR
uint cbPKeySpecificData, // DWORD
IntPtr pbPKeySpecificData, // BYTE* optional
out Guid pPKeyId // GUID* out
);<DllImport("SLC.dll", ExactSpelling:=True)>
Public Shared Function SLGetPKeyId(
hSLC As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> pwszPKeyAlgorithm As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pwszPKeyString As String, ' LPCWSTR
cbPKeySpecificData As UInteger, ' DWORD
pbPKeySpecificData As IntPtr, ' BYTE* optional
<Out> ByRef pPKeyId As Guid ' GUID* out
) As Integer
End Function' hSLC : void*
' pwszPKeyAlgorithm : LPCWSTR
' pwszPKeyString : LPCWSTR
' cbPKeySpecificData : DWORD
' pbPKeySpecificData : BYTE* optional
' pPKeyId : GUID* out
Declare PtrSafe Function SLGetPKeyId Lib "slc" ( _
ByVal hSLC As LongPtr, _
ByVal pwszPKeyAlgorithm As LongPtr, _
ByVal pwszPKeyString As LongPtr, _
ByVal cbPKeySpecificData As Long, _
ByVal pbPKeySpecificData As LongPtr, _
ByVal pPKeyId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SLGetPKeyId = ctypes.windll.slc.SLGetPKeyId
SLGetPKeyId.restype = ctypes.c_int
SLGetPKeyId.argtypes = [
ctypes.POINTER(None), # hSLC : void*
wintypes.LPCWSTR, # pwszPKeyAlgorithm : LPCWSTR
wintypes.LPCWSTR, # pwszPKeyString : LPCWSTR
wintypes.DWORD, # cbPKeySpecificData : DWORD
ctypes.POINTER(ctypes.c_ubyte), # pbPKeySpecificData : BYTE* optional
ctypes.c_void_p, # pPKeyId : GUID* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SLC.dll')
SLGetPKeyId = Fiddle::Function.new(
lib['SLGetPKeyId'],
[
Fiddle::TYPE_VOIDP, # hSLC : void*
Fiddle::TYPE_VOIDP, # pwszPKeyAlgorithm : LPCWSTR
Fiddle::TYPE_VOIDP, # pwszPKeyString : LPCWSTR
-Fiddle::TYPE_INT, # cbPKeySpecificData : DWORD
Fiddle::TYPE_VOIDP, # pbPKeySpecificData : BYTE* optional
Fiddle::TYPE_VOIDP, # pPKeyId : GUID* out
],
Fiddle::TYPE_INT)#[link(name = "slc")]
extern "system" {
fn SLGetPKeyId(
hSLC: *mut (), // void*
pwszPKeyAlgorithm: *const u16, // LPCWSTR
pwszPKeyString: *const u16, // LPCWSTR
cbPKeySpecificData: u32, // DWORD
pbPKeySpecificData: *const u8, // BYTE* optional
pPKeyId: *mut GUID // GUID* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SLC.dll")]
public static extern int SLGetPKeyId(IntPtr hSLC, [MarshalAs(UnmanagedType.LPWStr)] string pwszPKeyAlgorithm, [MarshalAs(UnmanagedType.LPWStr)] string pwszPKeyString, uint cbPKeySpecificData, IntPtr pbPKeySpecificData, out Guid pPKeyId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SLC_SLGetPKeyId' -Namespace Win32 -PassThru
# $api::SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId)#uselib "SLC.dll"
#func global SLGetPKeyId "SLGetPKeyId" sptr, sptr, sptr, sptr, sptr, sptr
; SLGetPKeyId hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, varptr(pbPKeySpecificData), varptr(pPKeyId) ; 戻り値は stat
; hSLC : void* -> "sptr"
; pwszPKeyAlgorithm : LPCWSTR -> "sptr"
; pwszPKeyString : LPCWSTR -> "sptr"
; cbPKeySpecificData : DWORD -> "sptr"
; pbPKeySpecificData : BYTE* optional -> "sptr"
; pPKeyId : GUID* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SLC.dll" #cfunc global SLGetPKeyId "SLGetPKeyId" sptr, wstr, wstr, int, var, var ; res = SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId) ; hSLC : void* -> "sptr" ; pwszPKeyAlgorithm : LPCWSTR -> "wstr" ; pwszPKeyString : LPCWSTR -> "wstr" ; cbPKeySpecificData : DWORD -> "int" ; pbPKeySpecificData : BYTE* optional -> "var" ; pPKeyId : GUID* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SLC.dll" #cfunc global SLGetPKeyId "SLGetPKeyId" sptr, wstr, wstr, int, sptr, sptr ; res = SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, varptr(pbPKeySpecificData), varptr(pPKeyId)) ; hSLC : void* -> "sptr" ; pwszPKeyAlgorithm : LPCWSTR -> "wstr" ; pwszPKeyString : LPCWSTR -> "wstr" ; cbPKeySpecificData : DWORD -> "int" ; pbPKeySpecificData : BYTE* optional -> "sptr" ; pPKeyId : GUID* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT SLGetPKeyId(void* hSLC, LPCWSTR pwszPKeyAlgorithm, LPCWSTR pwszPKeyString, DWORD cbPKeySpecificData, BYTE* pbPKeySpecificData, GUID* pPKeyId) #uselib "SLC.dll" #cfunc global SLGetPKeyId "SLGetPKeyId" intptr, wstr, wstr, int, var, var ; res = SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId) ; hSLC : void* -> "intptr" ; pwszPKeyAlgorithm : LPCWSTR -> "wstr" ; pwszPKeyString : LPCWSTR -> "wstr" ; cbPKeySpecificData : DWORD -> "int" ; pbPKeySpecificData : BYTE* optional -> "var" ; pPKeyId : GUID* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT SLGetPKeyId(void* hSLC, LPCWSTR pwszPKeyAlgorithm, LPCWSTR pwszPKeyString, DWORD cbPKeySpecificData, BYTE* pbPKeySpecificData, GUID* pPKeyId) #uselib "SLC.dll" #cfunc global SLGetPKeyId "SLGetPKeyId" intptr, wstr, wstr, int, intptr, intptr ; res = SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, varptr(pbPKeySpecificData), varptr(pPKeyId)) ; hSLC : void* -> "intptr" ; pwszPKeyAlgorithm : LPCWSTR -> "wstr" ; pwszPKeyString : LPCWSTR -> "wstr" ; cbPKeySpecificData : DWORD -> "int" ; pbPKeySpecificData : BYTE* optional -> "intptr" ; pPKeyId : GUID* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
slc = windows.NewLazySystemDLL("SLC.dll")
procSLGetPKeyId = slc.NewProc("SLGetPKeyId")
)
// hSLC (void*), pwszPKeyAlgorithm (LPCWSTR), pwszPKeyString (LPCWSTR), cbPKeySpecificData (DWORD), pbPKeySpecificData (BYTE* optional), pPKeyId (GUID* out)
r1, _, err := procSLGetPKeyId.Call(
uintptr(hSLC),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszPKeyAlgorithm))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszPKeyString))),
uintptr(cbPKeySpecificData),
uintptr(pbPKeySpecificData),
uintptr(pPKeyId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SLGetPKeyId(
hSLC: Pointer; // void*
pwszPKeyAlgorithm: PWideChar; // LPCWSTR
pwszPKeyString: PWideChar; // LPCWSTR
cbPKeySpecificData: DWORD; // DWORD
pbPKeySpecificData: Pointer; // BYTE* optional
pPKeyId: PGUID // GUID* out
): Integer; stdcall;
external 'SLC.dll' name 'SLGetPKeyId';result := DllCall("SLC\SLGetPKeyId"
, "Ptr", hSLC ; void*
, "WStr", pwszPKeyAlgorithm ; LPCWSTR
, "WStr", pwszPKeyString ; LPCWSTR
, "UInt", cbPKeySpecificData ; DWORD
, "Ptr", pbPKeySpecificData ; BYTE* optional
, "Ptr", pPKeyId ; GUID* out
, "Int") ; return: HRESULT●SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId) = DLL("SLC.dll", "int SLGetPKeyId(void*, char*, char*, dword, void*, void*)")
# 呼び出し: SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId)
# hSLC : void* -> "void*"
# pwszPKeyAlgorithm : LPCWSTR -> "char*"
# pwszPKeyString : LPCWSTR -> "char*"
# cbPKeySpecificData : DWORD -> "dword"
# pbPKeySpecificData : BYTE* optional -> "void*"
# pPKeyId : GUID* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "slc" fn SLGetPKeyId(
hSLC: ?*anyopaque, // void*
pwszPKeyAlgorithm: [*c]const u16, // LPCWSTR
pwszPKeyString: [*c]const u16, // LPCWSTR
cbPKeySpecificData: u32, // DWORD
pbPKeySpecificData: [*c]u8, // BYTE* optional
pPKeyId: [*c]GUID // GUID* out
) callconv(std.os.windows.WINAPI) i32;proc SLGetPKeyId(
hSLC: pointer, # void*
pwszPKeyAlgorithm: WideCString, # LPCWSTR
pwszPKeyString: WideCString, # LPCWSTR
cbPKeySpecificData: uint32, # DWORD
pbPKeySpecificData: ptr uint8, # BYTE* optional
pPKeyId: ptr GUID # GUID* out
): int32 {.importc: "SLGetPKeyId", stdcall, dynlib: "SLC.dll".}pragma(lib, "slc");
extern(Windows)
int SLGetPKeyId(
void* hSLC, // void*
const(wchar)* pwszPKeyAlgorithm, // LPCWSTR
const(wchar)* pwszPKeyString, // LPCWSTR
uint cbPKeySpecificData, // DWORD
ubyte* pbPKeySpecificData, // BYTE* optional
GUID* pPKeyId // GUID* out
);ccall((:SLGetPKeyId, "SLC.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring, Cwstring, UInt32, Ptr{UInt8}, Ptr{GUID}),
hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId)
# hSLC : void* -> Ptr{Cvoid}
# pwszPKeyAlgorithm : LPCWSTR -> Cwstring
# pwszPKeyString : LPCWSTR -> Cwstring
# cbPKeySpecificData : DWORD -> UInt32
# pbPKeySpecificData : BYTE* optional -> Ptr{UInt8}
# pPKeyId : GUID* out -> Ptr{GUID}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SLGetPKeyId(
void* hSLC,
const uint16_t* pwszPKeyAlgorithm,
const uint16_t* pwszPKeyString,
uint32_t cbPKeySpecificData,
uint8_t* pbPKeySpecificData,
void* pPKeyId);
]]
local slc = ffi.load("slc")
-- slc.SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId)
-- hSLC : void*
-- pwszPKeyAlgorithm : LPCWSTR
-- pwszPKeyString : LPCWSTR
-- cbPKeySpecificData : DWORD
-- pbPKeySpecificData : BYTE* optional
-- pPKeyId : GUID* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SLC.dll');
const SLGetPKeyId = lib.func('__stdcall', 'SLGetPKeyId', 'int32_t', ['void *', 'str16', 'str16', 'uint32_t', 'uint8_t *', 'void *']);
// SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId)
// hSLC : void* -> 'void *'
// pwszPKeyAlgorithm : LPCWSTR -> 'str16'
// pwszPKeyString : LPCWSTR -> 'str16'
// cbPKeySpecificData : DWORD -> 'uint32_t'
// pbPKeySpecificData : BYTE* optional -> 'uint8_t *'
// pPKeyId : GUID* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SLC.dll", {
SLGetPKeyId: { parameters: ["pointer", "buffer", "buffer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId)
// hSLC : void* -> "pointer"
// pwszPKeyAlgorithm : LPCWSTR -> "buffer"
// pwszPKeyString : LPCWSTR -> "buffer"
// cbPKeySpecificData : DWORD -> "u32"
// pbPKeySpecificData : BYTE* optional -> "pointer"
// pPKeyId : GUID* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SLGetPKeyId(
void* hSLC,
const uint16_t* pwszPKeyAlgorithm,
const uint16_t* pwszPKeyString,
uint32_t cbPKeySpecificData,
uint8_t* pbPKeySpecificData,
void* pPKeyId);
C, "SLC.dll");
// $ffi->SLGetPKeyId(hSLC, pwszPKeyAlgorithm, pwszPKeyString, cbPKeySpecificData, pbPKeySpecificData, pPKeyId);
// hSLC : void*
// pwszPKeyAlgorithm : LPCWSTR
// pwszPKeyString : LPCWSTR
// cbPKeySpecificData : DWORD
// pbPKeySpecificData : BYTE* optional
// pPKeyId : GUID* out
// 構造体/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 Slc extends StdCallLibrary {
Slc INSTANCE = Native.load("slc", Slc.class);
int SLGetPKeyId(
Pointer hSLC, // void*
WString pwszPKeyAlgorithm, // LPCWSTR
WString pwszPKeyString, // LPCWSTR
int cbPKeySpecificData, // DWORD
byte[] pbPKeySpecificData, // BYTE* optional
Pointer pPKeyId // GUID* out
);
}@[Link("slc")]
lib LibSLC
fun SLGetPKeyId = SLGetPKeyId(
hSLC : Void*, # void*
pwszPKeyAlgorithm : UInt16*, # LPCWSTR
pwszPKeyString : UInt16*, # LPCWSTR
cbPKeySpecificData : UInt32, # DWORD
pbPKeySpecificData : UInt8*, # BYTE* optional
pPKeyId : GUID* # GUID* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SLGetPKeyIdNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Uint32, Pointer<Uint8>, Pointer<Void>);
typedef SLGetPKeyIdDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, int, Pointer<Uint8>, Pointer<Void>);
final SLGetPKeyId = DynamicLibrary.open('SLC.dll')
.lookupFunction<SLGetPKeyIdNative, SLGetPKeyIdDart>('SLGetPKeyId');
// hSLC : void* -> Pointer<Void>
// pwszPKeyAlgorithm : LPCWSTR -> Pointer<Utf16>
// pwszPKeyString : LPCWSTR -> Pointer<Utf16>
// cbPKeySpecificData : DWORD -> Uint32
// pbPKeySpecificData : BYTE* optional -> Pointer<Uint8>
// pPKeyId : GUID* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SLGetPKeyId(
hSLC: Pointer; // void*
pwszPKeyAlgorithm: PWideChar; // LPCWSTR
pwszPKeyString: PWideChar; // LPCWSTR
cbPKeySpecificData: DWORD; // DWORD
pbPKeySpecificData: Pointer; // BYTE* optional
pPKeyId: PGUID // GUID* out
): Integer; stdcall;
external 'SLC.dll' name 'SLGetPKeyId';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SLGetPKeyId"
c_SLGetPKeyId :: Ptr () -> CWString -> CWString -> Word32 -> Ptr Word8 -> Ptr () -> IO Int32
-- hSLC : void* -> Ptr ()
-- pwszPKeyAlgorithm : LPCWSTR -> CWString
-- pwszPKeyString : LPCWSTR -> CWString
-- cbPKeySpecificData : DWORD -> Word32
-- pbPKeySpecificData : BYTE* optional -> Ptr Word8
-- pPKeyId : GUID* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let slgetpkeyid =
foreign "SLGetPKeyId"
((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> (ptr uint8_t) @-> (ptr void) @-> returning int32_t)
(* hSLC : void* -> (ptr void) *)
(* pwszPKeyAlgorithm : LPCWSTR -> (ptr uint16_t) *)
(* pwszPKeyString : LPCWSTR -> (ptr uint16_t) *)
(* cbPKeySpecificData : DWORD -> uint32_t *)
(* pbPKeySpecificData : BYTE* optional -> (ptr uint8_t) *)
(* pPKeyId : GUID* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library slc (t "SLC.dll"))
(cffi:use-foreign-library slc)
(cffi:defcfun ("SLGetPKeyId" slget-pkey-id :convention :stdcall) :int32
(h-slc :pointer) ; void*
(pwsz-pkey-algorithm (:string :encoding :utf-16le)) ; LPCWSTR
(pwsz-pkey-string (:string :encoding :utf-16le)) ; LPCWSTR
(cb-pkey-specific-data :uint32) ; DWORD
(pb-pkey-specific-data :pointer) ; BYTE* optional
(p-pkey-id :pointer)) ; GUID* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SLGetPKeyId = Win32::API::More->new('SLC',
'int SLGetPKeyId(LPVOID hSLC, LPCWSTR pwszPKeyAlgorithm, LPCWSTR pwszPKeyString, DWORD cbPKeySpecificData, LPVOID pbPKeySpecificData, LPVOID pPKeyId)');
# my $ret = $SLGetPKeyId->Call($hSLC, $pwszPKeyAlgorithm, $pwszPKeyString, $cbPKeySpecificData, $pbPKeySpecificData, $pPKeyId);
# hSLC : void* -> LPVOID
# pwszPKeyAlgorithm : LPCWSTR -> LPCWSTR
# pwszPKeyString : LPCWSTR -> LPCWSTR
# cbPKeySpecificData : DWORD -> DWORD
# pbPKeySpecificData : BYTE* optional -> LPVOID
# pPKeyId : GUID* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。