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

ldap_create_vlv_controlA

関数
仮想リストビュー用のLDAPコントロールを作成する(ANSI版)。
DLLWLDAP32.dll文字セットANSI (-A)呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

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

INT ldap_create_vlv_controlA(
    LDAP* ExternalHandle,
    LDAPVLVInfo* VlvInfo,
    BYTE IsCritical,
    LDAPControlA** Control
);

パラメーター

名前方向説明
ExternalHandleLDAP*inout対象のLDAPセッションハンドル。VLVコントロールを作成する接続を指す。
VlvInfoLDAPVLVInfo*inout仮想リストビューの位置・範囲情報を持つLDAPVLVInfo構造体へのポインタ。
IsCriticalBYTEin0以外ならこのコントロールを必須(クリティカル)として扱う真偽フラグ。
ControlLDAPControlA**inout生成されたVLVコントロールを受け取る出力先。ldap_control_freeで解放する。

戻り値の型: INT

各言語での呼び出し定義

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

INT ldap_create_vlv_controlA(
    LDAP* ExternalHandle,
    LDAPVLVInfo* VlvInfo,
    BYTE IsCritical,
    LDAPControlA** Control
);
[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ldap_create_vlv_controlA(
    IntPtr ExternalHandle,   // LDAP* in/out
    IntPtr VlvInfo,   // LDAPVLVInfo* in/out
    byte IsCritical,   // BYTE
    IntPtr Control   // LDAPControlA** in/out
);
<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_create_vlv_controlA(
    ExternalHandle As IntPtr,   ' LDAP* in/out
    VlvInfo As IntPtr,   ' LDAPVLVInfo* in/out
    IsCritical As Byte,   ' BYTE
    Control As IntPtr   ' LDAPControlA** in/out
) As Integer
End Function
' ExternalHandle : LDAP* in/out
' VlvInfo : LDAPVLVInfo* in/out
' IsCritical : BYTE
' Control : LDAPControlA** in/out
Declare PtrSafe Function ldap_create_vlv_controlA Lib "wldap32" ( _
    ByVal ExternalHandle As LongPtr, _
    ByVal VlvInfo As LongPtr, _
    ByVal IsCritical As Byte, _
    ByVal Control As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ldap_create_vlv_controlA = ctypes.cdll.wldap32.ldap_create_vlv_controlA
ldap_create_vlv_controlA.restype = ctypes.c_int
ldap_create_vlv_controlA.argtypes = [
    ctypes.c_void_p,  # ExternalHandle : LDAP* in/out
    ctypes.c_void_p,  # VlvInfo : LDAPVLVInfo* in/out
    ctypes.c_ubyte,  # IsCritical : BYTE
    ctypes.c_void_p,  # Control : LDAPControlA** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_create_vlv_controlA = wldap32.NewProc("ldap_create_vlv_controlA")
)

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

typedef ldap_create_vlv_controlANative = Int32 Function(Pointer<Void>, Pointer<Void>, Uint8, Pointer<Void>);
typedef ldap_create_vlv_controlADart = int Function(Pointer<Void>, Pointer<Void>, int, Pointer<Void>);
final ldap_create_vlv_controlA = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ldap_create_vlv_controlANative, ldap_create_vlv_controlADart>('ldap_create_vlv_controlA');
// ExternalHandle : LDAP* in/out -> Pointer<Void>
// VlvInfo : LDAPVLVInfo* in/out -> Pointer<Void>
// IsCritical : BYTE -> Uint8
// Control : LDAPControlA** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ldap_create_vlv_controlA(
  ExternalHandle: Pointer;   // LDAP* in/out
  VlvInfo: Pointer;   // LDAPVLVInfo* in/out
  IsCritical: Byte;   // BYTE
  Control: Pointer   // LDAPControlA** in/out
): Integer; cdecl;
  external 'WLDAP32.dll' name 'ldap_create_vlv_controlA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ldap_create_vlv_controlA"
  c_ldap_create_vlv_controlA :: Ptr () -> Ptr () -> Word8 -> Ptr () -> IO Int32
-- ExternalHandle : LDAP* in/out -> Ptr ()
-- VlvInfo : LDAPVLVInfo* in/out -> Ptr ()
-- IsCritical : BYTE -> Word8
-- Control : LDAPControlA** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ldap_create_vlv_controla =
  foreign "ldap_create_vlv_controlA"
    ((ptr void) @-> (ptr void) @-> uint8_t @-> (ptr void) @-> returning int32_t)
(* ExternalHandle : LDAP* in/out -> (ptr void) *)
(* VlvInfo : LDAPVLVInfo* in/out -> (ptr void) *)
(* IsCritical : BYTE -> uint8_t *)
(* Control : LDAPControlA** 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_create_vlv_controlA" ldap-create-vlv-control-a :convention :cdecl) :int32
  (external-handle :pointer)   ; LDAP* in/out
  (vlv-info :pointer)   ; LDAPVLVInfo* in/out
  (is-critical :uint8)   ; BYTE
  (control :pointer))   ; LDAPControlA** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ldap_create_vlv_controlA = Win32::API::More->new('WLDAP32',
    'int ldap_create_vlv_controlA(LPVOID ExternalHandle, LPVOID VlvInfo, BYTE IsCritical, LPVOID Control)');
# my $ret = $ldap_create_vlv_controlA->Call($ExternalHandle, $VlvInfo, $IsCritical, $Control);
# ExternalHandle : LDAP* in/out -> LPVOID
# VlvInfo : LDAPVLVInfo* in/out -> LPVOID
# IsCritical : BYTE -> BYTE
# Control : LDAPControlA** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

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