Win32 API 日本語リファレンス
ホームNetworking.Ldap › ldap_compare_extW

ldap_compare_extW

関数
コントロール付きで属性値を非同期に比較する拡張版(Unicode版)。
DLLWLDAP32.dll文字セットUnicode (-W)呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

// WLDAP32.dll  (Unicode / -W)
#include <windows.h>

DWORD ldap_compare_extW(
    LDAP* ld,
    LPCWSTR dn,
    LPCWSTR Attr,
    LPCWSTR Value,   // optional
    LDAP_BERVAL* Data,   // optional
    LDAPControlW** ServerControls,
    LDAPControlW** ClientControls,
    DWORD* MessageNumber
);

パラメーター

名前方向説明
ldLDAP*inout比較操作を行う対象のLDAPセッションハンドル。
dnLPCWSTRin比較対象エントリの識別名(DN、Unicode)。
AttrLPCWSTRin比較する属性名(Unicode)。エントリ内の対象属性を指す。
ValueLPCWSTRinoptional属性と照合する文字列値(Unicode)。Dataを使う場合はNULLとする。
DataLDAP_BERVAL*inoptionalバイナリ値で比較する場合のLDAP_BERVAL構造体へのポインタ。文字列比較時はNULL。
ServerControlsLDAPControlW**inoutサーバー側コントロールの配列(LDAPControlW*の配列)。不要ならNULL。
ClientControlsLDAPControlW**inoutクライアント側コントロールの配列(LDAPControlW*の配列)。不要ならNULL。
MessageNumberDWORD*inout発行した非同期要求のメッセージIDを受け取るDWORD変数へのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

// WLDAP32.dll  (Unicode / -W)
#include <windows.h>

