ホーム › Devices.DeviceAndDriverInstallation › SetupAddInstallSectionToDiskSpaceListW
SetupAddInstallSectionToDiskSpaceListW
関数INFのインストールセクションをディスク容量リストに追加する。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupAddInstallSectionToDiskSpaceListW(
void* DiskSpace,
void* InfHandle,
void* LayoutInfHandle, // optional
LPCWSTR SectionName,
void* Reserved1, // optional
DWORD Reserved2 // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| DiskSpace | void* | in |
| InfHandle | void* | in |
| LayoutInfHandle | void* | inoptional |
| SectionName | LPCWSTR | in |
| Reserved1 | void* | optional |
| Reserved2 | DWORD | optional |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupAddInstallSectionToDiskSpaceListW(
void* DiskSpace,
void* InfHandle,
void* LayoutInfHandle, // optional
LPCWSTR SectionName,
void* Reserved1, // optional
DWORD Reserved2 // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupAddInstallSectionToDiskSpaceListW(
IntPtr DiskSpace, // void*
IntPtr InfHandle, // void*
IntPtr LayoutInfHandle, // void* optional
[MarshalAs(UnmanagedType.LPWStr)] string SectionName, // LPCWSTR
IntPtr Reserved1, // void* optional
uint Reserved2 // DWORD optional
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupAddInstallSectionToDiskSpaceListW(
DiskSpace As IntPtr, ' void*
InfHandle As IntPtr, ' void*
LayoutInfHandle As IntPtr, ' void* optional
<MarshalAs(UnmanagedType.LPWStr)> SectionName As String, ' LPCWSTR
Reserved1 As IntPtr, ' void* optional
Reserved2 As UInteger ' DWORD optional
) As Boolean
End Function' DiskSpace : void*
' InfHandle : void*
' LayoutInfHandle : void* optional
' SectionName : LPCWSTR
' Reserved1 : void* optional
' Reserved2 : DWORD optional
Declare PtrSafe Function SetupAddInstallSectionToDiskSpaceListW Lib "setupapi" ( _
ByVal DiskSpace As LongPtr, _
ByVal InfHandle As LongPtr, _
ByVal LayoutInfHandle As LongPtr, _
ByVal SectionName As LongPtr, _
ByVal Reserved1 As LongPtr, _
ByVal Reserved2 As Long) 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
SetupAddInstallSectionToDiskSpaceListW = ctypes.windll.setupapi.SetupAddInstallSectionToDiskSpaceListW
SetupAddInstallSectionToDiskSpaceListW.restype = wintypes.BOOL
SetupAddInstallSectionToDiskSpaceListW.argtypes = [
ctypes.POINTER(None), # DiskSpace : void*
ctypes.POINTER(None), # InfHandle : void*
ctypes.POINTER(None), # LayoutInfHandle : void* optional
wintypes.LPCWSTR, # SectionName : LPCWSTR
ctypes.POINTER(None), # Reserved1 : void* optional
wintypes.DWORD, # Reserved2 : DWORD optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupAddInstallSectionToDiskSpaceListW = Fiddle::Function.new(
lib['SetupAddInstallSectionToDiskSpaceListW'],
[
Fiddle::TYPE_VOIDP, # DiskSpace : void*
Fiddle::TYPE_VOIDP, # InfHandle : void*
Fiddle::TYPE_VOIDP, # LayoutInfHandle : void* optional
Fiddle::TYPE_VOIDP, # SectionName : LPCWSTR
Fiddle::TYPE_VOIDP, # Reserved1 : void* optional
-Fiddle::TYPE_INT, # Reserved2 : DWORD optional
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupAddInstallSectionToDiskSpaceListW(
DiskSpace: *mut (), // void*
InfHandle: *mut (), // void*
LayoutInfHandle: *mut (), // void* optional
SectionName: *const u16, // LPCWSTR
Reserved1: *mut (), // void* optional
Reserved2: u32 // DWORD 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 SetupAddInstallSectionToDiskSpaceListW(IntPtr DiskSpace, IntPtr InfHandle, IntPtr LayoutInfHandle, [MarshalAs(UnmanagedType.LPWStr)] string SectionName, IntPtr Reserved1, uint Reserved2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupAddInstallSectionToDiskSpaceListW' -Namespace Win32 -PassThru
# $api::SetupAddInstallSectionToDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)#uselib "SETUPAPI.dll"
#func global SetupAddInstallSectionToDiskSpaceListW "SetupAddInstallSectionToDiskSpaceListW" wptr, wptr, wptr, wptr, wptr, wptr
; SetupAddInstallSectionToDiskSpaceListW DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2 ; 戻り値は stat
; DiskSpace : void* -> "wptr"
; InfHandle : void* -> "wptr"
; LayoutInfHandle : void* optional -> "wptr"
; SectionName : LPCWSTR -> "wptr"
; Reserved1 : void* optional -> "wptr"
; Reserved2 : DWORD optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupAddInstallSectionToDiskSpaceListW "SetupAddInstallSectionToDiskSpaceListW" sptr, sptr, sptr, wstr, sptr, int
; res = SetupAddInstallSectionToDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
; DiskSpace : void* -> "sptr"
; InfHandle : void* -> "sptr"
; LayoutInfHandle : void* optional -> "sptr"
; SectionName : LPCWSTR -> "wstr"
; Reserved1 : void* optional -> "sptr"
; Reserved2 : DWORD optional -> "int"; BOOL SetupAddInstallSectionToDiskSpaceListW(void* DiskSpace, void* InfHandle, void* LayoutInfHandle, LPCWSTR SectionName, void* Reserved1, DWORD Reserved2)
#uselib "SETUPAPI.dll"
#cfunc global SetupAddInstallSectionToDiskSpaceListW "SetupAddInstallSectionToDiskSpaceListW" intptr, intptr, intptr, wstr, intptr, int
; res = SetupAddInstallSectionToDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
; DiskSpace : void* -> "intptr"
; InfHandle : void* -> "intptr"
; LayoutInfHandle : void* optional -> "intptr"
; SectionName : LPCWSTR -> "wstr"
; Reserved1 : void* optional -> "intptr"
; Reserved2 : DWORD optional -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupAddInstallSectionToDiskSpaceListW = setupapi.NewProc("SetupAddInstallSectionToDiskSpaceListW")
)
// DiskSpace (void*), InfHandle (void*), LayoutInfHandle (void* optional), SectionName (LPCWSTR), Reserved1 (void* optional), Reserved2 (DWORD optional)
r1, _, err := procSetupAddInstallSectionToDiskSpaceListW.Call(
uintptr(DiskSpace),
uintptr(InfHandle),
uintptr(LayoutInfHandle),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SectionName))),
uintptr(Reserved1),
uintptr(Reserved2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupAddInstallSectionToDiskSpaceListW(
DiskSpace: Pointer; // void*
InfHandle: Pointer; // void*
LayoutInfHandle: Pointer; // void* optional
SectionName: PWideChar; // LPCWSTR
Reserved1: Pointer; // void* optional
Reserved2: DWORD // DWORD optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupAddInstallSectionToDiskSpaceListW';result := DllCall("SETUPAPI\SetupAddInstallSectionToDiskSpaceListW"
, "Ptr", DiskSpace ; void*
, "Ptr", InfHandle ; void*
, "Ptr", LayoutInfHandle ; void* optional
, "WStr", SectionName ; LPCWSTR
, "Ptr", Reserved1 ; void* optional
, "UInt", Reserved2 ; DWORD optional
, "Int") ; return: BOOL●SetupAddInstallSectionToDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2) = DLL("SETUPAPI.dll", "bool SetupAddInstallSectionToDiskSpaceListW(void*, void*, void*, char*, void*, dword)")
# 呼び出し: SetupAddInstallSectionToDiskSpaceListW(DiskSpace, InfHandle, LayoutInfHandle, SectionName, Reserved1, Reserved2)
# DiskSpace : void* -> "void*"
# InfHandle : void* -> "void*"
# LayoutInfHandle : void* optional -> "void*"
# SectionName : LPCWSTR -> "char*"
# Reserved1 : void* optional -> "void*"
# Reserved2 : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。