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

LdapMapErrorToWin32

関数
LDAPエラーコードを対応するWin32エラーに変換する。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

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

WIN32_ERROR LdapMapErrorToWin32(
    DWORD LdapError
);

パラメーター

名前方向
LdapErrorDWORDin

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

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

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

LdapMapErrorToWin32 = ctypes.cdll.wldap32.LdapMapErrorToWin32
LdapMapErrorToWin32.restype = wintypes.DWORD
LdapMapErrorToWin32.argtypes = [
    wintypes.DWORD,  # LdapError : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procLdapMapErrorToWin32 = wldap32.NewProc("LdapMapErrorToWin32")
)

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