Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › IsNativeVhdBoot

IsNativeVhdBoot

関数
システムがネイティブVHDから起動したかを判定する。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSwindows8.0

シグネチャ

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

BOOL IsNativeVhdBoot(
    BOOL* NativeVhdBoot
);

パラメーター

名前方向
NativeVhdBootBOOL*out

戻り値の型: BOOL

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('KERNEL32.dll')
IsNativeVhdBoot = Fiddle::Function.new(
  lib['IsNativeVhdBoot'],
  [
    Fiddle::TYPE_VOIDP,  # NativeVhdBoot : BOOL* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn IsNativeVhdBoot(
        NativeVhdBoot: *mut i32  // BOOL* 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 IsNativeVhdBoot(out int NativeVhdBoot);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_IsNativeVhdBoot' -Namespace Win32 -PassThru
# $api::IsNativeVhdBoot(NativeVhdBoot)
#uselib "KERNEL32.dll"
#func global IsNativeVhdBoot "IsNativeVhdBoot" sptr
; IsNativeVhdBoot NativeVhdBoot   ; 戻り値は stat
; NativeVhdBoot : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global IsNativeVhdBoot "IsNativeVhdBoot" int
; res = IsNativeVhdBoot(NativeVhdBoot)
; NativeVhdBoot : BOOL* out -> "int"
; BOOL IsNativeVhdBoot(BOOL* NativeVhdBoot)
#uselib "KERNEL32.dll"
#cfunc global IsNativeVhdBoot "IsNativeVhdBoot" int
; res = IsNativeVhdBoot(NativeVhdBoot)
; NativeVhdBoot : BOOL* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procIsNativeVhdBoot = kernel32.NewProc("IsNativeVhdBoot")
)

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