ホーム › Networking.Ldap › ldap_parse_extended_resultA
ldap_parse_extended_resultA
関数拡張操作の結果からOIDとデータを解析する(ANSI版)。
シグネチャ
// WLDAP32.dll (ANSI / -A)
#include <windows.h>
DWORD ldap_parse_extended_resultA(
LDAP* Connection,
LDAPMessage* ResultMessage,
LPSTR* ResultOID, // optional
LDAP_BERVAL** ResultData,
BOOLEAN Freeit
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Connection | LDAP* | inout | 対象のLDAPセッションハンドル。拡張操作の応答を受けた接続を指す。 |
| ResultMessage | LDAPMessage* | inout | 解析対象の拡張操作結果メッセージ。サーバ応答を渡す。 |
| ResultOID | LPSTR* | outoptional | 応答の拡張操作OID文字列(ANSI)を受け取る出力ポインタ。ldap_memfreeで解放。NULL可。 |
| ResultData | LDAP_BERVAL** | inout | 拡張操作の返却データ(berval)を受け取る出力先。ber_bvfreeで解放する。NULL可。 |
| Freeit | BOOLEAN | in | 0以外ならResultMessageを解析後に自動解放する真偽フラグ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// WLDAP32.dll (ANSI / -A)
#include <windows.h>
DWORD ldap_parse_extended_resultA(
LDAP* Connection,
LDAPMessage* ResultMessage,
LPSTR* ResultOID, // optional
LDAP_BERVAL** ResultData,
BOOLEAN Freeit
);[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_parse_extended_resultA(
IntPtr Connection, // LDAP* in/out
IntPtr ResultMessage, // LDAPMessage* in/out
IntPtr ResultOID, // LPSTR* optional, out
IntPtr ResultData, // LDAP_BERVAL** in/out
[MarshalAs(UnmanagedType.U1)] bool Freeit // BOOLEAN
);<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_parse_extended_resultA(
Connection As IntPtr, ' LDAP* in/out
ResultMessage As IntPtr, ' LDAPMessage* in/out
ResultOID As IntPtr, ' LPSTR* optional, out
ResultData As IntPtr, ' LDAP_BERVAL** in/out
<MarshalAs(UnmanagedType.U1)> Freeit As Boolean ' BOOLEAN
) As UInteger
End Function' Connection : LDAP* in/out
' ResultMessage : LDAPMessage* in/out
' ResultOID : LPSTR* optional, out
' ResultData : LDAP_BERVAL** in/out
' Freeit : BOOLEAN
Declare PtrSafe Function ldap_parse_extended_resultA Lib "wldap32" ( _
ByVal Connection As LongPtr, _
ByVal ResultMessage As LongPtr, _
ByVal ResultOID As LongPtr, _
ByVal ResultData As LongPtr, _
ByVal Freeit As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ldap_parse_extended_resultA = ctypes.cdll.wldap32.ldap_parse_extended_resultA
ldap_parse_extended_resultA.restype = wintypes.DWORD
ldap_parse_extended_resultA.argtypes = [
ctypes.c_void_p, # Connection : LDAP* in/out
ctypes.c_void_p, # ResultMessage : LDAPMessage* in/out
ctypes.c_void_p, # ResultOID : LPSTR* optional, out
ctypes.c_void_p, # ResultData : LDAP_BERVAL** in/out
wintypes.BOOLEAN, # Freeit : BOOLEAN
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WLDAP32.dll')
ldap_parse_extended_resultA = Fiddle::Function.new(
lib['ldap_parse_extended_resultA'],
[
Fiddle::TYPE_VOIDP, # Connection : LDAP* in/out
Fiddle::TYPE_VOIDP, # ResultMessage : LDAPMessage* in/out
Fiddle::TYPE_VOIDP, # ResultOID : LPSTR* optional, out
Fiddle::TYPE_VOIDP, # ResultData : LDAP_BERVAL** in/out
Fiddle::TYPE_CHAR, # Freeit : BOOLEAN
],
-Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "wldap32")]
extern "C" {
fn ldap_parse_extended_resultA(
Connection: *mut LDAP, // LDAP* in/out
ResultMessage: *mut LDAPMessage, // LDAPMessage* in/out
ResultOID: *mut *mut u8, // LPSTR* optional, out
ResultData: *mut *mut LDAP_BERVAL, // LDAP_BERVAL** in/out
Freeit: u8 // BOOLEAN
) -> 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_parse_extended_resultA(IntPtr Connection, IntPtr ResultMessage, IntPtr ResultOID, IntPtr ResultData, [MarshalAs(UnmanagedType.U1)] bool Freeit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_parse_extended_resultA' -Namespace Win32 -PassThru
# $api::ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit)#uselib "WLDAP32.dll"
#func global ldap_parse_extended_resultA "ldap_parse_extended_resultA" sptr, sptr, sptr, sptr, sptr
; ldap_parse_extended_resultA varptr(Connection), varptr(ResultMessage), varptr(ResultOID), varptr(ResultData), Freeit ; 戻り値は stat
; Connection : LDAP* in/out -> "sptr"
; ResultMessage : LDAPMessage* in/out -> "sptr"
; ResultOID : LPSTR* optional, out -> "sptr"
; ResultData : LDAP_BERVAL** in/out -> "sptr"
; Freeit : BOOLEAN -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WLDAP32.dll" #cfunc global ldap_parse_extended_resultA "ldap_parse_extended_resultA" var, var, var, var, int ; res = ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit) ; Connection : LDAP* in/out -> "var" ; ResultMessage : LDAPMessage* in/out -> "var" ; ResultOID : LPSTR* optional, out -> "var" ; ResultData : LDAP_BERVAL** in/out -> "var" ; Freeit : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WLDAP32.dll" #cfunc global ldap_parse_extended_resultA "ldap_parse_extended_resultA" sptr, sptr, sptr, sptr, int ; res = ldap_parse_extended_resultA(varptr(Connection), varptr(ResultMessage), varptr(ResultOID), varptr(ResultData), Freeit) ; Connection : LDAP* in/out -> "sptr" ; ResultMessage : LDAPMessage* in/out -> "sptr" ; ResultOID : LPSTR* optional, out -> "sptr" ; ResultData : LDAP_BERVAL** in/out -> "sptr" ; Freeit : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ldap_parse_extended_resultA(LDAP* Connection, LDAPMessage* ResultMessage, LPSTR* ResultOID, LDAP_BERVAL** ResultData, BOOLEAN Freeit) #uselib "WLDAP32.dll" #cfunc global ldap_parse_extended_resultA "ldap_parse_extended_resultA" var, var, var, var, int ; res = ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit) ; Connection : LDAP* in/out -> "var" ; ResultMessage : LDAPMessage* in/out -> "var" ; ResultOID : LPSTR* optional, out -> "var" ; ResultData : LDAP_BERVAL** in/out -> "var" ; Freeit : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ldap_parse_extended_resultA(LDAP* Connection, LDAPMessage* ResultMessage, LPSTR* ResultOID, LDAP_BERVAL** ResultData, BOOLEAN Freeit) #uselib "WLDAP32.dll" #cfunc global ldap_parse_extended_resultA "ldap_parse_extended_resultA" intptr, intptr, intptr, intptr, int ; res = ldap_parse_extended_resultA(varptr(Connection), varptr(ResultMessage), varptr(ResultOID), varptr(ResultData), Freeit) ; Connection : LDAP* in/out -> "intptr" ; ResultMessage : LDAPMessage* in/out -> "intptr" ; ResultOID : LPSTR* optional, out -> "intptr" ; ResultData : LDAP_BERVAL** in/out -> "intptr" ; Freeit : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
procldap_parse_extended_resultA = wldap32.NewProc("ldap_parse_extended_resultA")
)
// Connection (LDAP* in/out), ResultMessage (LDAPMessage* in/out), ResultOID (LPSTR* optional, out), ResultData (LDAP_BERVAL** in/out), Freeit (BOOLEAN)
r1, _, err := procldap_parse_extended_resultA.Call(
uintptr(Connection),
uintptr(ResultMessage),
uintptr(ResultOID),
uintptr(ResultData),
uintptr(Freeit),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ldap_parse_extended_resultA(
Connection: Pointer; // LDAP* in/out
ResultMessage: Pointer; // LDAPMessage* in/out
ResultOID: PPAnsiChar; // LPSTR* optional, out
ResultData: Pointer; // LDAP_BERVAL** in/out
Freeit: ByteBool // BOOLEAN
): DWORD; cdecl;
external 'WLDAP32.dll' name 'ldap_parse_extended_resultA';result := DllCall("WLDAP32\ldap_parse_extended_resultA"
, "Ptr", Connection ; LDAP* in/out
, "Ptr", ResultMessage ; LDAPMessage* in/out
, "Ptr", ResultOID ; LPSTR* optional, out
, "Ptr", ResultData ; LDAP_BERVAL** in/out
, "Char", Freeit ; BOOLEAN
, "Cdecl UInt") ; return: DWORD●ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit) = DLL("WLDAP32.dll", "dword ldap_parse_extended_resultA(void*, void*, void*, void*, byte)")
# 呼び出し: ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit)
# Connection : LDAP* in/out -> "void*"
# ResultMessage : LDAPMessage* in/out -> "void*"
# ResultOID : LPSTR* optional, out -> "void*"
# ResultData : LDAP_BERVAL** in/out -> "void*"
# Freeit : BOOLEAN -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "wldap32" fn ldap_parse_extended_resultA(
Connection: [*c]LDAP, // LDAP* in/out
ResultMessage: [*c]LDAPMessage, // LDAPMessage* in/out
ResultOID: [*c][*c]u8, // LPSTR* optional, out
ResultData: [*c][*c]LDAP_BERVAL, // LDAP_BERVAL** in/out
Freeit: u8 // BOOLEAN
) callconv(.c) u32;proc ldap_parse_extended_resultA(
Connection: ptr LDAP, # LDAP* in/out
ResultMessage: ptr LDAPMessage, # LDAPMessage* in/out
ResultOID: ptr cstring, # LPSTR* optional, out
ResultData: ptr LDAP_BERVAL, # LDAP_BERVAL** in/out
Freeit: uint8 # BOOLEAN
): uint32 {.importc: "ldap_parse_extended_resultA", cdecl, dynlib: "WLDAP32.dll".}pragma(lib, "wldap32");
extern(C)
uint ldap_parse_extended_resultA(
LDAP* Connection, // LDAP* in/out
LDAPMessage* ResultMessage, // LDAPMessage* in/out
char** ResultOID, // LPSTR* optional, out
LDAP_BERVAL** ResultData, // LDAP_BERVAL** in/out
ubyte Freeit // BOOLEAN
);ccall((:ldap_parse_extended_resultA, "WLDAP32.dll"), UInt32,
(Ptr{LDAP}, Ptr{LDAPMessage}, Ptr{Ptr{UInt8}}, Ptr{LDAP_BERVAL}, UInt8),
Connection, ResultMessage, ResultOID, ResultData, Freeit)
# Connection : LDAP* in/out -> Ptr{LDAP}
# ResultMessage : LDAPMessage* in/out -> Ptr{LDAPMessage}
# ResultOID : LPSTR* optional, out -> Ptr{Ptr{UInt8}}
# ResultData : LDAP_BERVAL** in/out -> Ptr{LDAP_BERVAL}
# Freeit : BOOLEAN -> UInt8local ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_parse_extended_resultA(
void* Connection,
void* ResultMessage,
char** ResultOID,
void* ResultData,
uint8_t Freeit);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit)
-- Connection : LDAP* in/out
-- ResultMessage : LDAPMessage* in/out
-- ResultOID : LPSTR* optional, out
-- ResultData : LDAP_BERVAL** in/out
-- Freeit : BOOLEAN
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_parse_extended_resultA = lib.func('__cdecl', 'ldap_parse_extended_resultA', 'uint32_t', ['void *', 'void *', 'void *', 'void *', 'uint8_t']);
// ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit)
// Connection : LDAP* in/out -> 'void *'
// ResultMessage : LDAPMessage* in/out -> 'void *'
// ResultOID : LPSTR* optional, out -> 'void *'
// ResultData : LDAP_BERVAL** in/out -> 'void *'
// Freeit : BOOLEAN -> 'uint8_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WLDAP32.dll", {
ldap_parse_extended_resultA: { parameters: ["pointer", "pointer", "pointer", "pointer", "u8"], result: "u32" },
});
// lib.symbols.ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit)
// Connection : LDAP* in/out -> "pointer"
// ResultMessage : LDAPMessage* in/out -> "pointer"
// ResultOID : LPSTR* optional, out -> "pointer"
// ResultData : LDAP_BERVAL** in/out -> "pointer"
// Freeit : BOOLEAN -> "u8"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_parse_extended_resultA(
void* Connection,
void* ResultMessage,
char** ResultOID,
void* ResultData,
uint8_t Freeit);
C, "WLDAP32.dll");
// $ffi->ldap_parse_extended_resultA(Connection, ResultMessage, ResultOID, ResultData, Freeit);
// Connection : LDAP* in/out
// ResultMessage : LDAPMessage* in/out
// ResultOID : LPSTR* optional, out
// ResultData : LDAP_BERVAL** in/out
// Freeit : BOOLEAN
// 構造体/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.ASCII_OPTIONS);
int ldap_parse_extended_resultA(
Pointer Connection, // LDAP* in/out
Pointer ResultMessage, // LDAPMessage* in/out
PointerByReference ResultOID, // LPSTR* optional, out
Pointer ResultData, // LDAP_BERVAL** in/out
byte Freeit // BOOLEAN
);
}@[Link("wldap32")]
lib LibWLDAP32
fun ldap_parse_extended_resultA = ldap_parse_extended_resultA(
Connection : LDAP*, # LDAP* in/out
ResultMessage : LDAPMessage*, # LDAPMessage* in/out
ResultOID : UInt8**, # LPSTR* optional, out
ResultData : LDAP_BERVAL**, # LDAP_BERVAL** in/out
Freeit : UInt8 # BOOLEAN
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ldap_parse_extended_resultANative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Pointer<Utf8>>, Pointer<Void>, Uint8);
typedef ldap_parse_extended_resultADart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Pointer<Utf8>>, Pointer<Void>, int);
final ldap_parse_extended_resultA = DynamicLibrary.open('WLDAP32.dll')
.lookupFunction<ldap_parse_extended_resultANative, ldap_parse_extended_resultADart>('ldap_parse_extended_resultA');
// Connection : LDAP* in/out -> Pointer<Void>
// ResultMessage : LDAPMessage* in/out -> Pointer<Void>
// ResultOID : LPSTR* optional, out -> Pointer<Pointer<Utf8>>
// ResultData : LDAP_BERVAL** in/out -> Pointer<Void>
// Freeit : BOOLEAN -> Uint8
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ldap_parse_extended_resultA(
Connection: Pointer; // LDAP* in/out
ResultMessage: Pointer; // LDAPMessage* in/out
ResultOID: PPAnsiChar; // LPSTR* optional, out
ResultData: Pointer; // LDAP_BERVAL** in/out
Freeit: ByteBool // BOOLEAN
): DWORD; cdecl;
external 'WLDAP32.dll' name 'ldap_parse_extended_resultA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ldap_parse_extended_resultA"
c_ldap_parse_extended_resultA :: Ptr () -> Ptr () -> Ptr CString -> Ptr () -> Word8 -> IO Word32
-- Connection : LDAP* in/out -> Ptr ()
-- ResultMessage : LDAPMessage* in/out -> Ptr ()
-- ResultOID : LPSTR* optional, out -> Ptr CString
-- ResultData : LDAP_BERVAL** in/out -> Ptr ()
-- Freeit : BOOLEAN -> Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ldap_parse_extended_resulta =
foreign "ldap_parse_extended_resultA"
((ptr void) @-> (ptr void) @-> (ptr string) @-> (ptr void) @-> uint8_t @-> returning uint32_t)
(* Connection : LDAP* in/out -> (ptr void) *)
(* ResultMessage : LDAPMessage* in/out -> (ptr void) *)
(* ResultOID : LPSTR* optional, out -> (ptr string) *)
(* ResultData : LDAP_BERVAL** in/out -> (ptr void) *)
(* Freeit : BOOLEAN -> uint8_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wldap32 (t "WLDAP32.dll"))
(cffi:use-foreign-library wldap32)
(cffi:defcfun ("ldap_parse_extended_resultA" ldap-parse-extended-result-a :convention :cdecl) :uint32
(connection :pointer) ; LDAP* in/out
(result-message :pointer) ; LDAPMessage* in/out
(result-oid :pointer) ; LPSTR* optional, out
(result-data :pointer) ; LDAP_BERVAL** in/out
(freeit :uint8)) ; BOOLEAN
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ldap_parse_extended_resultA = Win32::API::More->new('WLDAP32',
'DWORD ldap_parse_extended_resultA(LPVOID Connection, LPVOID ResultMessage, LPVOID ResultOID, LPVOID ResultData, BYTE Freeit)');
# my $ret = $ldap_parse_extended_resultA->Call($Connection, $ResultMessage, $ResultOID, $ResultData, $Freeit);
# Connection : LDAP* in/out -> LPVOID
# ResultMessage : LDAPMessage* in/out -> LPVOID
# ResultOID : LPSTR* optional, out -> LPVOID
# ResultData : LDAP_BERVAL** in/out -> LPVOID
# Freeit : BOOLEAN -> BYTE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f ldap_parse_extended_resultW (Unicode版) — 拡張操作の結果からOIDとデータを解析する(Unicode版)。