ホーム › System.Com › CoRevertToSelf
CoRevertToSelf
関数偽装を解除してサーバー自身のセキュリティに戻す。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT CoRevertToSelf(void);パラメーターなし。戻り値: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT CoRevertToSelf(void);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int CoRevertToSelf();<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoRevertToSelf() As Integer
End FunctionDeclare PtrSafe Function CoRevertToSelf Lib "ole32" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CoRevertToSelf = ctypes.windll.ole32.CoRevertToSelf
CoRevertToSelf.restype = ctypes.c_int
CoRevertToSelf.argtypes = []require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
CoRevertToSelf = Fiddle::Function.new(
lib['CoRevertToSelf'],
[],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn CoRevertToSelf() -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int CoRevertToSelf();
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_CoRevertToSelf' -Namespace Win32 -PassThru
# $api::CoRevertToSelf()#uselib "OLE32.dll"
#func global CoRevertToSelf "CoRevertToSelf"
; CoRevertToSelf ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global CoRevertToSelf "CoRevertToSelf"
; res = CoRevertToSelf(); HRESULT CoRevertToSelf()
#uselib "OLE32.dll"
#cfunc global CoRevertToSelf "CoRevertToSelf"
; res = CoRevertToSelf()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procCoRevertToSelf = ole32.NewProc("CoRevertToSelf")
)
r1, _, err := procCoRevertToSelf.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CoRevertToSelf: Integer; stdcall;
external 'OLE32.dll' name 'CoRevertToSelf';result := DllCall("OLE32\CoRevertToSelf", "Int")●CoRevertToSelf() = DLL("OLE32.dll", "int CoRevertToSelf()")
# 呼び出し: CoRevertToSelf()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。