SetupInstallServicesFromInfSectionA 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 SetupInstallServicesFromInfSection function performs service installation and deletion operations that are specified in the Service Install sections listed in the Service section of an INF file.

A caller of this function is required to have access to the Service Control Manager, and privileges to modify services.

Syntax

WINSETUPAPI BOOL SetupInstallServicesFromInfSectionA(
  [in] HINF  InfHandle,
  [in] PCSTR SectionName,
  [in] DWORD Flags
);

Parameters

[in] InfHandle

A handle to the INF file that contains the Service section.

[in] SectionName

The name of the Service section to process. You should use a null-terminated string.

[in] Flags

The controls for the installation of each service in the specified section.

Flag Meaning
SPSVCINST_TAGTOFRONT
0x001
AddService section: move the service tag to the front of its group order list.
SPSVCINST_DELETEEVENTLOGENTRY
0x004
DelService section: delete the event log entry.
SPSVCINST_NOCLOBBER_DISPLAYNAME
0x008
AddService section: do not overwrite the display name if one already exists.
SPSVCINST_NOCLOBBER_STARTTYPE
0x010
AddService section: do not overwrite the start type value if the service already exists.
SPSVCINST_NOCLOBBER_ERRORCONTROL
0x020
AddService section: do not overwrite the error control value if the service already exists.
SPSVCINST_NOCLOBBER_LOADORDERGROUP
0x040
AddService section: do not overwrite the load order group if it already exists.
SPSVCINST_NOCLOBBER_DEPENDENCIES
0x080
AddService section: do not overwrite the dependencies list if it already exists.
SPSVCINST_NOCLOBBER_DESCRIPTION
0x100
AddService section: mark this service as the function driver for the device being installed.
SPSVCINST_STOPSERVICE
0x200
DelService section: Stop the associated service specified in the entry before deleting the service.
SPSVCINST_CLOBBER_SECURITY
0x400
AddService section: Security settings the service are overwritten if the service already exists in the system.
Note  Available starting with Windows Server 2003 and Windows XP.
 
SPSVCINST_STARTSERVICE
0x800
AddService section: Start the service after the service is installed. This flag cannot be used to start a service that implements a Plug and Play (PnP) function driver or filter driver for a device. Otherwise, this flag can be used to start a user-mode or kernel-mode service that is managed by the Service Control Manager (SCM.)
Note  Available starting with Windows Server 2008 and Windows Vista.
 
SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES
0x1000
AddService section: Do not overwrite the given service's required privileges if the service already exists in the system.
Note  Available starting with Windows Server 2008 R2 and Windows 7.
 

Return value

If the function succeeds, the return value is nonzero. The function calls SetLastError with ERROR_SUCCESS_REBOOT_REQUIRED if a reboot of the system is required.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.

Remarks

Note

The setupapi.h header defines SetupInstallServicesFromInfSection as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
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

Functions

Overview

SetupInstallFilesFromInfSection

SetupInstallFromInfSection

SetupInstallServicesFromInfSectionEx