Search code examples
c++windowssetupapi

Can the key of a line in an .inf file be retrieved using the SetupAPI?


I'm using the function SetupGetLineText ( http://msdn.microsoft.com/en-us/library/aa377388(v=VS.85).aspx ) from the Setup API to read a line from a section in an inf file.

Lines are in the format:

key=value

SetupGetLineText appears to return the value part. That's fine, but I also want to know what the key is for the current context I'm reading. There doesn't seem to be a function in the Setup API for reading the key.

Any help in working out how to retrieve the key would be appreciated.


Solution

  • A long shot:

    BOOL SetupGetStringField(
      __in     PINFCONTEXT Context,
      __in     DWORD FieldIndex,
      __inout  PTSTR ReturnBuffer,
      __in     DWORD ReturnBufferSize,
      __out    PDWORD RequiredSize
    );
    

    with

    FieldIndex [in]
    The 1-based index of the field within the specified line from which the string should be retrieved. Use a FieldIndex of 0 to retrieve a string key, if present.