diff --git a/arch/i386/hwacpi.c b/arch/i386/hwacpi.c index 51403262bdf..36e7b770a66 100644 --- a/arch/i386/hwacpi.c +++ b/arch/i386/hwacpi.c @@ -19,8 +19,6 @@ */ #include - -#define NDEBUG #include 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)++; + /* 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; - } + /* 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; + } } } diff --git a/arch/i386/hwapm.c b/arch/i386/hwapm.c index e2a46370fdf..cbc3fe39be6 100644 --- a/arch/i386/hwapm.c +++ b/arch/i386/hwapm.c @@ -47,7 +47,7 @@ FindApmBios(VOID) return TRUE; } - printf("No APM BIOS found\n"); + DbgPrint((DPRINT_HWDETECT, "No APM BIOS found\n")); return FALSE; } diff --git a/arch/i386/pcdisk.c b/arch/i386/pcdisk.c index 9fbd3ec4814..568b897cf5f 100644 --- a/arch/i386/pcdisk.c +++ b/arch/i386/pcdisk.c @@ -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; } diff --git a/cache/blocklist.c b/cache/blocklist.c index 9478dba7803..a7af67bf7ab 100644 --- a/cache/blocklist.c +++ b/cache/blocklist.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include // Returns a pointer to a CACHE_BLOCK structure diff --git a/cache/cache.c b/cache/cache.c index eaf024fbfb4..c8b600342ea 100644 --- a/cache/cache.c +++ b/cache/cache.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include /////////////////////////////////////////////////////////////////////////////////////// diff --git a/debug.c b/debug.c index aaa92a55994..a691f795941 100644 --- 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 diff --git a/disk/disk.c b/disk/disk.c index 1380849c2fd..fa94dbc8f13 100644 --- a/disk/disk.c +++ b/disk/disk.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include #undef UNIMPLEMENTED diff --git a/disk/partition.c b/disk/partition.c index 80feb1ea668..bf3a2cbfc48 100644 --- a/disk/partition.c +++ b/disk/partition.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, diff --git a/drivemap.c b/drivemap.c index 7e82f13eea5..85181591695 100644 --- a/drivemap.c +++ b/drivemap.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include #ifdef __i386__ diff --git a/freeldr.c b/freeldr.c index 3df673960ab..55dec88c275 100644 --- a/freeldr.c +++ b/freeldr.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include VOID BootMain(LPSTR CmdLine) diff --git a/fs/ext2.c b/fs/ext2.c index 78d929cbe40..e82879be0d4 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include GEOMETRY Ext2DiskGeometry; // Ext2 file system disk geometry diff --git a/fs/fat.c b/fs/fat.c index 2f2cb3b59eb..14cf1d4ab98 100644 --- a/fs/fat.c +++ b/fs/fat.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include ULONG BytesPerSector; /* Number of bytes per sector */ diff --git a/fs/fs.c b/fs/fs.c index b45698beb46..a6654380043 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include ///////////////////////////////////////////////////////////////////////////////////////////// diff --git a/fs/fsrec.c b/fs/fsrec.c index 32a73549a4b..b34187780f8 100644 --- a/fs/fsrec.c +++ b/fs/fsrec.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include ///////////////////////////////////////////////////////////////////////////////////////////// diff --git a/fs/iso.c b/fs/iso.c index 2f475a7464c..3f344bd5614 100644 --- a/fs/iso.c +++ b/fs/iso.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include #define SECTORSIZE 2048 diff --git a/fs/ntfs.c b/fs/ntfs.c index 3125a44a476..eb5de4d0749 100644 --- a/fs/ntfs.c +++ b/fs/ntfs.c @@ -24,8 +24,6 @@ */ #include - -#define NDEBUG #include PNTFS_BOOTSECTOR NtfsBootSector; diff --git a/include/debug.h b/include/debug.h index 723575eedd2..a1b19beff2e 100644 --- a/include/debug.h +++ b/include/debug.h @@ -21,29 +21,30 @@ #ifndef __DEBUG_H #define __DEBUG_H +#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, ...); + #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 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_) diff --git a/inifile/inifile.c b/inifile/inifile.c index f4c9869af34..71ad20680fb 100644 --- a/inifile/inifile.c +++ b/inifile/inifile.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include BOOLEAN IniOpenSection(PCSTR SectionName, ULONG* SectionId) diff --git a/inifile/parse.c b/inifile/parse.c index b18fcf75b02..1427957f29a 100644 --- a/inifile/parse.c +++ b/inifile/parse.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include PINI_SECTION IniFileSectionListHead = NULL; diff --git a/linuxboot.c b/linuxboot.c index eeec566ef03..df2bb8fc7d6 100644 --- a/linuxboot.c +++ b/linuxboot.c @@ -19,8 +19,6 @@ #include - -#define NDEBUG #include #ifdef __i386__ diff --git a/mm/meminit.c b/mm/meminit.c index ffafd8c409a..d47ca29f4bb 100644 --- a/mm/meminit.c +++ b/mm/meminit.c @@ -19,8 +19,6 @@ */ #include - -#define NDEBUG #include #ifdef DBG diff --git a/mm/mm.c b/mm/mm.c index 624fa8f5cae..ff95805fa55 100644 --- a/mm/mm.c +++ b/mm/mm.c @@ -19,13 +19,11 @@ */ #include - -#define NDEBUG #include -#ifdef DBG ULONG AllocationCount = 0; +#ifdef DBG VOID VerifyHeap(VOID); VOID DumpMemoryAllocMap(VOID); VOID IncrementAllocationCount(VOID); diff --git a/reactos/binhive.c b/reactos/binhive.c index 72911baa935..470a36b34e3 100644 --- a/reactos/binhive.c +++ b/reactos/binhive.c @@ -21,8 +21,6 @@ #include #include - -#define NDEBUG #include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/reactos.c b/reactos/reactos.c index 26777136c55..9e1915f413d 100644 --- a/reactos/reactos.c +++ b/reactos/reactos.c @@ -20,8 +20,6 @@ */ #include - -#define NDEBUG #include ROS_LOADER_PARAMETER_BLOCK LoaderBlock; diff --git a/reactos/registry.c b/reactos/registry.c index 56fc57787db..89c440428ee 100644 --- a/reactos/registry.c +++ b/reactos/registry.c @@ -19,8 +19,6 @@ */ #include - -#define NDEBUG #include static FRLDRHKEY RootKey; diff --git a/reactos/setupldr.c b/reactos/setupldr.c index 30618789ada..180ff1a4d6e 100644 --- a/reactos/setupldr.c +++ b/reactos/setupldr.c @@ -19,6 +19,7 @@ */ #include +#include 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 3564f463b80..dc222461c41 100644 --- a/ui/ui.c +++ b/ui/ui.c @@ -18,8 +18,6 @@ */ #include - -#define NDEBUG #include diff --git a/windows/conversion.c b/windows/conversion.c index ad1b621ae61..3cc4ef7326c 100644 --- a/windows/conversion.c +++ b/windows/conversion.c @@ -11,8 +11,6 @@ #include //#include - -#define NDEBUG #include /* FUNCTIONS **************************************************************/ diff --git a/windows/peloader.c b/windows/peloader.c index 537757a87cc..93bf88be5d7 100644 --- a/windows/peloader.c +++ b/windows/peloader.c @@ -15,8 +15,6 @@ /* INCLUDES ***************************************************************/ #include - -//#define NDEBUG #include diff --git a/windows/winldr.c b/windows/winldr.c index 461e59a1096..0649d6e793d 100644 --- a/windows/winldr.c +++ b/windows/winldr.c @@ -22,8 +22,6 @@ #include #include - -//#define NDEBUG #include //FIXME: Do a better way to retrieve Arc disk information diff --git a/windows/wlmemory.c b/windows/wlmemory.c index 511c14754d7..9fa72ae562c 100644 --- a/windows/wlmemory.c +++ b/windows/wlmemory.c @@ -11,8 +11,6 @@ #include #include - -#define NDEBUG #include extern ULONG TotalNLSSize; diff --git a/windows/wlregistry.c b/windows/wlregistry.c index 3640a6a8b48..95690b8eb22 100644 --- a/windows/wlregistry.c +++ b/windows/wlregistry.c @@ -9,8 +9,6 @@ /* INCLUDES ***************************************************************/ #include - -#define NDEBUG #include // The only global var here, used to mark mem pages as NLS in WinLdrTurnOnPaging()