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

WlanFreeMemory

関数
WLAN APIが返したメモリブロックを解放する。
DLLwlanapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void WlanFreeMemory(
    void* pMemory
);

パラメーター

名前方向説明
pMemoryvoid*inWLAN系APIが割り当てたメモリへのポインター。解放対象とする。

戻り値の型: void

各言語での呼び出し定義

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

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

WlanFreeMemory = ctypes.windll.wlanapi.WlanFreeMemory
WlanFreeMemory.restype = None
WlanFreeMemory.argtypes = [
    ctypes.POINTER(None),  # pMemory : void*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
	procWlanFreeMemory = wlanapi.NewProc("WlanFreeMemory")
)

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

extern "wlanapi" fn WlanFreeMemory(
    pMemory: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) void;
proc WlanFreeMemory(
    pMemory: pointer  # void*
) {.importc: "WlanFreeMemory", stdcall, dynlib: "wlanapi.dll".}
pragma(lib, "wlanapi");
extern(Windows)
void WlanFreeMemory(
    void* pMemory   // void*
);
ccall((:WlanFreeMemory, "wlanapi.dll"), stdcall, Cvoid,
      (Ptr{Cvoid},),
      pMemory)
# pMemory : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void WlanFreeMemory(
    void* pMemory);
]]
local wlanapi = ffi.load("wlanapi")
-- wlanapi.WlanFreeMemory(pMemory)
-- pMemory : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('wlanapi.dll');
const WlanFreeMemory = lib.func('__stdcall', 'WlanFreeMemory', 'void', ['void *']);
// WlanFreeMemory(pMemory)
// pMemory : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("wlanapi.dll", {
  WlanFreeMemory: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.WlanFreeMemory(pMemory)
// pMemory : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void WlanFreeMemory(
    void* pMemory);
C, "wlanapi.dll");
// $ffi->WlanFreeMemory(pMemory);
// pMemory : void*
// 構造体/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 Wlanapi extends StdCallLibrary {
    Wlanapi INSTANCE = Native.load("wlanapi", Wlanapi.class);
    void WlanFreeMemory(
        Pointer pMemory   // void*
    );
}
@[Link("wlanapi")]
lib Libwlanapi
  fun WlanFreeMemory = WlanFreeMemory(
    pMemory : Void*   # void*
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

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

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

let wlanfreememory =
  foreign "WlanFreeMemory"
    ((ptr void) @-> returning void)
(* pMemory : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wlanapi (t "wlanapi.dll"))
(cffi:use-foreign-library wlanapi)

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