ホーム › System.Diagnostics.Debug › RtlDeleteFunctionTable
RtlDeleteFunctionTable
関数登録済みのx64例外処理関数テーブルを削除する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOLEAN RtlDeleteFunctionTable(
IMAGE_RUNTIME_FUNCTION_ENTRY* FunctionTable
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| FunctionTable | IMAGE_RUNTIME_FUNCTION_ENTRY* | in | 以前に RtlAddFunctionTable に渡された関数エントリの配列へのポインター、または以前に RtlInstallFunctionTableCallback に渡された識別子です。PRUNTIME_FUNCTION 型の定義については、WinNT.h を参照してください。 |
戻り値の型: BOOLEAN
公式ドキュメント
動的関数テーブルリストから動的関数テーブルを削除します。
戻り値
関数が成功した場合、戻り値は TRUE です。それ以外の場合、戻り値は FALSE です。
解説(Remarks)
関数テーブルは、スタックの巻き戻し(アンワインド)またはウォークの方法を決定するために 64 ビット版 Windows で使用されます。これらのテーブルは 通常コンパイラーによって生成され、イメージの一部として格納されます。ただし、アプリケーションは動的に生成されたコードについては関数 テーブルを自身で用意する必要があります。関数テーブルの詳細については、お使いのシステムのアーキテクチャガイドを参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOLEAN RtlDeleteFunctionTable(
IMAGE_RUNTIME_FUNCTION_ENTRY* FunctionTable
);[return: MarshalAs(UnmanagedType.U1)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool RtlDeleteFunctionTable(
IntPtr FunctionTable // IMAGE_RUNTIME_FUNCTION_ENTRY*
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function RtlDeleteFunctionTable(
FunctionTable As IntPtr ' IMAGE_RUNTIME_FUNCTION_ENTRY*
) As <MarshalAs(UnmanagedType.U1)> Boolean
End Function' FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY*
Declare PtrSafe Function RtlDeleteFunctionTable Lib "kernel32" ( _
ByVal FunctionTable As LongPtr) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RtlDeleteFunctionTable = ctypes.windll.kernel32.RtlDeleteFunctionTable
RtlDeleteFunctionTable.restype = wintypes.BOOLEAN
RtlDeleteFunctionTable.argtypes = [
ctypes.c_void_p, # FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
RtlDeleteFunctionTable = Fiddle::Function.new(
lib['RtlDeleteFunctionTable'],
[
Fiddle::TYPE_VOIDP, # FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY*
],
Fiddle::TYPE_CHAR)#[link(name = "kernel32")]
extern "system" {
fn RtlDeleteFunctionTable(
FunctionTable: *mut IMAGE_RUNTIME_FUNCTION_ENTRY // IMAGE_RUNTIME_FUNCTION_ENTRY*
) -> u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.U1)]
[DllImport("KERNEL32.dll")]
public static extern bool RtlDeleteFunctionTable(IntPtr FunctionTable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_RtlDeleteFunctionTable' -Namespace Win32 -PassThru
# $api::RtlDeleteFunctionTable(FunctionTable)#uselib "KERNEL32.dll"
#func global RtlDeleteFunctionTable "RtlDeleteFunctionTable" sptr
; RtlDeleteFunctionTable varptr(FunctionTable) ; 戻り値は stat
; FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global RtlDeleteFunctionTable "RtlDeleteFunctionTable" var ; res = RtlDeleteFunctionTable(FunctionTable) ; FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global RtlDeleteFunctionTable "RtlDeleteFunctionTable" sptr ; res = RtlDeleteFunctionTable(varptr(FunctionTable)) ; FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOLEAN RtlDeleteFunctionTable(IMAGE_RUNTIME_FUNCTION_ENTRY* FunctionTable) #uselib "KERNEL32.dll" #cfunc global RtlDeleteFunctionTable "RtlDeleteFunctionTable" var ; res = RtlDeleteFunctionTable(FunctionTable) ; FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOLEAN RtlDeleteFunctionTable(IMAGE_RUNTIME_FUNCTION_ENTRY* FunctionTable) #uselib "KERNEL32.dll" #cfunc global RtlDeleteFunctionTable "RtlDeleteFunctionTable" intptr ; res = RtlDeleteFunctionTable(varptr(FunctionTable)) ; FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procRtlDeleteFunctionTable = kernel32.NewProc("RtlDeleteFunctionTable")
)
// FunctionTable (IMAGE_RUNTIME_FUNCTION_ENTRY*)
r1, _, err := procRtlDeleteFunctionTable.Call(
uintptr(FunctionTable),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLEANfunction RtlDeleteFunctionTable(
FunctionTable: Pointer // IMAGE_RUNTIME_FUNCTION_ENTRY*
): ByteBool; stdcall;
external 'KERNEL32.dll' name 'RtlDeleteFunctionTable';result := DllCall("KERNEL32\RtlDeleteFunctionTable"
, "Ptr", FunctionTable ; IMAGE_RUNTIME_FUNCTION_ENTRY*
, "Char") ; return: BOOLEAN●RtlDeleteFunctionTable(FunctionTable) = DLL("KERNEL32.dll", "byte RtlDeleteFunctionTable(void*)")
# 呼び出し: RtlDeleteFunctionTable(FunctionTable)
# FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "kernel32" fn RtlDeleteFunctionTable(
FunctionTable: [*c]IMAGE_RUNTIME_FUNCTION_ENTRY // IMAGE_RUNTIME_FUNCTION_ENTRY*
) callconv(std.os.windows.WINAPI) u8;proc RtlDeleteFunctionTable(
FunctionTable: ptr IMAGE_RUNTIME_FUNCTION_ENTRY # IMAGE_RUNTIME_FUNCTION_ENTRY*
): uint8 {.importc: "RtlDeleteFunctionTable", stdcall, dynlib: "KERNEL32.dll".}pragma(lib, "kernel32");
extern(Windows)
ubyte RtlDeleteFunctionTable(
IMAGE_RUNTIME_FUNCTION_ENTRY* FunctionTable // IMAGE_RUNTIME_FUNCTION_ENTRY*
);ccall((:RtlDeleteFunctionTable, "KERNEL32.dll"), stdcall, UInt8,
(Ptr{IMAGE_RUNTIME_FUNCTION_ENTRY},),
FunctionTable)
# FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> Ptr{IMAGE_RUNTIME_FUNCTION_ENTRY}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint8_t RtlDeleteFunctionTable(
void* FunctionTable);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.RtlDeleteFunctionTable(FunctionTable)
-- FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const RtlDeleteFunctionTable = lib.func('__stdcall', 'RtlDeleteFunctionTable', 'uint8_t', ['void *']);
// RtlDeleteFunctionTable(FunctionTable)
// FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("KERNEL32.dll", {
RtlDeleteFunctionTable: { parameters: ["pointer"], result: "u8" },
});
// lib.symbols.RtlDeleteFunctionTable(FunctionTable)
// FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint8_t RtlDeleteFunctionTable(
void* FunctionTable);
C, "KERNEL32.dll");
// $ffi->RtlDeleteFunctionTable(FunctionTable);
// FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY*
// 構造体/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 Kernel32 extends StdCallLibrary {
Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class);
byte RtlDeleteFunctionTable(
Pointer FunctionTable // IMAGE_RUNTIME_FUNCTION_ENTRY*
);
}@[Link("kernel32")]
lib LibKERNEL32
fun RtlDeleteFunctionTable = RtlDeleteFunctionTable(
FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* # IMAGE_RUNTIME_FUNCTION_ENTRY*
) : UInt8
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RtlDeleteFunctionTableNative = Uint8 Function(Pointer<Void>);
typedef RtlDeleteFunctionTableDart = int Function(Pointer<Void>);
final RtlDeleteFunctionTable = DynamicLibrary.open('KERNEL32.dll')
.lookupFunction<RtlDeleteFunctionTableNative, RtlDeleteFunctionTableDart>('RtlDeleteFunctionTable');
// FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RtlDeleteFunctionTable(
FunctionTable: Pointer // IMAGE_RUNTIME_FUNCTION_ENTRY*
): ByteBool; stdcall;
external 'KERNEL32.dll' name 'RtlDeleteFunctionTable';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RtlDeleteFunctionTable"
c_RtlDeleteFunctionTable :: Ptr () -> IO Word8
-- FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rtldeletefunctiontable =
foreign "RtlDeleteFunctionTable"
((ptr void) @-> returning uint8_t)
(* FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)
(cffi:defcfun ("RtlDeleteFunctionTable" rtl-delete-function-table :convention :stdcall) :uint8
(function-table :pointer)) ; IMAGE_RUNTIME_FUNCTION_ENTRY*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RtlDeleteFunctionTable = Win32::API::More->new('KERNEL32',
'BYTE RtlDeleteFunctionTable(LPVOID FunctionTable)');
# my $ret = $RtlDeleteFunctionTable->Call($FunctionTable);
# FunctionTable : IMAGE_RUNTIME_FUNCTION_ENTRY* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f RtlAddFunctionTable — 動的コード用のx64例外処理関数テーブルを登録する。
- f RtlInstallFunctionTableCallback — 関数テーブルを動的に提供するコールバックを登録する。