Merge r17394:17744 from trunk.
Modified: branches/cache_manager_rewrite/reactos/Makefile
Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/arp/arp.c
Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnclass.cpp
Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.cpp
Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.h
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386.h
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/disk.h
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/freeldr.h
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/machine.h
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/inifile/inifile.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/linuxboot.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/machine.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/miscboot.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/arcname.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/setupldr.c
Modified: branches/cache_manager_rewrite/reactos/bootdata/hivecls.inf
Modified: branches/cache_manager_rewrite/reactos/bootdata/hivesys.inf
Modified: branches/cache_manager_rewrite/reactos/bootdata/packages/reactos.dff
Modified: branches/cache_manager_rewrite/reactos/bootdata/readme.txt
Modified: branches/cache_manager_rewrite/reactos/bootdata/txtsetup.sif
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/detect.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/fdo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/misc.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/pdo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/serenum/serenum.h
Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/devctrl.c
Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/info.c
Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/pnp.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/blockdev.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/cdfs.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/fat.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/fs_rec.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/fs_rec.h
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/fs_rec.rc
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/fs_rec.xml
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/ntfs.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/fs_rec/udfs.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/create.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/finfo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/fsctrl.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/msfs.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/msfs.h
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/msfs.xml
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/ms/rw.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/create.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/finfo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/fsctrl.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/npfs.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/npfs.h
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/npfs.rc
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/npfs.xml
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/rw.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/np/volume.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/cleanup.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/close.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/create.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/dir.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/direntry.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/dirwr.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/ea.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/fastio.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/fat.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/fcb.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/finfo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/flush.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/fsctl.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/iface.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/misc.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/rw.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/shutdown.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/string.c
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/vfatfs.rc
Modified: branches/cache_manager_rewrite/reactos/drivers/fs/vfat/volume.c
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.c
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.h
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.xml
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/keyboard.c
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/mouse.c
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/ps2pp.c
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/registry.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/include/debug.h
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/include/efilter.h
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/include/miniport.h
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/include/ndissys.h
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/include/protocol.h
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/40gone.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/50gone.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/SOURCES
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/buffer.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/cl.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/config.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/control.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/efilter.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/ndis/ndis/hardware.c
[truncated at 100 lines; 763 more skipped]
Property changes on: branches/cache_manager_rewrite/reactos
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.zip
*.iso
*.cab
*.bat
*.log
makefile.auto
config.xml
obj-*
output-*
doxy-doc
cd
reactos
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.zip
*.iso
*.img
*.cab
*.bat
*.log
*.patch
*.diff
makefile.auto
config.xml
obj-*
output-*
doxy-doc
cd
reactos
ros

Modified: branches/cache_manager_rewrite/reactos/Makefile
--- branches/cache_manager_rewrite/reactos/Makefile	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/Makefile	2005-10-17 19:29:51 UTC (rev 18527)
@@ -308,6 +308,10 @@
 	$(ECHO_RBUILD)
 	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
 
+.PHONY: msvc
+msvc: $(RBUILD_TARGET)
+	$(ECHO_RBUILD)
+	$(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) msvc
 
 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
 	$(ECHO_WMC)
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/arp
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile

Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/arp/arp.c
--- branches/cache_manager_rewrite/reactos/apps/utils/net/arp/arp.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/apps/utils/net/arp/arp.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -8,8 +8,8 @@
  *   GM 27/06/05 Created
  *
  */
- 
- 
+
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -18,11 +18,8 @@
 #include <ctype.h>
 #include <winsock2.h>
 #include <iphlpapi.h>
+
  
-#define WIN32_LEAN_AND_MEAN
-#define UNICODE
-#define _UNICODE
- 
 /*
  * Globals
  */ 
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/finger
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/ftp
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/ipconfig
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/netstat
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/ping
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/route
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile

Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnclass.cpp
--- branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnclass.cpp	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnclass.cpp	2005-10-17 19:29:51 UTC (rev 18527)
@@ -78,7 +78,7 @@
 	telSetConsoleTitle("No Connection");
 
 	// Change the icon
