建立佇列和佇列檔案作業
佇列檔案作業很有用,因為它可讓您以整體方式處理安裝,而不是 INF 區段。
若要建立檔案佇列,請宣告變數來儲存佇列句柄,然後呼叫 SetupOpenFileQueue 函式。 建立佇列之後,您可以將複製、重新命名和刪除作業排入佇列,以及掃描檔案佇列以確認加入佇列的作業。
若要將單一檔案作業新增至佇列,請使用 SetupQueueCopy、SetupQueueRename和 SetupQueueDelete 函式。
您可以使用 SetupQueueCopySection、SetupQueueDeleteSection或 SetupQueueRenameSection,將 複製檔案、Delete Files或 Rename Files 區段中所列的所有檔案作業新增至佇列。
另一種將 INF Install 區段中列出的 複製檔案 區段中所有檔案排入佇列的方法是使用函式 SetupInstallFilesFromInfSection。
下列範例會使用 SetupQueueCopySection 函式,針對 INF 檔案 複製 區段中所列的所有檔案加入佇列複製作業。
test = SetupQueueCopySection(
MyQueue, \\Handle to the open queue
"A:\", \\Source root path
MyInf, \\Inf containing the source info
NULL, \\specifies that MyInf contains
\\ the section to copy as well
MySection, \\the name of the section to queue
\\flags specifying the copy style
SP_COPY_NOSKIP | SP_COPY_NOBROWSE,
);
在此範例中,MyQueue 是將複製作業新增至 的佇列,“A:\” 會指定來源的路徑,而 MyInf 是開啟 INF 檔案的句柄。 ListInfHandle 參數 設為 NULL,表示複製的區段位於 MyInf 中。 MySection 是 MyInf 中的區段,其中包含要排入佇列以複製的檔案。
旗標 SP_COPY_NOSKIP 和 SP_COPY_NOBROWSE 已使用 OR 運算子結合,表示如果發生錯誤,使用者不應被提供略過或瀏覽檔案的選項。