- Remove InitSharedUserDataPage since this entire function is not needed anymore due to the recent ARC improvements.

- Call IoAssignDriverLetters with the proper parameters, and give it a chance to update the SystemRoot path (although our version doesn't yet do this).

svn path=/trunk/; revision=24461
This commit is contained in:
Alex Ionescu
2006-10-08 22:50:26 +00:00
parent d4b5fef3d6
commit 2b1ade4723
3 changed files with 41 additions and 179 deletions
+10 -164
View File
@@ -1,13 +1,13 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ex/init.c
* PURPOSE: Executive initalization
*
* PROGRAMMERS: Alex Ionescu ([email protected]) - Added ExpInitializeExecutive
* and optimized/cleaned it.
* Eric Kohl ([email protected])
*/
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/ex/init.c
* PURPOSE: Executive Initialization Code
* PROGRAMMERS: Alex Ionescu ([email protected])
* Eric Kohl ([email protected])
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
@@ -305,157 +305,6 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
ExpNlsTableBase = SectionBase;
}
static
VOID
INIT_FUNCTION
InitSystemSharedUserPage (IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
UNICODE_STRING ArcDeviceName;
UNICODE_STRING ArcName;
UNICODE_STRING BootPath;
UNICODE_STRING DriveDeviceName;
UNICODE_STRING DriveName;
WCHAR DriveNameBuffer[20];
PWCHAR ArcNameBuffer;
NTSTATUS Status;
ULONG Length;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE Handle;
ULONG i;
BOOLEAN BootDriveFound = FALSE;
/* Set the Product Type */
SharedUserData->NtProductType = NtProductWinNt;
SharedUserData->ProductTypeIsValid = TRUE;
/*
* Retrieve the current dos system path
* (e.g.: C:\reactos) from the given arc path
* (e.g.: multi(0)disk(0)rdisk(0)partititon(1)\reactos)
* Format: "<arc_name>\<path> [options...]"
*/
RtlCreateUnicodeStringFromAsciiz(&BootPath, LoaderBlock->NtBootPathName);
/* Remove the trailing backslash */
BootPath.Length -= sizeof(WCHAR);
BootPath.MaximumLength -= sizeof(WCHAR);
/* Only ARC Name left - Build full ARC Name */
ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
swprintf (ArcNameBuffer, L"\\ArcName\\%S", LoaderBlock->ArcBootDeviceName);
RtlInitUnicodeString (&ArcName, ArcNameBuffer);
/* Allocate ARC Device Name string */
ArcDeviceName.Length = 0;
ArcDeviceName.MaximumLength = 256 * sizeof(WCHAR);
ArcDeviceName.Buffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
/* Open the Symbolic Link */
InitializeObjectAttributes(&ObjectAttributes,
&ArcName,
OBJ_OPENLINK,
NULL,
NULL);
Status = NtOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
/* Free the String */
ExFreePool(ArcName.Buffer);
/* Check for Success */
if (!NT_SUCCESS(Status)) {
/* Free the Strings */
RtlFreeUnicodeString(&BootPath);
ExFreePool(ArcDeviceName.Buffer);
CPRINT("NtOpenSymbolicLinkObject() failed (Status %x)\n", Status);
KEBUGCHECK(0);
}
/* Query the Link */
Status = NtQuerySymbolicLinkObject(Handle,
&ArcDeviceName,
&Length);
NtClose (Handle);
/* Check for Success */
if (!NT_SUCCESS(Status)) {
/* Free the Strings */
RtlFreeUnicodeString(&BootPath);
ExFreePool(ArcDeviceName.Buffer);
CPRINT("NtQuerySymbolicLinkObject() failed (Status %x)\n", Status);
KEBUGCHECK(0);
}
/* Allocate Device Name string */
DriveDeviceName.Length = 0;
DriveDeviceName.MaximumLength = 256 * sizeof(WCHAR);
DriveDeviceName.Buffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
/* Loop Drives */
for (i = 0; i < 26; i++) {
/* Setup the String */
swprintf (DriveNameBuffer, L"\\??\\%C:", 'A' + i);
RtlInitUnicodeString(&DriveName,
DriveNameBuffer);
/* Open the Symbolic Link */
InitializeObjectAttributes(&ObjectAttributes,
&DriveName,
OBJ_OPENLINK,
NULL,
NULL);
Status = NtOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
/* If it failed, skip to the next drive */
if (!NT_SUCCESS(Status)) {
DPRINT("Failed to open link %wZ\n", &DriveName);
continue;
}
/* Query it */
Status = NtQuerySymbolicLinkObject(Handle,
&DriveDeviceName,
&Length);
/* If it failed, skip to the next drive */
if (!NT_SUCCESS(Status)) {
DPRINT("Failed to query link %wZ\n", &DriveName);
continue;
}
DPRINT("Opened link: %wZ ==> %wZ\n", &DriveName, &DriveDeviceName);
/* See if we've found the boot drive */
if (!RtlCompareUnicodeString (&ArcDeviceName, &DriveDeviceName, FALSE)) {
DPRINT("DOS Boot path: %c:%wZ\n", 'A' + i, &BootPath);
swprintf(SharedUserData->NtSystemRoot, L"%C:%wZ", 'A' + i, &BootPath);
BootDriveFound = TRUE;
}
/* Close this Link */
NtClose (Handle);
}
/* Free all the Strings we have in memory */
RtlFreeUnicodeString (&BootPath);
ExFreePool(DriveDeviceName.Buffer);
ExFreePool(ArcDeviceName.Buffer);
/* Make sure we found the Boot Drive */
if (BootDriveFound == FALSE) {
DbgPrint("No system drive found!\n");
KEBUGCHECK (NO_BOOT_DEVICE);
}
}
VOID
INIT_FUNCTION
ExpDisplayNotice(VOID)
@@ -770,7 +619,7 @@ ExpIsLoaderValid(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* Fail if this is XP */
if (Extension->MinorVersion < 2) return FALSE;
/* This is 2003 or newer, aprove it */
/* This is 2003 or newer, approve it */
return TRUE;
}
@@ -1092,9 +941,6 @@ ExPhase2Init(PVOID Context)
/* Load the System DLL and its Entrypoints */
PsLocateSystemDll();
/* Initialize shared user page. Set dos system path, dos device map, etc. */
InitSystemSharedUserPage(KeLoaderBlock);
/* Initialize VDM support */
KeI386VdmInitialize();
+10 -11
View File
@@ -1,14 +1,13 @@
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/arcname.c
* PURPOSE: Creates ARC names for boot devices
*
* PROGRAMMERS: Eric Kohl ([email protected])
*/
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/io/iomgr/arcname.c
* PURPOSE: ARC Path Initialization Functions
* PROGRAMMERS: Alex Ionescu ([email protected])
* Eric Kohl ([email protected])
*/
/* INCLUDES *****************************************************************/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
@@ -19,7 +18,7 @@
UNICODE_STRING IoArcHalDeviceName, IoArcBootDeviceName;
PCHAR IoLoaderArcBootDeviceName;
/* FUNCTIONS ****************************************************************/
/* FUNCTIONS *****************************************************************/
BOOLEAN
INIT_FUNCTION
+21 -4
View File
@@ -29,6 +29,7 @@ IoSynchronousInvalidateDeviceRelations(
POBJECT_TYPE IoDeviceObjectType = NULL;
POBJECT_TYPE IoFileObjectType = NULL;
extern POBJECT_TYPE IoControllerObjectType;
extern UNICODE_STRING NtSystemRoot;
BOOLEAN IoCountOperations;
ULONG IoReadOperationCount = 0;
LARGE_INTEGER IoReadTransferCount = {{0, 0}};
@@ -476,7 +477,8 @@ NTAPI
INIT_FUNCTION
IoInit3(VOID)
{
ANSI_STRING NtBootPath;
NTSTATUS Status;
ANSI_STRING NtBootPath, RootString;
/* Create ARC names for boot devices */
IopCreateArcNames(KeLoaderBlock);
@@ -502,11 +504,26 @@ IoInit3(VOID)
/* Convert SystemRoot from ARC to NT path */
IopReassignSystemRoot(KeLoaderBlock, &NtBootPath);
/* Set the ANSI_STRING for the root path */
RootString.MaximumLength = NtSystemRoot.MaximumLength / sizeof(WCHAR);
RootString.Length = 0;
RootString.Buffer = ExAllocatePoolWithTag(PagedPool,
RootString.MaximumLength,
TAG_IO);
/* Convert the path into the ANSI_STRING */
Status = RtlUnicodeStringToAnsiString(&RootString, &NtSystemRoot, FALSE);
if (!NT_SUCCESS(Status)) return;
/* Assign drive letters */
IoAssignDriveLetters(KeLoaderBlock,
NULL,
NULL,
NULL);
&NtBootPath,
RootString.Buffer,
&RootString);
/* Update system root */
Status = RtlAnsiStringToUnicodeString(&NtSystemRoot, &RootString, FALSE);
if (!NT_SUCCESS(Status)) return;
}
/* EOF */