Win32 API 日本語リファレンス
ホームNetworkManagement.Dhcp › DhcpRpcFreeMemory

DhcpRpcFreeMemory

関数
DHCP API が RPC で割り当てたメモリを解放する。
DLLDHCPSAPI.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

void DhcpRpcFreeMemory(
    void* BufferPointer
);

パラメーター

名前方向説明
BufferPointervoid*inoutDHCPサーバAPIがRPCで割り当てたメモリ領域へのポインタ。これを解放する。

戻り値の型: void

各言語での呼び出し定義

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

void DhcpRpcFreeMemory(
    void* BufferPointer
);
[DllImport("DHCPSAPI.dll", ExactSpelling = true)]
static extern void DhcpRpcFreeMemory(
    IntPtr BufferPointer   // void* in/out
);
<DllImport("DHCPSAPI.dll", ExactSpelling:=True)>
Public Shared Sub DhcpRpcFreeMemory(
    BufferPointer As IntPtr   ' void* in/out
)
End Sub
' BufferPointer : void* in/out
Declare PtrSafe Sub DhcpRpcFreeMemory Lib "dhcpsapi" ( _
    ByVal BufferPointer As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DhcpRpcFreeMemory = ctypes.windll.dhcpsapi.DhcpRpcFreeMemory
DhcpRpcFreeMemory.restype = None
DhcpRpcFreeMemory.argtypes = [
    ctypes.POINTER(None),  # BufferPointer : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DHCPSAPI.dll')
DhcpRpcFreeMemory = Fiddle::Function.new(
  lib['DhcpRpcFreeMemory'],
  [
    Fiddle::TYPE_VOIDP,  # BufferPointer : void* in/out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "dhcpsapi")]
extern "system" {
    fn DhcpRpcFreeMemory(
        BufferPointer: *mut ()  // void* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DHCPSAPI.dll")]
public static extern void DhcpRpcFreeMemory(IntPtr BufferPointer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DHCPSAPI_DhcpRpcFreeMemory' -Namespace Win32 -PassThru
# $api::DhcpRpcFreeMemory(BufferPointer)
#uselib "DHCPSAPI.dll"
#func global DhcpRpcFreeMemory "DhcpRpcFreeMemory" sptr
; DhcpRpcFreeMemory BufferPointer
; BufferPointer : void* in/out -> "sptr"
#uselib "DHCPSAPI.dll"
#func global DhcpRpcFreeMemory "DhcpRpcFreeMemory" sptr
; DhcpRpcFreeMemory BufferPointer
; BufferPointer : void* in/out -> "sptr"
; void DhcpRpcFreeMemory(void* BufferPointer)
#uselib "DHCPSAPI.dll"
#func global DhcpRpcFreeMemory "DhcpRpcFreeMemory" intptr
; DhcpRpcFreeMemory BufferPointer
; BufferPointer : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dhcpsapi = windows.NewLazySystemDLL("DHCPSAPI.dll")
	procDhcpRpcFreeMemory = dhcpsapi.NewProc("DhcpRpcFreeMemory")
)

// BufferPointer (void* in/out)
r1, _, err := procDhcpRpcFreeMemory.Call(
	uintptr(BufferPointer),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure DhcpRpcFreeMemory(
  BufferPointer: Pointer   // void* in/out
); stdcall;
  external 'DHCPSAPI.dll' name 'DhcpRpcFreeMemory';
result := DllCall("DHCPSAPI\DhcpRpcFreeMemory"
    , "Ptr", BufferPointer   ; void* in/out
    , "Int")   ; return: void
●DhcpRpcFreeMemory(BufferPointer) = DLL("DHCPSAPI.dll", "int DhcpRpcFreeMemory(void*)")
# 呼び出し: DhcpRpcFreeMemory(BufferPointer)
# BufferPointer : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "dhcpsapi" fn DhcpRpcFreeMemory(
    BufferPointer: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) void;
proc DhcpRpcFreeMemory(
    BufferPointer: pointer  # void* in/out
) {.importc: "DhcpRpcFreeMemory", stdcall, dynlib: "DHCPSAPI.dll".}
pragma(lib, "dhcpsapi");
extern(Windows)
void DhcpRpcFreeMemory(
    void* BufferPointer   // void* in/out
);
ccall((:DhcpRpcFreeMemory, "DHCPSAPI.dll"), stdcall, Cvoid,
      (Ptr{Cvoid},),
      BufferPointer)
# BufferPointer : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void DhcpRpcFreeMemory(
    void* BufferPointer);
]]
local dhcpsapi = ffi.load("dhcpsapi")
-- dhcpsapi.DhcpRpcFreeMemory(BufferPointer)
-- BufferPointer : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('DHCPSAPI.dll');
const DhcpRpcFreeMemory = lib.func('__stdcall', 'DhcpRpcFreeMemory', 'void', ['void *']);
// DhcpRpcFreeMemory(BufferPointer)
// BufferPointer : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("DHCPSAPI.dll", {
  DhcpRpcFreeMemory: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.DhcpRpcFreeMemory(BufferPointer)
// BufferPointer : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void DhcpRpcFreeMemory(
    void* BufferPointer);
C, "DHCPSAPI.dll");
// $ffi->DhcpRpcFreeMemory(BufferPointer);
// BufferPointer : void* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Dhcpsapi extends StdCallLibrary {
    Dhcpsapi INSTANCE = Native.load("dhcpsapi", Dhcpsapi.class);
    void DhcpRpcFreeMemory(
        Pointer BufferPointer   // void* in/out
    );
}
@[Link("dhcpsapi")]
lib LibDHCPSAPI
  fun DhcpRpcFreeMemory = DhcpRpcFreeMemory(
    BufferPointer : Void*   # void* in/out
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DhcpRpcFreeMemoryNative = Void Function(Pointer<Void>);
typedef DhcpRpcFreeMemoryDart = void Function(Pointer<Void>);
final DhcpRpcFreeMemory = DynamicLibrary.open('DHCPSAPI.dll')
    .lookupFunction<DhcpRpcFreeMemoryNative, DhcpRpcFreeMemoryDart>('DhcpRpcFreeMemory');
// BufferPointer : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure DhcpRpcFreeMemory(
  BufferPointer: Pointer   // void* in/out
); stdcall;
  external 'DHCPSAPI.dll' name 'DhcpRpcFreeMemory';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let dhcprpcfreememory =
  foreign "DhcpRpcFreeMemory"
    ((ptr void) @-> returning void)
(* BufferPointer : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dhcpsapi (t "DHCPSAPI.dll"))
(cffi:use-foreign-library dhcpsapi)

(cffi:defcfun ("DhcpRpcFreeMemory" dhcp-rpc-free-memory :convention :stdcall) :void
  (buffer-pointer :pointer))   ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DhcpRpcFreeMemory = Win32::API::More->new('DHCPSAPI',
    'void DhcpRpcFreeMemory(LPVOID BufferPointer)');
# my $ret = $DhcpRpcFreeMemory->Call($BufferPointer);
# BufferPointer : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。