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

ldap_parse_sort_controlA

関数
ソート結果コントロールを解析する(ANSI版)。
DLLWLDAP32.dll文字セットANSI (-A)呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

// WLDAP32.dll  (ANSI / -A)
#include <windows.h>

DWORD ldap_parse_sort_controlA(
    LDAP* ExternalHandle,
    LDAPControlA** Control,
    DWORD* Result,
    LPSTR* Attribute   // optional
);

パラメーター

名前方向説明
ExternalHandleLDAP*inout対象のLDAPセッションハンドル。応答を受信した接続を指す。
ControlLDAPControlA**inoutサーバから返されたコントロール配列。ソート結果コントロールを含む入力。
ResultDWORD*inoutソート操作の結果コードを受け取る出力先。LDAPエラーコードが格納される。
AttributeLPSTR*outoptionalソート失敗時の原因属性名を受け取る出力先(ANSI)。ldap_memfreeで解放。NULL可。

戻り値の型: DWORD

各言語での呼び出し定義

// WLDAP32.dll  (ANSI / -A)
#include <windows.h>

DWORD ldap_parse_sort_controlA(
    LDAP* ExternalHandle,
    LDAPControlA** Control,
    DWORD* Result,
    LPSTR* Attribute   // optional
);
[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_parse_sort_controlA(
    IntPtr ExternalHandle,   // LDAP* in/out
    IntPtr Control,   // LDAPControlA** in/out
    ref uint Result,   // DWORD* in/out
    IntPtr Attribute   // LPSTR* optional, out
);
<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_parse_sort_controlA(
    ExternalHandle As IntPtr,   ' LDAP* in/out
    Control As IntPtr,   ' LDAPControlA** in/out
    ByRef Result As UInteger,   ' DWORD* in/out
    Attribute As IntPtr   ' LPSTR* optional, out
) As UInteger
End Function
' ExternalHandle : LDAP* in/out
' Control : LDAPControlA** in/out
' Result : DWORD* in/out
' Attribute : LPSTR* optional, out
Declare PtrSafe Function ldap_parse_sort_controlA Lib "wldap32" ( _
    ByVal ExternalHandle As LongPtr, _
    ByVal Control As LongPtr, _
    ByRef Result As Long, _
    ByVal Attribute As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ldap_parse_sort_controlA = ctypes.cdll.wldap32.ldap_parse_sort_controlA
ldap_parse_sort_controlA.restype = wintypes.DWORD
ldap_parse_sort_controlA.argtypes = [
    ctypes.c_void_p,  # ExternalHandle : LDAP* in/out
    ctypes.c_void_p,  # Control : LDAPControlA** in/out
    ctypes.POINTER(wintypes.DWORD),  # Result : DWORD* in/out
    ctypes.c_void_p,  # Attribute : LPSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WLDAP32.dll')
ldap_parse_sort_controlA = Fiddle::Function.new(
  lib['ldap_parse_sort_controlA'],
  [
    Fiddle::TYPE_VOIDP,  # ExternalHandle : LDAP* in/out
    Fiddle::TYPE_VOIDP,  # Control : LDAPControlA** in/out
    Fiddle::TYPE_VOIDP,  # Result : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # Attribute : LPSTR* optional, out
  ],
  -Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "wldap32")]
extern "C" {
    fn ldap_parse_sort_controlA(
        ExternalHandle: *mut LDAP,  // LDAP* in/out
        Control: *mut *mut LDAPControlA,  // LDAPControlA** in/out
        Result: *mut u32,  // DWORD* in/out
        Attribute: *mut *mut u8  // LPSTR* optional, out
    ) -> 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_sort_controlA(IntPtr ExternalHandle, IntPtr Control, ref uint Result, IntPtr Attribute);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_parse_sort_controlA' -Namespace Win32 -PassThru
# $api::ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
#uselib "WLDAP32.dll"
#func global ldap_parse_sort_controlA "ldap_parse_sort_controlA" sptr, sptr, sptr, sptr
; ldap_parse_sort_controlA varptr(ExternalHandle), varptr(Control), varptr(Result), varptr(Attribute)   ; 戻り値は stat
; ExternalHandle : LDAP* in/out -> "sptr"
; Control : LDAPControlA** in/out -> "sptr"
; Result : DWORD* in/out -> "sptr"
; Attribute : LPSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WLDAP32.dll"
#cfunc global ldap_parse_sort_controlA "ldap_parse_sort_controlA" var, var, var, var
; res = ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
; ExternalHandle : LDAP* in/out -> "var"
; Control : LDAPControlA** in/out -> "var"
; Result : DWORD* in/out -> "var"
; Attribute : LPSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ldap_parse_sort_controlA(LDAP* ExternalHandle, LDAPControlA** Control, DWORD* Result, LPSTR* Attribute)
#uselib "WLDAP32.dll"
#cfunc global ldap_parse_sort_controlA "ldap_parse_sort_controlA" var, var, var, var
; res = ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
; ExternalHandle : LDAP* in/out -> "var"
; Control : LDAPControlA** in/out -> "var"
; Result : DWORD* in/out -> "var"
; Attribute : LPSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_parse_sort_controlA = wldap32.NewProc("ldap_parse_sort_controlA")
)

// ExternalHandle (LDAP* in/out), Control (LDAPControlA** in/out), Result (DWORD* in/out), Attribute (LPSTR* optional, out)
r1, _, err := procldap_parse_sort_controlA.Call(
	uintptr(ExternalHandle),
	uintptr(Control),
	uintptr(Result),
	uintptr(Attribute),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ldap_parse_sort_controlA(
  ExternalHandle: Pointer;   // LDAP* in/out
  Control: Pointer;   // LDAPControlA** in/out
  Result: Pointer;   // DWORD* in/out
  Attribute: PPAnsiChar   // LPSTR* optional, out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_parse_sort_controlA';
result := DllCall("WLDAP32\ldap_parse_sort_controlA"
    , "Ptr", ExternalHandle   ; LDAP* in/out
    , "Ptr", Control   ; LDAPControlA** in/out
    , "Ptr", Result   ; DWORD* in/out
    , "Ptr", Attribute   ; LPSTR* optional, out
    , "Cdecl UInt")   ; return: DWORD
●ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute) = DLL("WLDAP32.dll", "dword ldap_parse_sort_controlA(void*, void*, void*, void*)")
# 呼び出し: ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
# ExternalHandle : LDAP* in/out -> "void*"
# Control : LDAPControlA** in/out -> "void*"
# Result : DWORD* in/out -> "void*"
# Attribute : LPSTR* optional, 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_parse_sort_controlA(
    ExternalHandle: [*c]LDAP, // LDAP* in/out
    Control: [*c][*c]LDAPControlA, // LDAPControlA** in/out
    Result: [*c]u32, // DWORD* in/out
    Attribute: [*c][*c]u8 // LPSTR* optional, out
) callconv(.c) u32;
proc ldap_parse_sort_controlA(
    ExternalHandle: ptr LDAP,  # LDAP* in/out
    Control: ptr LDAPControlA,  # LDAPControlA** in/out
    Result: ptr uint32,  # DWORD* in/out
    Attribute: ptr cstring  # LPSTR* optional, out
): uint32 {.importc: "ldap_parse_sort_controlA", cdecl, dynlib: "WLDAP32.dll".}
pragma(lib, "wldap32");
extern(C)
uint ldap_parse_sort_controlA(
    LDAP* ExternalHandle,   // LDAP* in/out
    LDAPControlA** Control,   // LDAPControlA** in/out
    uint* Result,   // DWORD* in/out
    char** Attribute   // LPSTR* optional, out
);
ccall((:ldap_parse_sort_controlA, "WLDAP32.dll"), UInt32,
      (Ptr{LDAP}, Ptr{LDAPControlA}, Ptr{UInt32}, Ptr{Ptr{UInt8}}),
      ExternalHandle, Control, Result, Attribute)
# ExternalHandle : LDAP* in/out -> Ptr{LDAP}
# Control : LDAPControlA** in/out -> Ptr{LDAPControlA}
# Result : DWORD* in/out -> Ptr{UInt32}
# Attribute : LPSTR* optional, out -> Ptr{Ptr{UInt8}}
local ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_parse_sort_controlA(
    void* ExternalHandle,
    void* Control,
    uint32_t* Result,
    char** Attribute);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
-- ExternalHandle : LDAP* in/out
-- Control : LDAPControlA** in/out
-- Result : DWORD* in/out
-- Attribute : LPSTR* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_parse_sort_controlA = lib.func('__cdecl', 'ldap_parse_sort_controlA', 'uint32_t', ['void *', 'void *', 'uint32_t *', 'void *']);
// ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
// ExternalHandle : LDAP* in/out -> 'void *'
// Control : LDAPControlA** in/out -> 'void *'
// Result : DWORD* in/out -> 'uint32_t *'
// Attribute : LPSTR* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WLDAP32.dll", {
  ldap_parse_sort_controlA: { parameters: ["pointer", "pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute)
// ExternalHandle : LDAP* in/out -> "pointer"
// Control : LDAPControlA** in/out -> "pointer"
// Result : DWORD* in/out -> "pointer"
// Attribute : LPSTR* optional, out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_parse_sort_controlA(
    void* ExternalHandle,
    void* Control,
    uint32_t* Result,
    char** Attribute);
C, "WLDAP32.dll");
// $ffi->ldap_parse_sort_controlA(ExternalHandle, Control, Result, Attribute);
// ExternalHandle : LDAP* in/out
// Control : LDAPControlA** in/out
// Result : DWORD* in/out
// Attribute : LPSTR* optional, 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.ASCII_OPTIONS);
    int ldap_parse_sort_controlA(
        Pointer ExternalHandle,   // LDAP* in/out
        Pointer Control,   // LDAPControlA** in/out
        IntByReference Result,   // DWORD* in/out
        PointerByReference Attribute   // LPSTR* optional, out
    );
}
@[Link("wldap32")]
lib LibWLDAP32
  fun ldap_parse_sort_controlA = ldap_parse_sort_controlA(
    ExternalHandle : LDAP*,   # LDAP* in/out
    Control : LDAPControlA**,   # LDAPControlA** in/out
    Result : UInt32*,   # DWORD* in/out
    Attribute : UInt8**   # LPSTR* optional, out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ldap_parse_sort_controlANative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Uint32>, Pointer<Pointer<Utf8>>);
typedef ldap_parse_sort_controlADart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Uint32>, Pointer<Pointer<Utf8>>);
final ldap_parse_sort_controlA = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ldap_parse_sort_controlANative, ldap_parse_sort_controlADart>('ldap_parse_sort_controlA');
// ExternalHandle : LDAP* in/out -> Pointer<Void>
// Control : LDAPControlA** in/out -> Pointer<Void>
// Result : DWORD* in/out -> Pointer<Uint32>
// Attribute : LPSTR* optional, out -> Pointer<Pointer<Utf8>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ldap_parse_sort_controlA(
  ExternalHandle: Pointer;   // LDAP* in/out
  Control: Pointer;   // LDAPControlA** in/out
  Result: Pointer;   // DWORD* in/out
  Attribute: PPAnsiChar   // LPSTR* optional, out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_parse_sort_controlA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ldap_parse_sort_controlA"
  c_ldap_parse_sort_controlA :: Ptr () -> Ptr () -> Ptr Word32 -> Ptr CString -> IO Word32
-- ExternalHandle : LDAP* in/out -> Ptr ()
-- Control : LDAPControlA** in/out -> Ptr ()
-- Result : DWORD* in/out -> Ptr Word32
-- Attribute : LPSTR* optional, out -> Ptr CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ldap_parse_sort_controla =
  foreign "ldap_parse_sort_controlA"
    ((ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> (ptr string) @-> returning uint32_t)
(* ExternalHandle : LDAP* in/out -> (ptr void) *)
(* Control : LDAPControlA** in/out -> (ptr void) *)
(* Result : DWORD* in/out -> (ptr uint32_t) *)
(* Attribute : LPSTR* optional, out -> (ptr string) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wldap32 (t "WLDAP32.dll"))
(cffi:use-foreign-library wldap32)

(cffi:defcfun ("ldap_parse_sort_controlA" ldap-parse-sort-control-a :convention :cdecl) :uint32
  (external-handle :pointer)   ; LDAP* in/out
  (control :pointer)   ; LDAPControlA** in/out
  (result :pointer)   ; DWORD* in/out
  (attribute :pointer))   ; LPSTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ldap_parse_sort_controlA = Win32::API::More->new('WLDAP32',
    'DWORD ldap_parse_sort_controlA(LPVOID ExternalHandle, LPVOID Control, LPVOID Result, LPVOID Attribute)');
# my $ret = $ldap_parse_sort_controlA->Call($ExternalHandle, $Control, $Result, $Attribute);
# ExternalHandle : LDAP* in/out -> LPVOID
# Control : LDAPControlA** in/out -> LPVOID
# Result : DWORD* in/out -> LPVOID
# Attribute : LPSTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い
使用する型