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

ldap_get_next_page_s

関数
ページ検索で次のページを同期的に取得する。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

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

DWORD ldap_get_next_page_s(
    LDAP* ExternalHandle,
    PLDAPSearch SearchHandle,
    LDAP_TIMEVAL* timeout,
    DWORD PageSize,
    DWORD* TotalCount,
    LDAPMessage** Results
);

パラメーター

名前方向説明
ExternalHandleLDAP*inout対象のLDAPセッションハンドル。ページ検索を実行中の接続を指す。
SearchHandlePLDAPSearchinldap_search_init_pageで取得した検索ブロックハンドル。ページ状態を保持する。
timeoutLDAP_TIMEVAL*inout応答待ちのタイムアウト値(timeval構造体)。NULLで無制限待機。
PageSizeDWORDin今回取得するページのエントリ数。1ページ分の件数を指定する。
TotalCountDWORD*inoutサーバ見積もりの総エントリ数を受け取る出力先。
ResultsLDAPMessage**inout取得したページの結果メッセージを受け取る出力先。ldap_msgfreeで解放する。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ldap_get_next_page_s = ctypes.cdll.wldap32.ldap_get_next_page_s
ldap_get_next_page_s.restype = wintypes.DWORD
ldap_get_next_page_s.argtypes = [
    ctypes.c_void_p,  # ExternalHandle : LDAP* in/out
    ctypes.c_ssize_t,  # SearchHandle : PLDAPSearch
    ctypes.c_void_p,  # timeout : LDAP_TIMEVAL* in/out
    wintypes.DWORD,  # PageSize : DWORD
    ctypes.POINTER(wintypes.DWORD),  # TotalCount : DWORD* in/out
    ctypes.c_void_p,  # Results : LDAPMessage** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_get_next_page_s = wldap32.NewProc("ldap_get_next_page_s")
)

