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

ApplyLocalManagementSyncML

関数
ローカル管理にSyncMLリクエストを適用し結果を取得する。
DLLMDMLocalManagement.dll呼出規約winapi

シグネチャ

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

HRESULT ApplyLocalManagementSyncML(
    LPCWSTR syncMLRequest,
    LPWSTR* syncMLResult   // optional
);

パラメーター

名前方向説明
syncMLRequestLPCWSTRin適用するSyncML要求を示す文字列(Unicode)。
syncMLResultLPWSTR*outoptional処理結果のSyncML応答を受け取る文字列ポインタ(Unicode)。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

ApplyLocalManagementSyncML = ctypes.windll.mdmlocalmanagement.ApplyLocalManagementSyncML
ApplyLocalManagementSyncML.restype = ctypes.c_int
ApplyLocalManagementSyncML.argtypes = [
    wintypes.LPCWSTR,  # syncMLRequest : LPCWSTR
    ctypes.c_void_p,  # syncMLResult : LPWSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MDMLocalManagement.dll')
ApplyLocalManagementSyncML = Fiddle::Function.new(
  lib['ApplyLocalManagementSyncML'],
  [
    Fiddle::TYPE_VOIDP,  # syncMLRequest : LPCWSTR
    Fiddle::TYPE_VOIDP,  # syncMLResult : LPWSTR* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mdmlocalmanagement")]
extern "system" {
    fn ApplyLocalManagementSyncML(
        syncMLRequest: *const u16,  // LPCWSTR
        syncMLResult: *mut *mut u16  // LPWSTR* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MDMLocalManagement.dll")]
public static extern int ApplyLocalManagementSyncML([MarshalAs(UnmanagedType.LPWStr)] string syncMLRequest, IntPtr syncMLResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MDMLocalManagement_ApplyLocalManagementSyncML' -Namespace Win32 -PassThru
# $api::ApplyLocalManagementSyncML(syncMLRequest, syncMLResult)
#uselib "MDMLocalManagement.dll"
#func global ApplyLocalManagementSyncML "ApplyLocalManagementSyncML" sptr, sptr
; ApplyLocalManagementSyncML syncMLRequest, varptr(syncMLResult)   ; 戻り値は stat
; syncMLRequest : LPCWSTR -> "sptr"
; syncMLResult : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MDMLocalManagement.dll"
#cfunc global ApplyLocalManagementSyncML "ApplyLocalManagementSyncML" wstr, var
; res = ApplyLocalManagementSyncML(syncMLRequest, syncMLResult)
; syncMLRequest : LPCWSTR -> "wstr"
; syncMLResult : LPWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT ApplyLocalManagementSyncML(LPCWSTR syncMLRequest, LPWSTR* syncMLResult)
#uselib "MDMLocalManagement.dll"
#cfunc global ApplyLocalManagementSyncML "ApplyLocalManagementSyncML" wstr, var
; res = ApplyLocalManagementSyncML(syncMLRequest, syncMLResult)
; syncMLRequest : LPCWSTR -> "wstr"
; syncMLResult : LPWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mdmlocalmanagement = windows.NewLazySystemDLL("MDMLocalManagement.dll")
	procApplyLocalManagementSyncML = mdmlocalmanagement.NewProc("ApplyLocalManagementSyncML")
)

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

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

typedef ApplyLocalManagementSyncMLNative = Int32 Function(Pointer<Utf16>, Pointer<Pointer<Utf16>>);
typedef ApplyLocalManagementSyncMLDart = int Function(Pointer<Utf16>, Pointer<Pointer<Utf16>>);
final ApplyLocalManagementSyncML = DynamicLibrary.open('MDMLocalManagement.dll')
    .lookupFunction<ApplyLocalManagementSyncMLNative, ApplyLocalManagementSyncMLDart>('ApplyLocalManagementSyncML');
// syncMLRequest : LPCWSTR -> Pointer<Utf16>
// syncMLResult : LPWSTR* optional, out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ApplyLocalManagementSyncML(
  syncMLRequest: PWideChar;   // LPCWSTR
  syncMLResult: PPWideChar   // LPWSTR* optional, out
): Integer; stdcall;
  external 'MDMLocalManagement.dll' name 'ApplyLocalManagementSyncML';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ApplyLocalManagementSyncML"
  c_ApplyLocalManagementSyncML :: CWString -> Ptr CWString -> IO Int32
-- syncMLRequest : LPCWSTR -> CWString
-- syncMLResult : LPWSTR* optional, out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let applylocalmanagementsyncml =
  foreign "ApplyLocalManagementSyncML"
    ((ptr uint16_t) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* syncMLRequest : LPCWSTR -> (ptr uint16_t) *)
(* syncMLResult : LPWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mdmlocalmanagement (t "MDMLocalManagement.dll"))
(cffi:use-foreign-library mdmlocalmanagement)

(cffi:defcfun ("ApplyLocalManagementSyncML" apply-local-management-sync-ml :convention :stdcall) :int32
  (sync-mlrequest (:string :encoding :utf-16le))   ; LPCWSTR
  (sync-mlresult :pointer))   ; LPWSTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ApplyLocalManagementSyncML = Win32::API::More->new('MDMLocalManagement',
    'int ApplyLocalManagementSyncML(LPCWSTR syncMLRequest, LPVOID syncMLResult)');
# my $ret = $ApplyLocalManagementSyncML->Call($syncMLRequest, $syncMLResult);
# syncMLRequest : LPCWSTR -> LPCWSTR
# syncMLResult : LPWSTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。