ホーム › Devices.DeviceAndDriverInstallation › SetupUninstallOEMInfA
SetupUninstallOEMInfA
関数インストール済みのOEM製INFファイルをアンインストールする(ANSI)。
シグネチャ
// SETUPAPI.dll (ANSI / -A)
#include <windows.h>
BOOL SetupUninstallOEMInfA(
LPCSTR InfFileName,
DWORD Flags,
void* Reserved // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| InfFileName | LPCSTR | in | アンインストールするWindowsディレクトリ内のOEM INFファイル名(ANSI)。 |
| Flags | DWORD | in | SUOI_FORCEDELETEなどアンインストール動作を制御するフラグ。 |
| Reserved | void* | optional | 予約済み。NULLを指定する必要がある。 |
戻り値の型: 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 <MarshalAs(UnmanagedType.Bool)> 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 // BOOLfunction 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)。const std = @import("std");
extern "setupapi" fn SetupUninstallOEMInfA(
InfFileName: [*c]const u8, // LPCSTR
Flags: u32, // DWORD
Reserved: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) i32;proc SetupUninstallOEMInfA(
InfFileName: cstring, # LPCSTR
Flags: uint32, # DWORD
Reserved: pointer # void* optional
): int32 {.importc: "SetupUninstallOEMInfA", stdcall, dynlib: "SETUPAPI.dll".}pragma(lib, "setupapi");
extern(Windows)
int SetupUninstallOEMInfA(
const(char)* InfFileName, // LPCSTR
uint Flags, // DWORD
void* Reserved // void* optional
);ccall((:SetupUninstallOEMInfA, "SETUPAPI.dll"), stdcall, Int32,
(Cstring, UInt32, Ptr{Cvoid}),
InfFileName, Flags, Reserved)
# InfFileName : LPCSTR -> Cstring
# Flags : DWORD -> UInt32
# Reserved : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetupUninstallOEMInfA(
const char* InfFileName,
uint32_t Flags,
void* Reserved);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
-- InfFileName : LPCSTR
-- Flags : DWORD
-- Reserved : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SETUPAPI.dll');
const SetupUninstallOEMInfA = lib.func('__stdcall', 'SetupUninstallOEMInfA', 'int32_t', ['str', 'uint32_t', 'void *']);
// SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
// InfFileName : LPCSTR -> 'str'
// Flags : DWORD -> 'uint32_t'
// Reserved : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SETUPAPI.dll", {
SetupUninstallOEMInfA: { parameters: ["buffer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.SetupUninstallOEMInfA(InfFileName, Flags, Reserved)
// InfFileName : LPCSTR -> "buffer"
// Flags : DWORD -> "u32"
// Reserved : void* optional -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetupUninstallOEMInfA(
const char* InfFileName,
uint32_t Flags,
void* Reserved);
C, "SETUPAPI.dll");
// $ffi->SetupUninstallOEMInfA(InfFileName, Flags, Reserved);
// InfFileName : LPCSTR
// Flags : DWORD
// Reserved : void* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Setupapi extends StdCallLibrary {
Setupapi INSTANCE = Native.load("setupapi", Setupapi.class, W32APIOptions.ASCII_OPTIONS);
boolean SetupUninstallOEMInfA(
String InfFileName, // LPCSTR
int Flags, // DWORD
Pointer Reserved // void* optional
);
}@[Link("setupapi")]
lib LibSETUPAPI
fun SetupUninstallOEMInfA = SetupUninstallOEMInfA(
InfFileName : UInt8*, # LPCSTR
Flags : UInt32, # DWORD
Reserved : Void* # void* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetupUninstallOEMInfANative = Int32 Function(Pointer<Utf8>, Uint32, Pointer<Void>);
typedef SetupUninstallOEMInfADart = int Function(Pointer<Utf8>, int, Pointer<Void>);
final SetupUninstallOEMInfA = DynamicLibrary.open('SETUPAPI.dll')
.lookupFunction<SetupUninstallOEMInfANative, SetupUninstallOEMInfADart>('SetupUninstallOEMInfA');
// InfFileName : LPCSTR -> Pointer<Utf8>
// Flags : DWORD -> Uint32
// Reserved : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetupUninstallOEMInfA(
InfFileName: PAnsiChar; // LPCSTR
Flags: DWORD; // DWORD
Reserved: Pointer // void* optional
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupUninstallOEMInfA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetupUninstallOEMInfA"
c_SetupUninstallOEMInfA :: CString -> Word32 -> Ptr () -> IO CInt
-- InfFileName : LPCSTR -> CString
-- Flags : DWORD -> Word32
-- Reserved : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setupuninstalloeminfa =
foreign "SetupUninstallOEMInfA"
(string @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* InfFileName : LPCSTR -> string *)
(* Flags : DWORD -> uint32_t *)
(* Reserved : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)
(cffi:defcfun ("SetupUninstallOEMInfA" setup-uninstall-oeminf-a :convention :stdcall) :int32
(inf-file-name :string) ; LPCSTR
(flags :uint32) ; DWORD
(reserved :pointer)) ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetupUninstallOEMInfA = Win32::API::More->new('SETUPAPI',
'BOOL SetupUninstallOEMInfA(LPCSTR InfFileName, DWORD Flags, LPVOID Reserved)');
# my $ret = $SetupUninstallOEMInfA->Call($InfFileName, $Flags, $Reserved);
# InfFileName : LPCSTR -> LPCSTR
# Flags : DWORD -> DWORD
# Reserved : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f SetupUninstallOEMInfW (Unicode版) — インストール済みのOEM製INFファイルをアンインストールする(Unicode)。