CredPackAuthenticationBufferA
関数シグネチャ
// credui.dll (ANSI / -A)
#include <windows.h>
BOOL CredPackAuthenticationBufferA(
CRED_PACK_FLAGS dwFlags,
LPSTR pszUserName,
LPSTR pszPassword,
BYTE* pPackedCredentials, // optional
DWORD* pcbPackedCredentials
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| dwFlags | CRED_PACK_FLAGS | in | 資格情報をどのようにパックするかを指定します。次のフラグの組み合わせを指定できます。
| ||||||||||
| pszUserName | LPSTR | in | 変換するユーザー名を指定する null 終端文字列へのポインターです。ドメインユーザーの場合、文字列は次の形式である必要があります。 DomainName\UserName オンライン ID の場合、資格情報がプレーンテキストのパスワードであれば、ユーザー名の形式は ProviderName\UserName です。資格情報が SEC_WINNT_AUTH_IDENTITY_EX2 構造体の場合、ユーザー名は SspiEncodeAuthIdentityAsStrings 関数の呼び出しによって出力される UserName パラメーターであるエンコードされた文字列です。 スマートカード または証明書の資格情報の場合、ユーザー名は CertCredential オプションを指定した CredMarshalCredential 関数の呼び出しによって出力されるエンコードされた文字列です。 Windows Server 2008 R2、Windows 7、Windows Server 2008、Windows Vista: オンライン ID はサポートされていません。 | ||||||||||
| pszPassword | LPSTR | in | 変換するパスワードを指定する null 終端文字列へのポインターです。 SEC_WINNT_AUTH_IDENTITY_EX2 資格情報の場合、パスワードは SspiEncodeAuthIdentityAsStrings 関数の呼び出しの ppszPackedCredentialsString 出力に含まれるエンコードされた文字列です。 スマートカード の資格情報の場合、これはスマートカードの PIN です。 Windows Server 2008 R2、Windows 7、Windows Server 2008、Windows Vista: オンライン ID はサポートされていません。 | ||||||||||
| pPackedCredentials | BYTE* | outoptional | 出力時にパックされた認証バッファーを受け取るバイト配列へのポインターです。このパラメーターを NULL にすると、必要なバッファーサイズを pcbPackedCredentials パラメーターで受け取ることができます。 | ||||||||||
| pcbPackedCredentials | DWORD* | inout | pPackedCredentials バッファーのサイズ(バイト単位)を指定する DWORD 値へのポインターです。出力時、バッファーのサイズが十分でない場合は、pPackedCredentials バッファーに必要なサイズ(バイト単位)を指定します。 |
戻り値の型: BOOL
公式ドキュメント
文字列形式のユーザー名とパスワードを認証バッファーに変換します。(ANSI)
戻り値
関数が成功した場合は TRUE、それ以外の場合は FALSE を返します。
拡張エラー情報を取得するには、 GetLastError 関数を呼び出します。この関数は次のエラーコードを返すことがあります。
| 戻り値 | 説明 |
|---|---|
| pPackedCredentials によって提供されたバッファーが小さすぎます。 |
解説(Remarks)
wincred.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI バージョンまたは Unicode バージョンを自動的に選択するエイリアスとして CredPackAuthenticationBuffer を定義します。エンコードに依存しないエイリアスと、エンコードに依存しないわけではないコードを混在させて使用すると、不一致が生じ、コンパイルエラーまたは実行時エラーを引き起こす可能性があります。詳細については、関数プロトタイプの規則を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// credui.dll (ANSI / -A)
#include <windows.h>
BOOL CredPackAuthenticationBufferA(
CRED_PACK_FLAGS dwFlags,
LPSTR pszUserName,
LPSTR pszPassword,
BYTE* pPackedCredentials, // optional
DWORD* pcbPackedCredentials
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("credui.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool CredPackAuthenticationBufferA(
uint dwFlags, // CRED_PACK_FLAGS
[MarshalAs(UnmanagedType.LPStr)] string pszUserName, // LPSTR
[MarshalAs(UnmanagedType.LPStr)] string pszPassword, // LPSTR
IntPtr pPackedCredentials, // BYTE* optional, out
ref uint pcbPackedCredentials // DWORD* in/out
);<DllImport("credui.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CredPackAuthenticationBufferA(
dwFlags As UInteger, ' CRED_PACK_FLAGS
<MarshalAs(UnmanagedType.LPStr)> pszUserName As String, ' LPSTR
<MarshalAs(UnmanagedType.LPStr)> pszPassword As String, ' LPSTR
pPackedCredentials As IntPtr, ' BYTE* optional, out
ByRef pcbPackedCredentials As UInteger ' DWORD* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' dwFlags : CRED_PACK_FLAGS
' pszUserName : LPSTR
' pszPassword : LPSTR
' pPackedCredentials : BYTE* optional, out
' pcbPackedCredentials : DWORD* in/out
Declare PtrSafe Function CredPackAuthenticationBufferA Lib "credui" ( _
ByVal dwFlags As Long, _
ByVal pszUserName As String, _
ByVal pszPassword As String, _
ByVal pPackedCredentials As LongPtr, _
ByRef pcbPackedCredentials As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CredPackAuthenticationBufferA = ctypes.windll.credui.CredPackAuthenticationBufferA
CredPackAuthenticationBufferA.restype = wintypes.BOOL
CredPackAuthenticationBufferA.argtypes = [
wintypes.DWORD, # dwFlags : CRED_PACK_FLAGS
wintypes.LPCSTR, # pszUserName : LPSTR
wintypes.LPCSTR, # pszPassword : LPSTR
ctypes.POINTER(ctypes.c_ubyte), # pPackedCredentials : BYTE* optional, out
ctypes.POINTER(wintypes.DWORD), # pcbPackedCredentials : DWORD* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('credui.dll')
CredPackAuthenticationBufferA = Fiddle::Function.new(
lib['CredPackAuthenticationBufferA'],
[
-Fiddle::TYPE_INT, # dwFlags : CRED_PACK_FLAGS
Fiddle::TYPE_VOIDP, # pszUserName : LPSTR
Fiddle::TYPE_VOIDP, # pszPassword : LPSTR
Fiddle::TYPE_VOIDP, # pPackedCredentials : BYTE* optional, out
Fiddle::TYPE_VOIDP, # pcbPackedCredentials : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "credui")]
extern "system" {
fn CredPackAuthenticationBufferA(
dwFlags: u32, // CRED_PACK_FLAGS
pszUserName: *mut u8, // LPSTR
pszPassword: *mut u8, // LPSTR
pPackedCredentials: *mut u8, // BYTE* optional, out
pcbPackedCredentials: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("credui.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool CredPackAuthenticationBufferA(uint dwFlags, [MarshalAs(UnmanagedType.LPStr)] string pszUserName, [MarshalAs(UnmanagedType.LPStr)] string pszPassword, IntPtr pPackedCredentials, ref uint pcbPackedCredentials);
"@
$api = Add-Type -MemberDefinition $sig -Name 'credui_CredPackAuthenticationBufferA' -Namespace Win32 -PassThru
# $api::CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials)#uselib "credui.dll"
#func global CredPackAuthenticationBufferA "CredPackAuthenticationBufferA" sptr, sptr, sptr, sptr, sptr
; CredPackAuthenticationBufferA dwFlags, pszUserName, pszPassword, varptr(pPackedCredentials), varptr(pcbPackedCredentials) ; 戻り値は stat
; dwFlags : CRED_PACK_FLAGS -> "sptr"
; pszUserName : LPSTR -> "sptr"
; pszPassword : LPSTR -> "sptr"
; pPackedCredentials : BYTE* optional, out -> "sptr"
; pcbPackedCredentials : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "credui.dll" #cfunc global CredPackAuthenticationBufferA "CredPackAuthenticationBufferA" int, str, str, var, var ; res = CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials) ; dwFlags : CRED_PACK_FLAGS -> "int" ; pszUserName : LPSTR -> "str" ; pszPassword : LPSTR -> "str" ; pPackedCredentials : BYTE* optional, out -> "var" ; pcbPackedCredentials : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "credui.dll" #cfunc global CredPackAuthenticationBufferA "CredPackAuthenticationBufferA" int, str, str, sptr, sptr ; res = CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, varptr(pPackedCredentials), varptr(pcbPackedCredentials)) ; dwFlags : CRED_PACK_FLAGS -> "int" ; pszUserName : LPSTR -> "str" ; pszPassword : LPSTR -> "str" ; pPackedCredentials : BYTE* optional, out -> "sptr" ; pcbPackedCredentials : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
; BOOL CredPackAuthenticationBufferA(CRED_PACK_FLAGS dwFlags, LPSTR pszUserName, LPSTR pszPassword, BYTE* pPackedCredentials, DWORD* pcbPackedCredentials) #uselib "credui.dll" #cfunc global CredPackAuthenticationBufferA "CredPackAuthenticationBufferA" int, str, str, var, var ; res = CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials) ; dwFlags : CRED_PACK_FLAGS -> "int" ; pszUserName : LPSTR -> "str" ; pszPassword : LPSTR -> "str" ; pPackedCredentials : BYTE* optional, out -> "var" ; pcbPackedCredentials : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CredPackAuthenticationBufferA(CRED_PACK_FLAGS dwFlags, LPSTR pszUserName, LPSTR pszPassword, BYTE* pPackedCredentials, DWORD* pcbPackedCredentials) #uselib "credui.dll" #cfunc global CredPackAuthenticationBufferA "CredPackAuthenticationBufferA" int, str, str, intptr, intptr ; res = CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, varptr(pPackedCredentials), varptr(pcbPackedCredentials)) ; dwFlags : CRED_PACK_FLAGS -> "int" ; pszUserName : LPSTR -> "str" ; pszPassword : LPSTR -> "str" ; pPackedCredentials : BYTE* optional, out -> "intptr" ; pcbPackedCredentials : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
credui = windows.NewLazySystemDLL("credui.dll")
procCredPackAuthenticationBufferA = credui.NewProc("CredPackAuthenticationBufferA")
)
// dwFlags (CRED_PACK_FLAGS), pszUserName (LPSTR), pszPassword (LPSTR), pPackedCredentials (BYTE* optional, out), pcbPackedCredentials (DWORD* in/out)
r1, _, err := procCredPackAuthenticationBufferA.Call(
uintptr(dwFlags),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszUserName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszPassword))),
uintptr(pPackedCredentials),
uintptr(pcbPackedCredentials),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CredPackAuthenticationBufferA(
dwFlags: DWORD; // CRED_PACK_FLAGS
pszUserName: PAnsiChar; // LPSTR
pszPassword: PAnsiChar; // LPSTR
pPackedCredentials: Pointer; // BYTE* optional, out
pcbPackedCredentials: Pointer // DWORD* in/out
): BOOL; stdcall;
external 'credui.dll' name 'CredPackAuthenticationBufferA';result := DllCall("credui\CredPackAuthenticationBufferA"
, "UInt", dwFlags ; CRED_PACK_FLAGS
, "AStr", pszUserName ; LPSTR
, "AStr", pszPassword ; LPSTR
, "Ptr", pPackedCredentials ; BYTE* optional, out
, "Ptr", pcbPackedCredentials ; DWORD* in/out
, "Int") ; return: BOOL●CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials) = DLL("credui.dll", "bool CredPackAuthenticationBufferA(dword, char*, char*, void*, void*)")
# 呼び出し: CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials)
# dwFlags : CRED_PACK_FLAGS -> "dword"
# pszUserName : LPSTR -> "char*"
# pszPassword : LPSTR -> "char*"
# pPackedCredentials : BYTE* optional, out -> "void*"
# pcbPackedCredentials : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "credui" fn CredPackAuthenticationBufferA(
dwFlags: u32, // CRED_PACK_FLAGS
pszUserName: [*c]const u8, // LPSTR
pszPassword: [*c]const u8, // LPSTR
pPackedCredentials: [*c]u8, // BYTE* optional, out
pcbPackedCredentials: [*c]u32 // DWORD* in/out
) callconv(std.os.windows.WINAPI) i32;proc CredPackAuthenticationBufferA(
dwFlags: uint32, # CRED_PACK_FLAGS
pszUserName: cstring, # LPSTR
pszPassword: cstring, # LPSTR
pPackedCredentials: ptr uint8, # BYTE* optional, out
pcbPackedCredentials: ptr uint32 # DWORD* in/out
): int32 {.importc: "CredPackAuthenticationBufferA", stdcall, dynlib: "credui.dll".}pragma(lib, "credui");
extern(Windows)
int CredPackAuthenticationBufferA(
uint dwFlags, // CRED_PACK_FLAGS
const(char)* pszUserName, // LPSTR
const(char)* pszPassword, // LPSTR
ubyte* pPackedCredentials, // BYTE* optional, out
uint* pcbPackedCredentials // DWORD* in/out
);ccall((:CredPackAuthenticationBufferA, "credui.dll"), stdcall, Int32,
(UInt32, Cstring, Cstring, Ptr{UInt8}, Ptr{UInt32}),
dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials)
# dwFlags : CRED_PACK_FLAGS -> UInt32
# pszUserName : LPSTR -> Cstring
# pszPassword : LPSTR -> Cstring
# pPackedCredentials : BYTE* optional, out -> Ptr{UInt8}
# pcbPackedCredentials : DWORD* in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CredPackAuthenticationBufferA(
uint32_t dwFlags,
const char* pszUserName,
const char* pszPassword,
uint8_t* pPackedCredentials,
uint32_t* pcbPackedCredentials);
]]
local credui = ffi.load("credui")
-- credui.CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials)
-- dwFlags : CRED_PACK_FLAGS
-- pszUserName : LPSTR
-- pszPassword : LPSTR
-- pPackedCredentials : BYTE* optional, out
-- pcbPackedCredentials : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('credui.dll');
const CredPackAuthenticationBufferA = lib.func('__stdcall', 'CredPackAuthenticationBufferA', 'int32_t', ['uint32_t', 'str', 'str', 'uint8_t *', 'uint32_t *']);
// CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials)
// dwFlags : CRED_PACK_FLAGS -> 'uint32_t'
// pszUserName : LPSTR -> 'str'
// pszPassword : LPSTR -> 'str'
// pPackedCredentials : BYTE* optional, out -> 'uint8_t *'
// pcbPackedCredentials : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("credui.dll", {
CredPackAuthenticationBufferA: { parameters: ["u32", "buffer", "buffer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials)
// dwFlags : CRED_PACK_FLAGS -> "u32"
// pszUserName : LPSTR -> "buffer"
// pszPassword : LPSTR -> "buffer"
// pPackedCredentials : BYTE* optional, out -> "pointer"
// pcbPackedCredentials : DWORD* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CredPackAuthenticationBufferA(
uint32_t dwFlags,
const char* pszUserName,
const char* pszPassword,
uint8_t* pPackedCredentials,
uint32_t* pcbPackedCredentials);
C, "credui.dll");
// $ffi->CredPackAuthenticationBufferA(dwFlags, pszUserName, pszPassword, pPackedCredentials, pcbPackedCredentials);
// dwFlags : CRED_PACK_FLAGS
// pszUserName : LPSTR
// pszPassword : LPSTR
// pPackedCredentials : BYTE* optional, out
// pcbPackedCredentials : DWORD* in/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 Credui extends StdCallLibrary {
Credui INSTANCE = Native.load("credui", Credui.class, W32APIOptions.ASCII_OPTIONS);
boolean CredPackAuthenticationBufferA(
int dwFlags, // CRED_PACK_FLAGS
String pszUserName, // LPSTR
String pszPassword, // LPSTR
byte[] pPackedCredentials, // BYTE* optional, out
IntByReference pcbPackedCredentials // DWORD* in/out
);
}@[Link("credui")]
lib Libcredui
fun CredPackAuthenticationBufferA = CredPackAuthenticationBufferA(
dwFlags : UInt32, # CRED_PACK_FLAGS
pszUserName : UInt8*, # LPSTR
pszPassword : UInt8*, # LPSTR
pPackedCredentials : UInt8*, # BYTE* optional, out
pcbPackedCredentials : UInt32* # DWORD* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CredPackAuthenticationBufferANative = Int32 Function(Uint32, Pointer<Utf8>, Pointer<Utf8>, Pointer<Uint8>, Pointer<Uint32>);
typedef CredPackAuthenticationBufferADart = int Function(int, Pointer<Utf8>, Pointer<Utf8>, Pointer<Uint8>, Pointer<Uint32>);
final CredPackAuthenticationBufferA = DynamicLibrary.open('credui.dll')
.lookupFunction<CredPackAuthenticationBufferANative, CredPackAuthenticationBufferADart>('CredPackAuthenticationBufferA');
// dwFlags : CRED_PACK_FLAGS -> Uint32
// pszUserName : LPSTR -> Pointer<Utf8>
// pszPassword : LPSTR -> Pointer<Utf8>
// pPackedCredentials : BYTE* optional, out -> Pointer<Uint8>
// pcbPackedCredentials : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CredPackAuthenticationBufferA(
dwFlags: DWORD; // CRED_PACK_FLAGS
pszUserName: PAnsiChar; // LPSTR
pszPassword: PAnsiChar; // LPSTR
pPackedCredentials: Pointer; // BYTE* optional, out
pcbPackedCredentials: Pointer // DWORD* in/out
): BOOL; stdcall;
external 'credui.dll' name 'CredPackAuthenticationBufferA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CredPackAuthenticationBufferA"
c_CredPackAuthenticationBufferA :: Word32 -> CString -> CString -> Ptr Word8 -> Ptr Word32 -> IO CInt
-- dwFlags : CRED_PACK_FLAGS -> Word32
-- pszUserName : LPSTR -> CString
-- pszPassword : LPSTR -> CString
-- pPackedCredentials : BYTE* optional, out -> Ptr Word8
-- pcbPackedCredentials : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let credpackauthenticationbuffera =
foreign "CredPackAuthenticationBufferA"
(uint32_t @-> string @-> string @-> (ptr uint8_t) @-> (ptr uint32_t) @-> returning int32_t)
(* dwFlags : CRED_PACK_FLAGS -> uint32_t *)
(* pszUserName : LPSTR -> string *)
(* pszPassword : LPSTR -> string *)
(* pPackedCredentials : BYTE* optional, out -> (ptr uint8_t) *)
(* pcbPackedCredentials : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library credui (t "credui.dll"))
(cffi:use-foreign-library credui)
(cffi:defcfun ("CredPackAuthenticationBufferA" cred-pack-authentication-buffer-a :convention :stdcall) :int32
(dw-flags :uint32) ; CRED_PACK_FLAGS
(psz-user-name :string) ; LPSTR
(psz-password :string) ; LPSTR
(p-packed-credentials :pointer) ; BYTE* optional, out
(pcb-packed-credentials :pointer)) ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CredPackAuthenticationBufferA = Win32::API::More->new('credui',
'BOOL CredPackAuthenticationBufferA(DWORD dwFlags, LPCSTR pszUserName, LPCSTR pszPassword, LPVOID pPackedCredentials, LPVOID pcbPackedCredentials)');
# my $ret = $CredPackAuthenticationBufferA->Call($dwFlags, $pszUserName, $pszPassword, $pPackedCredentials, $pcbPackedCredentials);
# dwFlags : CRED_PACK_FLAGS -> DWORD
# pszUserName : LPSTR -> LPCSTR
# pszPassword : LPSTR -> LPCSTR
# pPackedCredentials : BYTE* optional, out -> LPVOID
# pcbPackedCredentials : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f CredPackAuthenticationBufferW (Unicode版) — ユーザー名とパスワードを認証バッファにパックする。