-	hConsoleWindow = GetConsoleWindow();
+	hConsoleWindow = TelnetGetConsoleWindow();
 	iconChange = SetIcon(hConsoleWindow, 0, &oldBIcon, &oldSIcon, ini.get_startdir());
 
 	if (WSAStartup(MAKEWORD(1, 1), &WsaData)) {
@@ -105,7 +105,7 @@
 Console(GetStdHandle(STD_OUTPUT_HANDLE)),
 TelHandler(Network, Console, Parser),
 ThreadParams(TelHandler),
-Clipboard(GetConsoleWindow(), Network),
+Clipboard(TelnetGetConsoleWindow(), Network),
 Mouse(Clipboard),
 Scroller(Mouse, ini.get_scroll_size()),
 Parser(Console, KeyTrans, Scroller, Network, Charmap) {
@@ -117,7 +117,7 @@
 Console(GetStdHandle(STD_OUTPUT_HANDLE)),
 TelHandler(Network, Console, Parser),
 ThreadParams(TelHandler),
-Clipboard(GetConsoleWindow(), Network),
+Clipboard(TelnetGetConsoleWindow(), Network),
 Mouse(Clipboard),
 Scroller(Mouse, ini.get_scroll_size()),
 Parser(Console, KeyTrans, Scroller, Network, Charmap) {

Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.cpp
--- branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.cpp	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.cpp	2005-10-17 19:29:51 UTC (rev 18527)
@@ -110,7 +110,7 @@
 // Paul Brannan 8/7/98
 // This code is from Michael 'Hacker' Krelin (author of KINSole)
 // (slightly modified)
-HWND GetConsoleWindow() {
+HWND TelnetGetConsoleWindow() {
 	DWORD pid = GetCurrentProcessId(), wpid;
 	char title[512], *t = title;
 	HWND hrv = NULL;

Modified: branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.h
--- branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.h	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/apps/utils/net/telnet/src/tnmisc.h	2005-10-17 19:29:51 UTC (rev 18527)
@@ -9,7 +9,7 @@
 
 int GetWin32Version(void);
 
-HWND GetConsoleWindow();
+HWND TelnetGetConsoleWindow(void);
 
 bool SetIcon(HWND hConsoleWindow, HANDLE hIcon, LPARAM *pOldBIcon, LPARAM *pOldSIcon,
 			 const char *icondir);
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/tracert
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/net/whois
___________________________________________________________________
Name: svn:ignore
   - *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
makefile
   + *.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/ps
___________________________________________________________________
Name: svn:ignore
   - *.o
*.a
*.d
*.exe
*.coff
*.sym
*.map
makefile
   + *.o
*.a
*.d
*.exe
*.coff
*.sym
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils/rosperf
___________________________________________________________________
Name: svn:ignore
   - *.o
*.a
*.d
*.exe
*.coff
*.sym
*.map
makefile
   + *.o
*.a
*.d
*.exe
*.coff
*.sym
*.map
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/boot/freeldr/bootsect
___________________________________________________________________
Name: svn:ignore
   - *.exe
makefile
   + *.exe
GNUmakefile
Property changes on: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr
___________________________________________________________________
Name: svn:ignore
   - *.d
*.map
*.exe
*.sys
makefile
   + *.d
*.map
*.exe
*.sys
GNUmakefile

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -293,7 +293,7 @@
 
       /* Initialize resource descriptor */
       memset(FullResourceDescriptor, 0, Size);
-      FullResourceDescriptor->InterfaceType = Internal;
+      FullResourceDescriptor->InterfaceType = PCIBus;
       FullResourceDescriptor->BusNumber = 0;
       FullResourceDescriptor->PartialResourceList.Count = 0;
 

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386.h
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386.h	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386.h	2005-10-17 19:29:51 UTC (rev 18527)
@@ -34,6 +34,7 @@
 extern BOOL i386DiskGetBootPath(char *BootPath, unsigned Size);
 extern VOID i386DiskGetBootDevice(PULONG BootDevice);
 extern BOOL i386DiskBootingFromFloppy(VOID);
+extern BOOL i386DiskNormalizeSystemPath(char *SystemPath, unsigned Size);
 
 #endif /* __I386_I386_H_ */
 

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -165,6 +165,38 @@
 
 	memcpy(Buffer, Ptr, BufferSize);
 
+#ifdef DEBUG
+        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]));
+        if (Ptr[0] >= 0x1e)
+        {
+            DbgPrint((DPRINT_HB, "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]));
+            }
+        }
+        if (Ptr[0] >= 0x42)
+        {
+            DbgPrint((DPRINT_HB, "signature:                             %x\n", Ptr[15]));
+        }
+#endif
+
 	return TRUE;
 }
 
@@ -172,6 +204,7 @@
 {
 	PARTITION_TABLE_ENTRY	PartitionTableEntry;
 	UCHAR			VolumeType;
+	ULONG			ActivePartition;
 
 	DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", i386BootDrive, i386BootPartition));
 
@@ -204,7 +237,7 @@
 	if (i386BootPartition == 0)
 	{
 		// Partition requested was zero which means the boot partition
-		if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
+		if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry, &ActivePartition))
 		{
 			/* Try partition-less disk */
 			*StartSector = 0;
@@ -301,6 +334,10 @@
      (P) == PARTITION_FAT32_XINT13 || \
      (P) == PARTITION_XINT13)
 
+#define IsContainerPartition(P) \
+    ((P) == PARTITION_EXTENDED         || \
+     (P) == PARTITION_XINT13_EXTENDED)
+
 BOOL i386DiskGetSystemVolume(char *SystemPath,
                              char *RemainingPath,
                              PULONG Device,
@@ -344,7 +381,8 @@
 			{
 				return FALSE;
 			}
-			if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
+                        if (!IsContainerPartition(PartitionTableEntry.SystemIndicator) &&
+                            PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED)
 			{
 				if (++RosPartition == PartitionNumber)
 				{
@@ -425,6 +463,46 @@
 	return TRUE;
 }
 
+BOOL
+i386DiskNormalizeSystemPath(char *SystemPath, unsigned Size)
+{
+	CHAR BootPath[256];
+	ULONG PartitionNumber;
+	ULONG DriveNumber;
+	PARTITION_TABLE_ENTRY PartEntry;
+	char *p;
+
+	if (!DissectArcPath(SystemPath, BootPath, &DriveNumber, &PartitionNumber))
+	{
+		return FALSE;
+	}
+
+	if (0 != PartitionNumber)
+	{
+		return TRUE;
+	}
+
+	if (! DiskGetActivePartitionEntry(DriveNumber,
+	                                  &PartEntry,
+	                                  &PartitionNumber) ||
+	    PartitionNumber < 1 || 9 < PartitionNumber)
+	{
+		return FALSE;
+	}
+
+	p = SystemPath;
+	while ('\0' != *p && 0 != strnicmp(p, "partition(", 10)) {
+		p++;
+	}
+	p = strchr(p, ')');
+	if (NULL == p || '0' != *(p - 1)) {
+		return FALSE;
+	}
+	*(p - 1) = '0' + PartitionNumber;
+
+	return TRUE;
+}
+
 #endif /* defined __i386__ */
 
 /* EOF */

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machpc.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machpc.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -54,6 +54,7 @@
   MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
   MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
   MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
+  MachVtbl.DiskNormalizeSystemPath = i386DiskNormalizeSystemPath;
   MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
   MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;
   MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -52,6 +52,7 @@
   MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
   MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
   MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
+  MachVtbl.DiskNormalizeSystemPath = i386DiskNormalizeSystemPath;
   MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
   MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
   MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/disk/partition.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -26,12 +26,14 @@
 #include <machine.h>
 
 
-BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+BOOL DiskGetActivePartitionEntry(ULONG DriveNumber,
+                                 PPARTITION_TABLE_ENTRY PartitionTableEntry,
+                                 ULONG *ActivePartition)
 {
 	ULONG			BootablePartitionCount = 0;
-	ULONG			ActivePartition = 0;
 	MASTER_BOOT_RECORD	MasterBootRecord;
 
+	*ActivePartition = 0;
 	// Read master boot record
 	if (!DiskReadBootRecord(DriveNumber, 0, &MasterBootRecord))
 	{
@@ -42,22 +44,22 @@
 	if (MasterBootRecord.PartitionTable[0].BootIndicator == 0x80)
 	{
 		BootablePartitionCount++;
-		ActivePartition = 0;
+		*ActivePartition = 1;
 	}
 	if (MasterBootRecord.PartitionTable[1].BootIndicator == 0x80)
 	{
 		BootablePartitionCount++;
-		ActivePartition = 1;
+		*ActivePartition = 2;
 	}
 	if (MasterBootRecord.PartitionTable[2].BootIndicator == 0x80)
 	{
 		BootablePartitionCount++;
-		ActivePartition = 2;
+		*ActivePartition = 3;
 	}
 	if (MasterBootRecord.PartitionTable[3].BootIndicator == 0x80)
 	{
 		BootablePartitionCount++;
-		ActivePartition = 3;
+		*ActivePartition = 4;
 	}
 
 	// Make sure there was only one bootable partition
@@ -73,7 +75,9 @@
 	}
 
 	// Copy the partition table entry
-	RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[ActivePartition], sizeof(PARTITION_TABLE_ENTRY));
+	RtlCopyMemory(PartitionTableEntry,
+	              &MasterBootRecord.PartitionTable[*ActivePartition - 1],
+	              sizeof(PARTITION_TABLE_ENTRY));
 
 	return TRUE;
 }

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/disk.h
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/disk.h	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/disk.h	2005-10-17 19:29:51 UTC (rev 18527)
@@ -130,7 +130,7 @@
 // Fixed Disk Partition Management Functions
 //
 ///////////////////////////////////////////////////////////////////////////////////////
-BOOL	DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
+BOOL	DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition);
 BOOL	DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
 BOOL	DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry);
 BOOL	DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry);

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/freeldr.h
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/freeldr.h	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/freeldr.h	2005-10-17 19:29:51 UTC (rev 18527)
@@ -35,8 +35,6 @@
 #include <portio.h>
 #include <reactos.h>
 
