[ros-diffs] [ion] 24461: - 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).

ion at svn.reactos.org ion at svn.reactos.org
Mon Oct 9 00:50:27 CEST 2006


Author: ion
Date: Mon Oct  9 02:50:26 2006
New Revision: 24461

URL: http://svn.reactos.org/svn/reactos?rev=24461&view=rev
Log:
- 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).

Modified:
    trunk/reactos/ntoskrnl/ex/init.c
    trunk/reactos/ntoskrnl/io/iomgr/arcname.c
    trunk/reactos/ntoskrnl/io/iomgr/iomgr.c

Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=24461&r1=24460&r2=24461&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Mon Oct  9 02:50:26 2006
@@ -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 (alex at relsoft.net) - Added ExpInitializeExecutive
- *                                                    and optimized/cleaned it.
- *                  Eric Kohl (ekohl at abo.rhein-zeitung.de)
- */
+* PROJECT:         ReactOS Kernel
+* LICENSE:         GPL - See COPYING in the top level directory
+* FILE:            ntoskrnl/ex/init.c
+* PURPOSE:         Executive Initialization Code
+* PROGRAMMERS:     Alex Ionescu (alex.ionescu at reactos.org)
+*                  Eric Kohl (ekohl at rz-online.de)
+*/
+
+/* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
 #define NDEBUG
@@ -303,157 +303,6 @@
     /* Copy the table into the system process and set this as the base */
     RtlMoveMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize);
     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
@@ -770,7 +619,7 @@
     /* 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 @@
     /* 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();
 

Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.c?rev=24461&r1=24460&r2=24461&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/arcname.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c Mon Oct  9 02:50:26 2006
@@ -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 (ekohl at rz-online.de)
- */
-
-/* INCLUDES *****************************************************************/
+/*
+* 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 (alex.ionescu at reactos.org)
+*                  Eric Kohl (ekohl at rz-online.de)
+*/
+
+/* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
 #define NDEBUG
@@ -19,7 +18,7 @@
 UNICODE_STRING IoArcHalDeviceName, IoArcBootDeviceName;
 PCHAR IoLoaderArcBootDeviceName;
 
-/* FUNCTIONS ****************************************************************/
+/* FUNCTIONS *****************************************************************/
 
 BOOLEAN
 INIT_FUNCTION

Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?rev=24461&r1=24460&r2=24461&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Mon Oct  9 02:50:26 2006
@@ -29,6 +29,7 @@
 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 @@
 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 @@
     /* 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 */




More information about the Ros-diffs mailing list