Queuing the file operations is useful because it enables you to process the installation as a whole, instead of by INF section.
To create a file queue, declare a variable to store the queue handle, then call the SetupOpenFileQueue function.
HSPFILEQ MyQueue; \\variable to hold the queue
\\handle
MyQueue = SetupOpenFileQueue(); \\create the queue
In the example, MyQueue is the handle to the queue created by SetupOpenFileQueue.
After the queue is created, you can queue copy, rename, and delete operations, as well as scan the file queue to verify enqueued operations.
To add single file operations to the queue, use the SetupQueueCopy, SetupQueueRename, and SetupQueueDelete functions.
All the file operations listed in a Copy Files, Delete Files, or Rename Files section can be added to the queue by using SetupQueueCopySection, SetupQueueDeleteSection, or SetupQueueRenameSection, respectively.
Another way to queue all the files in the Copy Files sections listed in an Install section of an INF is to use the function, SetupInstallFilesFromInfSection.
The following example uses the SetupQueueCopySection function to enqueue copy operations for all the files listed in a Copy Files section of an INF file.
test = SetupQueueCopySection(
MyQueue, \\Handle of 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,
);
In the example, MyQueue is the queue to add copy operations to, "A:\" specifies the path to the source, and MyInf is the handle to the open INF file. The parameter ListInfHandle is set to NULL, indicating that the section for copying is in MyInf. MySection is the section in MyInf containing the files to queue for copying.
The flags SP_COPY_NOSKIP and SP_COPY_NOBROWSE have been combined using an OR operator to indicate that the user should not be offered options to skip or browse for files if errors occur.