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

WldpSetDynamicCodeTrust

関数
指定ファイルを動的コードとして信頼するよう設定する。
DLLWldp.dll呼出規約winapi

シグネチャ

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

HRESULT WldpSetDynamicCodeTrust(
    HANDLE fileHandle
);

パラメーター

名前方向
fileHandleHANDLEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WldpSetDynamicCodeTrust = ctypes.windll.wldp.WldpSetDynamicCodeTrust
WldpSetDynamicCodeTrust.restype = ctypes.c_int
WldpSetDynamicCodeTrust.argtypes = [
    wintypes.HANDLE,  # fileHandle : HANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldp = windows.NewLazySystemDLL("Wldp.dll")
	procWldpSetDynamicCodeTrust = wldp.NewProc("WldpSetDynamicCodeTrust")
)

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