Opening the INF File

You must use the SetupOpenInfFile function to open the INF file before you can retrieve information from it, or append other INF files to it.

The following opens an INF file using SetupOpenInfFile and returns a handle, MyInf, to the opened INF file. The InfClass parameter of SetupOpenInfFile is specified as NULL to indicate that the Class of the INF file should be ignored.

HINF MyInf;                //variable to hold the INF handle
UINT ErrorLine;            //variable to hold errors returned
BOOL test=0;                 //variable to receive function success
MyInf = SetupOpenInfFile (
      szInfFileName,       //the filename of the inf file to open
      NULL,                //optional class information
      INF_STYLE_WIN4,      //the inf style
      &ErrorLine           //line number of the syntax error

After an INF file is opened, you can call the SetupOpenAppendInfFile function to append a file to the open INF file. To append several files, repeat this process. If you call the SetupOpenAppendInfFile function and the filename passed to it is NULL, then the function will search the Version section of the open INF file (and any appended INF files) for a LayoutFile key. If the function finds a key, it will append the file specified by that key (usually LAYOUT.INF). When multiple INF files have been combined, SetupOpenAppendInfFile starts with the last appended INF file when it searches for a Version section.