SetupFindNextMatchLineW 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 SetupFindNextMatchLine function returns the location of the next line in an INF file relative to ContextIn.Line that matches a specified key.


  [in]      PINFCONTEXT ContextIn,
  [in]      PCWSTR      Key,
  [in, out] PINFCONTEXT ContextOut


[in] ContextIn

Pointer to an INF file context, as retrieved by a call to the SetupFindFirstLine function.

[in] Key

If this optional parameter is specified, it supplies a key to match. This parameter should be a null-terminated string. This parameter can be Null. If Key is not specified, the SetupFindNextMatchLine function is equivalent to the SetupFindNextLine function.

[in, out] ContextOut

Pointer to a variable in which this function returns the context of the found line. ContextOut can point to ContextIn if the caller wishes.

Return value

The function returns a nonzero value if it finds a matching line. Otherwise, the return value is zero. To get extended error information, call GetLastError.


If ContextIn.Inf references multiple INF files that have been appended together using SetupOpenAppendInfFile, the SetupFindNextMatchLine function searches across the specified section in all files referenced by the HINF to locate the next matching line.


The setupapi.h header defines SetupFindNextMatchLine 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-inf-l1-1-0 (introduced in Windows 8)

See also