- Merge 26782, 26783, 26785, 26786
authorAleksey Bragin <aleksey@reactos.org>
Sat, 11 Aug 2007 14:32:39 +0000 (14:32 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Sat, 11 Aug 2007 14:32:39 +0000 (14:32 +0000)
- Merge 26842, 26847, 26861, 26867
- Merge 26958

svn path=/branches/winldr/; revision=28287

32 files changed:
arch/i386/hwacpi.c
arch/i386/hwapm.c
arch/i386/pcdisk.c
cache/blocklist.c
cache/cache.c
debug.c
disk/disk.c
disk/partition.c
drivemap.c
freeldr.c
fs/ext2.c
fs/fat.c
fs/fs.c
fs/fsrec.c
fs/iso.c
fs/ntfs.c
include/debug.h
inifile/inifile.c
inifile/parse.c
linuxboot.c
mm/meminit.c
mm/mm.c
reactos/binhive.c
reactos/reactos.c
reactos/registry.c
reactos/setupldr.c
ui/ui.c
windows/conversion.c
windows/peloader.c
windows/winldr.c
windows/wlmemory.c
windows/wlregistry.c

index 5140326..36e7b77 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 BOOLEAN AcpiPresent = FALSE;
@@ -28,49 +26,49 @@ BOOLEAN AcpiPresent = FALSE;
 static BOOLEAN
 FindAcpiBios(VOID)
 {
-  PUCHAR Ptr;
+    PUCHAR Ptr;
 
-  /* Find the 'Root System Descriptor Table Pointer' */
-  Ptr = (PUCHAR)0xE0000;
-  while ((ULONG)Ptr < 0x100000)
+    /* Find the 'Root System Descriptor Table Pointer' */
+    Ptr = (PUCHAR)0xE0000;
+    while ((ULONG)Ptr < 0x100000)
     {
-      if (!memcmp(Ptr, "RSD PTR ", 8))
-       {
-         DbgPrint((DPRINT_HWDETECT, "ACPI supported\n"));
+        if (!memcmp(Ptr, "RSD PTR ", 8))
+        {
+            DbgPrint((DPRINT_HWDETECT, "ACPI supported\n"));
 
-         return TRUE;
-       }
+            return TRUE;
+        }
 
-      Ptr = (PUCHAR)((ULONG)Ptr + 0x10);
+        Ptr = (PUCHAR)((ULONG)Ptr + 0x10);
     }
 
-  DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
+    DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
 
-  return FALSE;
+    return FALSE;
 }
 
 
 VOID
 DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
 {
-  WCHAR Buffer[80];
-  FRLDRHKEY BiosKey;
-  LONG Error;
+    WCHAR Buffer[80];
+    FRLDRHKEY BiosKey;
+    LONG Error;
 
-  if (FindAcpiBios())
+    if (FindAcpiBios())
     {
-      AcpiPresent = TRUE;
-      /* Create new bus key */
-      swprintf(Buffer,
-             L"MultifunctionAdapter\\%u", *BusNumber);
-      Error = RegCreateKey(SystemKey,
-                          Buffer,
-                          &BiosKey);
-      if (Error != ERROR_SUCCESS)
-       {
-         DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
-         return;
-       }
+        AcpiPresent = TRUE;
+        /* Create new bus key */
+        swprintf(Buffer,
+                 L"MultifunctionAdapter\\%u", *BusNumber);
+        Error = RegCreateKey(SystemKey,
+                             Buffer,
+                             &BiosKey);
+        if (Error != ERROR_SUCCESS)
+        {
+            DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
+            return;
+        }
 
 #if 0
       /* Set 'Component Information' */
@@ -80,20 +78,20 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
                               0xFFFFFFFF);
 #endif
 
-      /* Increment bus number */
-      (*BusNumber)++;
-
-      /* Set 'Identifier' value */
-      Error = RegSetValue(BiosKey,
-                         L"Identifier",
-                         REG_SZ,
-                         (PCHAR)L"ACPI BIOS",
-                         10 * sizeof(WCHAR));
-      if (Error != ERROR_SUCCESS)
-       {
-         DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
-         return;
-       }
+        /* Increment bus number */
+        (*BusNumber)++;
+
+        /* Set 'Identifier' value */
+        Error = RegSetValue(BiosKey,
+                            L"Identifier",
+                            REG_SZ,
+                            (PCHAR)L"ACPI BIOS",
+                            10 * sizeof(WCHAR));
+        if (Error != ERROR_SUCCESS)
+        {
+            DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
+            return;
+        }
 
     }
 }
index e2a4637..cbc3fe3 100644 (file)
@@ -47,7 +47,7 @@ FindApmBios(VOID)
       return TRUE;
     }
 
-  printf("No APM BIOS found\n");
+  DbgPrint((DPRINT_HWDETECT, "No APM BIOS found\n"));
 
   return FALSE;
 }
