34725, 34726, 34727, 34728, 34733, 34735, 34747, 34748, 34888, 34937, 34968, 35021, 35351, 35360, 35445, 35493, 35495, 35505, 35547, 35696, 35704, 36343, 36355, 36865, 37306, 37896, 38332, 38942, 38950, 38951, 38959, 39073, 39278
svn path=/trunk/; revision=39638
<define name="_M_IX86" />
<define name="_X86_" />
<define name="__i386__" />
++++ <define name="TARGET_i386" host="true" />
++++
++++ <define name="USE_COMPILER_EXCEPTIONS" />
<property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
+++++ <property name="PLATFORM" value="PC"/>
<if property="OPTIMIZE" value="1">
<compilerflag>-Os</compilerflag>
--- /dev/null
--- /dev/null
--- /dev/null
- -//.org 0x8000
++ + .intel_syntax noprefix
++ + .text
++ + .code16
++ +
- -#define STACK16ADDR 0x7000 /* The 16-bit stack top will be at 0000:7000 */
- -#define STACK64ADDR 0x74000 /* The 64-bit stack top will be at 0x74000 */
+++++#define ASM
+++++#include <arch.h>
++ +
- - * We defines one 2MB page at the start of memory, so we can access the first
- - * 2MBs as if paging was disabled
+++++//.org 0x8000
++ +
++ + .global RealEntryPoint
++ + RealEntryPoint:
++ +
++ + cli
++ +
++ + /* Setup real mode segment registers */
++ + xor ax, ax
++ + mov ds, ax
++ + mov es, ax
++ + mov fs, ax
++ + mov gs, ax
++ + mov ss, ax
++ +
++ + /* Setup a real mode stack */
++ + mov sp, stack16
++ +
++ + /* Zero BootDrive and BootPartition */
++ + xor eax, eax
++ + mov _BootDrive, eax
++ + mov _BootPartition, eax
++ +
++ + /* Store the boot drive */
++ + mov _BootDrive, dl
++ +
++ + /* Store the boot partition */
++ + mov _BootPartition, dh
++ +
++ + /* Load the GDT */
++ + lgdt gdtptr
++ + /* Load the IDT */
++ + // lidt idtptr
++ +
++ + call x86_16_EnableA20
++ +
++ + call x86_16_BuildPageTables
++ +
++ + /* Switch to long mode */
++ + call x86_16_SwitchToLong
++ +
++ + .code64
++ +
++ + /* GO! */
++ + xor rcx, rcx
++ + call _BootMain
++ +
++ + /* Return into real mode */
++ + call x86_64_SwitchToReal
++ + .code16
++ +
++ + // int 0x19
++ +
++ + /* We should never get here */
++ + stop:
++ + jmp stop
++ + nop
++ + nop
++ +
++ +
++ + /** 16 Bit helper functions ***************************************************/
++ + .code16
++ +
++ + x86_16_Empty8042:
++ + .word 0x00eb,0x00eb // jmp $+2, jmp $+2
++ + in al, 0x64
++ + cmp al, 0xff // legacy-free machine without keyboard
++ + jz empty_8042_ret // controllers on Intel Macs read back 0xFF
++ + test al, 0x02
++ + jnz x86_16_Empty8042
++ + empty_8042_ret:
++ + ret
++ +
++ + x86_16_EnableA20:
++ + pusha
++ + call x86_16_Empty8042
++ + mov al, 0xD1 // command write
++ + out 0x64, al
++ + call x86_16_Empty8042
++ + mov al, 0xDF // A20 on
++ + out 0x60, al
++ + call x86_16_Empty8042
++ + popa
++ + ret
++ +
++ +
++ + /*
- -
- -#define PML4_PAGENUM 60 // Put it high enough so it doesn't interfere with freeldr
- -
- -#define PAGESIZE 4096
- -#define PDP_PAGENUM (PML4_PAGENUM + 1)
- -#define PD_PAGENUM (PDP_PAGENUM + 1)
- -#define PML4_ADDRESS (PML4_PAGENUM * PAGESIZE)
- -#define PDP_ADDRESS (PDP_PAGENUM * PAGESIZE)
- -#define PML4_SEG (PML4_ADDRESS / 16)
- -
+++++ * We define 512 2MB pages at the start of memory, so we can access the first
+++++ * 1 GB as if paging was disabled
++ + */
- - mov ax, PML4_SEG
++ + x86_16_BuildPageTables:
++ + pusha
++ + push es
++ +
- - mov ax, ((PDP_PAGENUM << 12) & 0xffff) | 0x00f
- - stosw
- - mov ax, (PDP_PAGENUM >> 4)
- - stosw
- - xor ax,ax
- - mov cx, 0x07fe
- - rep stosw
+++++ /* Get segment of pml4 */
+++++ mov eax, offset _pml4_startup
+++++ shr eax, 4
++ + mov es, ax
++ + cld
++ + xor di, di
++ +
++ + /* One entry in the PML4 pointing to PDP */
- - mov ax, ((PD_PAGENUM << 12) & 0xffff) | 0x00f
- - stosw
- - mov ax, (PD_PAGENUM >> 4)
- - stosw
- - xor ax,ax
- - mov cx, 0x07fe
- - rep stosw
- -
- - /* One entry in the PD defining a 2MB page */
- - mov ax, 0x018f
- - stosw
- - xor ax,ax
- - mov cx,0x07ff
- - rep stosw
+++++ mov eax, offset _pdp_startup
+++++ or eax, 0x00f
+++++ stosd
+++++ /* clear rest */
+++++ xor eax, eax
+++++ mov cx, 0x03ff
+++++ rep stosd
++ +
++ + /* One entry in the PDP pointing to PD */
- -#define LMODE_CS 0x08
- -#define LMODE_DS 0x10
- -#define RMODE_CS 0x18 /* RMode code selector, base 0 limit 64k */
- -#define RMODE_DS 0x20 /* RMode data selector, base 0 limit 64k */
- -
+++++ mov eax, offset _pd_startup
+++++ or eax, 0x00f
+++++ stosd
+++++ /* clear rest */
+++++ xor eax, eax
+++++ mov ecx, 0x03ff
+++++ rep stosd
+++++
+++++ /* 512 entries in the PD defining a 2MB page each */
+++++ mov ecx, 512
+++++ mov eax, 0x008f
+++++
+++++Bpt2:
+++++ mov es: [di], eax
+++++ mov dword ptr es: [di + 4], 0
+++++ add eax, 512 << 12 // add 512 4k pages
+++++ add di, 8
+++++
+++++ /* Loop it */
+++++ dec cx
+++++ jnz Bpt2
++ +
++ + /* Return */
++ + pop es
++ + popa
++ + ret
++ +
++ +
- - mov edx, PML4_ADDRESS // Point cr3 at PML4
++ + //.global x86_16_SwitchToLong
++ + x86_16_SwitchToLong:
++ + cli
++ +
++ + xor ax,ax
++ + mov ds,ax
++ + mov es,ax
++ + mov fs,ax
++ + mov gs,ax
++ + mov ss,ax
++ +
++ + /* Get the return address off the stack */
++ + pop word ptr code64ret
++ +
++ + /* Save 16-bit stack pointer */
++ + mov stack16, sp
++ +
++ + mov eax, 0x00a0 // Set PAE and PGE: 10100000b
++ + mov cr4, eax
++ +
- - .quad 0x0000000000000000
- - .quad 0x0020980000000000
- - .quad 0x0000900000000000
+++++ mov edx, offset _pml4_startup // Point cr3 at PML4
++ + mov cr3, edx
++ +
++ + mov ecx, 0xC0000080 // Specify EFER MSR
++ +
++ + rdmsr // Enable long mode
++ + or eax, 0x00000100
++ + wrmsr
++ +
++ + mov ebx, cr0 // Activate long mode
++ + or ebx, 0x80000001 // by enabling paging and protection simultaneously
++ + mov cr0, ebx // skipping protected mode entirely
++ +
++ + jmp LMODE_CS:offset LongCat //Load CS with 64 bit segment and flush the instruction cache
++ +
++ + .code64
++ + LongCat:
++ + /* Set up 64 bit stack */
++ + mov rsp, stack64
++ +
++ + /* Put the return address back onto the stack */
++ + push qword ptr code64ret
++ +
++ + /* Now return in long mode! */
++ + ret
++ +
++ +
++ + /** 64 But functions **********************************************************/
++ + .code64
++ +
++ + .global x86_64_SwitchToReal
++ + x86_64_SwitchToReal:
++ +
++ + /* Get the return address off the stack */
++ + pop qword ptr code64ret
++ +
++ + /* Save 64-bit stack pointer */
++ + mov stack64, rsp
++ +
++ + /* Step 1 - deactivate long mode, by disabling paging */
++ + mov rax, cr0
++ + and rax, 0x000000007fffffff //~0x80000000
++ + mov cr0, rax
++ +
++ + /* Step 2 - disable long mode in EFER MSR */
++ + mov rcx, 0xC0000080 // Specify EFER MSR
++ + rdmsr
++ + and eax, ~0x00000100 // Disable EFER.LME
++ + wrmsr
++ +
++ + .code32
++ + /* jmp to 16-bit segment to set the limit correctly */
++ + jmp RMODE_CS: offset SwitchToReal2
++ +
++ + SwitchToReal2:
++ + .code16
++ +
++ + /* Step 3 - Disable Protected Mode */
++ + mov eax, cr0
++ + and eax, ~0x00000001
++ + mov cr0, eax
++ +
++ + /* Clear prefetch queue & correct CS */
++ + jmp 0:offset BeReal
++ +
++ + BeReal:
++ + /* Restore segment registers */
++ + mov ax, 0
++ + mov ds, ax
++ + mov es, ax
++ + mov fs, ax
++ + mov gs, ax
++ + mov ss, ax
++ +
++ + /* Rstore 16 bit stack */
++ + mov sp, stack16
++ +
++ + // lidt rmode_idtptr /* Load IDTR with real mode value */
++ +
++ + // sti /* These are ok now */
++ +
++ + /* Put the return address back onto the stack */
++ + push word ptr code64ret
++ +
++ + /* Now return in real mode! */
++ + ret
++ +
++ +
+++++
++ + /** Some data *****************************************************************/
++ +
++ + .code64
++ +
++ + stack16:
++ + .quad STACK16ADDR
++ +
++ + stack64:
++ + .quad STACK64ADDR
++ +
++ + code64ret:
++ + .quad 0
++ +
++ + gdt:
- - .word 0x27 /* Limit */
+++++ .quad 0x0000000000000000 /* 00: NULL descriptor */
+++++ .quad 0x0000000000000000 /* 08: */
+++++ .quad 0x0020980000000000 /* 10: long mode cs */
+++++ .quad 0x0000900000000000 /* 18: long mode ds */
++ + .word 0xFFFF, 0x0000, 0x9E00, 0x0000 /* 16-bit real mode CS */
++ + .word 0xFFFF, 0x0000, 0x9200, 0x0000 /* 16-bit real mode DS */
++ +
++ + /* GDT table pointer */
++ + gdtptr:
+++++ .word 0x2f /* Limit */
++ + .long gdt /* Base Address */
++ +
++ +
++ + .global _BootDrive
++ + _BootDrive:
++ + .long 0
++ +
++ + .global _BootPartition
++ + _BootPartition:
++ + .long 0
++ +
++ +
++ + ///////////////////////////////////////////////////////////////////////////////
++ +
++ + /* Need to include them here, because of linking issues between 64 / 16 bit */
++ + //#include "debug16.S"
++ + #include "int386.S"
++ + #include "boot.S"
++ + #include "i386pnp.S"
++ +
--- /dev/null
--- /dev/null
--- /dev/null
--- /dev/null
- * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
- * Copyright (C) 2005 Alex Ionescu <alex@relsoft.net>
++++ /*
++++ * FreeLoader
-#undef DbgPrint
+++++ * Copyright (C) 2008 - 2009 Timo Kreuzer (timo.kreuzer@reactor.org)
++++ *
++++ * This program is free software; you can redistribute it and/or modify
++++ * it under the terms of the GNU General Public License as published by
++++ * the Free Software Foundation; either version 2 of the License, or
++++ * (at your option) any later version.
++++ *
++++ * This program is distributed in the hope that it will be useful,
++++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++++ * GNU General Public License for more details.
++++ *
++++ * You should have received a copy of the GNU General Public License
++++ * along with this program; if not, write to the Free Software
++++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++++ */
++++ #define _NTSYSTEM_
++++ #include <freeldr.h>
++++
++++ #define NDEBUG
++++ #include <debug.h>
-extern PAGE_DIRECTORY_X86 startup_pagedirectory;
-extern PAGE_DIRECTORY_X86 lowmem_pagetable;
-extern PAGE_DIRECTORY_X86 kernel_pagetable;
-extern PAGE_DIRECTORY_X86 hyperspace_pagetable;
-extern PAGE_DIRECTORY_X86 apic_pagetable;
-extern PAGE_DIRECTORY_X86 kpcr_pagetable;
-extern PAGE_DIRECTORY_X86 kuser_pagetable;
++++
++++ /* Page Directory and Tables for non-PAE Systems */
- ASSERT(FALSE);
-#if 0
- /* Disable Interrupts */
- _disable();
+++++extern ULONG_PTR NextModuleBase;
++++ extern ULONG_PTR KernelBase;
+++++ULONG_PTR GdtBase, IdtBase, TssBase;
++++ extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint;
+++++
+++++PPAGE_DIRECTORY_AMD64 pPML4;
+++++PVOID pIdt, pGdt;
+++++
++++ /* FUNCTIONS *****************************************************************/
++++
+++++void
+++++EnableA20()
+++++{
+++++ /* Already done */
+++++}
+++++
+++++void
+++++DumpLoaderBlock()
+++++{
+++++ DbgPrint("LoaderBlock @ %p.\n", &LoaderBlock);
+++++ DbgPrint("Flags = 0x%x.\n", LoaderBlock.Flags);
+++++ DbgPrint("MemLower = 0x%p.\n", (PVOID)LoaderBlock.MemLower);
+++++ DbgPrint("MemHigher = 0x%p.\n", (PVOID)LoaderBlock.MemHigher);
+++++ DbgPrint("BootDevice = 0x%x.\n", LoaderBlock.BootDevice);
+++++ DbgPrint("CommandLine = %s.\n", LoaderBlock.CommandLine);
+++++ DbgPrint("ModsCount = 0x%x.\n", LoaderBlock.ModsCount);
+++++ DbgPrint("ModsAddr = 0x%p.\n", LoaderBlock.ModsAddr);
+++++ DbgPrint("Syms = 0x%s.\n", LoaderBlock.Syms);
+++++ DbgPrint("MmapLength = 0x%x.\n", LoaderBlock.MmapLength);
+++++ DbgPrint("MmapAddr = 0x%p.\n", (PVOID)LoaderBlock.MmapAddr);
+++++ DbgPrint("RdLength = 0x%x.\n", LoaderBlock.RdLength);
+++++ DbgPrint("RdAddr = 0x%p.\n", (PVOID)LoaderBlock.RdAddr);
+++++ DbgPrint("DrivesCount = 0x%x.\n", LoaderBlock.DrivesCount);
+++++ DbgPrint("DrivesAddr = 0x%p.\n", (PVOID)LoaderBlock.DrivesAddr);
+++++ DbgPrint("ConfigTable = 0x%x.\n", LoaderBlock.ConfigTable);
+++++ DbgPrint("BootLoaderName = 0x%x.\n", LoaderBlock.BootLoaderName);
+++++ DbgPrint("PageDirectoryStart = 0x%p.\n", (PVOID)LoaderBlock.PageDirectoryStart);
+++++ DbgPrint("PageDirectoryEnd = 0x%p.\n", (PVOID)LoaderBlock.PageDirectoryEnd);
+++++ DbgPrint("KernelBase = 0x%p.\n", (PVOID)LoaderBlock.KernelBase);
+++++ DbgPrint("ArchExtra = 0x%p.\n", (PVOID)LoaderBlock.ArchExtra);
+++++
+++++}
+++++
++++ /*++
++++ * FrLdrStartup
++++ * INTERNAL
++++ *
++++ * Prepares the system for loading the Kernel.
++++ *
++++ * Params:
++++ * Magic - Multiboot Magic
++++ *
++++ * Returns:
++++ * None.
++++ *
++++ * Remarks:
++++ * None.
++++ *
++++ *--*/
++++ VOID
++++ NTAPI
++++ FrLdrStartup(ULONG Magic)
++++ {
- /* Re-initalize EFLAGS */
- Ke386EraseFlags();
+++++ /* Disable Interrupts */
+++++ _disable();
++++
- /* Initialize the page directory */
- FrLdrSetupPageDirectory();
+++++ /* Re-initalize EFLAGS */
+++++ KeAmd64EraseFlags();
++++
- /* Initialize Paging, Write-Protection and Load NTOSKRNL */
- FrLdrSetupPae(Magic);
-#endif
+++++ /* Initialize the page directory */
+++++ FrLdrSetupPageDirectory();
+++++
+++++ /* Set the new PML4 */
+++++ __writecr3((ULONGLONG)pPML4);
+++++
+++++ FrLdrSetupGdtIdt();
+++++
+++++ LoaderBlock.FrLdrDbgPrint = DbgPrint;
+++++
+++++// DumpLoaderBlock();
+++++
+++++ DbgPrint("Jumping to kernel @ %p.\n", KernelEntryPoint);
+++++
+++++ /* Jump to Kernel */
+++++ (*KernelEntryPoint)(Magic, &LoaderBlock);
++++
-/*++
- * FrLdrSetupPae
- * INTERNAL
- *
- * Configures PAE on a MP System, and sets the PDBR if it's supported, or if
- * the system is UP.
- *
- * Params:
- * Magic - Multiboot Magic
- *
- * Returns:
- * None.
- *
- * Remarks:
- * None.
- *
- *--*/
-VOID
-FASTCALL
-FrLdrSetupPae(ULONG Magic)
++++ }
++++
-#if 0
- ULONG_PTR PageDirectoryBaseAddress = (ULONG_PTR)&startup_pagedirectory;
+++++PPAGE_DIRECTORY_AMD64
+++++FrLdrGetOrCreatePageDir(PPAGE_DIRECTORY_AMD64 pDir, ULONG Index)
+++++{
+++++ PPAGE_DIRECTORY_AMD64 pSubDir;
+++++
+++++ if (!pDir)
+++++ return NULL;
+++++
+++++ if (!pDir->Pde[Index].Valid)
+++++ {
+++++ pSubDir = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
+++++ if (!pSubDir)
+++++ return NULL;
+++++ RtlZeroMemory(pSubDir, PAGE_SIZE);
+++++ pDir->Pde[Index].PageFrameNumber = PtrToPfn(pSubDir);
+++++ pDir->Pde[Index].Valid = 1;
+++++ pDir->Pde[Index].Write = 1;
+++++ }
+++++ else
+++++ {
+++++ pSubDir = (PPAGE_DIRECTORY_AMD64)((ULONGLONG)(pDir->Pde[Index].PageFrameNumber) * PAGE_SIZE);
+++++ }
+++++ return pSubDir;
+++++}
+++++
+++++BOOLEAN
+++++FrLdrMapSinglePage(ULONGLONG VirtualAddress, ULONGLONG PhysicalAddress)
++++ {
- /* Set the PDBR */
- __writecr3(PageDirectoryBaseAddress);
+++++ PPAGE_DIRECTORY_AMD64 pDir3, pDir2, pDir1;
+++++ ULONG Index;
++++
- /* Enable Paging and Write Protect*/
- __writecr0(__readcr0() | X86_CR0_PG | X86_CR0_WP);
+++++ pDir3 = FrLdrGetOrCreatePageDir(pPML4, VAtoPXI(VirtualAddress));
+++++ pDir2 = FrLdrGetOrCreatePageDir(pDir3, VAtoPPI(VirtualAddress));
+++++ pDir1 = FrLdrGetOrCreatePageDir(pDir2, VAtoPDI(VirtualAddress));
++++
- /* Jump to Kernel */
- (*KernelEntryPoint)(Magic, &LoaderBlock);
-#endif
+++++ if (!pDir1)
+++++ return FALSE;
++++
- *
- * Remarks:
- * We are setting PDEs, but using the equvivalent (for our purpose) PTE structure.
- * As such, please note that PageFrameNumber == PageEntryNumber.
- *
+++++ Index = VAtoPTI(VirtualAddress);
+++++ if (pDir1->Pde[Index].Valid)
+++++ {
+++++ return FALSE;
+++++ }
+++++
+++++ pDir1->Pde[Index].Valid = 1;
+++++ pDir1->Pde[Index].Write = 1;
+++++ pDir1->Pde[Index].PageFrameNumber = PhysicalAddress / PAGE_SIZE;
+++++
+++++ return TRUE;
++++ }
++++
+++++ULONG
+++++FrLdrMapRangeOfPages(ULONGLONG VirtualAddress, ULONGLONG PhysicalAddress, ULONG cPages)
+++++{
+++++ ULONG i;
+++++
+++++ for (i = 0; i < cPages; i++)
+++++ {
+++++ if (!FrLdrMapSinglePage(VirtualAddress, PhysicalAddress))
+++++ {
+++++ return i;
+++++ }
+++++ VirtualAddress += PAGE_SIZE;
+++++ PhysicalAddress += PAGE_SIZE;
+++++ }
+++++ return i;
+++++}
+++++
+++++
++++ /*++
++++ * FrLdrSetupPageDirectory
++++ * INTERNAL
++++ *
++++ * Sets up the ReactOS Startup Page Directory.
++++ *
++++ * Params:
++++ * None.
++++ *
++++ * Returns:
++++ * None.
-#if 0
- PPAGE_DIRECTORY_X86 PageDir;
- ULONG KernelPageTableIndex;
- ULONG i;
-
- /* Get the Kernel Table Index */
- KernelPageTableIndex = KernelBase >> PDE_SHIFT;
-
- /* Get the Startup Page Directory */
- PageDir = (PPAGE_DIRECTORY_X86)&startup_pagedirectory;
-
- /* Set up the Low Memory PDE */
- PageDir->Pde[LowMemPageTableIndex].Valid = 1;
- PageDir->Pde[LowMemPageTableIndex].Write = 1;
- PageDir->Pde[LowMemPageTableIndex].PageFrameNumber = PaPtrToPfn(lowmem_pagetable);
-
- /* Set up the Kernel PDEs */
- PageDir->Pde[KernelPageTableIndex].Valid = 1;
- PageDir->Pde[KernelPageTableIndex].Write = 1;
- PageDir->Pde[KernelPageTableIndex].PageFrameNumber = PaPtrToPfn(kernel_pagetable);
- PageDir->Pde[KernelPageTableIndex + 1].Valid = 1;
- PageDir->Pde[KernelPageTableIndex + 1].Write = 1;
- PageDir->Pde[KernelPageTableIndex + 1].PageFrameNumber = PaPtrToPfn(kernel_pagetable + 4096);
-
- /* Set up the Startup PDE */
- PageDir->Pde[StartupPageTableIndex].Valid = 1;
- PageDir->Pde[StartupPageTableIndex].Write = 1;
- PageDir->Pde[StartupPageTableIndex].PageFrameNumber = PaPtrToPfn(startup_pagedirectory);
-
- /* Set up the Hyperspace PDE */
- PageDir->Pde[HyperspacePageTableIndex].Valid = 1;
- PageDir->Pde[HyperspacePageTableIndex].Write = 1;
- PageDir->Pde[HyperspacePageTableIndex].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable);
-
- /* Set up the HAL PDE */
- PageDir->Pde[HalPageTableIndex].Valid = 1;
- PageDir->Pde[HalPageTableIndex].Write = 1;
- PageDir->Pde[HalPageTableIndex].PageFrameNumber = PaPtrToPfn(apic_pagetable);
-
- /* Set up Low Memory PTEs */
- PageDir = (PPAGE_DIRECTORY_X86)&lowmem_pagetable;
- for (i=0; i<1024; i++)
- {
- PageDir->Pde[i].Valid = 1;
- PageDir->Pde[i].Write = 1;
- PageDir->Pde[i].Owner = 1;
- PageDir->Pde[i].PageFrameNumber = PaToPfn(i * PAGE_SIZE);
- }
-
- /* Set up Kernel PTEs */
- PageDir = (PPAGE_DIRECTORY_X86)&kernel_pagetable;
- for (i=0; i<1536; i++)
- {
- PageDir->Pde[i].Valid = 1;
- PageDir->Pde[i].Write = 1;
- PageDir->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS + i * PAGE_SIZE);
- }
-
- /* Setup APIC Base */
- PageDir = (PPAGE_DIRECTORY_X86)&apic_pagetable;
- PageDir->Pde[0].Valid = 1;
- PageDir->Pde[0].Write = 1;
- PageDir->Pde[0].CacheDisable = 1;
- PageDir->Pde[0].WriteThrough = 1;
- PageDir->Pde[0].PageFrameNumber = PaToPfn(HAL_BASE);
- PageDir->Pde[0x200].Valid = 1;
- PageDir->Pde[0x200].Write = 1;
- PageDir->Pde[0x200].CacheDisable = 1;
- PageDir->Pde[0x200].WriteThrough = 1;
- PageDir->Pde[0x200].PageFrameNumber = PaToPfn(HAL_BASE + KERNEL_BASE_PHYS);
-
- /* Setup KUSER_SHARED_DATA Base */
- PageDir->Pde[0x1F0].Valid = 1;
- PageDir->Pde[0x1F0].Write = 1;
- PageDir->Pde[0x1F0].PageFrameNumber = 2;
-
- /* Setup KPCR Base*/
- PageDir->Pde[0x1FF].Valid = 1;
- PageDir->Pde[0x1FF].Write = 1;
- PageDir->Pde[0x1FF].PageFrameNumber = 1;
-
- /* Zero shared data */
- RtlZeroMemory((PVOID)(2 << MM_PAGE_SHIFT), PAGE_SIZE);
-#endif
++++ *--*/
++++ VOID
++++ FASTCALL
++++ FrLdrSetupPageDirectory(VOID)
++++ {
+++++ ULONG KernelPages;
+++++ PVOID UserSharedData;
+++++
+++++ /* Allocate a Page for the PML4 */
+++++ pPML4 = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
+++++
+++++ ASSERT(pPML4);
+++++
+++++ /* The page tables are located at 0xfffff68000000000
+++++ * We create a recursive self mapping through all 4 levels at
+++++ * virtual address 0xfffff6fb7dbedf68 */
+++++ pPML4->Pde[VAtoPXI(PXE_BASE)].Valid = 1;
+++++ pPML4->Pde[VAtoPXI(PXE_BASE)].Write = 1;
+++++ pPML4->Pde[VAtoPXI(PXE_BASE)].PageFrameNumber = PtrToPfn(pPML4);
+++++
+++++ /* Setup low memory pages */
+++++ if (FrLdrMapRangeOfPages(0, 0, 1024) < 1024)
+++++ {
+++++ DbgPrint("Could not map low memory pages.\n");
+++++ }
+++++
+++++ /* Setup kernel pages */
+++++ KernelPages = (ROUND_TO_PAGES(NextModuleBase - KERNEL_BASE_PHYS) / PAGE_SIZE);
+++++ if (FrLdrMapRangeOfPages(KernelBase, KERNEL_BASE_PHYS, KernelPages) != KernelPages)
+++++ {
+++++ DbgPrint("Could not map %d kernel pages.\n", KernelPages);
+++++ }
+++++
+++++ /* Setup a page for the idt */
+++++ pIdt = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
+++++ IdtBase = KernelBase + KernelPages * PAGE_SIZE;
+++++ if (!FrLdrMapSinglePage(IdtBase, (ULONGLONG)pIdt))
+++++ {
+++++ DbgPrint("Could not map idt page.\n", KernelPages);
+++++ }
+++++
+++++ /* Setup a page for the gdt & tss */
+++++ pGdt = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
+++++ GdtBase = IdtBase + PAGE_SIZE;
+++++ TssBase = GdtBase + 20 * sizeof(ULONG64); // FIXME: don't hardcode
+++++ if (!FrLdrMapSinglePage(GdtBase, (ULONGLONG)pGdt))
+++++ {
+++++ DbgPrint("Could not map gdt page.\n", KernelPages);
+++++ }
+++++
+++++ /* Setup KUSER_SHARED_DATA page */
+++++ UserSharedData = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
+++++ if (!FrLdrMapSinglePage(KI_USER_SHARED_DATA, (ULONG64)UserSharedData))
+++++ {
+++++ DbgPrint("Could not map KUSER_SHARED_DATA page.\n", KernelPages);
+++++ }
+++++
+++++ /* Map APIC page */
+++++ if (!FrLdrMapSinglePage(APIC_BASE, APIC_PHYS_BASE))
+++++ {
+++++ DbgPrint("Could not map APIC page.\n");
+++++ }
+++++
++++ }
++++
+++++VOID
+++++FrLdrSetupGdtIdt()
+++++{
+++++ PKGDTENTRY64 Entry;
+++++ KDESCRIPTOR Desc;
+++++
+++++ RtlZeroMemory(pGdt, PAGE_SIZE);
+++++
+++++ /* Setup KGDT_64_R0_CODE */
+++++ Entry = KiGetGdtEntry(pGdt, KGDT_64_R0_CODE);
+++++ *(PULONG64)Entry = 0x00209b0000000000ULL;
+++++
+++++ /* Setup KGDT_64_R0_SS */
+++++ Entry = KiGetGdtEntry(pGdt, KGDT_64_R0_SS);
+++++ *(PULONG64)Entry = 0x00cf93000000ffffULL;
+++++
+++++ /* Setup KGDT_64_DATA */
+++++ Entry = KiGetGdtEntry(pGdt, KGDT_64_DATA);
+++++ *(PULONG64)Entry = 0x00cff3000000ffffULL;
+++++
+++++ /* Setup KGDT_64_R3_CODE */
+++++ Entry = KiGetGdtEntry(pGdt, KGDT_64_R3_CODE);
+++++ *(PULONG64)Entry = 0x0020fb0000000000ULL;
+++++
+++++ /* Setup KGDT_32_R3_TEB */
+++++ Entry = KiGetGdtEntry(pGdt, KGDT_32_R3_TEB);
+++++ *(PULONG64)Entry = 0xff40f3fd50003c00ULL;
+++++
+++++ /* Setup TSS entry */
+++++ Entry = KiGetGdtEntry(pGdt, KGDT_TSS);
+++++ KiInitGdtEntry(Entry, TssBase, sizeof(KTSS), I386_TSS, 0);
+++++
+++++ /* Setup the gdt descriptor */
+++++ Desc.Limit = 12 * sizeof(ULONG64) - 1;
+++++ Desc.Base = (PVOID)GdtBase;
+++++
+++++ /* Set the new Gdt */
+++++ __lgdt(&Desc.Limit);
+++++ DbgPrint("Gdtr.Base = %p\n", Desc.Base);
+++++
+++++ /* Setup the idt descriptor */
+++++ Desc.Limit = 12 * sizeof(ULONG64) - 1;
+++++ Desc.Base = (PVOID)IdtBase;
+++++
+++++ /* Set the new Idt */
+++++ __lidt(&Desc.Limit);
+++++ DbgPrint("Idtr.Base = %p\n", Desc.Base);
+++++
+++++}
--- /dev/null
--- /dev/null
--- .code32
++ /*
++ * FreeLoader
++ * Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++ .text
++ .code16
++
++ #define ASM
++ #include <arch.h>
++ #include <multiboot.h>
++
++ /*
++ * Here we assume the kernel is loaded at 1mb
++ * This boots the kernel
++ */
--- .globl _startup_pagedirectory
--- .globl _lowmem_pagetable
--- .globl _kernel_pagetable
--- .globl _hyperspace_pagetable
--- .globl _apic_pagetable
--- .globl _kpcr_pagetable
--- .globl _kuser_pagetable
+++++ .code64
++ .globl _PageDirectoryStart
++
---_startup_pagedirectory:
+++++ .globl _pml4_startup
+++++ .globl _pdp_startup
+++++ .globl _pd_startup
++
++ .globl _PageDirectoryEnd
++
++ //
++ // Boot information structure
++ //
++
++ EXTERN(_reactos_memory_map_descriptor_size)
++ .long 0
++
++ EXTERN(_reactos_memory_map)
++ .rept (32 * /*sizeof(memory_map_t)*/24)
++ .byte 0
++ .endr
++
++ .bss
++ _PageDirectoryStart:
---_lowmem_pagetable:
+++++_pml4_startup:
++ .fill 4096, 1, 0
++
---_kernel_pagetable:
--- .fill 2*4096, 1, 0
---
---_hyperspace_pagetable:
--- .fill 4096, 1, 0
---
---_apic_pagetable:
+++++_pdp_startup:
++ .fill 4096, 1, 0
++
---_kpcr_pagetable:
--- .fill 4096, 1, 0
---
---_kuser_pagetable:
--- .fill 4096, 1, 0
---
+++++_pd_startup:
++ .fill 4096, 1, 0
++
++ _PageDirectoryEnd:
InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported();
if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
{
----- DbgPrint((DPRINT_HWDETECT, "PnP-BIOS not supported\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "PnP-BIOS not supported\n");
return;
}
----- DbgPrint((DPRINT_HWDETECT, "Signature '%c%c%c%c'\n",
+++++ DPRINTM(DPRINT_HWDETECT, "Signature '%c%c%c%c'\n",
InstData->Signature[0], InstData->Signature[1],
----- InstData->Signature[2], InstData->Signature[3]));
+++++ InstData->Signature[2], InstData->Signature[3]);
x = PnpBiosGetDeviceNodeCount(&NodeSize, &NodeCount);
// e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
if (x != 0 || NodeSize == 0 || NodeCount == 0)
{
----- DbgPrint((DPRINT_HWDETECT, "PnP-BIOS failed to enumerate device nodes\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "PnP-BIOS failed to enumerate device nodes\n");
return;
}
----- DbgPrint((DPRINT_HWDETECT, "PnP-BIOS supported\n"));
----- DbgPrint((DPRINT_HWDETECT, "MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount));
----- DbgPrint((DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount));
+++++ DPRINTM(DPRINT_HWDETECT, "PnP-BIOS supported\n");
+++++ DPRINTM(DPRINT_HWDETECT, "MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
+++++ DPRINTM(DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount);
/* Create component key */
FldrCreateComponentKey(SystemKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
memset(PartialResourceList, 0, Size);
{
DeviceNode = (PCM_PNP_BIOS_DEVICE_NODE)DISKREADBUFFER;
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Node: %u Size %u (0x%x)\n",
DeviceNode->Node,
DeviceNode->Size,
----- DeviceNode->Size));
+++++ DeviceNode->Size);
memcpy (Ptr,
DeviceNode,
PnpBufferSize;
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
----- DbgPrint((DPRINT_HWDETECT, "Real buffer size: %u\n", PnpBufferSize));
----- DbgPrint((DPRINT_HWDETECT, "Resource size: %u\n", Size));
+++++ DPRINTM(DPRINT_HWDETECT, "Real buffer size: %u\n", PnpBufferSize);
+++++ DPRINTM(DPRINT_HWDETECT, "Resource size: %u\n", Size);
FldrSetConfigurationData(BusKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate a full resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate a full resource descriptor\n");
return;
}
}
else
{
----- DbgPrint((DPRINT_HWDETECT, "Reading disk geometry failed\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
MmHeapFree(PartialResourceList);
return;
}
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
----- DiskGeometry->BytesPerSector));
+++++ DiskGeometry->BytesPerSector);
FldrSetConfigurationData(DiskKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
{
----- DbgPrint((DPRINT_HWDETECT, "Reading MBR failed\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n");
return;
}
Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
Signature = Mbr->Signature;
----- DbgPrint((DPRINT_HWDETECT, "Signature: %x\n", Signature));
+++++ DPRINTM(DPRINT_HWDETECT, "Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
----- DbgPrint((DPRINT_HWDETECT, "Checksum: %x\n", Checksum));
+++++ DPRINTM(DPRINT_HWDETECT, "Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
Identifier[17] = '-';
Identifier[18] = 'A';
Identifier[19] = 0;
----- DbgPrint((DPRINT_HWDETECT, "Identifier: %s\n", Identifier));
+++++ DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
/* Set identifier */
FldrSetIdentifier(DiskKey, Identifier);
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
ULONG FloppyCount;
FloppyCount = GetFloppyCount();
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Floppy count: %u\n",
----- FloppyCount));
+++++ FloppyCount);
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
memset(PartialResourceList, 0, Size);
}
if (! Changed)
{
----- DbgPrint((DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
----- (int)DiskCount));
+++++ DPRINTM(DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
+++++ (int)DiskCount);
break;
}
DiskCount++;
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
}
DiskReportError(TRUE);
----- DbgPrint((DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
----- (int)DiskCount, (DiskCount == 1) ? "": "s"));
+++++ DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
+++++ (int)DiskCount, (DiskCount == 1) ? "": "s");
FldrCreateComponentKey(BusKey,
L"DiskController",
ControllerClass,
DiskController,
&ControllerKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(ControllerKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
Int13Drives[i].MaxHeads = Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount;
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
0x80 + i,
Geometry.Cylinders - 1,
Geometry.Heads -1,
Geometry.Sectors,
----- Geometry.BytesPerSector));
+++++ Geometry.BytesPerSector);
}
}
if (TimeOut == 0)
return MOUSE_TYPE_NONE;
}
---- Buffer[i] = READ_PORT_UCHAR((PUCHAR)Port);
++++ Buffer[i] = READ_PORT_UCHAR(Port);
}
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Mouse data: %x %x %x %x\n",
----- Buffer[0],Buffer[1],Buffer[2],Buffer[3]));
+++++ Buffer[0],Buffer[1],Buffer[2],Buffer[3]);
/* Check that four bytes for signs */
for (i = 0; i < 4; ++i)
switch (Buffer[i + 1])
{
case '3':
----- DbgPrint((DPRINT_HWDETECT,
----- "Microsoft Mouse with 3-buttons detected\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Microsoft Mouse with 3-buttons detected\n");
return MOUSE_TYPE_LOGITECH;
case 'Z':
----- DbgPrint((DPRINT_HWDETECT,
----- "Microsoft Wheel Mouse detected\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Microsoft Wheel Mouse detected\n");
return MOUSE_TYPE_WHEELZ;
/* case '2': */
default:
----- DbgPrint((DPRINT_HWDETECT,
----- "Microsoft Mouse with 2-buttons detected\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Microsoft Mouse with 2-buttons detected\n");
return MOUSE_TYPE_MICROSOFT;
}
}
ULONG j;
ULONG k;
----- DbgPrint((DPRINT_HWDETECT,
----- "DetectSerialPointerPeripheral()\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "DetectSerialPointerPeripheral()\n");
Identifier[0] = 0;
if (MouseType != MOUSE_TYPE_NONE)
{
Length = GetSerialMousePnpId(Base, Buffer);
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"PnP ID length: %u\n",
----- Length));
+++++ Length);
if (Length != 0)
{
}
Buffer[Length] = 0;
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"PnP ID string: %s\n",
----- Buffer));
+++++ Buffer);
/* Copy PnpId string */
for (i = 0; i < 7; i++)
}
}
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Identifier string: %s\n",
----- Identifier));
+++++ Identifier);
}
if (Length == 0 || strlen(Identifier) < 11)
PeripheralClass,
PointerPeripheral,
&PeripheralKey);
----- DbgPrint((DPRINT_HWDETECT,
----- "Created key: PointerPeripheral\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Created key: PointerPeripheral\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(PeripheralKey,
ULONG i;
ULONG Size;
----- DbgPrint((DPRINT_HWDETECT, "DetectSerialPorts()\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectSerialPorts()\n");
ControllerNumber = 0;
BasePtr = (PUSHORT)0x400;
if (Base == 0)
continue;
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Found COM%u port at 0x%x\n",
i + 1,
----- Base));
+++++ Base);
/* Create controller key */
FldrCreateComponentKey(BusKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
continue;
}
memset(PartialResourceList, 0, Size);
/* Set 'Identifier' value */
sprintf(Buffer, "COM%ld", i + 1);
FldrSetIdentifier(ControllerKey, Buffer);
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Created value: Identifier %s\n",
----- Buffer));
+++++ Buffer);
if (!Rs232PortInUse(Base))
{
ULONG i;
ULONG Size;
----- DbgPrint((DPRINT_HWDETECT, "DetectParallelPorts() called\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectParallelPorts() called\n");
ControllerNumber = 0;
BasePtr = (PUSHORT)0x408;
if (Base == 0)
continue;
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Parallel port %u: %x\n",
ControllerNumber,
----- Base));
+++++ Base);
/* Create controller key */
FldrCreateComponentKey(BusKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
continue;
}
memset(PartialResourceList, 0, Size);
/* Set 'Identifier' value */
sprintf(Buffer, "PARALLEL%ld", i + 1);
FldrSetIdentifier(ControllerKey, Buffer);
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Created value: Identifier %s\n",
----- Buffer));
+++++ Buffer);
ControllerNumber++;
}
----- DbgPrint((DPRINT_HWDETECT, "DetectParallelPorts() done\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectParallelPorts() done\n");
}
PeripheralClass,
KeyboardPeripheral,
&PeripheralKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(PeripheralKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
ControllerClass,
KeyboardController,
&ControllerKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(ControllerKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
if (DetectPS2AuxPort())
{
----- DbgPrint((DPRINT_HWDETECT, "Detected PS2 port\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Detected PS2 port\n");
/* Create controller key */
FldrCreateComponentKey(BusKey,
ControllerClass,
PointerController,
&ControllerKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: PointerController\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(ControllerKey,
if (DetectPS2AuxDevice())
{
----- DbgPrint((DPRINT_HWDETECT, "Detected PS2 mouse\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Detected PS2 mouse\n");
/* Create peripheral key */
FldrCreateComponentKey(ControllerKey,
ControllerClass,
PointerPeripheral,
&PeripheralKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(PeripheralKey,
ControllerClass,
DisplayController,
&ControllerKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: DisplayController\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(ControllerKey,
VesaVersion = BiosIsVesaSupported();
if (VesaVersion != 0)
{
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"VESA version %c.%c\n",
(VesaVersion >> 8) + '0',
----- (VesaVersion & 0xFF) + '0'));
+++++ (VesaVersion & 0xFF) + '0');
}
else
{
----- DbgPrint((DPRINT_HWDETECT,
----- "VESA not supported\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "VESA not supported\n");
}
if (VesaVersion >= 0x0200)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
PCONFIGURATION_COMPONENT_DATA SystemKey;
ULONG BusNumber = 0;
----- DbgPrint((DPRINT_HWDETECT, "DetectHardware()\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
/* Create the 'System' key */
FldrCreateSystemKey(&SystemKey);
DetectIsaBios(SystemKey, &BusNumber);
DetectAcpiBios(SystemKey, &BusNumber);
----- DbgPrint((DPRINT_HWDETECT, "DetectHardware() Done\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n");
return SystemKey;
}
{
if (!memcmp(Ptr, "RSD PTR ", 8))
{
----- DbgPrint((DPRINT_HWDETECT, "ACPI supported\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "ACPI supported\n");
return (PRSDP_DESCRIPTOR)Ptr;
}
---- Ptr = (PUCHAR)((ULONG)Ptr + 0x10);
++++ Ptr = (PUCHAR)((ULONG_PTR)Ptr + 0x10);
}
----- DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "ACPI not supported\n");
return NULL;
}
memcpy(AcpiBiosData->MemoryMap, BiosMemoryMap,
BiosMemoryMapEntryCount * sizeof(BIOS_MEMORY_MAP));
----- DbgPrint((DPRINT_HWDETECT, "RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
----- TableSize));
+++++ DPRINTM(DPRINT_HWDETECT, "RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
+++++ TableSize);
FldrSetConfigurationData(BiosKey,
PartialResourceList,
if (INT386_SUCCESS(RegsOut))
{
----- DbgPrint((DPRINT_HWDETECT, "Found APM BIOS\n"));
----- DbgPrint((DPRINT_HWDETECT, "AH: %x\n", RegsOut.b.ah));
----- DbgPrint((DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al));
----- DbgPrint((DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh));
----- DbgPrint((DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl));
----- DbgPrint((DPRINT_HWDETECT, "CX: %x\n", RegsOut.w.cx));
+++++ DPRINTM(DPRINT_HWDETECT, "Found APM BIOS\n");
+++++ DPRINTM(DPRINT_HWDETECT, "AH: %x\n", RegsOut.b.ah);
+++++ DPRINTM(DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al);
+++++ DPRINTM(DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh);
+++++ DPRINTM(DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl);
+++++ DPRINTM(DPRINT_HWDETECT, "CX: %x\n", RegsOut.w.cx);
return TRUE;
}
----- DbgPrint((DPRINT_HWDETECT, "No APM BIOS found\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "No APM BIOS found\n");
return FALSE;
}
{
if (Table->Signature == 0x52495024)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Found signature\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Found signature\n");
Ptr = (PUCHAR)Table;
Sum = 0;
if ((Sum & 0xFF) != 0)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Invalid routing table\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Invalid routing table\n");
return NULL;
}
----- DbgPrint((DPRINT_HWDETECT,
----- "Valid checksum\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Valid checksum\n");
return Table;
}
if (INT386_SUCCESS(RegsOut) && RegsOut.d.edx == 0x20494350 && RegsOut.b.ah == 0)
{
----- DbgPrint((DPRINT_HWDETECT, "Found PCI bios\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Found PCI bios\n");
----- DbgPrint((DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al));
----- DbgPrint((DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh));
----- DbgPrint((DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl));
----- DbgPrint((DPRINT_HWDETECT, "CL: %x\n", RegsOut.b.cl));
+++++ DPRINTM(DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al);
+++++ DPRINTM(DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh);
+++++ DPRINTM(DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl);
+++++ DPRINTM(DPRINT_HWDETECT, "CL: %x\n", RegsOut.b.cl);
BusData->NoBuses = RegsOut.b.cl + 1;
BusData->MajorRevision = RegsOut.b.bh;
}
----- DbgPrint((DPRINT_HWDETECT, "No PCI bios found\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "No PCI bios found\n");
return FALSE;
}
Table = GetPciIrqRoutingTable();
if (Table != NULL)
{
----- DbgPrint((DPRINT_HWDETECT, "Table size: %u\n", Table->Size));
+++++ DPRINTM(DPRINT_HWDETECT, "Table size: %u\n", Table->Size);
FldrCreateComponentKey(BusKey,
L"RealModeIrqRoutingTable",
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) + Table->Size;
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST,
PartialDescriptors);
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
PartialDescriptors) +
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
sizeof(PCI_REGISTRY_INFO);
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (!PartialResourceList)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST,
PartialDescriptors);
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (!PartialResourceList)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
REGS RegsIn;
REGS RegsOut;
----- DbgPrint((DPRINT_DISK, "DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber));
+++++ DPRINTM(DPRINT_DISK, "DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
// BIOS Int 13h, function 0 - Reset disk system
// AH = 00h
REGS RegsIn;
REGS RegsOut;
----- DbgPrint((DPRINT_DISK, "DiskInt13ExtensionsSupported()\n"));
+++++ DPRINTM(DPRINT_DISK, "DiskInt13ExtensionsSupported()\n");
// IBM/MS INT 13 Extensions - INSTALLATION CHECK
// AH = 41h
REGS RegsOut;
PUSHORT Ptr = (PUSHORT)(BIOSCALLBUFFER);
----- DbgPrint((DPRINT_DISK, "DiskGetExtendedDriveParameters()\n"));
+++++ DPRINTM(DPRINT_DISK, "DiskGetExtendedDriveParameters()\n");
// Initialize transfer buffer
*Ptr = BufferSize;
memcpy(Buffer, Ptr, BufferSize);
----- DbgPrint((DPRINT_DISK, "size of buffer: %x\n", Ptr[0]));
----- DbgPrint((DPRINT_DISK, "information flags: %x\n", Ptr[1]));
----- DbgPrint((DPRINT_DISK, "number of physical cylinders on drive: %u\n", *(PULONG)&Ptr[2]));
----- DbgPrint((DPRINT_DISK, "number of physical heads on drive: %u\n", *(PULONG)&Ptr[4]));
----- DbgPrint((DPRINT_DISK, "number of physical sectors per track: %u\n", *(PULONG)&Ptr[6]));
----- DbgPrint((DPRINT_DISK, "total number of sectors on drive: %I64u\n", *(unsigned long long*)&Ptr[8]));
----- DbgPrint((DPRINT_DISK, "bytes per sector: %u\n", Ptr[12]));
+++++ DPRINTM(DPRINT_DISK, "size of buffer: %x\n", Ptr[0]);
+++++ DPRINTM(DPRINT_DISK, "information flags: %x\n", Ptr[1]);
+++++ DPRINTM(DPRINT_DISK, "number of physical cylinders on drive: %u\n", *(PULONG)&Ptr[2]);
+++++ DPRINTM(DPRINT_DISK, "number of physical heads on drive: %u\n", *(PULONG)&Ptr[4]);
+++++ DPRINTM(DPRINT_DISK, "number of physical sectors per track: %u\n", *(PULONG)&Ptr[6]);
+++++ DPRINTM(DPRINT_DISK, "total number of sectors on drive: %I64u\n", *(unsigned long long*)&Ptr[8]);
+++++ DPRINTM(DPRINT_DISK, "bytes per sector: %u\n", Ptr[12]);
if (Ptr[0] >= 0x1e)
{
----- DbgPrint((DPRINT_DISK, "EED configuration parameters: %x:%x\n", Ptr[13], Ptr[14]));
+++++ DPRINTM(DPRINT_DISK, "EED configuration parameters: %x:%x\n", Ptr[13], Ptr[14]);
if (Ptr[13] != 0xffff && Ptr[14] != 0xffff)
{
---- PUCHAR SpecPtr = (PUCHAR)((Ptr[13] << 4) + Ptr[14]);
---- DbgPrint((DPRINT_DISK, "SpecPtr: %x\n", SpecPtr));
---- DbgPrint((DPRINT_DISK, "physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0]));
---- DbgPrint((DPRINT_DISK, "disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2]));
---- DbgPrint((DPRINT_DISK, "drive flags: %x\n", SpecPtr[4]));
---- DbgPrint((DPRINT_DISK, "proprietary information: %x\n", SpecPtr[5]));
---- DbgPrint((DPRINT_DISK, "IRQ for drive: %u\n", SpecPtr[6]));
---- DbgPrint((DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7]));
---- DbgPrint((DPRINT_DISK, "DMA control: %x\n", SpecPtr[8]));
---- DbgPrint((DPRINT_DISK, "programmed I/O control: %x\n", SpecPtr[9]));
---- DbgPrint((DPRINT_DISK, "drive options: %x\n", *(PUSHORT)&SpecPtr[10]));
++++ PUCHAR SpecPtr = (PUCHAR)(ULONG_PTR)((Ptr[13] << 4) + Ptr[14]);
- DbgPrint((DPRINT_DISK, "SpecPtr: %x\n", SpecPtr));
- DbgPrint((DPRINT_DISK, "physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0]));
- DbgPrint((DPRINT_DISK, "disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2]));
- DbgPrint((DPRINT_DISK, "drive flags: %x\n", SpecPtr[4]));
- DbgPrint((DPRINT_DISK, "proprietary information: %x\n", SpecPtr[5]));
- DbgPrint((DPRINT_DISK, "IRQ for drive: %u\n", SpecPtr[6]));
- DbgPrint((DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7]));
- DbgPrint((DPRINT_DISK, "DMA control: %x\n", SpecPtr[8]));
- DbgPrint((DPRINT_DISK, "programmed I/O control: %x\n", SpecPtr[9]));
- DbgPrint((DPRINT_DISK, "drive options: %x\n", *(PUSHORT)&SpecPtr[10]));
+++++ DPRINTM(DPRINT_DISK, "SpecPtr: %x\n", SpecPtr);
+++++ DPRINTM(DPRINT_DISK, "physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0]);
+++++ DPRINTM(DPRINT_DISK, "disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2]);
+++++ DPRINTM(DPRINT_DISK, "drive flags: %x\n", SpecPtr[4]);
+++++ DPRINTM(DPRINT_DISK, "proprietary information: %x\n", SpecPtr[5]);
+++++ DPRINTM(DPRINT_DISK, "IRQ for drive: %u\n", SpecPtr[6]);
+++++ DPRINTM(DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7]);
+++++ DPRINTM(DPRINT_DISK, "DMA control: %x\n", SpecPtr[8]);
+++++ DPRINTM(DPRINT_DISK, "programmed I/O control: %x\n", SpecPtr[9]);
+++++ DPRINTM(DPRINT_DISK, "drive options: %x\n", *(PUSHORT)&SpecPtr[10]);
}
}
if (Ptr[0] >= 0x42)
{
----- DbgPrint((DPRINT_DISK, "signature: %x\n", Ptr[15]));
+++++ DPRINTM(DPRINT_DISK, "signature: %x\n", Ptr[15]);
}
return TRUE;
//USHORT* VideoModes;
//USHORT Index;
----- DbgPrint((DPRINT_UI, "BiosIsVesaSupported()\n"));
+++++ DPRINTM(DPRINT_UI, "BiosIsVesaSupported()\n");
RtlZeroMemory(SvgaInfo, sizeof(VESA_SVGA_INFO));
Regs.w.di = BIOSCALLBUFOFFSET;
Int386(0x10, &Regs, &Regs);
----- DbgPrint((DPRINT_UI, "AL = 0x%x\n", Regs.b.al));
----- DbgPrint((DPRINT_UI, "AH = 0x%x\n", Regs.b.ah));
+++++ DPRINTM(DPRINT_UI, "AL = 0x%x\n", Regs.b.al);
+++++ DPRINTM(DPRINT_UI, "AH = 0x%x\n", Regs.b.ah);
if (Regs.w.ax != 0x004F)
{
----- DbgPrint((DPRINT_UI, "Failed.\n"));
+++++ DPRINTM(DPRINT_UI, "Failed.\n");
return 0x0000;
}
----- DbgPrint((DPRINT_UI, "Supported.\n"));
----- DbgPrint((DPRINT_UI, "SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]));
----- DbgPrint((DPRINT_UI, "SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF)));
----- DbgPrint((DPRINT_UI, "SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr));
----- DbgPrint((DPRINT_UI, "SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities));
----- DbgPrint((DPRINT_UI, "SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64));
----- DbgPrint((DPRINT_UI, "---VBE v2.0 ---\n"));
----- DbgPrint((DPRINT_UI, "SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10)));
----- DbgPrint((DPRINT_UI, "SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr));
----- DbgPrint((DPRINT_UI, "SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr));
----- DbgPrint((DPRINT_UI, "SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr));
----- DbgPrint((DPRINT_UI, "SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version));
-----
----- //DbgPrint((DPRINT_UI, "\nSupported VESA and OEM video modes:\n"));
+++++ DPRINTM(DPRINT_UI, "Supported.\n");
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]);
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF));
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr);
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities);
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64);
+++++ DPRINTM(DPRINT_UI, "---VBE v2.0 ---\n");
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10));
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr);
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr);
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr);
+++++ DPRINTM(DPRINT_UI, "SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version);
+++++
+++++ //DPRINTM(DPRINT_UI, "\nSupported VESA and OEM video modes:\n");
//VideoModes = (USHORT*)SvgaInfo->SupportedModeListPtr;
//for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
//{
----- // DbgPrint((DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]));
+++++ // DPRINTM(DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]);
//}
//if (SvgaInfo->VesaVersion >= 0x0200)
//{
----- // DbgPrint((DPRINT_UI, "\nSupported accelerated video modes (VESA v2.0):\n"));
+++++ // DPRINTM(DPRINT_UI, "\nSupported accelerated video modes (VESA v2.0):\n");
// VideoModes = (USHORT*)SvgaInfo->AcceleratedModeListPtr;
// for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
// {
----- // DbgPrint((DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]));
+++++ // DPRINTM(DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]);
// }
//}
----- DbgPrint((DPRINT_UI, "\n"));
+++++ DPRINTM(DPRINT_UI, "\n");
return SvgaInfo->VesaVersion;
}
#define NDEBUG
#include <debug.h>
-----#undef DbgPrint
/* Page Directory and Tables for non-PAE Systems */
extern PAGE_DIRECTORY_X86 startup_pagedirectory;
REGS RegsIn;
REGS RegsOut;
----- DbgPrint((DPRINT_DISK, "PcDiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber));
+++++ DPRINTM(DPRINT_DISK, "PcDiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
// BIOS Int 13h, function 0 - Reset disk system
// AH = 00h
ULONG RetryCount;
PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER);
----- DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));
+++++ DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
RegsIn.b.ah = 0x42; // Subfunction 42h
REGS RegsOut;
ULONG RetryCount;
----- DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectorsCHS()\n"));
+++++ DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsCHS()\n");
//
// Get the drive geometry
REGS RegsIn;
REGS RegsOut;
----- DbgPrint((DPRINT_DISK, "PcDiskInt13ExtensionsSupported()\n"));
+++++ DPRINTM(DPRINT_DISK, "PcDiskInt13ExtensionsSupported()\n");
if (DriveNumber == LastDriveNumber)
{
----- DbgPrint((DPRINT_DISK, "Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber));
+++++ DPRINTM(DPRINT_DISK, "Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber);
return LastSupported;
}
BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{
----- DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));
+++++ DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
//
// Check to see if it is a fixed disk drive
//
if ((DriveNumber >= 0x80) && PcDiskInt13ExtensionsSupported(DriveNumber))
{
----- DbgPrint((DPRINT_DISK, "Using Int 13 Extensions for read. PcDiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, PcDiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE"));
+++++ DPRINTM(DPRINT_DISK, "Using Int 13 Extensions for read. PcDiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, PcDiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE");
//
// LBA is easy, nothing to calculate
REGS RegsOut;
ULONG Cylinders;
----- DbgPrint((DPRINT_DISK, "DiskGetDriveGeometry()\n"));
+++++ DPRINTM(DPRINT_DISK, "DiskGetDriveGeometry()\n");
/* BIOS Int 13h, function 08h - Get drive parameters
* AH = 08h
REGS RegsOut;
ULONG MemorySize;
----- DbgPrint((DPRINT_MEMORY, "GetExtendedMemorySize()\n"));
+++++ DPRINTM(DPRINT_MEMORY, "GetExtendedMemorySize()\n");
/* Int 15h AX=E801h
* Phoenix BIOS v4.0 - GET MEMORY SIZE FOR >64M CONFIGURATIONS
RegsIn.w.ax = 0xE801;
Int386(0x15, &RegsIn, &RegsOut);
----- DbgPrint((DPRINT_MEMORY, "Int15h AX=E801h\n"));
----- DbgPrint((DPRINT_MEMORY, "AX = 0x%x\n", RegsOut.w.ax));
----- DbgPrint((DPRINT_MEMORY, "BX = 0x%x\n", RegsOut.w.bx));
----- DbgPrint((DPRINT_MEMORY, "CX = 0x%x\n", RegsOut.w.cx));
----- DbgPrint((DPRINT_MEMORY, "DX = 0x%x\n", RegsOut.w.dx));
----- DbgPrint((DPRINT_MEMORY, "CF set = %s\n\n", (RegsOut.x.eflags & I386FLAG_CF) ? "TRUE" : "FALSE"));
+++++ DPRINTM(DPRINT_MEMORY, "Int15h AX=E801h\n");
+++++ DPRINTM(DPRINT_MEMORY, "AX = 0x%x\n", RegsOut.w.ax);
+++++ DPRINTM(DPRINT_MEMORY, "BX = 0x%x\n", RegsOut.w.bx);
+++++ DPRINTM(DPRINT_MEMORY, "CX = 0x%x\n", RegsOut.w.cx);
+++++ DPRINTM(DPRINT_MEMORY, "DX = 0x%x\n", RegsOut.w.dx);
+++++ DPRINTM(DPRINT_MEMORY, "CF set = %s\n\n", (RegsOut.x.eflags & I386FLAG_CF) ? "TRUE" : "FALSE");
if (INT386_SUCCESS(RegsOut))
{
RegsIn.b.ah = 0x88;
Int386(0x15, &RegsIn, &RegsOut);
----- DbgPrint((DPRINT_MEMORY, "Int15h AH=88h\n"));
----- DbgPrint((DPRINT_MEMORY, "AX = 0x%x\n", RegsOut.w.ax));
----- DbgPrint((DPRINT_MEMORY, "CF set = %s\n\n", (RegsOut.x.eflags & I386FLAG_CF) ? "TRUE" : "FALSE"));
+++++ DPRINTM(DPRINT_MEMORY, "Int15h AH=88h\n");
+++++ DPRINTM(DPRINT_MEMORY, "AX = 0x%x\n", RegsOut.w.ax);
+++++ DPRINTM(DPRINT_MEMORY, "CF set = %s\n\n", (RegsOut.x.eflags & I386FLAG_CF) ? "TRUE" : "FALSE");
if (INT386_SUCCESS(RegsOut) && RegsOut.w.ax != 0)
{
MemorySize = (MemorySize & 0xFFFF);
MemorySize = (MemorySize << 8);
----- DbgPrint((DPRINT_MEMORY, "Int15h Failed\n"));
----- DbgPrint((DPRINT_MEMORY, "CMOS reports: 0x%x\n", MemorySize));
+++++ DPRINTM(DPRINT_MEMORY, "Int15h Failed\n");
+++++ DPRINTM(DPRINT_MEMORY, "CMOS reports: 0x%x\n", MemorySize);
return MemorySize;
}
{
REGS Regs;
----- DbgPrint((DPRINT_MEMORY, "GetConventionalMemorySize()\n"));
+++++ DPRINTM(DPRINT_MEMORY, "GetConventionalMemorySize()\n");
/* Int 12h
* BIOS - GET MEMORY SIZE
Regs.w.ax = 0;
Int386(0x12, &Regs, &Regs);
----- DbgPrint((DPRINT_MEMORY, "Int12h\n"));
----- DbgPrint((DPRINT_MEMORY, "AX = 0x%x\n\n", Regs.w.ax));
+++++ DPRINTM(DPRINT_MEMORY, "Int12h\n");
+++++ DPRINTM(DPRINT_MEMORY, "AX = 0x%x\n\n", Regs.w.ax);
return (ULONG)Regs.w.ax;
}
REGS Regs;
ULONG MapCount;
----- DbgPrint((DPRINT_MEMORY, "GetBiosMemoryMap()\n"));
+++++ DPRINTM(DPRINT_MEMORY, "GetBiosMemoryMap()\n");
/* Int 15h AX=E820h
* Newer BIOSes - GET SYSTEM MEMORY MAP
{
Int386(0x15, &Regs, &Regs);
----- DbgPrint((DPRINT_MEMORY, "Memory Map Entry %d\n", MapCount));
----- DbgPrint((DPRINT_MEMORY, "Int15h AX=E820h\n"));
----- DbgPrint((DPRINT_MEMORY, "EAX = 0x%x\n", Regs.x.eax));
----- DbgPrint((DPRINT_MEMORY, "EBX = 0x%x\n", Regs.x.ebx));
----- DbgPrint((DPRINT_MEMORY, "ECX = 0x%x\n", Regs.x.ecx));
----- DbgPrint((DPRINT_MEMORY, "CF set = %s\n", (Regs.x.eflags & I386FLAG_CF) ? "TRUE" : "FALSE"));
+++++ DPRINTM(DPRINT_MEMORY, "Memory Map Entry %d\n", MapCount);
+++++ DPRINTM(DPRINT_MEMORY, "Int15h AX=E820h\n");
+++++ DPRINTM(DPRINT_MEMORY, "EAX = 0x%x\n", Regs.x.eax);
+++++ DPRINTM(DPRINT_MEMORY, "EBX = 0x%x\n", Regs.x.ebx);
+++++ DPRINTM(DPRINT_MEMORY, "ECX = 0x%x\n", Regs.x.ecx);
+++++ DPRINTM(DPRINT_MEMORY, "CF set = %s\n", (Regs.x.eflags & I386FLAG_CF) ? "TRUE" : "FALSE");
/* If the BIOS didn't return 'SMAP' in EAX then
* it doesn't support this call */
/* Copy data to caller's buffer */
RtlCopyMemory(&BiosMemoryMap[MapCount], (PVOID)BIOSCALLBUFFER, Regs.x.ecx);
- DbgPrint((DPRINT_MEMORY, "BaseAddress: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].BaseAddress));
- DbgPrint((DPRINT_MEMORY, "Length: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].Length));
---- DbgPrint((DPRINT_MEMORY, "BaseAddress: 0x%x%x\n", BiosMemoryMap[MapCount].BaseAddress));
---- DbgPrint((DPRINT_MEMORY, "Length: 0x%x%x\n", BiosMemoryMap[MapCount].Length));
----- DbgPrint((DPRINT_MEMORY, "Type: 0x%x\n", BiosMemoryMap[MapCount].Type));
----- DbgPrint((DPRINT_MEMORY, "Reserved: 0x%x\n", BiosMemoryMap[MapCount].Reserved));
----- DbgPrint((DPRINT_MEMORY, "\n"));
+++++ DPRINTM(DPRINT_MEMORY, "BaseAddress: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].BaseAddress);
+++++ DPRINTM(DPRINT_MEMORY, "Length: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].Length);
+++++ DPRINTM(DPRINT_MEMORY, "Type: 0x%x\n", BiosMemoryMap[MapCount].Type);
+++++ DPRINTM(DPRINT_MEMORY, "Reserved: 0x%x\n", BiosMemoryMap[MapCount].Reserved);
+++++ DPRINTM(DPRINT_MEMORY, "\n");
/* If the continuation value is zero or the
* carry flag is set then this was
if (Regs.x.ebx == 0x00000000 || !INT386_SUCCESS(Regs))
{
MapCount++;
----- DbgPrint((DPRINT_MEMORY, "End Of System Memory Map!\n\n"));
+++++ DPRINTM(DPRINT_MEMORY, "End Of System Memory Map!\n\n");
break;
}
RtlCopyMemory(ModeInformation, (PVOID)BIOSCALLBUFFER, sizeof(SVGA_MODE_INFORMATION));
----- DbgPrint((DPRINT_UI, "\n"));
----- DbgPrint((DPRINT_UI, "BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode));
----- DbgPrint((DPRINT_UI, "ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes));
----- DbgPrint((DPRINT_UI, "WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA));
----- DbgPrint((DPRINT_UI, "WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB));
----- DbgPrint((DPRINT_UI, "WindowGranularity = %dKB\n", ModeInformation->WindowGranularity));
----- DbgPrint((DPRINT_UI, "WindowSize = %dKB\n", ModeInformation->WindowSize));
----- DbgPrint((DPRINT_UI, "WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment));
----- DbgPrint((DPRINT_UI, "WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment));
----- DbgPrint((DPRINT_UI, "WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction));
----- DbgPrint((DPRINT_UI, "BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine));
----- DbgPrint((DPRINT_UI, "WidthInPixels = %d\n", ModeInformation->WidthInPixels));
----- DbgPrint((DPRINT_UI, "HeightInPixels = %d\n", ModeInformation->HeightInPixels));
----- DbgPrint((DPRINT_UI, "CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels));
----- DbgPrint((DPRINT_UI, "CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels));
----- DbgPrint((DPRINT_UI, "NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes));
----- DbgPrint((DPRINT_UI, "BitsPerPixel = %d\n", ModeInformation->BitsPerPixel));
----- DbgPrint((DPRINT_UI, "NumberOfBanks = %d\n", ModeInformation->NumberOfBanks));
----- DbgPrint((DPRINT_UI, "MemoryModel = %d\n", ModeInformation->MemoryModel));
----- DbgPrint((DPRINT_UI, "BankSize = %d\n", ModeInformation->BankSize));
----- DbgPrint((DPRINT_UI, "NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes));
----- DbgPrint((DPRINT_UI, "---VBE v1.2+ ---\n"));
----- DbgPrint((DPRINT_UI, "RedMaskSize = %d\n", ModeInformation->RedMaskSize));
----- DbgPrint((DPRINT_UI, "RedMaskPosition = %d\n", ModeInformation->RedMaskPosition));
----- DbgPrint((DPRINT_UI, "GreenMaskSize = %d\n", ModeInformation->GreenMaskSize));
----- DbgPrint((DPRINT_UI, "GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition));
----- DbgPrint((DPRINT_UI, "BlueMaskSize = %d\n", ModeInformation->BlueMaskSize));
----- DbgPrint((DPRINT_UI, "BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition));
----- DbgPrint((DPRINT_UI, "ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize));
----- DbgPrint((DPRINT_UI, "ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition));
----- DbgPrint((DPRINT_UI, "\n"));
+++++ DPRINTM(DPRINT_UI, "\n");
+++++ DPRINTM(DPRINT_UI, "BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode);
+++++ DPRINTM(DPRINT_UI, "ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes);
+++++ DPRINTM(DPRINT_UI, "WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA);
+++++ DPRINTM(DPRINT_UI, "WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB);
+++++ DPRINTM(DPRINT_UI, "WindowGranularity = %dKB\n", ModeInformation->WindowGranularity);
+++++ DPRINTM(DPRINT_UI, "WindowSize = %dKB\n", ModeInformation->WindowSize);
+++++ DPRINTM(DPRINT_UI, "WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment);
+++++ DPRINTM(DPRINT_UI, "WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment);
+++++ DPRINTM(DPRINT_UI, "WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
+++++ DPRINTM(DPRINT_UI, "BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine);
+++++ DPRINTM(DPRINT_UI, "WidthInPixels = %d\n", ModeInformation->WidthInPixels);
+++++ DPRINTM(DPRINT_UI, "HeightInPixels = %d\n", ModeInformation->HeightInPixels);
+++++ DPRINTM(DPRINT_UI, "CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels);
+++++ DPRINTM(DPRINT_UI, "CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels);
+++++ DPRINTM(DPRINT_UI, "NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes);
+++++ DPRINTM(DPRINT_UI, "BitsPerPixel = %d\n", ModeInformation->BitsPerPixel);
+++++ DPRINTM(DPRINT_UI, "NumberOfBanks = %d\n", ModeInformation->NumberOfBanks);
+++++ DPRINTM(DPRINT_UI, "MemoryModel = %d\n", ModeInformation->MemoryModel);
+++++ DPRINTM(DPRINT_UI, "BankSize = %d\n", ModeInformation->BankSize);
+++++ DPRINTM(DPRINT_UI, "NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes);
+++++ DPRINTM(DPRINT_UI, "---VBE v1.2+ ---\n");
+++++ DPRINTM(DPRINT_UI, "RedMaskSize = %d\n", ModeInformation->RedMaskSize);
+++++ DPRINTM(DPRINT_UI, "RedMaskPosition = %d\n", ModeInformation->RedMaskPosition);
+++++ DPRINTM(DPRINT_UI, "GreenMaskSize = %d\n", ModeInformation->GreenMaskSize);
+++++ DPRINTM(DPRINT_UI, "GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition);
+++++ DPRINTM(DPRINT_UI, "BlueMaskSize = %d\n", ModeInformation->BlueMaskSize);
+++++ DPRINTM(DPRINT_UI, "BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition);
+++++ DPRINTM(DPRINT_UI, "ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize);
+++++ DPRINTM(DPRINT_UI, "ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition);
+++++ DPRINTM(DPRINT_UI, "\n");
return TRUE;
}
if (VIDEOCARD_CGA_OR_OTHER == PcVideoDetectVideoCard())
{
----- DbgPrint((DPRINT_UI, "CGA or other display adapter detected.\n"));
+++++ DPRINTM(DPRINT_UI, "CGA or other display adapter detected.\n");
printf("CGA or other display adapter detected.\n");
printf("Using 80x25 text mode.\n");
VideoMode = VIDEOMODE_NORMAL_TEXT;
}
else if (VIDEOCARD_EGA == PcVideoDetectVideoCard())
{
----- DbgPrint((DPRINT_UI, "EGA display adapter detected.\n"));
+++++ DPRINTM(DPRINT_UI, "EGA display adapter detected.\n");
printf("EGA display adapter detected.\n");
printf("Using 80x25 text mode.\n");
VideoMode = VIDEOMODE_NORMAL_TEXT;
}
else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
{
----- DbgPrint((DPRINT_UI, "VGA display adapter detected.\n"));
+++++ DPRINTM(DPRINT_UI, "VGA display adapter detected.\n");
if (0 == _stricmp(DisplayModeName, "NORMAL_VGA"))
{
}
StallExecutionProcessor(10);
}
----- DbgPrint((DPRINT_DISK, "status=0x%x\n", Status));
----- DbgPrint((DPRINT_DISK, "waited %d usecs for busy to clear\n", RetryCount * 10));
+++++ DPRINTM(DPRINT_DISK, "status=0x%x\n", Status);
+++++ DPRINTM(DPRINT_DISK, "waited %d usecs for busy to clear\n", RetryCount * 10);
if (RetryCount >= IDE_MAX_BUSY_RETRIES)
{
----- DbgPrint((DPRINT_DISK, "Drive is BUSY for too long\n"));
+++++ DPRINTM(DPRINT_DISK, "Drive is BUSY for too long\n");
return FALSE;
}
/* Issue command to drive */
if (DrvHead & IDE_DH_LBA)
{
----- DbgPrint((DPRINT_DISK, "READ:DRV=%d:LBA=1:BLK=%d:SC=0x%x:CM=0x%x\n",
+++++ DPRINTM(DPRINT_DISK, "READ:DRV=%d:LBA=1:BLK=%d:SC=0x%x:CM=0x%x\n",
DrvHead & IDE_DH_DRV1 ? 1 : 0,
((DrvHead & 0x0f) << 24) + (CylinderHigh << 16) + (CylinderLow << 8) + SectorNum,
SectorCnt,
----- Command));
+++++ Command);
}
else
{
----- DbgPrint((DPRINT_DISK, "READ:DRV=%d:LBA=0:CH=0x%x:CL=0x%x:HD=0x%x:SN=0x%x:SC=0x%x:CM=0x%x\n",
+++++ DPRINTM(DPRINT_DISK, "READ:DRV=%d:LBA=0:CH=0x%x:CL=0x%x:HD=0x%x:SN=0x%x:SC=0x%x:CM=0x%x\n",
DrvHead & IDE_DH_DRV1 ? 1 : 0,
CylinderHigh,
CylinderLow,
DrvHead & 0x0f,
SectorNum,
SectorCnt,
----- Command));
+++++ Command);
}
/* Setup command parameters */
{
if (SectorCount >= SectorCnt)
{
----- DbgPrint((DPRINT_DISK, "Buffer size exceeded!\n"));
+++++ DPRINTM(DPRINT_DISK, "Buffer size exceeded!\n");
Junk = TRUE;
}
break;
{
if (SectorCount > SectorCnt)
{
----- DbgPrint((DPRINT_DISK, "Read %lu sectors of junk!\n",
----- SectorCount - SectorCnt));
+++++ DPRINTM(DPRINT_DISK, "Read %lu sectors of junk!\n",
+++++ SectorCount - SectorCnt);
}
IDEWriteDriveControl(ControlPort, 0);
StallExecutionProcessor(50);
if (DriveNumber < 0x80 || 2 <= (DriveNumber & 0x0f))
{
/* Xbox has only 1 IDE controller and no floppy */
----- DbgPrint((DPRINT_DISK, "Invalid drive number\n"));
+++++ DPRINTM(DPRINT_DISK, "Invalid drive number\n");
return FALSE;
}
if (UINT64_C(0) != ((SectorNumber + SectorCount) & UINT64_C(0xfffffffff0000000)))
{
----- DbgPrint((DPRINT_DISK, "48bit LBA required but not implemented\n"));
+++++ DPRINTM(DPRINT_DISK, "48bit LBA required but not implemented\n");
return FALSE;
}
(Atapi ? IDE_CMD_IDENT_ATAPI_DRV : IDE_CMD_IDENT_ATA_DRV),
(PUCHAR) &DrvParms))
{
----- DbgPrint((DPRINT_DISK, "XboxDiskPolledRead() failed\n"));
+++++ DPRINTM(DPRINT_DISK, "XboxDiskPolledRead() failed\n");
return FALSE;
}
}
else
{
----- DbgPrint((DPRINT_DISK, "BytesPerSector %d\n", DrvParms.BytesPerSector));
+++++ DPRINTM(DPRINT_DISK, "BytesPerSector %d\n", DrvParms.BytesPerSector);
if (DrvParms.BytesPerSector == 0)
{
Geometry->BytesPerSector = 512;
}
}
}
----- DbgPrint((DPRINT_DISK, "Cylinders %d\n", Geometry->Cylinders));
----- DbgPrint((DPRINT_DISK, "Heads %d\n", Geometry->Heads));
----- DbgPrint((DPRINT_DISK, "Sectors %d\n", Geometry->Sectors));
----- DbgPrint((DPRINT_DISK, "BytesPerSector %d\n", Geometry->BytesPerSector));
+++++ DPRINTM(DPRINT_DISK, "Cylinders %d\n", Geometry->Cylinders);
+++++ DPRINTM(DPRINT_DISK, "Heads %d\n", Geometry->Heads);
+++++ DPRINTM(DPRINT_DISK, "Sectors %d\n", Geometry->Sectors);
+++++ DPRINTM(DPRINT_DISK, "BytesPerSector %d\n", Geometry->BytesPerSector);
return TRUE;
}
/* Set 'Configuration Data' value */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate a full resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate a full resource descriptor\n");
return;
}
}
else
{
----- DbgPrint((DPRINT_HWDETECT, "Reading disk geometry failed\n"));
---- MmFreeMemory(PartialResourceList);
+++++ DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
++++ MmHeapFree(PartialResourceList);
return;
}
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
----- DiskGeometry->BytesPerSector));
+++++ DiskGeometry->BytesPerSector);
FldrSetConfigurationData(DiskKey, PartialResourceList, Size);
---- MmFreeMemory(PartialResourceList);
++++ MmHeapFree(PartialResourceList);
}
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
{
----- DbgPrint((DPRINT_HWDETECT, "Reading MBR failed\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n");
return;
}
Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
Signature = Mbr->Signature;
----- DbgPrint((DPRINT_HWDETECT, "Signature: %x\n", Signature));
+++++ DPRINTM(DPRINT_HWDETECT, "Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
----- DbgPrint((DPRINT_HWDETECT, "Checksum: %x\n", Checksum));
+++++ DPRINTM(DPRINT_HWDETECT, "Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
Identifier[17] = '-';
Identifier[18] = 'A';
Identifier[19] = 0;
----- DbgPrint((DPRINT_HWDETECT, "Identifier: %s\n", Identifier));
+++++ DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
/* Set identifier */
FldrSetIdentifier(DiskKey, Identifier);
}
if (! Changed)
{
----- DbgPrint((DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
----- (int)DiskCount));
+++++ DPRINTM(DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
+++++ (int)DiskCount);
break;
}
DiskCount++;
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
}
DiskReportError(TRUE);
----- DbgPrint((DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
----- (int)DiskCount, (DiskCount == 1) ? "": "s"));
+++++ DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
+++++ (int)DiskCount, (DiskCount == 1) ? "": "s");
FldrCreateComponentKey(BusKey,
L"DiskController",
ControllerClass,
DiskController,
&ControllerKey);
----- DbgPrint((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(ControllerKey,
/* Allocate resource descriptor */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
Int13Drives[i].MaxHeads = Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount;
----- DbgPrint((DPRINT_HWDETECT,
+++++ DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
0x80 + i,
Geometry.Cylinders - 1,
Geometry.Heads -1,
Geometry.Sectors,
----- Geometry.BytesPerSector));
+++++ Geometry.BytesPerSector);
}
}
/* Set 'Configuration Data' value */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
---- PartialResourceList = MmAllocateMemory(Size);
++++ PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
----- DbgPrint((DPRINT_HWDETECT,
----- "Failed to allocate resource descriptor\n"));
+++++ DPRINTM(DPRINT_HWDETECT,
+++++ "Failed to allocate resource descriptor\n");
return;
}
PCONFIGURATION_COMPONENT_DATA SystemKey;
ULONG BusNumber = 0;
----- DbgPrint((DPRINT_HWDETECT, "DetectHardware()\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
/* Create the 'System' key */
FldrCreateSystemKey(&SystemKey);
/* TODO: Build actual xbox's hardware configuration tree */
DetectIsaBios(SystemKey, &BusNumber);
----- DbgPrint((DPRINT_HWDETECT, "DetectHardware() Done\n"));
+++++ DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n");
return SystemKey;
}
#define NDEBUG
#include <debug.h>
-----#undef DbgPrint
#define DbgPrint printf
extern PVOID KernelBase;
{
PCACHE_BLOCK CacheBlock = NULL;
----- DbgPrint((DPRINT_CACHE, "CacheInternalGetBlockPointer() BlockNumber = %d\n", BlockNumber));
+++++ DPRINTM(DPRINT_CACHE, "CacheInternalGetBlockPointer() BlockNumber = %d\n", BlockNumber);
CacheBlock = CacheInternalFindBlock(CacheDrive, BlockNumber);
if (CacheBlock != NULL)
{
----- DbgPrint((DPRINT_CACHE, "Cache hit! BlockNumber: %d CacheBlock->BlockNumber: %d\n", BlockNumber, CacheBlock->BlockNumber));
+++++ DPRINTM(DPRINT_CACHE, "Cache hit! BlockNumber: %d CacheBlock->BlockNumber: %d\n", BlockNumber, CacheBlock->BlockNumber);
return CacheBlock;
}
----- DbgPrint((DPRINT_CACHE, "Cache miss! BlockNumber: %d\n", BlockNumber));
+++++ DPRINTM(DPRINT_CACHE, "Cache miss! BlockNumber: %d\n", BlockNumber);
CacheBlock = CacheInternalAddBlockToCache(CacheDrive, BlockNumber);
{
PCACHE_BLOCK CacheBlock = NULL;
----- DbgPrint((DPRINT_CACHE, "CacheInternalFindBlock() BlockNumber = %d\n", BlockNumber));
+++++ DPRINTM(DPRINT_CACHE, "CacheInternalFindBlock() BlockNumber = %d\n", BlockNumber);
//
// Make sure the block list has entries before I start searching it.
{
PCACHE_BLOCK CacheBlock = NULL;
----- DbgPrint((DPRINT_CACHE, "CacheInternalAddBlockToCache() BlockNumber = %d\n", BlockNumber));
+++++ DPRINTM(DPRINT_CACHE, "CacheInternalAddBlockToCache() BlockNumber = %d\n", BlockNumber);
// Check the size of the cache so we don't exceed our limits
CacheInternalCheckCacheSizeLimits(CacheDrive);
{
PCACHE_BLOCK CacheBlockToFree;
----- DbgPrint((DPRINT_CACHE, "CacheInternalFreeBlock()\n"));
+++++ DPRINTM(DPRINT_CACHE, "CacheInternalFreeBlock()\n");
// Get a pointer to the last item in the block list
// that isn't forced to be in the cache and remove
{
ULONG NewCacheSize;
----- DbgPrint((DPRINT_CACHE, "CacheInternalCheckCacheSizeLimits()\n"));
+++++ DPRINTM(DPRINT_CACHE, "CacheInternalCheckCacheSizeLimits()\n");
// Calculate the size of the cache if we added a block
NewCacheSize = (CacheBlockCount + 1) * (CacheDrive->BlockSize * CacheDrive->BytesPerSector);
{
PCACHE_BLOCK CacheBlock;
----- DbgPrint((DPRINT_CACHE, "Dumping block list for BIOS drive 0x%x.\n", CacheDrive->DriveNumber));
----- DbgPrint((DPRINT_CACHE, "BytesPerSector: %d.\n", CacheDrive->BytesPerSector));
----- DbgPrint((DPRINT_CACHE, "BlockSize: %d.\n", CacheDrive->BlockSize));
----- DbgPrint((DPRINT_CACHE, "CacheSizeLimit: %d.\n", CacheSizeLimit));
----- DbgPrint((DPRINT_CACHE, "CacheSizeCurrent: %d.\n", CacheSizeCurrent));
----- DbgPrint((DPRINT_CACHE, "CacheBlockCount: %d.\n", CacheBlockCount));
+++++ DPRINTM(DPRINT_CACHE, "Dumping block list for BIOS drive 0x%x.\n", CacheDrive->DriveNumber);
+++++ DPRINTM(DPRINT_CACHE, "BytesPerSector: %d.\n", CacheDrive->BytesPerSector);
+++++ DPRINTM(DPRINT_CACHE, "BlockSize: %d.\n", CacheDrive->BlockSize);
+++++ DPRINTM(DPRINT_CACHE, "CacheSizeLimit: %d.\n", CacheSizeLimit);
+++++ DPRINTM(DPRINT_CACHE, "CacheSizeCurrent: %d.\n", CacheSizeCurrent);
+++++ DPRINTM(DPRINT_CACHE, "CacheBlockCount: %d.\n", CacheBlockCount);
CacheBlock = CONTAINING_RECORD(CacheDrive->CacheBlockHead.Flink, CACHE_BLOCK, ListEntry);
while (&CacheBlock->ListEntry != &CacheDrive->CacheBlockHead)
{
----- DbgPrint((DPRINT_CACHE, "Cache Block: CacheBlock: 0x%x\n", CacheBlock));
----- DbgPrint((DPRINT_CACHE, "Cache Block: Block Number: %d\n", CacheBlock->BlockNumber));
----- DbgPrint((DPRINT_CACHE, "Cache Block: Access Count: %d\n", CacheBlock->AccessCount));
----- DbgPrint((DPRINT_CACHE, "Cache Block: Block Data: 0x%x\n", CacheBlock->BlockData));
----- DbgPrint((DPRINT_CACHE, "Cache Block: Locked In Cache: %d\n", CacheBlock->LockedInCache));
+++++ DPRINTM(DPRINT_CACHE, "Cache Block: CacheBlock: 0x%x\n", CacheBlock);
+++++ DPRINTM(DPRINT_CACHE, "Cache Block: Block Number: %d\n", CacheBlock->BlockNumber);
+++++ DPRINTM(DPRINT_CACHE, "Cache Block: Access Count: %d\n", CacheBlock->AccessCount);
+++++ DPRINTM(DPRINT_CACHE, "Cache Block: Block Data: 0x%x\n", CacheBlock->BlockData);
+++++ DPRINTM(DPRINT_CACHE, "Cache Block: Locked In Cache: %d\n", CacheBlock->LockedInCache);
if (CacheBlock->BlockData == NULL)
{
VOID CacheInternalOptimizeBlockList(PCACHE_DRIVE CacheDrive, PCACHE_BLOCK CacheBlock)
{
----- DbgPrint((DPRINT_CACHE, "CacheInternalOptimizeBlockList()\n"));
+++++ DPRINTM(DPRINT_CACHE, "CacheInternalOptimizeBlockList()\n");
// Don't do this if this block is already at the head of the list
if (&CacheBlock->ListEntry != CacheDrive->CacheBlockHead.Flink)
{
CacheManagerInitialized = FALSE;
----- DbgPrint((DPRINT_CACHE, "CacheBlockCount: %d\n", CacheBlockCount));
----- DbgPrint((DPRINT_CACHE, "CacheSizeLimit: %d\n", CacheSizeLimit));
----- DbgPrint((DPRINT_CACHE, "CacheSizeCurrent: %d\n", CacheSizeCurrent));
+++++ DPRINTM(DPRINT_CACHE, "CacheBlockCount: %d\n", CacheBlockCount);
+++++ DPRINTM(DPRINT_CACHE, "CacheSizeLimit: %d\n", CacheSizeLimit);
+++++ DPRINTM(DPRINT_CACHE, "CacheSizeCurrent: %d\n", CacheSizeCurrent);
//
// Loop through and free the cache blocks
//
CacheManagerInitialized = TRUE;
----- DbgPrint((DPRINT_CACHE, "Initializing BIOS drive 0x%x.\n", DriveNumber));
----- DbgPrint((DPRINT_CACHE, "BytesPerSector: %d.\n", CacheManagerDrive.BytesPerSector));
----- DbgPrint((DPRINT_CACHE, "BlockSize: %d.\n", CacheManagerDrive.BlockSize));
----- DbgPrint((DPRINT_CACHE, "CacheSizeLimit: %d.\n", CacheSizeLimit));
+++++ DPRINTM(DPRINT_CACHE, "Initializing BIOS drive 0x%x.\n", DriveNumber);
+++++ DPRINTM(DPRINT_CACHE, "BytesPerSector: %d.\n", CacheManagerDrive.BytesPerSector);
+++++ DPRINTM(DPRINT_CACHE, "BlockSize: %d.\n", CacheManagerDrive.BlockSize);
+++++ DPRINTM(DPRINT_CACHE, "CacheSizeLimit: %d.\n", CacheSizeLimit);
return TRUE;
}
ULONG BlockCount;
ULONG Idx;
----- DbgPrint((DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer));
+++++ DPRINTM(DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer);
// If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE)
EndBlock = (StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize;
SectorOffsetInEndBlock = 1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize;
BlockCount = (EndBlock - StartBlock) + 1;
----- DbgPrint((DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount));
+++++ DPRINTM(DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount);
//
// Read the first block into the buffer
RtlCopyMemory(Buffer,
(PVOID)((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)),
(CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
----- DbgPrint((DPRINT_CACHE, "1 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, ((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)), (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector)));
+++++ DPRINTM(DPRINT_CACHE, "1 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, ((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)), (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
//
// Update the buffer address
RtlCopyMemory(Buffer,
CacheBlock->BlockData,
CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector);
----- DbgPrint((DPRINT_CACHE, "2 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector));
+++++ DPRINTM(DPRINT_CACHE, "2 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector);
//
// Update the buffer address
RtlCopyMemory(Buffer,
CacheBlock->BlockData,
SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector);
----- DbgPrint((DPRINT_CACHE, "3 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector));
+++++ DPRINTM(DPRINT_CACHE, "3 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector);
//
// Update the buffer address
ULONG BlockCount;
ULONG Idx;
----- DbgPrint((DPRINT_CACHE, "CacheForceDiskSectorsIntoCache() DiskNumber: 0x%x StartSector: %d SectorCount: %d\n", DiskNumber, StartSector, SectorCount));
+++++ DPRINTM(DPRINT_CACHE, "CacheForceDiskSectorsIntoCache() DiskNumber: 0x%x StartSector: %d SectorCount: %d\n", DiskNumber, StartSector, SectorCount);
// If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE)
{
ULONG AmountReleased;
----- DbgPrint((DPRINT_CACHE, "CacheReleaseMemory() MinimumAmountToRelease = %d\n", MinimumAmountToRelease));
+++++ DPRINTM(DPRINT_CACHE, "CacheReleaseMemory() MinimumAmountToRelease = %d\n", MinimumAmountToRelease);
// If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE)
#elif defined (DEBUG_REACTOS)
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
#elif defined (DEBUG_CUSTOM)
-----ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY |
----- DPRINT_REACTOS | DPRINT_WINDOWS | DPRINT_HWDETECT;
+++++ULONG DebugPrintMask = DPRINT_WARNING |
+++++ DPRINT_UI | DPRINT_CACHE | DPRINT_REACTOS |
+++++ DPRINT_LINUX;
#else //#elif defined (DEBUG_NONE)
ULONG DebugPrintMask = 0;
#endif
}
}
+++++ULONG
+++++DbgPrint(const char *Format, ...)
+++++{
+++++ va_list ap;
+++++ CHAR Buffer[512];
+++++ ULONG Length;
+++++ char *ptr = Buffer;
+++++
+++++ va_start(ap, Format);
+++++
+++++ /* Construct a string */
+++++ Length = _vsnprintf(Buffer, 512, Format, ap);
+++++
+++++ /* Check if we went past the buffer */
+++++ if (Length == -1)
+++++ {
+++++ /* Terminate it if we went over-board */
+++++ Buffer[sizeof(Buffer) - 1] = '\n';
+++++
+++++ /* Put maximum */
+++++ Length = sizeof(Buffer);
+++++ }
+++++
+++++ while (*ptr)
+++++ {
+++++ DebugPrintChar(*ptr++);
+++++ }
+++++
+++++ va_end(ap);
+++++ return 0;
+++++}
+++++
VOID DebugPrintHeader(ULONG Mask)
{
/* No header */
switch (Mask)
{
case DPRINT_WARNING:
----- DebugPrintChar('W');
----- DebugPrintChar('A');
----- DebugPrintChar('R');
----- DebugPrintChar('N');
----- DebugPrintChar('I');
----- DebugPrintChar('N');
----- DebugPrintChar('G');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("WARNING: ");
break;
case DPRINT_MEMORY:
----- DebugPrintChar('M');
----- DebugPrintChar('E');
----- DebugPrintChar('M');
----- DebugPrintChar('O');
----- DebugPrintChar('R');
----- DebugPrintChar('Y');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("MEMORY: ");
break;
case DPRINT_FILESYSTEM:
----- DebugPrintChar('F');
----- DebugPrintChar('I');
----- DebugPrintChar('L');
----- DebugPrintChar('E');
----- DebugPrintChar('S');
----- DebugPrintChar('Y');
----- DebugPrintChar('S');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("FILESYS: ");
break;
case DPRINT_INIFILE:
----- DebugPrintChar('I');
----- DebugPrintChar('N');
----- DebugPrintChar('I');
----- DebugPrintChar('F');
----- DebugPrintChar('I');
----- DebugPrintChar('L');
----- DebugPrintChar('E');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("INIFILE: ");
break;
case DPRINT_UI:
----- DebugPrintChar('U');
----- DebugPrintChar('I');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("UI: ");
break;
case DPRINT_DISK:
----- DebugPrintChar('D');
----- DebugPrintChar('I');
----- DebugPrintChar('S');
----- DebugPrintChar('K');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("DISK: ");
break;
case DPRINT_CACHE:
----- DebugPrintChar('C');
----- DebugPrintChar('A');
----- DebugPrintChar('C');
----- DebugPrintChar('H');
----- DebugPrintChar('E');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("CACHE: ");
break;
case DPRINT_REGISTRY:
----- DebugPrintChar('R');
----- DebugPrintChar('E');
----- DebugPrintChar('G');
----- DebugPrintChar('I');
----- DebugPrintChar('S');
----- DebugPrintChar('T');
----- DebugPrintChar('R');
----- DebugPrintChar('Y');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("REGISTER: ");
break;
case DPRINT_REACTOS:
----- DebugPrintChar('R');
----- DebugPrintChar('E');
----- DebugPrintChar('A');
----- DebugPrintChar('C');
----- DebugPrintChar('T');
----- DebugPrintChar('O');
----- DebugPrintChar('S');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("REACTOS: ");
break;
case DPRINT_LINUX:
----- DebugPrintChar('L');
----- DebugPrintChar('I');
----- DebugPrintChar('N');
----- DebugPrintChar('U');
----- DebugPrintChar('X');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("LINUX: ");
break;
case DPRINT_WINDOWS:
----- DebugPrintChar('W');
----- DebugPrintChar('I');
----- DebugPrintChar('N');
----- DebugPrintChar('L');
----- DebugPrintChar('D');
----- DebugPrintChar('R');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("WINLDR: ");
break;
case DPRINT_HWDETECT:
----- DebugPrintChar('H');
----- DebugPrintChar('W');
----- DebugPrintChar('D');
----- DebugPrintChar('E');
----- DebugPrintChar('T');
----- DebugPrintChar('E');
----- DebugPrintChar('C');
----- DebugPrintChar('T');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("HWDETECT: ");
break;
default:
----- DebugPrintChar('U');
----- DebugPrintChar('N');
----- DebugPrintChar('K');
----- DebugPrintChar('N');
----- DebugPrintChar('O');
----- DebugPrintChar('W');
----- DebugPrintChar('N');
----- DebugPrintChar(':');
----- DebugPrintChar(' ');
+++++ DbgPrint("UNKNOWN: ");
break;
}
}
-----VOID DebugPrint(ULONG Mask, char *format, ...)
+++++char* g_file;
+++++int g_line;
+++++
+++++VOID DbgPrintMask(ULONG Mask, char *format, ...)
{
va_list ap;
-- - char Buffer[4096];
++ + char Buffer[2096];
char *ptr = Buffer;
// Mask out unwanted debug messages
// Print the header if we have started a new line
if (DebugStartOfLine)
{
+++++ DbgPrint("(%s:%d) ", g_file, g_line);
DebugPrintHeader(Mask);
DebugStartOfLine = FALSE;
}
}
}
-----VOID DebugPrint1(char *format, ...)
-----{
----- va_list ap;
-- - char Buffer[4096];
- - char Buffer[2096];
----- char *ptr = Buffer;
-----
----- va_start(ap, format);
----- vsprintf(Buffer, format, ap);
----- va_end(ap);
----- while (*ptr)
----- {
----- DebugPrintChar(*ptr++);
----- }
-----}
-----
VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
{
PUCHAR BufPtr = (PUCHAR)Buffer;
}
DebugStartOfLine = FALSE; // We don't want line headers
----- DebugPrint(Mask, "Dumping buffer at 0x%x with length of %d bytes:\n", Buffer, Length);
+++++ DbgPrintMask(Mask, "Dumping buffer at 0x%x with length of %d bytes:\n", Buffer, Length);
for (Idx=0; Idx<Length; )
{
if (Idx < 0x0010)
{
----- DebugPrint(Mask, "000%x:\t", Idx);
+++++ DbgPrintMask(Mask, "000%x:\t", Idx);
}
else if (Idx < 0x0100)
{
----- DebugPrint(Mask, "00%x:\t", Idx);
+++++ DbgPrintMask(Mask, "00%x:\t", Idx);
}
else if (Idx < 0x1000)
{
----- DebugPrint(Mask, "0%x:\t", Idx);
+++++ DbgPrintMask(Mask, "0%x:\t", Idx);
}
else
{
----- DebugPrint(Mask, "%x:\t", Idx);
+++++ DbgPrintMask(Mask, "%x:\t", Idx);
}
for (Idx2=0; Idx2<16; Idx2++,Idx++)
{
if (BufPtr[Idx] < 0x10)
{
----- DebugPrint(Mask, "0");
+++++ DbgPrintMask(Mask, "0");
}
----- DebugPrint(Mask, "%x", BufPtr[Idx]);
+++++ DbgPrintMask(Mask, "%x", BufPtr[Idx]);
if (Idx2 == 7)
{
----- DebugPrint(Mask, "-");
+++++ DbgPrintMask(Mask, "-");
}
else
{
----- DebugPrint(Mask, " ");
+++++ DbgPrintMask(Mask, " ");
}
}
Idx -= 16;
----- DebugPrint(Mask, " ");
+++++ DbgPrintMask(Mask, " ");
for (Idx2=0; Idx2<16; Idx2++,Idx++)
{
if ((BufPtr[Idx] > 20) && (BufPtr[Idx] < 0x80))
{
----- DebugPrint(Mask, "%c", BufPtr[Idx]);
+++++ DbgPrintMask(Mask, "%c", BufPtr[Idx]);
}
else
{
----- DebugPrint(Mask, ".");
+++++ DbgPrintMask(Mask, ".");
}
}
----- DebugPrint(Mask, "\n");
+++++ DbgPrintMask(Mask, "\n");
}
}
#else
-----VOID DebugPrint(ULONG Mask, char *format, ...)
+++++VOID DbgPrintMask(ULONG Mask, char *format, ...)
{
}
#endif // defined DBG
+++++
+++++ULONG
+++++MsgBoxPrint(const char *Format, ...)
+++++{
+++++ va_list ap;
+++++ CHAR Buffer[512];
+++++ ULONG Length;
+++++
+++++ va_start(ap, Format);
+++++
+++++ /* Construct a string */
+++++ Length = _vsnprintf(Buffer, 512, Format, ap);
+++++
+++++ /* Check if we went past the buffer */
+++++ if (Length == -1U)
+++++ {
+++++ /* Terminate it if we went over-board */
+++++ Buffer[sizeof(Buffer) - 1] = '\n';
+++++
+++++ /* Put maximum */
+++++ Length = sizeof(Buffer);
+++++ }
+++++
+++++ /* Show it as a message box */
+++++ UiMessageBox(Buffer);
+++++
+++++ /* Cleanup and exit */
+++++ va_end(ap);
+++++ return 0;
+++++}
+++++
sprintf(ErrorCodeString, "%s\n\nError Code: 0x%lx\nError: %s", ErrorString, ErrorCode, DiskGetErrorCodeString(ErrorCode));
----- DbgPrint((DPRINT_DISK, "%s\n", ErrorCodeString));
+++++ DPRINTM(DPRINT_DISK, "%s\n", ErrorCodeString);
UiMessageBox(ErrorCodeString);
}
UCHAR VolumeType;
ULONG ActivePartition;
----- DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", BootDrive, BootPartition));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", BootDrive, BootPartition);
// Check and see if it is a floppy drive
// If so then just assume FAT12 file system type
if (DiskIsDriveRemovable(BootDrive))
{
----- DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n");
*DriveNumber = BootDrive;
*StartSector = 0;
// Check for ISO9660 file system type
if (BootDrive >= 0x80 && FsRecIsIso9660(BootDrive))
{
----- DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n");
*DriveNumber = BootDrive;
*StartSector = 0;
/* Check for ISO9660 file system type */
if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber))
{
----- DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n");
if (NULL != Device)
{
// Make sure there was only one bootable partition
if (BootablePartitionCount == 0)
{
----- DbgPrint((DPRINT_DISK, "No bootable (active) partitions found.\n"));
+++++ DPRINTM(DPRINT_DISK, "No bootable (active) partitions found.\n");
return FALSE;
}
else if (BootablePartitionCount != 1)
{
----- DbgPrint((DPRINT_DISK, "Too many bootable (active) partitions found.\n"));
+++++ DPRINTM(DPRINT_DISK, "Too many bootable (active) partitions found.\n");
return FALSE;
}
RtlCopyMemory(BootRecord, (PVOID)DISKREADBUFFER, sizeof(MASTER_BOOT_RECORD));
----- DbgPrint((DPRINT_DISK, "Dumping partition table for drive 0x%x:\n", DriveNumber));
----- DbgPrint((DPRINT_DISK, "Boot record logical start sector = %d\n", LogicalSectorNumber));
----- DbgPrint((DPRINT_DISK, "sizeof(MASTER_BOOT_RECORD) = 0x%x.\n", sizeof(MASTER_BOOT_RECORD)));
+++++ DPRINTM(DPRINT_DISK, "Dumping partition table for drive 0x%x:\n", DriveNumber);
+++++ DPRINTM(DPRINT_DISK, "Boot record logical start sector = %d\n", LogicalSectorNumber);
+++++ DPRINTM(DPRINT_DISK, "sizeof(MASTER_BOOT_RECORD) = 0x%x.\n", sizeof(MASTER_BOOT_RECORD));
for (Index=0; Index<4; Index++)
{
----- DbgPrint((DPRINT_DISK, "-------------------------------------------\n"));
----- DbgPrint((DPRINT_DISK, "Partition %d\n", (Index + 1)));
----- DbgPrint((DPRINT_DISK, "BootIndicator: 0x%x\n", BootRecord->PartitionTable[Index].BootIndicator));
----- DbgPrint((DPRINT_DISK, "StartHead: 0x%x\n", BootRecord->PartitionTable[Index].StartHead));
----- DbgPrint((DPRINT_DISK, "StartSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].StartSector));
----- DbgPrint((DPRINT_DISK, "StartCylinder: 0x%x\n", BootRecord->PartitionTable[Index].StartCylinder));
----- DbgPrint((DPRINT_DISK, "SystemIndicator: 0x%x\n", BootRecord->PartitionTable[Index].SystemIndicator));
----- DbgPrint((DPRINT_DISK, "EndHead: 0x%x\n", BootRecord->PartitionTable[Index].EndHead));
----- DbgPrint((DPRINT_DISK, "EndSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].EndSector));
----- DbgPrint((DPRINT_DISK, "EndCylinder: 0x%x\n", BootRecord->PartitionTable[Index].EndCylinder));
----- DbgPrint((DPRINT_DISK, "SectorCountBeforePartition: 0x%x\n", BootRecord->PartitionTable[Index].SectorCountBeforePartition));
----- DbgPrint((DPRINT_DISK, "PartitionSectorCount: 0x%x\n", BootRecord->PartitionTable[Index].PartitionSectorCount));
+++++ DPRINTM(DPRINT_DISK, "-------------------------------------------\n");
+++++ DPRINTM(DPRINT_DISK, "Partition %d\n", (Index + 1));
+++++ DPRINTM(DPRINT_DISK, "BootIndicator: 0x%x\n", BootRecord->PartitionTable[Index].BootIndicator);
+++++ DPRINTM(DPRINT_DISK, "StartHead: 0x%x\n", BootRecord->PartitionTable[Index].StartHead);
+++++ DPRINTM(DPRINT_DISK, "StartSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].StartSector);
+++++ DPRINTM(DPRINT_DISK, "StartCylinder: 0x%x\n", BootRecord->PartitionTable[Index].StartCylinder);
+++++ DPRINTM(DPRINT_DISK, "SystemIndicator: 0x%x\n", BootRecord->PartitionTable[Index].SystemIndicator);
+++++ DPRINTM(DPRINT_DISK, "EndHead: 0x%x\n", BootRecord->PartitionTable[Index].EndHead);
+++++ DPRINTM(DPRINT_DISK, "EndSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].EndSector);
+++++ DPRINTM(DPRINT_DISK, "EndCylinder: 0x%x\n", BootRecord->PartitionTable[Index].EndCylinder);
+++++ DPRINTM(DPRINT_DISK, "SectorCountBeforePartition: 0x%x\n", BootRecord->PartitionTable[Index].SectorCountBeforePartition);
+++++ DPRINTM(DPRINT_DISK, "PartitionSectorCount: 0x%x\n", BootRecord->PartitionTable[Index].PartitionSectorCount);
}
// Check the partition table magic value
DriveMapList.DriveMap[(DriveMapList.DriveMapCount * 2)+1] = DriveMapGetBiosDriveNumber(Drive2);
DriveMapList.DriveMapCount++;
----- DbgPrint((DPRINT_WARNING, "Mapping BIOS drive 0x%x to drive 0x%x\n", DriveMapGetBiosDriveNumber(Drive1), DriveMapGetBiosDriveNumber(Drive2)));
+++++ DPRINTM(DPRINT_WARNING, "Mapping BIOS drive 0x%x to drive 0x%x\n", DriveMapGetBiosDriveNumber(Drive1), DriveMapGetBiosDriveNumber(Drive2));
}
}
}
if (DriveMapList.DriveMapCount)
{
----- DbgPrint((DPRINT_WARNING, "Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount));
+++++ DPRINTM(DPRINT_WARNING, "Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount);
DriveMapInstallInt13Handler(&DriveMapList);
}
else
{
----- DbgPrint((DPRINT_WARNING, "Removing any previously installed Int13 drive map.\n"));
+++++ DPRINTM(DPRINT_WARNING, "Removing any previously installed Int13 drive map.\n");
DriveMapRemoveInt13Handler();
}
}
DebugInit();
----- DbgPrint((DPRINT_WARNING, "BootMain() called.\n"));
+++++ DPRINTM(DPRINT_WARNING, "BootMain() called.\n");
if (!UiInitialize(FALSE))
{
<file>versuart.c</file>
</if>
</directory>
---- <file>_alloca.S</file>
---- <file>mach.c</file>
+
+ <if property="ARCH" value="amd64">
+ <directory name="amd64">
---- <file>i386disk.c</file>
+++++ <file>loader.c</file>
+++++ </directory>
+++++ <directory name="i386">
+ <file>hardware.c</file>
+ <file>hwacpi.c</file>
+ <file>hwapm.c</file>
+ <file>hwpci.c</file>
- - <file>loader.c</file>
+ <file>i386rtl.c</file>
+++++ <file>i386disk.c</file>
+ <file>i386vid.c</file>
+++++ <file>machpc.c</file>
+ <file>pccons.c</file>
+ <file>pcdisk.c</file>
+ <file>pcmem.c</file>
+ <file>pcrtc.c</file>
+ <file>pcvideo.c</file>
+ </directory>
+ </if>
+
</directory>
</module>
BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount)
{
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2OpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2OpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector);
// Store the drive number and start sector
Ext2DriveNumber = DriveNumber;
CHAR FullPath[EXT3_NAME_LEN * 2];
ULONG Index;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName);
RtlZeroMemory(SymLinkPath, EXT3_NAME_LEN);
// and re-call this function
if ((TempExt2FileInfo.Inode.i_mode & EXT2_S_IFMT) == EXT2_S_IFLNK)
{
----- DbgPrint((DPRINT_FILESYSTEM, "File is a symbolic link\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "File is a symbolic link\n");
// Now read in the symbolic link path
if (!Ext2ReadFileBig(&TempExt2FileInfo, TempExt2FileInfo.FileSize, NULL, SymLinkPath))
return NULL;
}
----- DbgPrint((DPRINT_FILESYSTEM, "Symbolic link path = %s\n", SymLinkPath));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Symbolic link path = %s\n", SymLinkPath);
// Get the full path
if (SymLinkPath[0] == '/' || SymLinkPath[0] == '\\')
strcat(FullPath, SymLinkPath);
}
----- DbgPrint((DPRINT_FILESYSTEM, "Full file path = %s\n", FullPath));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Full file path = %s\n", FullPath);
if (TempExt2FileInfo.FileBlockList != NULL)
{
EXT2_INODE InodeData;
EXT2_DIR_ENTRY DirectoryEntry;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2LookupFile() FileName = %s\n", FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2LookupFile() FileName = %s\n", FileName);
RtlZeroMemory(Ext2FileInfoPointer, sizeof(EXT2_FILE_INFO));
ULONG CurrentOffset;
PEXT2_DIR_ENTRY CurrentDirectoryEntry;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2SearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectorySize = %d FileName = %s\n", DirectoryBuffer, DirectorySize, FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2SearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectorySize = %d FileName = %s\n", DirectoryBuffer, DirectorySize, FileName);
for (CurrentOffset=0; CurrentOffset<DirectorySize; )
{
return FALSE;
}
----- DbgPrint((DPRINT_FILESYSTEM, "Dumping directory entry at offset %d:\n", CurrentOffset));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Dumping directory entry at offset %d:\n", CurrentOffset);
DbgDumpBuffer(DPRINT_FILESYSTEM, CurrentDirectoryEntry, CurrentDirectoryEntry->rec_len);
if ((_strnicmp(FileName, CurrentDirectoryEntry->name, CurrentDirectoryEntry->name_len) == 0) &&
{
RtlCopyMemory(DirectoryEntry, CurrentDirectoryEntry, sizeof(EXT2_DIR_ENTRY));
----- DbgPrint((DPRINT_FILESYSTEM, "EXT2 Directory Entry:\n"));
----- DbgPrint((DPRINT_FILESYSTEM, "inode = %d\n", DirectoryEntry->inode));
----- DbgPrint((DPRINT_FILESYSTEM, "rec_len = %d\n", DirectoryEntry->rec_len));
----- DbgPrint((DPRINT_FILESYSTEM, "name_len = %d\n", DirectoryEntry->name_len));
----- DbgPrint((DPRINT_FILESYSTEM, "file_type = %d\n", DirectoryEntry->file_type));
----- DbgPrint((DPRINT_FILESYSTEM, "name = "));
+++++ DPRINTM(DPRINT_FILESYSTEM, "EXT2 Directory Entry:\n");
+++++ DPRINTM(DPRINT_FILESYSTEM, "inode = %d\n", DirectoryEntry->inode);
+++++ DPRINTM(DPRINT_FILESYSTEM, "rec_len = %d\n", DirectoryEntry->rec_len);
+++++ DPRINTM(DPRINT_FILESYSTEM, "name_len = %d\n", DirectoryEntry->name_len);
+++++ DPRINTM(DPRINT_FILESYSTEM, "file_type = %d\n", DirectoryEntry->file_type);
+++++ DPRINTM(DPRINT_FILESYSTEM, "name = ");
for (CurrentOffset=0; CurrentOffset<DirectoryEntry->name_len; CurrentOffset++)
{
----- DbgPrint((DPRINT_FILESYSTEM, "%c", DirectoryEntry->name[CurrentOffset]));
+++++ DPRINTM(DPRINT_FILESYSTEM, "%c", DirectoryEntry->name[CurrentOffset]);
}
----- DbgPrint((DPRINT_FILESYSTEM, "\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "\n");
return TRUE;
}
ULONG LengthInBlock;
ULONG NumberOfBlocks;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadFileBig() BytesToRead = %d Buffer = 0x%x\n", (ULONG)BytesToRead, Buffer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadFileBig() BytesToRead = %d Buffer = 0x%x\n", (ULONG)BytesToRead, Buffer);
if (BytesRead != NULL)
{
if (((Ext2FileInfo->Inode.i_mode & EXT2_S_IFMT) == EXT2_S_IFLNK) &&
(Ext2FileInfo->FileSize <= FAST_SYMLINK_MAX_NAME_SIZE))
{
----- DbgPrint((DPRINT_FILESYSTEM, "Reading fast symbolic link data\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Reading fast symbolic link data\n");
// Copy the data from the link
RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.i_block), BytesToRead);
{
PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2GetFileSize() FileSize = %d\n", Ext2FileHandle->FileSize));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileSize() FileSize = %d\n", Ext2FileHandle->FileSize);
return Ext2FileHandle->FileSize;
}
{
PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2SetFilePointer() NewFilePointer = %d\n", NewFilePointer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2SetFilePointer() NewFilePointer = %d\n", NewFilePointer);
Ext2FileHandle->FilePointer = NewFilePointer;
}
{
PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2GetFilePointer() FilePointer = %d\n", Ext2FileHandle->FilePointer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFilePointer() FilePointer = %d\n", Ext2FileHandle->FilePointer);
return Ext2FileHandle->FilePointer;
}
BOOLEAN Ext2ReadSuperBlock(VOID)
{
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadSuperBlock()\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadSuperBlock()\n");
//
// Free any memory previously allocated
}
RtlCopyMemory(Ext2SuperBlock, (PVOID)(DISKREADBUFFER + 1024), 1024);
----- DbgPrint((DPRINT_FILESYSTEM, "Dumping super block:\n"));
-----
----- DbgPrint((DPRINT_FILESYSTEM, "s_inodes_count: %d\n", Ext2SuperBlock->s_inodes_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_blocks_count: %d\n", Ext2SuperBlock->s_blocks_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_r_blocks_count: %d\n", Ext2SuperBlock->s_r_blocks_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_free_blocks_count: %d\n", Ext2SuperBlock->s_free_blocks_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_free_inodes_count: %d\n", Ext2SuperBlock->s_free_inodes_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_first_data_block: %d\n", Ext2SuperBlock->s_first_data_block));
----- DbgPrint((DPRINT_FILESYSTEM, "s_log_block_size: %d\n", Ext2SuperBlock->s_log_block_size));
----- DbgPrint((DPRINT_FILESYSTEM, "s_log_frag_size: %d\n", Ext2SuperBlock->s_log_frag_size));
----- DbgPrint((DPRINT_FILESYSTEM, "s_blocks_per_group: %d\n", Ext2SuperBlock->s_blocks_per_group));
----- DbgPrint((DPRINT_FILESYSTEM, "s_frags_per_group: %d\n", Ext2SuperBlock->s_frags_per_group));
----- DbgPrint((DPRINT_FILESYSTEM, "s_inodes_per_group: %d\n", Ext2SuperBlock->s_inodes_per_group));
----- DbgPrint((DPRINT_FILESYSTEM, "s_mtime: %d\n", Ext2SuperBlock->s_mtime));
----- DbgPrint((DPRINT_FILESYSTEM, "s_wtime: %d\n", Ext2SuperBlock->s_wtime));
----- DbgPrint((DPRINT_FILESYSTEM, "s_mnt_count: %d\n", Ext2SuperBlock->s_mnt_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_max_mnt_count: %d\n", Ext2SuperBlock->s_max_mnt_count));
----- DbgPrint((DPRINT_FILESYSTEM, "s_magic: 0x%x\n", Ext2SuperBlock->s_magic));
----- DbgPrint((DPRINT_FILESYSTEM, "s_state: %d\n", Ext2SuperBlock->s_state));
----- DbgPrint((DPRINT_FILESYSTEM, "s_errors: %d\n", Ext2SuperBlock->s_errors));
----- DbgPrint((DPRINT_FILESYSTEM, "s_minor_rev_level: %d\n", Ext2SuperBlock->s_minor_rev_level));
----- DbgPrint((DPRINT_FILESYSTEM, "s_lastcheck: %d\n", Ext2SuperBlock->s_lastcheck));
----- DbgPrint((DPRINT_FILESYSTEM, "s_checkinterval: %d\n", Ext2SuperBlock->s_checkinterval));
----- DbgPrint((DPRINT_FILESYSTEM, "s_creator_os: %d\n", Ext2SuperBlock->s_creator_os));
----- DbgPrint((DPRINT_FILESYSTEM, "s_rev_level: %d\n", Ext2SuperBlock->s_rev_level));
----- DbgPrint((DPRINT_FILESYSTEM, "s_def_resuid: %d\n", Ext2SuperBlock->s_def_resuid));
----- DbgPrint((DPRINT_FILESYSTEM, "s_def_resgid: %d\n", Ext2SuperBlock->s_def_resgid));
----- DbgPrint((DPRINT_FILESYSTEM, "s_first_ino: %d\n", Ext2SuperBlock->s_first_ino));
----- DbgPrint((DPRINT_FILESYSTEM, "s_inode_size: %d\n", Ext2SuperBlock->s_inode_size));
----- DbgPrint((DPRINT_FILESYSTEM, "s_block_group_nr: %d\n", Ext2SuperBlock->s_block_group_nr));
----- DbgPrint((DPRINT_FILESYSTEM, "s_feature_compat: 0x%x\n", Ext2SuperBlock->s_feature_compat));
----- DbgPrint((DPRINT_FILESYSTEM, "s_feature_incompat: 0x%x\n", Ext2SuperBlock->s_feature_incompat));
----- DbgPrint((DPRINT_FILESYSTEM, "s_feature_ro_compat: 0x%x\n", Ext2SuperBlock->s_feature_ro_compat));
----- DbgPrint((DPRINT_FILESYSTEM, "s_uuid[16] = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Ext2SuperBlock->s_uuid[0], Ext2SuperBlock->s_uuid[1], Ext2SuperBlock->s_uuid[2], Ext2SuperBlock->s_uuid[3], Ext2SuperBlock->s_uuid[4], Ext2SuperBlock->s_uuid[5], Ext2SuperBlock->s_uuid[6], Ext2SuperBlock->s_uuid[7], Ext2SuperBlock->s_uuid[8], Ext2SuperBlock->s_uuid[9], Ext2SuperBlock->s_uuid[10], Ext2SuperBlock->s_uuid[11], Ext2SuperBlock->s_uuid[12], Ext2SuperBlock->s_uuid[13], Ext2SuperBlock->s_uuid[14], Ext2SuperBlock->s_uuid[15]));
----- DbgPrint((DPRINT_FILESYSTEM, "s_volume_name[16] = '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c'\n", Ext2SuperBlock->s_volume_name[0], Ext2SuperBlock->s_volume_name[1], Ext2SuperBlock->s_volume_name[2], Ext2SuperBlock->s_volume_name[3], Ext2SuperBlock->s_volume_name[4], Ext2SuperBlock->s_volume_name[5], Ext2SuperBlock->s_volume_name[6], Ext2SuperBlock->s_volume_name[7], Ext2SuperBlock->s_volume_name[8], Ext2SuperBlock->s_volume_name[9], Ext2SuperBlock->s_volume_name[10], Ext2SuperBlock->s_volume_name[11], Ext2SuperBlock->s_volume_name[12], Ext2SuperBlock->s_volume_name[13], Ext2SuperBlock->s_volume_name[14], Ext2SuperBlock->s_volume_name[15]));
----- DbgPrint((DPRINT_FILESYSTEM, "s_last_mounted[64]='%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c'\n", Ext2SuperBlock->s_last_mounted[0], Ext2SuperBlock->s_last_mounted[1], Ext2SuperBlock->s_last_mounted[2], Ext2SuperBlock->s_last_mounted[3], Ext2SuperBlock->s_last_mounted[4], Ext2SuperBlock->s_last_mounted[5], Ext2SuperBlock->s_last_mounted[6], Ext2SuperBlock->s_last_mounted[7], Ext2SuperBlock->s_last_mounted[8], Ext2SuperBlock->s_last_mounted[9],
+++++ DPRINTM(DPRINT_FILESYSTEM, "Dumping super block:\n");
+++++
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_inodes_count: %d\n", Ext2SuperBlock->s_inodes_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_blocks_count: %d\n", Ext2SuperBlock->s_blocks_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_r_blocks_count: %d\n", Ext2SuperBlock->s_r_blocks_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_free_blocks_count: %d\n", Ext2SuperBlock->s_free_blocks_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_free_inodes_count: %d\n", Ext2SuperBlock->s_free_inodes_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_first_data_block: %d\n", Ext2SuperBlock->s_first_data_block);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_log_block_size: %d\n", Ext2SuperBlock->s_log_block_size);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_log_frag_size: %d\n", Ext2SuperBlock->s_log_frag_size);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_blocks_per_group: %d\n", Ext2SuperBlock->s_blocks_per_group);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_frags_per_group: %d\n", Ext2SuperBlock->s_frags_per_group);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_inodes_per_group: %d\n", Ext2SuperBlock->s_inodes_per_group);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_mtime: %d\n", Ext2SuperBlock->s_mtime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_wtime: %d\n", Ext2SuperBlock->s_wtime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_mnt_count: %d\n", Ext2SuperBlock->s_mnt_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_max_mnt_count: %d\n", Ext2SuperBlock->s_max_mnt_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_magic: 0x%x\n", Ext2SuperBlock->s_magic);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_state: %d\n", Ext2SuperBlock->s_state);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_errors: %d\n", Ext2SuperBlock->s_errors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_minor_rev_level: %d\n", Ext2SuperBlock->s_minor_rev_level);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_lastcheck: %d\n", Ext2SuperBlock->s_lastcheck);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_checkinterval: %d\n", Ext2SuperBlock->s_checkinterval);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_creator_os: %d\n", Ext2SuperBlock->s_creator_os);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_rev_level: %d\n", Ext2SuperBlock->s_rev_level);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_def_resuid: %d\n", Ext2SuperBlock->s_def_resuid);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_def_resgid: %d\n", Ext2SuperBlock->s_def_resgid);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_first_ino: %d\n", Ext2SuperBlock->s_first_ino);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_inode_size: %d\n", Ext2SuperBlock->s_inode_size);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_block_group_nr: %d\n", Ext2SuperBlock->s_block_group_nr);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_feature_compat: 0x%x\n", Ext2SuperBlock->s_feature_compat);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_feature_incompat: 0x%x\n", Ext2SuperBlock->s_feature_incompat);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_feature_ro_compat: 0x%x\n", Ext2SuperBlock->s_feature_ro_compat);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_uuid[16] = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Ext2SuperBlock->s_uuid[0], Ext2SuperBlock->s_uuid[1], Ext2SuperBlock->s_uuid[2], Ext2SuperBlock->s_uuid[3], Ext2SuperBlock->s_uuid[4], Ext2SuperBlock->s_uuid[5], Ext2SuperBlock->s_uuid[6], Ext2SuperBlock->s_uuid[7], Ext2SuperBlock->s_uuid[8], Ext2SuperBlock->s_uuid[9], Ext2SuperBlock->s_uuid[10], Ext2SuperBlock->s_uuid[11], Ext2SuperBlock->s_uuid[12], Ext2SuperBlock->s_uuid[13], Ext2SuperBlock->s_uuid[14], Ext2SuperBlock->s_uuid[15]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_volume_name[16] = '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c'\n", Ext2SuperBlock->s_volume_name[0], Ext2SuperBlock->s_volume_name[1], Ext2SuperBlock->s_volume_name[2], Ext2SuperBlock->s_volume_name[3], Ext2SuperBlock->s_volume_name[4], Ext2SuperBlock->s_volume_name[5], Ext2SuperBlock->s_volume_name[6], Ext2SuperBlock->s_volume_name[7], Ext2SuperBlock->s_volume_name[8], Ext2SuperBlock->s_volume_name[9], Ext2SuperBlock->s_volume_name[10], Ext2SuperBlock->s_volume_name[11], Ext2SuperBlock->s_volume_name[12], Ext2SuperBlock->s_volume_name[13], Ext2SuperBlock->s_volume_name[14], Ext2SuperBlock->s_volume_name[15]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_last_mounted[64]='%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c'\n", Ext2SuperBlock->s_last_mounted[0], Ext2SuperBlock->s_last_mounted[1], Ext2SuperBlock->s_last_mounted[2], Ext2SuperBlock->s_last_mounted[3], Ext2SuperBlock->s_last_mounted[4], Ext2SuperBlock->s_last_mounted[5], Ext2SuperBlock->s_last_mounted[6], Ext2SuperBlock->s_last_mounted[7], Ext2SuperBlock->s_last_mounted[8], Ext2SuperBlock->s_last_mounted[9],
Ext2SuperBlock->s_last_mounted[10], Ext2SuperBlock->s_last_mounted[11], Ext2SuperBlock->s_last_mounted[12], Ext2SuperBlock->s_last_mounted[13], Ext2SuperBlock->s_last_mounted[14], Ext2SuperBlock->s_last_mounted[15], Ext2SuperBlock->s_last_mounted[16], Ext2SuperBlock->s_last_mounted[17], Ext2SuperBlock->s_last_mounted[18], Ext2SuperBlock->s_last_mounted[19],
Ext2SuperBlock->s_last_mounted[20], Ext2SuperBlock->s_last_mounted[21], Ext2SuperBlock->s_last_mounted[22], Ext2SuperBlock->s_last_mounted[23], Ext2SuperBlock->s_last_mounted[24], Ext2SuperBlock->s_last_mounted[25], Ext2SuperBlock->s_last_mounted[26], Ext2SuperBlock->s_last_mounted[27], Ext2SuperBlock->s_last_mounted[28], Ext2SuperBlock->s_last_mounted[29],
Ext2SuperBlock->s_last_mounted[30], Ext2SuperBlock->s_last_mounted[31], Ext2SuperBlock->s_last_mounted[32], Ext2SuperBlock->s_last_mounted[33], Ext2SuperBlock->s_last_mounted[34], Ext2SuperBlock->s_last_mounted[35], Ext2SuperBlock->s_last_mounted[36], Ext2SuperBlock->s_last_mounted[37], Ext2SuperBlock->s_last_mounted[38], Ext2SuperBlock->s_last_mounted[39],
Ext2SuperBlock->s_last_mounted[40], Ext2SuperBlock->s_last_mounted[41], Ext2SuperBlock->s_last_mounted[42], Ext2SuperBlock->s_last_mounted[43], Ext2SuperBlock->s_last_mounted[44], Ext2SuperBlock->s_last_mounted[45], Ext2SuperBlock->s_last_mounted[46], Ext2SuperBlock->s_last_mounted[47], Ext2SuperBlock->s_last_mounted[48], Ext2SuperBlock->s_last_mounted[49],
Ext2SuperBlock->s_last_mounted[50], Ext2SuperBlock->s_last_mounted[51], Ext2SuperBlock->s_last_mounted[52], Ext2SuperBlock->s_last_mounted[53], Ext2SuperBlock->s_last_mounted[54], Ext2SuperBlock->s_last_mounted[55], Ext2SuperBlock->s_last_mounted[56], Ext2SuperBlock->s_last_mounted[57], Ext2SuperBlock->s_last_mounted[58], Ext2SuperBlock->s_last_mounted[59],
----- Ext2SuperBlock->s_last_mounted[60], Ext2SuperBlock->s_last_mounted[61], Ext2SuperBlock->s_last_mounted[62], Ext2SuperBlock->s_last_mounted[63]));
----- DbgPrint((DPRINT_FILESYSTEM, "s_algorithm_usage_bitmap = 0x%x\n", Ext2SuperBlock->s_algorithm_usage_bitmap));
----- DbgPrint((DPRINT_FILESYSTEM, "s_prealloc_blocks = %d\n", Ext2SuperBlock->s_prealloc_blocks));
----- DbgPrint((DPRINT_FILESYSTEM, "s_prealloc_dir_blocks = %d\n", Ext2SuperBlock->s_prealloc_dir_blocks));
----- DbgPrint((DPRINT_FILESYSTEM, "s_padding1 = %d\n", Ext2SuperBlock->s_padding1));
----- DbgPrint((DPRINT_FILESYSTEM, "s_journal_uuid[16] = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Ext2SuperBlock->s_journal_uuid[0], Ext2SuperBlock->s_journal_uuid[1], Ext2SuperBlock->s_journal_uuid[2], Ext2SuperBlock->s_journal_uuid[3], Ext2SuperBlock->s_journal_uuid[4], Ext2SuperBlock->s_journal_uuid[5], Ext2SuperBlock->s_journal_uuid[6], Ext2SuperBlock->s_journal_uuid[7], Ext2SuperBlock->s_journal_uuid[8], Ext2SuperBlock->s_journal_uuid[9], Ext2SuperBlock->s_journal_uuid[10], Ext2SuperBlock->s_journal_uuid[11], Ext2SuperBlock->s_journal_uuid[12], Ext2SuperBlock->s_journal_uuid[13], Ext2SuperBlock->s_journal_uuid[14], Ext2SuperBlock->s_journal_uuid[15]));
----- DbgPrint((DPRINT_FILESYSTEM, "s_journal_inum = %d\n", Ext2SuperBlock->s_journal_inum));
----- DbgPrint((DPRINT_FILESYSTEM, "s_journal_dev = %d\n", Ext2SuperBlock->s_journal_dev));
----- DbgPrint((DPRINT_FILESYSTEM, "s_last_orphan = %d\n", Ext2SuperBlock->s_last_orphan));
+++++ Ext2SuperBlock->s_last_mounted[60], Ext2SuperBlock->s_last_mounted[61], Ext2SuperBlock->s_last_mounted[62], Ext2SuperBlock->s_last_mounted[63]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_algorithm_usage_bitmap = 0x%x\n", Ext2SuperBlock->s_algorithm_usage_bitmap);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_prealloc_blocks = %d\n", Ext2SuperBlock->s_prealloc_blocks);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_prealloc_dir_blocks = %d\n", Ext2SuperBlock->s_prealloc_dir_blocks);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_padding1 = %d\n", Ext2SuperBlock->s_padding1);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_journal_uuid[16] = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", Ext2SuperBlock->s_journal_uuid[0], Ext2SuperBlock->s_journal_uuid[1], Ext2SuperBlock->s_journal_uuid[2], Ext2SuperBlock->s_journal_uuid[3], Ext2SuperBlock->s_journal_uuid[4], Ext2SuperBlock->s_journal_uuid[5], Ext2SuperBlock->s_journal_uuid[6], Ext2SuperBlock->s_journal_uuid[7], Ext2SuperBlock->s_journal_uuid[8], Ext2SuperBlock->s_journal_uuid[9], Ext2SuperBlock->s_journal_uuid[10], Ext2SuperBlock->s_journal_uuid[11], Ext2SuperBlock->s_journal_uuid[12], Ext2SuperBlock->s_journal_uuid[13], Ext2SuperBlock->s_journal_uuid[14], Ext2SuperBlock->s_journal_uuid[15]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_journal_inum = %d\n", Ext2SuperBlock->s_journal_inum);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_journal_dev = %d\n", Ext2SuperBlock->s_journal_dev);
+++++ DPRINTM(DPRINT_FILESYSTEM, "s_last_orphan = %d\n", Ext2SuperBlock->s_last_orphan);
//
// Check the super block magic
// Calculate the group count
Ext2GroupCount = (Ext2SuperBlock->s_blocks_count - Ext2SuperBlock->s_first_data_block + Ext2SuperBlock->s_blocks_per_group - 1) / Ext2SuperBlock->s_blocks_per_group;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2GroupCount: %d\n", Ext2GroupCount));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2GroupCount: %d\n", Ext2GroupCount);
// Calculate the block size
Ext2BlockSizeInBytes = 1024 << Ext2SuperBlock->s_log_block_size;
Ext2BlockSizeInSectors = Ext2BlockSizeInBytes / Ext2DiskGeometry.BytesPerSector;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2BlockSizeInBytes: %d\n", Ext2BlockSizeInBytes));
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2BlockSizeInSectors: %d\n", Ext2BlockSizeInSectors));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2BlockSizeInBytes: %d\n", Ext2BlockSizeInBytes);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2BlockSizeInSectors: %d\n", Ext2BlockSizeInSectors);
// Calculate the fragment size
if (Ext2SuperBlock->s_log_frag_size >= 0)
Ext2FragmentSizeInBytes = 1024 >> -(Ext2SuperBlock->s_log_frag_size);
}
Ext2FragmentSizeInSectors = Ext2FragmentSizeInBytes / Ext2DiskGeometry.BytesPerSector;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2FragmentSizeInBytes: %d\n", Ext2FragmentSizeInBytes));
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2FragmentSizeInSectors: %d\n", Ext2FragmentSizeInSectors));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2FragmentSizeInBytes: %d\n", Ext2FragmentSizeInBytes);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2FragmentSizeInSectors: %d\n", Ext2FragmentSizeInSectors);
// Verify that the fragment size and the block size are equal
if (Ext2BlockSizeInBytes != Ext2FragmentSizeInBytes)
// Calculate the number of inodes in one block
Ext2InodesPerBlock = Ext2BlockSizeInBytes / EXT3_INODE_SIZE(Ext2SuperBlock);
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2InodesPerBlock: %d\n", Ext2InodesPerBlock));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2InodesPerBlock: %d\n", Ext2InodesPerBlock);
// Calculate the number of group descriptors in one block
Ext2GroupDescPerBlock = EXT3_DESC_PER_BLOCK(Ext2SuperBlock);
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2GroupDescPerBlock: %d\n", Ext2GroupDescPerBlock));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2GroupDescPerBlock: %d\n", Ext2GroupDescPerBlock);
return TRUE;
}
ULONG GroupDescBlockCount;
ULONG CurrentGroupDescBlock;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptors()\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptors()\n");
//
// Free any memory previously allocated
{
EXT2_FILE_INFO DirectoryFileInfo;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadDirectory() Inode = %d\n", Inode));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadDirectory() Inode = %d\n", Inode);
// Read the directory inode
if (!Ext2ReadInode(Inode, InodePointer))
{
CHAR ErrorString[80];
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer);
// Make sure its a valid block
if (BlockNumber > Ext2SuperBlock->s_blocks_count)
// Check to see if this is a sparse block
if (BlockNumber == 0)
{
----- DbgPrint((DPRINT_FILESYSTEM, "Block is part of a sparse file. Zeroing input buffer.\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Block is part of a sparse file. Zeroing input buffer.\n");
RtlZeroMemory(Buffer, Ext2BlockSizeInBytes);
BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer)
{
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadPartialBlock() BlockNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", BlockNumber, StartingOffset, Length, Buffer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadPartialBlock() BlockNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", BlockNumber, StartingOffset, Length, Buffer);
if (!Ext2ReadBlock(BlockNumber, (PVOID)FILESYSBUFFER))
{
CHAR ErrorString[80];
EXT2_GROUP_DESC GroupDescriptor;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadInode() Inode = %d\n", Inode));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadInode() Inode = %d\n", Inode);
// Make sure its a valid inode
if ((Inode < 1) || (Inode > Ext2SuperBlock->s_inodes_count))
InodeGroupNumber = Ext2GetInodeGroupNumber(Inode);
InodeBlockNumber = Ext2GetInodeBlockNumber(Inode);
InodeOffsetInBlock = Ext2GetInodeOffsetInBlock(Inode);
----- DbgPrint((DPRINT_FILESYSTEM, "InodeGroupNumber = %d\n", InodeGroupNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "InodeBlockNumber = %d\n", InodeBlockNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "InodeOffsetInBlock = %d\n", InodeOffsetInBlock));
+++++ DPRINTM(DPRINT_FILESYSTEM, "InodeGroupNumber = %d\n", InodeGroupNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "InodeBlockNumber = %d\n", InodeBlockNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "InodeOffsetInBlock = %d\n", InodeOffsetInBlock);
// Read the group descriptor
if (!Ext2ReadGroupDescriptor(InodeGroupNumber, &GroupDescriptor))
// Add the start block of the inode table to the inode block number
InodeBlockNumber += GroupDescriptor.bg_inode_table;
----- DbgPrint((DPRINT_FILESYSTEM, "InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber));
+++++ DPRINTM(DPRINT_FILESYSTEM, "InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber);
// Read the block
if (!Ext2ReadBlock(InodeBlockNumber, (PVOID)FILESYSBUFFER))
// Copy the data to their buffer
RtlCopyMemory(InodeBuffer, (PVOID)(ULONG_PTR)(FILESYSBUFFER + (InodeOffsetInBlock * EXT3_INODE_SIZE(Ext2SuperBlock))), sizeof(EXT2_INODE));
----- DbgPrint((DPRINT_FILESYSTEM, "Dumping inode information:\n"));
----- DbgPrint((DPRINT_FILESYSTEM, "i_mode = 0x%x\n", InodeBuffer->i_mode));
----- DbgPrint((DPRINT_FILESYSTEM, "i_uid = %d\n", InodeBuffer->i_uid));
----- DbgPrint((DPRINT_FILESYSTEM, "i_size = %d\n", InodeBuffer->i_size));
----- DbgPrint((DPRINT_FILESYSTEM, "i_atime = %d\n", InodeBuffer->i_atime));
----- DbgPrint((DPRINT_FILESYSTEM, "i_ctime = %d\n", InodeBuffer->i_ctime));
----- DbgPrint((DPRINT_FILESYSTEM, "i_mtime = %d\n", InodeBuffer->i_mtime));
----- DbgPrint((DPRINT_FILESYSTEM, "i_dtime = %d\n", InodeBuffer->i_dtime));
----- DbgPrint((DPRINT_FILESYSTEM, "i_gid = %d\n", InodeBuffer->i_gid));
----- DbgPrint((DPRINT_FILESYSTEM, "i_links_count = %d\n", InodeBuffer->i_links_count));
----- DbgPrint((DPRINT_FILESYSTEM, "i_blocks = %d\n", InodeBuffer->i_blocks));
----- DbgPrint((DPRINT_FILESYSTEM, "i_flags = 0x%x\n", InodeBuffer->i_flags));
----- DbgPrint((DPRINT_FILESYSTEM, "i_block[EXT3_N_BLOCKS (%d)] =\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d\n", EXT3_N_BLOCKS, InodeBuffer->i_block[0], InodeBuffer->i_block[1], InodeBuffer->i_block[2], InodeBuffer->i_block[3], InodeBuffer->i_block[4], InodeBuffer->i_block[5], InodeBuffer->i_block[6], InodeBuffer->i_block[7], InodeBuffer->i_block[8], InodeBuffer->i_block[9], InodeBuffer->i_block[10], InodeBuffer->i_block[11], InodeBuffer->i_block[12], InodeBuffer->i_block[13], InodeBuffer->i_block[14]));
----- DbgPrint((DPRINT_FILESYSTEM, "i_generation = %d\n", InodeBuffer->i_generation));
----- DbgPrint((DPRINT_FILESYSTEM, "i_file_acl = %d\n", InodeBuffer->i_file_acl));
----- DbgPrint((DPRINT_FILESYSTEM, "i_dir_acl = %d\n", InodeBuffer->i_dir_acl));
----- DbgPrint((DPRINT_FILESYSTEM, "i_faddr = %d\n", InodeBuffer->i_faddr));
----- DbgPrint((DPRINT_FILESYSTEM, "l_i_frag = %d\n", InodeBuffer->osd2.linux2.l_i_frag));
----- DbgPrint((DPRINT_FILESYSTEM, "l_i_fsize = %d\n", InodeBuffer->osd2.linux2.l_i_fsize));
----- DbgPrint((DPRINT_FILESYSTEM, "l_i_uid_high = %d\n", InodeBuffer->osd2.linux2.l_i_uid_high));
----- DbgPrint((DPRINT_FILESYSTEM, "l_i_gid_high = %d\n", InodeBuffer->osd2.linux2.l_i_gid_high));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Dumping inode information:\n");
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_mode = 0x%x\n", InodeBuffer->i_mode);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_uid = %d\n", InodeBuffer->i_uid);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_size = %d\n", InodeBuffer->i_size);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_atime = %d\n", InodeBuffer->i_atime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_ctime = %d\n", InodeBuffer->i_ctime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_mtime = %d\n", InodeBuffer->i_mtime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_dtime = %d\n", InodeBuffer->i_dtime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_gid = %d\n", InodeBuffer->i_gid);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_links_count = %d\n", InodeBuffer->i_links_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_blocks = %d\n", InodeBuffer->i_blocks);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_flags = 0x%x\n", InodeBuffer->i_flags);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_block[EXT3_N_BLOCKS (%d)] =\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d,\n%d\n", EXT3_N_BLOCKS, InodeBuffer->i_block[0], InodeBuffer->i_block[1], InodeBuffer->i_block[2], InodeBuffer->i_block[3], InodeBuffer->i_block[4], InodeBuffer->i_block[5], InodeBuffer->i_block[6], InodeBuffer->i_block[7], InodeBuffer->i_block[8], InodeBuffer->i_block[9], InodeBuffer->i_block[10], InodeBuffer->i_block[11], InodeBuffer->i_block[12], InodeBuffer->i_block[13], InodeBuffer->i_block[14]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_generation = %d\n", InodeBuffer->i_generation);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_file_acl = %d\n", InodeBuffer->i_file_acl);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_dir_acl = %d\n", InodeBuffer->i_dir_acl);
+++++ DPRINTM(DPRINT_FILESYSTEM, "i_faddr = %d\n", InodeBuffer->i_faddr);
+++++ DPRINTM(DPRINT_FILESYSTEM, "l_i_frag = %d\n", InodeBuffer->osd2.linux2.l_i_frag);
+++++ DPRINTM(DPRINT_FILESYSTEM, "l_i_fsize = %d\n", InodeBuffer->osd2.linux2.l_i_fsize);
+++++ DPRINTM(DPRINT_FILESYSTEM, "l_i_uid_high = %d\n", InodeBuffer->osd2.linux2.l_i_uid_high);
+++++ DPRINTM(DPRINT_FILESYSTEM, "l_i_gid_high = %d\n", InodeBuffer->osd2.linux2.l_i_gid_high);
return TRUE;
}
BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer)
{
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptor()\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptor()\n");
/*if (!Ext2ReadBlock(Ext2GetGroupDescBlockNumber(Group), (PVOID)FILESYSBUFFER))
{
RtlCopyMemory(GroupBuffer, &Ext2GroupDescriptors[Group], sizeof(EXT2_GROUP_DESC));
----- DbgPrint((DPRINT_FILESYSTEM, "Dumping group descriptor:\n"));
----- DbgPrint((DPRINT_FILESYSTEM, "bg_block_bitmap = %d\n", GroupBuffer->bg_block_bitmap));
----- DbgPrint((DPRINT_FILESYSTEM, "bg_inode_bitmap = %d\n", GroupBuffer->bg_inode_bitmap));
----- DbgPrint((DPRINT_FILESYSTEM, "bg_inode_table = %d\n", GroupBuffer->bg_inode_table));
----- DbgPrint((DPRINT_FILESYSTEM, "bg_free_blocks_count = %d\n", GroupBuffer->bg_free_blocks_count));
----- DbgPrint((DPRINT_FILESYSTEM, "bg_free_inodes_count = %d\n", GroupBuffer->bg_free_inodes_count));
----- DbgPrint((DPRINT_FILESYSTEM, "bg_used_dirs_count = %d\n", GroupBuffer->bg_used_dirs_count));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Dumping group descriptor:\n");
+++++ DPRINTM(DPRINT_FILESYSTEM, "bg_block_bitmap = %d\n", GroupBuffer->bg_block_bitmap);
+++++ DPRINTM(DPRINT_FILESYSTEM, "bg_inode_bitmap = %d\n", GroupBuffer->bg_inode_bitmap);
+++++ DPRINTM(DPRINT_FILESYSTEM, "bg_inode_table = %d\n", GroupBuffer->bg_inode_table);
+++++ DPRINTM(DPRINT_FILESYSTEM, "bg_free_blocks_count = %d\n", GroupBuffer->bg_free_blocks_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "bg_free_inodes_count = %d\n", GroupBuffer->bg_free_inodes_count);
+++++ DPRINTM(DPRINT_FILESYSTEM, "bg_used_dirs_count = %d\n", GroupBuffer->bg_used_dirs_count);
return TRUE;
}
ULONG CurrentBlockInList;
ULONG CurrentBlock;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadBlockPointerList()\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadBlockPointerList()\n");
// Get the number of blocks this file occupies
// I would just use Inode->i_blocks but it
ULONG CurrentBlock;
ULONG BlockPointersPerBlock;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2CopyIndirectBlockPointers() BlockCount = %d\n", BlockCount));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyIndirectBlockPointers() BlockCount = %d\n", BlockCount);
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
ULONG CurrentBlock;
ULONG BlockPointersPerBlock;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2CopyDoubleIndirectBlockPointers() BlockCount = %d\n", BlockCount));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyDoubleIndirectBlockPointers() BlockCount = %d\n", BlockCount);
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
ULONG CurrentBlock;
ULONG BlockPointersPerBlock;
----- DbgPrint((DPRINT_FILESYSTEM, "Ext2CopyTripleIndirectBlockPointers() BlockCount = %d\n", BlockCount));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyTripleIndirectBlockPointers() BlockCount = %d\n", BlockCount);
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
PFAT32_BOOTSECTOR Fat32VolumeBootSector;
PFATX_BOOTSECTOR FatXVolumeBootSector;
----- DbgPrint((DPRINT_FILESYSTEM, "FatOpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatOpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector);
// Store the drive number
FatDriveNumber = DriveNumber;
FatType = FatDetermineFatType(FatVolumeBootSector, PartitionSectorCount);
// Dump boot sector (and swap it for big endian systems)
----- DbgPrint((DPRINT_FILESYSTEM, "Dumping boot sector:\n"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Dumping boot sector:\n");
if (ISFATX(FatType))
{
FatSwapFatXBootSector(FatXVolumeBootSector);
----- DbgPrint((DPRINT_FILESYSTEM, "sizeof(FATX_BOOTSECTOR) = 0x%x.\n", sizeof(FATX_BOOTSECTOR)));
+++++ DPRINTM(DPRINT_FILESYSTEM, "sizeof(FATX_BOOTSECTOR) = 0x%x.\n", sizeof(FATX_BOOTSECTOR));
----- DbgPrint((DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c.\n", FatXVolumeBootSector->FileSystemType[0], FatXVolumeBootSector->FileSystemType[1], FatXVolumeBootSector->FileSystemType[2], FatXVolumeBootSector->FileSystemType[3]));
----- DbgPrint((DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", FatXVolumeBootSector->VolumeSerialNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", FatXVolumeBootSector->SectorsPerCluster));
----- DbgPrint((DPRINT_FILESYSTEM, "NumberOfFats: %d\n", FatXVolumeBootSector->NumberOfFats));
----- DbgPrint((DPRINT_FILESYSTEM, "Unknown: 0x%x\n", FatXVolumeBootSector->Unknown));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c.\n", FatXVolumeBootSector->FileSystemType[0], FatXVolumeBootSector->FileSystemType[1], FatXVolumeBootSector->FileSystemType[2], FatXVolumeBootSector->FileSystemType[3]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", FatXVolumeBootSector->VolumeSerialNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", FatXVolumeBootSector->SectorsPerCluster);
+++++ DPRINTM(DPRINT_FILESYSTEM, "NumberOfFats: %d\n", FatXVolumeBootSector->NumberOfFats);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Unknown: 0x%x\n", FatXVolumeBootSector->Unknown);
----- DbgPrint((DPRINT_FILESYSTEM, "FatType %s\n", FatType == FATX16 ? "FATX16" : "FATX32"));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatType %s\n", FatType == FATX16 ? "FATX16" : "FATX32");
}
else if (FatType == FAT32)
{
FatSwapFat32BootSector(Fat32VolumeBootSector);
----- DbgPrint((DPRINT_FILESYSTEM, "sizeof(FAT32_BOOTSECTOR) = 0x%x.\n", sizeof(FAT32_BOOTSECTOR)));
-----
----- DbgPrint((DPRINT_FILESYSTEM, "JumpBoot: 0x%x 0x%x 0x%x\n", Fat32VolumeBootSector->JumpBoot[0], Fat32VolumeBootSector->JumpBoot[1], Fat32VolumeBootSector->JumpBoot[2]));
----- DbgPrint((DPRINT_FILESYSTEM, "OemName: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->OemName[0], Fat32VolumeBootSector->OemName[1], Fat32VolumeBootSector->OemName[2], Fat32VolumeBootSector->OemName[3], Fat32VolumeBootSector->OemName[4], Fat32VolumeBootSector->OemName[5], Fat32VolumeBootSector->OemName[6], Fat32VolumeBootSector->OemName[7]));
----- DbgPrint((DPRINT_FILESYSTEM, "BytesPerSector: %d\n", Fat32VolumeBootSector->BytesPerSector));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", Fat32VolumeBootSector->SectorsPerCluster));
----- DbgPrint((DPRINT_FILESYSTEM, "ReservedSectors: %d\n", Fat32VolumeBootSector->ReservedSectors));
----- DbgPrint((DPRINT_FILESYSTEM, "NumberOfFats: %d\n", Fat32VolumeBootSector->NumberOfFats));
----- DbgPrint((DPRINT_FILESYSTEM, "RootDirEntries: %d\n", Fat32VolumeBootSector->RootDirEntries));
----- DbgPrint((DPRINT_FILESYSTEM, "TotalSectors: %d\n", Fat32VolumeBootSector->TotalSectors));
----- DbgPrint((DPRINT_FILESYSTEM, "MediaDescriptor: 0x%x\n", Fat32VolumeBootSector->MediaDescriptor));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerFat: %d\n", Fat32VolumeBootSector->SectorsPerFat));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerTrack: %d\n", Fat32VolumeBootSector->SectorsPerTrack));
----- DbgPrint((DPRINT_FILESYSTEM, "NumberOfHeads: %d\n", Fat32VolumeBootSector->NumberOfHeads));
----- DbgPrint((DPRINT_FILESYSTEM, "HiddenSectors: %d\n", Fat32VolumeBootSector->HiddenSectors));
----- DbgPrint((DPRINT_FILESYSTEM, "TotalSectorsBig: %d\n", Fat32VolumeBootSector->TotalSectorsBig));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerFatBig: %d\n", Fat32VolumeBootSector->SectorsPerFatBig));
----- DbgPrint((DPRINT_FILESYSTEM, "ExtendedFlags: 0x%x\n", Fat32VolumeBootSector->ExtendedFlags));
----- DbgPrint((DPRINT_FILESYSTEM, "FileSystemVersion: 0x%x\n", Fat32VolumeBootSector->FileSystemVersion));
----- DbgPrint((DPRINT_FILESYSTEM, "RootDirStartCluster: %d\n", Fat32VolumeBootSector->RootDirStartCluster));
----- DbgPrint((DPRINT_FILESYSTEM, "FsInfo: %d\n", Fat32VolumeBootSector->FsInfo));
----- DbgPrint((DPRINT_FILESYSTEM, "BackupBootSector: %d\n", Fat32VolumeBootSector->BackupBootSector));
----- DbgPrint((DPRINT_FILESYSTEM, "Reserved: 0x%x\n", Fat32VolumeBootSector->Reserved));
----- DbgPrint((DPRINT_FILESYSTEM, "DriveNumber: 0x%x\n", Fat32VolumeBootSector->DriveNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "Reserved1: 0x%x\n", Fat32VolumeBootSector->Reserved1));
----- DbgPrint((DPRINT_FILESYSTEM, "BootSignature: 0x%x\n", Fat32VolumeBootSector->BootSignature));
----- DbgPrint((DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", Fat32VolumeBootSector->VolumeSerialNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->VolumeLabel[0], Fat32VolumeBootSector->VolumeLabel[1], Fat32VolumeBootSector->VolumeLabel[2], Fat32VolumeBootSector->VolumeLabel[3], Fat32VolumeBootSector->VolumeLabel[4], Fat32VolumeBootSector->VolumeLabel[5], Fat32VolumeBootSector->VolumeLabel[6], Fat32VolumeBootSector->VolumeLabel[7], Fat32VolumeBootSector->VolumeLabel[8], Fat32VolumeBootSector->VolumeLabel[9], Fat32VolumeBootSector->VolumeLabel[10]));
----- DbgPrint((DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->FileSystemType[0], Fat32VolumeBootSector->FileSystemType[1], Fat32VolumeBootSector->FileSystemType[2], Fat32VolumeBootSector->FileSystemType[3], Fat32VolumeBootSector->FileSystemType[4], Fat32VolumeBootSector->FileSystemType[5], Fat32VolumeBootSector->FileSystemType[6], Fat32VolumeBootSector->FileSystemType[7]));
----- DbgPrint((DPRINT_FILESYSTEM, "BootSectorMagic: 0x%x\n", Fat32VolumeBootSector->BootSectorMagic));
+++++ DPRINTM(DPRINT_FILESYSTEM, "sizeof(FAT32_BOOTSECTOR) = 0x%x.\n", sizeof(FAT32_BOOTSECTOR));
+++++
+++++ DPRINTM(DPRINT_FILESYSTEM, "JumpBoot: 0x%x 0x%x 0x%x\n", Fat32VolumeBootSector->JumpBoot[0], Fat32VolumeBootSector->JumpBoot[1], Fat32VolumeBootSector->JumpBoot[2]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "OemName: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->OemName[0], Fat32VolumeBootSector->OemName[1], Fat32VolumeBootSector->OemName[2], Fat32VolumeBootSector->OemName[3], Fat32VolumeBootSector->OemName[4], Fat32VolumeBootSector->OemName[5], Fat32VolumeBootSector->OemName[6], Fat32VolumeBootSector->OemName[7]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BytesPerSector: %d\n", Fat32VolumeBootSector->BytesPerSector);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", Fat32VolumeBootSector->SectorsPerCluster);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ReservedSectors: %d\n", Fat32VolumeBootSector->ReservedSectors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "NumberOfFats: %d\n", Fat32VolumeBootSector->NumberOfFats);
+++++ DPRINTM(DPRINT_FILESYSTEM, "RootDirEntries: %d\n", Fat32VolumeBootSector->RootDirEntries);
+++++ DPRINTM(DPRINT_FILESYSTEM, "TotalSectors: %d\n", Fat32VolumeBootSector->TotalSectors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "MediaDescriptor: 0x%x\n", Fat32VolumeBootSector->MediaDescriptor);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerFat: %d\n", Fat32VolumeBootSector->SectorsPerFat);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerTrack: %d\n", Fat32VolumeBootSector->SectorsPerTrack);
+++++ DPRINTM(DPRINT_FILESYSTEM, "NumberOfHeads: %d\n", Fat32VolumeBootSector->NumberOfHeads);
+++++ DPRINTM(DPRINT_FILESYSTEM, "HiddenSectors: %d\n", Fat32VolumeBootSector->HiddenSectors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "TotalSectorsBig: %d\n", Fat32VolumeBootSector->TotalSectorsBig);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerFatBig: %d\n", Fat32VolumeBootSector->SectorsPerFatBig);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ExtendedFlags: 0x%x\n", Fat32VolumeBootSector->ExtendedFlags);
+++++ DPRINTM(DPRINT_FILESYSTEM, "FileSystemVersion: 0x%x\n", Fat32VolumeBootSector->FileSystemVersion);
+++++ DPRINTM(DPRINT_FILESYSTEM, "RootDirStartCluster: %d\n", Fat32VolumeBootSector->RootDirStartCluster);
+++++ DPRINTM(DPRINT_FILESYSTEM, "FsInfo: %d\n", Fat32VolumeBootSector->FsInfo);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BackupBootSector: %d\n", Fat32VolumeBootSector->BackupBootSector);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Reserved: 0x%x\n", Fat32VolumeBootSector->Reserved);
+++++ DPRINTM(DPRINT_FILESYSTEM, "DriveNumber: 0x%x\n", Fat32VolumeBootSector->DriveNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Reserved1: 0x%x\n", Fat32VolumeBootSector->Reserved1);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BootSignature: 0x%x\n", Fat32VolumeBootSector->BootSignature);
+++++ DPRINTM(DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", Fat32VolumeBootSector->VolumeSerialNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->VolumeLabel[0], Fat32VolumeBootSector->VolumeLabel[1], Fat32VolumeBootSector->VolumeLabel[2], Fat32VolumeBootSector->VolumeLabel[3], Fat32VolumeBootSector->VolumeLabel[4], Fat32VolumeBootSector->VolumeLabel[5], Fat32VolumeBootSector->VolumeLabel[6], Fat32VolumeBootSector->VolumeLabel[7], Fat32VolumeBootSector->VolumeLabel[8], Fat32VolumeBootSector->VolumeLabel[9], Fat32VolumeBootSector->VolumeLabel[10]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->FileSystemType[0], Fat32VolumeBootSector->FileSystemType[1], Fat32VolumeBootSector->FileSystemType[2], Fat32VolumeBootSector->FileSystemType[3], Fat32VolumeBootSector->FileSystemType[4], Fat32VolumeBootSector->FileSystemType[5], Fat32VolumeBootSector->FileSystemType[6], Fat32VolumeBootSector->FileSystemType[7]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BootSectorMagic: 0x%x\n", Fat32VolumeBootSector->BootSectorMagic);
}
else
{
FatSwapFatBootSector(FatVolumeBootSector);
----- DbgPrint((DPRINT_FILESYSTEM, "sizeof(FAT_BOOTSECTOR) = 0x%x.\n", sizeof(FAT_BOOTSECTOR)));
-----
----- DbgPrint((DPRINT_FILESYSTEM, "JumpBoot: 0x%x 0x%x 0x%x\n", FatVolumeBootSector->JumpBoot[0], FatVolumeBootSector->JumpBoot[1], FatVolumeBootSector->JumpBoot[2]));
----- DbgPrint((DPRINT_FILESYSTEM, "OemName: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->OemName[0], FatVolumeBootSector->OemName[1], FatVolumeBootSector->OemName[2], FatVolumeBootSector->OemName[3], FatVolumeBootSector->OemName[4], FatVolumeBootSector->OemName[5], FatVolumeBootSector->OemName[6], FatVolumeBootSector->OemName[7]));
----- DbgPrint((DPRINT_FILESYSTEM, "BytesPerSector: %d\n", FatVolumeBootSector->BytesPerSector));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", FatVolumeBootSector->SectorsPerCluster));
----- DbgPrint((DPRINT_FILESYSTEM, "ReservedSectors: %d\n", FatVolumeBootSector->ReservedSectors));
----- DbgPrint((DPRINT_FILESYSTEM, "NumberOfFats: %d\n", FatVolumeBootSector->NumberOfFats));
----- DbgPrint((DPRINT_FILESYSTEM, "RootDirEntries: %d\n", FatVolumeBootSector->RootDirEntries));
----- DbgPrint((DPRINT_FILESYSTEM, "TotalSectors: %d\n", FatVolumeBootSector->TotalSectors));
----- DbgPrint((DPRINT_FILESYSTEM, "MediaDescriptor: 0x%x\n", FatVolumeBootSector->MediaDescriptor));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerFat: %d\n", FatVolumeBootSector->SectorsPerFat));
----- DbgPrint((DPRINT_FILESYSTEM, "SectorsPerTrack: %d\n", FatVolumeBootSector->SectorsPerTrack));
----- DbgPrint((DPRINT_FILESYSTEM, "NumberOfHeads: %d\n", FatVolumeBootSector->NumberOfHeads));
----- DbgPrint((DPRINT_FILESYSTEM, "HiddenSectors: %d\n", FatVolumeBootSector->HiddenSectors));
----- DbgPrint((DPRINT_FILESYSTEM, "TotalSectorsBig: %d\n", FatVolumeBootSector->TotalSectorsBig));
----- DbgPrint((DPRINT_FILESYSTEM, "DriveNumber: 0x%x\n", FatVolumeBootSector->DriveNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "Reserved1: 0x%x\n", FatVolumeBootSector->Reserved1));
----- DbgPrint((DPRINT_FILESYSTEM, "BootSignature: 0x%x\n", FatVolumeBootSector->BootSignature));
----- DbgPrint((DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", FatVolumeBootSector->VolumeSerialNumber));
----- DbgPrint((DPRINT_FILESYSTEM, "VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", FatVolumeBootSector->VolumeLabel[0], FatVolumeBootSector->VolumeLabel[1], FatVolumeBootSector->VolumeLabel[2], FatVolumeBootSector->VolumeLabel[3], FatVolumeBootSector->VolumeLabel[4], FatVolumeBootSector->VolumeLabel[5], FatVolumeBootSector->VolumeLabel[6], FatVolumeBootSector->VolumeLabel[7], FatVolumeBootSector->VolumeLabel[8], FatVolumeBootSector->VolumeLabel[9], FatVolumeBootSector->VolumeLabel[10]));
----- DbgPrint((DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->FileSystemType[0], FatVolumeBootSector->FileSystemType[1], FatVolumeBootSector->FileSystemType[2], FatVolumeBootSector->FileSystemType[3], FatVolumeBootSector->FileSystemType[4], FatVolumeBootSector->FileSystemType[5], FatVolumeBootSector->FileSystemType[6], FatVolumeBootSector->FileSystemType[7]));
----- DbgPrint((DPRINT_FILESYSTEM, "BootSectorMagic: 0x%x\n", FatVolumeBootSector->BootSectorMagic));
+++++ DPRINTM(DPRINT_FILESYSTEM, "sizeof(FAT_BOOTSECTOR) = 0x%x.\n", sizeof(FAT_BOOTSECTOR));
+++++
+++++ DPRINTM(DPRINT_FILESYSTEM, "JumpBoot: 0x%x 0x%x 0x%x\n", FatVolumeBootSector->JumpBoot[0], FatVolumeBootSector->JumpBoot[1], FatVolumeBootSector->JumpBoot[2]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "OemName: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->OemName[0], FatVolumeBootSector->OemName[1], FatVolumeBootSector->OemName[2], FatVolumeBootSector->OemName[3], FatVolumeBootSector->OemName[4], FatVolumeBootSector->OemName[5], FatVolumeBootSector->OemName[6], FatVolumeBootSector->OemName[7]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BytesPerSector: %d\n", FatVolumeBootSector->BytesPerSector);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", FatVolumeBootSector->SectorsPerCluster);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ReservedSectors: %d\n", FatVolumeBootSector->ReservedSectors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "NumberOfFats: %d\n", FatVolumeBootSector->NumberOfFats);
+++++ DPRINTM(DPRINT_FILESYSTEM, "RootDirEntries: %d\n", FatVolumeBootSector->RootDirEntries);
+++++ DPRINTM(DPRINT_FILESYSTEM, "TotalSectors: %d\n", FatVolumeBootSector->TotalSectors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "MediaDescriptor: 0x%x\n", FatVolumeBootSector->MediaDescriptor);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerFat: %d\n", FatVolumeBootSector->SectorsPerFat);
+++++ DPRINTM(DPRINT_FILESYSTEM, "SectorsPerTrack: %d\n", FatVolumeBootSector->SectorsPerTrack);
+++++ DPRINTM(DPRINT_FILESYSTEM, "NumberOfHeads: %d\n", FatVolumeBootSector->NumberOfHeads);
+++++ DPRINTM(DPRINT_FILESYSTEM, "HiddenSectors: %d\n", FatVolumeBootSector->HiddenSectors);
+++++ DPRINTM(DPRINT_FILESYSTEM, "TotalSectorsBig: %d\n", FatVolumeBootSector->TotalSectorsBig);
+++++ DPRINTM(DPRINT_FILESYSTEM, "DriveNumber: 0x%x\n", FatVolumeBootSector->DriveNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Reserved1: 0x%x\n", FatVolumeBootSector->Reserved1);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BootSignature: 0x%x\n", FatVolumeBootSector->BootSignature);
+++++ DPRINTM(DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", FatVolumeBootSector->VolumeSerialNumber);
+++++ DPRINTM(DPRINT_FILESYSTEM, "VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", FatVolumeBootSector->VolumeLabel[0], FatVolumeBootSector->VolumeLabel[1], FatVolumeBootSector->VolumeLabel[2], FatVolumeBootSector->VolumeLabel[3], FatVolumeBootSector->VolumeLabel[4], FatVolumeBootSector->VolumeLabel[5], FatVolumeBootSector->VolumeLabel[6], FatVolumeBootSector->VolumeLabel[7], FatVolumeBootSector->VolumeLabel[8], FatVolumeBootSector->VolumeLabel[9], FatVolumeBootSector->VolumeLabel[10]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->FileSystemType[0], FatVolumeBootSector->FileSystemType[1], FatVolumeBootSector->FileSystemType[2], FatVolumeBootSector->FileSystemType[3], FatVolumeBootSector->FileSystemType[4], FatVolumeBootSector->FileSystemType[5], FatVolumeBootSector->FileSystemType[6], FatVolumeBootSector->FileSystemType[7]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "BootSectorMagic: 0x%x\n", FatVolumeBootSector->BootSectorMagic);
}
//
{
PVOID DirectoryBuffer;
----- DbgPrint((DPRINT_FILESYSTEM, "FatBufferDirectory() DirectoryStartCluster = %d RootDirectory = %s\n", DirectoryStartCluster, (RootDirectory ? "TRUE" : "FALSE")));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatBufferDirectory() DirectoryStartCluster = %d RootDirectory = %s\n", DirectoryStartCluster, (RootDirectory ? "TRUE" : "FALSE"));
/*
* For FAT32, the root directory is nothing special. We can treat it the same
//
// Attempt to allocate memory for directory buffer
//
----- DbgPrint((DPRINT_FILESYSTEM, "Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize);
DirectoryBuffer = MmHeapAlloc(*DirectorySize);
if (DirectoryBuffer == NULL)
EntryCount = DirectorySize / sizeof(DIRENTRY);
----- DbgPrint((DPRINT_FILESYSTEM, "FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
memset(ShortNameBuffer, 0, 13 * sizeof(CHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(CHAR));
OurDirEntry = *((PDIRENTRY) DirectoryBuffer);
FatSwapDirEntry(DirEntry);
----- //DbgPrint((DPRINT_FILESYSTEM, "Dumping directory entry %d:\n", CurrentEntry));
+++++ //DPRINTM(DPRINT_FILESYSTEM, "Dumping directory entry %d:\n", CurrentEntry);
//DbgDumpBuffer(DPRINT_FILESYSTEM, DirEntry, sizeof(DIRENTRY));
//
LfnNameBuffer[12 + (LfnDirEntry->SequenceNumber * 13)] = (UCHAR)LfnDirEntry->Name11_12[1];
}
----- //DbgPrint((DPRINT_FILESYSTEM, "Dumping long name buffer:\n"));
+++++ //DPRINTM(DPRINT_FILESYSTEM, "Dumping long name buffer:\n");
//DbgDumpBuffer(DPRINT_FILESYSTEM, LfnNameBuffer, 260);
continue;
//
FatParseShortFileName(ShortNameBuffer, DirEntry);
----- DbgPrint((DPRINT_FILESYSTEM, "Entry: %d LFN = %s\n", CurrentEntry, LfnNameBuffer));
----- DbgPrint((DPRINT_FILESYSTEM, "Entry: %d DOS name = %s\n", CurrentEntry, ShortNameBuffer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "Entry: %d LFN = %s\n", CurrentEntry, LfnNameBuffer);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Entry: %d DOS name = %s\n", CurrentEntry, ShortNameBuffer);
//
// See if the file name matches either the short or long name
FatFileInfoPointer->FileSize = DirEntry->Size;
FatFileInfoPointer->FilePointer = 0;
----- DbgPrint((DPRINT_FILESYSTEM, "MSDOS Directory Entry:\n"));
----- DbgPrint((DPRINT_FILESYSTEM, "FileName[11] = %c%c%c%c%c%c%c%c%c%c%c\n", DirEntry->FileName[0], DirEntry->FileName[1], DirEntry->FileName[2], DirEntry->FileName[3], DirEntry->FileName[4], DirEntry->FileName[5], DirEntry->FileName[6], DirEntry->FileName[7], DirEntry->FileName[8], DirEntry->FileName[9], DirEntry->FileName[10]));
----- DbgPrint((DPRINT_FILESYSTEM, "Attr = 0x%x\n", DirEntry->Attr));
----- DbgPrint((DPRINT_FILESYSTEM, "ReservedNT = 0x%x\n", DirEntry->ReservedNT));
----- DbgPrint((DPRINT_FILESYSTEM, "TimeInTenths = %d\n", DirEntry->TimeInTenths));
----- DbgPrint((DPRINT_FILESYSTEM, "CreateTime = %d\n", DirEntry->CreateTime));
----- DbgPrint((DPRINT_FILESYSTEM, "CreateDate = %d\n", DirEntry->CreateDate));
----- DbgPrint((DPRINT_FILESYSTEM, "LastAccessDate = %d\n", DirEntry->LastAccessDate));
----- DbgPrint((DPRINT_FILESYSTEM, "ClusterHigh = 0x%x\n", DirEntry->ClusterHigh));
----- DbgPrint((DPRINT_FILESYSTEM, "Time = %d\n", DirEntry->Time));
----- DbgPrint((DPRINT_FILESYSTEM, "Date = %d\n", DirEntry->Date));
----- DbgPrint((DPRINT_FILESYSTEM, "ClusterLow = 0x%x\n", DirEntry->ClusterLow));
----- DbgPrint((DPRINT_FILESYSTEM, "Size = %d\n", DirEntry->Size));
+++++ DPRINTM(DPRINT_FILESYSTEM, "MSDOS Directory Entry:\n");
+++++ DPRINTM(DPRINT_FILESYSTEM, "FileName[11] = %c%c%c%c%c%c%c%c%c%c%c\n", DirEntry->FileName[0], DirEntry->FileName[1], DirEntry->FileName[2], DirEntry->FileName[3], DirEntry->FileName[4], DirEntry->FileName[5], DirEntry->FileName[6], DirEntry->FileName[7], DirEntry->FileName[8], DirEntry->FileName[9], DirEntry->FileName[10]);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Attr = 0x%x\n", DirEntry->Attr);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ReservedNT = 0x%x\n", DirEntry->ReservedNT);
+++++ DPRINTM(DPRINT_FILESYSTEM, "TimeInTenths = %d\n", DirEntry->TimeInTenths);
+++++ DPRINTM(DPRINT_FILESYSTEM, "CreateTime = %d\n", DirEntry->CreateTime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "CreateDate = %d\n", DirEntry->CreateDate);
+++++ DPRINTM(DPRINT_FILESYSTEM, "LastAccessDate = %d\n", DirEntry->LastAccessDate);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ClusterHigh = 0x%x\n", DirEntry->ClusterHigh);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Time = %d\n", DirEntry->Time);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Date = %d\n", DirEntry->Date);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ClusterLow = 0x%x\n", DirEntry->ClusterLow);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Size = %d\n", DirEntry->Size);
//
// Get the cluster chain
//
StartCluster = ((ULONG)DirEntry->ClusterHigh << 16) + DirEntry->ClusterLow;
----- DbgPrint((DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", StartCluster));
+++++ DPRINTM(DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", StartCluster);
FatFileInfoPointer->FileFatChain = FatGetClusterChainArray(StartCluster);
//
EntryCount = DirectorySize / sizeof(FATX_DIRENTRY);
----- DbgPrint((DPRINT_FILESYSTEM, "FatXSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatXSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
FileNameLen = strlen(FileName);
FatFileInfoPointer->FileSize = DirEntry->Size;
FatFileInfoPointer->FilePointer = 0;
----- DbgPrint((DPRINT_FILESYSTEM, "FATX Directory Entry:\n"));
----- DbgPrint((DPRINT_FILESYSTEM, "FileNameSize = %d\n", DirEntry->FileNameSize));
----- DbgPrint((DPRINT_FILESYSTEM, "Attr = 0x%x\n", DirEntry->Attr));
----- DbgPrint((DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", DirEntry->StartCluster));
----- DbgPrint((DPRINT_FILESYSTEM, "Size = %d\n", DirEntry->Size));
----- DbgPrint((DPRINT_FILESYSTEM, "Time = %d\n", DirEntry->Time));
----- DbgPrint((DPRINT_FILESYSTEM, "Date = %d\n", DirEntry->Date));
----- DbgPrint((DPRINT_FILESYSTEM, "CreateTime = %d\n", DirEntry->CreateTime));
----- DbgPrint((DPRINT_FILESYSTEM, "CreateDate = %d\n", DirEntry->CreateDate));
----- DbgPrint((DPRINT_FILESYSTEM, "LastAccessTime = %d\n", DirEntry->LastAccessTime));
----- DbgPrint((DPRINT_FILESYSTEM, "LastAccessDate = %d\n", DirEntry->LastAccessDate));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FATX Directory Entry:\n");
+++++ DPRINTM(DPRINT_FILESYSTEM, "FileNameSize = %d\n", DirEntry->FileNameSize);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Attr = 0x%x\n", DirEntry->Attr);
+++++ DPRINTM(DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", DirEntry->StartCluster);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Size = %d\n", DirEntry->Size);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Time = %d\n", DirEntry->Time);
+++++ DPRINTM(DPRINT_FILESYSTEM, "Date = %d\n", DirEntry->Date);
+++++ DPRINTM(DPRINT_FILESYSTEM, "CreateTime = %d\n", DirEntry->CreateTime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "CreateDate = %d\n", DirEntry->CreateDate);
+++++ DPRINTM(DPRINT_FILESYSTEM, "LastAccessTime = %d\n", DirEntry->LastAccessTime);
+++++ DPRINTM(DPRINT_FILESYSTEM, "LastAccessDate = %d\n", DirEntry->LastAccessDate);
/*
* Get the cluster chain
ULONG DirectorySize;
FAT_FILE_INFO FatFileInfo;
----- DbgPrint((DPRINT_FILESYSTEM, "FatLookupFile() FileName = %s\n", FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatLookupFile() FileName = %s\n", FileName);
memset(FatFileInfoPointer, 0, sizeof(FAT_FILE_INFO));
Buffer[Idx++] = (DirEntry->FileName[10] == ' ') ? '\0' : DirEntry->FileName[10];
}
----- DbgPrint((DPRINT_FILESYSTEM, "FatParseShortFileName() ShortName = %s\n", Buffer));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatParseShortFileName() ShortName = %s\n", Buffer);
}
/*
BOOLEAN FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
{
ULONG fat = 0;
---- UINT FatOffset;
---- UINT ThisFatSecNum;
---- UINT ThisFatEntOffset;
++++ UINT32 FatOffset;
++++ UINT32 ThisFatSecNum;
++++ UINT32 ThisFatEntOffset;
----- DbgPrint((DPRINT_FILESYSTEM, "FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster);
switch(FatType)
{
ThisFatSecNum = ActiveFatSectorStart + (FatOffset / BytesPerSector);
ThisFatEntOffset = (FatOffset % BytesPerSector);
----- DbgPrint((DPRINT_FILESYSTEM, "FatOffset: %d\n", FatOffset));
----- DbgPrint((DPRINT_FILESYSTEM, "ThisFatSecNum: %d\n", ThisFatSecNum));
----- DbgPrint((DPRINT_FILESYSTEM, "ThisFatEntOffset: %d\n", ThisFatEntOffset));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatOffset: %d\n", FatOffset);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ThisFatSecNum: %d\n", ThisFatSecNum);
+++++ DPRINTM(DPRINT_FILESYSTEM, "ThisFatEntOffset: %d\n", ThisFatEntOffset);
if (ThisFatEntOffset == (BytesPerSector - 1))
{
}
----- DbgPrint((DPRINT_FILESYSTEM, "FAT entry is 0x%x.\n", fat));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FAT entry is 0x%x.\n", fat);
*ClusterPointer = fat;
FAT_FILE_INFO TempFatFileInfo;
PFAT_FILE_INFO FileHandle;
----- DbgPrint((DPRINT_FILESYSTEM, "FatOpenFile() FileName = %s\n", FileName));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatOpenFile() FileName = %s\n", FileName);
if (!FatLookupFile(FileName, &TempFatFileInfo))
{
{
ULONG ClusterCount = 0;
----- DbgPrint((DPRINT_FILESYSTEM, "FatCountClustersInChain() StartCluster = %d\n", StartCluster));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatCountClustersInChain() StartCluster = %d\n", StartCluster);
while (1)
{
}
}
----- DbgPrint((DPRINT_FILESYSTEM, "FatCountClustersInChain() ClusterCount = %d\n", ClusterCount));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatCountClustersInChain() ClusterCount = %d\n", ClusterCount);
return ClusterCount;
}
ULONG* ArrayPointer;
ULONG Idx;
----- DbgPrint((DPRINT_FILESYSTEM, "FatGetClusterChainArray() StartCluster = %d\n", StartCluster));
+++++ DPRINTM(DPRINT_FILESYSTEM, "FatGetClusterChainArray() StartCluster = %d\n", StartCluster);
ClusterCount = FatCountClustersInChain(StartCluster) + 1; // Lets get the 0x0ffffff8 on the end of the array
&n