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

WldpSetWindowsLockdownRestriction

関数
Windowsロックダウン制限の設定を行う。
DLLWldp.dll呼出規約winapi

シグネチャ

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

HRESULT WldpSetWindowsLockdownRestriction(
    WLDP_WINDOWS_LOCKDOWN_RESTRICTION LockdownRestriction
);

パラメーター

名前方向説明
LockdownRestrictionWLDP_WINDOWS_LOCKDOWN_RESTRICTIONin設定するロックダウン制限を示すWLDP_WINDOWS_LOCKDOWN_RESTRICTION値。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WldpSetWindowsLockdownRestriction = ctypes.windll.wldp.WldpSetWindowsLockdownRestriction
WldpSetWindowsLockdownRestriction.restype = ctypes.c_int
WldpSetWindowsLockdownRestriction.argtypes = [
    ctypes.c_int,  # LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldp = windows.NewLazySystemDLL("Wldp.dll")
	procWldpSetWindowsLockdownRestriction = wldp.NewProc("WldpSetWindowsLockdownRestriction")
)

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

extern "wldp" fn WldpSetWindowsLockdownRestriction(
    LockdownRestriction: i32 // WLDP_WINDOWS_LOCKDOWN_RESTRICTION
) callconv(std.os.windows.WINAPI) i32;
proc WldpSetWindowsLockdownRestriction(
    LockdownRestriction: int32  # WLDP_WINDOWS_LOCKDOWN_RESTRICTION
): int32 {.importc: "WldpSetWindowsLockdownRestriction", stdcall, dynlib: "Wldp.dll".}
pragma(lib, "wldp");
extern(Windows)
int WldpSetWindowsLockdownRestriction(
    int LockdownRestriction   // WLDP_WINDOWS_LOCKDOWN_RESTRICTION
);
ccall((:WldpSetWindowsLockdownRestriction, "Wldp.dll"), stdcall, Int32,
      (Int32,),
      LockdownRestriction)
# LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WldpSetWindowsLockdownRestriction(
    int32_t LockdownRestriction);
]]
local wldp = ffi.load("wldp")
-- wldp.WldpSetWindowsLockdownRestriction(LockdownRestriction)
-- LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('Wldp.dll');
const WldpSetWindowsLockdownRestriction = lib.func('__stdcall', 'WldpSetWindowsLockdownRestriction', 'int32_t', ['int32_t']);
// WldpSetWindowsLockdownRestriction(LockdownRestriction)
// LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("Wldp.dll", {
  WldpSetWindowsLockdownRestriction: { parameters: ["i32"], result: "i32" },
});
// lib.symbols.WldpSetWindowsLockdownRestriction(LockdownRestriction)
// LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WldpSetWindowsLockdownRestriction(
    int32_t LockdownRestriction);
C, "Wldp.dll");
// $ffi->WldpSetWindowsLockdownRestriction(LockdownRestriction);
// LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION
// 構造体/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 WldpSetWindowsLockdownRestriction(
        int LockdownRestriction   // WLDP_WINDOWS_LOCKDOWN_RESTRICTION
    );
}
@[Link("wldp")]
lib LibWldp
  fun WldpSetWindowsLockdownRestriction = WldpSetWindowsLockdownRestriction(
    LockdownRestriction : Int32   # WLDP_WINDOWS_LOCKDOWN_RESTRICTION
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WldpSetWindowsLockdownRestrictionNative = Int32 Function(Int32);
typedef WldpSetWindowsLockdownRestrictionDart = int Function(int);
final WldpSetWindowsLockdownRestriction = DynamicLibrary.open('Wldp.dll')
    .lookupFunction<WldpSetWindowsLockdownRestrictionNative, WldpSetWindowsLockdownRestrictionDart>('WldpSetWindowsLockdownRestriction');
// LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WldpSetWindowsLockdownRestriction(
  LockdownRestriction: Integer   // WLDP_WINDOWS_LOCKDOWN_RESTRICTION
): Integer; stdcall;
  external 'Wldp.dll' name 'WldpSetWindowsLockdownRestriction';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WldpSetWindowsLockdownRestriction"
  c_WldpSetWindowsLockdownRestriction :: Int32 -> IO Int32
-- LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wldpsetwindowslockdownrestriction =
  foreign "WldpSetWindowsLockdownRestriction"
    (int32_t @-> returning int32_t)
(* LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wldp (t "Wldp.dll"))
(cffi:use-foreign-library wldp)

(cffi:defcfun ("WldpSetWindowsLockdownRestriction" wldp-set-windows-lockdown-restriction :convention :stdcall) :int32
  (lockdown-restriction :int32))   ; WLDP_WINDOWS_LOCKDOWN_RESTRICTION
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WldpSetWindowsLockdownRestriction = Win32::API::More->new('Wldp',
    'int WldpSetWindowsLockdownRestriction(int LockdownRestriction)');
# my $ret = $WldpSetWindowsLockdownRestriction->Call($LockdownRestriction);
# LockdownRestriction : WLDP_WINDOWS_LOCKDOWN_RESTRICTION -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型