ホーム › Networking.Ldap › ldap_set_dbg_routine
ldap_set_dbg_routine
関数LDAPのデバッグ出力用コールバック関数を登録する。
シグネチャ
// WLDAP32.dll
#include <windows.h>
void ldap_set_dbg_routine(
DBGPRINT DebugPrintRoutine
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| DebugPrintRoutine | DBGPRINT | in | デバッグ出力を受け取るコールバック関数(DBGPRINT)へのポインタ。printf風に呼ばれる。 |
戻り値の型: void
各言語での呼び出し定義
// WLDAP32.dll
#include <windows.h>
void ldap_set_dbg_routine(
DBGPRINT DebugPrintRoutine
);[DllImport("WLDAP32.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ldap_set_dbg_routine(
IntPtr DebugPrintRoutine // DBGPRINT
);<DllImport("WLDAP32.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ldap_set_dbg_routine(
DebugPrintRoutine As IntPtr ' DBGPRINT
)
End Sub' DebugPrintRoutine : DBGPRINT
Declare PtrSafe Sub ldap_set_dbg_routine Lib "wldap32" ( _
ByVal DebugPrintRoutine As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ldap_set_dbg_routine = ctypes.cdll.wldap32.ldap_set_dbg_routine
ldap_set_dbg_routine.restype = None
ldap_set_dbg_routine.argtypes = [
ctypes.c_void_p, # DebugPrintRoutine : DBGPRINT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WLDAP32.dll')
ldap_set_dbg_routine = Fiddle::Function.new(
lib['ldap_set_dbg_routine'],
[
Fiddle::TYPE_VOIDP, # DebugPrintRoutine : DBGPRINT
],
Fiddle::TYPE_VOID, Fiddle::Function::CDECL)#[link(name = "wldap32")]
extern "C" {
fn ldap_set_dbg_routine(
DebugPrintRoutine: *const core::ffi::c_void // DBGPRINT
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WLDAP32.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ldap_set_dbg_routine(IntPtr DebugPrintRoutine);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_ldap_set_dbg_routine' -Namespace Win32 -PassThru
# $api::ldap_set_dbg_routine(DebugPrintRoutine)#uselib "WLDAP32.dll"
#func global ldap_set_dbg_routine "ldap_set_dbg_routine" sptr
; ldap_set_dbg_routine DebugPrintRoutine
; DebugPrintRoutine : DBGPRINT -> "sptr"#uselib "WLDAP32.dll"
#func global ldap_set_dbg_routine "ldap_set_dbg_routine" sptr
; ldap_set_dbg_routine DebugPrintRoutine
; DebugPrintRoutine : DBGPRINT -> "sptr"; void ldap_set_dbg_routine(DBGPRINT DebugPrintRoutine)
#uselib "WLDAP32.dll"
#func global ldap_set_dbg_routine "ldap_set_dbg_routine" intptr
; ldap_set_dbg_routine DebugPrintRoutine
; DebugPrintRoutine : DBGPRINT -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
procldap_set_dbg_routine = wldap32.NewProc("ldap_set_dbg_routine")
)
// DebugPrintRoutine (DBGPRINT)
r1, _, err := procldap_set_dbg_routine.Call(
uintptr(DebugPrintRoutine),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure ldap_set_dbg_routine(
DebugPrintRoutine: Pointer // DBGPRINT
); cdecl;
external 'WLDAP32.dll' name 'ldap_set_dbg_routine';result := DllCall("WLDAP32\ldap_set_dbg_routine"
, "Ptr", DebugPrintRoutine ; DBGPRINT
, "Cdecl Int") ; return: void●ldap_set_dbg_routine(DebugPrintRoutine) = DLL("WLDAP32.dll", "int ldap_set_dbg_routine(void*)")
# 呼び出し: ldap_set_dbg_routine(DebugPrintRoutine)
# DebugPrintRoutine : DBGPRINT -> "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_set_dbg_routine(
DebugPrintRoutine: ?*anyopaque // DBGPRINT
) callconv(.c) void;proc ldap_set_dbg_routine(
DebugPrintRoutine: pointer # DBGPRINT
) {.importc: "ldap_set_dbg_routine", cdecl, dynlib: "WLDAP32.dll".}pragma(lib, "wldap32");
extern(C)
void ldap_set_dbg_routine(
void* DebugPrintRoutine // DBGPRINT
);ccall((:ldap_set_dbg_routine, "WLDAP32.dll"), Cvoid,
(Ptr{Cvoid},),
DebugPrintRoutine)
# DebugPrintRoutine : DBGPRINT -> Ptr{Cvoid}local ffi = require("ffi")
ffi.cdef[[
void ldap_set_dbg_routine(
void* DebugPrintRoutine);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_set_dbg_routine(DebugPrintRoutine)
-- DebugPrintRoutine : DBGPRINT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_set_dbg_routine = lib.func('__cdecl', 'ldap_set_dbg_routine', 'void', ['void *']);
// ldap_set_dbg_routine(DebugPrintRoutine)
// DebugPrintRoutine : DBGPRINT -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("WLDAP32.dll", {
ldap_set_dbg_routine: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.ldap_set_dbg_routine(DebugPrintRoutine)
// DebugPrintRoutine : DBGPRINT -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void ldap_set_dbg_routine(
void* DebugPrintRoutine);
C, "WLDAP32.dll");
// $ffi->ldap_set_dbg_routine(DebugPrintRoutine);
// DebugPrintRoutine : DBGPRINT
// 構造体/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);
void ldap_set_dbg_routine(
Callback DebugPrintRoutine // DBGPRINT
);
}@[Link("wldap32")]
lib LibWLDAP32
fun ldap_set_dbg_routine = ldap_set_dbg_routine(
DebugPrintRoutine : Void* # DBGPRINT
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ldap_set_dbg_routineNative = Void Function(Pointer<Void>);
typedef ldap_set_dbg_routineDart = void Function(Pointer<Void>);
final ldap_set_dbg_routine = DynamicLibrary.open('WLDAP32.dll')
.lookupFunction<ldap_set_dbg_routineNative, ldap_set_dbg_routineDart>('ldap_set_dbg_routine');
// DebugPrintRoutine : DBGPRINT -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure ldap_set_dbg_routine(
DebugPrintRoutine: Pointer // DBGPRINT
); cdecl;
external 'WLDAP32.dll' name 'ldap_set_dbg_routine';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "ldap_set_dbg_routine"
c_ldap_set_dbg_routine :: Ptr () -> IO ()
-- DebugPrintRoutine : DBGPRINT -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ldap_set_dbg_routine =
foreign "ldap_set_dbg_routine"
((ptr void) @-> returning void)
(* DebugPrintRoutine : DBGPRINT -> (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_set_dbg_routine" ldap-set-dbg-routine :convention :cdecl) :void
(debug-print-routine :pointer)) ; DBGPRINT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ldap_set_dbg_routine = Win32::API::More->new('WLDAP32',
'void ldap_set_dbg_routine(LPVOID DebugPrintRoutine)');
# my $ret = $ldap_set_dbg_routine->Call($DebugPrintRoutine);
# DebugPrintRoutine : DBGPRINT -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。関連項目
使用する型