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

RtlOsDeploymentState

関数
OSの配置(デプロイ)状態を取得する。
DLLntdll.dll呼出規約winapi

シグネチャ

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

OS_DEPLOYEMENT_STATE_VALUES RtlOsDeploymentState(
    DWORD Flags
);

パラメーター

名前方向
FlagsDWORDin

戻り値の型: OS_DEPLOYEMENT_STATE_VALUES

各言語での呼び出し定義

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

OS_DEPLOYEMENT_STATE_VALUES RtlOsDeploymentState(
    DWORD Flags
);
[DllImport("ntdll.dll", ExactSpelling = true)]
static extern int RtlOsDeploymentState(
    uint Flags   // DWORD
);
<DllImport("ntdll.dll", ExactSpelling:=True)>
Public Shared Function RtlOsDeploymentState(
    Flags As UInteger   ' DWORD
) As Integer
End Function
' Flags : DWORD
Declare PtrSafe Function RtlOsDeploymentState Lib "ntdll" ( _
    ByVal Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RtlOsDeploymentState = ctypes.windll.ntdll.RtlOsDeploymentState
RtlOsDeploymentState.restype = ctypes.c_int
RtlOsDeploymentState.argtypes = [
    wintypes.DWORD,  # Flags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ntdll.dll')
RtlOsDeploymentState = Fiddle::Function.new(
  lib['RtlOsDeploymentState'],
  [
    -Fiddle::TYPE_INT,  # Flags : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "ntdll")]
extern "system" {
    fn RtlOsDeploymentState(
        Flags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ntdll.dll")]
public static extern int RtlOsDeploymentState(uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ntdll_RtlOsDeploymentState' -Namespace Win32 -PassThru
# $api::RtlOsDeploymentState(Flags)
#uselib "ntdll.dll"
#func global RtlOsDeploymentState "RtlOsDeploymentState" sptr
; RtlOsDeploymentState Flags   ; 戻り値は stat
; Flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ntdll.dll"
#cfunc global RtlOsDeploymentState "RtlOsDeploymentState" int
; res = RtlOsDeploymentState(Flags)
; Flags : DWORD -> "int"
; OS_DEPLOYEMENT_STATE_VALUES RtlOsDeploymentState(DWORD Flags)
#uselib "ntdll.dll"
#cfunc global RtlOsDeploymentState "RtlOsDeploymentState" int
; res = RtlOsDeploymentState(Flags)
; Flags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ntdll = windows.NewLazySystemDLL("ntdll.dll")
	procRtlOsDeploymentState = ntdll.NewProc("RtlOsDeploymentState")
)

// Flags (DWORD)
r1, _, err := procRtlOsDeploymentState.Call(
	uintptr(Flags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // OS_DEPLOYEMENT_STATE_VALUES
function RtlOsDeploymentState(
  Flags: DWORD   // DWORD
): Integer; stdcall;
  external 'ntdll.dll' name 'RtlOsDeploymentState';
result := DllCall("ntdll\RtlOsDeploymentState"
    , "UInt", Flags   ; DWORD
    , "Int")   ; return: OS_DEPLOYEMENT_STATE_VALUES
●RtlOsDeploymentState(Flags) = DLL("ntdll.dll", "int RtlOsDeploymentState(dword)")
# 呼び出し: RtlOsDeploymentState(Flags)
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。