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

FreeInterfaceContextTable

関数
インターフェイスコンテキストテーブルのメモリを解放する。
DLLOnDemandConnRouteHelper.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

void FreeInterfaceContextTable(
    NET_INTERFACE_CONTEXT_TABLE* InterfaceContextTable
);

パラメーター

名前方向説明
InterfaceContextTableNET_INTERFACE_CONTEXT_TABLE*inGetInterfaceContextTableForHostNameが返したテーブルへのポインター。解放対象。

戻り値の型: void

各言語での呼び出し定義

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

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

FreeInterfaceContextTable = ctypes.windll.ondemandconnroutehelper.FreeInterfaceContextTable
FreeInterfaceContextTable.restype = None
FreeInterfaceContextTable.argtypes = [
    ctypes.c_void_p,  # InterfaceContextTable : NET_INTERFACE_CONTEXT_TABLE*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OnDemandConnRouteHelper.dll')
FreeInterfaceContextTable = Fiddle::Function.new(
  lib['FreeInterfaceContextTable'],
  [
    Fiddle::TYPE_VOIDP,  # InterfaceContextTable : NET_INTERFACE_CONTEXT_TABLE*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "ondemandconnroutehelper")]
extern "system" {
    fn FreeInterfaceContextTable(
        InterfaceContextTable: *mut NET_INTERFACE_CONTEXT_TABLE  // NET_INTERFACE_CONTEXT_TABLE*
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OnDemandConnRouteHelper.dll")]
public static extern void FreeInterfaceContextTable(IntPtr InterfaceContextTable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OnDemandConnRouteHelper_FreeInterfaceContextTable' -Namespace Win32 -PassThru
# $api::FreeInterfaceContextTable(InterfaceContextTable)
#uselib "OnDemandConnRouteHelper.dll"
#func global FreeInterfaceContextTable "FreeInterfaceContextTable" sptr
; FreeInterfaceContextTable varptr(InterfaceContextTable)
; InterfaceContextTable : NET_INTERFACE_CONTEXT_TABLE* -> "sptr"
出力引数:
#uselib "OnDemandConnRouteHelper.dll"
#func global FreeInterfaceContextTable "FreeInterfaceContextTable" var
; FreeInterfaceContextTable InterfaceContextTable
; InterfaceContextTable : NET_INTERFACE_CONTEXT_TABLE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void FreeInterfaceContextTable(NET_INTERFACE_CONTEXT_TABLE* InterfaceContextTable)
#uselib "OnDemandConnRouteHelper.dll"
#func global FreeInterfaceContextTable "FreeInterfaceContextTable" var
; FreeInterfaceContextTable InterfaceContextTable
; InterfaceContextTable : NET_INTERFACE_CONTEXT_TABLE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ondemandconnroutehelper = windows.NewLazySystemDLL("OnDemandConnRouteHelper.dll")
	procFreeInterfaceContextTable = ondemandconnroutehelper.NewProc("FreeInterfaceContextTable")
)

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

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

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

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

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

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

関連項目

使用する型