SetupDiGetActualModelsSectionW function (setupapi.h)
The SetupDiGetActualModelsSection function retrieves the appropriate decorated INF Models section to use when installing a device from a device INF file.
Syntax
WINSETUPAPI BOOL SetupDiGetActualModelsSectionW(
[in] PINFCONTEXT Context,
[in, optional] PSP_ALTPLATFORM_INFO AlternatePlatformInfo,
[out, optional] PWSTR InfSectionWithExt,
[in] DWORD InfSectionWithExtSize,
[out, optional] PDWORD RequiredSize,
PVOID Reserved
);
Parameters
[in] Context
A pointer to an INF file context that specifies a manufacturer-identifier entry in an INF Manufacturer section of an INF file. The manufacturer-identifier entry specifies an INF Models section name and optionally specifies TargetOSVersion decorations for the Models section name. For information about INF files and an INF file context, see the Platform SDK topics on using INF files and the INFCONTEXT structure.
[in, optional] AlternatePlatformInfo
A pointer to an SP_ALTPLATFORM_INFO structure that supplies information about a Windows version and processor architecture. The cbSize member of this structure must be set to sizeof(SP_ALTPLATFORM_INFO_V2). This parameter is optional and can be set to NULL.
[out, optional] InfSectionWithExt
A pointer to a buffer that receives a string that contains the decorated INF Models section name and a NULL terminator. If AlternatePlatformInfo is not supplied, the decorated INF Models section name applies to the current platform; otherwise the name applies to the specified alternative platform. This parameter is optional and can be set to NULL. If this parameter is NULL, the function returns TRUE and sets RequiredSize to the size, in characters, that is required to return the decorated Models section name and a terminating NULL character.
[in] InfSectionWithExtSize
The size, in characters, of the DecoratedModelsSection buffer. If DecoratedModelsSection is NULL, this parameter must be set to zero.
[out, optional] RequiredSize
A pointer to a DWORD-type variable that receives the size, in characters, of the DecoratedModelsSection buffer that is required to retrieve the decorated Models section name and a terminating NULL character. This parameter is optional and can be set to NULL.
Reserved
Reserved for internal system use. This parameter must be set to NULL.
Return value
SetupDiGetActualModelsSection returns TRUE if the operation succeeds. Otherwise, the function returns FALSE and the logged error can be retrieved with a call to GetLastError.
Remarks
SetupDiGetActualModelsSection determines which TargetOSVersion fields in the manufacturer-identifier entry (supplied by Context) apply to the current platform, if AlternatePlatformInfo is not supplied, or to an alternative platform, if alternative platform information is supplied. SetupDiGetActualModelsSection selects the most appropriate platform based on all the TargetOSVersion fields, appends the TargetOSVersion string to the INF Models section name, and returns the decorated INF Models section name to the caller. In a manufacturer-identifier entry, the operating system major version is specified by the OSMajorVersion field and the operating system minor version is specified by the OSMinorVersion field.
For information about retrieving an INF DDInstall section for a device, see SetupDiGetActualSectionToInstall.
Note
The setupapi.h header defines SetupDiGetActualModelsSection 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 | Available in Windows Server 2003 with Service Pack 1 (SP1) and later versions of Windows. |
Target Platform | Desktop |
Header | setupapi.h (include Setupapi.h) |
Library | Setupapi.lib |