ホーム › Networking.Ldap › ldap_first_attributeW
ldap_first_attributeW
関数エントリから最初の属性名を取得する(Unicode版)。
シグネチャ
// WLDAP32.dll (Unicode / -W)
#include <windows.h>
LPWSTR ldap_first_attributeW(
LDAP* ld,
LDAPMessage* entry,
BerElement** ptr
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ld | LDAP* | inout |
| entry | LDAPMessage* | inout |
| ptr | BerElement** | inout |
戻り値の型: LPWSTR
各言語での呼び出し定義
// WLDAP32.dll (Unicode / -W)
#include <windows.h>
LPWSTR ldap_first_attributeW(
LDAP* ld,
LDAPMessage* entry,
BerElement** ptr
);[DllImport("WLDAP32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ldap_first_attributeW(
IntPtr ld, // LDAP* in/out
IntPtr entry, // LDAPMessage* in/out
IntPtr ptr // BerElement** in/out
);<DllImport("WLDAP32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_first_attributeW(
ld As IntPtr, ' LDAP* in/out
entry As IntPtr, ' LDAPMessage* in/out
ptr As IntPtr ' BerElement** in/out
) As IntPtr
End Function' ld : LDAP* in/out
' entry : LDAPMessage* in/out
' ptr : BerElement** in/out
Declare PtrSafe Function ldap_first_attributeW Lib "wldap32" ( _
ByVal ld As LongPtr, _
ByVal entry As LongPtr, _
ByVal ptr As LongPtr) As LongPtr
' 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_first_attributeW = ctypes.cdll.wldap32.ldap_first_attributeW
ldap_first_attributeW.restype = wintypes.LPWSTR
ldap_first_attributeW.argtypes = [
ctypes.c_void_p, # ld : LDAP* in/out
ctypes.c_void_p, # entry : LDAPMessage* in/out
ctypes.c_void_p, # ptr : BerElement** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WLDAP32.dll')
ldap_first_attributeW = Fiddle::Function.new(
lib['ldap_first_attributeW'],
[
Fiddle::TYPE_VOIDP, # ld : LDAP* in/out
Fiddle::TYPE_VOIDP, # entry : LDAPMessage* in/out
Fiddle::TYPE_VOIDP, # ptr : BerElement** in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "wldap32")]
extern "C" {
fn ldap_first_attributeW(
ld: *mut LDAP, // LDAP* in/out
entry: *mut LDAPMessage, // LDAPMessage* in/out
ptr: *mut *mut BerElement // BerElement** in/out
) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WLDAP32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr ldap_first_attributeW(IntPtr ld, IntPtr entry, IntPtr ptr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_first_attributeW' -Namespace Win32 -PassThru
# $api::ldap_first_attributeW(ld, entry, ptr)#uselib "WLDAP32.dll"
#func global ldap_first_attributeW "ldap_first_attributeW" wptr, wptr, wptr
; ldap_first_attributeW varptr(ld), varptr(entry), varptr(ptr) ; 戻り値は stat
; ld : LDAP* in/out -> "wptr"
; entry : LDAPMessage* in/out -> "wptr"
; ptr : BerElement** in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WLDAP32.dll" #cfunc global ldap_first_attributeW "ldap_first_attributeW" var, var, var ; res = ldap_first_attributeW(ld, entry, ptr) ; ld : LDAP* in/out -> "var" ; entry : LDAPMessage* in/out -> "var" ; ptr : BerElement** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WLDAP32.dll" #cfunc global ldap_first_attributeW "ldap_first_attributeW" sptr, sptr, sptr ; res = ldap_first_attributeW(varptr(ld), varptr(entry), varptr(ptr)) ; ld : LDAP* in/out -> "sptr" ; entry : LDAPMessage* in/out -> "sptr" ; ptr : BerElement** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; LPWSTR ldap_first_attributeW(LDAP* ld, LDAPMessage* entry, BerElement** ptr) #uselib "WLDAP32.dll" #cfunc global ldap_first_attributeW "ldap_first_attributeW" var, var, var ; res = ldap_first_attributeW(ld, entry, ptr) ; ld : LDAP* in/out -> "var" ; entry : LDAPMessage* in/out -> "var" ; ptr : BerElement** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; LPWSTR ldap_first_attributeW(LDAP* ld, LDAPMessage* entry, BerElement** ptr) #uselib "WLDAP32.dll" #cfunc global ldap_first_attributeW "ldap_first_attributeW" intptr, intptr, intptr ; res = ldap_first_attributeW(varptr(ld), varptr(entry), varptr(ptr)) ; ld : LDAP* in/out -> "intptr" ; entry : LDAPMessage* in/out -> "intptr" ; ptr : BerElement** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
procldap_first_attributeW = wldap32.NewProc("ldap_first_attributeW")
)
// ld (LDAP* in/out), entry (LDAPMessage* in/out), ptr (BerElement** in/out)
r1, _, err := procldap_first_attributeW.Call(
uintptr(ld),
uintptr(entry),
uintptr(ptr),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPWSTRfunction ldap_first_attributeW(
ld: Pointer; // LDAP* in/out
entry: Pointer; // LDAPMessage* in/out
ptr: Pointer // BerElement** in/out
): PWideChar; cdecl;
external 'WLDAP32.dll' name 'ldap_first_attributeW';result := DllCall("WLDAP32\ldap_first_attributeW"
, "Ptr", ld ; LDAP* in/out
, "Ptr", entry ; LDAPMessage* in/out
, "Ptr", ptr ; BerElement** in/out
, "Cdecl Ptr") ; return: LPWSTR●ldap_first_attributeW(ld, entry, ptr) = DLL("WLDAP32.dll", "char* ldap_first_attributeW(void*, void*, void*)")
# 呼び出し: ldap_first_attributeW(ld, entry, ptr)
# ld : LDAP* in/out -> "void*"
# entry : LDAPMessage* in/out -> "void*"
# ptr : BerElement** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。