// ExternalHandle (LDAP* in/out), SearchHandle (PLDAPSearch), timeout (LDAP_TIMEVAL* in/out), PageSize (DWORD), TotalCount (DWORD* in/out), Results (LDAPMessage** in/out)
r1, _, err := procldap_get_next_page_s.Call(
	uintptr(ExternalHandle),
	uintptr(SearchHandle),
	uintptr(timeout),
	uintptr(PageSize),
	uintptr(TotalCount),
	uintptr(Results),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ldap_get_next_page_s(
  ExternalHandle: Pointer;   // LDAP* in/out
  SearchHandle: NativeInt;   // PLDAPSearch
  timeout: Pointer;   // LDAP_TIMEVAL* in/out
  PageSize: DWORD;   // DWORD
  TotalCount: Pointer;   // DWORD* in/out
  Results: Pointer   // LDAPMessage** in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_get_next_page_s';
result := DllCall("WLDAP32\ldap_get_next_page_s"
    , "Ptr", ExternalHandle   ; LDAP* in/out
    , "Ptr", SearchHandle   ; PLDAPSearch
    , "Ptr", timeout   ; LDAP_TIMEVAL* in/out
    , "UInt", PageSize   ; DWORD
    , "Ptr", TotalCount   ; DWORD* in/out
    , "Ptr", Results   ; LDAPMessage** in/out
    , "Cdecl UInt")   ; return: DWORD
●ldap_get_next_page_s(ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results) = DLL("WLDAP32.dll", "dword ldap_get_next_page_s(void*, int, void*, dword, void*, void*)")
# 呼び出し: ldap_get_next_page_s(ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results)
# ExternalHandle : LDAP* in/out -> "void*"
# SearchHandle : PLDAPSearch -> "int"
# timeout : LDAP_TIMEVAL* in/out -> "void*"
# PageSize : DWORD -> "dword"
# TotalCount : DWORD* in/out -> "void*"
# Results : LDAPMessage** in/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_get_next_page_s(
    ExternalHandle: [*c]LDAP, // LDAP* in/out
    SearchHandle: isize, // PLDAPSearch
    timeout: [*c]LDAP_TIMEVAL, // LDAP_TIMEVAL* in/out
    PageSize: u32, // DWORD
    TotalCount: [*c]u32, // DWORD* in/out
    Results: [*c][*c]LDAPMessage // LDAPMessage** in/out
) callconv(.c) u32;
proc ldap_get_next_page_s(
    ExternalHandle: ptr LDAP,  # LDAP* in/out
    SearchHandle: int,  # PLDAPSearch
    timeout: ptr LDAP_TIMEVAL,  # LDAP_TIMEVAL* in/out
    PageSize: uint32,  # DWORD
    TotalCount: ptr uint32,  # DWORD* in/out
    Results: ptr LDAPMessage  # LDAPMessage** in/out
): uint32 {.importc: "ldap_get_next_page_s", cdecl, dynlib: "WLDAP32.dll".}
pragma(lib, "wldap32");
extern(C)
uint ldap_get_next_page_s(
    LDAP* ExternalHandle,   // LDAP* in/out
    ptrdiff_t SearchHandle,   // PLDAPSearch
    LDAP_TIMEVAL* timeout,   // LDAP_TIMEVAL* in/out
    uint PageSize,   // DWORD
    uint* TotalCount,   // DWORD* in/out
    LDAPMessage** Results   // LDAPMessage** in/out
);
ccall((:ldap_get_next_page_s, "WLDAP32.dll"), UInt32,
      (Ptr{LDAP}, Int, Ptr{LDAP_TIMEVAL}, UInt32, Ptr{UInt32}, Ptr{LDAPMessage}),
      ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results)
# ExternalHandle : LDAP* in/out -> Ptr{LDAP}
# SearchHandle : PLDAPSearch -> Int
# timeout : LDAP_TIMEVAL* in/out -> Ptr{LDAP_TIMEVAL}
# PageSize : DWORD -> UInt32
# TotalCount : DWORD* in/out -> Ptr{UInt32}
# Results : LDAPMessage** in/out -> Ptr{LDAPMessage}
local ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_get_next_page_s(
    void* ExternalHandle,
    intptr_t SearchHandle,
    void* timeout,
    uint32_t PageSize,
    uint32_t* TotalCount,
    void* Results);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_get_next_page_s(ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results)
-- ExternalHandle : LDAP* in/out
-- SearchHandle : PLDAPSearch
-- timeout : LDAP_TIMEVAL* in/out
-- PageSize : DWORD
-- TotalCount : DWORD* in/out
-- Results : LDAPMessage** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_get_next_page_s = lib.func('__cdecl', 'ldap_get_next_page_s', 'uint32_t', ['void *', 'intptr_t', 'void *', 'uint32_t', 'uint32_t *', 'void *']);
// ldap_get_next_page_s(ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results)
// ExternalHandle : LDAP* in/out -> 'void *'
// SearchHandle : PLDAPSearch -> 'intptr_t'
// timeout : LDAP_TIMEVAL* in/out -> 'void *'
// PageSize : DWORD -> 'uint32_t'
// TotalCount : DWORD* in/out -> 'uint32_t *'
// Results : LDAPMessage** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WLDAP32.dll", {
  ldap_get_next_page_s: { parameters: ["pointer", "isize", "pointer", "u32", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ldap_get_next_page_s(ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results)
// ExternalHandle : LDAP* in/out -> "pointer"
// SearchHandle : PLDAPSearch -> "isize"
// timeout : LDAP_TIMEVAL* in/out -> "pointer"
// PageSize : DWORD -> "u32"
// TotalCount : DWORD* in/out -> "pointer"
// Results : LDAPMessage** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_get_next_page_s(
    void* ExternalHandle,
    intptr_t SearchHandle,
    void* timeout,
    uint32_t PageSize,
    uint32_t* TotalCount,
    void* Results);
C, "WLDAP32.dll");
// $ffi->ldap_get_next_page_s(ExternalHandle, SearchHandle, timeout, PageSize, TotalCount, Results);
// ExternalHandle : LDAP* in/out
// SearchHandle : PLDAPSearch
// timeout : LDAP_TIMEVAL* in/out
// PageSize : DWORD
// TotalCount : DWORD* in/out
// Results : LDAPMessage** 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);
    int ldap_get_next_page_s(
        Pointer ExternalHandle,   // LDAP* in/out
        long SearchHandle,   // PLDAPSearch
        Pointer timeout,   // LDAP_TIMEVAL* in/out
        int PageSize,   // DWORD
        IntByReference TotalCount,   // DWORD* in/out
        Pointer Results   // LDAPMessage** in/out
    );
}
@[Link("wldap32")]
lib LibWLDAP32
  fun ldap_get_next_page_s = ldap_get_next_page_s(
    ExternalHandle : LDAP*,   # LDAP* in/out
    SearchHandle : LibC::SSizeT,   # PLDAPSearch
    timeout : LDAP_TIMEVAL*,   # LDAP_TIMEVAL* in/out
    PageSize : UInt32,   # DWORD
    TotalCount : UInt32*,   # DWORD* in/out
    Results : LDAPMessage**   # LDAPMessage** in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ldap_get_next_page_sNative = Uint32 Function(Pointer<Void>, IntPtr, Pointer<Void>, Uint32, Pointer<Uint32>, Pointer<Void>);
typedef ldap_get_next_page_sDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Uint32>, Pointer<Void>);
final ldap_get_next_page_s = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ldap_get_next_page_sNative, ldap_get_next_page_sDart>('ldap_get_next_page_s');
// ExternalHandle : LDAP* in/out -> Pointer<Void>
// SearchHandle : PLDAPSearch -> IntPtr
// timeout : LDAP_TIMEVAL* in/out -> Pointer<Void>
// PageSize : DWORD -> Uint32
// TotalCount : DWORD* in/out -> Pointer<Uint32>
// Results : LDAPMessage** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ldap_get_next_page_s(
  ExternalHandle: Pointer;   // LDAP* in/out
  SearchHandle: NativeInt;   // PLDAPSearch
  timeout: Pointer;   // LDAP_TIMEVAL* in/out
  PageSize: DWORD;   // DWORD
  TotalCount: Pointer;   // DWORD* in/out
  Results: Pointer   // LDAPMessage** in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_get_next_page_s';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ldap_get_next_page_s"
  c_ldap_get_next_page_s :: Ptr () -> CIntPtr -> Ptr () -> Word32 -> Ptr Word32 -> Ptr () -> IO Word32