index 9fbd3ec..568b897 100644 (file)
@@ -121,7 +121,7 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu
        }
 
        // If we get here then the read failed
-       DiskError("Disk Read Failed", RegsOut.b.ah);
+       DiskError("Disk Read Failed in LBA mode", RegsOut.b.ah);
 
        return FALSE;
 }
@@ -244,7 +244,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu
                // If we retried 3 times then fail
                if (RetryCount >= 3)
                {
-                       DiskError("Disk Read Failed", RegsOut.b.ah);
+                       DiskError("Disk Read Failed in CHS mode, after retrying 3 times", RegsOut.b.ah);
                        return FALSE;
                }
 
index 9478dba..a7af67b 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 // Returns a pointer to a CACHE_BLOCK structure
index eaf024f..c8b6003 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 ///////////////////////////////////////////////////////////////////////////////////////
diff --git a/debug.c b/debug.c
index aaa92a5..a691f79 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -356,4 +356,10 @@ VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
        }
 }
 
+#else
+
+VOID DebugPrint(ULONG Mask, char *format, ...)
+{
+}
+
 #endif // defined DBG
index 1380849..fa94dbc 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 #undef  UNIMPLEMENTED
index 80feb1e..bf3a2cb 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber,
index 7e82f13..8518159 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 #ifdef __i386__
index 3df6739..55dec88 100644 (file)
--- a/freeldr.c
+++ b/freeldr.c
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 VOID BootMain(LPSTR CmdLine)
index 78d929c..e82879b 100644 (file)
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 GEOMETRY                       Ext2DiskGeometry;                               // Ext2 file system disk geometry
index 2f2cb3b..14cf1d4 100644 (file)
--- a/fs/fat.c
+++ b/fs/fat.c
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 ULONG                  BytesPerSector;                 /* Number of bytes per sector */
diff --git a/fs/fs.c b/fs/fs.c
index b45698b..a665438 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 /////////////////////////////////////////////////////////////////////////////////////////////
index 32a7354..b341877 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 /////////////////////////////////////////////////////////////////////////////////////////////
index 2f475a7..3f344bd 100644 (file)
--- a/fs/iso.c
+++ b/fs/iso.c
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 #define SECTORSIZE 2048
index 3125a44..eb5de4d 100644 (file)
--- a/fs/ntfs.c
+++ b/fs/ntfs.c
@@ -24,8 +24,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 PNTFS_BOOTSECTOR NtfsBootSector;
index 723575e..a1b19be 100644 (file)
 #ifndef __DEBUG_H
 #define __DEBUG_H
 
-#ifdef DBG
+#define DPRINT_NONE            0x00000000  // No debug print
+#define DPRINT_WARNING         0x00000001  // OR this with DebugPrintMask to enable debugger messages and other misc stuff
+#define DPRINT_MEMORY          0x00000002  // OR this with DebugPrintMask to enable memory management messages
+#define DPRINT_FILESYSTEM      0x00000004  // OR this with DebugPrintMask to enable file system messages
+#define DPRINT_INIFILE         0x00000008  // OR this with DebugPrintMask to enable .ini file messages
+#define DPRINT_UI              0x00000010  // OR this with DebugPrintMask to enable user interface messages
+#define DPRINT_DISK            0x00000020  // OR this with DebugPrintMask to enable disk messages
+#define DPRINT_CACHE           0x00000040  // OR this with DebugPrintMask to enable cache messages
+#define DPRINT_REGISTRY                0x00000080  // OR this with DebugPrintMask to enable registry messages
+#define DPRINT_REACTOS         0x00000100  // OR this with DebugPrintMask to enable ReactOS messages
+#define DPRINT_LINUX           0x00000200  // OR this with DebugPrintMask to enable Linux messages
+#define DPRINT_HWDETECT                0x00000400  // OR this with DebugPrintMask to enable hardware detection messages
+#define DPRINT_WINDOWS         0x00000800  // OR this with DebugPrintMask to enable messages from Windows loader
+
+VOID   DebugPrint(ULONG Mask, char *format, ...);
 
-       #define DPRINT_NONE             0x00000000  // No debug print
-       #define DPRINT_WARNING          0x00000001  // OR this with DebugPrintMask to enable debugger messages and other misc stuff
-       #define DPRINT_MEMORY           0x00000002  // OR this with DebugPrintMask to enable memory management messages
-       #define DPRINT_FILESYSTEM       0x00000004  // OR this with DebugPrintMask to enable file system messages
-       #define DPRINT_INIFILE          0x00000008  // OR this with DebugPrintMask to enable .ini file messages
-       #define DPRINT_UI               0x00000010  // OR this with DebugPrintMask to enable user interface messages
-       #define DPRINT_DISK             0x00000020  // OR this with DebugPrintMask to enable disk messages
-       #define DPRINT_CACHE            0x00000040  // OR this with DebugPrintMask to enable cache messages
-       #define DPRINT_REGISTRY         0x00000080  // OR this with DebugPrintMask to enable registry messages
-       #define DPRINT_REACTOS          0x00000100  // OR this with DebugPrintMask to enable ReactOS messages
-       #define DPRINT_LINUX            0x00000200  // OR this with DebugPrintMask to enable Linux messages
-       #define DPRINT_HWDETECT         0x00000400  // OR this with DebugPrintMask to enable hardware detection messages
-       #define DPRINT_WINDOWS          0x00000800  // OR this with DebugPrintMask to enable messages from Windows loader
+#ifdef DBG
 
        VOID    DebugInit(VOID);
