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

SetupUninstallOEMInfA

関数
インストール済みのOEM製INFファイルをアンインストールする(ANSI)。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapi対応OSWindows XP 以降

シグネチャ

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupUninstallOEMInfA(
    LPCSTR InfFileName,
    DWORD Flags,
    void* Reserved   // optional
);

パラメーター

名前方向
InfFileNameLPCSTRin
FlagsDWORDin
Reservedvoid*optional

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupUninstallOEMInfA(
    LPCSTR InfFileName,
    DWORD Flags,
    void* Reserved   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool SetupUninstallOEMInfA(
    [MarshalAs(UnmanagedType.LPStr)] string InfFileName,   // LPCSTR
    uint Flags,   // DWORD
    IntPtr Reserved   // void* optional
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SetupUninstallOEMInfA(
    <MarshalAs(UnmanagedType.LPStr)> InfFileName As String,   ' LPCSTR
    Flags As UInteger,   ' DWORD
    Reserved As IntPtr   ' void* optional
) As Boolean
End Function
' InfFileName : LPCSTR
' Flags : DWORD
' Reserved : void* optional
Declare PtrSafe Function SetupUninstallOEMInfA Lib "setupapi" ( _
    ByVal InfFileName As String, _
    ByVal Flags As Long, _
    ByVal Reserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupUninstallOEMInfA = ctypes.windll.setupapi.SetupUninstallOEMInfA
SetupUninstallOEMInfA.restype = wintypes.BOOL
SetupUninstallOEMInfA.argtypes = [
    wintypes.LPCSTR,  # InfFileName : LPCSTR
    wintypes.DWORD,  # Flags : DWORD
    ctypes.POINTER(None),  # Reserved : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupUninstallOEMInfA = Fiddle::Function.new(
  lib['SetupUninstallOEMInfA'],
  [
    Fiddle::TYPE_VOIDP,  # InfFileName : LPCSTR
    -Fiddle::TYPE_INT,  # Flags : DWORD
    Fiddle::TYPE_VOIDP,  # Reserved : void* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupUninstallOEMInfA(
        InfFileName: *const u8,  // LPCSTR
        Flags: u32,  // DWORD
        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.Ansi)]
public static extern bool SetupUninstallOEMInfA([MarshalAs(UnmanagedType.LPStr)] string InfFileName, uint Flags, IntPtr Reserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupUninstallOEMInfA' -Namespace Win32 -PassThru
# $api::SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
#uselib "SETUPAPI.dll"
#func global SetupUninstallOEMInfA "SetupUninstallOEMInfA" sptr, sptr, sptr
; SetupUninstallOEMInfA InfFileName, Flags, Reserved   ; 戻り値は stat
; InfFileName : LPCSTR -> "sptr"
; Flags : DWORD -> "sptr"
; Reserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SETUPAPI.dll"
#cfunc global SetupUninstallOEMInfA "SetupUninstallOEMInfA" str, int, sptr
; res = SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
; InfFileName : LPCSTR -> "str"
; Flags : DWORD -> "int"
; Reserved : void* optional -> "sptr"
; BOOL SetupUninstallOEMInfA(LPCSTR InfFileName, DWORD Flags, void* Reserved)
#uselib "SETUPAPI.dll"
#cfunc global SetupUninstallOEMInfA "SetupUninstallOEMInfA" str, int, intptr
; res = SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
; InfFileName : LPCSTR -> "str"
; Flags : DWORD -> "int"
; Reserved : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupUninstallOEMInfA = setupapi.NewProc("SetupUninstallOEMInfA")
)

// InfFileName (LPCSTR), Flags (DWORD), Reserved (void* optional)
r1, _, err := procSetupUninstallOEMInfA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(InfFileName))),
	uintptr(Flags),
	uintptr(Reserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupUninstallOEMInfA(
  InfFileName: PAnsiChar;   // LPCSTR
  Flags: DWORD;   // DWORD
  Reserved: Pointer   // void* optional
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupUninstallOEMInfA';
result := DllCall("SETUPAPI\SetupUninstallOEMInfA"
    , "AStr", InfFileName   ; LPCSTR
    , "UInt", Flags   ; DWORD
    , "Ptr", Reserved   ; void* optional
    , "Int")   ; return: BOOL
●SetupUninstallOEMInfA(InfFileName, Flags, Reserved) = DLL("SETUPAPI.dll", "bool SetupUninstallOEMInfA(char*, dword, void*)")
# 呼び出し: SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
# InfFileName : LPCSTR -> "char*"
# Flags : DWORD -> "dword"
# Reserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。