SetupDiGetActualSectionToInstall

HKEY
    SetupDiGetActualSectionToInstall(
        IN HINF  InfHandle,
        IN PCTSTR  InfSectionName,
        OUT PTSTR  InfSectionWithExt,    /* optional */
        IN DWORD  InfSectionWithExtSize,
        OUT PDWORD
  RequiredSize,    /* optional */
        OUT PTSTR  *Extension    /* optional */
        );

SetupDiGetActualSectionToInstall finds the appropriate Install section to use when installing a device from a Windows NT 4.0-style device INF file.

Parameters
InfHandle
Supplies the handle of the INF file that contains the Install section.
InfSectionName
Supplies a pointer to the name of the Install section as specified by the driver node being installed.
InfSectionWithExt
Supplies a pointer to a character buffer to receive the name of the Install section that should be used for installation. If this parameter is NULL, InfSectionWithExtSize must be 0. The caller can use the NULL value to determine the required buffer size, because the function returns TRUE and RequiredSize is set to the size, in characters, necessary to store the Install section name.
InfSectionWithExtSize
Supplies the size, in characters, of the InfSectionWithExt buffer.
RequiredSize
Supplies a pointer to a variable that receives the size, in characters, required to store the actual Install section name, including the terminating NULL.
Extension
Supplies a pointer to a variable that receives a pointer to the extension, including ".". This parameter is NULL if an extension is not required. Extension points to the extension within the caller-supplied buffer. If the InfSectionWithExt buffer is not supplied, this variable is not filled in.
Return Value

If the function is successful, it returns TRUE. If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Comments

This function supports an OS/architecture-specific extension that can be used to specify multiple installation behaviors for a single device, dependent on the operating environment. An extension is appended to the INF file Install section name to identify that it contains OS/architecture-specific installation instructions. SetupDiGetActualSectionToInstall searches for the different Install section names in the manner described below.

Starting with the Install section name as specified in the driver node (for example, InstallSec) the function attempts to find one of the following section names (the search is carried out in the order listed):

In Windows NT 4.0:
  1. InstallSec.NTplatform 
    where platform is x86, MIPS, Alpha, or PPC.

  2. InstallSec.NT

  3. InstallSec
In Windows 95:
  1. InstallSec.Win

  2. InstallSec

The first Install section located is used for the installation. This section name is also used as the base for Hardware and Services section names. For example, if the Install section name found is InstallSec.NTAlpha, the Services section name must be named InstallSec.NTAlpha.Services.

The original Install section name specified in the driver node is written to the driver's registry key's InfSection value entry. The extension that was found is stored in the key as the REG_SZ value InfSectionExt. For example:

InfSection       : REG_SZ :    "InstallSec"
InfSectionExt    : REG_SZ :    ".NTMIPS"
 

If a driver is not selected for the specified device information element, a NULL driver is installed. Upon return, the Install Parameters flags in the device’s SP_DEVINSTALL_PARAMS structure indicate whether the system should be restarted or rebooted for the device to start.

See Also

SetupDiInstallDevice