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

FwpmFreeMemory0

関数
WFP APIが割り当てたメモリを解放する。
DLLfwpuclnt.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void FwpmFreeMemory0(
    void** p
);

パラメーター

名前方向説明
pvoid**inoutFWPM系APIが割り当てたメモリへのポインターのアドレス。解放後NULLが設定される。

戻り値の型: void

各言語での呼び出し定義

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

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

FwpmFreeMemory0 = ctypes.windll.fwpuclnt.FwpmFreeMemory0
FwpmFreeMemory0.restype = None
FwpmFreeMemory0.argtypes = [
    ctypes.c_void_p,  # p : void** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	fwpuclnt = windows.NewLazySystemDLL("fwpuclnt.dll")
	procFwpmFreeMemory0 = fwpuclnt.NewProc("FwpmFreeMemory0")
)

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

extern "fwpuclnt" fn FwpmFreeMemory0(
    p: ?*anyopaque // void** in/out
) callconv(std.os.windows.WINAPI) void;
proc FwpmFreeMemory0(
    p: pointer  # void** in/out
) {.importc: "FwpmFreeMemory0", stdcall, dynlib: "fwpuclnt.dll".}
pragma(lib, "fwpuclnt");
extern(Windows)
void FwpmFreeMemory0(
    void** p   // void** in/out
);
ccall((:FwpmFreeMemory0, "fwpuclnt.dll"), stdcall, Cvoid,
      (Ptr{Cvoid},),
      p)
# p : void** in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void FwpmFreeMemory0(
    void** p);
]]
local fwpuclnt = ffi.load("fwpuclnt")
-- fwpuclnt.FwpmFreeMemory0(p)
-- p : void** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('fwpuclnt.dll');
const FwpmFreeMemory0 = lib.func('__stdcall', 'FwpmFreeMemory0', 'void', ['void *']);
// FwpmFreeMemory0(p)
// p : void** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("fwpuclnt.dll", {
  FwpmFreeMemory0: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.FwpmFreeMemory0(p)
// p : void** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void FwpmFreeMemory0(
    void** p);
C, "fwpuclnt.dll");
// $ffi->FwpmFreeMemory0(p);
// p : 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 Fwpuclnt extends StdCallLibrary {
    Fwpuclnt INSTANCE = Native.load("fwpuclnt", Fwpuclnt.class);
    void FwpmFreeMemory0(
        Pointer p   // void** in/out
    );
}
@[Link("fwpuclnt")]
lib Libfwpuclnt
  fun FwpmFreeMemory0 = FwpmFreeMemory0(
    p : 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 FwpmFreeMemory0Native = Void Function(Pointer<Void>);
typedef FwpmFreeMemory0Dart = void Function(Pointer<Void>);
final FwpmFreeMemory0 = DynamicLibrary.open('fwpuclnt.dll')
    .lookupFunction<FwpmFreeMemory0Native, FwpmFreeMemory0Dart>('FwpmFreeMemory0');
// p : void** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure FwpmFreeMemory0(
  p: Pointer   // void** in/out
); stdcall;
  external 'fwpuclnt.dll' name 'FwpmFreeMemory0';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

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

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