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

LdapGetLastError

関数
直前のLDAP呼び出しのエラーコードを取得する。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

// WLDAP32.dll
#include <windows.h>

DWORD LdapGetLastError(void);

パラメーターなし。戻り値: DWORD

各言語での呼び出し定義

// WLDAP32.dll
#include <windows.h>

DWORD LdapGetLastError(void);
[DllImport("WLDAP32.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern uint LdapGetLastError();
<DllImport("WLDAP32.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function LdapGetLastError() As UInteger
End Function
Declare PtrSafe Function LdapGetLastError Lib "wldap32" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

LdapGetLastError = ctypes.cdll.wldap32.LdapGetLastError
LdapGetLastError.restype = wintypes.DWORD
LdapGetLastError.argtypes = []
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WLDAP32.dll')
LdapGetLastError = Fiddle::Function.new(
  lib['LdapGetLastError'],
  [],
  -Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "wldap32")]
extern "C" {
    fn LdapGetLastError() -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WLDAP32.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint LdapGetLastError();
"@
$api = Add-Type -MemberDefinition $sig -Name 'WLDAP32_LdapGetLastError' -Namespace Win32 -PassThru
# $api::LdapGetLastError()
#uselib "WLDAP32.dll"
#func global LdapGetLastError "LdapGetLastError"
; LdapGetLastError   ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WLDAP32.dll"
#cfunc global LdapGetLastError "LdapGetLastError"
; res = LdapGetLastError()
; DWORD LdapGetLastError()
#uselib "WLDAP32.dll"
#cfunc global LdapGetLastError "LdapGetLastError"
; res = LdapGetLastError()
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procLdapGetLastError = wldap32.NewProc("LdapGetLastError")
)

r1, _, err := procLdapGetLastError.Call()
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function LdapGetLastError: DWORD; cdecl;
  external 'WLDAP32.dll' name 'LdapGetLastError';
result := DllCall("WLDAP32\LdapGetLastError", "Cdecl UInt")
●LdapGetLastError() = DLL("WLDAP32.dll", "dword LdapGetLastError()")
# 呼び出し: LdapGetLastError()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。