Added some more files to the boot cd.

Implemented file copy queue.

svn path=/trunk/; revision=3774
This commit is contained in:
Eric Kohl 2002-11-23 01:55:27 +00:00
parent b8d0354d95
commit e6d113445e
10 changed files with 924 additions and 105 deletions

View file

@ -8,6 +8,7 @@ md %BOOTCD_DIR%\disk\install
md %BOOTCD_DIR%\disk\reactos
md %BOOTCD_DIR%\disk\reactos\system32
rem copy boot files
copy /Y ntoskrnl\ntoskrnl.exe %BOOTCD_DIR%\disk\reactos
copy /Y hal\halx86\hal.dll %BOOTCD_DIR%\disk\reactos
copy /Y drivers\fs\vfat\vfatfs.sys %BOOTCD_DIR%\disk\reactos
@ -24,4 +25,31 @@ copy /Y drivers\storage\class2\class2.sys %BOOTCD_DIR%\disk\reactos
copy /Y lib\ntdll\ntdll.dll %BOOTCD_DIR%\disk\reactos\system32
copy /Y subsys\system\usetup\usetup.exe %BOOTCD_DIR%\disk\reactos\system32\smss.exe
rem copy install files
copy /Y txtsetup.sif %BOOTCD_DIR%\disk\install
copy /Y ntoskrnl\ntoskrnl.exe %BOOTCD_DIR%\disk\install
copy /Y hal\halx86\hal.dll %BOOTCD_DIR%\disk\install
copy /Y drivers\fs\vfat\vfatfs.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\fs\cdfs\cdfs.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\fs\ntfs\ntfs.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\dd\floppy\floppy.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\dd\blue\blue.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\input\keyboard\keyboard.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\storage\atapi\atapi.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\storage\scsiport\scsiport.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\storage\cdrom\cdrom.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\storage\disk\disk.sys %BOOTCD_DIR%\disk\install
copy /Y drivers\storage\class2\class2.sys %BOOTCD_DIR%\disk\install
copy /Y lib\ntdll\ntdll.dll %BOOTCD_DIR%\disk\install
copy /Y lib\advapi32\advapi32.dll %BOOTCD_DIR%\disk\install
copy /Y lib\kernel32\kernel32.dll %BOOTCD_DIR%\disk\install
copy /Y lib\msvcrt\msvcrt.dll %BOOTCD_DIR%\disk\install
copy /Y subsys\smss\smss.exe %BOOTCD_DIR%\disk\install
copy /Y subsys\csrss\csrss.exe %BOOTCD_DIR%\disk\install
copy /Y subsys\system\services\services.exe %BOOTCD_DIR%\disk\install
copy /Y subsys\system\shell\shell.exe %BOOTCD_DIR%\disk\install
copy /Y subsys\system\winlogon\winlogon.exe %BOOTCD_DIR%\disk\install

View file

@ -1055,7 +1055,7 @@ SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text)
VOID
PrintTextXY(SHORT x, SHORT y, char* fmt,...)
PrintTextXY(SHORT x, SHORT y, char* fmt, ...)
{
char buffer[512];
va_list ap;
@ -1073,4 +1073,43 @@ PrintTextXY(SHORT x, SHORT y, char* fmt,...)
coPos);
}
VOID
PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...)
{
char buffer[512];
va_list ap;
COORD coPos;
ULONG Length;
ULONG Written;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
coPos.X = x;
coPos.Y = y;
Length = strlen(buffer);
if (Length > len - 1)
{
Length = len - 1;
}
WriteConsoleOutputCharacters(buffer,
Length,
coPos);
coPos.X += Length;
if (len > Length)
{
FillConsoleOutputCharacter(' ',
len - Length,
coPos,
&Written);
}
}
/* EOF */

View file

@ -120,7 +120,10 @@ VOID
SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text);
VOID
PrintTextXY(SHORT x, SHORT y, char* fmt,...);
PrintTextXY(SHORT x, SHORT y, char* fmt, ...);
VOID
PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...);
#endif /* __CONSOLE_H__*/

View file

