前面准备好文件后,就需要从光盘里拷贝文件到安装目录,下面就是这个过程的界面:
实现这个过程的代码如下:
#001 static
#002 PAGE_NUMBER
#003 FileCopyPage(PINPUT_RECORD Ir)
#004 {
#005 COPYCONTEXT CopyContext;
#006
#007 MUIDisplayPage(FILE_COPY_PAGE);
#008
创建一个拷贝文件的环境结构。
#009 /* Create context for the copy process */
#010 CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
#011 CopyContext.InstallPath = InstallPath.Buffer;
#012 CopyContext.TotalOperations = 0;
#013 CopyContext.CompletedOperations = 0;
#014
#015 /* Create the progress bar as well */
#016 CopyContext.ProgressBar = CreateProgressBar(13,
#017 26,
#018 xScreen - 13,
#019 yScreen - 20,
#020 10,
#021 24,
#022 TRUE,
#023 MUIGetString(STRING_SETUPCOPYINGFILES));
#024
#025 // fit memory bars to screen width,distribute them uniform
#026 unsigned int mem_bar_width = (xScreen - 26) / 5;
#027 mem_bar_width -= mem_bar_width % 2; // make even
#028 /* ATTENTION: The following progress bars are debug stuff,which should not be translated!! */
创建分页内存使用情况的柱条。
#029 /* Create the paged pool progress bar */
#030 CopyContext.MemoryBars[0] = CreateProgressBar(13,
#031 40,
#032 13 + mem_bar_width,
#033 43,
#034 13,
#035 44,
#036 FALSE,
#037 "Paged Memory");
#038
#039 /* Create the non paged pool progress bar */
#040 CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (mem_bar_width / 2),
#041 40,
#042 (xScreen / 2) + (mem_bar_width / 2),
#043 43,
#044 (xScreen / 2)- (mem_bar_width / 2),
#045 44,
#046 FALSE,
#047 "Nonpaged Memory");
#048
创建全局内存使用情况的柱条。
#049 /* Create the global memory progress bar */
#050 CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - mem_bar_width,
#051 40,
#052 xScreen - 13,
#053 43,
#054 xScreen - 13 - mem_bar_width,
#055 44,
#056 FALSE,
#057 "Free Memory");
#058
调用函数SetupCommitFileQueueW来进行所有文件拷贝。
#059 /* Do the file copying */
#060 SetupCommitFileQueueW(NULL,
#061 SetupFileQueue,
#062 FileCopyCallback,
#063 &CopyContext);
#064
#065 /* If we get here,we're done,so cleanup the queue and progress bar */
#066 SetupCloseFileQueue(SetupFileQueue);
#067 DestroyProgressBar(CopyContext.ProgressBar);
#068 DestroyProgressBar(CopyContext.MemoryBars[0]);
#069 DestroyProgressBar(CopyContext.MemoryBars[1]);
#070 DestroyProgressBar(CopyContext.MemoryBars[2]);
#071
#072 /* Go display the next page */
#073 return REGISTRY_PAGE;
#074}
原文链接:https://www.f2er.com/react/308472.html