SetupGetLineTextW 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 SetupGetLineText function returns the contents of a line in an INF file in a compact form. The line to retrieve can be specified by an INFCONTEXT structure returned from a SetupFindLineXXX function, or by explicitly passing in the INF handle, section, and key of the desired line.
Syntax
WINSETUPAPI BOOL SetupGetLineTextW(
[in] PINFCONTEXT Context,
[in] HINF InfHandle,
[in] PCWSTR Section,
[in] PCWSTR Key,
[in, out] PWSTR ReturnBuffer,
[in] DWORD ReturnBufferSize,
[in, out] PDWORD RequiredSize
);
Parameters
[in] Context
Context for a line in an INF file whose text is to be retrieved. This parameter can be NULL. If Context is NULL, InfHandle, Section, and Key must all be specified.
[in] InfHandle
Handle to the INF file to query. This parameter can be NULL. This parameter is used only if Context is NULL. If Context is NULL, InfHandle, Section, and Key must all be specified.
[in] Section
Pointer to a null-terminated string that specifies the section that contains the key name of the line whose text is to be retrieved. This parameter can be NULL. This parameter is used only if Context is NULL. If Context is NULL, InfHandle, Section, and Key must be specified.
[in] Key
Pointer to a null-terminated string that contains the key name whose associated string is to be retrieved. This parameter can be NULL. This parameter is used only if Context is NULL. If Context is NULL, InfHandle, Section, and Key must be specified.
[in, out] ReturnBuffer
If not NULL, ReturnBuffer points to a buffer in which this function returns the contents of the line. The null-terminated string must not exceed the size of the destination buffer. You can call the function once to get the required buffer size, allocate the necessary memory, and then call the function a second time to retrieve the data. Using this technique, you can avoid errors due to an insufficient buffer size. See the Remarks section. This parameter can be NULL.
[in] ReturnBufferSize
Size of the buffer pointed to by the ReturnBuffer parameter, in characters. This includes the null terminator.
[in, out] RequiredSize
If not NULL, points to a variable in which this function returns the required size for the buffer pointed to by the ReturnBuffer parameter, in characters. This includes the null terminator. If ReturnBuffer is specified and the size required is larger than the value specified in the ReturnBufferSize parameter, the function fails and does not store data in the buffer.
Return value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
If this function is called with a ReturnBuffer of NULL and a ReturnBufferSize of zero, the function puts the buffer size required to hold the specified data into the variable pointed to by RequiredSize. If the function succeeds in this, the return value is a nonzero value. Otherwise, the return value is zero and extended error information can be obtained by calling GetLastError.
This function returns the contents of a line in a compact format. All extraneous white space is removed and multi-line values are converted into a single contiguous string. For example, this line:
HKLM, , PointerClass0, 1 \
; This is a comment
01, 02, 03
would be returned as:
HKLM,,PointerClass0,1,01,02,03
Note
The setupapi.h header defines SetupGetLineText 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-inf-l1-1-0 (introduced in Windows 8) |