[ros-diffs] [ion] 24347: - Add setupblk.h from TinyKRNL with all the definitions for NT's SETUPLDR structures (SETUP_LOADER_BLOCK and hardware configuration stuff). Update KiRosFrldrLpbToNtLpb to setup the Flags field of this block to "Text-Mode Setup Active" when we know that we're in ROS text mode. - Update ExpInitializeExecutive to check for a valid setup block and detect text-mode and network installation modes. Use ExpInTextModeSetup instead of SetupMode variable, to make detection compatible with NTLDR.

ion at svn.reactos.org ion at svn.reactos.org
Sun Oct 1 20:28:01 CEST 2006


Author: ion
Date: Sun Oct  1 22:27:59 2006
New Revision: 24347

URL: http://svn.reactos.org/svn/reactos?rev=24347&view=rev
Log:
- Add setupblk.h from TinyKRNL with all the definitions for NT's SETUPLDR structures (SETUP_LOADER_BLOCK and hardware configuration stuff). Update KiRosFrldrLpbToNtLpb to setup the Flags field of this block to "Text-Mode Setup Active" when we know that we're in ROS text mode.
- Update ExpInitializeExecutive to check for a valid setup block and detect text-mode and network installation modes. Use ExpInTextModeSetup instead of SetupMode variable, to make detection compatible with NTLDR.

Added:
    trunk/reactos/include/reactos/arc/setupblk.h
Modified:
    trunk/reactos/include/reactos/arc/arc.h
    trunk/reactos/ntoskrnl/ex/init.c
    trunk/reactos/ntoskrnl/include/ntoskrnl.h
    trunk/reactos/ntoskrnl/io/iomgr/driver.c
    trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c
    trunk/reactos/ntoskrnl/ke/freeldr.c

Modified: trunk/reactos/include/reactos/arc/arc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arc/arc.h?rev=24347&r1=24346&r2=24347&view=diff
==============================================================================
--- trunk/reactos/include/reactos/arc/arc.h (original)
+++ trunk/reactos/include/reactos/arc/arc.h Sun Oct  1 22:27:59 2006
@@ -23,20 +23,6 @@
     MemoryClass,
     MaximumClass
 } CONFIGURATION_CLASS;
