ホーム › Networking.Ldap › ldap_check_filterA
ldap_check_filterA
関数LDAP検索フィルターの構文を検証する(ANSI版)。
シグネチャ
// WLDAP32.dll (ANSI / -A)
#include <windows.h>
DWORD ldap_check_filterA(
LDAP* ld,
LPSTR SearchFilter
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ld | LDAP* | inout | フィルター検証に用いるLDAPセッションハンドル。 |
| SearchFilter | LPSTR | in | 構文を検証する検索フィルター文字列(ANSI)。妥当性のみを確認する。 |
戻り値の型: DWORD
各言語での呼び出し定義
// WLDAP32.dll (ANSI / -A)
#include <windows.h>
DWORD ldap_check_filterA(
LDAP* ld,
LPSTR SearchFilter
);[DllImport("WLDAP32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint ldap_check_filterA(
IntPtr ld, // LDAP* in/out
[MarshalAs(UnmanagedType.LPStr)] string SearchFilter // LPSTR
);<DllImport("WLDAP32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ldap_check_filterA(
ld As IntPtr, ' LDAP* in/out
<MarshalAs(UnmanagedType.LPStr)> SearchFilter As String ' LPSTR
) As UInteger
End Function' ld : LDAP* in/out
' SearchFilter : LPSTR
Declare PtrSafe Function ldap_check_filterA Lib "wldap32" ( _
ByVal ld As LongPtr, _
ByVal SearchFilter As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ldap_check_filterA = ctypes.cdll.wldap32.ldap_check_filterA
ldap_check_filterA.restype = wintypes.DWORD
ldap_check_filterA.argtypes = [
ctypes.c_void_p, # ld : LDAP* in/out
wintypes.LPCSTR, # SearchFilter : LPSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WLDAP32.dll')
ldap_check_filterA = Fiddle::Function.new(
lib['ldap_check_filterA'],
[
Fiddle::TYPE_VOIDP, # ld : LDAP* in/out
Fiddle::TYPE_VOIDP, # SearchFilter : LPSTR
],
-Fiddle::TYPE_INT, Fiddle::Function::CDECL)#[link(name = "wldap32")]
extern "C" {
fn ldap_check_filterA(
ld: *mut LDAP, // LDAP* in/out
SearchFilter: *mut u8 // LPSTR
) -> 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_check_filterA(IntPtr ld, [MarshalAs(UnmanagedType.LPStr)] string SearchFilter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_check_filterA' -Namespace Win32 -PassThru
# $api::ldap_check_filterA(ld, SearchFilter)#uselib "WLDAP32.dll"
#func global ldap_check_filterA "ldap_check_filterA" sptr, sptr
; ldap_check_filterA varptr(ld), SearchFilter ; 戻り値は stat
; ld : LDAP* in/out -> "sptr"
; SearchFilter : LPSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WLDAP32.dll" #cfunc global ldap_check_filterA "ldap_check_filterA" var, str ; res = ldap_check_filterA(ld, SearchFilter) ; ld : LDAP* in/out -> "var" ; SearchFilter : LPSTR -> "str" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WLDAP32.dll" #cfunc global ldap_check_filterA "ldap_check_filterA" sptr, str ; res = ldap_check_filterA(varptr(ld), SearchFilter) ; ld : LDAP* in/out -> "sptr" ; SearchFilter : LPSTR -> "str" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD ldap_check_filterA(LDAP* ld, LPSTR SearchFilter) #uselib "WLDAP32.dll" #cfunc global ldap_check_filterA "ldap_check_filterA" var, str ; res = ldap_check_filterA(ld, SearchFilter) ; ld : LDAP* in/out -> "var" ; SearchFilter : LPSTR -> "str" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD ldap_check_filterA(LDAP* ld, LPSTR SearchFilter) #uselib "WLDAP32.dll" #cfunc global ldap_check_filterA "ldap_check_filterA" intptr, str ; res = ldap_check_filterA(varptr(ld), SearchFilter) ; ld : LDAP* in/out -> "intptr" ; SearchFilter : LPSTR -> "str" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
procldap_check_filterA = wldap32.NewProc("ldap_check_filterA")
)
// ld (LDAP* in/out), SearchFilter (LPSTR)
r1, _, err := procldap_check_filterA.Call(
uintptr(ld),
uintptr(unsafe.Pointer(windows.BytePtrFromString(SearchFilter))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ldap_check_filterA(
ld: Pointer; // LDAP* in/out
SearchFilter: PAnsiChar // LPSTR
): DWORD; cdecl;
external 'WLDAP32.dll' name 'ldap_check_filterA';result := DllCall("WLDAP32\ldap_check_filterA"
, "Ptr", ld ; LDAP* in/out
, "AStr", SearchFilter ; LPSTR
, "Cdecl UInt") ; return: DWORD●ldap_check_filterA(ld, SearchFilter) = DLL("WLDAP32.dll", "dword ldap_check_filterA(void*, char*)")
# 呼び出し: ldap_check_filterA(ld, SearchFilter)
# ld : LDAP* in/out -> "void*"
# SearchFilter : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。const std = @import("std");
extern "wldap32" fn ldap_check_filterA(
ld: [*c]LDAP, // LDAP* in/out
SearchFilter: [*c]const u8 // LPSTR
) callconv(.c) u32;proc ldap_check_filterA(
ld: ptr LDAP, # LDAP* in/out
SearchFilter: cstring # LPSTR
): uint32 {.importc: "ldap_check_filterA", cdecl, dynlib: "WLDAP32.dll".}pragma(lib, "wldap32");
extern(C)
uint ldap_check_filterA(
LDAP* ld, // LDAP* in/out
const(char)* SearchFilter // LPSTR
);ccall((:ldap_check_filterA, "WLDAP32.dll"), UInt32,
(Ptr{LDAP}, Cstring),
ld, SearchFilter)
# ld : LDAP* in/out -> Ptr{LDAP}
# SearchFilter : LPSTR -> Cstringlocal ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_check_filterA(
void* ld,
const char* SearchFilter);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_check_filterA(ld, SearchFilter)
-- ld : LDAP* in/out
-- SearchFilter : LPSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_check_filterA = lib.func('__cdecl', 'ldap_check_filterA', 'uint32_t', ['void *', 'str']);
// ldap_check_filterA(ld, SearchFilter)
// ld : LDAP* in/out -> 'void *'
// SearchFilter : LPSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WLDAP32.dll", {
ldap_check_filterA: { parameters: ["pointer", "buffer"], result: "u32" },
});
// lib.symbols.ldap_check_filterA(ld, SearchFilter)
// ld : LDAP* in/out -> "pointer"
// SearchFilter : LPSTR -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_check_filterA(
void* ld,
const char* SearchFilter);
C, "WLDAP32.dll");
// $ffi->ldap_check_filterA(ld, SearchFilter);
// ld : LDAP* in/out
// SearchFilter : LPSTR
// 構造体/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_check_filterA(
Pointer ld, // LDAP* in/out
String SearchFilter // LPSTR
);
}@[Link("wldap32")]
lib LibWLDAP32
fun ldap_check_filterA = ldap_check_filterA(
ld : LDAP*, # LDAP* in/out
SearchFilter : UInt8* # LPSTR
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ldap_check_filterANative = Uint32 Function(Pointer<Void>, Pointer<Utf8>);
typedef ldap_check_filterADart = int Function(Pointer<Void>, Pointer<Utf8>);
final ldap_check_filterA = DynamicLibrary.open('WLDAP32.dll')
.lookupFunction<ldap_check_filterANative, ldap_check_filterADart>('ldap_check_filterA');
// ld : LDAP* in/out -> Pointer<Void>
// SearchFilter : LPSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ldap_check_filterA(
ld: Pointer; // LDAP* in/out
SearchFilter: PAnsiChar // LPSTR
): DWORD; cdecl;
external 'WLDAP32.dll' name 'ldap_check_filterA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ldap_check_filterA"
c_ldap_check_filterA :: Ptr () -> CString -> IO Word32
-- ld : LDAP* in/out -> Ptr ()
-- SearchFilter : LPSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ldap_check_filtera =
foreign "ldap_check_filterA"
((ptr void) @-> string @-> returning uint32_t)
(* ld : LDAP* in/out -> (ptr void) *)
(* SearchFilter : LPSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wldap32 (t "WLDAP32.dll"))
(cffi:use-foreign-library wldap32)
(cffi:defcfun ("ldap_check_filterA" ldap-check-filter-a :convention :cdecl) :uint32
(ld :pointer) ; LDAP* in/out
(search-filter :string)) ; LPSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ldap_check_filterA = Win32::API::More->new('WLDAP32',
'DWORD ldap_check_filterA(LPVOID ld, LPCSTR SearchFilter)');
# my $ret = $ldap_check_filterA->Call($ld, $SearchFilter);
# ld : LDAP* in/out -> LPVOID
# SearchFilter : LPSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f ldap_check_filterW (Unicode版) — LDAP検索フィルターの構文を検証する(Unicode版)。
使用する型