Win32 API 日本語リファレンス
ホームManagement.MobileDeviceManagementRegistration › UnregisterDeviceWithManagement

UnregisterDeviceWithManagement

関数
登録IDを指定してデバイスのMDM登録を解除する。
DLLMDMRegistration.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

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

HRESULT UnregisterDeviceWithManagement(
    LPCWSTR enrollmentID   // optional
);

パラメーター

名前方向
enrollmentIDLPCWSTRinoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT UnregisterDeviceWithManagement(
    LPCWSTR enrollmentID   // optional
);
[DllImport("MDMRegistration.dll", ExactSpelling = true)]
static extern int UnregisterDeviceWithManagement(
    [MarshalAs(UnmanagedType.LPWStr)] string enrollmentID   // LPCWSTR optional
);
<DllImport("MDMRegistration.dll", ExactSpelling:=True)>
Public Shared Function UnregisterDeviceWithManagement(
    <MarshalAs(UnmanagedType.LPWStr)> enrollmentID As String   ' LPCWSTR optional
) As Integer
End Function
' enrollmentID : LPCWSTR optional
Declare PtrSafe Function UnregisterDeviceWithManagement Lib "mdmregistration" ( _
    ByVal enrollmentID As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UnregisterDeviceWithManagement = ctypes.windll.mdmregistration.UnregisterDeviceWithManagement
UnregisterDeviceWithManagement.restype = ctypes.c_int
UnregisterDeviceWithManagement.argtypes = [
    wintypes.LPCWSTR,  # enrollmentID : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mdmregistration = windows.NewLazySystemDLL("MDMRegistration.dll")
	procUnregisterDeviceWithManagement = mdmregistration.NewProc("UnregisterDeviceWithManagement")
)

// enrollmentID (LPCWSTR optional)
r1, _, err := procUnregisterDeviceWithManagement.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(enrollmentID))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function UnregisterDeviceWithManagement(
  enrollmentID: PWideChar   // LPCWSTR optional
): Integer; stdcall;
  external 'MDMRegistration.dll' name 'UnregisterDeviceWithManagement';
result := DllCall("MDMRegistration\UnregisterDeviceWithManagement"
    , "WStr", enrollmentID   ; LPCWSTR optional
    , "Int")   ; return: HRESULT
●UnregisterDeviceWithManagement(enrollmentID) = DLL("MDMRegistration.dll", "int UnregisterDeviceWithManagement(char*)")
# 呼び出し: UnregisterDeviceWithManagement(enrollmentID)
# enrollmentID : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。