ホーム › Devices.DeviceAndDriverInstallation › SetupRemoveSectionFromDiskSpaceListA
SetupRemoveSectionFromDiskSpaceListA
関数INFセクションのファイル操作をディスク容量リストから削除する。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupRemoveSectionFromDiskSpaceListA(
void* DiskSpace,
void* InfHandle,
void* ListInfHandle, // optional
LPCSTR SectionName,
SETUP_FILE_OPERATION Operation,
void* Reserved1, // optional
DWORD Reserved2 // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| DiskSpace | void* | in |
| InfHandle | void* | in |
| ListInfHandle | void* | inoptional |
| SectionName | LPCSTR | in |
| Operation | SETUP_FILE_OPERATION | in |
| Reserved1 | void* | optional |
| Reserved2 | DWORD | optional |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupRemoveSectionFromDiskSpaceListA(
void* DiskSpace,
void* InfHandle,
void* ListInfHandle, // optional
LPCSTR SectionName,
SETUP_FILE_OPERATION Operation,
void* Reserved1, // optional
DWORD Reserved2 // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupRemoveSectionFromDiskSpaceListA(
IntPtr DiskSpace, // void*
IntPtr InfHandle, // void*
IntPtr ListInfHandle, // void* optional
[MarshalAs(UnmanagedType.LPStr)] string SectionName, // LPCSTR
uint Operation, // SETUP_FILE_OPERATION
IntPtr Reserved1, // void* optional
uint Reserved2 // DWORD optional
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupRemoveSectionFromDiskSpaceListA(
DiskSpace As IntPtr, ' void*
InfHandle As IntPtr, ' void*
ListInfHandle As IntPtr, ' void* optional
<MarshalAs(UnmanagedType.LPStr)> SectionName As String, ' LPCSTR
Operation As UInteger, ' SETUP_FILE_OPERATION
Reserved1 As IntPtr, ' void* optional
Reserved2 As UInteger ' DWORD optional
) As Boolean
End Function' DiskSpace : void*
' InfHandle : void*
' ListInfHandle : void* optional
' SectionName : LPCSTR
' Operation : SETUP_FILE_OPERATION
' Reserved1 : void* optional
' Reserved2 : DWORD optional
Declare PtrSafe Function SetupRemoveSectionFromDiskSpaceListA Lib "setupapi" ( _
ByVal DiskSpace As LongPtr, _
ByVal InfHandle As LongPtr, _
ByVal ListInfHandle As LongPtr, _
ByVal SectionName As String, _
ByVal Operation As Long, _
ByVal Reserved1 As LongPtr, _
ByVal Reserved2 As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupRemoveSectionFromDiskSpaceListA = ctypes.windll.setupapi.SetupRemoveSectionFromDiskSpaceListA
SetupRemoveSectionFromDiskSpaceListA.restype = wintypes.BOOL
SetupRemoveSectionFromDiskSpaceListA.argtypes = [
ctypes.POINTER(None), # DiskSpace : void*
ctypes.POINTER(None), # InfHandle : void*
ctypes.POINTER(None), # ListInfHandle : void* optional
wintypes.LPCSTR, # SectionName : LPCSTR
wintypes.DWORD, # Operation : SETUP_FILE_OPERATION
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')
SetupRemoveSectionFromDiskSpaceListA = Fiddle::Function.new(
lib['SetupRemoveSectionFromDiskSpaceListA'],
[
Fiddle::TYPE_VOIDP, # DiskSpace : void*
Fiddle::TYPE_VOIDP, # InfHandle : void*
Fiddle::TYPE_VOIDP, # ListInfHandle : void* optional
Fiddle::TYPE_VOIDP, # SectionName : LPCSTR
-Fiddle::TYPE_INT, # Operation : SETUP_FILE_OPERATION
Fiddle::TYPE_VOIDP, # Reserved1 : void* optional
-Fiddle::TYPE_INT, # Reserved2 : DWORD optional
],
Fiddle::TYPE_INT)#[link(name = "setupapi")]
extern "system" {
fn SetupRemoveSectionFromDiskSpaceListA(
DiskSpace: *mut (), // void*
InfHandle: *mut (), // void*
ListInfHandle: *mut (), // void* optional
SectionName: *const u8, // LPCSTR
Operation: u32, // SETUP_FILE_OPERATION
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.Ansi, SetLastError = true)]
public static extern bool SetupRemoveSectionFromDiskSpaceListA(IntPtr DiskSpace, IntPtr InfHandle, IntPtr ListInfHandle, [MarshalAs(UnmanagedType.LPStr)] string SectionName, uint Operation, IntPtr Reserved1, uint Reserved2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupRemoveSectionFromDiskSpaceListA' -Namespace Win32 -PassThru
# $api::SetupRemoveSectionFromDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)#uselib "SETUPAPI.dll"
#func global SetupRemoveSectionFromDiskSpaceListA "SetupRemoveSectionFromDiskSpaceListA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SetupRemoveSectionFromDiskSpaceListA DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2 ; 戻り値は stat
; DiskSpace : void* -> "sptr"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; SectionName : LPCSTR -> "sptr"
; Operation : SETUP_FILE_OPERATION -> "sptr"
; Reserved1 : void* optional -> "sptr"
; Reserved2 : DWORD optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SETUPAPI.dll"
#cfunc global SetupRemoveSectionFromDiskSpaceListA "SetupRemoveSectionFromDiskSpaceListA" sptr, sptr, sptr, str, int, sptr, int
; res = SetupRemoveSectionFromDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
; DiskSpace : void* -> "sptr"
; InfHandle : void* -> "sptr"
; ListInfHandle : void* optional -> "sptr"
; SectionName : LPCSTR -> "str"
; Operation : SETUP_FILE_OPERATION -> "int"
; Reserved1 : void* optional -> "sptr"
; Reserved2 : DWORD optional -> "int"; BOOL SetupRemoveSectionFromDiskSpaceListA(void* DiskSpace, void* InfHandle, void* ListInfHandle, LPCSTR SectionName, SETUP_FILE_OPERATION Operation, void* Reserved1, DWORD Reserved2)
#uselib "SETUPAPI.dll"
#cfunc global SetupRemoveSectionFromDiskSpaceListA "SetupRemoveSectionFromDiskSpaceListA" intptr, intptr, intptr, str, int, intptr, int
; res = SetupRemoveSectionFromDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
; DiskSpace : void* -> "intptr"
; InfHandle : void* -> "intptr"
; ListInfHandle : void* optional -> "intptr"
; SectionName : LPCSTR -> "str"
; Operation : SETUP_FILE_OPERATION -> "int"
; Reserved1 : void* optional -> "intptr"
; Reserved2 : DWORD optional -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupRemoveSectionFromDiskSpaceListA = setupapi.NewProc("SetupRemoveSectionFromDiskSpaceListA")
)
// DiskSpace (void*), InfHandle (void*), ListInfHandle (void* optional), SectionName (LPCSTR), Operation (SETUP_FILE_OPERATION), Reserved1 (void* optional), Reserved2 (DWORD optional)
r1, _, err := procSetupRemoveSectionFromDiskSpaceListA.Call(
uintptr(DiskSpace),
uintptr(InfHandle),
uintptr(ListInfHandle),
uintptr(unsafe.Pointer(windows.BytePtrFromString(SectionName))),
uintptr(Operation),
uintptr(Reserved1),
uintptr(Reserved2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupRemoveSectionFromDiskSpaceListA(
DiskSpace: Pointer; // void*
InfHandle: Pointer; // void*
ListInfHandle: Pointer; // void* optional
SectionName: PAnsiChar; // LPCSTR
Operation: DWORD; // SETUP_FILE_OPERATION
Reserved1: Pointer; // void* optional
Reserved2: DWORD // DWORD optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupRemoveSectionFromDiskSpaceListA';result := DllCall("SETUPAPI\SetupRemoveSectionFromDiskSpaceListA"
, "Ptr", DiskSpace ; void*
, "Ptr", InfHandle ; void*
, "Ptr", ListInfHandle ; void* optional
, "AStr", SectionName ; LPCSTR
, "UInt", Operation ; SETUP_FILE_OPERATION
, "Ptr", Reserved1 ; void* optional
, "UInt", Reserved2 ; DWORD optional
, "Int") ; return: BOOL●SetupRemoveSectionFromDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2) = DLL("SETUPAPI.dll", "bool SetupRemoveSectionFromDiskSpaceListA(void*, void*, void*, char*, dword, void*, dword)")
# 呼び出し: SetupRemoveSectionFromDiskSpaceListA(DiskSpace, InfHandle, ListInfHandle, SectionName, Operation, Reserved1, Reserved2)
# DiskSpace : void* -> "void*"
# InfHandle : void* -> "void*"
# ListInfHandle : void* optional -> "void*"
# SectionName : LPCSTR -> "char*"
# Operation : SETUP_FILE_OPERATION -> "dword"
# Reserved1 : void* optional -> "void*"
# Reserved2 : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。