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

ldap_msgfree

関数
LDAP操作結果のメッセージ構造体を解放する。
DLLWLDAP32.dll呼出規約cdecl対応OSWindows Vista 以降

シグネチャ

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

DWORD ldap_msgfree(
    LDAPMessage* res
);

パラメーター

名前方向説明
resLDAPMessage*inout解放するLDAP検索結果メッセージチェーンの先頭ポインタ。検索操作で取得した全結果を一括解放する。NULL可。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ldap_msgfree = ctypes.cdll.wldap32.ldap_msgfree
ldap_msgfree.restype = wintypes.DWORD
ldap_msgfree.argtypes = [
    ctypes.c_void_p,  # res : LDAPMessage* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wldap32 = windows.NewLazySystemDLL("WLDAP32.dll")
	procldap_msgfree = wldap32.NewProc("ldap_msgfree")
)

// res (LDAPMessage* in/out)
r1, _, err := procldap_msgfree.Call(
	uintptr(res),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ldap_msgfree(
  res: Pointer   // LDAPMessage* in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_msgfree';
result := DllCall("WLDAP32\ldap_msgfree"
    , "Ptr", res   ; LDAPMessage* in/out
    , "Cdecl UInt")   ; return: DWORD
●ldap_msgfree(res) = DLL("WLDAP32.dll", "dword ldap_msgfree(void*)")
# 呼び出し: ldap_msgfree(res)
# res : LDAPMessage* in/out -> "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_msgfree(
    res: [*c]LDAPMessage // LDAPMessage* in/out
) callconv(.c) u32;
proc ldap_msgfree(
    res: ptr LDAPMessage  # LDAPMessage* in/out
): uint32 {.importc: "ldap_msgfree", cdecl, dynlib: "WLDAP32.dll".}
pragma(lib, "wldap32");
extern(C)
uint ldap_msgfree(
    LDAPMessage* res   // LDAPMessage* in/out
);
ccall((:ldap_msgfree, "WLDAP32.dll"), UInt32,
      (Ptr{LDAPMessage},),
      res)
# res : LDAPMessage* in/out -> Ptr{LDAPMessage}
local ffi = require("ffi")
ffi.cdef[[
uint32_t ldap_msgfree(
    void* res);
]]
local wldap32 = ffi.load("wldap32")
-- wldap32.ldap_msgfree(res)
-- res : LDAPMessage* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WLDAP32.dll');
const ldap_msgfree = lib.func('__cdecl', 'ldap_msgfree', 'uint32_t', ['void *']);
// ldap_msgfree(res)
// res : LDAPMessage* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WLDAP32.dll", {
  ldap_msgfree: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.ldap_msgfree(res)
// res : LDAPMessage* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ldap_msgfree(
    void* res);
C, "WLDAP32.dll");
// $ffi->ldap_msgfree(res);
// res : LDAPMessage* in/out
// 構造体/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);
    int ldap_msgfree(
        Pointer res   // LDAPMessage* in/out
    );
}
@[Link("wldap32")]
lib LibWLDAP32
  fun ldap_msgfree = ldap_msgfree(
    res : LDAPMessage*   # LDAPMessage* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ldap_msgfreeNative = Uint32 Function(Pointer<Void>);
typedef ldap_msgfreeDart = int Function(Pointer<Void>);
final ldap_msgfree = DynamicLibrary.open('WLDAP32.dll')
    .lookupFunction<ldap_msgfreeNative, ldap_msgfreeDart>('ldap_msgfree');
// res : LDAPMessage* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ldap_msgfree(
  res: Pointer   // LDAPMessage* in/out
): DWORD; cdecl;
  external 'WLDAP32.dll' name 'ldap_msgfree';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ldap_msgfree"
  c_ldap_msgfree :: Ptr () -> IO Word32
-- res : LDAPMessage* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ldap_msgfree =
  foreign "ldap_msgfree"
    ((ptr void) @-> returning uint32_t)
(* res : LDAPMessage* in/out -> (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_msgfree" ldap-msgfree :convention :cdecl) :uint32
  (res :pointer))   ; LDAPMessage* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ldap_msgfree = Win32::API::More->new('WLDAP32',
    'DWORD ldap_msgfree(LPVOID res)');
# my $ret = $ldap_msgfree->Call($res);
# res : LDAPMessage* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型