ホーム › Security.Authentication.Identity › QuerySecurityPackageInfoW
QuerySecurityPackageInfoW
関数名前を指定してセキュリティパッケージの情報を取得する(Unicode版)。
シグネチャ
// SECUR32.dll (Unicode / -W)
#include <windows.h>
HRESULT QuerySecurityPackageInfoW(
LPWSTR pszPackageName,
SecPkgInfoW** ppPackageInfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPackageName | LPWSTR | in |
| ppPackageInfo | SecPkgInfoW** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// SECUR32.dll (Unicode / -W)
#include <windows.h>
HRESULT QuerySecurityPackageInfoW(
LPWSTR pszPackageName,
SecPkgInfoW** ppPackageInfo
);[DllImport("SECUR32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int QuerySecurityPackageInfoW(
[MarshalAs(UnmanagedType.LPWStr)] string pszPackageName, // LPWSTR
IntPtr ppPackageInfo // SecPkgInfoW** out
);<DllImport("SECUR32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function QuerySecurityPackageInfoW(
<MarshalAs(UnmanagedType.LPWStr)> pszPackageName As String, ' LPWSTR
ppPackageInfo As IntPtr ' SecPkgInfoW** out
) As Integer
End Function' pszPackageName : LPWSTR
' ppPackageInfo : SecPkgInfoW** out
Declare PtrSafe Function QuerySecurityPackageInfoW Lib "secur32" ( _
ByVal pszPackageName As LongPtr, _
ByVal ppPackageInfo As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
QuerySecurityPackageInfoW = ctypes.windll.secur32.QuerySecurityPackageInfoW
QuerySecurityPackageInfoW.restype = ctypes.c_int
QuerySecurityPackageInfoW.argtypes = [
wintypes.LPCWSTR, # pszPackageName : LPWSTR
ctypes.c_void_p, # ppPackageInfo : SecPkgInfoW** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SECUR32.dll')
QuerySecurityPackageInfoW = Fiddle::Function.new(
lib['QuerySecurityPackageInfoW'],
[
Fiddle::TYPE_VOIDP, # pszPackageName : LPWSTR
Fiddle::TYPE_VOIDP, # ppPackageInfo : SecPkgInfoW** out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "secur32")]
extern "system" {
fn QuerySecurityPackageInfoW(
pszPackageName: *mut u16, // LPWSTR
ppPackageInfo: *mut *mut SecPkgInfoW // SecPkgInfoW** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SECUR32.dll", CharSet = CharSet.Unicode)]
public static extern int QuerySecurityPackageInfoW([MarshalAs(UnmanagedType.LPWStr)] string pszPackageName, IntPtr ppPackageInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SECUR32_QuerySecurityPackageInfoW' -Namespace Win32 -PassThru
# $api::QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo)#uselib "SECUR32.dll"
#func global QuerySecurityPackageInfoW "QuerySecurityPackageInfoW" wptr, wptr
; QuerySecurityPackageInfoW pszPackageName, varptr(ppPackageInfo) ; 戻り値は stat
; pszPackageName : LPWSTR -> "wptr"
; ppPackageInfo : SecPkgInfoW** out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SECUR32.dll" #cfunc global QuerySecurityPackageInfoW "QuerySecurityPackageInfoW" wstr, var ; res = QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo) ; pszPackageName : LPWSTR -> "wstr" ; ppPackageInfo : SecPkgInfoW** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SECUR32.dll" #cfunc global QuerySecurityPackageInfoW "QuerySecurityPackageInfoW" wstr, sptr ; res = QuerySecurityPackageInfoW(pszPackageName, varptr(ppPackageInfo)) ; pszPackageName : LPWSTR -> "wstr" ; ppPackageInfo : SecPkgInfoW** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT QuerySecurityPackageInfoW(LPWSTR pszPackageName, SecPkgInfoW** ppPackageInfo) #uselib "SECUR32.dll" #cfunc global QuerySecurityPackageInfoW "QuerySecurityPackageInfoW" wstr, var ; res = QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo) ; pszPackageName : LPWSTR -> "wstr" ; ppPackageInfo : SecPkgInfoW** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT QuerySecurityPackageInfoW(LPWSTR pszPackageName, SecPkgInfoW** ppPackageInfo) #uselib "SECUR32.dll" #cfunc global QuerySecurityPackageInfoW "QuerySecurityPackageInfoW" wstr, intptr ; res = QuerySecurityPackageInfoW(pszPackageName, varptr(ppPackageInfo)) ; pszPackageName : LPWSTR -> "wstr" ; ppPackageInfo : SecPkgInfoW** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
secur32 = windows.NewLazySystemDLL("SECUR32.dll")
procQuerySecurityPackageInfoW = secur32.NewProc("QuerySecurityPackageInfoW")
)
// pszPackageName (LPWSTR), ppPackageInfo (SecPkgInfoW** out)
r1, _, err := procQuerySecurityPackageInfoW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPackageName))),
uintptr(ppPackageInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction QuerySecurityPackageInfoW(
pszPackageName: PWideChar; // LPWSTR
ppPackageInfo: Pointer // SecPkgInfoW** out
): Integer; stdcall;
external 'SECUR32.dll' name 'QuerySecurityPackageInfoW';result := DllCall("SECUR32\QuerySecurityPackageInfoW"
, "WStr", pszPackageName ; LPWSTR
, "Ptr", ppPackageInfo ; SecPkgInfoW** out
, "Int") ; return: HRESULT●QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo) = DLL("SECUR32.dll", "int QuerySecurityPackageInfoW(char*, void*)")
# 呼び出し: QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo)
# pszPackageName : LPWSTR -> "char*"
# ppPackageInfo : SecPkgInfoW** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。