ホーム › System.WindowsProgramming › WldpIsDynamicCodePolicyEnabled
WldpIsDynamicCodePolicyEnabled
関数動的コードポリシーが有効かを判定する。
シグネチャ
// Wldp.dll
#include <windows.h>
HRESULT WldpIsDynamicCodePolicyEnabled(
BOOL* isEnabled
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| isEnabled | BOOL* | out | 出力として動的コードポリシーが有効か(TRUE/FALSE)を受け取るBOOLポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// Wldp.dll
#include <windows.h>
HRESULT WldpIsDynamicCodePolicyEnabled(
BOOL* isEnabled
);[DllImport("Wldp.dll", ExactSpelling = true)]
static extern int WldpIsDynamicCodePolicyEnabled(
out bool isEnabled // BOOL* out
);<DllImport("Wldp.dll", ExactSpelling:=True)>
Public Shared Function WldpIsDynamicCodePolicyEnabled(
<Out> ByRef isEnabled As Boolean ' BOOL* out
) As Integer
End Function' isEnabled : BOOL* out
Declare PtrSafe Function WldpIsDynamicCodePolicyEnabled Lib "wldp" ( _
ByRef isEnabled As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WldpIsDynamicCodePolicyEnabled = ctypes.windll.wldp.WldpIsDynamicCodePolicyEnabled
WldpIsDynamicCodePolicyEnabled.restype = ctypes.c_int
WldpIsDynamicCodePolicyEnabled.argtypes = [
ctypes.c_void_p, # isEnabled : BOOL* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('Wldp.dll')
WldpIsDynamicCodePolicyEnabled = Fiddle::Function.new(
lib['WldpIsDynamicCodePolicyEnabled'],
[
Fiddle::TYPE_VOIDP, # isEnabled : BOOL* out
],
Fiddle::TYPE_INT)#[link(name = "wldp")]
extern "system" {
fn WldpIsDynamicCodePolicyEnabled(
isEnabled: *mut i32 // BOOL* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("Wldp.dll")]
public static extern int WldpIsDynamicCodePolicyEnabled(out bool isEnabled);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Wldp_WldpIsDynamicCodePolicyEnabled' -Namespace Win32 -PassThru
# $api::WldpIsDynamicCodePolicyEnabled(isEnabled)#uselib "Wldp.dll"
#func global WldpIsDynamicCodePolicyEnabled "WldpIsDynamicCodePolicyEnabled" sptr
; WldpIsDynamicCodePolicyEnabled varptr(isEnabled) ; 戻り値は stat
; isEnabled : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "Wldp.dll" #cfunc global WldpIsDynamicCodePolicyEnabled "WldpIsDynamicCodePolicyEnabled" var ; res = WldpIsDynamicCodePolicyEnabled(isEnabled) ; isEnabled : BOOL* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "Wldp.dll" #cfunc global WldpIsDynamicCodePolicyEnabled "WldpIsDynamicCodePolicyEnabled" sptr ; res = WldpIsDynamicCodePolicyEnabled(varptr(isEnabled)) ; isEnabled : BOOL* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WldpIsDynamicCodePolicyEnabled(BOOL* isEnabled) #uselib "Wldp.dll" #cfunc global WldpIsDynamicCodePolicyEnabled "WldpIsDynamicCodePolicyEnabled" var ; res = WldpIsDynamicCodePolicyEnabled(isEnabled) ; isEnabled : BOOL* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WldpIsDynamicCodePolicyEnabled(BOOL* isEnabled) #uselib "Wldp.dll" #cfunc global WldpIsDynamicCodePolicyEnabled "WldpIsDynamicCodePolicyEnabled" intptr ; res = WldpIsDynamicCodePolicyEnabled(varptr(isEnabled)) ; isEnabled : BOOL* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldp = windows.NewLazySystemDLL("Wldp.dll")
procWldpIsDynamicCodePolicyEnabled = wldp.NewProc("WldpIsDynamicCodePolicyEnabled")
)
// isEnabled (BOOL* out)
r1, _, err := procWldpIsDynamicCodePolicyEnabled.Call(
uintptr(isEnabled),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WldpIsDynamicCodePolicyEnabled(
isEnabled: Pointer // BOOL* out
): Integer; stdcall;
external 'Wldp.dll' name 'WldpIsDynamicCodePolicyEnabled';result := DllCall("Wldp\WldpIsDynamicCodePolicyEnabled"
, "Ptr", isEnabled ; BOOL* out
, "Int") ; return: HRESULT●WldpIsDynamicCodePolicyEnabled(isEnabled) = DLL("Wldp.dll", "int WldpIsDynamicCodePolicyEnabled(void*)")
# 呼び出し: WldpIsDynamicCodePolicyEnabled(isEnabled)
# isEnabled : BOOL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wldp" fn WldpIsDynamicCodePolicyEnabled(
isEnabled: [*c]i32 // BOOL* out
) callconv(std.os.windows.WINAPI) i32;proc WldpIsDynamicCodePolicyEnabled(
isEnabled: ptr int32 # BOOL* out
): int32 {.importc: "WldpIsDynamicCodePolicyEnabled", stdcall, dynlib: "Wldp.dll".}pragma(lib, "wldp");
extern(Windows)
int WldpIsDynamicCodePolicyEnabled(
int* isEnabled // BOOL* out
);ccall((:WldpIsDynamicCodePolicyEnabled, "Wldp.dll"), stdcall, Int32,
(Ptr{Int32},),
isEnabled)
# isEnabled : BOOL* out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WldpIsDynamicCodePolicyEnabled(
int32_t* isEnabled);
]]
local wldp = ffi.load("wldp")
-- wldp.WldpIsDynamicCodePolicyEnabled(isEnabled)
-- isEnabled : BOOL* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('Wldp.dll');
const WldpIsDynamicCodePolicyEnabled = lib.func('__stdcall', 'WldpIsDynamicCodePolicyEnabled', 'int32_t', ['int32_t *']);
// WldpIsDynamicCodePolicyEnabled(isEnabled)
// isEnabled : BOOL* out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("Wldp.dll", {
WldpIsDynamicCodePolicyEnabled: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.WldpIsDynamicCodePolicyEnabled(isEnabled)
// isEnabled : BOOL* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WldpIsDynamicCodePolicyEnabled(
int32_t* isEnabled);
C, "Wldp.dll");
// $ffi->WldpIsDynamicCodePolicyEnabled(isEnabled);
// isEnabled : BOOL* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Wldp extends StdCallLibrary {
Wldp INSTANCE = Native.load("wldp", Wldp.class);
int WldpIsDynamicCodePolicyEnabled(
IntByReference isEnabled // BOOL* out
);
}@[Link("wldp")]
lib LibWldp
fun WldpIsDynamicCodePolicyEnabled = WldpIsDynamicCodePolicyEnabled(
isEnabled : Int32* # BOOL* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WldpIsDynamicCodePolicyEnabledNative = Int32 Function(Pointer<Int32>);
typedef WldpIsDynamicCodePolicyEnabledDart = int Function(Pointer<Int32>);
final WldpIsDynamicCodePolicyEnabled = DynamicLibrary.open('Wldp.dll')
.lookupFunction<WldpIsDynamicCodePolicyEnabledNative, WldpIsDynamicCodePolicyEnabledDart>('WldpIsDynamicCodePolicyEnabled');
// isEnabled : BOOL* out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WldpIsDynamicCodePolicyEnabled(
isEnabled: Pointer // BOOL* out
): Integer; stdcall;
external 'Wldp.dll' name 'WldpIsDynamicCodePolicyEnabled';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WldpIsDynamicCodePolicyEnabled"
c_WldpIsDynamicCodePolicyEnabled :: Ptr CInt -> IO Int32
-- isEnabled : BOOL* out -> Ptr CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wldpisdynamiccodepolicyenabled =
foreign "WldpIsDynamicCodePolicyEnabled"
((ptr int32_t) @-> returning int32_t)
(* isEnabled : BOOL* out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wldp (t "Wldp.dll"))
(cffi:use-foreign-library wldp)
(cffi:defcfun ("WldpIsDynamicCodePolicyEnabled" wldp-is-dynamic-code-policy-enabled :convention :stdcall) :int32
(is-enabled :pointer)) ; BOOL* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WldpIsDynamicCodePolicyEnabled = Win32::API::More->new('Wldp',
'int WldpIsDynamicCodePolicyEnabled(LPVOID isEnabled)');
# my $ret = $WldpIsDynamicCodePolicyEnabled->Call($isEnabled);
# isEnabled : BOOL* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。