@ -0,0 +1,381 @@
/*
* ReactOS kernel
* Copyright (C) 2002 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: filequeue.c,v 1.1 2002/11/23 01:55:27 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filequeue.c
* PURPOSE: File queue functions
* PROGRAMMER: Eric Kohl
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include "usetup.h"
#include "filesup.h"
#include "filequeue.h"
/* INCLUDES *****************************************************************/
typedef struct _QUEUEENTRY
{
struct _QUEUEENTRY *Prev;
struct _QUEUEENTRY *Next;
PWSTR SourceRootPath;
PWSTR SourcePath;
PWSTR SourceFilename;
PWSTR TargetDirectory;
PWSTR TargetFilename;
} QUEUEENTRY, *PQUEUEENTRY;
typedef struct _FILEQUEUEHEADER
{
PQUEUEENTRY CopyHead;
PQUEUEENTRY CopyTail;
ULONG CopyCount;
} FILEQUEUEHEADER, *PFILEQUEUEHEADER;
/* FUNCTIONS ****************************************************************/
HSPFILEQ
SetupOpenFileQueue(VOID)
{
PFILEQUEUEHEADER QueueHeader;
/* Allocate queue header */
QueueHeader = (PFILEQUEUEHEADER)RtlAllocateHeap(ProcessHeap,
0,
sizeof(FILEQUEUEHEADER));
if (QueueHeader == NULL)
return(NULL);
/* Initialize queue header */
RtlZeroMemory(QueueHeader,
sizeof(FILEQUEUEHEADER));
return((HSPFILEQ)QueueHeader);
}
BOOL
SetupCloseFileQueue(HSPFILEQ QueueHandle)
{
PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry;
if (QueueHandle == NULL)
return(FALSE);
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
/* Delete copy queue */
Entry = QueueHeader->CopyHead;
while (Entry != NULL)
{
/* Delete all strings */
if (Entry->SourceRootPath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
if (Entry->SourcePath != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
if (Entry->SourceFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
if (Entry->TargetDirectory != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
if (Entry->TargetFilename != NULL)
RtlFreeHeap(ProcessHeap, 0, Entry->TargetFilename);
/* Unlink current queue entry */
if (Entry->Next != NULL)
{
QueueHeader->CopyHead = Entry->Next;
QueueHeader->CopyHead->Prev = NULL;
}
else
{
QueueHeader->CopyHead = NULL;
QueueHeader->CopyTail = NULL;
}
/* Delete queue entry */
RtlFreeHeap(ProcessHeap, 0, Entry);
/* Get next queue entry */
Entry = QueueHeader->CopyHead;
}
/* Delete queue header */
RtlFreeHeap(ProcessHeap,
0,
QueueHeader);
return(TRUE);
}
BOOL
SetupQueueCopy(HSPFILEQ QueueHandle,
PCWSTR SourceRootPath,
PCWSTR SourcePath,
PCWSTR SourceFilename,
PCWSTR TargetDirectory,
PCWSTR TargetFilename)
{
PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry;
ULONG Length;
if (QueueHandle == NULL ||
SourceRootPath == NULL ||
SourceFilename == NULL ||
TargetDirectory == NULL)
return(FALSE);
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
/* Allocate new queue entry */
Entry = (PQUEUEENTRY)RtlAllocateHeap(ProcessHeap,
0,
sizeof(QUEUEENTRY));
if (Entry == NULL)
return(FALSE);
RtlZeroMemory(Entry,
sizeof(QUEUEENTRY));
/* Copy source root path */
Length = wcslen(SourceRootPath);
Entry->SourceRootPath = RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourceRootPath == NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->SourceRootPath, SourceRootPath, Length);
Entry->SourceRootPath[Length] = (WCHAR)0;
/* Copy source path */
if (SourcePath != NULL)
{
Length = wcslen(SourcePath);
Entry->SourcePath = RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourcePath == NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->SourcePath, SourcePath, Length);
Entry->SourcePath[Length] = (WCHAR)0;
}
/* Copy source file name */
Length = wcslen(SourceFilename);
Entry->SourceFilename = RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->SourceFilename == NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->SourceFilename, SourceFilename, Length);
Entry->SourceFilename[Length] = (WCHAR)0;
/* Copy target directory */
Length = wcslen(TargetDirectory);
if (TargetDirectory[Length] == '\\')
Length--;
Entry->TargetDirectory = RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->TargetDirectory == NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->TargetDirectory, TargetDirectory, Length);
Entry->TargetDirectory[Length] = (WCHAR)0;
/* Copy optional target filename */
if (TargetFilename != NULL)
{
Length = wcslen(TargetFilename);
Entry->TargetFilename = RtlAllocateHeap(ProcessHeap,
0,
(Length + 1) * sizeof(WCHAR));
if (Entry->TargetFilename == NULL)
{
RtlFreeHeap(ProcessHeap, 0, Entry->SourceRootPath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourcePath);
RtlFreeHeap(ProcessHeap, 0, Entry->SourceFilename);
RtlFreeHeap(ProcessHeap, 0, Entry->TargetDirectory);
RtlFreeHeap(ProcessHeap, 0, Entry);
return(FALSE);
}
wcsncpy(Entry->TargetFilename, TargetFilename, Length);
Entry->TargetFilename[Length] = (WCHAR)0;
}
/* Append queue entry */
if (QueueHeader->CopyHead == NULL) // && QueueHeader->CopyTail == NULL)
{
Entry->Prev = NULL;
Entry->Next = NULL;
QueueHeader->CopyHead = Entry;
QueueHeader->CopyTail = Entry;
}
else
{
Entry->Prev = QueueHeader->CopyTail;
Entry->Next = NULL;
QueueHeader->CopyTail->Next = Entry;
QueueHeader->CopyTail = Entry;
}
QueueHeader->CopyCount++;
return(TRUE);
}
BOOL
SetupCommitFileQueue(HSPFILEQ QueueHandle,
PCWSTR TargetRootPath,
PCWSTR TargetPath,
PSP_FILE_CALLBACK MsgHandler,
PVOID Context)
{
PFILEQUEUEHEADER QueueHeader;
PQUEUEENTRY Entry;
NTSTATUS Status;
WCHAR FileSrcPath[MAX_PATH];
WCHAR FileDstPath[MAX_PATH];
if (QueueHandle == NULL)
return(FALSE);
QueueHeader = (PFILEQUEUEHEADER)QueueHandle;
MsgHandler(Context,
SPFILENOTIFY_STARTQUEUE,
NULL,
NULL);
MsgHandler(Context,
SPFILENOTIFY_STARTSUBQUEUE,
(PVOID)FILEOP_COPY,
(PVOID)QueueHeader->CopyCount);
/* Commit copy queue */
Entry = QueueHeader->CopyHead;
while (Entry != NULL)
{
/* Build the full source path */
wcscpy(FileSrcPath, Entry->SourceRootPath);
if (Entry->SourcePath != NULL)
wcscat(FileSrcPath, Entry->SourcePath);
wcscat(FileSrcPath, L"\\");
wcscat(FileSrcPath, Entry->SourceFilename);
/* Build the full target path */
wcscpy(FileDstPath, TargetRootPath);
if (Entry->TargetDirectory[0] == L'\\')
{
wcscat(FileDstPath, Entry->TargetDirectory);
}
else
{
if (TargetPath != NULL)
{
if (TargetPath[0] != L'\\')
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, TargetPath);
}
wcscat(FileDstPath, L"\\");
wcscat(FileDstPath, Entry->TargetDirectory);
}
wcscat(FileDstPath, L"\\");
if (Entry->TargetFilename != NULL)
wcscat(FileDstPath, Entry->TargetFilename);
else
wcscat(FileDstPath, Entry->SourceFilename);
/* FIXME: Do it! */
DPRINT("'%S' ==> '%S'\n",
FileSrcPath,
FileDstPath);
MsgHandler(Context,
SPFILENOTIFY_STARTCOPY,
(PVOID)Entry->SourceFilename,
(PVOID)FILEOP_COPY);
/* Copy the file */
Status = SetupCopyFile(FileSrcPath, FileDstPath);
if (!NT_SUCCESS(Status))
{
MsgHandler(Context,
SPFILENOTIFY_COPYERROR,
(PVOID)Entry->SourceFilename,
(PVOID)FILEOP_COPY);
}
else
{
MsgHandler(Context,
SPFILENOTIFY_ENDCOPY,
(PVOID)Entry->SourceFilename,
(PVOID)FILEOP_COPY);
}
Entry = Entry->Next;
}
MsgHandler(Context,
SPFILENOTIFY_ENDSUBQUEUE,
(PVOID)FILEOP_COPY,
NULL);
MsgHandler(Context,
SPFILENOTIFY_ENDQUEUE,
NULL,
NULL);
return(TRUE);
}
/* EOF */

