fs_rec: add ext2 support
txtsetup: add ext2
hivesys: add ext2
usetup: add formatting and installing on ext2 (by filip navara)
Modified: branches/ext2/reactos/bootdata/hivesys.inf
Modified: branches/ext2/reactos/bootdata/txtsetup.sif
Modified: branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.c
Modified: branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.h
Modified: branches/ext2/reactos/drivers/fs/fs_rec/makefile
Modified: branches/ext2/reactos/subsys/system/usetup/bootsup.c
Modified: branches/ext2/reactos/subsys/system/usetup/bootsup.h
Modified: branches/ext2/reactos/subsys/system/usetup/format.c
Modified: branches/ext2/reactos/subsys/system/usetup/format.h
Modified: branches/ext2/reactos/subsys/system/usetup/fslist.c
Modified: branches/ext2/reactos/subsys/system/usetup/fslist.h
Modified: branches/ext2/reactos/subsys/system/usetup/makefile
Modified: branches/ext2/reactos/subsys/system/usetup/partlist.c
Modified: branches/ext2/reactos/subsys/system/usetup/usetup.c
_____
Modified: branches/ext2/reactos/bootdata/hivesys.inf
--- branches/ext2/reactos/bootdata/hivesys.inf 2005-01-13 01:54:28 UTC
(rev 13010)
+++ branches/ext2/reactos/bootdata/hivesys.inf 2005-01-13 01:59:08 UTC
(rev 13011)
@@ -729,6 +729,13 @@
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Start",0x00010001,0x000
00000
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Type",0x00010001,0x0000
0002
+; EXT2 Filesystem driver
+HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","ErrorControl",0x000100
01,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","Group",0x00000000,"Boo
t File System"
+HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","ImagePath",0x00020000,
"system32\drivers\ext2.sys"
+HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","Start",0x00010001,0x00
000000
+HKLM,"SYSTEM\CurrentControlSet\Services\Ext2fs","Type",0x00010001,0x000
00002
+
; VBE SVGA driver
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","ErrorControl",0x00010001,0
x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Group",0x00000000,"Video
Save SVGA"
_____
Modified: branches/ext2/reactos/bootdata/txtsetup.sif
--- branches/ext2/reactos/bootdata/txtsetup.sif 2005-01-13 01:54:28 UTC
(rev 13010)
+++ branches/ext2/reactos/bootdata/txtsetup.sif 2005-01-13 01:59:08 UTC
(rev 13011)
@@ -29,14 +29,15 @@
ntoskrnl.exe = 2
scsiport.sys = 3
vfatfs.sys = 3
+ext2.sys = 3
[Cabinets]
Cabinet=reactos.cab
[SetupData]
DefaultPath = \ReactOS
-OsLoadOptions = "/NOGUIBOOT /NODEBUG"
-;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1"
+;OsLoadOptions = "/NOGUIBOOT /NODEBUG"
+OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
_____
Modified: branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.c
--- branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.c 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.c 2005-01-13
01:59:08 UTC (rev 13011)
@@ -27,9 +27,10 @@
/* INCLUDES
*****************************************************************/
+#include <roscfg.h>
#include <ddk/ntddk.h>
-#define NDEBUG
+//#define NDEBUG
#include <debug.h>
#include "fs_rec.h"
@@ -81,6 +82,10 @@
Status = FsRecVfatFsControl(DeviceObject, Irp);
break;
+ case FS_TYPE_EXT2:
+ Status = FsRecExt2FsControl(DeviceObject, Irp);
+ break;
+
case FS_TYPE_NTFS:
Status = FsRecNtfsFsControl(DeviceObject, Irp);
break;
_____
Modified: branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.h
--- branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.h 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/drivers/fs/fs_rec/fs_rec.h 2005-01-13
01:59:08 UTC (rev 13011)
@@ -33,6 +33,7 @@
#define FS_TYPE_NTFS 2
#define FS_TYPE_CDFS 3
#define FS_TYPE_UDFS 4
+#define FS_TYPE_EXT2 5
typedef struct _DEVICE_EXTENSION
@@ -91,6 +92,12 @@
IN PIRP Irp);
+/* ext2.c */
+
+NTSTATUS
+FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
/* ntfs.c */
NTSTATUS
_____
Modified: branches/ext2/reactos/drivers/fs/fs_rec/makefile
--- branches/ext2/reactos/drivers/fs/fs_rec/makefile 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/drivers/fs/fs_rec/makefile 2005-01-13
01:59:08 UTC (rev 13011)
@@ -11,6 +11,7 @@
fs_rec.o \
cdfs.o \
fat.o \
+ ext2.o \
ntfs.o \
udfs.o
_____
Modified: branches/ext2/reactos/subsys/system/usetup/bootsup.c
--- branches/ext2/reactos/subsys/system/usetup/bootsup.c
2005-01-13 01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/bootsup.c
2005-01-13 01:59:08 UTC (rev 13011)
@@ -1542,6 +1542,424 @@
}
+NTSTATUS
+InstallExt2BootCodeToDisk(PWSTR SrcPath,
+ PWSTR RootPath)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ IO_STATUS_BLOCK IoStatusBlock;
+ UNICODE_STRING Name;
+ HANDLE FileHandle;
+ NTSTATUS Status;
+ PUCHAR OrigBootSector;
+ PUCHAR NewBootSector;
+ LARGE_INTEGER FileOffset;
+ USHORT BackupBootSector;
+
+ /* Allocate buffer for original bootsector */
+ OrigBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap,
+ 0,
+ SECTORSIZE);
+ if (OrigBootSector == NULL)
+ return(STATUS_INSUFFICIENT_RESOURCES);
+
+ /* Read current boot sector into buffer */
+ RtlInitUnicodeString(&Name,
+ RootPath);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+
+ Status = NtOpenFile(&FileHandle,
+ FILE_READ_ACCESS,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ 0,
+ FILE_SYNCHRONOUS_IO_NONALERT);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ return(Status);
+ }
+
+ Status = NtReadFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ OrigBootSector,
+ SECTORSIZE,
+ NULL,
+ NULL);
+ NtClose(FileHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ return(Status);
+ }
+
+
+ /* Allocate buffer for new bootsector (2 sectors) */
+ NewBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap,
+ 0,
+ 2 * SECTORSIZE);
+ if (NewBootSector == NULL)
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ /* Read new bootsector from SrcPath */
+ RtlInitUnicodeString(&Name,
+ SrcPath);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+
+ Status = NtOpenFile(&FileHandle,
+ FILE_READ_ACCESS,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ 0,
+ FILE_SYNCHRONOUS_IO_NONALERT);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ Status = NtReadFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ NewBootSector,
+ 2 * SECTORSIZE,
+ NULL,
+ NULL);
+ NtClose(FileHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ /* Adjust bootsector (copy a part of the FAT32 BPB) */
+ memcpy((NewBootSector + 3),
+ (OrigBootSector + 3),
+ 87); /* FAT32 BPB length */
+
+ /* Get the location of the backup boot sector */
+ BackupBootSector = (OrigBootSector[0x33] << 8) +
OrigBootSector[0x32];
+
+ /* Free the original boot sector */
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+
+ /* Write the first sector of the new bootcode to DstPath */
+ RtlInitUnicodeString(&Name,
+ RootPath);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ 0,
+ NULL,
+ NULL);
+
+ Status = NtOpenFile(&FileHandle,
+ FILE_WRITE_ACCESS | FILE_WRITE_ATTRIBUTES,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ 0,
+ FILE_SYNCHRONOUS_IO_NONALERT |
FILE_SEQUENTIAL_ONLY);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ /* Write sector 0 */
+ FileOffset.QuadPart = 0ULL;
+ Status = NtWriteFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ NewBootSector,
+ SECTORSIZE,
+ &FileOffset,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
+ NtClose(FileHandle);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ /* Write backup boot sector */
+ if ((BackupBootSector != 0x0000) && (BackupBootSector != 0xFFFF))
+ {
+ FileOffset.QuadPart = (ULONGLONG)((ULONG)BackupBootSector *
SECTORSIZE);
+ Status = NtWriteFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ NewBootSector,
+ SECTORSIZE,
+ &FileOffset,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
+ NtClose(FileHandle);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+ }
+
+ /* Write sector 14 */
+ FileOffset.QuadPart = (ULONGLONG)(14 * SECTORSIZE);
+ Status = NtWriteFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ (NewBootSector + SECTORSIZE),
+ SECTORSIZE,
+ &FileOffset,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
+ }
+ NtClose(FileHandle);
+
+ /* Free the new boot sector */
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+
+ return(Status);
+}
+
+
+NTSTATUS
+InstallExt2BootCodeToDisk(PWSTR SrcPath,
+ PWSTR RootPath)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ IO_STATUS_BLOCK IoStatusBlock;
+ UNICODE_STRING Name;
+ HANDLE FileHandle;
+ NTSTATUS Status;
+ PUCHAR OrigBootSector;
+ PUCHAR NewBootSector;
+ LARGE_INTEGER FileOffset;
+ USHORT BackupBootSector;
+
+ /* Allocate buffer for original bootsector */
+ OrigBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap,
+ 0,
+ SECTORSIZE);
+ if (OrigBootSector == NULL)
+ return(STATUS_INSUFFICIENT_RESOURCES);
+
+ /* Read current boot sector into buffer */
+ RtlInitUnicodeString(&Name,
+ RootPath);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+
+ Status = NtOpenFile(&FileHandle,
+ FILE_READ_ACCESS,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ 0,
+ FILE_SYNCHRONOUS_IO_NONALERT);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ return(Status);
+ }
+
+ Status = NtReadFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ OrigBootSector,
+ SECTORSIZE,
+ NULL,
+ NULL);
+ NtClose(FileHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ return(Status);
+ }
+
+
+ /* Allocate buffer for new bootsector (2 sectors) */
+ NewBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap,
+ 0,
+ 2 * SECTORSIZE);
+ if (NewBootSector == NULL)
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ /* Read new bootsector from SrcPath */
+ RtlInitUnicodeString(&Name,
+ SrcPath);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+
+ Status = NtOpenFile(&FileHandle,
+ FILE_READ_ACCESS,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ 0,
+ FILE_SYNCHRONOUS_IO_NONALERT);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ Status = NtReadFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ NewBootSector,
+ 2 * SECTORSIZE,
+ NULL,
+ NULL);
+ NtClose(FileHandle);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ /* Adjust bootsector (copy a part of the FAT32 BPB) */
+ memcpy((NewBootSector + 3),
+ (OrigBootSector + 3),
+ 87); /* FAT32 BPB length */
+
+ /* Get the location of the backup boot sector */
+ BackupBootSector = (OrigBootSector[0x33] << 8) +
OrigBootSector[0x32];
+
+ /* Free the original boot sector */
+ RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
+
+ /* Write the first sector of the new bootcode to DstPath */
+ RtlInitUnicodeString(&Name,
+ RootPath);
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ 0,
+ NULL,
+ NULL);
+
+ Status = NtOpenFile(&FileHandle,
+ FILE_WRITE_ACCESS | FILE_WRITE_ATTRIBUTES,
+ &ObjectAttributes,
+ &IoStatusBlock,
+ 0,
+ FILE_SYNCHRONOUS_IO_NONALERT |
FILE_SEQUENTIAL_ONLY);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ /* Write sector 0 */
+ FileOffset.QuadPart = 0ULL;
+ Status = NtWriteFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ NewBootSector,
+ SECTORSIZE,
+ &FileOffset,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
+ NtClose(FileHandle);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+
+ /* Write backup boot sector */
+ if ((BackupBootSector != 0x0000) && (BackupBootSector != 0xFFFF))
+ {
+ FileOffset.QuadPart = (ULONGLONG)((ULONG)BackupBootSector *
SECTORSIZE);
+ Status = NtWriteFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ NewBootSector,
+ SECTORSIZE,
+ &FileOffset,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
+ NtClose(FileHandle);
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+ return(Status);
+ }
+ }
+
+ /* Write sector 14 */
+ FileOffset.QuadPart = (ULONGLONG)(14 * SECTORSIZE);
+ Status = NtWriteFile(FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ (NewBootSector + SECTORSIZE),
+ SECTORSIZE,
+ &FileOffset,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
+ }
+ NtClose(FileHandle);
+
+ /* Free the new boot sector */
+ RtlFreeHeap(ProcessHeap, 0, NewBootSector);
+
+ return(Status);
+}
+
+
static NTSTATUS
UnprotectBootIni(PWSTR FileName,
PULONG Attributes)
_____
Modified: branches/ext2/reactos/subsys/system/usetup/bootsup.h
--- branches/ext2/reactos/subsys/system/usetup/bootsup.h
2005-01-13 01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/bootsup.h
2005-01-13 01:59:08 UTC (rev 13011)
@@ -66,6 +66,14 @@
PWSTR RootPath);
NTSTATUS
+InstallExt2BootCodeToDisk(PWSTR SrcPath,
+ PWSTR RootPath);
+
+NTSTATUS
+InstallExt2BootCodeToDisk(PWSTR SrcPath,
+ PWSTR RootPath);
+
+NTSTATUS
UpdateBootIni(PWSTR BootIniPath,
PWSTR EntryName,
PWSTR EntryValue);
_____
Modified: branches/ext2/reactos/subsys/system/usetup/format.c
--- branches/ext2/reactos/subsys/system/usetup/format.c 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/format.c 2005-01-13
01:59:08 UTC (rev 13011)
@@ -29,10 +29,12 @@
#include "precomp.h"
#include <ntdll/rtl.h>
#include <fslib/vfatlib.h>
+#include <fslib/ext2lib.h>
#include "usetup.h"
#include "console.h"
#include "progress.h"
+#include "fslist.h"
#define NDEBUG
#include <debug.h>
@@ -96,7 +98,7 @@
NTSTATUS
-FormatPartition (PUNICODE_STRING DriveRoot)
+FormatPartition (PUNICODE_STRING DriveRoot, FILE_SYSTEM FsType)
{
NTSTATUS Status;
SHORT xScreen;
@@ -111,17 +113,27 @@
ProgressSetStepCount (ProgressBar, 100);
- VfatInitialize ();
+ if (FsType == FsFat)
+ {
+ VfatInitialize ();
+ Status = VfatFormat (DriveRoot,
+ 0, /* MediaFlag */
+ NULL, /* Label */
+ TRUE, /* QuickFormat */
+ 0, /* ClusterSize */
+ FormatCallback); /* Callback */
+ VfatCleanup ();
+ }
+ else if (FsType == FsExt2)
+ {
+ Status = Ext2Format (DriveRoot,
+ 0, /* MediaFlag */
+ NULL, /* Label */
+ TRUE, /* QuickFormat */
+ 0, /* ClusterSize */
+ FormatCallback); /* Callback */
+ }
- Status = VfatFormat (DriveRoot,
- 0, /* MediaFlag */
- NULL, /* Label */
- TRUE, /* QuickFormat */
- 0, /* ClusterSize */
- (PFMIFSCALLBACK)FormatCallback); /* Callback */
-
- VfatCleanup ();
-
DestroyProgressBar (ProgressBar);
ProgressBar = NULL;
@@ -130,4 +142,25 @@
return Status;
}
+
+#if 0
+NTSTATUS STDCALL
+InstallFileSystemDriver (PUNICODE_STRING Name)
+{
+ ULONG StartValue = 0; /* Boot start driver. */
+
+ Status = RtlWriteRegistryValue(RTL_REGISTRY_SERVICES,
+ Name,
+ L"Start",
+ REG_DWORD,
+ &StartValue,
+ sizeof(ULONG));
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+ return FALSE;
+ }
+}
+#endif
+
/* EOF */
_____
Modified: branches/ext2/reactos/subsys/system/usetup/format.h
--- branches/ext2/reactos/subsys/system/usetup/format.h 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/format.h 2005-01-13
01:59:08 UTC (rev 13011)
@@ -28,7 +28,7 @@
#define __FORMAT_H__
NTSTATUS
-FormatPartition(PUNICODE_STRING DriveRoot);
+FormatPartition(PUNICODE_STRING DriveRoot, FILE_SYSTEM FsType);
#endif /* __FILESUP_H__ */
_____
Modified: branches/ext2/reactos/subsys/system/usetup/fslist.c
--- branches/ext2/reactos/subsys/system/usetup/fslist.c 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/fslist.c 2005-01-13
01:59:08 UTC (rev 13011)
@@ -52,7 +52,7 @@
List->Top = Top;
List->ForceFormat = ForceFormat;
- List->FileSystemCount = 1;
+ List->FileSystemCount = 2;
if (ForceFormat)
{
List->CurrentFileSystem = ForceFileSystem;
@@ -108,6 +108,20 @@
}
Index++;
+ if (List->CurrentFileSystem == FsExt2)
+ {
+ SetInvertedTextXY (List->Left,
+ List->Top + Index,
+ " Format partition as EXT2 file system ");
+ }
+ else
+ {
+ SetTextXY (List->Left,
+ List->Top + Index,
+ " Format partition as EXT2 file system ");
+ }
+ Index++;
+
if (List->ForceFormat == FALSE)
{
coPos.X = List->Left;
_____
Modified: branches/ext2/reactos/subsys/system/usetup/fslist.h
--- branches/ext2/reactos/subsys/system/usetup/fslist.h 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/fslist.h 2005-01-13
01:59:08 UTC (rev 13011)
@@ -31,7 +31,8 @@
typedef enum
{
FsFat = 0,
- FsKeep = 1
+ FsExt2 = 1,
+ FsKeep = 2
} FILE_SYSTEM;
typedef struct _FILE_SYSTEM_LIST
_____
Modified: branches/ext2/reactos/subsys/system/usetup/makefile
--- branches/ext2/reactos/subsys/system/usetup/makefile 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/makefile 2005-01-13
01:59:08 UTC (rev 13011)
@@ -14,7 +14,7 @@
TARGET_PCH = precomp.h
-TARGET_SDKLIBS = zlib.a vfatlib.a ntdll.a
+TARGET_SDKLIBS = zlib.a vfatlib.a ext2lib.a ntdll.a
TARGET_INSTALLDIR = system32
_____
Modified: branches/ext2/reactos/subsys/system/usetup/partlist.c
--- branches/ext2/reactos/subsys/system/usetup/partlist.c
2005-01-13 01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/partlist.c
2005-01-13 01:59:08 UTC (rev 13011)
@@ -297,6 +297,10 @@
#endif
PartEntry->FormatState = Preformatted;
}
+ else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2)
+ {
+ PartEntry->FormatState = Preformatted;
+ }
else
{
PartEntry->FormatState = Unknown;
@@ -812,6 +816,10 @@
{
PartType = "FAT32";
}
+ else if (PartEntry->PartInfo[0].PartitionType ==
PARTITION_EXT2)
+ {
+ PartType = "EXT2";
+ }
else if (PartEntry->PartInfo[0].PartitionType ==
PARTITION_IFS)
{
PartType = "NTFS"; /* FIXME: Not quite correct! */
_____
Modified: branches/ext2/reactos/subsys/system/usetup/usetup.c
--- branches/ext2/reactos/subsys/system/usetup/usetup.c 2005-01-13
01:54:28 UTC (rev 13010)
+++ branches/ext2/reactos/subsys/system/usetup/usetup.c 2005-01-13
01:59:08 UTC (rev 13011)
@@ -34,6 +34,7 @@
#include <rosrtl/string.h>
#include "usetup.h"
+#include "bootsup.h"
#include "console.h"
#include "partlist.h"
#include "inicache.h"
@@ -42,8 +43,8 @@
#include "progress.h"
#include "bootsup.h"
#include "registry.h"
+#include "fslist.h"
#include "format.h"
-#include "fslist.h"
#include "cabinet.h"
#include "filesup.h"
#include "drivesup.h"
@@ -2139,6 +2140,10 @@
{
PartType = "FAT32";
}
+ else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2)
+ {
+ PartType = "FAT32";
+ }
else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS)
{
PartType = "NTFS"; /* FIXME: Not quite correct! */
@@ -2301,6 +2306,7 @@
#ifndef NDEBUG
ULONG Line;
ULONG i;
+ PLIST_ENTRY Entry;
#endif
@@ -2386,6 +2392,10 @@
}
break;
+ case FsExt2:
+ PartEntry->PartInfo[0].PartitionType =
PARTITION_EXT2;
+ break;
+
case FsKeep:
break;
@@ -2477,27 +2487,24 @@
PathBuffer);
DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath);
+ if (FileSystemList->CurrentFileSystem != FsKeep)
+ {
+ Status = FormatPartition (&DestinationRootPath,
+
FileSystemList->CurrentFileSystem);
+ if (!NT_SUCCESS (Status))
+ {
+ DPRINT1 ("FormatPartition() failed with status
0x%.08x\n", Status);
+ /* FIXME: show an error dialog */
+ return QUIT_PAGE;
+ }
+ PartEntry->New = FALSE;
+ CheckActiveBootPartition (PartitionList);
+ }
+
switch (FileSystemList->CurrentFileSystem)
{
case FsFat:
- Status = FormatPartition (&DestinationRootPath);
- if (!NT_SUCCESS (Status))
- {
- DPRINT1 ("FormatPartition() failed with status
0x%.08x\n", Status);
- /* FIXME: show an error dialog */
- return QUIT_PAGE;
- }
-
- PartEntry->New = FALSE;
- if (FileSystemList != NULL)
- {
- DestroyFileSystemList (FileSystemList);
- FileSystemList = NULL;
- }
-
- CheckActiveBootPartition (PartitionList);
-
/* FIXME: Install boot code. This is a hack! */
if ((PartEntry->PartInfo[0].PartitionType ==
PARTITION_FAT32_XINT13) ||
(PartEntry->PartInfo[0].PartitionType ==
PARTITION_FAT32))
@@ -2534,13 +2541,34 @@
}
break;
+ case FsExt2:
+ {
+ wcscpy (PathBuffer, SourceRootPath.Buffer);
+ wcscat (PathBuffer, L"\\loader\\ext2.bin");
+
+ DPRINT ("Install EXT2 bootcode: %S ==> %S\n",
PathBuffer,
+ DestinationRootPath.Buffer);
+ Status = InstallExt2BootCodeToDisk (PathBuffer,
+
DestinationRootPath.Buffer);
+ if (!NT_SUCCESS (Status))
+ {
+ DPRINT1 ("InstallExt2BootCodeToDisk() failed
with status 0x%.08x\n", Status);
+ /* FIXME: show an error dialog */
+ return QUIT_PAGE;
+ }
+ }
+ break;
+
case FsKeep:
break;
- default:
- return QUIT_PAGE;
+ default:
+ return QUIT_PAGE;
}
+ DestroyFileSystemList (FileSystemList);
+ FileSystemList = NULL;
+
#ifndef NDEBUG
SetStatusText (" Done. Press any key ...");
ConInKey(Ir);