Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SetupOpenMasterInf

SetupOpenMasterInf

関数
システムのマスターINFファイルを開いてハンドルを取得する。
DLLSETUPAPI.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

void* SetupOpenMasterInf(void);

パラメーターなし。戻り値: void*

各言語での呼び出し定義

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

void* SetupOpenMasterInf(void);
[DllImport("SETUPAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr SetupOpenMasterInf();
<DllImport("SETUPAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupOpenMasterInf() As IntPtr
End Function
Declare PtrSafe Function SetupOpenMasterInf Lib "setupapi" () As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupOpenMasterInf = ctypes.windll.setupapi.SetupOpenMasterInf
SetupOpenMasterInf.restype = ctypes.c_void_p
SetupOpenMasterInf.argtypes = []
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupOpenMasterInf = setupapi.NewProc("SetupOpenMasterInf")
)

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