ホーム › Management.MobileDeviceManagementRegistration › SetManagedExternally
SetManagedExternally
関数デバイスが外部から管理される状態かどうかを設定する。
シグネチャ
// MDMRegistration.dll
#include <windows.h>
HRESULT SetManagedExternally(
BOOL IsManagedExternally
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| IsManagedExternally | BOOL | in | 外部管理状態に設定するか否かを指定するBOOL値。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// MDMRegistration.dll
#include <windows.h>
HRESULT SetManagedExternally(
BOOL IsManagedExternally
);[DllImport("MDMRegistration.dll", ExactSpelling = true)]
static extern int SetManagedExternally(
bool IsManagedExternally // BOOL
);<DllImport("MDMRegistration.dll", ExactSpelling:=True)>
Public Shared Function SetManagedExternally(
IsManagedExternally As Boolean ' BOOL
) As Integer
End Function' IsManagedExternally : BOOL
Declare PtrSafe Function SetManagedExternally Lib "mdmregistration" ( _
ByVal IsManagedExternally As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetManagedExternally = ctypes.windll.mdmregistration.SetManagedExternally
SetManagedExternally.restype = ctypes.c_int
SetManagedExternally.argtypes = [
wintypes.BOOL, # IsManagedExternally : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MDMRegistration.dll')
SetManagedExternally = Fiddle::Function.new(
lib['SetManagedExternally'],
[
Fiddle::TYPE_INT, # IsManagedExternally : BOOL
],
Fiddle::TYPE_INT)#[link(name = "mdmregistration")]
extern "system" {
fn SetManagedExternally(
IsManagedExternally: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MDMRegistration.dll")]
public static extern int SetManagedExternally(bool IsManagedExternally);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MDMRegistration_SetManagedExternally' -Namespace Win32 -PassThru
# $api::SetManagedExternally(IsManagedExternally)#uselib "MDMRegistration.dll"
#func global SetManagedExternally "SetManagedExternally" sptr
; SetManagedExternally IsManagedExternally ; 戻り値は stat
; IsManagedExternally : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MDMRegistration.dll"
#cfunc global SetManagedExternally "SetManagedExternally" int
; res = SetManagedExternally(IsManagedExternally)
; IsManagedExternally : BOOL -> "int"; HRESULT SetManagedExternally(BOOL IsManagedExternally)
#uselib "MDMRegistration.dll"
#cfunc global SetManagedExternally "SetManagedExternally" int
; res = SetManagedExternally(IsManagedExternally)
; IsManagedExternally : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mdmregistration = windows.NewLazySystemDLL("MDMRegistration.dll")
procSetManagedExternally = mdmregistration.NewProc("SetManagedExternally")
)
// IsManagedExternally (BOOL)
r1, _, err := procSetManagedExternally.Call(
uintptr(IsManagedExternally),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SetManagedExternally(
IsManagedExternally: BOOL // BOOL
): Integer; stdcall;
external 'MDMRegistration.dll' name 'SetManagedExternally';result := DllCall("MDMRegistration\SetManagedExternally"
, "Int", IsManagedExternally ; BOOL
, "Int") ; return: HRESULT●SetManagedExternally(IsManagedExternally) = DLL("MDMRegistration.dll", "int SetManagedExternally(bool)")
# 呼び出し: SetManagedExternally(IsManagedExternally)
# IsManagedExternally : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mdmregistration" fn SetManagedExternally(
IsManagedExternally: i32 // BOOL
) callconv(std.os.windows.WINAPI) i32;proc SetManagedExternally(
IsManagedExternally: int32 # BOOL
): int32 {.importc: "SetManagedExternally", stdcall, dynlib: "MDMRegistration.dll".}pragma(lib, "mdmregistration");
extern(Windows)
int SetManagedExternally(
int IsManagedExternally // BOOL
);ccall((:SetManagedExternally, "MDMRegistration.dll"), stdcall, Int32,
(Int32,),
IsManagedExternally)
# IsManagedExternally : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetManagedExternally(
int32_t IsManagedExternally);
]]
local mdmregistration = ffi.load("mdmregistration")
-- mdmregistration.SetManagedExternally(IsManagedExternally)
-- IsManagedExternally : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MDMRegistration.dll');
const SetManagedExternally = lib.func('__stdcall', 'SetManagedExternally', 'int32_t', ['int32_t']);
// SetManagedExternally(IsManagedExternally)
// IsManagedExternally : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MDMRegistration.dll", {
SetManagedExternally: { parameters: ["i32"], result: "i32" },
});
// lib.symbols.SetManagedExternally(IsManagedExternally)
// IsManagedExternally : BOOL -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetManagedExternally(
int32_t IsManagedExternally);
C, "MDMRegistration.dll");
// $ffi->SetManagedExternally(IsManagedExternally);
// IsManagedExternally : BOOL
// 構造体/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 Mdmregistration extends StdCallLibrary {
Mdmregistration INSTANCE = Native.load("mdmregistration", Mdmregistration.class);
int SetManagedExternally(
boolean IsManagedExternally // BOOL
);
}@[Link("mdmregistration")]
lib LibMDMRegistration
fun SetManagedExternally = SetManagedExternally(
IsManagedExternally : Int32 # BOOL
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetManagedExternallyNative = Int32 Function(Int32);
typedef SetManagedExternallyDart = int Function(int);
final SetManagedExternally = DynamicLibrary.open('MDMRegistration.dll')
.lookupFunction<SetManagedExternallyNative, SetManagedExternallyDart>('SetManagedExternally');
// IsManagedExternally : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetManagedExternally(
IsManagedExternally: BOOL // BOOL
): Integer; stdcall;
external 'MDMRegistration.dll' name 'SetManagedExternally';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetManagedExternally"
c_SetManagedExternally :: CInt -> IO Int32
-- IsManagedExternally : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setmanagedexternally =
foreign "SetManagedExternally"
(int32_t @-> returning int32_t)
(* IsManagedExternally : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mdmregistration (t "MDMRegistration.dll"))
(cffi:use-foreign-library mdmregistration)
(cffi:defcfun ("SetManagedExternally" set-managed-externally :convention :stdcall) :int32
(is-managed-externally :int32)) ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetManagedExternally = Win32::API::More->new('MDMRegistration',
'int SetManagedExternally(BOOL IsManagedExternally)');
# my $ret = $SetManagedExternally->Call($IsManagedExternally);
# IsManagedExternally : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。