-
-typedef enum
-{
-    HwFileDriver,
-    HwFilePort,
-    HwFileClass,
-    HwFileInf,
-    HwFileDll,
-    HwFileDetect,
-    HwFileHal,
-    HwFileCatalog,
-    HwFileMax,
-    HwFileDynUpdt = 31,
-} HwFileType;
 
 typedef enum _TYPE_OF_MEMORY
 {

Added: trunk/reactos/include/reactos/arc/setupblk.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arc/setupblk.h?rev=24347&view=auto
==============================================================================
--- trunk/reactos/include/reactos/arc/setupblk.h (added)
+++ trunk/reactos/include/reactos/arc/setupblk.h Sun Oct  1 22:27:59 2006
@@ -1,0 +1,152 @@
+#ifndef _SETUPBLK_
+#define _SETUPBLK_
+
+//
+// Type of file described in DETECTED_DEVICE_FILE
+//
+typedef enum
+{
+    HwFileDriver,
+    HwFilePort,
+    HwFileClass,
+    HwFileInf,
+    HwFileDll,
+    HwFileDetect,
+    HwFileHal,
+    HwFileCatalog,
+    HwFileMax,
+    HwFileDynUpdt = 31,
+} HwFileType;
+
+//
+// Hardware ID for the detected device
+//
+typedef struct _PNP_HARDWARE_ID
+{
+    struct _PNP_HARDWARE_ID *Next;
+    PCHAR Id;
+    PCHAR DriverName;
+    PCHAR ClassGuid;
+} PNP_HARDWARE_ID, *PPNP_HARDWARE_ID;
+
+//
+// Structures for detected device data (file/registry)
+//
+typedef struct _DETECTED_DEVICE_REGISTRY
+{
+    struct _DETECTED_DEVICE_REGISTRY *Next;
+    PCHAR KeyName;
+    PCHAR ValueName;
+    ULONG ValueType;
+    PVOID Buffer;
+    ULONG BufferSize;
+} DETECTED_DEVICE_REGISTRY, *PDETECTED_DEVICE_REGISTRY;
+
+typedef struct _DETECTED_DEVICE_FILE
+{
+    struct _DETECTED_DEVICE_FILE *Next;
+    PCHAR FileName;
+    HwFileType FileType;
+    PCHAR ConfigName;
+    PDETECTED_DEVICE_REGISTRY RegistryValueList;
+    PCHAR DiskDescription;
+    PCHAR DiskTagfile;
+    PCHAR Directory;
+    PCHAR ArcDeviceName;
+} DETECTED_DEVICE_FILE, *PDETECTED_DEVICE_FILE;
+
+//
+// Structure for any detected device
+//
+typedef struct _DETECTED_DEVICE
+{
+    struct _DETECTED_DEVICE *Next;
+    PCHAR IdString;
+    ULONG Ordinal;
+    PCHAR Description;
+    BOOLEAN ThirdPartyOptionSelected;
+    ULONG FileTypeBits;
+    PDETECTED_DEVICE_FILE Files;
+    PCHAR BasedllName;
+    BOOLEAN MigratedDriver;
+    PPNP_HARDWARE_ID HardwareIds;
+} DETECTED_DEVICE, *PDETECTED_DEVICE;
+
+typedef struct _DETECTED_OEM_SOURCE_DEVICE
+{
+    struct _DETECTED_OEM_SOURCE_DEVICE *Next;
+    PCHAR ArcDeviceName;
+    ULONG ImageBase;
+    ULONGLONG ImageSize;
+} DETECTED_OEM_SOURCE_DEVICE, *PDETECTED_OEM_SOURCE_DEVICE;
+
+//
+// Setup Loader Parameter Block
+//
+typedef struct _SETUP_LOADER_BLOCK_SCALARS
+{
+    ULONG SetupOperation;
+    union
+    {
+        struct
+        {
+            UCHAR SetupFromCdRom:1;
+            UCHAR LoadedScsi:1;
+            UCHAR LoadedFloppyDrivers:1;
+            UCHAR LoadedDiskDrivers:1;
+            UCHAR LoadedCdRomDrivers:1;
+            UCHAR LoadedFileSystems:1;
+        };
+        ULONG AsULong;
+    };
+} SETUP_LOADER_BLOCK_SCALARS, *PSETUP_LOADER_BLOCK_SCALARS;
+
+typedef struct _SETUP_LOADER_BLOCK
+{
+    PCHAR ArcSetupDeviceName;
+    DETECTED_DEVICE VideoDevice;
+    PDETECTED_DEVICE KeyboardDevices;
+    DETECTED_DEVICE ComputerDevice;
+    PDETECTED_DEVICE ScsiDevices;
+    PDETECTED_OEM_SOURCE_DEVICE OemSourceDevices;
+    SETUP_LOADER_BLOCK_SCALARS ScalarValues;
+    PCHAR IniFile;
+    ULONG IniFileLength;
+    PCHAR WinntSifFile;
+    ULONG WinntSifFileLength;
+    PCHAR MigrateInfFile;
+    ULONG MigrateInfFileLength;
+    PCHAR UnsupDriversInfFile;
+    ULONG UnsupDriversInfFileLength;
+    PVOID BootFontFile;
+    ULONG BootFontFileLength;
+    MONITOR_CONFIGURATION_DATA Monitor;
+    PCHAR MonitorId;
+    PDETECTED_DEVICE BootBusExtenders;
+    PDETECTED_DEVICE BusExtenders;
+    PDETECTED_DEVICE InputDevicesSupport;
+    PPNP_HARDWARE_ID HardwareIdDatabase;
+    WCHAR ComputerName[64];
+    ULONG IpAddress;
+    ULONG SubnetMask;
+    ULONG ServerIpAddress;
+    ULONG DefaultRouter;
+    ULONG DnsNameServer;
+    WCHAR NetbootCardHardwareId[64];
+    WCHAR NetbootCardDriverName[24];
+    WCHAR NetbootCardServiceName[24];
+    PCHAR NetbootCardRegistry;
+    ULONG NetbootCardRegistryLength;
+    PCHAR NetbootCardInfo;
+    ULONG NetbootCardInfoLength;
+    ULONG Flags;
+    PCHAR MachineDirectoryPath;
+    PCHAR NetBootSifPath;
+    PVOID NetBootSecret;
+    CHAR NetBootIMirrorFilePath[26];
+    PCHAR ASRPnPSifFile;
+    ULONG ASRPnPSifFileLength;
+    CHAR NetBootAdministratorPassword[64];
+} SETUP_LOADER_BLOCK, *PSETUP_LOADER_BLOCK;
+
+#endif

Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=24347&r1=24346&r2=24347&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Sun Oct  1 22:27:59 2006
@@ -41,7 +41,6 @@
 BOOLEAN NoGuiBoot = FALSE;
 static BOOLEAN BootLog = FALSE;
 static ULONG MaxMem = 0;
-BOOLEAN SetupMode = TRUE;
 static BOOLEAN ForceAcpiDisable = FALSE;
 
 BOOLEAN
@@ -51,6 +50,8 @@
 );
 
 ULONG ExpInitializationPhase;
+BOOLEAN ExpInTextModeSetup;
+BOOLEAN IoRemoteBootClient;
 
 /* FUNCTIONS ****************************************************************/
 
