ホーム › Networking.Ldap › ldap_encode_sort_controlA
ldap_encode_sort_controlA
関数ソートキーをLDAPソートコントロールにエンコードする(ANSI版)。
シグネチャ
// WLDAP32.dll (ANSI / -A)
#include <windows.h>
DWORD ldap_encode_sort_controlA(
LDAP* ExternalHandle,
LDAPSortKeyA** SortKeys,
LDAPControlA* Control,
BOOLEAN Criticality
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ExternalHandle | LDAP* | inout |
| SortKeys | LDAPSortKeyA** | inout |
| Control | LDAPControlA* | inout |
| Criticality | BOOLEAN | in |
戻り値の型: DWORD
各言語での呼び出し定義
// WLDAP32.dll (ANSI / -A)
#include <windows.h>
DWORD ldap_encode_sort_controlA(
LDAP* ExternalHandle,
LDAPSortKeyA** SortKeys,
LDAPControlA* Control,
BOOLEAN Criticality
);[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_encode_sort_controlA(
IntPtr ExternalHandle, // LDAP* in/out
IntPtr SortKeys, // LDAPSortKeyA** in/out
IntPtr Control, // LDAPControlA* in/out
[MarshalAs(UnmanagedType.U1)] bool Criticality // BOOLEAN
);<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_encode_sort_controlA(
ExternalHandle As IntPtr, ' LDAP* in/out
SortKeys As IntPtr, ' LDAPSortKeyA** in/out
Control As IntPtr, ' LDAPControlA* in/out
<MarshalAs(UnmanagedType.U1)> Criticality As Boolean ' BOOLEAN
) As UInteger
End Function' ExternalHandle : LDAP* in/out
' SortKeys : LDAPSortKeyA** in/out
' Control : LDAPControlA* in/out
' Criticality : BOOLEAN
Declare PtrSafe Function ldap_encode_sort_controlA Lib "wldap32" ( _
ByVal ExternalHandle As LongPtr, _
ByVal SortKeys As LongPtr, _
ByVal Control As LongPtr, _
ByVal Criticality As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ldap_encode_sort_controlA = ctypes.cdll.wldap32.ldap_encode_sort_controlA
ldap_encode_sort_controlA.restype = wintypes.DWORD
ldap_encode_sort_controlA.argtypes = [
ctypes.c_void_p, # ExternalHandle : LDAP* in/out
ctypes.c_void_p, # SortKeys : LDAPSortKeyA** in/out
ctypes.c_void_p, # Control : LDAPControlA* in/out
ctypes.c_byte, # Criticality : BOOLEAN
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WLDAP32.dll')
ldap_encode_sort_controlA = Fiddle::Function.new(
lib['ldap_encode_sort_controlA'],
[
Fiddle::TYPE_VOIDP, # ExternalHandle : LDAP* in/out
Fiddle::TYPE_VOIDP, # SortKeys : LDAPSortKeyA** in/out
Fiddle::TYPE_VOIDP, # Control : LDAPControlA* in/out
Fiddle::TYPE_CHAR, # Criticality : BOOLEAN
],
-Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "wldap32")]
extern "C" {
fn ldap_encode_sort_controlA(
ExternalHandle: *mut LDAP, // LDAP* in/out
SortKeys: *mut *mut LDAPSortKeyA, // LDAPSortKeyA** in/out
Control: *mut LDAPControlA, // LDAPControlA* in/out
Criticality: 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_encode_sort_controlA(IntPtr ExternalHandle, IntPtr SortKeys, IntPtr Control, [MarshalAs(UnmanagedType.U1)] bool Criticality);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_encode_sort_controlA' -Namespace Win32 -PassThru
# $api::ldap_encode_sort_controlA(ExternalHandle, SortKeys, Control, Criticality)#uselib "WLDAP32.dll"
#func global ldap_encode_sort_controlA "ldap_encode_sort_controlA" sptr, sptr, sptr, sptr
; ldap_encode_sort_controlA varptr(ExternalHandle), varptr(SortKeys), varptr(Control), Criticality ; 戻り値は stat
; ExternalHandle : LDAP* in/out -> "sptr"
; SortKeys : LDAPSortKeyA** in/out -> "sptr"
; Control : LDAPControlA* in/out -> "sptr"
; Criticality : BOOLEAN -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WLDAP32.dll" #cfunc global ldap_encode_sort_controlA "ldap_encode_sort_controlA" var, var, var, int ; res = ldap_encode_sort_controlA(ExternalHandle, SortKeys, Control, Criticality) ; ExternalHandle : LDAP* in/out -> "var" ; SortKeys : LDAPSortKeyA** in/out -> "var" ; Control : LDAPControlA* in/out -> "var" ; Criticality : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WLDAP32.dll" #cfunc global ldap_encode_sort_controlA "ldap_encode_sort_controlA" sptr, sptr, sptr, int ; res = ldap_encode_sort_controlA(varptr(ExternalHandle), varptr(SortKeys), varptr(Control), Criticality) ; ExternalHandle : LDAP* in/out -> "sptr" ; SortKeys : LDAPSortKeyA** in/out -> "sptr" ; Control : LDAPControlA* in/out -> "sptr" ; Criticality : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ldap_encode_sort_controlA(LDAP* ExternalHandle, LDAPSortKeyA** SortKeys, LDAPControlA* Control, BOOLEAN Criticality) #uselib "WLDAP32.dll" #cfunc global ldap_encode_sort_controlA "ldap_encode_sort_controlA" var, var, var, int ; res = ldap_encode_sort_controlA(ExternalHandle, SortKeys, Control, Criticality) ; ExternalHandle : LDAP* in/out -> "var" ; SortKeys : LDAPSortKeyA** in/out -> "var" ; Control : LDAPControlA* in/out -> "var" ; Criticality : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ldap_encode_sort_controlA(LDAP* ExternalHandle, LDAPSortKeyA** SortKeys, LDAPControlA* Control, BOOLEAN Criticality) #uselib "WLDAP32.dll" #cfunc global ldap_encode_sort_controlA "ldap_encode_sort_controlA" intptr, intptr, intptr, int ; res = ldap_encode_sort_controlA(varptr(ExternalHandle), varptr(SortKeys), varptr(Control), Criticality) ; ExternalHandle : LDAP* in/out -> "intptr" ; SortKeys : LDAPSortKeyA** in/out -> "intptr" ; Control : LDAPControlA* in/out -> "intptr" ; Criticality : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
procldap_encode_sort_controlA = wldap32.NewProc("ldap_encode_sort_controlA")
)
// ExternalHandle (LDAP* in/out), SortKeys (LDAPSortKeyA** in/out), Control (LDAPControlA* in/out), Criticality (BOOLEAN)
r1, _, err := procldap_encode_sort_controlA.Call(
uintptr(ExternalHandle),
uintptr(SortKeys),
uintptr(Control),
uintptr(Criticality),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ldap_encode_sort_controlA(
ExternalHandle: Pointer; // LDAP* in/out
SortKeys: Pointer; // LDAPSortKeyA** in/out
Control: Pointer; // LDAPControlA* in/out
Criticality: ByteBool // BOOLEAN
): DWORD; cdecl;
external 'WLDAP32.dll' name 'ldap_encode_sort_controlA';result := DllCall("WLDAP32\ldap_encode_sort_controlA"
, "Ptr", ExternalHandle ; LDAP* in/out
, "Ptr", SortKeys ; LDAPSortKeyA** in/out
, "Ptr", Control ; LDAPControlA* in/out
, "Char", Criticality ; BOOLEAN
, "Cdecl UInt") ; return: DWORD●ldap_encode_sort_controlA(ExternalHandle, SortKeys, Control, Criticality) = DLL("WLDAP32.dll", "dword ldap_encode_sort_controlA(void*, void*, void*, byte)")
# 呼び出し: ldap_encode_sort_controlA(ExternalHandle, SortKeys, Control, Criticality)
# ExternalHandle : LDAP* in/out -> "void*"
# SortKeys : LDAPSortKeyA** in/out -> "void*"
# Control : LDAPControlA* in/out -> "void*"
# Criticality : BOOLEAN -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。