ホーム › Networking.Ldap › ldap_next_attributeW
ldap_next_attributeW
関数エントリから次の属性名を取得する(Unicode版)。
シグネチャ
// WLDAP32.dll (Unicode / -W)
#include <windows.h>
LPWSTR ldap_next_attributeW(
LDAP* ld,
LDAPMessage* entry,
BerElement* ptr
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ld | LDAP* | inout | 対象のLDAPセッションハンドル。検索を実行した接続を指す。 |
| entry | LDAPMessage* | inout | 属性を列挙する対象のエントリ。first_attributeと同一エントリを渡す。 |
| ptr | BerElement* | inout | ldap_first_attributeWで得た列挙状態のBerElement。次の属性名を取得する。 |
戻り値の型: LPWSTR
各言語での呼び出し定義
// WLDAP32.dll (Unicode / -W)
#include <windows.h>
LPWSTR ldap_next_attributeW(
LDAP* ld,
LDAPMessage* entry,
BerElement* ptr
);[DllImport("WLDAP32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr ldap_next_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_next_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_next_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_next_attributeW = ctypes.cdll.wldap32.ldap_next_attributeW
ldap_next_attributeW.restype = wintypes.LPWSTR
ldap_next_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_next_attributeW = Fiddle::Function.new(
lib['ldap_next_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_next_attributeW(
ld: *mut LDAP, // LDAP* in/out
entry: *mut LDAPMessage, // LDAPMessage* in/out
ptr: *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_next_attributeW(IntPtr ld, IntPtr entry, IntPtr ptr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_next_attributeW' -Namespace Win32 -PassThru
# $api::ldap_next_attributeW(ld, entry, ptr)#uselib "WLDAP32.dll"
#func global ldap_next_attributeW "ldap_next_attributeW" wptr, wptr, wptr
; ldap_next_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_next_attributeW "ldap_next_attributeW" var, var, var ; res = ldap_next_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_next_attributeW "ldap_next_attributeW" sptr, sptr, sptr ; res = ldap_next_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_next_attributeW(LDAP* ld, LDAPMessage* entry, BerElement* ptr) #uselib "WLDAP32.dll" #cfunc global ldap_next_attributeW "ldap_next_attributeW" var, var, var ; res = ldap_next_attributeW(ld, entry, ptr) ; ld : LDAP* in/out -> "var" ; entry : LDAPMessage* in/out -> "var" ; ptr : BerElement* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; LPWSTR ldap_next_attributeW(LDAP* ld, LDAPMessage* entry, BerElement* ptr) #uselib "WLDAP32.dll" #cfunc global ldap_next_attributeW "ldap_next_attributeW" intptr, intptr, intptr ; res = ldap_next_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_next_attributeW = wldap32.NewProc("ldap_next_attributeW")
)
// ld (LDAP* in/out), entry (LDAPMessage* in/out), ptr (BerElement* in/out)
r1, _, err := procldap_next_attributeW.Call(
uintptr(ld),
uintptr(entry),
uintptr(ptr),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPWSTRfunction ldap_next_attributeW(
ld: Pointer; // LDAP* in/out
entry: Pointer; // LDAPMessage* in/out
ptr: Pointer // BerElement* in/out
): PWideChar; cdecl;
external 'WLDAP32.dll' name 'ldap_next_attributeW';result := DllCall("WLDAP32\ldap_next_attributeW"
, "Ptr", ld ; LDAP* in/out
, "Ptr", entry ; LDAPMessage* in/out
, "Ptr", ptr ; BerElement* in/out
, "Cdecl Ptr") ; return: LPWSTR●ldap_next_attributeW(ld, entry, ptr) = DLL("WLDAP32.dll", "char* ldap_next_attributeW(void*, void*, void*)")
# 呼び出し: ldap_next_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`,…) を使用。const std = @import("std");
extern "wldap32" fn ldap_next_attributeW(
ld: [*c]LDAP, // LDAP* in/out
entry: [*c]LDAPMessage, // LDAPMessage* in/out
ptr: [*c]BerElement // BerElement* in/out
) callconv(.c) [*c]const u16;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc ldap_next_attributeW(
ld: ptr LDAP, # LDAP* in/out
entry: ptr LDAPMessage, # LDAPMessage* in/out
`ptr`: ptr BerElement # BerElement* in/out
): WideCString {.importc: "ldap_next_attributeW", cdecl, dynlib: "WLDAP32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "wldap32");
extern(C)
const(wchar)* ldap_next_attributeW(
LDAP* ld, // LDAP* in/out
LDAPMessage* entry, // LDAPMessage* in/out
BerElement* ptr // BerElement* in/out
);ccall((:ldap_next_attributeW, "WLDAP32.dll"), Cwstring,
(Ptr{LDAP}, Ptr{LDAPMessage}, Ptr{BerElement}),
ld, entry, ptr)
# ld : LDAP* in/out -> Ptr{LDAP}
# entry : LDAPMessage* in/out -> Ptr{LDAPMessage}
# ptr : BerElement* in/out -> Ptr{BerElement}
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
const uint16_t* ldap_next_attributeW(
void* ld,
void* entry,
void* ptr);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_next_attributeW(ld, entry, ptr)
-- ld : LDAP* in/out
-- entry : LDAPMessage* in/out
-- ptr : BerElement* 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_next_attributeW = lib.func('__cdecl', 'ldap_next_attributeW', 'void *', ['void *', 'void *', 'void *']);
// ldap_next_attributeW(ld, entry, ptr)
// ld : LDAP* in/out -> 'void *'
// entry : LDAPMessage* in/out -> 'void *'
// ptr : BerElement* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WLDAP32.dll", {
ldap_next_attributeW: { parameters: ["pointer", "pointer", "pointer"], result: "pointer" },
});
// lib.symbols.ldap_next_attributeW(ld, entry, ptr)
// ld : LDAP* in/out -> "pointer"
// entry : LDAPMessage* in/out -> "pointer"
// ptr : BerElement* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
const uint16_t* ldap_next_attributeW(
void* ld,
void* entry,
void* ptr);
C, "WLDAP32.dll");
// $ffi->ldap_next_attributeW(ld, entry, ptr);
// ld : LDAP* in/out
// entry : LDAPMessage* in/out
// ptr : BerElement* 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);
Pointer ldap_next_attributeW(
Pointer ld, // LDAP* in/out
Pointer entry, // LDAPMessage* in/out
Pointer ptr // BerElement* in/out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("wldap32")]
lib LibWLDAP32
fun ldap_next_attributeW = ldap_next_attributeW(
ld : LDAP*, # LDAP* in/out
entry : LDAPMessage*, # LDAPMessage* in/out
ptr : BerElement* # BerElement* in/out
) : UInt16*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ldap_next_attributeWNative = Pointer<Utf16> Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef ldap_next_attributeWDart = Pointer<Utf16> Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final ldap_next_attributeW = DynamicLibrary.open('WLDAP32.dll')
.lookupFunction<ldap_next_attributeWNative, ldap_next_attributeWDart>('ldap_next_attributeW');
// ld : LDAP* in/out -> Pointer<Void>
// entry : LDAPMessage* in/out -> Pointer<Void>
// ptr : BerElement* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ldap_next_attributeW(
ld: Pointer; // LDAP* in/out
entry: Pointer; // LDAPMessage* in/out
ptr: Pointer // BerElement* in/out
): PWideChar; cdecl;
external 'WLDAP32.dll' name 'ldap_next_attributeW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ldap_next_attributeW"
c_ldap_next_attributeW :: Ptr () -> Ptr () -> Ptr () -> IO CWString
-- ld : LDAP* in/out -> Ptr ()
-- entry : LDAPMessage* in/out -> Ptr ()
-- ptr : BerElement* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ldap_next_attributew =
foreign "ldap_next_attributeW"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning (ptr uint16_t))
(* ld : LDAP* in/out -> (ptr void) *)
(* entry : LDAPMessage* in/out -> (ptr void) *)
(* ptr : BerElement* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wldap32 (t "WLDAP32.dll"))
(cffi:use-foreign-library wldap32)
(cffi:defcfun ("ldap_next_attributeW" ldap-next-attribute-w :convention :cdecl) (:string :encoding :utf-16le)
(ld :pointer) ; LDAP* in/out
(entry :pointer) ; LDAPMessage* in/out
(ptr :pointer)) ; BerElement* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ldap_next_attributeW = Win32::API::More->new('WLDAP32',
'LPWSTR ldap_next_attributeW(LPVOID ld, LPVOID entry, LPVOID ptr)');
# my $ret = $ldap_next_attributeW->Call($ld, $entry, $ptr);
# ld : LDAP* in/out -> LPVOID
# entry : LDAPMessage* in/out -> LPVOID
# ptr : BerElement* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f ldap_next_attributeA (ANSI版) — エントリから次の属性名を取得する(ANSI版)。