-#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
-#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
 #define Ke386EraseFlags(x)     __asm__ __volatile__("pushl $0 ; popfl\n")
 
 extern BOOL UserInterfaceUp;	/* Tells us if the user interface is displayed */

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/machine.h
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/machine.h	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/include/machine.h	2005-10-17 19:29:51 UTC (rev 18527)
@@ -61,6 +61,7 @@
   BOOL (*DiskGetBootPath)(char *BootPath, unsigned Size);
   VOID (*DiskGetBootDevice)(PULONG BootDevice);
   BOOL (*DiskBootingFromFloppy)(VOID);
+  BOOL (*DiskNormalizeSystemPath)(char *SystemPath, unsigned Size);
   BOOL (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
   BOOL (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
   BOOL (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
@@ -97,6 +98,7 @@
 #define MachDiskGetBootPath(Path, Size)		MachVtbl.DiskGetBootPath((Path), (Size))
 #define MachDiskGetBootDevice(BootDevice)	MachVtbl.DiskGetBootDevice(BootDevice)
 #define MachDiskBootingFromFloppy()		MachVtbl.DiskBootingFromFloppy()
+#define MachDiskNormalizeSystemPath(Path, Size)	MachVtbl.DiskNormalizeSystemPath((Path), (Size))
 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)	MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
 #define MachDiskGetPartitionEntry(Drive, Part, Entry)	MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
 #define MachDiskGetDriveGeometry(Drive, Geom)	MachVtbl.DiskGetDriveGeometry((Drive), (Geom))

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/inifile/inifile.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/inifile/inifile.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/inifile/inifile.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -218,7 +218,7 @@
 	RtlZeroMemory(SectionItem, sizeof(INI_SECTION_ITEM));
 
 	// Allocate the setting name buffer
-	SectionItem->ItemName = MmAllocateMemory(strlen(SettingName));
+	SectionItem->ItemName = MmAllocateMemory(strlen(SettingName) + 1);
 	if (!SectionItem->ItemName)
 	{
 		MmFreeMemory(SectionItem);
@@ -226,7 +226,7 @@
 	}
 
 	// Allocate the setting value buffer
-	SectionItem->ItemValue = MmAllocateMemory(strlen(SettingValue));
+	SectionItem->ItemValue = MmAllocateMemory(strlen(SettingValue) + 1);
 	if (!SectionItem->ItemValue)
 	{
 		MmFreeMemory(SectionItem->ItemName);

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/linuxboot.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/linuxboot.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/linuxboot.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -81,6 +81,11 @@
 	}
 
 	// Open the boot volume
+	if (!MachDiskNormalizeSystemPath(LinuxBootPath, sizeof(LinuxBootPath)))
+	{
+		UiMessageBox("Invalid boot path");
+		goto LinuxBootFailed;
+	}
 	if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL))
 	{
 		UiMessageBox("Failed to open boot drive.");

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/machine.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/machine.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/machine.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -42,6 +42,7 @@
 #undef MachDiskGetBootPath
 #undef MachDiskGetBootDevice
 #undef MachDiskBootingFromFloppy
+#undef MachDiskNormalizeSystemPath
 #undef MachDiskReadLogicalSectors
 #undef MachDiskGetPartitionEntry
 #undef MachDiskGetDriveGeometry
@@ -192,6 +193,12 @@
 }
 
 BOOL
+MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size)
+{
+  return MachVtbl.DiskNormalizeSystemPath(SystemPath, Size);
+}
+
+BOOL
 MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
   return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/miscboot.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/miscboot.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/miscboot.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -54,6 +54,12 @@
 		return;
 	}
 
+	if (!MachDiskNormalizeSystemPath(FileName, sizeof(FileName)))
+	{
+		UiMessageBox("Invalid path to boot sector file");
+		return;
+	}
+
 	if (!FsOpenSystemVolume(FileName, FileName, NULL))
 	{
 		UiMessageBox("Failed to open boot drive.");

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/arcname.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/arcname.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/arcname.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -73,7 +73,7 @@
 		p = p + 11;
 		*BootPartition = atoi(p);
 		p = strchr(p, ')');
-		if ((p == NULL) || (*BootPartition == 0))
+		if (p == NULL)
 			return FALSE;
 		p++;
 	}

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c	2005-10-17 18:04:11 UTC (rev 18526)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c	2005-10-17 19:29:51 UTC (rev 18527)
@@ -671,6 +671,12 @@
 	}
 	else
 	{
+		if (! MachDiskNormalizeSystemPath(SystemPath,
+		                                  sizeof(SystemPath)))
+		{
+			UiMessageBox("Invalid system path");
+			return;
+		}
[truncated at 1000 lines; 142966 more skipped]