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

ber_peek_tag

関数
BERストリームの次のタグを先読みする。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

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

DWORD ber_peek_tag(
    BerElement* pBerElement,
    DWORD* pLen
);

パラメーター

名前方向説明
pBerElementBerElement*inout走査対象のBerElement。位置を進めず現在のタグを覗き見る。
pLenDWORD*inout現在の要素の値部の長さを受け取る出力先。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ber_peek_tag = ctypes.cdll.wldap32.ber_peek_tag
ber_peek_tag.restype = wintypes.DWORD
ber_peek_tag.argtypes = [
    ctypes.c_void_p,  # pBerElement : BerElement* in/out
    ctypes.POINTER(wintypes.DWORD),  # pLen : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procber_peek_tag = wldap32.NewProc("ber_peek_tag")
)

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