Fix option selection in bootcd

Fix SetupOpenFileQueue, SetupCloseFileQueue and SetupCommitFileQueueW prototypes to match setupapi.dll ones

svn path=/trunk/; revision=23862
This commit is contained in:
Hervé Poussineau 2006-09-01 09:53:33 +00:00
parent 30f4d83978
commit f05d1bb617
5 changed files with 78 additions and 46 deletions

View file

@ -684,7 +684,7 @@ CONSOLE_NormalTextXY(
FillConsoleOutputAttribute( FillConsoleOutputAttribute(
StdOutput, StdOutput,
FOREGROUND_BLUE | BACKGROUND_WHITE, FOREGROUND_WHITE | BACKGROUND_BLUE,
col, col,
coPos, coPos,
&Written); &Written);

View file

@ -63,6 +63,10 @@ extern SHORT xScreen, yScreen;
BOOL WINAPI BOOL WINAPI
ConAllocConsole(VOID); ConAllocConsole(VOID);
BOOL WINAPI
ConAttachConsole(
IN DWORD dwProcessId);
BOOL WINAPI BOOL WINAPI
ConFillConsoleOutputAttribute( ConFillConsoleOutputAttribute(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,

View file

@ -60,7 +60,7 @@ typedef struct _FILEQUEUEHEADER
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
HSPFILEQ HSPFILEQ WINAPI
SetupOpenFileQueue(VOID) SetupOpenFileQueue(VOID)
{ {
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
@ -81,14 +81,14 @@ SetupOpenFileQueue(VOID)
} }
BOOL VOID WINAPI
SetupCloseFileQueue(HSPFILEQ QueueHandle) SetupCloseFileQueue(HSPFILEQ QueueHandle)
{ {
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry; PQUEUEENTRY Entry;
if (QueueHandle == NULL) if (QueueHandle == NULL)
return(FALSE); return;
QueueHeader = (PFILEQUEUEHEADER)QueueHandle; QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
@ -133,8 +133,6 @@ SetupCloseFileQueue(HSPFILEQ QueueHandle)
RtlFreeHeap(ProcessHeap, RtlFreeHeap(ProcessHeap,
0, 0,
QueueHeader); QueueHeader);
return(TRUE);
} }
@ -314,21 +312,36 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
} }
BOOL typedef struct _COPYCONTEXT
SetupCommitFileQueue(HSPFILEQ QueueHandle, {
PCWSTR TargetRootPath, LPCWSTR DestinationRootPath; /* Not owned by this structure */
PCWSTR TargetPath, LPCWSTR InstallPath; /* Not owned by this structure */
PSP_FILE_CALLBACK MsgHandler, ULONG TotalOperations;
ULONG CompletedOperations;
PPROGRESSBAR ProgressBar;
} COPYCONTEXT, *PCOPYCONTEXT;
BOOL WINAPI
SetupCommitFileQueueW(HWND Owner,
HSPFILEQ QueueHandle,
PSP_FILE_CALLBACK_W MsgHandler,
PVOID Context) PVOID Context)
{ {
WCHAR CabinetName[MAX_PATH]; WCHAR CabinetName[MAX_PATH];
PFILEQUEUEHEADER QueueHeader; PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry; PQUEUEENTRY Entry;
NTSTATUS Status; NTSTATUS Status;
PCWSTR TargetRootPath, TargetPath;
WCHAR FileSrcPath[MAX_PATH]; WCHAR FileSrcPath[MAX_PATH];
WCHAR FileDstPath[MAX_PATH]; WCHAR FileDstPath[MAX_PATH];
DPRINT1("Context %p\n", Context);
TargetRootPath = ((PCOPYCONTEXT)Context)->DestinationRootPath;
DPRINT1("TargetRootPath %S\n", TargetRootPath);
TargetPath = ((PCOPYCONTEXT)Context)->InstallPath;
DPRINT1("TargetPath %S\n", TargetPath);
if (QueueHandle == NULL) if (QueueHandle == NULL)
return(FALSE); return(FALSE);
@ -336,13 +349,13 @@ SetupCommitFileQueue(HSPFILEQ QueueHandle,
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_STARTQUEUE, SPFILENOTIFY_STARTQUEUE,
NULL, 0,
NULL); 0);
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_STARTSUBQUEUE, SPFILENOTIFY_STARTSUBQUEUE,
(PVOID)FILEOP_COPY, FILEOP_COPY,
(PVOID)QueueHeader->CopyCount); QueueHeader->CopyCount);
/* Commit copy queue */ /* Commit copy queue */
Entry = QueueHeader->CopyHead; Entry = QueueHeader->CopyHead;
@ -389,8 +402,8 @@ SetupCommitFileQueue(HSPFILEQ QueueHandle,
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_STARTCOPY, SPFILENOTIFY_STARTCOPY,
(PVOID)Entry->SourceFilename, (UINT_PTR)Entry->SourceFilename,
(PVOID)FILEOP_COPY); FILEOP_COPY);
if (Entry->SourceCabinet != NULL) if (Entry->SourceCabinet != NULL)
{ {
@ -411,16 +424,16 @@ SetupCommitFileQueue(HSPFILEQ QueueHandle,
{ {
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_COPYERROR, SPFILENOTIFY_COPYERROR,
(PVOID)Entry->SourceFilename, (UINT_PTR)Entry->SourceFilename,
(PVOID)FILEOP_COPY); FILEOP_COPY);
} }
else else
{ {
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_ENDCOPY, SPFILENOTIFY_ENDCOPY,
(PVOID)Entry->SourceFilename, (UINT_PTR)Entry->SourceFilename,
(PVOID)FILEOP_COPY); FILEOP_COPY);
} }
Entry = Entry->Next; Entry = Entry->Next;
@ -428,13 +441,13 @@ SetupCommitFileQueue(HSPFILEQ QueueHandle,
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_ENDSUBQUEUE, SPFILENOTIFY_ENDSUBQUEUE,
(PVOID)FILEOP_COPY, FILEOP_COPY,
NULL); 0);
MsgHandler(Context, MsgHandler(Context,
SPFILENOTIFY_ENDQUEUE, SPFILENOTIFY_ENDQUEUE,
NULL, 0,
NULL); 0);
return(TRUE); return(TRUE);
} }