-       VOID    DebugPrint(ULONG Mask, char *format, ...);
        VOID    DebugPrint1(char *format, ...);
        VOID    DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length);
 
        #define DbgPrint(_x_)                                   DebugPrint _x_ ;
-       #define DPRINT1                                         DebugPrint1
+       #define DPRINT1                                                 DebugPrint1
        #define BugCheck(_x_)                                   { DebugPrint(DPRINT_WARNING, "Fatal Error: %s:%d(%s)\n", __FILE__, __LINE__, __FUNCTION__); DebugPrint _x_ ; for (;;); }
        #define DbgDumpBuffer(_x_, _y_, _z_)    DebugDumpBuffer(_x_, _y_, _z_)
 
@@ -77,8 +78,8 @@ void  MEMORY_WRITE_BREAKPOINT4(unsigned long addr);
 #else
 
        #define DebugInit()
-       #define DbgPrint(_x_)
-       #define DPRINT1(_x_)
+    #define DbgPrint(_x_) { if (0) DebugPrint _x_; }
+       #define DPRINT1(_x_) { if (0) printf _x_; }
        #define BugCheck(_x_)
        #define DbgDumpBuffer(_x_, _y_, _z_)
 
index f4c9869..71ad206 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 BOOLEAN IniOpenSection(PCSTR SectionName, ULONG* SectionId)
index b18fcf7..1427957 100644 (file)
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 PINI_SECTION           IniFileSectionListHead = NULL;
index eeec566..df2bb8f 100644 (file)
@@ -19,8 +19,6 @@
 
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 #ifdef __i386__
index ffafd8c..d47ca29 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 #ifdef DBG
diff --git a/mm/mm.c b/mm/mm.c
index 624fa8f..ff95805 100644 (file)
--- a/mm/mm.c
+++ b/mm/mm.c
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
-#ifdef DBG
 ULONG                  AllocationCount = 0;
 
+#ifdef DBG
 VOID           VerifyHeap(VOID);
 VOID           DumpMemoryAllocMap(VOID);
 VOID           IncrementAllocationCount(VOID);
index 72911ba..470a36b 100644 (file)
@@ -21,8 +21,6 @@
 
 #include <freeldr.h>
 #include <cmlib.h>
-
-#define NDEBUG
 #include <debug.h>
 
 /* FUNCTIONS ****************************************************************/
index 2677713..9e1915f 100644 (file)
@@ -20,8 +20,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
index 56fc577..89c4404 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 static FRLDRHKEY RootKey;
index 3061878..180ff1a 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <freeldr.h>
+#include <debug.h>
 
 ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
 char                                   reactos_kernel_cmdline[255];    // Command line passed to kernel
diff --git a/ui/ui.c b/ui/ui.c
index 3564f46..dc22246 100644 (file)
--- a/ui/ui.c
+++ b/ui/ui.c
@@ -18,8 +18,6 @@
  */
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 
index ad1b621..3cc4ef7 100644 (file)
@@ -11,8 +11,6 @@
 #include <freeldr.h>
 
 //#include <ndk/ldrtypes.h>
-
-#define NDEBUG
 #include <debug.h>
 
 /* FUNCTIONS **************************************************************/
index 537757a..93bf88b 100644 (file)
@@ -15,8 +15,6 @@
 
 /* INCLUDES ***************************************************************/
 #include <freeldr.h>
-
-//#define NDEBUG
 #include <debug.h>
 
 
index 461e59a..0649d6e 100644 (file)
@@ -22,8 +22,6 @@
 #include <freeldr.h>
 
 #include <ndk/ldrtypes.h>
-
-//#define NDEBUG
 #include <debug.h>
 
 //FIXME: Do a better way to retrieve Arc disk information
index 511c147..9fa72ae 100644 (file)
@@ -11,8 +11,6 @@
 #include <freeldr.h>
 
 #include <ndk/asm.h>
-
-#define NDEBUG
 #include <debug.h>
 
 extern ULONG TotalNLSSize;
index 3640a6a..95690b8 100644 (file)
@@ -9,8 +9,6 @@
 /* INCLUDES ***************************************************************/
 
 #include <freeldr.h>
-
-#define NDEBUG
 #include <debug.h>
 
 // The only global var here, used to mark mem pages as NLS in WinLdrTurnOnPaging()