Win32 API 日本語リファレンス
ホームStorage.FileSystem › Wow64DisableWow64FsRedirection

Wow64DisableWow64FsRedirection

関数
WOW64のファイルシステムリダイレクトを無効化し旧状態を保存する。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL Wow64DisableWow64FsRedirection(
    void** OldValue
);

パラメーター

名前方向
OldValuevoid**out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL Wow64DisableWow64FsRedirection(
    void** OldValue
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool Wow64DisableWow64FsRedirection(
    IntPtr OldValue   // void** out
);
<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function Wow64DisableWow64FsRedirection(
    OldValue As IntPtr   ' void** out
) As Boolean
End Function
' OldValue : void** out
Declare PtrSafe Function Wow64DisableWow64FsRedirection Lib "kernel32" ( _
    ByVal OldValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

Wow64DisableWow64FsRedirection = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
Wow64DisableWow64FsRedirection.restype = wintypes.BOOL
Wow64DisableWow64FsRedirection.argtypes = [
    ctypes.c_void_p,  # OldValue : void** out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
Wow64DisableWow64FsRedirection = Fiddle::Function.new(
  lib['Wow64DisableWow64FsRedirection'],
  [
    Fiddle::TYPE_VOIDP,  # OldValue : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn Wow64DisableWow64FsRedirection(
        OldValue: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool Wow64DisableWow64FsRedirection(IntPtr OldValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_Wow64DisableWow64FsRedirection' -Namespace Win32 -PassThru
# $api::Wow64DisableWow64FsRedirection(OldValue)
#uselib "KERNEL32.dll"
#func global Wow64DisableWow64FsRedirection "Wow64DisableWow64FsRedirection" sptr
; Wow64DisableWow64FsRedirection OldValue   ; 戻り値は stat
; OldValue : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global Wow64DisableWow64FsRedirection "Wow64DisableWow64FsRedirection" sptr
; res = Wow64DisableWow64FsRedirection(OldValue)
; OldValue : void** out -> "sptr"
; BOOL Wow64DisableWow64FsRedirection(void** OldValue)
#uselib "KERNEL32.dll"
#cfunc global Wow64DisableWow64FsRedirection "Wow64DisableWow64FsRedirection" intptr
; res = Wow64DisableWow64FsRedirection(OldValue)
; OldValue : void** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWow64DisableWow64FsRedirection = kernel32.NewProc("Wow64DisableWow64FsRedirection")
)

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