DWORD ldap_compare_extW(
    LDAP* ld,
    LPCWSTR dn,
    LPCWSTR Attr,
    LPCWSTR Value,   // optional
    LDAP_BERVAL* Data,   // optional
    LDAPControlW** ServerControls,
    LDAPControlW** ClientControls,
    DWORD* MessageNumber
);
[DllImport("WLDAP32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_compare_extW(
    IntPtr ld,   // LDAP* in/out
    [MarshalAs(UnmanagedType.LPWStr)] string dn,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string Attr,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string Value,   // LPCWSTR optional
    IntPtr Data,   // LDAP_BERVAL* optional
    IntPtr ServerControls,   // LDAPControlW** in/out
    IntPtr ClientControls,   // LDAPControlW** in/out
    ref uint MessageNumber   // DWORD* in/out
);
<DllImport("WLDAP32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_compare_extW(
    ld As IntPtr,   ' LDAP* in/out
    <MarshalAs(UnmanagedType.LPWStr)> dn As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> Attr As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> Value As String,   ' LPCWSTR optional
    Data As IntPtr,   ' LDAP_BERVAL* optional
    ServerControls As IntPtr,   ' LDAPControlW** in/out
    ClientControls As IntPtr,   ' LDAPControlW** in/out
    ByRef MessageNumber As UInteger   ' DWORD* in/out
) As UInteger
End Function
' ld : LDAP* in/out
' dn : LPCWSTR
' Attr : LPCWSTR
' Value : LPCWSTR optional
' Data : LDAP_BERVAL* optional
' ServerControls : LDAPControlW** in/out
' ClientControls : LDAPControlW** in/out
' MessageNumber : DWORD* in/out
Declare PtrSafe Function ldap_compare_extW Lib "wldap32" ( _
    ByVal ld As LongPtr, _
    ByVal dn As LongPtr, _
    ByVal Attr As LongPtr, _
    ByVal Value As LongPtr, _
    ByVal Data As LongPtr, _
    ByVal ServerControls As LongPtr, _
    ByVal ClientControls As LongPtr, _
    ByRef MessageNumber As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ldap_compare_extW = ctypes.cdll.wldap32.ldap_compare_extW
ldap_compare_extW.restype = wintypes.DWORD
ldap_compare_extW.argtypes = [
    ctypes.c_void_p,  # ld : LDAP* in/out
    wintypes.LPCWSTR,  # dn : LPCWSTR
    wintypes.LPCWSTR,  # Attr : LPCWSTR
    wintypes.LPCWSTR,  # Value : LPCWSTR optional
    ctypes.c_void_p,  # Data : LDAP_BERVAL* optional
    ctypes.c_void_p,  # ServerControls : LDAPControlW** in/out
    ctypes.c_void_p,  # ClientControls : LDAPControlW** in/out
    ctypes.POINTER(wintypes.DWORD),  # MessageNumber : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WLDAP32.dll')
ldap_compare_extW = Fiddle::Function.new(
  lib['ldap_compare_extW'],
  [
    Fiddle::TYPE_VOIDP,  # ld : LDAP* in/out
    Fiddle::TYPE_VOIDP,  # dn : LPCWSTR
    Fiddle::TYPE_VOIDP,  # Attr : LPCWSTR
    Fiddle::TYPE_VOIDP,  # Value : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # Data : LDAP_BERVAL* optional
    Fiddle::TYPE_VOIDP,  # ServerControls : LDAPControlW** in/out
    Fiddle::TYPE_VOIDP,  # ClientControls : LDAPControlW** in/out
    Fiddle::TYPE_VOIDP,  # MessageNumber : DWORD* in/out
  ],
  -Fiddle::TYPE_INT, Fiddle::Function::CDECL)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "wldap32")]
extern "C" {
    fn ldap_compare_extW(
        ld: *mut LDAP,  // LDAP* in/out
        dn: *const u16,  // LPCWSTR
        Attr: *const u16,  // LPCWSTR
        Value: *const u16,  // LPCWSTR optional
        Data: *mut LDAP_BERVAL,  // LDAP_BERVAL* optional
        ServerControls: *mut *mut LDAPControlW,  // LDAPControlW** in/out
        ClientControls: *mut *mut LDAPControlW,  // LDAPControlW** in/out
        MessageNumber: *mut u32  // DWORD* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WLDAP32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ldap_compare_extW(IntPtr ld, [MarshalAs(UnmanagedType.LPWStr)] string dn, [MarshalAs(UnmanagedType.LPWStr)] string Attr, [MarshalAs(UnmanagedType.LPWStr)] string Value, IntPtr Data, IntPtr ServerControls, IntPtr ClientControls, ref uint MessageNumber);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_compare_extW' -Namespace Win32 -PassThru
# $api::ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
#uselib "WLDAP32.dll"
#func global ldap_compare_extW "ldap_compare_extW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; ldap_compare_extW varptr(ld), dn, Attr, Value, varptr(Data), varptr(ServerControls), varptr(ClientControls), varptr(MessageNumber)   ; 戻り値は stat
; ld : LDAP* in/out -> "wptr"
; dn : LPCWSTR -> "wptr"
; Attr : LPCWSTR -> "wptr"
; Value : LPCWSTR optional -> "wptr"
; Data : LDAP_BERVAL* optional -> "wptr"
; ServerControls : LDAPControlW** in/out -> "wptr"
; ClientControls : LDAPControlW** in/out -> "wptr"
; MessageNumber : DWORD* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WLDAP32.dll"
#cfunc global ldap_compare_extW "ldap_compare_extW" var, wstr, wstr, wstr, var, var, var, var
; res = ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
; ld : LDAP* in/out -> "var"
; dn : LPCWSTR -> "wstr"
; Attr : LPCWSTR -> "wstr"
; Value : LPCWSTR optional -> "wstr"
; Data : LDAP_BERVAL* optional -> "var"
; ServerControls : LDAPControlW** in/out -> "var"
; ClientControls : LDAPControlW** in/out -> "var"
; MessageNumber : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ldap_compare_extW(LDAP* ld, LPCWSTR dn, LPCWSTR Attr, LPCWSTR Value, LDAP_BERVAL* Data, LDAPControlW** ServerControls, LDAPControlW** ClientControls, DWORD* MessageNumber)
#uselib "WLDAP32.dll"
#cfunc global ldap_compare_extW "ldap_compare_extW" var, wstr, wstr, wstr, var, var, var, var
; res = ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
; ld : LDAP* in/out -> "var"
; dn : LPCWSTR -> "wstr"
; Attr : LPCWSTR -> "wstr"
; Value : LPCWSTR optional -> "wstr"
; Data : LDAP_BERVAL* optional -> "var"
; ServerControls : LDAPControlW** in/out -> "var"
; ClientControls : LDAPControlW** in/out -> "var"
; MessageNumber : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_compare_extW = wldap32.NewProc("ldap_compare_extW")
)

// ld (LDAP* in/out), dn (LPCWSTR), Attr (LPCWSTR), Value (LPCWSTR optional), Data (LDAP_BERVAL* optional), ServerControls (LDAPControlW** in/out), ClientControls (LDAPControlW** in/out), MessageNumber (DWORD* in/out)
r1, _, err := procldap_compare_extW.Call(
	uintptr(ld),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(dn))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Attr))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Value))),
	uintptr(Data),
	uintptr(ServerControls),
	uintptr(ClientControls),
	uintptr(MessageNumber),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ldap_compare_extW(
  ld: Pointer;   // LDAP* in/out
  dn: PWideChar;   // LPCWSTR
  Attr: PWideChar;   // LPCWSTR
  Value: PWideChar;   // LPCWSTR optional
  Data: Pointer;   // LDAP_BERVAL* optional
  ServerControls: Pointer;   // LDAPControlW** in/out
  ClientControls: Pointer;   // LDAPControlW** in/out
  MessageNumber: Pointer   // DWORD* in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_compare_extW';
result := DllCall("WLDAP32\ldap_compare_extW"
    , "Ptr", ld   ; LDAP* in/out
    , "WStr", dn   ; LPCWSTR
    , "WStr", Attr   ; LPCWSTR
    , "WStr", Value   ; LPCWSTR optional
    , "Ptr", Data   ; LDAP_BERVAL* optional
    , "Ptr", ServerControls   ; LDAPControlW** in/out
    , "Ptr", ClientControls   ; LDAPControlW** in/out
    , "Ptr", MessageNumber   ; DWORD* in/out
    , "Cdecl UInt")   ; return: DWORD
●ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber) = DLL("WLDAP32.dll", "dword ldap_compare_extW(void*, char*, char*, char*, void*, void*, void*, void*)")
# 呼び出し: ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
# ld : LDAP* in/out -> "void*"
# dn : LPCWSTR -> "char*"
# Attr : LPCWSTR -> "char*"
# Value : LPCWSTR optional -> "char*"
# Data : LDAP_BERVAL* optional -> "void*"
# ServerControls : LDAPControlW** in/out -> "void*"
# ClientControls : LDAPControlW** in/out -> "void*"
# MessageNumber : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "wldap32" fn ldap_compare_extW(
    ld: [*c]LDAP, // LDAP* in/out
    dn: [*c]const u16, // LPCWSTR
    Attr: [*c]const u16, // LPCWSTR
    Value: [*c]const u16, // LPCWSTR optional
    Data: [*c]LDAP_BERVAL, // LDAP_BERVAL* optional
    ServerControls: [*c][*c]LDAPControlW, // LDAPControlW** in/out
    ClientControls: [*c][*c]LDAPControlW, // LDAPControlW** in/out
    MessageNumber: [*c]u32 // DWORD* in/out
) callconv(.c) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc ldap_compare_extW(
    ld: ptr LDAP,  # LDAP* in/out
    dn: WideCString,  # LPCWSTR
    Attr: WideCString,  # LPCWSTR
    Value: WideCString,  # LPCWSTR optional
    Data: ptr LDAP_BERVAL,  # LDAP_BERVAL* optional
    ServerControls: ptr LDAPControlW,  # LDAPControlW** in/out
    ClientControls: ptr LDAPControlW,  # LDAPControlW** in/out
    MessageNumber: ptr uint32  # DWORD* in/out
): uint32 {.importc: "ldap_compare_extW", cdecl, dynlib: "WLDAP32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "wldap32");
extern(C)
uint ldap_compare_extW(
    LDAP* ld,   // LDAP* in/out
    const(wchar)* dn,   // LPCWSTR
    const(wchar)* Attr,   // LPCWSTR
    const(wchar)* Value,   // LPCWSTR optional
    LDAP_BERVAL* Data,   // LDAP_BERVAL* optional
    LDAPControlW** ServerControls,   // LDAPControlW** in/out
    LDAPControlW** ClientControls,   // LDAPControlW** in/out
    uint* MessageNumber   // DWORD* in/out
);
ccall((:ldap_compare_extW, "WLDAP32.dll"), UInt32,
      (Ptr{LDAP}, Cwstring, Cwstring, Cwstring, Ptr{LDAP_BERVAL}, Ptr{LDAPControlW}, Ptr{LDAPControlW}, Ptr{UInt32}),
      ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
# ld : LDAP* in/out -> Ptr{LDAP}
# dn : LPCWSTR -> Cwstring
# Attr : LPCWSTR -> Cwstring
# Value : LPCWSTR optional -> Cwstring
# Data : LDAP_BERVAL* optional -> Ptr{LDAP_BERVAL}
# ServerControls : LDAPControlW** in/out -> Ptr{LDAPControlW}
# ClientControls : LDAPControlW** in/out -> Ptr{LDAPControlW}
# MessageNumber : DWORD* in/out -> Ptr{UInt32}
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_compare_extW(
    void* ld,
    const uint16_t* dn,
    const uint16_t* Attr,
    const uint16_t* Value,
    void* Data,
    void* ServerControls,
    void* ClientControls,
    uint32_t* MessageNumber);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
-- ld : LDAP* in/out
-- dn : LPCWSTR
-- Attr : LPCWSTR
-- Value : LPCWSTR optional
-- Data : LDAP_BERVAL* optional
-- ServerControls : LDAPControlW** in/out
-- ClientControls : LDAPControlW** in/out
-- MessageNumber : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_compare_extW = lib.func('__cdecl', 'ldap_compare_extW', 'uint32_t', ['void *', 'str16', 'str16', 'str16', 'void *', 'void *', 'void *', 'uint32_t *']);
// ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
// ld : LDAP* in/out -> 'void *'
// dn : LPCWSTR -> 'str16'
// Attr : LPCWSTR -> 'str16'
// Value : LPCWSTR optional -> 'str16'
// Data : LDAP_BERVAL* optional -> 'void *'
// ServerControls : LDAPControlW** in/out -> 'void *'
// ClientControls : LDAPControlW** in/out -> 'void *'
// MessageNumber : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WLDAP32.dll", {
  ldap_compare_extW: { parameters: ["pointer", "buffer", "buffer", "buffer", "pointer", "pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber)
// ld : LDAP* in/out -> "pointer"
// dn : LPCWSTR -> "buffer"
// Attr : LPCWSTR -> "buffer"
// Value : LPCWSTR optional -> "buffer"
// Data : LDAP_BERVAL* optional -> "pointer"
// ServerControls : LDAPControlW** in/out -> "pointer"
// ClientControls : LDAPControlW** in/out -> "pointer"
// MessageNumber : DWORD* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_compare_extW(
    void* ld,
    const uint16_t* dn,
    const uint16_t* Attr,
    const uint16_t* Value,
    void* Data,
    void* ServerControls,
    void* ClientControls,
    uint32_t* MessageNumber);
C, "WLDAP32.dll");
// $ffi->ldap_compare_extW(ld, dn, Attr, Value, Data, ServerControls, ClientControls, MessageNumber);
// ld : LDAP* in/out
// dn : LPCWSTR
// Attr : LPCWSTR
// Value : LPCWSTR optional
// Data : LDAP_BERVAL* optional
// ServerControls : LDAPControlW** in/out
// ClientControls : LDAPControlW** in/out
// MessageNumber : DWORD* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wldap32 extends Library {
    Wldap32 INSTANCE = Native.load("wldap32", Wldap32.class, W32APIOptions.UNICODE_OPTIONS);
    int ldap_compare_extW(
        Pointer ld,   // LDAP* in/out
        WString dn,   // LPCWSTR
        WString Attr,   // LPCWSTR
        WString Value,   // LPCWSTR optional
        Pointer Data,   // LDAP_BERVAL* optional
        Pointer ServerControls,   // LDAPControlW** in/out
        Pointer ClientControls,   // LDAPControlW** in/out
        IntByReference MessageNumber   // DWORD* in/out
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("wldap32")]
lib LibWLDAP32
  fun ldap_compare_extW = ldap_compare_extW(
    ld : LDAP*,   # LDAP* in/out
    dn : UInt16*,   # LPCWSTR
    Attr : UInt16*,   # LPCWSTR
    Value : UInt16*,   # LPCWSTR optional
    Data : LDAP_BERVAL*,   # LDAP_BERVAL* optional
    ServerControls : LDAPControlW**,   # LDAPControlW** in/out
    ClientControls : LDAPControlW**,   # LDAPControlW** in/out
    MessageNumber : UInt32*   # DWORD* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ldap_compare_extWNative = Uint32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef ldap_compare_extWDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final ldap_compare_extW = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ldap_compare_extWNative, ldap_compare_extWDart>('ldap_compare_extW');
// ld : LDAP* in/out -> Pointer<Void>
// dn : LPCWSTR -> Pointer<Utf16>
// Attr : LPCWSTR -> Pointer<Utf16>
// Value : LPCWSTR optional -> Pointer<Utf16>
// Data : LDAP_BERVAL* optional -> Pointer<Void>
// ServerControls : LDAPControlW** in/out -> Pointer<Void>
// ClientControls : LDAPControlW** in/out -> Pointer<Void>
// MessageNumber : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ldap_compare_extW(
  ld: Pointer;   // LDAP* in/out
  dn: PWideChar;   // LPCWSTR
  Attr: PWideChar;   // LPCWSTR
  Value: PWideChar;   // LPCWSTR optional
  Data: Pointer;   // LDAP_BERVAL* optional
  ServerControls: Pointer;   // LDAPControlW** in/out
  ClientControls: Pointer;   // LDAPControlW** in/out
  MessageNumber: Pointer   // DWORD* in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_compare_extW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ldap_compare_extW"
  c_ldap_compare_extW :: Ptr () -> CWString -> CWString -> CWString -> Ptr () -> Ptr () -> Ptr () -> Ptr Word32 -> IO Word32
-- ld : LDAP* in/out -> Ptr ()
-- dn : LPCWSTR -> CWString
-- Attr : LPCWSTR -> CWString
-- Value : LPCWSTR optional -> CWString
-- Data : LDAP_BERVAL* optional -> Ptr ()
-- ServerControls : LDAPControlW** in/out -> Ptr ()
-- ClientControls : LDAPControlW** in/out -> Ptr ()
-- MessageNumber : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ldap_compare_extw =
  foreign "ldap_compare_extW"
    ((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning uint32_t)
(* ld : LDAP* in/out -> (ptr void) *)
(* dn : LPCWSTR -> (ptr uint16_t) *)
(* Attr : LPCWSTR -> (ptr uint16_t) *)
(* Value : LPCWSTR optional -> (ptr uint16_t) *)
(* Data : LDAP_BERVAL* optional -> (ptr void) *)
(* ServerControls : LDAPControlW** in/out -> (ptr void) *)
(* ClientControls : LDAPControlW** in/out -> (ptr void) *)
(* MessageNumber : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wldap32 (t "WLDAP32.dll"))
(cffi:use-foreign-library wldap32)

(cffi:defcfun ("ldap_compare_extW" ldap-compare-ext-w :convention :cdecl) :uint32
  (ld :pointer)   ; LDAP* in/out
  (dn (:string :encoding :utf-16le))   ; LPCWSTR
  (attr (:string :encoding :utf-16le))   ; LPCWSTR
  (value (:string :encoding :utf-16le))   ; LPCWSTR optional
  (data :pointer)   ; LDAP_BERVAL* optional
  (server-controls :pointer)   ; LDAPControlW** in/out
  (client-controls :pointer)   ; LDAPControlW** in/out
  (message-number :pointer))   ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ldap_compare_extW = Win32::API::More->new('WLDAP32',
    'DWORD ldap_compare_extW(LPVOID ld, LPCWSTR dn, LPCWSTR Attr, LPCWSTR Value, LPVOID Data, LPVOID ServerControls, LPVOID ClientControls, LPVOID MessageNumber)');
# my $ret = $ldap_compare_extW->Call($ld, $dn, $Attr, $Value, $Data, $ServerControls, $ClientControls, $MessageNumber);
# ld : LDAP* in/out -> LPVOID
# dn : LPCWSTR -> LPCWSTR
# Attr : LPCWSTR -> LPCWSTR
# Value : LPCWSTR optional -> LPCWSTR
# Data : LDAP_BERVAL* optional -> LPVOID
# ServerControls : LDAPControlW** in/out -> LPVOID
# ClientControls : LDAPControlW** in/out -> LPVOID
# MessageNumber : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
使用する型