View file

@ -0,0 +1,87 @@
/*
* ReactOS kernel
* Copyright (C) 2002 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: filequeue.h,v 1.1 2002/11/23 01:55:27 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filequeue.h
* PURPOSE: File queue functions
* PROGRAMMER: Eric Kohl
*/
#ifndef __FILEQUEUE_H__
#define __FILEQUEUE_H__
#define SPFILENOTIFY_STARTQUEUE 0x1
#define SPFILENOTIFY_ENDQUEUE 0x2
#define SPFILENOTIFY_STARTSUBQUEUE 0x3
#define SPFILENOTIFY_ENDSUBQUEUE 0x4
#define SPFILENOTIFY_STARTCOPY 0xb
#define SPFILENOTIFY_ENDCOPY 0xc
#define SPFILENOTIFY_COPYERROR 0xd
#define FILEOP_COPY 0x0
#define FILEOP_RENAME 0x1
#define FILEOP_DELETE 0x2
#define FILEOP_BACKUP 0x3
#define FILEOP_ABORT 0x0
#define FILEOP_DOIT 0x1
#define FILEOP_SKIP 0x2
#define FILEOP_RETRY FILEOP_DOIT
#define FILEOP_NEWPATH 0x4
/* TYPES ********************************************************************/
typedef PVOID HSPFILEQ;
typedef ULONG (*PSP_FILE_CALLBACK)(PVOID Context,
ULONG Notification,
PVOID Param1,
PVOID Param2);
/* FUNCTIONS ****************************************************************/
HSPFILEQ
SetupOpenFileQueue(VOID);
BOOL
SetupCloseFileQueue(HSPFILEQ QueueHandle);
BOOL
SetupQueueCopy(HSPFILEQ QueueHandle,
PCWSTR SourceRootPath,
PCWSTR SourcePath,
PCWSTR SourceFilename,
PCWSTR TargetDirectory,
PCWSTR TargetFilename);
BOOL
SetupCommitFileQueue(HSPFILEQ QueueHandle,
PCWSTR TargetRootPath,
PCWSTR TargetPath,
PSP_FILE_CALLBACK MsgHandler,
PVOID Context);
#endif /* __FILEQUEUE_H__ */
/* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: filesup.c,v 1.1 2002/11/13 18:25:18 ekohl Exp $
/* $Id: filesup.c,v 1.2 2002/11/23 01:55:27 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filesup.c
@ -48,12 +48,20 @@ CreateDirectory(PWCHAR DirectoryName)
RtlCreateUnicodeString(&PathName,
DirectoryName);
#if 0
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &PathName;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE | OBJ_INHERIT;
ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = NULL;
#endif
InitializeObjectAttributes(&ObjectAttributes,
&PathName,
OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
NULL,
NULL);
Status = NtCreateFile(&DirectoryHandle,
DIRECTORY_ALL_ACCESS,
@ -76,4 +84,192 @@ CreateDirectory(PWCHAR DirectoryName)
return(Status);
}
NTSTATUS
SetupCopyFile(PWCHAR SourceFileName,
PWCHAR DestinationFileName)
{
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE FileHandleSource;
HANDLE FileHandleDest;
IO_STATUS_BLOCK IoStatusBlock;
FILE_STANDARD_INFORMATION FileStandard;
FILE_BASIC_INFORMATION FileBasic;
FILE_POSITION_INFORMATION FilePosition;
PUCHAR Buffer;
ULONG RegionSize;
UNICODE_STRING FileName;
NTSTATUS Status;
Buffer = NULL;
RegionSize = 0x1000000;
RtlInitUnicodeString(&FileName,
SourceFileName);
InitializeObjectAttributes(&ObjectAttributes,
&FileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtOpenFile(&FileHandleSource,
FILE_READ_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ,
FILE_SYNCHRONOUS_IO_ALERT | FILE_SEQUENTIAL_ONLY);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
return(Status);
}
Status = NtQueryInformationFile(FileHandleSource,
&IoStatusBlock,
&FileStandard,
sizeof(FILE_STANDARD_INFORMATION),
FileStandardInformation);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtClose(FileHandleSource);
return(Status);
}
Status = NtQueryInformationFile(FileHandleSource,
&IoStatusBlock,&FileBasic,
sizeof(FILE_BASIC_INFORMATION),
FileBasicInformation);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtClose(FileHandleSource);
return(Status);
}
RtlInitUnicodeString(&FileName,
DestinationFileName);
InitializeObjectAttributes(&ObjectAttributes,
&FileName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtCreateFile(&FileHandleDest,
FILE_WRITE_ACCESS,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OVERWRITE_IF,
FILE_SYNCHRONOUS_IO_ALERT | FILE_SEQUENTIAL_ONLY,
NULL,
0);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtClose(FileHandleSource);
return(Status);
}
FilePosition.CurrentByteOffset.QuadPart = 0;
Status = NtSetInformationFile(FileHandleSource,
&IoStatusBlock,
&FilePosition,
sizeof(FILE_POSITION_INFORMATION),
FilePositionInformation);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtClose(FileHandleSource);
NtClose(FileHandleDest);
return(Status);
}
Status = NtSetInformationFile(FileHandleDest,
&IoStatusBlock,
&FilePosition,
sizeof(FILE_POSITION_INFORMATION),
FilePositionInformation);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtClose(FileHandleSource);
NtClose(FileHandleDest);
return(Status);
}
Status = NtAllocateVirtualMemory(NtCurrentProcess(),
(PVOID *)&Buffer,
2,
&RegionSize,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtClose(FileHandleSource);
NtClose(FileHandleDest);
return(Status);
}
while (TRUE)
{
Status = NtReadFile(FileHandleSource,
NULL,
NULL,
NULL,
&IoStatusBlock,
Buffer,
RegionSize,
NULL,
NULL);
if (!NT_SUCCESS(Status))
{
NtFreeVirtualMemory(NtCurrentProcess(),
(PVOID *)&Buffer,
&RegionSize,
MEM_RELEASE);
NtClose(FileHandleSource);
NtClose(FileHandleDest);
if (Status == STATUS_END_OF_FILE)
{
DPRINT("STATUS_END_OF_FILE\n");
break;
}
CHECKPOINT1;
return(Status);
}
DPRINT("Bytes read %lu\n", IoStatusBlock.Information);
Status = NtWriteFile(FileHandleDest,
NULL,
NULL,
NULL,
&IoStatusBlock,
Buffer,
IoStatusBlock.Information,
NULL,
NULL);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
NtFreeVirtualMemory(NtCurrentProcess(),
(PVOID *)&Buffer,
&RegionSize,
MEM_RELEASE);
NtClose(FileHandleSource);
NtClose(FileHandleDest);
return(Status);
}
}
return(STATUS_SUCCESS);
}
/* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: filesup.h,v 1.1 2002/11/13 18:25:18 ekohl Exp $
/* $Id: filesup.h,v 1.2 2002/11/23 01:55:27 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/filesup.h
@ -30,6 +30,10 @@
NTSTATUS
CreateDirectory(PWCHAR DirectoryName);
NTSTATUS
SetupCopyFile(PWCHAR SourceFileName,
PWCHAR DestinationFileName);
#endif /* __FILESUP_H__ */

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.4 2002/11/13 18:25:18 ekohl Exp $
# $Id: makefile,v 1.5 2002/11/23 01:55:27 ekohl Exp $
PATH_TO_TOP = ../../..
@ -12,7 +12,7 @@ TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__NTAPP__
TARGET_OBJECTS = $(TARGET_NAME).o console.o drivesup.o filesup.o inicache.o partlist.o
TARGET_OBJECTS = $(TARGET_NAME).o console.o drivesup.o filequeue.o filesup.o inicache.o partlist.o
include $(PATH_TO_TOP)/rules.mak

