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

ldap_compare_ext_sA

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

シグネチャ

// WLDAP32.dll  (ANSI / -A)
#include <windows.h>

DWORD ldap_compare_ext_sA(
    LDAP* ld,
    LPCSTR dn,
    LPCSTR Attr,
    LPCSTR Value,   // optional
    LDAP_BERVAL* Data,   // optional
    LDAPControlA** ServerControls,
    LDAPControlA** ClientControls
);

パラメーター

名前方向
ldLDAP*inout
dnLPCSTRin
AttrLPCSTRin
ValueLPCSTRinoptional
DataLDAP_BERVAL*inoptional
ServerControlsLDAPControlA**inout
ClientControlsLDAPControlA**inout

戻り値の型: DWORD

各言語での呼び出し定義

// WLDAP32.dll  (ANSI / -A)
#include <windows.h>

DWORD ldap_compare_ext_sA(
    LDAP* ld,
    LPCSTR dn,
    LPCSTR Attr,
    LPCSTR Value,   // optional
    LDAP_BERVAL* Data,   // optional
    LDAPControlA** ServerControls,
    LDAPControlA** ClientControls
);
[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_compare_ext_sA(
    IntPtr ld,   // LDAP* in/out
    [MarshalAs(UnmanagedType.LPStr)] string dn,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string Attr,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string Value,   // LPCSTR optional
    IntPtr Data,   // LDAP_BERVAL* optional
    IntPtr ServerControls,   // LDAPControlA** in/out
    IntPtr ClientControls   // LDAPControlA** in/out
);
<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_compare_ext_sA(
    ld As IntPtr,   ' LDAP* in/out
    <MarshalAs(UnmanagedType.LPStr)> dn As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> Attr As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> Value As String,   ' LPCSTR optional
    Data As IntPtr,   ' LDAP_BERVAL* optional
    ServerControls As IntPtr,   ' LDAPControlA** in/out
    ClientControls As IntPtr   ' LDAPControlA** in/out
) As UInteger
End Function
' ld : LDAP* in/out
' dn : LPCSTR
' Attr : LPCSTR
' Value : LPCSTR optional
' Data : LDAP_BERVAL* optional
' ServerControls : LDAPControlA** in/out
' ClientControls : LDAPControlA** in/out
Declare PtrSafe Function ldap_compare_ext_sA Lib "wldap32" ( _
    ByVal ld As LongPtr, _
    ByVal dn As String, _
    ByVal Attr As String, _
    ByVal Value As String, _
    ByVal Data As LongPtr, _
    ByVal ServerControls As LongPtr, _
    ByVal ClientControls As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ldap_compare_ext_sA = ctypes.cdll.wldap32.ldap_compare_ext_sA
ldap_compare_ext_sA.restype = wintypes.DWORD
ldap_compare_ext_sA.argtypes = [
    ctypes.c_void_p,  # ld : LDAP* in/out
    wintypes.LPCSTR,  # dn : LPCSTR
    wintypes.LPCSTR,  # Attr : LPCSTR
    wintypes.LPCSTR,  # Value : LPCSTR optional
    ctypes.c_void_p,  # Data : LDAP_BERVAL* optional
    ctypes.c_void_p,  # ServerControls : LDAPControlA** in/out
    ctypes.c_void_p,  # ClientControls : LDAPControlA** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_compare_ext_sA = wldap32.NewProc("ldap_compare_ext_sA")
)

// ld (LDAP* in/out), dn (LPCSTR), Attr (LPCSTR), Value (LPCSTR optional), Data (LDAP_BERVAL* optional), ServerControls (LDAPControlA** in/out), ClientControls (LDAPControlA** in/out)
r1, _, err := procldap_compare_ext_sA.Call(
	uintptr(ld),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(dn))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(Attr))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(Value))),
	uintptr(Data),
	uintptr(ServerControls),
	uintptr(ClientControls),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ldap_compare_ext_sA(
  ld: Pointer;   // LDAP* in/out
  dn: PAnsiChar;   // LPCSTR
  Attr: PAnsiChar;   // LPCSTR
  Value: PAnsiChar;   // LPCSTR optional
  Data: Pointer;   // LDAP_BERVAL* optional
  ServerControls: Pointer;   // LDAPControlA** in/out
  ClientControls: Pointer   // LDAPControlA** in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_compare_ext_sA';
result := DllCall("WLDAP32\ldap_compare_ext_sA"
    , "Ptr", ld   ; LDAP* in/out
    , "AStr", dn   ; LPCSTR
    , "AStr", Attr   ; LPCSTR
    , "AStr", Value   ; LPCSTR optional
    , "Ptr", Data   ; LDAP_BERVAL* optional
    , "Ptr", ServerControls   ; LDAPControlA** in/out
    , "Ptr", ClientControls   ; LDAPControlA** in/out
    , "Cdecl UInt")   ; return: DWORD
●ldap_compare_ext_sA(ld, dn, Attr, Value, Data, ServerControls, ClientControls) = DLL("WLDAP32.dll", "dword ldap_compare_ext_sA(void*, char*, char*, char*, void*, void*, void*)")
# 呼び出し: ldap_compare_ext_sA(ld, dn, Attr, Value, Data, ServerControls, ClientControls)
# ld : LDAP* in/out -> "void*"
# dn : LPCSTR -> "char*"
# Attr : LPCSTR -> "char*"
# Value : LPCSTR optional -> "char*"
# Data : LDAP_BERVAL* optional -> "void*"
# ServerControls : LDAPControlA** in/out -> "void*"
# ClientControls : LDAPControlA** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。