ホーム › Security.WinTrust › WinVerifyTrust
WinVerifyTrust
関数指定オブジェクトの署名と信頼性を検証する。
シグネチャ
// WINTRUST.dll
#include <windows.h>
INT WinVerifyTrust(
HWND hwnd,
GUID* pgActionID,
void* pWVTData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| pgActionID | GUID* | inout |
| pWVTData | void* | inout |
戻り値の型: INT
各言語での呼び出し定義
// WINTRUST.dll
#include <windows.h>
INT WinVerifyTrust(
HWND hwnd,
GUID* pgActionID,
void* pWVTData
);[DllImport("WINTRUST.dll", ExactSpelling = true)]
static extern int WinVerifyTrust(
IntPtr hwnd, // HWND
ref Guid pgActionID, // GUID* in/out
IntPtr pWVTData // void* in/out
);<DllImport("WINTRUST.dll", ExactSpelling:=True)>
Public Shared Function WinVerifyTrust(
hwnd As IntPtr, ' HWND
ByRef pgActionID As Guid, ' GUID* in/out
pWVTData As IntPtr ' void* in/out
) As Integer
End Function' hwnd : HWND
' pgActionID : GUID* in/out
' pWVTData : void* in/out
Declare PtrSafe Function WinVerifyTrust Lib "wintrust" ( _
ByVal hwnd As LongPtr, _
ByVal pgActionID As LongPtr, _
ByVal pWVTData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WinVerifyTrust = ctypes.windll.wintrust.WinVerifyTrust
WinVerifyTrust.restype = ctypes.c_int
WinVerifyTrust.argtypes = [
wintypes.HANDLE, # hwnd : HWND
ctypes.c_void_p, # pgActionID : GUID* in/out
ctypes.POINTER(None), # pWVTData : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINTRUST.dll')
WinVerifyTrust = Fiddle::Function.new(
lib['WinVerifyTrust'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # pgActionID : GUID* in/out
Fiddle::TYPE_VOIDP, # pWVTData : void* in/out
],
Fiddle::TYPE_INT)#[link(name = "wintrust")]
extern "system" {
fn WinVerifyTrust(
hwnd: *mut core::ffi::c_void, // HWND
pgActionID: *mut GUID, // GUID* in/out
pWVTData: *mut () // void* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINTRUST.dll")]
public static extern int WinVerifyTrust(IntPtr hwnd, ref Guid pgActionID, IntPtr pWVTData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINTRUST_WinVerifyTrust' -Namespace Win32 -PassThru
# $api::WinVerifyTrust(hwnd, pgActionID, pWVTData)#uselib "WINTRUST.dll"
#func global WinVerifyTrust "WinVerifyTrust" sptr, sptr, sptr
; WinVerifyTrust hwnd, varptr(pgActionID), pWVTData ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pgActionID : GUID* in/out -> "sptr"
; pWVTData : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINTRUST.dll" #cfunc global WinVerifyTrust "WinVerifyTrust" sptr, var, sptr ; res = WinVerifyTrust(hwnd, pgActionID, pWVTData) ; hwnd : HWND -> "sptr" ; pgActionID : GUID* in/out -> "var" ; pWVTData : void* in/out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINTRUST.dll" #cfunc global WinVerifyTrust "WinVerifyTrust" sptr, sptr, sptr ; res = WinVerifyTrust(hwnd, varptr(pgActionID), pWVTData) ; hwnd : HWND -> "sptr" ; pgActionID : GUID* in/out -> "sptr" ; pWVTData : void* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT WinVerifyTrust(HWND hwnd, GUID* pgActionID, void* pWVTData) #uselib "WINTRUST.dll" #cfunc global WinVerifyTrust "WinVerifyTrust" intptr, var, intptr ; res = WinVerifyTrust(hwnd, pgActionID, pWVTData) ; hwnd : HWND -> "intptr" ; pgActionID : GUID* in/out -> "var" ; pWVTData : void* in/out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT WinVerifyTrust(HWND hwnd, GUID* pgActionID, void* pWVTData) #uselib "WINTRUST.dll" #cfunc global WinVerifyTrust "WinVerifyTrust" intptr, intptr, intptr ; res = WinVerifyTrust(hwnd, varptr(pgActionID), pWVTData) ; hwnd : HWND -> "intptr" ; pgActionID : GUID* in/out -> "intptr" ; pWVTData : void* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wintrust = windows.NewLazySystemDLL("WINTRUST.dll")
procWinVerifyTrust = wintrust.NewProc("WinVerifyTrust")
)
// hwnd (HWND), pgActionID (GUID* in/out), pWVTData (void* in/out)
r1, _, err := procWinVerifyTrust.Call(
uintptr(hwnd),
uintptr(pgActionID),
uintptr(pWVTData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction WinVerifyTrust(
hwnd: THandle; // HWND
pgActionID: PGUID; // GUID* in/out
pWVTData: Pointer // void* in/out
): Integer; stdcall;
external 'WINTRUST.dll' name 'WinVerifyTrust';result := DllCall("WINTRUST\WinVerifyTrust"
, "Ptr", hwnd ; HWND
, "Ptr", pgActionID ; GUID* in/out
, "Ptr", pWVTData ; void* in/out
, "Int") ; return: INT●WinVerifyTrust(hwnd, pgActionID, pWVTData) = DLL("WINTRUST.dll", "int WinVerifyTrust(void*, void*, void*)")
# 呼び出し: WinVerifyTrust(hwnd, pgActionID, pWVTData)
# hwnd : HWND -> "void*"
# pgActionID : GUID* in/out -> "void*"
# pWVTData : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。