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

ldap_result

関数
非同期LDAP操作の結果をタイムアウト指定で取得する。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

// WLDAP32.dll
#include <windows.h>

DWORD ldap_result(
    LDAP* ld,
    DWORD msgid,
    DWORD all,
    LDAP_TIMEVAL* timeout,   // optional
    LDAPMessage** res
);

パラメーター

名前方向説明
ldLDAP*inout結果を取得する対象のLDAPセッションハンドル。
msgidDWORDin取得対象とする操作のメッセージID。LDAP_RES_ANY(-1)で任意の結果を受け取る。
allDWORDin複数結果の取り扱いを示すフラグ。LDAP_MSG_ONE/ALL/RECEIVED等を指定する。
timeoutLDAP_TIMEVAL*inoptional結果待ちの最大時間を示すLDAP_TIMEVAL構造体へのポインタ。NULLで無制限に待機する。
resLDAPMessage**out取得した結果メッセージを受け取るLDAPMessage*へのポインタ。使用後はldap_msgfreeで解放する。

戻り値の型: DWORD

各言語での呼び出し定義

// WLDAP32.dll
#include <windows.h>

DWORD ldap_result(
    LDAP* ld,
    DWORD msgid,
    DWORD all,
    LDAP_TIMEVAL* timeout,   // optional
    LDAPMessage** res
);
[DllImport("WLDAP32.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_result(
    IntPtr ld,   // LDAP* in/out
    uint msgid,   // DWORD
    uint all,   // DWORD
    IntPtr timeout,   // LDAP_TIMEVAL* optional
    IntPtr res   // LDAPMessage** out
);
<DllImport("WLDAP32.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_result(
    ld As IntPtr,   ' LDAP* in/out
    msgid As UInteger,   ' DWORD
    all As UInteger,   ' DWORD
    timeout As IntPtr,   ' LDAP_TIMEVAL* optional
    res As IntPtr   ' LDAPMessage** out
) As UInteger
End Function
' ld : LDAP* in/out
' msgid : DWORD
' all : DWORD
' timeout : LDAP_TIMEVAL* optional
' res : LDAPMessage** out
Declare PtrSafe Function ldap_result Lib "wldap32" ( _
    ByVal ld As LongPtr, _
    ByVal msgid As Long, _
    ByVal all As Long, _
    ByVal timeout As LongPtr, _
    ByVal res As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ldap_result = ctypes.cdll.wldap32.ldap_result
ldap_result.restype = wintypes.DWORD
ldap_result.argtypes = [
    ctypes.c_void_p,  # ld : LDAP* in/out
    wintypes.DWORD,  # msgid : DWORD
    wintypes.DWORD,  # all : DWORD
    ctypes.c_void_p,  # timeout : LDAP_TIMEVAL* optional
    ctypes.c_void_p,  # res : LDAPMessage** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_result = wldap32.NewProc("ldap_result")
)

// ld (LDAP* in/out), msgid (DWORD), all (DWORD), timeout (LDAP_TIMEVAL* optional), res (LDAPMessage** out)
r1, _, err := procldap_result.Call(
	uintptr(ld),
	uintptr(msgid),
	uintptr(all),
	uintptr(timeout),
	uintptr(res),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ldap_result(
  ld: Pointer;   // LDAP* in/out
  msgid: DWORD;   // DWORD
  all: DWORD;   // DWORD
  timeout: Pointer;   // LDAP_TIMEVAL* optional
  res: Pointer   // LDAPMessage** out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_result';
result := DllCall("WLDAP32\ldap_result"
    , "Ptr", ld   ; LDAP* in/out
    , "UInt", msgid   ; DWORD
    , "UInt", all   ; DWORD
    , "Ptr", timeout   ; LDAP_TIMEVAL* optional
    , "Ptr", res   ; LDAPMessage** out
    , "Cdecl UInt")   ; return: DWORD
●ldap_result(ld, msgid, all, timeout, res) = DLL("WLDAP32.dll", "dword ldap_result(void*, dword, dword, void*, void*)")
# 呼び出し: ldap_result(ld, msgid, all, timeout, res)
# ld : LDAP* in/out -> "void*"
# msgid : DWORD -> "dword"
# all : DWORD -> "dword"
# timeout : LDAP_TIMEVAL* optional -> "void*"
# res : LDAPMessage** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "wldap32" fn ldap_result(
    ld: [*c]LDAP, // LDAP* in/out
    msgid: u32, // DWORD
    all: u32, // DWORD
    timeout: [*c]LDAP_TIMEVAL, // LDAP_TIMEVAL* optional
    res: [*c][*c]LDAPMessage // LDAPMessage** out
) callconv(.c) u32;
proc ldap_result(
    ld: ptr LDAP,  # LDAP* in/out
    msgid: uint32,  # DWORD
    all: uint32,  # DWORD
    timeout: ptr LDAP_TIMEVAL,  # LDAP_TIMEVAL* optional
    res: ptr LDAPMessage  # LDAPMessage** out
): uint32 {.importc: "ldap_result", cdecl, dynlib: "WLDAP32.dll".}
pragma(lib, "wldap32");
extern(C)
uint ldap_result(
    LDAP* ld,   // LDAP* in/out
    uint msgid,   // DWORD
    uint all,   // DWORD
    LDAP_TIMEVAL* timeout,   // LDAP_TIMEVAL* optional
    LDAPMessage** res   // LDAPMessage** out
);
ccall((:ldap_result, "WLDAP32.dll"), UInt32,
      (Ptr{LDAP}, UInt32, UInt32, Ptr{LDAP_TIMEVAL}, Ptr{LDAPMessage}),
      ld, msgid, all, timeout, res)
# ld : LDAP* in/out -> Ptr{LDAP}
# msgid : DWORD -> UInt32
# all : DWORD -> UInt32
# timeout : LDAP_TIMEVAL* optional -> Ptr{LDAP_TIMEVAL}
# res : LDAPMessage** out -> Ptr{LDAPMessage}
local ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_result(
    void* ld,
    uint32_t msgid,
    uint32_t all,
    void* timeout,
    void* res);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_result(ld, msgid, all, timeout, res)
-- ld : LDAP* in/out
-- msgid : DWORD
-- all : DWORD
-- timeout : LDAP_TIMEVAL* optional
-- res : LDAPMessage** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_result = lib.func('__cdecl', 'ldap_result', 'uint32_t', ['void *', 'uint32_t', 'uint32_t', 'void *', 'void *']);
// ldap_result(ld, msgid, all, timeout, res)
// ld : LDAP* in/out -> 'void *'
// msgid : DWORD -> 'uint32_t'
// all : DWORD -> 'uint32_t'
// timeout : LDAP_TIMEVAL* optional -> 'void *'
// res : LDAPMessage** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WLDAP32.dll", {
  ldap_result: { parameters: ["pointer", "u32", "u32", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ldap_result(ld, msgid, all, timeout, res)
// ld : LDAP* in/out -> "pointer"
// msgid : DWORD -> "u32"
// all : DWORD -> "u32"
// timeout : LDAP_TIMEVAL* optional -> "pointer"
// res : LDAPMessage** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_result(
    void* ld,
    uint32_t msgid,
    uint32_t all,
    void* timeout,
    void* res);
C, "WLDAP32.dll");
// $ffi->ldap_result(ld, msgid, all, timeout, res);
// ld : LDAP* in/out
// msgid : DWORD
// all : DWORD
// timeout : LDAP_TIMEVAL* optional
// res : LDAPMessage** 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);
    int ldap_result(
        Pointer ld,   // LDAP* in/out
        int msgid,   // DWORD
        int all,   // DWORD
        Pointer timeout,   // LDAP_TIMEVAL* optional
        Pointer res   // LDAPMessage** out
    );
}
@[Link("wldap32")]
lib LibWLDAP32
  fun ldap_result = ldap_result(
    ld : LDAP*,   # LDAP* in/out
    msgid : UInt32,   # DWORD
    all : UInt32,   # DWORD
    timeout : LDAP_TIMEVAL*,   # LDAP_TIMEVAL* optional
    res : LDAPMessage**   # LDAPMessage** out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ldap_resultNative = Uint32 Function(Pointer<Void>, Uint32, Uint32, Pointer<Void>, Pointer<Void>);
typedef ldap_resultDart = int Function(Pointer<Void>, int, int, Pointer<Void>, Pointer<Void>);
final ldap_result = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ldap_resultNative, ldap_resultDart>('ldap_result');
// ld : LDAP* in/out -> Pointer<Void>
// msgid : DWORD -> Uint32
// all : DWORD -> Uint32
// timeout : LDAP_TIMEVAL* optional -> Pointer<Void>
// res : LDAPMessage** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ldap_result(
  ld: Pointer;   // LDAP* in/out
  msgid: DWORD;   // DWORD
  all: DWORD;   // DWORD
  timeout: Pointer;   // LDAP_TIMEVAL* optional
  res: Pointer   // LDAPMessage** out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_result';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ldap_result"
  c_ldap_result :: Ptr () -> Word32 -> Word32 -> Ptr () -> Ptr () -> IO Word32
-- ld : LDAP* in/out -> Ptr ()
-- msgid : DWORD -> Word32
-- all : DWORD -> Word32
-- timeout : LDAP_TIMEVAL* optional -> Ptr ()
-- res : LDAPMessage** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ldap_result =
  foreign "ldap_result"
    ((ptr void) @-> uint32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* ld : LDAP* in/out -> (ptr void) *)
(* msgid : DWORD -> uint32_t *)
(* all : DWORD -> uint32_t *)
(* timeout : LDAP_TIMEVAL* optional -> (ptr void) *)
(* res : LDAPMessage** 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_result" ldap-result :convention :cdecl) :uint32
  (ld :pointer)   ; LDAP* in/out
  (msgid :uint32)   ; DWORD
  (all :uint32)   ; DWORD
  (timeout :pointer)   ; LDAP_TIMEVAL* optional
  (res :pointer))   ; LDAPMessage** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ldap_result = Win32::API::More->new('WLDAP32',
    'DWORD ldap_result(LPVOID ld, DWORD msgid, DWORD all, LPVOID timeout, LPVOID res)');
# my $ret = $ldap_result->Call($ld, $msgid, $all, $timeout, $res);
# ld : LDAP* in/out -> LPVOID
# msgid : DWORD -> DWORD
# all : DWORD -> DWORD
# timeout : LDAP_TIMEVAL* optional -> LPVOID
# res : LDAPMessage** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型