View file

@ -34,7 +34,7 @@
#include "console.h"
#include "partlist.h"
#include "inicache.h"
#include "filequeue.h"
#define START_PAGE 0
@ -56,6 +56,14 @@
#define REBOOT_PAGE 102
typedef struct _COPYCONTEXT
{
ULONG TotalOperations;
ULONG CompletedOperations;
ULONG Progress;
} COPYCONTEXT, *PCOPYCONTEXT;
/* GLOBALS ******************************************************************/
HANDLE ProcessHeap;
@ -70,6 +78,8 @@ UNICODE_STRING SourceRootPath;
PINICACHE IniCache;
HSPFILEQ SetupFileQueue = NULL;
/* FUNCTIONS ****************************************************************/
@ -895,13 +905,18 @@ static ULONG
PrepareCopyPage(PINPUT_RECORD Ir)
{
WCHAR PathBuffer[MAX_PATH];
PINICACHESECTION Section;
PINICACHESECTION DirSection;
PINICACHESECTION FilesSection;
PINICACHEITERATOR Iterator;
PWCHAR KeyName;
PWCHAR KeyValue;
ULONG Length;
NTSTATUS Status;
PWCHAR FileKeyName;
PWCHAR FileKeyValue;
PWCHAR DirKeyName;
PWCHAR DirKeyValue;
SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
@ -913,26 +928,16 @@ PrepareCopyPage(PINPUT_RECORD Ir)
SetStatusText(" Please wait...");
/* build the file copy list */
/*
* Build the file copy list
*/
SetInvertedTextXY(8, 12, "Build file copy list");
/* FIXME: build that list */
SetTextXY(8, 12, "Build file copy list");
SetHighlightedTextXY(50, 12, "Done");
/* create directories */
SetInvertedTextXY(8, 14, "Create directories");
/* Open 'Directories' section */
Section = IniCacheGetSection(IniCache,
L"Directories");
if (Section == NULL)
DirSection = IniCacheGetSection(IniCache,
L"Directories");
if (DirSection == NULL)
{
PopupError("Setup failed to find the 'Directories' section\n"
"in TXTSETUP.SIF.\n",
@ -949,6 +954,92 @@ PrepareCopyPage(PINPUT_RECORD Ir)
}
}
/* Open 'SourceFiles' section */
FilesSection = IniCacheGetSection(IniCache,
L"SourceFiles");
if (FilesSection == NULL)
{
PopupError("Setup failed to find the 'SourceFiles' section\n"
"in TXTSETUP.SIF.\n",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/* Create the file queue */
SetupFileQueue = SetupOpenFileQueue();
if (SetupFileQueue == NULL)
{
PopupError("Setup failed to open the copy file queue.\n",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/*
* Enumerate the files in the 'SourceFiles' section
* and add them to the file queue.
*/
Iterator = IniCacheFindFirstValue(FilesSection,
&FileKeyName,
&FileKeyValue);
if (Iterator != NULL)
{
do
{
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
/* Lookup target directory */
Status = IniCacheGetKey(DirSection,
FileKeyValue,
&DirKeyValue);
if (!NT_SUCCESS(Status))
{
/* FIXME: Handle error! */
DPRINT1("IniCacheGetKey() failed (Status 0x%lX)\n", Status);
}
if (SetupQueueCopy(SetupFileQueue,
SourceRootPath.Buffer,
L"\\install",
FileKeyName,
DirKeyValue,
NULL) == FALSE)
{
/* FIXME: Handle error! */
DPRINT1("SetupQueueCopy() failed\n");
}
}
while (IniCacheFindNextValue(Iterator, &FileKeyName, &FileKeyValue));
IniCacheFindClose(Iterator);
}
/* Report that the file queue has been built */
SetTextXY(8, 12, "Build file copy list");
SetHighlightedTextXY(50, 12, "Done");
/* create directories */
SetInvertedTextXY(8, 14, "Create directories");
/*
* FIXME:
* Install directories like '\reactos\test' are not handled yet.
@ -990,7 +1081,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
/* Enumerate the directory values and create the subdirectories */
Iterator = IniCacheFindFirstValue(Section,
Iterator = IniCacheFindFirstValue(DirSection,
&KeyName,
&KeyValue);
if (Iterator != NULL)
@ -1079,12 +1170,67 @@ PrepareCopyPage(PINPUT_RECORD Ir)
}
static ULONG
FileCopyCallback(PVOID Context,
ULONG Notification,
PVOID Param1,
PVOID Param2)
{
PCOPYCONTEXT CopyContext;
CopyContext = (PCOPYCONTEXT)Context;
switch (Notification)
{
case SPFILENOTIFY_STARTSUBQUEUE:
CopyContext->TotalOperations = (ULONG)Param2;
break;
case SPFILENOTIFY_STARTCOPY:
/* Display copy message */
PrintTextXYN(6, 16, 60, "Copying file: %S", (PWSTR)Param1);
PrintTextXYN(6, 18, 60, "File %lu of %lu",
CopyContext->CompletedOperations + 1,
CopyContext->TotalOperations);
break;
case SPFILENOTIFY_ENDCOPY:
CopyContext->CompletedOperations++;
break;
}
return(0);
}
static ULONG
FileCopyPage(PINPUT_RECORD Ir)
{
WCHAR TargetRootPath[MAX_PATH];
COPYCONTEXT CopyContext;
CopyContext.TotalOperations = 0;
CopyContext.CompletedOperations = 0;
CopyContext.Progress = 0;
SetStatusText(" Please wait...");
SetTextXY(6, 8, "Copying files");
swprintf(TargetRootPath,
L"\\Device\\Harddisk%lu\\Partition%lu",
PartData.DiskNumber,
PartData.PartNumber);
SetupCommitFileQueue(SetupFileQueue,
TargetRootPath,
InstallDir,
(PSP_FILE_CALLBACK)FileCopyCallback,
&CopyContext);
SetupCloseFileQueue(SetupFileQueue);
SetStatusText(" ENTER = Continue F3 = Quit");
@ -1109,72 +1255,10 @@ FileCopyPage(PINPUT_RECORD Ir)
}
#if 0
static NTSTATUS
UpdateSystemRootLink(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING LinkName;
UNICODE_STRING TargetName;
CHAR TargetBuffer[MAX_PATH];
HANDLE Handle;
NTSTATUS Status;
RtlInitUnicodeString(&LinkName,
L"\\SystemRoot");
InitializeObjectAttributes(&ObjectAttributes,
&LinkName,
OBJ_OPENLINK,
NULL,
NULL);
Status = NtOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
return(Status);
Status = NtMakeTemporaryObject(Handle);
NtClose(Handle);
if (!NT_SUCCESS(Status))
return(Status);
sprintf(TargetBuffer,
"\\Device\\Harddisk%lu\\Partition%lu",
PartData.DiskNumber,
PartData.PartNumber);
if (InstallDir[0] != '\\')
strcat(TargetBuffer, "\\");
strcat(TargetBuffer, InstallDir);
RtlCreateUnicodeStringFromAsciiz(&TargetName,
TargetBuffer);
Status = NtCreateSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes,
&TargetName);
RtlFreeUnicodeString(&TargetName);
if (!NT_SUCCESS(Status))
return(Status);
NtClose(Handle);
return(STATUS_SUCCESS);
}
#endif
static ULONG
InitSystemPage(PINPUT_RECORD Ir)
{
#if 0
NTSTATUS Status;
#endif
SetTextXY(6, 8, "Initializing system settings");
@ -1186,27 +1270,11 @@ InitSystemPage(PINPUT_RECORD Ir)
SetStatusText(" Please wait...");
#if 0
/*
* Initialize registry
* Create registry hives
*/
/* Update 'SystemRoot' link */
Status = UpdateSystemRootLink();
if (!NT_SUCCESS(Status))
{
PrintTextXY(6, 25, "UpdateSystemRootLink() failed (Status = 0x%08lx)", Status);
}
Status = NtInitializeRegistry(TRUE);
if (!NT_SUCCESS(Status))
{
PrintTextXY(6, 26, "NtInitializeRegistry() failed (Status = 0x%08lx)", Status);
}
#endif
/*
* Update registry

View file

@ -6,3 +6,16 @@ Signature = "$ReactOS$"
2 = system32
3 = system32\drivers
4 = system32\config
[SourceFiles]
atapi.sys = 3
cdrom.sys = 3
class2.sys = 3
disk.sys = 3
hal.dll = 2
scsiport.sys = 3
ntoskrnl.exe = 2
vfatfs.sys = 3
[SetupData]
DefaultPath = \reactos