From 92bb09bd8d31e90022a7fbabb5878f7f41d2a184 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 29 Oct 2002 18:40:02 +0000 Subject: [PATCH] Various improvements and hardcoded directory creation. svn path=/trunk/; revision=3675 --- reactos/subsys/system/usetup/console.c | 36 +- reactos/subsys/system/usetup/console.h | 127 +++++++ reactos/subsys/system/usetup/drivesup.c | 163 +++++++++ reactos/subsys/system/usetup/drivesup.h | 37 ++ reactos/subsys/system/usetup/makefile | 4 +- reactos/subsys/system/usetup/partlist.c | 324 ++++++++++------- reactos/subsys/system/usetup/partlist.h | 31 +- reactos/subsys/system/usetup/usetup.c | 443 ++++++++++++++++++++---- reactos/subsys/system/usetup/usetup.h | 119 ++----- 9 files changed, 981 insertions(+), 303 deletions(-) create mode 100644 reactos/subsys/system/usetup/console.h create mode 100644 reactos/subsys/system/usetup/drivesup.c create mode 100644 reactos/subsys/system/usetup/drivesup.h diff --git a/reactos/subsys/system/usetup/console.c b/reactos/subsys/system/usetup/console.c index f0f9fa74957..e9fbc2b222a 100644 --- a/reactos/subsys/system/usetup/console.c +++ b/reactos/subsys/system/usetup/console.c @@ -1,13 +1,27 @@ +/* + * 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. + */ /* * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/console.c - * PURPOSE: Win32 server console functions - * PROGRAMMER: ??? - * UPDATE HISTORY: - * 199901?? ?? Created - * 19990204 EA SetConsoleTitleA - * 19990306 EA Stubs + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/console.c + * PURPOSE: Console support functions + * PROGRAMMER: Eric Kohl */ /* INCLUDES ******************************************************************/ @@ -15,12 +29,8 @@ #include #include -#include - #include "usetup.h" -//#include -//#include -//#include +#include "console.h" /* GLOBALS ******************************************************************/ diff --git a/reactos/subsys/system/usetup/console.h b/reactos/subsys/system/usetup/console.h new file mode 100644 index 00000000000..cecff914ecf --- /dev/null +++ b/reactos/subsys/system/usetup/console.h @@ -0,0 +1,127 @@ +/* + * 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. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/console.h + * PURPOSE: Console support functions + * PROGRAMMER: Eric Kohl + */ + +#ifndef __CONSOLE_H__ +#define __CONSOLE_H__ + +#include + + +NTSTATUS +AllocConsole(VOID); + +VOID +FreeConsole(VOID); + + +NTSTATUS +ReadConsoleOutputCharacters(LPSTR lpCharacter, + ULONG nLength, + COORD dwReadCoord, + PULONG lpNumberOfCharsRead); + +NTSTATUS +ReadConsoleOutputAttributes(PUSHORT lpAttribute, + ULONG nLength, + COORD dwReadCoord, + PULONG lpNumberOfAttrsRead); + +NTSTATUS +WriteConsoleOutputCharacters(LPCSTR lpCharacter, + ULONG nLength, + COORD dwWriteCoord); + +NTSTATUS +WriteConsoleOutputAttributes(CONST USHORT *lpAttribute, + ULONG nLength, + COORD dwWriteCoord, + PULONG lpNumberOfAttrsWritten); + +#if 0 +NTSTATUS +SetConsoleMode(HANDLE hConsoleHandle, + ULONG dwMode); +#endif + +VOID +ConInKey(PINPUT_RECORD Buffer); + +VOID +ConOutChar(CHAR c); + +VOID +ConOutPuts(LPSTR szText); + +VOID +ConOutPrintf(LPSTR szFormat, ...); + +SHORT +GetCursorX(VOID); + +SHORT +GetCursorY(VOID); + +VOID +GetScreenSize(SHORT *maxx, + SHORT *maxy); + + +VOID +SetCursorType(BOOL bInsert, + BOOL bVisible); + +VOID +SetCursorXY(SHORT x, + SHORT y); + + +VOID +ClearScreen(VOID); + +VOID +SetStatusText(PCHAR Text); + +VOID +SetTextXY(SHORT x, SHORT y, PCHAR Text); + +VOID +SetInputTextXY(SHORT x, SHORT y, SHORT len, PCHAR Text); + +VOID +SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text); + +VOID +SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text); + +VOID +SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text); + +VOID +PrintTextXY(SHORT x, SHORT y, char* fmt,...); + +#endif /* __CONSOLE_H__*/ + +/* EOF */ diff --git a/reactos/subsys/system/usetup/drivesup.c b/reactos/subsys/system/usetup/drivesup.c new file mode 100644 index 00000000000..c87f74e51e4 --- /dev/null +++ b/reactos/subsys/system/usetup/drivesup.c @@ -0,0 +1,163 @@ +/* + * 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. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/drivesup.c + * PURPOSE: Drive support functions + * PROGRAMMER: Eric Kohl + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +#include "usetup.h" +#include "drivesup.h" + + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS +GetSourcePaths(PUNICODE_STRING SourcePath, + PUNICODE_STRING SourceRootPath) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING LinkName; + UNICODE_STRING SourceName; + WCHAR SourceBuffer[MAX_PATH]; + HANDLE Handle; + NTSTATUS Status; + ULONG Length; + PWCHAR Ptr; + + 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); + + SourceName.Length = 0; + SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR); + SourceName.Buffer = SourceBuffer; + + Status = NtQuerySymbolicLinkObject(Handle, + &SourceName, + &Length); + NtClose(Handle); + + if (NT_SUCCESS(Status)) + { + RtlCreateUnicodeString(SourcePath, + SourceName.Buffer); + + /* strip trailing directory */ + Ptr = wcsrchr(SourceName.Buffer, L'\\'); +// if ((Ptr != NULL) && +// (wcsicmp(Ptr, L"\\reactos") == 0)) + if (Ptr != NULL) + *Ptr = 0; + + RtlCreateUnicodeString(SourceRootPath, + SourceName.Buffer); + } + + NtClose(Handle); + + return(STATUS_SUCCESS); +} + + +#if 0 +CHAR +GetDriveLetter(IN ULONG DriveNumber, + IN ULONG PartitionNumber) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING LinkName; + WCHAR LinkBuffer[8]; + WCHAR Letter; + HANDLE LinkHandle; + UNICODE_STRING TargetName; + WCHAR TargetBuffer[MAX_PATH]; +// WCHAR DeviceBuffer[MAX_PATH]; + ULONG Length; + + wcscpy(LinkBuffer, + L"\\??\\A:"); + + RtlInitUnicodeString(&LinkName, + LinkBuffer); + + InitializeObjectAttributes(&ObjectAttributes, + &LinkName, + OBJ_OPENLINK, + NULL, + NULL); + + TargetName.Length = 0; + TargetName.MaximumLength = MAX_PATH * sizeof(WCHAR); + TargetName.Buffer = TargetBuffer; + + for (Letter = L'C'; Letter <= L'Z'; Letter++) + { + LinkBuffer[4] = Letter; + TargetName.Length = 0; + + Status = NtOpenSymbolicLinkObject(&LinkHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + Status = NtQuerySymbolicLinkObject(LinkHandle, + &TargetName, + &Length); + if (NT_SUCCESS(Status)) + { + + + + } + NtClose(LinkHandle); + } + } + + return((CHAR)0); +} +#endif + +#if 0 +STATUS +GetFileSystem() +{ + +} +#endif + +/* EOF */ diff --git a/reactos/subsys/system/usetup/drivesup.h b/reactos/subsys/system/usetup/drivesup.h new file mode 100644 index 00000000000..f2ef4de5382 --- /dev/null +++ b/reactos/subsys/system/usetup/drivesup.h @@ -0,0 +1,37 @@ +/* + * 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. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/drivesup.h + * PURPOSE: Drive support functions + * PROGRAMMER: Eric Kohl + */ + +#ifndef __DRIVESUP_H__ +#define __DRIVESUP_H__ + +NTSTATUS +GetSourcePaths(PUNICODE_STRING SourcePath, + PUNICODE_STRING SourceRootPath); + + +#endif /* __DRIVESUP_H__ */ + +/* EOF */ \ No newline at end of file diff --git a/reactos/subsys/system/usetup/makefile b/reactos/subsys/system/usetup/makefile index 42dae1779fa..b3aefdfcf3b 100644 --- a/reactos/subsys/system/usetup/makefile +++ b/reactos/subsys/system/usetup/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.2 2002/10/18 20:04:00 ekohl Exp $ +# $Id: makefile,v 1.3 2002/10/29 18:40:02 ekohl Exp $ PATH_TO_TOP = ../../.. @@ -12,7 +12,7 @@ TARGET_INSTALLDIR = system32 TARGET_CFLAGS = -D__NTAPP__ -TARGET_OBJECTS = $(TARGET_NAME).o console.o partlist.o +TARGET_OBJECTS = $(TARGET_NAME).o console.o drivesup.o partlist.o include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/subsys/system/usetup/partlist.c b/reactos/subsys/system/usetup/partlist.c index b3f1fce67ab..d00867fcd92 100644 --- a/reactos/subsys/system/usetup/partlist.c +++ b/reactos/subsys/system/usetup/partlist.c @@ -1,5 +1,27 @@ /* - * partlist.c + * 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. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/partlist.c + * PURPOSE: Partition list functions + * PROGRAMMER: Eric Kohl */ #include @@ -8,13 +30,13 @@ #include #include -#include #include "usetup.h" +#include "console.h" #include "partlist.h" - +/* FUNCTIONS ****************************************************************/ PPARTLIST CreatePartitionList(SHORT Left, @@ -46,6 +68,8 @@ CreatePartitionList(SHORT Left, List->Right = Right; List->Bottom = Bottom; + List->Line = 0; + List->TopDisk = (ULONG)-1; List->TopPartition = (ULONG)-1; @@ -248,7 +272,7 @@ DestroyPartitionList(PPARTLIST List) static VOID -PrintEmptyLine(PPARTLIST List, USHORT Line) +PrintEmptyLine(PPARTLIST List) { COORD coPos; ULONG Written; @@ -258,12 +282,11 @@ PrintEmptyLine(PPARTLIST List, USHORT Line) Width = List->Right - List->Left - 1; Height = List->Bottom - List->Top - 1; - if (Line > Height) + if (List->Line < 0 || List->Line > Height) return; coPos.X = List->Left + 1; - coPos.Y = List->Top + 1 + Line; - + coPos.Y = List->Top + 1 + List->Line; FillConsoleOutputAttribute(0x17, Width, @@ -274,63 +297,89 @@ PrintEmptyLine(PPARTLIST List, USHORT Line) Width, coPos, &Written); + + List->Line++; } static VOID -PrintDiskLine(PPARTLIST List, USHORT Line, PCHAR Text) +PrintPartitionData(PPARTLIST List, + SHORT DiskIndex, + SHORT PartIndex) { + PPARTENTRY PartEntry; + CHAR LineBuffer[128]; COORD coPos; ULONG Written; USHORT Width; USHORT Height; + ULONGLONG PartSize; + PCHAR Unit; + PCHAR PartType; + UCHAR Attribute; + + Width = List->Right - List->Left - 1; Height = List->Bottom - List->Top - 1; - if (Line > Height) + if (List->Line < 0 || List->Line > Height) return; coPos.X = List->Left + 1; - coPos.Y = List->Top + 1 + Line; + coPos.Y = List->Top + 1 + List->Line; + PartEntry = &List->DiskArray[DiskIndex].PartArray[PartIndex]; - FillConsoleOutputAttribute(0x17, - Width, - coPos, - &Written); - - FillConsoleOutputCharacter(' ', - Width, - coPos, - &Written); - - if (Text != NULL) + if ((PartEntry->PartType == PARTITION_FAT_12) || + (PartEntry->PartType == PARTITION_FAT_16) || + (PartEntry->PartType == PARTITION_HUGE) || + (PartEntry->PartType == PARTITION_XINT13)) { - coPos.X++; - WriteConsoleOutputCharacters(Text, - min(strlen(Text), Width - 2), - coPos); + PartType = "FAT"; } -} + else if ((PartEntry->PartType == PARTITION_FAT32) || + (PartEntry->PartType == PARTITION_FAT32_XINT13)) + { + PartType = "FAT32"; + } + else if (PartEntry->PartType == PARTITION_IFS) + { + PartType = "NTFS"; /* FIXME: Not quite correct! */ + } + else + { + PartType = "Unknown"; + } + + if (PartEntry->PartSize >= 0x280000000ULL) /* 10 GB */ + { + PartSize = (PartEntry->PartSize + (1 << 29)) >> 30; + Unit = "GB"; + } + else if (PartEntry->PartSize >= 0xA00000ULL) /* 10 MB */ + { + PartSize = (PartEntry->PartSize + (1 << 19)) >> 20; + Unit = "MB"; + } + else + { + PartSize = (PartEntry->PartSize + (1 << 9)) >> 10; + Unit = "kB"; + } + + sprintf(LineBuffer, + "%d: nr: %d type: %x (%s) %I64u %s", + PartIndex, + PartEntry->PartNumber, + PartEntry->PartType, + PartType, + PartSize, + Unit); -static VOID -PrintPartitionLine(PPARTLIST List, USHORT Line, PCHAR Text, BOOL Selected) -{ - COORD coPos; - ULONG Written; - USHORT Width; - USHORT Height; - - Width = List->Right - List->Left - 1; - Height = List->Bottom - List->Top - 1; - - if (Line > Height) - return; - - coPos.X = List->Left + 1; - coPos.Y = List->Top + 1 + Line; + Attribute = (List->CurrentDisk == DiskIndex && + List->CurrentPartition == PartIndex) ? 0x71 : 0x17; FillConsoleOutputCharacter(' ', Width, @@ -339,19 +388,114 @@ PrintPartitionLine(PPARTLIST List, USHORT Line, PCHAR Text, BOOL Selected) coPos.X += 4; Width -= 8; - FillConsoleOutputAttribute((Selected == TRUE)? 0x71 : 0x17, + FillConsoleOutputAttribute(Attribute, Width, coPos, &Written); coPos.X++; Width -= 2; - WriteConsoleOutputCharacters(Text, - min(strlen(Text), Width), + WriteConsoleOutputCharacters(LineBuffer, + min(strlen(LineBuffer), Width), coPos); + + List->Line++; } +static VOID +PrintDiskData(PPARTLIST List, + SHORT DiskIndex) +{ + PDISKENTRY DiskEntry; + CHAR LineBuffer[128]; + COORD coPos; + ULONG Written; + USHORT Width; + USHORT Height; + ULONGLONG DiskSize; + PCHAR Unit; + SHORT PartIndex; + BOOL PartPrinted; + + DiskEntry = &List->DiskArray[DiskIndex]; + + Width = List->Right - List->Left - 1; + Height = List->Bottom - List->Top - 1; + + if (List->Line < 0 || List->Line > Height) + return; + + coPos.X = List->Left + 1; + coPos.Y = List->Top + 1 + List->Line; + + if (DiskEntry->DiskSize >= 0x280000000ULL) /* 10 GB */ + { + DiskSize = (DiskEntry->DiskSize + (1 << 29)) >> 30; + Unit = "GB"; + } + else if (DiskEntry->DiskSize >= 0xA00000ULL) /* 10 MB */ + { + DiskSize = (DiskEntry->DiskSize + (1 << 19)) >> 20; + Unit = "MB"; + } + else + { + DiskSize = (DiskEntry->DiskSize + (1 << 9)) >> 10; + Unit = "kB"; + } + + sprintf(LineBuffer, + "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)", + DiskSize, + Unit, + DiskEntry->DiskNumber, + DiskEntry->Port, + DiskEntry->Bus, + DiskEntry->Id); + + FillConsoleOutputAttribute(0x17, + Width, + coPos, + &Written); + + FillConsoleOutputCharacter(' ', + Width, + coPos, + &Written); + + coPos.X++; + WriteConsoleOutputCharacters(LineBuffer, + min(strlen(LineBuffer), Width - 2), + coPos); + + List->Line++; + + /* Print separator line */ + PrintEmptyLine(List); + + + PartPrinted = FALSE; + + /* Print partition lines*/ + for (PartIndex = 0; PartIndex < List->DiskArray[DiskIndex].PartCount; PartIndex++) + { + if (List->DiskArray[DiskIndex].PartArray[PartIndex].Used == TRUE) + { + PrintPartitionData(List, + DiskIndex, + PartIndex); + PartPrinted = TRUE; + } + } + + /* Print separator line */ + if (PartPrinted == TRUE) + { + PrintEmptyLine(List); + } +} + VOID DrawPartitionList(PPARTLIST List) @@ -360,11 +504,7 @@ DrawPartitionList(PPARTLIST List) COORD coPos; ULONG Written; SHORT i; - SHORT j; - ULONGLONG DiskSize; - PCHAR Unit; - USHORT Line; - PCHAR PartType; + SHORT DiskIndex; /* draw upper left corner */ coPos.X = List->Left; @@ -432,85 +572,16 @@ DrawPartitionList(PPARTLIST List) &Written); /* print list entries */ - Line = 0; - for (i = 0; i < List->DiskCount; i++) + List->Line = 0; + for (DiskIndex = 0; DiskIndex < List->DiskCount; DiskIndex++) { - if (List->DiskArray[i].FixedDisk == TRUE) + if (List->DiskArray[DiskIndex].FixedDisk == TRUE) { - /* print disk entry */ - if (List->DiskArray[i].DiskSize >= 0x280000000ULL) /* 10 GB */ - { - DiskSize = (List->DiskArray[i].DiskSize + (1 << 29)) >> 30; - Unit = "GB"; - } - else - { - DiskSize = (List->DiskArray[i].DiskSize + (1 << 19)) >> 20; - Unit = "MB"; - } - - sprintf(LineBuffer, - "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)", - DiskSize, - Unit, - List->DiskArray[i].DiskNumber, - List->DiskArray[i].Port, - List->DiskArray[i].Bus, - List->DiskArray[i].Id); - PrintDiskLine(List, Line, LineBuffer); - Line++; - - /* print separator line */ - PrintEmptyLine(List, Line); - Line++; - - /* print partition lines*/ - for (j = 0; j < List->DiskArray[i].PartCount; j++) - { - if (List->DiskArray[i].PartArray[j].Used == TRUE) - { - if ((List->DiskArray[i].PartArray[j].PartType == PARTITION_FAT_12) || - (List->DiskArray[i].PartArray[j].PartType == PARTITION_FAT_16) || - (List->DiskArray[i].PartArray[j].PartType == PARTITION_HUGE) || - (List->DiskArray[i].PartArray[j].PartType == PARTITION_XINT13)) - { - PartType = "FAT"; - } - else if ((List->DiskArray[i].PartArray[j].PartType == PARTITION_FAT32) || - (List->DiskArray[i].PartArray[j].PartType == PARTITION_FAT32_XINT13)) - { - PartType = "FAT32"; - } - else if (List->DiskArray[i].PartArray[j].PartType == PARTITION_IFS) - { - PartType = "NTFS"; /* FIXME: Not quite correct! */ - } - else - { - PartType = "Unknown"; - } - - sprintf(LineBuffer, - "%d: nr: %d type: %x (%s) %I64u MB", - j, - List->DiskArray[i].PartArray[j].PartNumber, - List->DiskArray[i].PartArray[j].PartType, - PartType, - (List->DiskArray[i].PartArray[j].PartSize + (1 << 19)) >> 20); - PrintPartitionLine(List, Line, LineBuffer, - (List->CurrentDisk == i && List->CurrentPartition == j)); // FALSE); - Line++; - - - } - } - - /* print separator line */ - PrintEmptyLine(List, Line); - Line++; + /* Print disk entry */ + PrintDiskData(List, + DiskIndex); } } - } @@ -591,7 +662,8 @@ ScrollUpPartitionList(PPARTLIST List) BOOL -GetPartitionData(PPARTLIST List, PPARTDATA Data) +GetPartitionData(PPARTLIST List, + PPARTDATA Data) { if (List->CurrentDisk >= List->DiskCount) return(FALSE); diff --git a/reactos/subsys/system/usetup/partlist.h b/reactos/subsys/system/usetup/partlist.h index ecd16d34b53..28bf5c1c94c 100644 --- a/reactos/subsys/system/usetup/partlist.h +++ b/reactos/subsys/system/usetup/partlist.h @@ -1,7 +1,31 @@ /* - * partlist.h + * 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. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/partlist.h + * PURPOSE: Partition list functions + * PROGRAMMER: Eric Kohl */ +#ifndef __PARTLIST_H__ +#define __PARTLIST_H__ typedef struct _PARTDATA { @@ -21,6 +45,7 @@ typedef struct _PARTENTRY ULONGLONG PartSize; ULONG PartNumber; ULONG PartType; + CHAR DriveLetter; BOOL Used; } PARTENTRY, *PPARTENTRY; @@ -46,6 +71,8 @@ typedef struct _PARTLIST SHORT Right; SHORT Bottom; + SHORT Line; + ULONG TopDisk; ULONG TopPartition; @@ -81,4 +108,6 @@ ScrollUpPartitionList(PPARTLIST List); BOOL GetPartitionData(PPARTLIST List, PPARTDATA Data); +#endif /* __PARTLIST_H__ */ + /* EOF */ \ No newline at end of file diff --git a/reactos/subsys/system/usetup/usetup.c b/reactos/subsys/system/usetup/usetup.c index 0df85762063..1704d6e92af 100644 --- a/reactos/subsys/system/usetup/usetup.c +++ b/reactos/subsys/system/usetup/usetup.c @@ -16,37 +16,36 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: usetup.c,v 1.5 2002/10/25 22:08:21 chorns Exp $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS user-mode setup application - * FILE: subsys/system/usetup/usetup.c - * PURPOSE: setup application - * PROGRAMMERS: Eric Kohl (ekohl@rz-online.de) +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/usetup.c + * PURPOSE: Text-mode setup + * PROGRAMMER: Eric Kohl */ #include -#include -#include - #include -#include - #include "usetup.h" +#include "console.h" #include "partlist.h" -#define INTRO_PAGE 0 -#define INSTALL_INTRO_PAGE 1 -#define SELECT_PARTITION_PAGE 3 -#define SELECT_FILE_SYSTEM_PAGE 4 -#define CHECK_FILE_SYSTEM_PAGE 5 -#define PREPARE_COPY_PAGE 6 -#define INSTALL_DIRECTORY_PAGE 7 -#define FILE_COPY_PAGE 8 -#define INIT_SYSTEM_PAGE 9 +#define START_PAGE 0 +#define INTRO_PAGE 1 +#define INSTALL_INTRO_PAGE 2 + +#define SELECT_PARTITION_PAGE 4 +#define SELECT_FILE_SYSTEM_PAGE 5 +#define CHECK_FILE_SYSTEM_PAGE 6 +#define PREPARE_COPY_PAGE 7 +#define INSTALL_DIRECTORY_PAGE 8 +#define FILE_COPY_PAGE 9 +#define INIT_SYSTEM_PAGE 10 + +#define REPAIR_INTRO_PAGE 20 #define SUCCESS_PAGE 100 #define QUIT_PAGE 101 @@ -62,20 +61,13 @@ PARTDATA PartData; CHAR InstallDir[51]; +UNICODE_STRING SourcePath; +UNICODE_STRING SourceRootPath; + /* FUNCTIONS ****************************************************************/ -void -DisplayString(LPCWSTR lpwString) -{ - UNICODE_STRING us; - - RtlInitUnicodeString(&us, lpwString); - NtDisplayString(&us); -} - - -void +static VOID PrintString(char* fmt,...) { char buffer[512]; @@ -170,12 +162,12 @@ CHECKPOINT1; ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { Result = TRUE; break; } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { Result = FALSE; break; @@ -210,16 +202,86 @@ CHECKPOINT1; +/* + * First setup page + * RETURNS + * TRUE: setup/repair completed successfully + * FALSE: setup/repair terminated by user + */ +static ULONG +StartPage(PINPUT_RECORD Ir) +{ + NTSTATUS Status; + + SetStatusText(" Please wait..."); + + Status = GetSourcePaths(&SourcePath, + &SourceRootPath); + if (!NT_SUCCESS(Status)) + { + PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status); + } + else + { + PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath); + PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath); + } + + /* + * FIXME: Open and load txtsetup.sif here. A pointer (or handle) to the + * ini data should be stored in a global variable. + * The full path to txtsetup.sif is created by appending '\txtsetup.sif' + * to the unicode string SourceRootPath. + */ + + SetStatusText(" ENTER = Continue"); + + while(TRUE) + { + ConInKey(Ir); + + if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ + { + return(INTRO_PAGE); + } + } + + return(START_PAGE); +} -#if 0 static ULONG RepairIntroPage(PINPUT_RECORD Ir) { + SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); + SetTextXY(6, 9, "support all the functions of a fully usable setup application."); + SetTextXY(6, 12, "The repair functions are not implemented yet."); + + SetTextXY(8, 15, "\xf9 Press ESC to return to the main page."); + + SetTextXY(8, 17, "\xf9 Press ENTER to reboot your computer."); + + SetStatusText(" ESC = Main page ENTER = Reboot"); + + while(TRUE) + { + ConInKey(Ir); + + if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ + { + return(REBOOT_PAGE); + } + else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */ + { + return(INTRO_PAGE); + } + } + + return(REPAIR_INTRO_PAGE); } -#endif /* @@ -231,19 +293,17 @@ RepairIntroPage(PINPUT_RECORD Ir) static ULONG IntroPage(PINPUT_RECORD Ir) { - SetHighlightedTextXY(6, 8, "Welcome to the ReactOS Setup"); + SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup"); SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your"); SetTextXY(6, 12, "computer and prepares the second part of the setup."); SetTextXY(8, 15, "\xf9 Press ENTER to install ReactOS."); -#if 0 SetTextXY(8, 17, "\xf9 Press R to repair ReactOS."); - SetTextXY(8, 19, "\xf9 Press F3 to quit without installing ReactOS."); -#endif - SetTextXY(8, 17, "\xf9 Press F3 to quit without installing ReactOS."); + SetTextXY(8, 19, "\xf9 Press F3 to quit without installing ReactOS."); + SetStatusText(" ENTER = Continue F3 = Quit"); @@ -252,22 +312,20 @@ IntroPage(PINPUT_RECORD Ir) ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { if (ConfirmQuit(Ir) == TRUE) return(QUIT_PAGE); break; } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { return(INSTALL_INTRO_PAGE); } -#if 0 - else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') + else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */ { return(REPAIR_INTRO_PAGE); } -#endif } return(INTRO_PAGE); @@ -277,16 +335,22 @@ IntroPage(PINPUT_RECORD Ir) static ULONG InstallIntroPage(PINPUT_RECORD Ir) { - SetTextXY(6, 8, "Install intro page"); + SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); + SetTextXY(6, 9, "support all the functions of a fully usable setup application."); -#if 0 - SetTextXY(6, 10, "This part of the setup copies the ReactOS Operating System to your"); - SetTextXY(6, 11, "computer and prepairs the second part of the setup."); + SetTextXY(6, 12, "The following functions are missing:"); + SetTextXY(8, 13, "- Creating and deleting harddisk partitions."); + SetTextXY(8, 14, "- Formatting partitions."); + SetTextXY(8, 15, "- Support for non-FAT file systems."); + SetTextXY(8, 16, "- Checking file systems."); + SetTextXY(8, 17, "- Installing the bootloader."); - SetTextXY(8, 14, "\xf9 Press ENTER to start the ReactOS setup."); - SetTextXY(8, 17, "\xf9 Press F3 to quit without installing ReactOS."); -#endif + + SetTextXY(8, 21, "\xf9 Press ENTER to install ReactOS."); + + SetTextXY(8, 23, "\xf9 Press F3 to quit without installing ReactOS."); + SetStatusText(" ENTER = Continue F3 = Quit"); @@ -480,11 +544,12 @@ SelectFileSystemPage(PINPUT_RECORD Ir) return(QUIT_PAGE); break; } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x1B) /* ESC */ + else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */ { return(SELECT_PARTITION_PAGE); } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { return(CHECK_FILE_SYSTEM_PAGE); } @@ -497,11 +562,12 @@ SelectFileSystemPage(PINPUT_RECORD Ir) static ULONG CheckFileSystemPage(PINPUT_RECORD Ir) { - SetTextXY(6, 8, "Check file system"); SetTextXY(6, 10, "At present, ReactOS can not check file systems."); + SetStatusText(" Please wait ..."); + SetStatusText(" ENTER = Continue F3 = Quit"); @@ -516,7 +582,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir) return(QUIT_PAGE); break; } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { return(INSTALL_DIRECTORY_PAGE); } @@ -557,11 +623,11 @@ InstallDirectoryPage(PINPUT_RECORD Ir) return(QUIT_PAGE); break; } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* Return */ + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { return(PREPARE_COPY_PAGE); } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* Backspace */ + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */ { if (Length > 0) { @@ -589,17 +655,154 @@ InstallDirectoryPage(PINPUT_RECORD Ir) static ULONG PrepareCopyPage(PINPUT_RECORD Ir) { + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + CHAR PathBuffer[MAX_PATH]; + UNICODE_STRING PathName; + HANDLE DirectoryHandle; + NTSTATUS Status; + PCHAR End; + ULONG Length; + ULONG i; - SetTextXY(6, 8, "Preparing to copy files"); + PCHAR Dirs[]= { + "System32", + "System32\\Config", + "System32\\Drivers", + "Inf", + "Help", + "Fonts", + NULL}; + + SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. "); - SetTextXY(6, 12, "Build file copy list"); + SetTextXY(8, 12, "Build file copy list"); - SetTextXY(6, 14, "Create directories"); + SetTextXY(8, 14, "Create directories"); SetStatusText(" Please wait..."); + /* 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"); + + + /* + * FIXME: Enumerate the ini section 'Directories' and create all "relative" directories + */ + + + /* create the systemroot directory */ + sprintf(PathBuffer, + "\\Device\\Harddisk%lu\\Partition%lu", + PartData.DiskNumber, + PartData.PartNumber); + if (InstallDir[0] != '\\') + strcat(PathBuffer, "\\"); + strcat(PathBuffer, InstallDir); + + /* remove trailing backslash */ + Length = strlen(PathBuffer); + if ((Length > 0) && (PathBuffer[Length - 1] == '\\')) + PathBuffer[Length - 1] = 0; + + RtlCreateUnicodeStringFromAsciiz(&PathName, + PathBuffer); + + ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); + ObjectAttributes.RootDirectory = NULL; + ObjectAttributes.ObjectName = &PathName; + ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE | OBJ_INHERIT; + ObjectAttributes.SecurityDescriptor = NULL; + ObjectAttributes.SecurityQualityOfService = NULL; + + Status = NtCreateFile(&DirectoryHandle, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_DIRECTORY, + 0, + FILE_CREATE, + FILE_DIRECTORY_FILE, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + PrintTextXY(6, 25, "Creating directory failed: Status = 0x%08lx", Status); + + } + else + { + PrintTextXY(6, 25, "Created directory."); + NtClose (DirectoryHandle); + } + + + RtlFreeUnicodeString(&PathName); + + + /* create the subdirectories */ + + /* append backslash and init end pointer */ + strcat(PathBuffer, "\\"); + Length = strlen(PathBuffer); + End = &PathBuffer[Length]; + + for (i = 0; Dirs[i] != NULL; i++) + { + strcpy(End, Dirs[i]); + + + RtlCreateUnicodeStringFromAsciiz(&PathName, + PathBuffer); + + + ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); + ObjectAttributes.RootDirectory = NULL; + ObjectAttributes.ObjectName = &PathName; + ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE | OBJ_INHERIT; + ObjectAttributes.SecurityDescriptor = NULL; + ObjectAttributes.SecurityQualityOfService = NULL; + + Status = NtCreateFile(&DirectoryHandle, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_DIRECTORY, + 0, + FILE_CREATE, + FILE_DIRECTORY_FILE, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + PrintTextXY(6, 25, "Creating directory failed: Status = 0x%08lx", Status); + } + else + { + PrintTextXY(6, 25, "Created directory."); + NtClose (DirectoryHandle); + } + + RtlFreeUnicodeString(&PathName); + } + + + SetTextXY(8, 14, "Create directories"); + SetHighlightedTextXY(50, 14, "Done"); SetStatusText(" ENTER = Continue F3 = Quit"); @@ -609,7 +812,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { if (ConfirmQuit(Ir) == TRUE) return(QUIT_PAGE); @@ -639,7 +842,7 @@ FileCopyPage(PINPUT_RECORD Ir) ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { if (ConfirmQuit(Ir) == TRUE) return(QUIT_PAGE); @@ -655,9 +858,71 @@ 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"); @@ -668,6 +933,39 @@ InitSystemPage(PINPUT_RECORD Ir) SetTextXY(6, 16, "Install/update boot manager"); + SetStatusText(" Please wait..."); + +#if 0 + /* + * Initialize registry + */ + + /* 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 + */ + + /* FIXME: Create key '\Registry\Machine\System\Setup' */ + + /* FIXME: Create value 'SystemSetupInProgress' */ + + SetStatusText(" ENTER = Continue F3 = Quit"); @@ -754,14 +1052,14 @@ NtProcessStartup(PPEB Peb) Status = AllocConsole(); if (!NT_SUCCESS(Status)) { - PrintString("Console initialization failed! (Status %lx)\n", Status); + PrintString("AllocConsole() failed (Status = 0x%08lx)\n", Status); /* Raise a hard error (crash the system/BSOD) */ NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0,0,0,0,0); } - Page = INTRO_PAGE; + Page = START_PAGE; while (Page != REBOOT_PAGE) { ClearScreen(); @@ -770,10 +1068,17 @@ NtProcessStartup(PPEB Peb) switch (Page) { + /* Start page */ + case START_PAGE: + Page = StartPage(&Ir); + break; + + /* Intro page */ case INTRO_PAGE: Page = IntroPage(&Ir); break; + /* Install pages */ case INSTALL_INTRO_PAGE: Page = InstallIntroPage(&Ir); break; @@ -817,6 +1122,12 @@ NtProcessStartup(PPEB Peb) break; + /* Repair pages */ + case REPAIR_INTRO_PAGE: + Page = RepairIntroPage(&Ir); + break; + + case SUCCESS_PAGE: Page = SuccessPage(&Ir); break; diff --git a/reactos/subsys/system/usetup/usetup.h b/reactos/subsys/system/usetup/usetup.h index 56617e659d9..b4fc855720d 100644 --- a/reactos/subsys/system/usetup/usetup.h +++ b/reactos/subsys/system/usetup/usetup.h @@ -1,5 +1,28 @@ /* -*/ + * 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. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS text-mode setup + * FILE: subsys/system/usetup/usetup.h + * PURPOSE: Text-mode setup + * PROGRAMMER: Eric Kohl + */ #ifndef __USETUP_H__ #define __USETUP_H__ @@ -15,100 +38,6 @@ extern HANDLE ProcessHeap; -/* console.c */ - -NTSTATUS -AllocConsole(VOID); - -VOID -FreeConsole(VOID); - - -NTSTATUS -ReadConsoleOutputCharacters(LPSTR lpCharacter, - ULONG nLength, - COORD dwReadCoord, - PULONG lpNumberOfCharsRead); - -NTSTATUS -ReadConsoleOutputAttributes(PUSHORT lpAttribute, - ULONG nLength, - COORD dwReadCoord, - PULONG lpNumberOfAttrsRead); - -NTSTATUS -WriteConsoleOutputCharacters(LPCSTR lpCharacter, - ULONG nLength, - COORD dwWriteCoord); - -NTSTATUS -WriteConsoleOutputAttributes(CONST USHORT *lpAttribute, - ULONG nLength, - COORD dwWriteCoord, - PULONG lpNumberOfAttrsWritten); - -#if 0 -NTSTATUS -SetConsoleMode(HANDLE hConsoleHandle, - ULONG dwMode); -#endif - -VOID -ConInKey(PINPUT_RECORD Buffer); - -VOID -ConOutChar(CHAR c); - -VOID -ConOutPuts(LPSTR szText); - -VOID -ConOutPrintf(LPSTR szFormat, ...); - -SHORT -GetCursorX(VOID); - -SHORT -GetCursorY(VOID); - -VOID -GetScreenSize(SHORT *maxx, - SHORT *maxy); - - -VOID -SetCursorType(BOOL bInsert, - BOOL bVisible); - -VOID -SetCursorXY(SHORT x, - SHORT y); - - -VOID -ClearScreen(VOID); - -VOID -SetStatusText(PCHAR Text); - -VOID -SetTextXY(SHORT x, SHORT y, PCHAR Text); - -VOID -SetInputTextXY(SHORT x, SHORT y, SHORT len, PCHAR Text); - -VOID -SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text); - -VOID -SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text); - -VOID -SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text); - -VOID -PrintTextXY(SHORT x, SHORT y, char* fmt,...); - #endif /* __USETUP_H__*/ /* EOF */