ホーム › Devices.DeviceAndDriverInstallation › SetupDiGetActualSectionToInstallExW
SetupDiGetActualSectionToInstallExW
関数指定プラットフォームでインストールする実際のINFセクション名を取得する。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupDiGetActualSectionToInstallExW(
void* InfHandle,
LPCWSTR InfSectionName,
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // optional
LPWSTR InfSectionWithExt, // optional
DWORD InfSectionWithExtSize,
DWORD* RequiredSize, // optional
LPWSTR* Extension, // optional
void* Reserved // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| InfHandle | void* | in |
| InfSectionName | LPCWSTR | in |
| AlternatePlatformInfo | SP_ALTPLATFORM_INFO_V2* | inoptional |
| InfSectionWithExt | LPWSTR | outoptional |
| InfSectionWithExtSize | DWORD | in |
| RequiredSize | DWORD* | outoptional |
| Extension | LPWSTR* | outoptional |
| Reserved | void* | optional |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupDiGetActualSectionToInstallExW(
void* InfHandle,
LPCWSTR InfSectionName,
SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, // optional
LPWSTR InfSectionWithExt, // optional
DWORD InfSectionWithExtSize,
DWORD* RequiredSize, // optional
LPWSTR* Extension, // optional
void* Reserved // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupDiGetActualSectionToInstallExW(
IntPtr InfHandle, // void*
[MarshalAs(UnmanagedType.LPWStr)] string InfSectionName, // LPCWSTR
IntPtr AlternatePlatformInfo, // SP_ALTPLATFORM_INFO_V2* optional
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder InfSectionWithExt, // LPWSTR optional, out
uint InfSectionWithExtSize, // DWORD
IntPtr RequiredSize, // DWORD* optional, out
IntPtr Extension, // LPWSTR* optional, out
IntPtr Reserved // void* optional
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupDiGetActualSectionToInstallExW(
InfHandle As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> InfSectionName As String, ' LPCWSTR
AlternatePlatformInfo As IntPtr, ' SP_ALTPLATFORM_INFO_V2* optional
<MarshalAs(UnmanagedType.LPWStr)> InfSectionWithExt As System.Text.StringBuilder, ' LPWSTR optional, out
InfSectionWithExtSize As UInteger, ' DWORD
RequiredSize As IntPtr, ' DWORD* optional, out
Extension As IntPtr, ' LPWSTR* optional, out
Reserved As IntPtr ' void* optional
) As Boolean
End Function' InfHandle : void*
' InfSectionName : LPCWSTR
' AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
' InfSectionWithExt : LPWSTR optional, out
' InfSectionWithExtSize : DWORD
' RequiredSize : DWORD* optional, out
' Extension : LPWSTR* optional, out
' Reserved : void* optional
Declare PtrSafe Function SetupDiGetActualSectionToInstallExW Lib "setupapi" ( _
ByVal InfHandle As LongPtr, _
ByVal InfSectionName As LongPtr, _
ByVal AlternatePlatformInfo As LongPtr, _
ByVal InfSectionWithExt As LongPtr, _
ByVal InfSectionWithExtSize As Long, _
ByVal RequiredSize As LongPtr, _
ByVal Extension As LongPtr, _
ByVal Reserved As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupDiGetActualSectionToInstallExW = ctypes.windll.setupapi.SetupDiGetActualSectionToInstallExW
SetupDiGetActualSectionToInstallExW.restype = wintypes.BOOL
SetupDiGetActualSectionToInstallExW.argtypes = [
ctypes.POINTER(None), # InfHandle : void*
wintypes.LPCWSTR, # InfSectionName : LPCWSTR
ctypes.c_void_p, # AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
wintypes.LPWSTR, # InfSectionWithExt : LPWSTR optional, out
wintypes.DWORD, # InfSectionWithExtSize : DWORD
ctypes.POINTER(wintypes.DWORD), # RequiredSize : DWORD* optional, out
ctypes.c_void_p, # Extension : LPWSTR* optional, out
ctypes.POINTER(None), # Reserved : void* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupDiGetActualSectionToInstallExW = Fiddle::Function.new(
lib['SetupDiGetActualSectionToInstallExW'],
[
Fiddle::TYPE_VOIDP, # InfHandle : void*
Fiddle::TYPE_VOIDP, # InfSectionName : LPCWSTR
Fiddle::TYPE_VOIDP, # AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
Fiddle::TYPE_VOIDP, # InfSectionWithExt : LPWSTR optional, out
-Fiddle::TYPE_INT, # InfSectionWithExtSize : DWORD
Fiddle::TYPE_VOIDP, # RequiredSize : DWORD* optional, out
Fiddle::TYPE_VOIDP, # Extension : LPWSTR* optional, out
Fiddle::TYPE_VOIDP, # Reserved : void* optional
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupDiGetActualSectionToInstallExW(
InfHandle: *mut (), // void*
InfSectionName: *const u16, // LPCWSTR
AlternatePlatformInfo: *mut SP_ALTPLATFORM_INFO_V2, // SP_ALTPLATFORM_INFO_V2* optional
InfSectionWithExt: *mut u16, // LPWSTR optional, out
InfSectionWithExtSize: u32, // DWORD
RequiredSize: *mut u32, // DWORD* optional, out
Extension: *mut *mut u16, // LPWSTR* optional, out
Reserved: *mut () // void* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SetupDiGetActualSectionToInstallExW(IntPtr InfHandle, [MarshalAs(UnmanagedType.LPWStr)] string InfSectionName, IntPtr AlternatePlatformInfo, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder InfSectionWithExt, uint InfSectionWithExtSize, IntPtr RequiredSize, IntPtr Extension, IntPtr Reserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupDiGetActualSectionToInstallExW' -Namespace Win32 -PassThru
# $api::SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved)#uselib "SETUPAPI.dll"
#func global SetupDiGetActualSectionToInstallExW "SetupDiGetActualSectionToInstallExW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; SetupDiGetActualSectionToInstallExW InfHandle, InfSectionName, varptr(AlternatePlatformInfo), varptr(InfSectionWithExt), InfSectionWithExtSize, varptr(RequiredSize), varptr(Extension), Reserved ; 戻り値は stat
; InfHandle : void* -> "wptr"
; InfSectionName : LPCWSTR -> "wptr"
; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "wptr"
; InfSectionWithExt : LPWSTR optional, out -> "wptr"
; InfSectionWithExtSize : DWORD -> "wptr"
; RequiredSize : DWORD* optional, out -> "wptr"
; Extension : LPWSTR* optional, out -> "wptr"
; Reserved : void* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SETUPAPI.dll" #cfunc global SetupDiGetActualSectionToInstallExW "SetupDiGetActualSectionToInstallExW" sptr, wstr, var, var, int, var, var, sptr ; res = SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved) ; InfHandle : void* -> "sptr" ; InfSectionName : LPCWSTR -> "wstr" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var" ; InfSectionWithExt : LPWSTR optional, out -> "var" ; InfSectionWithExtSize : DWORD -> "int" ; RequiredSize : DWORD* optional, out -> "var" ; Extension : LPWSTR* optional, out -> "var" ; Reserved : void* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SETUPAPI.dll" #cfunc global SetupDiGetActualSectionToInstallExW "SetupDiGetActualSectionToInstallExW" sptr, wstr, sptr, sptr, int, sptr, sptr, sptr ; res = SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, varptr(AlternatePlatformInfo), varptr(InfSectionWithExt), InfSectionWithExtSize, varptr(RequiredSize), varptr(Extension), Reserved) ; InfHandle : void* -> "sptr" ; InfSectionName : LPCWSTR -> "wstr" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "sptr" ; InfSectionWithExt : LPWSTR optional, out -> "sptr" ; InfSectionWithExtSize : DWORD -> "int" ; RequiredSize : DWORD* optional, out -> "sptr" ; Extension : LPWSTR* optional, out -> "sptr" ; Reserved : void* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SetupDiGetActualSectionToInstallExW(void* InfHandle, LPCWSTR InfSectionName, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, LPWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, DWORD* RequiredSize, LPWSTR* Extension, void* Reserved) #uselib "SETUPAPI.dll" #cfunc global SetupDiGetActualSectionToInstallExW "SetupDiGetActualSectionToInstallExW" intptr, wstr, var, var, int, var, var, intptr ; res = SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved) ; InfHandle : void* -> "intptr" ; InfSectionName : LPCWSTR -> "wstr" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var" ; InfSectionWithExt : LPWSTR optional, out -> "var" ; InfSectionWithExtSize : DWORD -> "int" ; RequiredSize : DWORD* optional, out -> "var" ; Extension : LPWSTR* optional, out -> "var" ; Reserved : void* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SetupDiGetActualSectionToInstallExW(void* InfHandle, LPCWSTR InfSectionName, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, LPWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, DWORD* RequiredSize, LPWSTR* Extension, void* Reserved) #uselib "SETUPAPI.dll" #cfunc global SetupDiGetActualSectionToInstallExW "SetupDiGetActualSectionToInstallExW" intptr, wstr, intptr, intptr, int, intptr, intptr, intptr ; res = SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, varptr(AlternatePlatformInfo), varptr(InfSectionWithExt), InfSectionWithExtSize, varptr(RequiredSize), varptr(Extension), Reserved) ; InfHandle : void* -> "intptr" ; InfSectionName : LPCWSTR -> "wstr" ; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "intptr" ; InfSectionWithExt : LPWSTR optional, out -> "intptr" ; InfSectionWithExtSize : DWORD -> "int" ; RequiredSize : DWORD* optional, out -> "intptr" ; Extension : LPWSTR* optional, out -> "intptr" ; Reserved : void* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupDiGetActualSectionToInstallExW = setupapi.NewProc("SetupDiGetActualSectionToInstallExW")
)
// InfHandle (void*), InfSectionName (LPCWSTR), AlternatePlatformInfo (SP_ALTPLATFORM_INFO_V2* optional), InfSectionWithExt (LPWSTR optional, out), InfSectionWithExtSize (DWORD), RequiredSize (DWORD* optional, out), Extension (LPWSTR* optional, out), Reserved (void* optional)
r1, _, err := procSetupDiGetActualSectionToInstallExW.Call(
uintptr(InfHandle),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(InfSectionName))),
uintptr(AlternatePlatformInfo),
uintptr(InfSectionWithExt),
uintptr(InfSectionWithExtSize),
uintptr(RequiredSize),
uintptr(Extension),
uintptr(Reserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupDiGetActualSectionToInstallExW(
InfHandle: Pointer; // void*
InfSectionName: PWideChar; // LPCWSTR
AlternatePlatformInfo: Pointer; // SP_ALTPLATFORM_INFO_V2* optional
InfSectionWithExt: PWideChar; // LPWSTR optional, out
InfSectionWithExtSize: DWORD; // DWORD
RequiredSize: Pointer; // DWORD* optional, out
Extension: PPWideChar; // LPWSTR* optional, out
Reserved: Pointer // void* optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupDiGetActualSectionToInstallExW';result := DllCall("SETUPAPI\SetupDiGetActualSectionToInstallExW"
, "Ptr", InfHandle ; void*
, "WStr", InfSectionName ; LPCWSTR
, "Ptr", AlternatePlatformInfo ; SP_ALTPLATFORM_INFO_V2* optional
, "Ptr", InfSectionWithExt ; LPWSTR optional, out
, "UInt", InfSectionWithExtSize ; DWORD
, "Ptr", RequiredSize ; DWORD* optional, out
, "Ptr", Extension ; LPWSTR* optional, out
, "Ptr", Reserved ; void* optional
, "Int") ; return: BOOL●SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved) = DLL("SETUPAPI.dll", "bool SetupDiGetActualSectionToInstallExW(void*, char*, void*, char*, dword, void*, void*, void*)")
# 呼び出し: SetupDiGetActualSectionToInstallExW(InfHandle, InfSectionName, AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize, RequiredSize, Extension, Reserved)
# InfHandle : void* -> "void*"
# InfSectionName : LPCWSTR -> "char*"
# AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "void*"
# InfSectionWithExt : LPWSTR optional, out -> "char*"
# InfSectionWithExtSize : DWORD -> "dword"
# RequiredSize : DWORD* optional, out -> "void*"
# Extension : LPWSTR* optional, out -> "void*"
# Reserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。