View file

@ -53,19 +53,32 @@
typedef PVOID HSPFILEQ; typedef PVOID HSPFILEQ;
typedef ULONG (*PSP_FILE_CALLBACK)(PVOID Context, typedef UINT (CALLBACK* PSP_FILE_CALLBACK_W)(PVOID Context,
ULONG Notification, UINT Notification,
PVOID Param1, UINT_PTR Param1,
PVOID Param2); UINT_PTR Param2);
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
HSPFILEQ HSPFILEQ WINAPI
SetupOpenFileQueue(VOID); SetupOpenFileQueue(VOID);
BOOL VOID WINAPI
SetupCloseFileQueue(HSPFILEQ QueueHandle); SetupCloseFileQueue(
IN HSPFILEQ QueueHandle);
BOOL WINAPI
SetupQueueCopyWNew(
IN HSPFILEQ QueueHandle,
IN PCWSTR SourceRootPath,
IN PCWSTR SourcePath,
IN PCWSTR SourceFileName,
IN PCWSTR SourceDescription,
IN PCWSTR SourceTagFile,
IN PCWSTR TargetDirectory,
IN PCWSTR TargetFileName,
IN DWORD CopyStyle);
BOOL BOOL
SetupQueueCopy(HSPFILEQ QueueHandle, SetupQueueCopy(HSPFILEQ QueueHandle,
@ -76,11 +89,10 @@ SetupQueueCopy(HSPFILEQ QueueHandle,
PCWSTR TargetDirectory, PCWSTR TargetDirectory,
PCWSTR TargetFilename); PCWSTR TargetFilename);
BOOL BOOL WINAPI
SetupCommitFileQueue(HSPFILEQ QueueHandle, SetupCommitFileQueueW(HWND Owner,
PCWSTR TargetRootPath, HSPFILEQ QueueHandle,
PCWSTR TargetPath, PSP_FILE_CALLBACK_W MsgHandler,
PSP_FILE_CALLBACK MsgHandler,
PVOID Context); PVOID Context);
#endif /* __FILEQUEUE_H__ */ #endif /* __FILEQUEUE_H__ */

View file

@ -71,6 +71,8 @@ typedef enum _PAGE_NUMBER
typedef struct _COPYCONTEXT typedef struct _COPYCONTEXT
{ {
LPCWSTR DestinationRootPath; /* Not owned by this structure */
LPCWSTR InstallPath; /* Not owned by this structure */
ULONG TotalOperations; ULONG TotalOperations;
ULONG CompletedOperations; ULONG CompletedOperations;
PPROGRESSBAR ProgressBar; PPROGRESSBAR ProgressBar;
@ -2920,11 +2922,11 @@ PrepareCopyPage(PINPUT_RECORD Ir)
} }
static ULONG static UINT CALLBACK
FileCopyCallback(PVOID Context, FileCopyCallback(PVOID Context,
ULONG Notification, UINT Notification,
PVOID Param1, UINT_PTR Param1,
PVOID Param2) UINT_PTR Param2)
{ {
PCOPYCONTEXT CopyContext; PCOPYCONTEXT CopyContext;
@ -2967,6 +2969,8 @@ FileCopyPage(PINPUT_RECORD Ir)
CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete."); CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete.");
CONSOLE_GetScreenSize(&xScreen, &yScreen); CONSOLE_GetScreenSize(&xScreen, &yScreen);
CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
CopyContext.InstallPath = InstallPath.Buffer;
CopyContext.TotalOperations = 0; CopyContext.TotalOperations = 0;
CopyContext.CompletedOperations = 0; CopyContext.CompletedOperations = 0;
CopyContext.ProgressBar = CreateProgressBar(13, CopyContext.ProgressBar = CreateProgressBar(13,
@ -2975,10 +2979,9 @@ FileCopyPage(PINPUT_RECORD Ir)
yScreen - 20, yScreen - 20,
"Setup is copying files..."); "Setup is copying files...");
SetupCommitFileQueue(SetupFileQueue, SetupCommitFileQueueW(NULL,
DestinationRootPath.Buffer, SetupFileQueue,
InstallPath.Buffer, FileCopyCallback,
(PSP_FILE_CALLBACK)FileCopyCallback,
&CopyContext); &CopyContext);
SetupCloseFileQueue(SetupFileQueue); SetupCloseFileQueue(SetupFileQueue);
@ -3489,7 +3492,7 @@ RunUSetup(VOID)
SignalInitEvent(); SignalInitEvent();
ret = AllocConsole(); ret = AllocConsole();
if (ret) if (!ret)
ret = AttachConsole(ATTACH_PARENT_PROCESS); ret = AttachConsole(ATTACH_PARENT_PROCESS);
if (!ret if (!ret