-- ExternalHandle : LDAP* in/out -> Ptr ()
-- SearchHandle : PLDAPSearch -> CIntPtr
-- timeout : LDAP_TIMEVAL* in/out -> Ptr ()
-- PageSize : DWORD -> Word32
-- TotalCount : DWORD* in/out -> Ptr Word32
-- Results : LDAPMessage** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ldap_get_next_page_s =
  foreign "ldap_get_next_page_s"
    ((ptr void) @-> intptr_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> (ptr void) @-> returning uint32_t)
(* ExternalHandle : LDAP* in/out -> (ptr void) *)
(* SearchHandle : PLDAPSearch -> intptr_t *)
(* timeout : LDAP_TIMEVAL* in/out -> (ptr void) *)
(* PageSize : DWORD -> uint32_t *)
(* TotalCount : DWORD* in/out -> (ptr uint32_t) *)
(* Results : LDAPMessage** 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_get_next_page_s" ldap-get-next-page-s :convention :cdecl) :uint32
  (external-handle :pointer)   ; LDAP* in/out
  (search-handle :int64)   ; PLDAPSearch
  (timeout :pointer)   ; LDAP_TIMEVAL* in/out
  (page-size :uint32)   ; DWORD
  (total-count :pointer)   ; DWORD* in/out
  (results :pointer))   ; LDAPMessage** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ldap_get_next_page_s = Win32::API::More->new('WLDAP32',
    'DWORD ldap_get_next_page_s(LPVOID ExternalHandle, LPARAM SearchHandle, LPVOID timeout, DWORD PageSize, LPVOID TotalCount, LPVOID Results)');
# my $ret = $ldap_get_next_page_s->Call($ExternalHandle, $SearchHandle, $timeout, $PageSize, $TotalCount, $Results);
# ExternalHandle : LDAP* in/out -> LPVOID
# SearchHandle : PLDAPSearch -> LPARAM
# timeout : LDAP_TIMEVAL* in/out -> LPVOID
# PageSize : DWORD -> DWORD
# TotalCount : DWORD* in/out -> LPVOID
# Results : LDAPMessage** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型