@@ -279,7 +280,6 @@
         } else if (!_stricmp(Name, "system") || !_stricmp(Name, "system.hiv")) {
 
             CachedModules[SystemRegistry] = &KeLoaderModules[i];
-            SetupMode = FALSE;
 
         } else if (!_stricmp(Name, "hardware") || !_stricmp(Name, "hardware.hiv")) {
 
@@ -361,7 +361,7 @@
 {
     CHAR str[50];
    
-    if (SetupMode)
+    if (ExpInTextModeSetup)
     {
         HalDisplayString(
         "\n\n\n     ReactOS " KERNEL_VERSION_STR " Setup \n");
@@ -534,6 +534,30 @@
         return;
     }
 
+    /* Assume no text-mode or remote boot */
+    ExpInTextModeSetup = FALSE;
+    IoRemoteBootClient = FALSE;
+
+    /* Check if we have a setup loader block */
+    if (LoaderBlock->SetupLdrBlock)
+    {
+        /* Check if this is text-mode setup */
+        if (LoaderBlock->SetupLdrBlock->Flags & 1) ExpInTextModeSetup = TRUE;
+
+        /* Check if this is network boot */
+        if (LoaderBlock->SetupLdrBlock->Flags & 2)
+        {
+            /* Set variable */
+            IoRemoteBootClient = TRUE;
+
+            /* Make sure we're actually booting off the network */
+            ASSERT(!_memicmp(LoaderBlock->ArcBootDeviceName, "net(0)", 6));
+        }
+    }
+
+    /* Set phase to 0 */
+    ExpInitializationPhase = 0;
+
     /* Initialize HAL */
     HalInitSystem (0, KeLoaderBlock);
 
@@ -658,7 +682,7 @@
     RtlpInitNls();
 
     /* Import and Load Registry Hives */
-    CmInitHives(SetupMode);
+    CmInitHives(ExpInTextModeSetup);
 
     /* Initialize VDM support */
     KeI386VdmInitialize();

Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/ntoskrnl.h?rev=24347&r1=24346&r2=24347&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h (original)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h Sun Oct  1 22:27:59 2006
@@ -44,6 +44,9 @@
 #define ExRaiseStatus RtlRaiseStatus
 #include <reactos/probe.h>
 
+/* SetupLDR Support */
+#include <arc/setupblk.h>
+
 /* PNP GUIDs */
 #include <umpnpmgr/sysguid.h>
 

Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?rev=24347&r1=24346&r2=24347&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Sun Oct  1 22:27:59 2006
@@ -29,7 +29,7 @@
 
 POBJECT_TYPE IoDriverObjectType = NULL;
 
-extern BOOLEAN SetupMode;
+extern BOOLEAN ExpInTextModeSetup;
 extern BOOLEAN NoGuiBoot;
 
 /* DECLARATIONS ***************************************************************/
@@ -311,7 +311,7 @@
                          BOOLEAN Unicode)
 {
     CHAR TextBuffer[256];
-    if (SetupMode || !NoGuiBoot) return;
+    if (ExpInTextModeSetup || !NoGuiBoot) return;
     if (Unicode) 
     {
         sprintf(TextBuffer, "Loading %S...\n", (PWCHAR)ServiceName);

Modified: trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c?rev=24347&r1=24346&r2=24347&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c Sun Oct  1 22:27:59 2006
@@ -41,7 +41,6 @@
 
 LIST_ENTRY GroupListHead = {NULL, NULL};
 LIST_ENTRY ServiceListHead  = {NULL, NULL};
-extern BOOLEAN SetupMode;
 extern BOOLEAN NoGuiBoot;
 
 VOID 

Modified: trunk/reactos/ntoskrnl/ke/freeldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/freeldr.c?rev=24347&r1=24346&r2=24347&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/freeldr.c (original)
+++ trunk/reactos/ntoskrnl/ke/freeldr.c Sun Oct  1 22:27:59 2006
@@ -47,6 +47,7 @@
 MEMORY_ALLOCATION_DESCRIPTOR BldrMemoryDescriptors[64];
 WCHAR BldrModuleStrings[64][260];
 NLS_DATA_BLOCK BldrNlsDataBlock;
+SETUP_LOADER_BLOCK BldrSetupBlock;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -78,8 +79,8 @@
     /* Set the NLS Data block */
     LoaderBlock->NlsData = &BldrNlsDataBlock;
 
-    /* Set an invalid pointer, but used as a flag (SetupBoot) */
-    LoaderBlock->SetupLdrBlock = (PVOID)1;
+    /* Assume this is from FreeLDR's SetupLdr */
+    LoaderBlock->SetupLdrBlock = &BldrSetupBlock;
 
     /* Setup the list heads */
     InitializeListHead(&LoaderBlock->LoadOrderListHead);
@@ -248,6 +249,13 @@
     LoaderBlock->Extension->Size = sizeof(LOADER_PARAMETER_EXTENSION);
     LoaderBlock->Extension->MajorVersion = 5;
     LoaderBlock->Extension->MinorVersion = 2;
+
+    /* Now setup the setup block if we have one */
+    if (LoaderBlock->SetupLdrBlock)
+    {
+        /* All we'll setup right now is the flag for text-mode setup */
+        LoaderBlock->SetupLdrBlock->Flags = 1;
+    }
 }
 
 VOID




More information about the Ros-diffs mailing list