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

GetOsManufacturingMode

関数
OSが製造モードで動作中かどうかを取得する。
DLLapi-ms-win-core-sysinfo-l1-2-3.dll呼出規約winapi

シグネチャ

// api-ms-win-core-sysinfo-l1-2-3.dll
#include <windows.h>

BOOL GetOsManufacturingMode(
    BOOL* pbEnabled
);

パラメーター

名前方向
pbEnabledBOOL*out

戻り値の型: BOOL

各言語での呼び出し定義

// api-ms-win-core-sysinfo-l1-2-3.dll
#include <windows.h>

BOOL GetOsManufacturingMode(
    BOOL* pbEnabled
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-sysinfo-l1-2-3.dll", ExactSpelling = true)]
static extern bool GetOsManufacturingMode(
    out int pbEnabled   // BOOL* out
);
<DllImport("api-ms-win-core-sysinfo-l1-2-3.dll", ExactSpelling:=True)>
Public Shared Function GetOsManufacturingMode(
    <Out> ByRef pbEnabled As Integer   ' BOOL* out
) As Boolean
End Function
' pbEnabled : BOOL* out
Declare PtrSafe Function GetOsManufacturingMode Lib "api-ms-win-core-sysinfo-l1-2-3" ( _
    ByRef pbEnabled As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetOsManufacturingMode = ctypes.windll.LoadLibrary("api-ms-win-core-sysinfo-l1-2-3.dll").GetOsManufacturingMode
GetOsManufacturingMode.restype = wintypes.BOOL
GetOsManufacturingMode.argtypes = [
    ctypes.c_void_p,  # pbEnabled : BOOL* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	api_ms_win_core_sysinfo_l1_2_3 = windows.NewLazySystemDLL("api-ms-win-core-sysinfo-l1-2-3.dll")
	procGetOsManufacturingMode = api_ms_win_core_sysinfo_l1_2_3.NewProc("GetOsManufacturingMode")
)

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