mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Display drive letters in partition list.
svn path=/trunk/; revision=3691
This commit is contained in:
parent
d6d5e1af3d
commit
614f689b29
6 changed files with 105 additions and 68 deletions
|
@ -1006,13 +1006,9 @@ PrintTextXY(SHORT x, SHORT y, char* fmt,...)
|
|||
va_list ap;
|
||||
COORD coPos;
|
||||
|
||||
CHECKPOINT1;
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
CHECKPOINT1;
|
||||
DPRINT1("%s\n", buffer);
|
||||
CHECKPOINT1;
|
||||
|
||||
coPos.X = x;
|
||||
coPos.Y = y;
|
||||
|
|
|
@ -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: drivesup.c,v 1.2 2002/11/02 23:17:06 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/drivesup.c
|
||||
|
@ -94,23 +94,22 @@ GetSourcePaths(PUNICODE_STRING SourcePath,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
CHAR
|
||||
GetDriveLetter(IN ULONG DriveNumber,
|
||||
IN ULONG PartitionNumber)
|
||||
GetDriveLetter(ULONG DriveNumber,
|
||||
ULONG PartitionNumber)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING LinkName;
|
||||
WCHAR LinkBuffer[8];
|
||||
WCHAR Letter;
|
||||
CHAR Letter;
|
||||
HANDLE LinkHandle;
|
||||
UNICODE_STRING TargetName;
|
||||
WCHAR TargetBuffer[MAX_PATH];
|
||||
// WCHAR DeviceBuffer[MAX_PATH];
|
||||
PWCHAR TargetBuffer;
|
||||
PWCHAR DeviceBuffer;
|
||||
ULONG Length;
|
||||
NTSTATUS Status;
|
||||
|
||||
wcscpy(LinkBuffer,
|
||||
L"\\??\\A:");
|
||||
wcscpy(LinkBuffer, L"\\??\\A:");
|
||||
|
||||
RtlInitUnicodeString(&LinkName,
|
||||
LinkBuffer);
|
||||
|
@ -121,13 +120,21 @@ GetDriveLetter(IN ULONG DriveNumber,
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
TargetBuffer = RtlAllocateHeap(ProcessHeap, 0, MAX_PATH * sizeof(WCHAR));
|
||||
DeviceBuffer = RtlAllocateHeap(ProcessHeap, 0, MAX_PATH * sizeof(WCHAR));
|
||||
|
||||
TargetName.Length = 0;
|
||||
TargetName.MaximumLength = MAX_PATH * sizeof(WCHAR);
|
||||
TargetName.Buffer = TargetBuffer;
|
||||
|
||||
for (Letter = L'C'; Letter <= L'Z'; Letter++)
|
||||
swprintf(DeviceBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
DriveNumber,
|
||||
PartitionNumber);
|
||||
|
||||
for (Letter = 'C'; Letter <= 'Z'; Letter++)
|
||||
{
|
||||
LinkBuffer[4] = Letter;
|
||||
LinkBuffer[4] = (WCHAR)Letter;
|
||||
TargetName.Length = 0;
|
||||
|
||||
Status = NtOpenSymbolicLinkObject(&LinkHandle,
|
||||
|
@ -138,26 +145,23 @@ GetDriveLetter(IN ULONG DriveNumber,
|
|||
Status = NtQuerySymbolicLinkObject(LinkHandle,
|
||||
&TargetName,
|
||||
&Length);
|
||||
NtClose(LinkHandle);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (_wcsicmp(DeviceBuffer, TargetBuffer) == 0)
|
||||
{
|
||||
RtlFreeHeap(ProcessHeap, 0, DeviceBuffer);
|
||||
RtlFreeHeap(ProcessHeap, 0, TargetBuffer);
|
||||
return(Letter);
|
||||
}
|
||||
}
|
||||
NtClose(LinkHandle);
|
||||
}
|
||||
}
|
||||
|
||||
RtlFreeHeap(ProcessHeap, 0, DeviceBuffer);
|
||||
RtlFreeHeap(ProcessHeap, 0, TargetBuffer);
|
||||
|
||||
return((CHAR)0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
STATUS
|
||||
GetFileSystem()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -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: drivesup.h,v 1.2 2002/11/02 23:17:06 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/drivesup.h
|
||||
|
@ -31,6 +31,10 @@ NTSTATUS
|
|||
GetSourcePaths(PUNICODE_STRING SourcePath,
|
||||
PUNICODE_STRING SourceRootPath);
|
||||
|
||||
CHAR
|
||||
GetDriveLetter(ULONG DriveNumber,
|
||||
ULONG PartitionNumber);
|
||||
|
||||
|
||||
#endif /* __DRIVESUP_H__ */
|
||||
|
||||
|
|
|
@ -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: partlist.c,v 1.3 2002/11/02 23:17:06 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.c
|
||||
|
@ -34,6 +34,7 @@
|
|||
#include "usetup.h"
|
||||
#include "console.h"
|
||||
#include "partlist.h"
|
||||
#include "drivesup.h"
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
@ -184,6 +185,10 @@ CreatePartitionList(SHORT Left,
|
|||
List->DiskArray[DiskCount].PartArray[i].PartSize = LayoutBuffer->PartitionEntry[i].PartitionLength.QuadPart;
|
||||
List->DiskArray[DiskCount].PartArray[i].PartNumber = LayoutBuffer->PartitionEntry[i].PartitionNumber,
|
||||
List->DiskArray[DiskCount].PartArray[i].PartType = LayoutBuffer->PartitionEntry[i].PartitionType;
|
||||
|
||||
List->DiskArray[DiskCount].PartArray[i].DriveLetter = GetDriveLetter(DiskCount,
|
||||
LayoutBuffer->PartitionEntry[i].PartitionNumber);
|
||||
|
||||
List->DiskArray[DiskCount].PartArray[i].Used = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -368,15 +373,29 @@ PrintPartitionData(PPARTLIST List,
|
|||
Unit = "kB";
|
||||
}
|
||||
|
||||
sprintf(LineBuffer,
|
||||
"%d: nr: %d type: %x (%s) %I64u %s",
|
||||
PartIndex,
|
||||
PartEntry->PartNumber,
|
||||
PartEntry->PartType,
|
||||
PartType,
|
||||
PartSize,
|
||||
Unit);
|
||||
|
||||
if (PartEntry->DriveLetter != (CHAR)0)
|
||||
{
|
||||
sprintf(LineBuffer,
|
||||
"%c: %d: nr: %d type: %x (%s) %I64u %s",
|
||||
PartEntry->DriveLetter,
|
||||
PartIndex,
|
||||
PartEntry->PartNumber,
|
||||
PartEntry->PartType,
|
||||
PartType,
|
||||
PartSize,
|
||||
Unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(LineBuffer,
|
||||
" %d: nr: %d type: %x (%s) %I64u %s",
|
||||
PartIndex,
|
||||
PartEntry->PartNumber,
|
||||
PartEntry->PartType,
|
||||
PartType,
|
||||
PartSize,
|
||||
Unit);
|
||||
}
|
||||
|
||||
Attribute = (List->CurrentDisk == DiskIndex &&
|
||||
List->CurrentPartition == PartIndex) ? 0x71 : 0x17;
|
||||
|
@ -687,6 +706,8 @@ GetPartitionData(PPARTLIST List,
|
|||
Data->PartNumber = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartNumber;
|
||||
Data->PartType = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartType;
|
||||
|
||||
Data->DriveLetter = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].DriveLetter;
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -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: partlist.h,v 1.3 2002/11/02 23:17:06 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.h
|
||||
|
@ -34,9 +34,12 @@ typedef struct _PARTDATA
|
|||
USHORT Port;
|
||||
USHORT Bus;
|
||||
USHORT Id;
|
||||
|
||||
ULONGLONG PartSize;
|
||||
ULONG PartNumber;
|
||||
ULONG PartType;
|
||||
|
||||
CHAR DriveLetter;
|
||||
} PARTDATA, *PPARTDATA;
|
||||
|
||||
|
||||
|
@ -45,6 +48,7 @@ typedef struct _PARTENTRY
|
|||
ULONGLONG PartSize;
|
||||
ULONG PartNumber;
|
||||
ULONG PartType;
|
||||
|
||||
CHAR DriveLetter;
|
||||
BOOL Used;
|
||||
} PARTENTRY, *PPARTENTRY;
|
||||
|
@ -106,7 +110,8 @@ VOID
|
|||
ScrollUpPartitionList(PPARTLIST List);
|
||||
|
||||
BOOL
|
||||
GetPartitionData(PPARTLIST List, PPARTDATA Data);
|
||||
GetPartitionData(PPARTLIST List,
|
||||
PPARTDATA Data);
|
||||
|
||||
#endif /* __PARTLIST_H__ */
|
||||
|
||||
|
|
|
@ -203,10 +203,9 @@ CHECKPOINT1;
|
|||
|
||||
|
||||
/*
|
||||
* First setup page
|
||||
* Start page
|
||||
* RETURNS
|
||||
* TRUE: setup/repair completed successfully
|
||||
* FALSE: setup/repair terminated by user
|
||||
* Number of the next page.
|
||||
*/
|
||||
static ULONG
|
||||
StartPage(PINPUT_RECORD Ir)
|
||||
|
@ -269,12 +268,12 @@ RepairIntroPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
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 */
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
|
||||
{
|
||||
return(INTRO_PAGE);
|
||||
}
|
||||
|
@ -300,9 +299,11 @@ IntroPage(PINPUT_RECORD Ir)
|
|||
|
||||
SetTextXY(8, 15, "\xf9 Press ENTER to install ReactOS.");
|
||||
|
||||
SetTextXY(8, 17, "\xf9 Press R to repair ReactOS.");
|
||||
SetTextXY(8, 17, "\xf9 Press E to start the emergency repair console.");
|
||||
|
||||
SetTextXY(8, 19, "\xf9 Press F3 to quit without installing ReactOS.");
|
||||
SetTextXY(8, 19, "\xf9 Press R to repair ReactOS.");
|
||||
|
||||
SetTextXY(8, 21, "\xf9 Press F3 to quit without installing ReactOS.");
|
||||
|
||||
|
||||
SetStatusText(" ENTER = Continue F3 = Quit");
|
||||
|
@ -312,17 +313,23 @@ IntroPage(PINPUT_RECORD Ir)
|
|||
ConInKey(Ir);
|
||||
|
||||
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
|
||||
{
|
||||
if (ConfirmQuit(Ir) == TRUE)
|
||||
return(QUIT_PAGE);
|
||||
break;
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return(INSTALL_INTRO_PAGE);
|
||||
}
|
||||
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
|
||||
#if 0
|
||||
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'E') /* E */
|
||||
{
|
||||
return(RepairConsole());
|
||||
}
|
||||
#endif
|
||||
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
|
||||
{
|
||||
return(REPAIR_INTRO_PAGE);
|
||||
}
|
||||
|
@ -359,13 +366,13 @@ InstallIntroPage(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(SELECT_PARTITION_PAGE);
|
||||
}
|
||||
|
@ -408,7 +415,7 @@ SelectPartitionPage(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)
|
||||
{
|
||||
|
@ -418,16 +425,16 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
break;
|
||||
}
|
||||
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN))
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
|
||||
{
|
||||
ScrollDownPartitionList(PartList);
|
||||
}
|
||||
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP))
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
|
||||
{
|
||||
ScrollUpPartitionList(PartList);
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
PartDataValid = GetPartitionData(PartList, &PartData);
|
||||
DestroyPartitionList(PartList);
|
||||
|
@ -538,18 +545,18 @@ SelectFileSystemPage(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 == 0x00) &&
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
|
||||
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
|
||||
{
|
||||
return(SELECT_PARTITION_PAGE);
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return(CHECK_FILE_SYSTEM_PAGE);
|
||||
}
|
||||
|
@ -576,7 +583,7 @@ CheckFileSystemPage(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);
|
||||
|
@ -617,7 +624,7 @@ InstallDirectoryPage(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);
|
||||
|
@ -818,7 +825,7 @@ PrepareCopyPage(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(FILE_COPY_PAGE);
|
||||
}
|
||||
|
@ -848,7 +855,7 @@ FileCopyPage(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(INIT_SYSTEM_PAGE);
|
||||
}
|
||||
|
@ -974,13 +981,13 @@ InitSystemPage(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(SUCCESS_PAGE);
|
||||
}
|
||||
|
@ -1006,7 +1013,7 @@ QuitPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return(REBOOT_PAGE);
|
||||
}
|
||||
|
@ -1030,7 +1037,7 @@ SuccessPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return(REBOOT_PAGE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue