Fixed drive map in the shared user page.

svn path=/trunk/; revision=2871
This commit is contained in:
Eric Kohl 2002-04-26 19:59:25 +00:00
parent f46d1f34e3
commit 321c888721
4 changed files with 116 additions and 66 deletions

View file

@ -3,6 +3,49 @@
int main() int main()
{ {
int i;
printf("TickCountLow: %x\n", printf("TickCountLow: %x\n",
SharedUserData->TickCountLow); SharedUserData->TickCountLow);
printf("Drives: ");
for (i = 0; i < 26; i++)
{
printf("%c", (SharedUserData->DosDeviceMap & (1 << i))?'1':'0');
}
printf("\n");
for (i = 0; i < 26; i++)
{
if (SharedUserData->DosDeviceMap & (1 << i))
{
printf("%c: ", 'A'+i);
switch(SharedUserData->DosDeviceDriveType[i])
{
case DOSDEVICE_DRIVE_UNKNOWN:
printf("Unknown\n");
break;
case DOSDEVICE_DRIVE_CALCULATE:
printf("No root\n");
break;
case DOSDEVICE_DRIVE_REMOVABLE:
printf("Removable\n");
break;
case DOSDEVICE_DRIVE_FIXED:
printf("Fixed\n");
break;
case DOSDEVICE_DRIVE_REMOTE:
printf("Remote\n");
break;
case DOSDEVICE_DRIVE_CDROM:
printf("CD-ROM\n");
break;
case DOSDEVICE_DRIVE_RAMDISK:
printf("Ram disk\n");
break;
default:
printf("undefined type\n");
break;
}
}
}
printf("\n\n");
} }

View file

@ -44,6 +44,16 @@ typedef struct _KUSER_SHARED_DATA
BOOLEAN KdDebuggerEnabled; BOOLEAN KdDebuggerEnabled;
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA; } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
/* Values for DosDeviceDriveType */
#define DOSDEVICE_DRIVE_UNKNOWN 0
#define DOSDEVICE_DRIVE_CALCULATE 1
#define DOSDEVICE_DRIVE_REMOVABLE 2
#define DOSDEVICE_DRIVE_FIXED 3
#define DOSDEVICE_DRIVE_REMOTE 4
#define DOSDEVICE_DRIVE_CDROM 5
#define DOSDEVICE_DRIVE_RAMDISK 6
#define KERNEL_SHARED_DATA (0xFFDF0000) #define KERNEL_SHARED_DATA (0xFFDF0000)
#define USER_SHARED_DATA (0x7FFE0000) #define USER_SHARED_DATA (0x7FFE0000)

View file

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.19 2002/04/17 18:26:53 ekohl Exp $ /* $Id: xhaldrv.c,v 1.20 2002/04/26 19:58:48 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -241,64 +241,65 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
static VOID static VOID
HalpAssignDrive(IN PUNICODE_STRING PartitionName, HalpAssignDrive(IN PUNICODE_STRING PartitionName,
IN OUT PULONG DriveMap, IN ULONG DriveNumber,
IN ULONG DriveNumber) IN UCHAR DriveType)
{ {
WCHAR DriveNameBuffer[8]; WCHAR DriveNameBuffer[8];
UNICODE_STRING DriveName; UNICODE_STRING DriveName;
ULONG i; ULONG i;
DPRINT("HalpAssignDrive()\n"); DPRINT("HalpAssignDrive()\n");
if ((DriveNumber != AUTO_DRIVE) && (DriveNumber < 24)) if ((DriveNumber != AUTO_DRIVE) && (DriveNumber < 24))
{ {
/* force assignment */ /* Force assignment */
if ((*DriveMap & (1 << DriveNumber)) != 0) if ((SharedUserData->DosDeviceMap & (1 << DriveNumber)) != 0)
{ {
DbgPrint("Drive letter already used!\n"); DbgPrint("Drive letter already used!\n");
return; return;
} }
} }
else else
{ {
/* automatic assignment */ /* Automatic assignment */
DriveNumber = AUTO_DRIVE; DriveNumber = AUTO_DRIVE;
for (i = 2; i < 24; i++) for (i = 2; i < 24; i++)
{ {
if ((*DriveMap & (1 << i)) == 0) if ((SharedUserData->DosDeviceMap & (1 << i)) == 0)
{ {
DriveNumber = i; DriveNumber = i;
break; break;
} }
} }
if (DriveNumber == AUTO_DRIVE) if (DriveNumber == AUTO_DRIVE)
{ {
DbgPrint("No drive letter available!\n"); DbgPrint("No drive letter available!\n");
return; return;
} }
} }
DPRINT("DriveNumber %d\n", DriveNumber); DPRINT("DriveNumber %d\n", DriveNumber);
/* set bit in drive map */ /* Update the shared user page */
*DriveMap = *DriveMap | (1 << DriveNumber); SharedUserData->DosDeviceMap |= (1 << DriveNumber);
SharedUserData->DosDeviceDriveType[DriveNumber] = DriveType;
/* build drive name */ /* Build drive name */
swprintf(DriveNameBuffer, swprintf(DriveNameBuffer,
L"\\??\\%C:", L"\\??\\%C:",
'A' + DriveNumber); 'A' + DriveNumber);
RtlInitUnicodeString(&DriveName, RtlInitUnicodeString(&DriveName,
DriveNameBuffer); DriveNameBuffer);
DPRINT(" %wZ ==> %wZ\n", DPRINT(" %wZ ==> %wZ\n",
&DriveName, &DriveName,
PartitionName); PartitionName);
/* create symbolic link */ /* Create symbolic link */
IoCreateSymbolicLink(&DriveName, IoCreateSymbolicLink(&DriveName,
PartitionName); PartitionName);
} }
@ -319,7 +320,6 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
PWSTR Buffer2; PWSTR Buffer2;
ULONG i; ULONG i;
NTSTATUS Status; NTSTATUS Status;
ULONG DriveMap = 0;
ULONG j; ULONG j;
DPRINT("xHalIoAssignDriveLetters()\n"); DPRINT("xHalIoAssignDriveLetters()\n");
@ -445,8 +445,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
/* assign it */ /* assign it */
HalpAssignDrive(&UnicodeString2, HalpAssignDrive(&UnicodeString2,
&DriveMap, AUTO_DRIVE,
AUTO_DRIVE); DOSDEVICE_DRIVE_FIXED);
} }
} }
} }
@ -473,8 +473,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
DPRINT(" %wZ\n", DPRINT(" %wZ\n",
&UnicodeString2); &UnicodeString2);
HalpAssignDrive(&UnicodeString2, HalpAssignDrive(&UnicodeString2,
&DriveMap, AUTO_DRIVE,
AUTO_DRIVE); DOSDEVICE_DRIVE_FIXED);
} }
} }
} }
@ -501,8 +501,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
DPRINT(" %wZ\n", DPRINT(" %wZ\n",
&UnicodeString2); &UnicodeString2);
HalpAssignDrive(&UnicodeString2, HalpAssignDrive(&UnicodeString2,
&DriveMap, AUTO_DRIVE,
AUTO_DRIVE); DOSDEVICE_DRIVE_FIXED);
} }
} }
} }
@ -528,8 +528,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
DPRINT(" %wZ\n", DPRINT(" %wZ\n",
&UnicodeString2); &UnicodeString2);
HalpAssignDrive(&UnicodeString2, HalpAssignDrive(&UnicodeString2,
&DriveMap, AUTO_DRIVE,
AUTO_DRIVE); DOSDEVICE_DRIVE_REMOVABLE);
} }
} }
/* TEST END */ /* TEST END */
@ -557,8 +557,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
DPRINT(" %wZ\n", DPRINT(" %wZ\n",
&UnicodeString1); &UnicodeString1);
HalpAssignDrive(&UnicodeString1, HalpAssignDrive(&UnicodeString1,
&DriveMap, (i < 2) ? i : AUTO_DRIVE,
(i < 2) ? i : AUTO_DRIVE); DOSDEVICE_DRIVE_REMOVABLE);
} }
/* Assign cdrom drives */ /* Assign cdrom drives */
@ -574,8 +574,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
/* assign first free drive letter */ /* assign first free drive letter */
DPRINT(" %wZ\n", &UnicodeString1); DPRINT(" %wZ\n", &UnicodeString1);
HalpAssignDrive(&UnicodeString1, HalpAssignDrive(&UnicodeString1,
&DriveMap, AUTO_DRIVE,
AUTO_DRIVE); DOSDEVICE_DRIVE_CDROM);
} }
/* Anything else ?? */ /* Anything else ?? */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: main.c,v 1.118 2002/04/26 13:11:28 ekohl Exp $ /* $Id: main.c,v 1.119 2002/04/26 19:57:11 ekohl Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -561,9 +561,6 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
} }
NtClose (Handle); NtClose (Handle);
/* set bit in dos drives bitmap (drive available) */
SharedUserData->DosDeviceMap |= (1<<i);
} }
RtlFreeUnicodeString (&BootPath); RtlFreeUnicodeString (&BootPath);