Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › WldpQueryDynamicCodeTrust

WldpQueryDynamicCodeTrust

関数
指定イメージの動的コード信頼状態を問い合わせる。
DLLWldp.dll呼出規約winapi

シグネチャ

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

HRESULT WldpQueryDynamicCodeTrust(
    HANDLE fileHandle,   // optional
    void* baseImage,   // optional
    DWORD imageSize
);

パラメーター

名前方向
fileHandleHANDLEinoptional
baseImagevoid*inoptional
imageSizeDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WldpQueryDynamicCodeTrust(
    HANDLE fileHandle,   // optional
    void* baseImage,   // optional
    DWORD imageSize
);
[DllImport("Wldp.dll", ExactSpelling = true)]
static extern int WldpQueryDynamicCodeTrust(
    IntPtr fileHandle,   // HANDLE optional
    IntPtr baseImage,   // void* optional
    uint imageSize   // DWORD
);
<DllImport("Wldp.dll", ExactSpelling:=True)>
Public Shared Function WldpQueryDynamicCodeTrust(
    fileHandle As IntPtr,   ' HANDLE optional
    baseImage As IntPtr,   ' void* optional
    imageSize As UInteger   ' DWORD
) As Integer
End Function
' fileHandle : HANDLE optional
' baseImage : void* optional
' imageSize : DWORD
Declare PtrSafe Function WldpQueryDynamicCodeTrust Lib "wldp" ( _
    ByVal fileHandle As LongPtr, _
    ByVal baseImage As LongPtr, _
    ByVal imageSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WldpQueryDynamicCodeTrust = ctypes.windll.wldp.WldpQueryDynamicCodeTrust
WldpQueryDynamicCodeTrust.restype = ctypes.c_int
WldpQueryDynamicCodeTrust.argtypes = [
    wintypes.HANDLE,  # fileHandle : HANDLE optional
    ctypes.POINTER(None),  # baseImage : void* optional
    wintypes.DWORD,  # imageSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Wldp.dll')
WldpQueryDynamicCodeTrust = Fiddle::Function.new(
  lib['WldpQueryDynamicCodeTrust'],
  [
    Fiddle::TYPE_VOIDP,  # fileHandle : HANDLE optional
    Fiddle::TYPE_VOIDP,  # baseImage : void* optional
    -Fiddle::TYPE_INT,  # imageSize : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "wldp")]
extern "system" {
    fn WldpQueryDynamicCodeTrust(
        fileHandle: *mut core::ffi::c_void,  // HANDLE optional
        baseImage: *mut (),  // void* optional
        imageSize: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("Wldp.dll")]
public static extern int WldpQueryDynamicCodeTrust(IntPtr fileHandle, IntPtr baseImage, uint imageSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Wldp_WldpQueryDynamicCodeTrust' -Namespace Win32 -PassThru
# $api::WldpQueryDynamicCodeTrust(fileHandle, baseImage, imageSize)
#uselib "Wldp.dll"
#func global WldpQueryDynamicCodeTrust "WldpQueryDynamicCodeTrust" sptr, sptr, sptr
; WldpQueryDynamicCodeTrust fileHandle, baseImage, imageSize   ; 戻り値は stat
; fileHandle : HANDLE optional -> "sptr"
; baseImage : void* optional -> "sptr"
; imageSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Wldp.dll"
#cfunc global WldpQueryDynamicCodeTrust "WldpQueryDynamicCodeTrust" sptr, sptr, int
; res = WldpQueryDynamicCodeTrust(fileHandle, baseImage, imageSize)
; fileHandle : HANDLE optional -> "sptr"
; baseImage : void* optional -> "sptr"
; imageSize : DWORD -> "int"
; HRESULT WldpQueryDynamicCodeTrust(HANDLE fileHandle, void* baseImage, DWORD imageSize)
#uselib "Wldp.dll"
#cfunc global WldpQueryDynamicCodeTrust "WldpQueryDynamicCodeTrust" intptr, intptr, int
; res = WldpQueryDynamicCodeTrust(fileHandle, baseImage, imageSize)
; fileHandle : HANDLE optional -> "intptr"
; baseImage : void* optional -> "intptr"
; imageSize : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wldp = windows.NewLazySystemDLL("Wldp.dll")
	procWldpQueryDynamicCodeTrust = wldp.NewProc("WldpQueryDynamicCodeTrust")
)

// fileHandle (HANDLE optional), baseImage (void* optional), imageSize (DWORD)
r1, _, err := procWldpQueryDynamicCodeTrust.Call(
	uintptr(fileHandle),
	uintptr(baseImage),
	uintptr(imageSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WldpQueryDynamicCodeTrust(
  fileHandle: THandle;   // HANDLE optional
  baseImage: Pointer;   // void* optional
  imageSize: DWORD   // DWORD
): Integer; stdcall;
  external 'Wldp.dll' name 'WldpQueryDynamicCodeTrust';
result := DllCall("Wldp\WldpQueryDynamicCodeTrust"
    , "Ptr", fileHandle   ; HANDLE optional
    , "Ptr", baseImage   ; void* optional
    , "UInt", imageSize   ; DWORD
    , "Int")   ; return: HRESULT
●WldpQueryDynamicCodeTrust(fileHandle, baseImage, imageSize) = DLL("Wldp.dll", "int WldpQueryDynamicCodeTrust(void*, void*, dword)")
# 呼び出し: WldpQueryDynamicCodeTrust(fileHandle, baseImage, imageSize)
# fileHandle : HANDLE optional -> "void*"
# baseImage : void* optional -> "void*"
# imageSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。