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

RegisterDeviceWithManagementUsingAADDeviceCredentials2

関数
指定MDMアプリIDとAzure ADデバイス資格情報でデバイスを登録する。
DLLMDMRegistration.dll呼出規約winapi

シグネチャ

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

HRESULT RegisterDeviceWithManagementUsingAADDeviceCredentials2(
    LPCWSTR MDMApplicationID   // optional
);

パラメーター

名前方向
MDMApplicationIDLPCWSTRinoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	mdmregistration = windows.NewLazySystemDLL("MDMRegistration.dll")
	procRegisterDeviceWithManagementUsingAADDeviceCredentials2 = mdmregistration.NewProc("RegisterDeviceWithManagementUsingAADDeviceCredentials2")
)

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