共用方式為


開啟 INF 檔案

您必須使用 SetupOpenInfFile 函式來開啟 INF 檔案,才能從中擷取資訊,或將其他 INF 檔案附加至該檔案。

下列程式會使用 SetupOpenInfFile 開啟 INF 檔案,並將句柄 MyInf 傳回至開啟的 INF 檔案。 SetupOpenInfFileInfClass 參數指定 為 null,表示應該忽略 INF 檔案的 Class。

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
);

開啟 INF 檔案之後,您可以呼叫 SetupOpenAppendInfFile 函式,將檔案附加至開啟的 INF 檔案。 若要附加數個檔案,請重複此程式。 如果您呼叫 SetupOpenAppendInfFile 函式,而傳遞給它的檔名會 NULL,則函式會搜尋 Open INF 檔案的 Version 區段(以及任何附加的 INF 檔案),以取得 LayoutFile 索引鍵。 如果函式找到索引鍵,它會附加該索引鍵所指定的檔案(通常是 LAYOUT。INF)。 當合併多個 INF 檔案時,SetupOpenAppendInfFile 會在搜尋 Version 區段時,從最後一個附加的 INF 檔案開始。