SetupUninstallOEMInfW function (setupapi.h)

[This function is available for use in the operating systems indicated in the Requirements section. It may be altered or unavailable in subsequent versions. SetupAPI should no longer be used for installing applications. Instead, use the Windows Installer for developing application installers. SetupAPI continues to be used for installing device drivers.]

The SetupUninstallOEMInf function uninstalls a specified .inf file and any associated .pnf file. If the .inf file was installed with a catalog for signing drivers, the catalog is also removed. A caller of this function must have administrative privileges, otherwise the function fails.


  [in] PCWSTR InfFileName,
  [in] DWORD  Flags,
  [in] PVOID  Reserved


[in] InfFileName

File name, without path, of the .inf file in the Windows Inf directory that is to be uninstalled.

[in] Flags

This parameter can be set as follows.

Flag Meaning
The SetupUninstallOEMInf function first checks whether there are any devices installed using the .inf file. A device does not need to be present to be detected as using the .inf file.

If this flag is not set and the function finds a currently installed device that was installed using this .inf file, the .inf file is not removed.

If this flag is set, the .inf file is removed whether the function finds a device that was installed with this .inf file.

Note  This flag only applies to x86, amd64, and ia64 architectures.  It is ignored on all other architectures.
Note  If the driver package has any files that are copied to a DestinationDir that uses a dirid of 13, then this force flag is ignored.

[in] Reserved

Set to null.

Return value

This function returns WINSETUPAPI BOOL.



The setupapi.h header defines SetupUninstallOEMInf as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header setupapi.h
Library Setupapi.lib
DLL Setupapi.dll
API set ext-ms-win-setupapi-classinstallers-l1-1-2 (introduced in Windows 10, version 10.0.14393)

See also