ホーム › System.WindowsProgramming › WldpCanExecuteStream
WldpCanExecuteStream
関数ストリームの内容が実行許可されるかを評価する。
シグネチャ
// Wldp.dll
#include <windows.h>
HRESULT WldpCanExecuteStream(
const GUID* host,
WLDP_EXECUTION_EVALUATION_OPTIONS options,
IStream* stream,
LPCWSTR auditInfo, // optional
WLDP_EXECUTION_POLICY* result
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| host | GUID* | in |
| options | WLDP_EXECUTION_EVALUATION_OPTIONS | in |
| stream | IStream* | in |
| auditInfo | LPCWSTR | inoptional |
| result | WLDP_EXECUTION_POLICY* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// Wldp.dll
#include <windows.h>
HRESULT WldpCanExecuteStream(
const GUID* host,
WLDP_EXECUTION_EVALUATION_OPTIONS options,
IStream* stream,
LPCWSTR auditInfo, // optional
WLDP_EXECUTION_POLICY* result
);[DllImport("Wldp.dll", ExactSpelling = true)]
static extern int WldpCanExecuteStream(
ref Guid host, // GUID*
int options, // WLDP_EXECUTION_EVALUATION_OPTIONS
IntPtr stream, // IStream*
[MarshalAs(UnmanagedType.LPWStr)] string auditInfo, // LPCWSTR optional
out int result // WLDP_EXECUTION_POLICY* out
);<DllImport("Wldp.dll", ExactSpelling:=True)>
Public Shared Function WldpCanExecuteStream(
ByRef host As Guid, ' GUID*
options As Integer, ' WLDP_EXECUTION_EVALUATION_OPTIONS
stream As IntPtr, ' IStream*
<MarshalAs(UnmanagedType.LPWStr)> auditInfo As String, ' LPCWSTR optional
<Out> ByRef result As Integer ' WLDP_EXECUTION_POLICY* out
) As Integer
End Function' host : GUID*
' options : WLDP_EXECUTION_EVALUATION_OPTIONS
' stream : IStream*
' auditInfo : LPCWSTR optional
' result : WLDP_EXECUTION_POLICY* out
Declare PtrSafe Function WldpCanExecuteStream Lib "wldp" ( _
ByVal host As LongPtr, _
ByVal options As Long, _
ByVal stream As LongPtr, _
ByVal auditInfo As LongPtr, _
ByRef result As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WldpCanExecuteStream = ctypes.windll.wldp.WldpCanExecuteStream
WldpCanExecuteStream.restype = ctypes.c_int
WldpCanExecuteStream.argtypes = [
ctypes.c_void_p, # host : GUID*
ctypes.c_int, # options : WLDP_EXECUTION_EVALUATION_OPTIONS
ctypes.c_void_p, # stream : IStream*
wintypes.LPCWSTR, # auditInfo : LPCWSTR optional
ctypes.c_void_p, # result : WLDP_EXECUTION_POLICY* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('Wldp.dll')
WldpCanExecuteStream = Fiddle::Function.new(
lib['WldpCanExecuteStream'],
[
Fiddle::TYPE_VOIDP, # host : GUID*
Fiddle::TYPE_INT, # options : WLDP_EXECUTION_EVALUATION_OPTIONS
Fiddle::TYPE_VOIDP, # stream : IStream*
Fiddle::TYPE_VOIDP, # auditInfo : LPCWSTR optional
Fiddle::TYPE_VOIDP, # result : WLDP_EXECUTION_POLICY* out
],
Fiddle::TYPE_INT)#[link(name = "wldp")]
extern "system" {
fn WldpCanExecuteStream(
host: *const GUID, // GUID*
options: i32, // WLDP_EXECUTION_EVALUATION_OPTIONS
stream: *mut core::ffi::c_void, // IStream*
auditInfo: *const u16, // LPCWSTR optional
result: *mut i32 // WLDP_EXECUTION_POLICY* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("Wldp.dll")]
public static extern int WldpCanExecuteStream(ref Guid host, int options, IntPtr stream, [MarshalAs(UnmanagedType.LPWStr)] string auditInfo, out int result);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Wldp_WldpCanExecuteStream' -Namespace Win32 -PassThru
# $api::WldpCanExecuteStream(host, options, stream, auditInfo, result)#uselib "Wldp.dll"
#func global WldpCanExecuteStream "WldpCanExecuteStream" sptr, sptr, sptr, sptr, sptr
; WldpCanExecuteStream varptr(host), options, stream, auditInfo, result ; 戻り値は stat
; host : GUID* -> "sptr"
; options : WLDP_EXECUTION_EVALUATION_OPTIONS -> "sptr"
; stream : IStream* -> "sptr"
; auditInfo : LPCWSTR optional -> "sptr"
; result : WLDP_EXECUTION_POLICY* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "Wldp.dll" #cfunc global WldpCanExecuteStream "WldpCanExecuteStream" var, int, sptr, wstr, int ; res = WldpCanExecuteStream(host, options, stream, auditInfo, result) ; host : GUID* -> "var" ; options : WLDP_EXECUTION_EVALUATION_OPTIONS -> "int" ; stream : IStream* -> "sptr" ; auditInfo : LPCWSTR optional -> "wstr" ; result : WLDP_EXECUTION_POLICY* out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "Wldp.dll" #cfunc global WldpCanExecuteStream "WldpCanExecuteStream" sptr, int, sptr, wstr, int ; res = WldpCanExecuteStream(varptr(host), options, stream, auditInfo, result) ; host : GUID* -> "sptr" ; options : WLDP_EXECUTION_EVALUATION_OPTIONS -> "int" ; stream : IStream* -> "sptr" ; auditInfo : LPCWSTR optional -> "wstr" ; result : WLDP_EXECUTION_POLICY* out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WldpCanExecuteStream(GUID* host, WLDP_EXECUTION_EVALUATION_OPTIONS options, IStream* stream, LPCWSTR auditInfo, WLDP_EXECUTION_POLICY* result) #uselib "Wldp.dll" #cfunc global WldpCanExecuteStream "WldpCanExecuteStream" var, int, intptr, wstr, int ; res = WldpCanExecuteStream(host, options, stream, auditInfo, result) ; host : GUID* -> "var" ; options : WLDP_EXECUTION_EVALUATION_OPTIONS -> "int" ; stream : IStream* -> "intptr" ; auditInfo : LPCWSTR optional -> "wstr" ; result : WLDP_EXECUTION_POLICY* out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WldpCanExecuteStream(GUID* host, WLDP_EXECUTION_EVALUATION_OPTIONS options, IStream* stream, LPCWSTR auditInfo, WLDP_EXECUTION_POLICY* result) #uselib "Wldp.dll" #cfunc global WldpCanExecuteStream "WldpCanExecuteStream" intptr, int, intptr, wstr, int ; res = WldpCanExecuteStream(varptr(host), options, stream, auditInfo, result) ; host : GUID* -> "intptr" ; options : WLDP_EXECUTION_EVALUATION_OPTIONS -> "int" ; stream : IStream* -> "intptr" ; auditInfo : LPCWSTR optional -> "wstr" ; result : WLDP_EXECUTION_POLICY* out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldp = windows.NewLazySystemDLL("Wldp.dll")
procWldpCanExecuteStream = wldp.NewProc("WldpCanExecuteStream")
)
// host (GUID*), options (WLDP_EXECUTION_EVALUATION_OPTIONS), stream (IStream*), auditInfo (LPCWSTR optional), result (WLDP_EXECUTION_POLICY* out)
r1, _, err := procWldpCanExecuteStream.Call(
uintptr(host),
uintptr(options),
uintptr(stream),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(auditInfo))),
uintptr(result),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WldpCanExecuteStream(
host: PGUID; // GUID*
options: Integer; // WLDP_EXECUTION_EVALUATION_OPTIONS
stream: Pointer; // IStream*
auditInfo: PWideChar; // LPCWSTR optional
result: Pointer // WLDP_EXECUTION_POLICY* out
): Integer; stdcall;
external 'Wldp.dll' name 'WldpCanExecuteStream';result := DllCall("Wldp\WldpCanExecuteStream"
, "Ptr", host ; GUID*
, "Int", options ; WLDP_EXECUTION_EVALUATION_OPTIONS
, "Ptr", stream ; IStream*
, "WStr", auditInfo ; LPCWSTR optional
, "Ptr", result ; WLDP_EXECUTION_POLICY* out
, "Int") ; return: HRESULT●WldpCanExecuteStream(host, options, stream, auditInfo, result) = DLL("Wldp.dll", "int WldpCanExecuteStream(void*, int, void*, char*, void*)")
# 呼び出し: WldpCanExecuteStream(host, options, stream, auditInfo, result)
# host : GUID* -> "void*"
# options : WLDP_EXECUTION_EVALUATION_OPTIONS -> "int"
# stream : IStream* -> "void*"
# auditInfo : LPCWSTR optional -> "char*"
# result : WLDP_EXECUTION_POLICY* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。