ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
654 discussions
Start a n
N
ew thread
[hpoussin] 42545: Fix compilation
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sun Aug 9 10:13:17 2009 New Revision: 42545 URL:
http://svn.reactos.org/svn/reactos?rev=42545&view=rev
Log: Fix compilation Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild [iso-8859-1] Sun Aug 9 10:13:17 2009 @@ -11,10 +11,6 @@ <compilerflag>-fno-inline</compilerflag> <compilerflag>-fno-zero-initialized-in-bss</compilerflag> </group> - <directory name="arcemul"> - <file>component.c</file> - <file>time.c</file> - </directory> <directory name="cache"> <file>blocklist.c</file> <file>cache.c</file>
15 years, 4 months
1
0
0
0
[hpoussin] 42544: Merge FldrCreateComponentKey and FldrSetIdentifier
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sun Aug 9 10:11:52 2009 New Revision: 42544 URL:
http://svn.reactos.org/svn/reactos?rev=42544&view=rev
Log: Merge FldrCreateComponentKey and FldrSetIdentifier Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -243,11 +243,9 @@ 0x0, 0x0, 0xFFFFFFFF, + "PNP BIOS", &BusKey); (*BusNumber)++; - - /* Set the identifier */ - FldrSetIdentifier(BusKey, "PNP BIOS"); /* Set 'Configuration Data' value */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + (NodeSize * NodeCount); @@ -492,7 +490,7 @@ }; static VOID -SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey, +GetHarddiskIdentifier(PCHAR Identifier, ULONG DriveNumber) { PMASTER_BOOT_RECORD Mbr; @@ -500,7 +498,6 @@ ULONG i; ULONG Checksum; ULONG Signature; - CHAR Identifier[20]; CHAR ArcName[256]; PARTITION_TABLE_ENTRY PartitionTableEntry; @@ -574,9 +571,6 @@ Identifier[18] = 'A'; Identifier[19] = 0; DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier); - - /* Set identifier */ - FldrSetIdentifier(DiskKey, Identifier); } static ULONG @@ -642,13 +636,17 @@ DiskResetController(FloppyNumber); Ptr = GetInt1eTable(); - + + /* Set 'Identifier' value */ + sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1); + FldrCreateComponentKey(ControllerKey, PeripheralClass, FloppyDiskPeripheral, Input | Output, FloppyNumber, 0xFFFFFFFF, + Identifier, &PeripheralKey); Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + @@ -685,10 +683,6 @@ /* Set 'Configuration Data' value */ FldrSetConfigurationData(PeripheralKey, PartialResourceList, Size); MmHeapFree(PartialResourceList); - - /* Set 'Identifier' value */ - sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1); - FldrSetIdentifier(PeripheralKey, Identifier); } } @@ -806,6 +800,7 @@ Output | Input | Removable, 0x0, 0xFFFFFFFF, + NULL, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n"); @@ -865,6 +860,11 @@ /* Create and fill subkey for each harddisk */ for (i = 0; i < DiskCount; i++) { + CHAR Identifier[20]; + + /* Get disk values */ + GetHarddiskIdentifier(Identifier, 0x80 + i); + /* Create disk key */ FldrCreateComponentKey(ControllerKey, PeripheralClass, @@ -872,11 +872,11 @@ Output | Input, 0x0, 0xFFFFFFFF, + Identifier, &DiskKey); /* Set disk values */ SetHarddiskConfigurationData(DiskKey, 0x80 + i); - SetHarddiskIdentifier(DiskKey, 0x80 + i); } /* Get the drive we're booting from */ @@ -1209,6 +1209,7 @@ Input, 0x0, 0xFFFFFFFF, + Identifier, &PeripheralKey); DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"); @@ -1223,9 +1224,6 @@ &PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); - - /* Set 'Identifier' value */ - FldrSetIdentifier(PeripheralKey, Identifier); } } @@ -1260,6 +1258,9 @@ i + 1, Base); + /* Set 'Identifier' value */ + sprintf(Buffer, "COM%ld", i + 1); + /* Create controller key */ FldrCreateComponentKey(BusKey, ControllerClass, @@ -1267,6 +1268,7 @@ Output | Input | ConsoleIn | ConsoleOut, ControllerNumber, 0xFFFFFFFF, + Buffer, &ControllerKey); /* Build full device descriptor */ @@ -1320,13 +1322,6 @@ FldrSetConfigurationData(ControllerKey, PartialResourceList, Size); MmHeapFree(PartialResourceList); - /* Set 'Identifier' value */ - sprintf(Buffer, "COM%ld", i + 1); - FldrSetIdentifier(ControllerKey, Buffer); - DPRINTM(DPRINT_HWDETECT, - "Created value: Identifier %s\n", - Buffer); - if (!Rs232PortInUse(Base)) { /* Detect serial mouse */ @@ -1367,6 +1362,9 @@ ControllerNumber, Base); + /* Set 'Identifier' value */ + sprintf(Buffer, "PARALLEL%ld", i + 1); + /* Create controller key */ FldrCreateComponentKey(BusKey, ControllerClass, @@ -1374,6 +1372,7 @@ Output, ControllerNumber, 0xFFFFFFFF, + Buffer, &ControllerKey); /* Build full device descriptor */ @@ -1420,13 +1419,6 @@ FldrSetConfigurationData(ControllerKey, PartialResourceList, Size); MmHeapFree(PartialResourceList); - /* Set 'Identifier' value */ - sprintf(Buffer, "PARALLEL%ld", i + 1); - FldrSetIdentifier(ControllerKey, Buffer); - DPRINTM(DPRINT_HWDETECT, - "Created value: Identifier %s\n", - Buffer); - ControllerNumber++; } @@ -1524,6 +1516,7 @@ Input | ConsoleIn, 0x0, 0xFFFFFFFF, + "PCAT_ENHANCED", &PeripheralKey); DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n"); @@ -1559,9 +1552,6 @@ /* Set 'Configuration Data' value */ FldrSetConfigurationData(PeripheralKey, PartialResourceList, Size); MmHeapFree(PartialResourceList); - - /* Set 'Identifier' value */ - FldrSetIdentifier(PeripheralKey, "PCAT_ENHANCED"); } } @@ -1581,6 +1571,7 @@ Input | ConsoleIn, 0x0, 0xFFFFFFFF, + NULL, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"); @@ -1763,6 +1754,7 @@ Input, 0x0, 0xFFFFFFFF, + NULL, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n"); @@ -1797,6 +1789,7 @@ Input, 0x0, 0xFFFFFFFF, + "MICROSOFT PS2 MOUSE", &PeripheralKey); DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"); @@ -1811,9 +1804,6 @@ &PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); - - /* Set 'Identifier' value */ - FldrSetIdentifier(PeripheralKey, "MICROSOFT PS2 MOUSE"); } } } @@ -1825,6 +1815,33 @@ CHAR Buffer[80]; PCONFIGURATION_COMPONENT_DATA ControllerKey; USHORT VesaVersion; + + /* FIXME: Set 'ComponentInformation' value */ + + VesaVersion = BiosIsVesaSupported(); + if (VesaVersion != 0) + { + DPRINTM(DPRINT_HWDETECT, + "VESA version %c.%c\n", + (VesaVersion >> 8) + '0', + (VesaVersion & 0xFF) + '0'); + } + else + { + DPRINTM(DPRINT_HWDETECT, + "VESA not supported\n"); + } + + if (VesaVersion >= 0x0200) + { + strcpy(Buffer, + "VBE Display"); + } + else + { + strcpy(Buffer, + "VGA Display"); + } FldrCreateComponentKey(BusKey, ControllerClass, @@ -1832,38 +1849,9 @@ 0x0, 0x0, 0xFFFFFFFF, + Buffer, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n"); - - /* FIXME: Set 'ComponentInformation' value */ - - VesaVersion = BiosIsVesaSupported(); - if (VesaVersion != 0) - { - DPRINTM(DPRINT_HWDETECT, - "VESA version %c.%c\n", - (VesaVersion >> 8) + '0', - (VesaVersion & 0xFF) + '0'); - } - else - { - DPRINTM(DPRINT_HWDETECT, - "VESA not supported\n"); - } - - if (VesaVersion >= 0x0200) - { - strcpy(Buffer, - "VBE Display"); - } - else - { - strcpy(Buffer, - "VGA Display"); - } - - /* Set 'Identifier' value */ - FldrSetIdentifier(ControllerKey, Buffer); /* FIXME: Add display peripheral (monitor) data */ } @@ -1883,13 +1871,11 @@ 0x0, 0x0, 0xFFFFFFFF, + "ISA", &BusKey); /* Increment bus number */ (*BusNumber)++; - - /* Set 'Identifier' value */ - FldrSetIdentifier(BusKey, "ISA"); /* Set 'Configuration Data' value */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) - Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -74,6 +74,7 @@ 0x0, 0x0, 0xFFFFFFFF, + "ACPI BIOS", &BiosKey); /* Get BIOS memory map */ @@ -116,8 +117,6 @@ /* Increment bus number */ (*BusNumber)++; - /* Set 'Identifier' value */ - FldrSetIdentifier(BiosKey, "ACPI BIOS"); MmHeapFree(PartialResourceList); } } Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -68,6 +68,7 @@ 0x0, 0x0, 0xFFFFFFFF, + "APM", &BiosKey); /* Set 'Configuration Data' value */ @@ -82,9 +83,6 @@ /* Increment bus number */ (*BusNumber)++; - - /* Set 'Identifier' value */ - FldrSetIdentifier(BiosKey, "APM"); } /* FIXME: Add configuration data */ Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -160,10 +160,8 @@ 0x0, 0x0, 0xFFFFFFFF, + "PCI Real-mode IRQ Routing Table", &TableKey); - - /* Set 'Identifier' value */ - FldrSetIdentifier(TableKey, "PCI Real-mode IRQ Routing Table"); /* Set 'Configuration Data' value */ Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) + @@ -213,7 +211,6 @@ ULONG Size; PCONFIGURATION_COMPONENT_DATA BusKey; ULONG i; - CHAR szPci[] = "PCI"; /* Report the PCI BIOS */ if (FindPciBios(&BusData)) @@ -225,13 +222,11 @@ 0x0, 0x0, 0xFFFFFFFF, + "PCI BIOS" &BiosKey); /* Increment bus number */ (*BusNumber)++; - - /* Set 'Identifier' value */ - FldrSetIdentifier(BiosKey, "PCI BIOS"); /* Set 'Configuration Data' value */ Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, @@ -263,6 +258,7 @@ 0x0, 0x0, 0xFFFFFFFF, + "PCI", &BusKey); /* Check if this is the first bus */ @@ -321,9 +317,6 @@ /* Increment bus number */ (*BusNumber)++; - - /* Set 'Identifier' value */ - FldrSetIdentifier(BusKey, szPci); } } } Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -94,7 +94,7 @@ static VOID -SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey, +GetHarddiskIdentifier(PCHAR Identifier, ULONG DriveNumber) { PMASTER_BOOT_RECORD Mbr; @@ -158,9 +158,6 @@ Identifier[18] = 'A'; Identifier[19] = 0; DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier); - - /* Set identifier */ - FldrSetIdentifier(DiskKey, Identifier); } static VOID @@ -212,6 +209,7 @@ Output | Input | Removable, 0, 0xFFFFFFFF, + NULL, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n"); @@ -268,6 +266,11 @@ /* Create and fill subkey for each harddisk */ for (i = 0; i < DiskCount; i++) { + CHAR Identifier[20]; + + /* Get disk values */ + GetHarddiskIdentifier(Identifier, 0x80 + i); + /* Create disk key */ FldrCreateComponentKey(ControllerKey, PeripheralClass, @@ -275,11 +278,11 @@ Output | Input, 0, 0xFFFFFFFF, + Identifier, &DiskKey); /* Set disk values */ SetHarddiskConfigurationData(DiskKey, 0x80 + i); - SetHarddiskIdentifier(DiskKey, 0x80 + i); } } @@ -297,13 +300,11 @@ 0x0, 0x0, 0xFFFFFFFF, + "ISA", &BusKey); /* Increment bus number */ (*BusNumber)++; - - /* Set 'Identifier' value */ - FldrSetIdentifier(BusKey, "ISA"); /* Set 'Configuration Data' value */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) - Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -393,6 +393,7 @@ 0, 0, (ULONG)-1, + NULL, &NewKey); /* Add properties */ Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -40,13 +40,6 @@ // VOID NTAPI -FldrSetIdentifier( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN PCHAR Identifier -); - -VOID -NTAPI FldrCreateSystemKey( OUT PCONFIGURATION_COMPONENT_DATA *SystemKey ); @@ -60,6 +53,7 @@ IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, + IN PCHAR IdentifierString, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -60,13 +60,6 @@ // VOID NTAPI -FldrSetIdentifier( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN PCHAR Identifier -); - -VOID -NTAPI FldrCreateSystemKey( OUT PCONFIGURATION_COMPONENT_DATA *SystemKey ); @@ -80,6 +73,7 @@ IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, + IN PCHAR IdentifierString, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -40,13 +40,6 @@ // VOID NTAPI -FldrSetIdentifier( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN PCHAR Identifier -); - -VOID -NTAPI FldrCreateSystemKey( OUT PCONFIGURATION_COMPONENT_DATA *SystemKey ); @@ -60,6 +53,7 @@ IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, + IN PCHAR IdentifierString, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -39,13 +39,6 @@ // VOID NTAPI -FldrSetIdentifier( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN PCHAR Identifier -); - -VOID -NTAPI FldrCreateSystemKey( OUT PCONFIGURATION_COMPONENT_DATA *SystemKey ); @@ -59,6 +52,7 @@ IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, + IN PCHAR IdentifierString, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c [iso-8859-1] Sun Aug 9 10:11:52 2009 @@ -138,6 +138,7 @@ IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity, + IN PCHAR IdentifierString, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey) { PCONFIGURATION_COMPONENT_DATA ComponentData; @@ -157,6 +158,13 @@ Component = &ComponentData->ComponentEntry; Component->Class = Class; Component->Type = Type; + Component->Flags = Flags; + Component->Key = Key; + Component->Affinity = Affinity; + + /* Set identifier */ + if (Identifier) + FldrSetIdentifier(ComponentData, Identifier); /* Return the child */ *ComponentKey = ComponentData;
15 years, 4 months
1
0
0
0
[hpoussin] 42543: Merge FldrCreateComponentKey and FldrSetComponentInformation Remove unneeded parameters in FldrCreateComponentKey
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sun Aug 9 09:45:41 2009 New Revision: 42543 URL:
http://svn.reactos.org/svn/reactos?rev=42543&view=rev
Log: Merge FldrCreateComponentKey and FldrSetComponentInformation Remove unneeded parameters in FldrCreateComponentKey Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -103,14 +103,6 @@ FldrCreateSystemKey(&RootNode); // - // Write null component information - // - FldrSetComponentInformation(RootNode, - 0x0, - 0x0, - 0xFFFFFFFF); - - // // TODO: // There's no such thing as "PnP" on embedded hardware. // The boot loader will send us a device tree, similar to ACPI Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -238,18 +238,13 @@ /* Create component key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BusKey); (*BusNumber)++; - - /* Set the component information */ - FldrSetComponentInformation(BusKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Set the identifier */ FldrSetIdentifier(BusKey, "PNP BIOS"); @@ -649,17 +644,12 @@ Ptr = GetInt1eTable(); FldrCreateComponentKey(ControllerKey, - L"FloppyDiskPeripheral", - FloppyNumber, PeripheralClass, FloppyDiskPeripheral, + Input | Output, + FloppyNumber, + 0xFFFFFFFF, &PeripheralKey); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(PeripheralKey, - Input | Output, - FloppyNumber, - 0xFFFFFFFF); Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + sizeof(CM_FLOPPY_DEVICE_DATA); @@ -811,18 +801,13 @@ (int)DiskCount, (DiskCount == 1) ? "": "s"); FldrCreateComponentKey(BusKey, - L"DiskController", - 0, ControllerClass, DiskController, + Output | Input | Removable, + 0x0, + 0xFFFFFFFF, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - Output | Input | Removable, - 0, - 0xFFFFFFFF); DetectBiosFloppyController(BusKey, ControllerKey); @@ -882,17 +867,12 @@ { /* Create disk key */ FldrCreateComponentKey(ControllerKey, - L"DiskPeripheral", - i, PeripheralClass, DiskPeripheral, + Output | Input, + 0x0, + 0xFFFFFFFF, &DiskKey); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(DiskKey, - Output | Input, - 0, - 0xFFFFFFFF); /* Set disk values */ SetHarddiskConfigurationData(DiskKey, 0x80 + i); @@ -1224,19 +1204,14 @@ /* Create 'PointerPeripheral' key */ FldrCreateComponentKey(ControllerKey, - L"PointerPeripheral", - 0, PeripheralClass, PointerPeripheral, + Input, + 0x0, + 0xFFFFFFFF, &PeripheralKey); DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(PeripheralKey, - Input, - 0, - 0xFFFFFFFF); /* Set 'Configuration Data' value */ memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST)); @@ -1287,17 +1262,12 @@ /* Create controller key */ FldrCreateComponentKey(BusKey, - L"SerialController", - ControllerNumber, ControllerClass, SerialController, + Output | Input | ConsoleIn | ConsoleOut, + ControllerNumber, + 0xFFFFFFFF, &ControllerKey); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - Output | Input | ConsoleIn | ConsoleOut, - ControllerNumber, - 0xFFFFFFFF); /* Build full device descriptor */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + @@ -1399,17 +1369,12 @@ /* Create controller key */ FldrCreateComponentKey(BusKey, - L"ParallelController", - ControllerNumber, ControllerClass, ParallelController, + Output, + ControllerNumber, + 0xFFFFFFFF, &ControllerKey); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - Output, - ControllerNumber, - 0xFFFFFFFF); /* Build full device descriptor */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST); @@ -1554,18 +1519,13 @@ { /* Create controller key */ FldrCreateComponentKey(ControllerKey, - L"KeyboardPeripheral", - 0, PeripheralClass, KeyboardPeripheral, + Input | ConsoleIn, + 0x0, + 0xFFFFFFFF, &PeripheralKey); DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(PeripheralKey, - Input | ConsoleIn, - 0, - 0xFFFFFFFF); /* Set 'Configuration Data' value */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + @@ -1616,18 +1576,13 @@ /* Create controller key */ FldrCreateComponentKey(BusKey, - L"KeyboardController", - 0, ControllerClass, KeyboardController, + Input | ConsoleIn, + 0x0, + 0xFFFFFFFF, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - Input | ConsoleIn, - 0, - 0xFFFFFFFF); /* Set 'Configuration Data' value */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + @@ -1803,18 +1758,13 @@ /* Create controller key */ FldrCreateComponentKey(BusKey, - L"PointerController", - 0, ControllerClass, PointerController, + Input, + 0x0, + 0xFFFFFFFF, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - Input, - 0, - 0xFFFFFFFF); memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST)); @@ -1842,18 +1792,13 @@ /* Create peripheral key */ FldrCreateComponentKey(ControllerKey, - L"PointerPeripheral", - 0, ControllerClass, PointerPeripheral, + Input, + 0x0, + 0xFFFFFFFF, &PeripheralKey); DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(PeripheralKey, - Input, - 0, - 0xFFFFFFFF); /* Initialize resource descriptor */ memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST)); @@ -1882,18 +1827,13 @@ USHORT VesaVersion; FldrCreateComponentKey(BusKey, - L"DisplayController", - 0, ControllerClass, DisplayController, + 0x0, + 0x0, + 0xFFFFFFFF, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - 0x00, - 0, - 0xFFFFFFFF); /* FIXME: Set 'ComponentInformation' value */ @@ -1938,17 +1878,12 @@ /* Create new bus key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BusKey); - - /* Set 'Component Information' value similar to my NT4 box */ - FldrSetComponentInformation(BusKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Increment bus number */ (*BusNumber)++; @@ -2004,12 +1939,6 @@ /* Create the 'System' key */ FldrCreateSystemKey(&SystemKey); - - /* Set empty component information */ - FldrSetComponentInformation(SystemKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Detect buses */ DetectPciBios(SystemKey, &BusNumber); Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -69,17 +69,12 @@ /* Create new bus key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BiosKey); - - /* Set 'Component Information' */ - FldrSetComponentInformation(BiosKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Get BIOS memory map */ RtlZeroMemory(BiosMemoryMap, sizeof(BIOS_MEMORY_MAP) * 32); Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -63,17 +63,12 @@ { /* Create new bus key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BiosKey); - - /* Set 'Component Information' */ - FldrSetComponentInformation(BiosKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Set 'Configuration Data' value */ memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST)); Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -155,17 +155,12 @@ DPRINTM(DPRINT_HWDETECT, "Table size: %u\n", Table->Size); FldrCreateComponentKey(BusKey, - L"RealModeIrqRoutingTable", - 0, PeripheralClass, RealModeIrqRoutingTable, + 0x0, + 0x0, + 0xFFFFFFFF, &TableKey); - - /* Set 'Component Information' */ - FldrSetComponentInformation(TableKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Set 'Identifier' value */ FldrSetIdentifier(TableKey, "PCI Real-mode IRQ Routing Table"); @@ -225,17 +220,12 @@ { /* Create new bus key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BiosKey); - - /* Set 'Component Information' */ - FldrSetComponentInformation(BiosKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Increment bus number */ (*BusNumber)++; @@ -268,17 +258,12 @@ { /* Create the bus key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BusKey); - - /* Set 'Component Information' */ - FldrSetComponentInformation(BusKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Check if this is the first bus */ if (i == 0) Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -207,18 +207,13 @@ (int)DiskCount, (DiskCount == 1) ? "": "s"); FldrCreateComponentKey(BusKey, - L"DiskController", - 0, ControllerClass, DiskController, + Output | Input | Removable, + 0, + 0xFFFFFFFF, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n"); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(ControllerKey, - Output | Input | Removable, - 0, - 0xFFFFFFFF); //DetectBiosFloppyController(BusKey, ControllerKey); @@ -275,17 +270,12 @@ { /* Create disk key */ FldrCreateComponentKey(ControllerKey, - L"DiskPeripheral", - i, PeripheralClass, DiskPeripheral, + Output | Input, + 0, + 0xFFFFFFFF, &DiskKey); - - /* Set 'ComponentInformation' value */ - FldrSetComponentInformation(DiskKey, - Output | Input, - 0, - 0xFFFFFFFF); /* Set disk values */ SetHarddiskConfigurationData(DiskKey, 0x80 + i); @@ -302,17 +292,12 @@ /* Create new bus key */ FldrCreateComponentKey(SystemKey, - L"MultifunctionAdapter", - *BusNumber, AdapterClass, MultiFunctionAdapter, + 0x0, + 0x0, + 0xFFFFFFFF, &BusKey); - - /* Set 'Component Information' value similar to my NT4 box */ - FldrSetComponentInformation(BusKey, - 0x0, - 0x0, - 0xFFFFFFFF); /* Increment bus number */ (*BusNumber)++; @@ -360,12 +345,6 @@ /* Create the 'System' key */ FldrCreateSystemKey(&SystemKey); - /* Set empty component information */ - FldrSetComponentInformation(SystemKey, - 0x0, - 0x0, - 0xFFFFFFFF); - /* TODO: Build actual xbox's hardware configuration tree */ DetectIsaBios(SystemKey, &BusNumber); Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -388,13 +388,12 @@ /* Create a key for this device */ FldrCreateComponentKey (ParentKey, - wide_name, - 0, AdapterClass, MultiFunctionAdapter, + 0, + 0, + (ULONG)-1, &NewKey); - - FldrSetComponentInformation(NewKey, 0, 0, (ULONG)-1); /* Add properties */ for (prev_name = ""; ofw_nextprop(node, prev_name, cur_name) == 1; ) @@ -451,8 +450,6 @@ int node = ofw_finddevice("/"); FldrCreateSystemKey(&RootKey); - - FldrSetComponentInformation(RootKey, 0, 0, (ULONG)-1); OfwCopyDeviceTree(RootKey,"/",node,&BusNumber,&DiskController,&DiskNumber); return RootKey; Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -114,12 +114,6 @@ /* Create the 'System' key */ FldrCreateSystemKey(&SystemKey); - /* Set empty component information */ - FldrSetComponentInformation(SystemKey, - 0x0, - 0x0, - 0xFFFFFFFF); - printf("DetectHardware() Done\n"); return SystemKey; } Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -11,6 +11,10 @@ <compilerflag>-fno-inline</compilerflag> <compilerflag>-fno-zero-initialized-in-bss</compilerflag> </group> + <directory name="arcemul"> + <file>component.c</file> + <file>time.c</file> + </directory> <directory name="cache"> <file>blocklist.c</file> <file>cache.c</file> Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/hardware.h [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -40,15 +40,6 @@ // VOID NTAPI -FldrSetComponentInformation( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN IDENTIFIER_FLAG Flags, - IN ULONG Key, - IN ULONG Affinity -); - -VOID -NTAPI FldrSetIdentifier( IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN PCHAR Identifier @@ -64,10 +55,11 @@ NTAPI FldrCreateComponentKey( IN PCONFIGURATION_COMPONENT_DATA SystemKey, - IN PWCHAR BusName, - IN ULONG BusNumber, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, + IN IDENTIFIER_FLAG Flags, + IN ULONG Key, + IN ULONG Affinity, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -60,15 +60,6 @@ // VOID NTAPI -FldrSetComponentInformation( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN IDENTIFIER_FLAG Flags, - IN ULONG Key, - IN ULONG Affinity -); - -VOID -NTAPI FldrSetIdentifier( IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN PCHAR Identifier @@ -83,11 +74,12 @@ VOID NTAPI FldrCreateComponentKey( - IN PCONFIGURATION_COMPONENT_DATA SystemKey, - IN PWCHAR BusName, - IN ULONG BusNumber, + IN PCONFIGURATION_COMPONENT_DATA SystemKey,, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, + IN IDENTIFIER_FLAG Flags, + IN ULONG Key, + IN ULONG Affinity, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -40,15 +40,6 @@ // VOID NTAPI -FldrSetComponentInformation( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN IDENTIFIER_FLAG Flags, - IN ULONG Key, - IN ULONG Affinity -); - -VOID -NTAPI FldrSetIdentifier( IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN PCHAR Identifier @@ -64,10 +55,11 @@ NTAPI FldrCreateComponentKey( IN PCONFIGURATION_COMPONENT_DATA SystemKey, - IN PWCHAR BusName, - IN ULONG BusNumber, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, + IN IDENTIFIER_FLAG Flags, + IN ULONG Key, + IN ULONG Affinity, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/powerpc/hardware.h [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -39,15 +39,6 @@ // VOID NTAPI -FldrSetComponentInformation( - IN PCONFIGURATION_COMPONENT_DATA ComponentKey, - IN IDENTIFIER_FLAG Flags, - IN ULONG Key, - IN ULONG Affinity -); - -VOID -NTAPI FldrSetIdentifier( IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN PCHAR Identifier @@ -63,10 +54,11 @@ NTAPI FldrCreateComponentKey( IN PCONFIGURATION_COMPONENT_DATA SystemKey, - IN PWCHAR BusName, - IN ULONG BusNumber, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, + IN IDENTIFIER_FLAG Flags, + IN ULONG Key, + IN ULONG Affinity, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); Modified: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c [iso-8859-1] Sun Aug 9 09:45:41 2009 @@ -53,23 +53,6 @@ VOID NTAPI -FldrSetComponentInformation(IN PCONFIGURATION_COMPONENT_DATA ComponentData, - IN IDENTIFIER_FLAG Flags, - IN ULONG Key, - IN ULONG Affinity) -{ - PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry; - - /* Set component information */ - Component->Flags = Flags; - Component->Version = 0; - Component->Revision = 0; - Component->Key = Key; - Component->AffinityMask = Affinity; -} - -VOID -NTAPI FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCHAR IdentifierString) { @@ -107,6 +90,11 @@ Component->ConfigurationDataLength = 0; Component->Identifier = 0; Component->IdentifierLength = 0; + Component->Flags = 0; + Component->Version = 0; + Component->Revision = 0; + Component->Key = 0; + Component->AffinityMask = 0xFFFFFFFF; /* Return the node */ *SystemNode = FldrArcHwTreeRoot; @@ -145,10 +133,11 @@ VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, - IN PWCHAR BusName, - IN ULONG BusNumber, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, + IN IDENTIFIER_FLAG Flags, + IN ULONG Key, + IN ULONG Affinity, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey) { PCONFIGURATION_COMPONENT_DATA ComponentData;
15 years, 4 months
1
0
0
0
[cgutman] 42542: - Return the correct value for AFD_INFO_BLOCKING_MODE - Implement AFD_INFO_SENDS_IN_PROGRESS (SO_LINGER should work now)
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Aug 9 05:57:29 2009 New Revision: 42542 URL:
http://svn.reactos.org/svn/reactos?rev=42542&view=rev
Log: - Return the correct value for AFD_INFO_BLOCKING_MODE - Implement AFD_INFO_SENDS_IN_PROGRESS (SO_LINGER should work now) Modified: trunk/reactos/drivers/network/afd/afd/info.c Modified: trunk/reactos/drivers/network/afd/afd/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Sun Aug 9 05:57:29 2009 @@ -20,6 +20,7 @@ PAFD_INFO InfoReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; + PLIST_ENTRY CurrentEntry; AFD_DbgPrint(MID_TRACE,("Called %x %x\n", InfoReq, InfoReq ? InfoReq->InformationClass : 0)); @@ -42,7 +43,7 @@ break; case AFD_INFO_BLOCKING_MODE: - InfoReq->Information.Ulong = 0; + InfoReq->Information.Ulong = FCB->BlockingMode; break; case AFD_INFO_RECEIVE_CONTENT_SIZE: @@ -52,6 +53,23 @@ InfoReq->Information.Ulong = FCB->Recv.Content - FCB->Recv.BytesUsed; break; + + case AFD_INFO_SENDS_IN_PROGRESS: + InfoReq->Information.Ulong = 0; + + /* Count the queued sends */ + CurrentEntry = FCB->PendingIrpList[FUNCTION_SEND].Flink; + while (CurrentEntry != &FCB->PendingIrpList[FUNCTION_SEND]) + { + InfoReq->Information.Ulong++; + CurrentEntry = CurrentEntry->Flink; + } + + /* Count the send in progress */ + if (FCB->SendIrp.InFlightRequest) + InfoReq->Information.Ulong++; + + break; default: AFD_DbgPrint(MID_TRACE,("Unknown info id %x\n",
15 years, 4 months
1
0
0
0
[dgorbachev] 42541: Fix issue #4673 ("Misrepresented license in FreeLDR"), Robert Millan (rmh.reactos at aybabtu.com).
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Sun Aug 9 00:39:04 2009 New Revision: 42541 URL:
http://svn.reactos.org/svn/reactos?rev=42541&view=rev
Log: Fix issue #4673 ("Misrepresented license in FreeLDR"), Robert Millan (rmh.reactos at
aybabtu.com
). Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c trunk/reactos/boot/freeldr/freeldr/fs/fsrec.c trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ex…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] Sun Aug 9 00:39:04 2009 @@ -45,13 +45,13 @@ BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG DoubleIndirectBlock); BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG TripleIndirectBlock); -GEOMETRY Ext2DiskGeometry; // Ext2 file system disk geometry +GEOMETRY Ext2DiskGeometry; // Ext2 file system disk geometry PEXT2_SUPER_BLOCK Ext2SuperBlock = NULL; // Ext2 file system super block PEXT2_GROUP_DESC Ext2GroupDescriptors = NULL; // Ext2 file system group descriptors UCHAR Ext2DriveNumber = 0; // Ext2 file system drive number -ULONGLONG Ext2VolumeStartSector = 0; // Ext2 file system starting sector +ULONGLONG Ext2VolumeStartSector = 0; // Ext2 file system starting sector ULONG Ext2BlockSizeInBytes = 0; // Block size in bytes ULONG Ext2BlockSizeInSectors = 0; // Block size in sectors ULONG Ext2FragmentSizeInBytes = 0; // Fragment size in bytes @@ -106,13 +106,13 @@ { EXT2_FILE_INFO TempExt2FileInfo; PEXT2_FILE_INFO FileHandle; - CHAR SymLinkPath[EXT3_NAME_LEN]; - CHAR FullPath[EXT3_NAME_LEN * 2]; - ULONG Index; + CHAR SymLinkPath[EXT2_NAME_LEN]; + CHAR FullPath[EXT2_NAME_LEN * 2]; + ULONG Index; DPRINTM(DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName); - RtlZeroMemory(SymLinkPath, EXT3_NAME_LEN); + RtlZeroMemory(SymLinkPath, sizeof(SymLinkPath)); // Lookup the file in the file system if (!Ext2LookupFile(FileName, &TempExt2FileInfo)) @@ -122,7 +122,7 @@ // If we got a symbolic link then fix up the path // and re-call this function - if ((TempExt2FileInfo.Inode.i_mode & EXT2_S_IFMT) == EXT2_S_IFLNK) + if ((TempExt2FileInfo.Inode.mode & EXT2_S_IFMT) == EXT2_S_IFLNK) { DPRINTM(DPRINT_FILESYSTEM, "File is a symbolic link\n"); @@ -207,12 +207,12 @@ */ BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer) { - UINT32 i; - ULONG NumberOfPathParts; - CHAR PathPart[261]; - PVOID DirectoryBuffer; - ULONG DirectoryInode = EXT3_ROOT_INO; - EXT2_INODE InodeData; + UINT32 i; + ULONG NumberOfPathParts; + CHAR PathPart[261]; + PVOID DirectoryBuffer; + ULONG DirectoryInode = EXT2_ROOT_INO; + EXT2_INODE InodeData; EXT2_DIR_ENTRY DirectoryEntry; DPRINTM(DPRINT_FILESYSTEM, "Ext2LookupFile() FileName = %s\n", FileName); @@ -269,8 +269,8 @@ return FALSE; } - if (((InodeData.i_mode & EXT2_S_IFMT) != EXT2_S_IFREG) && - ((InodeData.i_mode & EXT2_S_IFMT) != EXT2_S_IFLNK)) + if (((InodeData.mode & EXT2_S_IFMT) != EXT2_S_IFREG) && + ((InodeData.mode & EXT2_S_IFMT) != EXT2_S_IFLNK)) { FileSystemError("Inode is not a regular file or symbolic link."); return FALSE; @@ -282,8 +282,8 @@ // If it's a regular file or a regular symbolic link // then get the block pointer list otherwise it must // be a fast symbolic link which doesn't have a block list - if (((InodeData.i_mode & EXT2_S_IFMT) == EXT2_S_IFREG) || - ((InodeData.i_mode & EXT2_S_IFMT) == EXT2_S_IFLNK && InodeData.i_size > FAST_SYMLINK_MAX_NAME_SIZE)) + if (((InodeData.mode & EXT2_S_IFMT) == EXT2_S_IFREG) || + ((InodeData.mode & EXT2_S_IFMT) == EXT2_S_IFLNK && InodeData.size > FAST_SYMLINK_MAX_NAME_SIZE)) { Ext2FileInfoPointer->FileBlockList = Ext2ReadBlockPointerList(&InodeData); @@ -306,7 +306,7 @@ BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry) { - ULONG CurrentOffset; + ULONG CurrentOffset; PEXT2_DIR_ENTRY CurrentDirectoryEntry; DPRINTM(DPRINT_FILESYSTEM, "Ext2SearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectorySize = %d FileName = %s\n", DirectoryBuffer, DirectorySize, FileName); @@ -315,32 +315,32 @@ { CurrentDirectoryEntry = (PEXT2_DIR_ENTRY)((ULONG_PTR)DirectoryBuffer + CurrentOffset); - if (CurrentDirectoryEntry->rec_len == 0) + if (CurrentDirectoryEntry->direntlen == 0) { break; } - if ((CurrentDirectoryEntry->rec_len + CurrentOffset) > DirectorySize) + if ((CurrentDirectoryEntry->direntlen + CurrentOffset) > DirectorySize) { FileSystemError("Directory entry extends past end of directory file."); return FALSE; } 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) && - (strlen(FileName) == CurrentDirectoryEntry->name_len)) + DbgDumpBuffer(DPRINT_FILESYSTEM, CurrentDirectoryEntry, CurrentDirectoryEntry->direntlen); + + if ((_strnicmp(FileName, CurrentDirectoryEntry->name, CurrentDirectoryEntry->namelen) == 0) && + (strlen(FileName) == CurrentDirectoryEntry->namelen)) { RtlCopyMemory(DirectoryEntry, CurrentDirectoryEntry, sizeof(EXT2_DIR_ENTRY)); 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, "direntlen = %d\n", DirectoryEntry->direntlen); + DPRINTM(DPRINT_FILESYSTEM, "namelen = %d\n", DirectoryEntry->namelen); + DPRINTM(DPRINT_FILESYSTEM, "filetype = %d\n", DirectoryEntry->filetype); DPRINTM(DPRINT_FILESYSTEM, "name = "); - for (CurrentOffset=0; CurrentOffset<DirectoryEntry->name_len; CurrentOffset++) + for (CurrentOffset=0; CurrentOffset<DirectoryEntry->namelen; CurrentOffset++) { DPRINTM(DPRINT_FILESYSTEM, "%c", DirectoryEntry->name[CurrentOffset]); } @@ -349,7 +349,7 @@ return TRUE; } - CurrentOffset += CurrentDirectoryEntry->rec_len; + CurrentOffset += CurrentDirectoryEntry->direntlen; } return FALSE; @@ -380,7 +380,7 @@ { // Block pointer list is NULL // so this better be a fast symbolic link or else - if (((Ext2FileInfo->Inode.i_mode & EXT2_S_IFMT) != EXT2_S_IFLNK) || + if (((Ext2FileInfo->Inode.mode & EXT2_S_IFMT) != EXT2_S_IFLNK) || (Ext2FileInfo->FileSize > FAST_SYMLINK_MAX_NAME_SIZE)) { FileSystemError("Block pointer list is NULL and file is not a fast symbolic link."); @@ -409,13 +409,13 @@ // Check if this is a fast symbolic link // if so then the read is easy - if (((Ext2FileInfo->Inode.i_mode & EXT2_S_IFMT) == EXT2_S_IFLNK) && + if (((Ext2FileInfo->Inode.mode & EXT2_S_IFMT) == EXT2_S_IFLNK) && (Ext2FileInfo->FileSize <= FAST_SYMLINK_MAX_NAME_SIZE)) { 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); + RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.symlink), BytesToRead); if (BytesRead != NULL) { @@ -596,60 +596,47 @@ RtlCopyMemory(Ext2SuperBlock, (PVOID)((ULONG_PTR)DISKREADBUFFER + 1024), 1024); 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]); - 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); + DPRINTM(DPRINT_FILESYSTEM, "total_inodes: %d\n", Ext2SuperBlock->total_inodes); + DPRINTM(DPRINT_FILESYSTEM, "total_blocks: %d\n", Ext2SuperBlock->total_blocks); + DPRINTM(DPRINT_FILESYSTEM, "reserved_blocks: %d\n", Ext2SuperBlock->reserved_blocks); + DPRINTM(DPRINT_FILESYSTEM, "free_blocks: %d\n", Ext2SuperBlock->free_blocks); + DPRINTM(DPRINT_FILESYSTEM, "free_inodes: %d\n", Ext2SuperBlock->free_inodes); + DPRINTM(DPRINT_FILESYSTEM, "first_data_block: %d\n", Ext2SuperBlock->first_data_block); + DPRINTM(DPRINT_FILESYSTEM, "log2_block_size: %d\n", Ext2SuperBlock->log2_block_size); + DPRINTM(DPRINT_FILESYSTEM, "log2_fragment_size: %d\n", Ext2SuperBlock->log2_fragment_size); + DPRINTM(DPRINT_FILESYSTEM, "blocks_per_group: %d\n", Ext2SuperBlock->blocks_per_group); + DPRINTM(DPRINT_FILESYSTEM, "fragments_per_group: %d\n", Ext2SuperBlock->fragments_per_group); + DPRINTM(DPRINT_FILESYSTEM, "inodes_per_group: %d\n", Ext2SuperBlock->inodes_per_group); + DPRINTM(DPRINT_FILESYSTEM, "mtime: %d\n", Ext2SuperBlock->mtime); + DPRINTM(DPRINT_FILESYSTEM, "utime: %d\n", Ext2SuperBlock->utime); + DPRINTM(DPRINT_FILESYSTEM, "mnt_count: %d\n", Ext2SuperBlock->mnt_count); + DPRINTM(DPRINT_FILESYSTEM, "max_mnt_count: %d\n", Ext2SuperBlock->max_mnt_count); + DPRINTM(DPRINT_FILESYSTEM, "magic: 0x%x\n", Ext2SuperBlock->magic); + DPRINTM(DPRINT_FILESYSTEM, "fs_state: %d\n", Ext2SuperBlock->fs_state); + DPRINTM(DPRINT_FILESYSTEM, "error_handling: %d\n", Ext2SuperBlock->error_handling); + DPRINTM(DPRINT_FILESYSTEM, "minor_revision_level: %d\n", Ext2SuperBlock->minor_revision_level); + DPRINTM(DPRINT_FILESYSTEM, "lastcheck: %d\n", Ext2SuperBlock->lastcheck); + DPRINTM(DPRINT_FILESYSTEM, "checkinterval: %d\n", Ext2SuperBlock->checkinterval); + DPRINTM(DPRINT_FILESYSTEM, "creator_os: %d\n", Ext2SuperBlock->creator_os); + DPRINTM(DPRINT_FILESYSTEM, "revision_level: %d\n", Ext2SuperBlock->revision_level); + DPRINTM(DPRINT_FILESYSTEM, "uid_reserved: %d\n", Ext2SuperBlock->uid_reserved); + DPRINTM(DPRINT_FILESYSTEM, "gid_reserved: %d\n", Ext2SuperBlock->gid_reserved); + DPRINTM(DPRINT_FILESYSTEM, "first_inode: %d\n", Ext2SuperBlock->first_inode); + DPRINTM(DPRINT_FILESYSTEM, "inode_size: %d\n", Ext2SuperBlock->inode_size); + DPRINTM(DPRINT_FILESYSTEM, "block_group_number: %d\n", Ext2SuperBlock->block_group_number); + DPRINTM(DPRINT_FILESYSTEM, "feature_compatibility: 0x%x\n", Ext2SuperBlock->feature_compatibility); + DPRINTM(DPRINT_FILESYSTEM, "feature_incompat: 0x%x\n", Ext2SuperBlock->feature_incompat); + DPRINTM(DPRINT_FILESYSTEM, "feature_ro_compat: 0x%x\n", Ext2SuperBlock->feature_ro_compat); + DPRINTM(DPRINT_FILESYSTEM, "unique_id = { 0x%x, 0x%x, 0x%x, 0x%x }\n", + Ext2SuperBlock->unique_id[0], Ext2SuperBlock->unique_id[1], Ext2SuperBlock->unique_id[2], Ext2SuperBlock->unique_id[3]); + DPRINTM(DPRINT_FILESYSTEM, "volume_name = '%.16s'\n", Ext2SuperBlock->volume_name); + DPRINTM(DPRINT_FILESYSTEM, "last_mounted_on = '%.64s'\n", Ext2SuperBlock->last_mounted_on); + DPRINTM(DPRINT_FILESYSTEM, "compression_info = 0x%x\n", Ext2SuperBlock->compression_info); // // Check the super block magic // - if (Ext2SuperBlock->s_magic != EXT3_SUPER_MAGIC) + if (Ext2SuperBlock->magic != EXT2_MAGIC) { FileSystemError("Invalid super block magic (0xef53)"); return FALSE; @@ -658,7 +645,7 @@ // // Check the revision level // - if (Ext2SuperBlock->s_rev_level > EXT3_DYNAMIC_REV) + if (Ext2SuperBlock->revision_level > EXT2_DYNAMIC_REVISION) { FileSystemError("FreeLoader does not understand the revision of this EXT2/EXT3 filesystem.\nPlease update FreeLoader."); return FALSE; @@ -669,33 +656,33 @@ // Don't need to check the compatible or read-only compatible features // because we only mount the filesystem as read-only // - if ((Ext2SuperBlock->s_rev_level >= EXT3_DYNAMIC_REV) && + if ((Ext2SuperBlock->revision_level >= EXT2_DYNAMIC_REVISION) && (/*((Ext2SuperBlock->s_feature_compat & ~EXT3_FEATURE_COMPAT_SUPP) != 0) ||*/ /*((Ext2SuperBlock->s_feature_ro_compat & ~EXT3_FEATURE_RO_COMPAT_SUPP) != 0) ||*/ - ((Ext2SuperBlock->s_feature_incompat & ~EXT3_FEATURE_INCOMPAT_SUPP) != 0))) + ((Ext2SuperBlock->feature_incompat & ~EXT3_FEATURE_INCOMPAT_SUPP) != 0))) { FileSystemError("FreeLoader does not understand features of this EXT2/EXT3 filesystem.\nPlease update FreeLoader."); return FALSE; } // 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; + Ext2GroupCount = (Ext2SuperBlock->total_blocks - Ext2SuperBlock->first_data_block + Ext2SuperBlock->blocks_per_group - 1) / Ext2SuperBlock->blocks_per_group; DPRINTM(DPRINT_FILESYSTEM, "Ext2GroupCount: %d\n", Ext2GroupCount); // Calculate the block size - Ext2BlockSizeInBytes = 1024 << Ext2SuperBlock->s_log_block_size; + Ext2BlockSizeInBytes = 1024 << Ext2SuperBlock->log2_block_size; Ext2BlockSizeInSectors = Ext2BlockSizeInBytes / Ext2DiskGeometry.BytesPerSector; 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; + if (Ext2SuperBlock->log2_fragment_size >= 0) + { + Ext2FragmentSizeInBytes = 1024 << Ext2SuperBlock->log2_fragment_size; } else { - Ext2FragmentSizeInBytes = 1024 >> -(Ext2SuperBlock->s_log_frag_size); + Ext2FragmentSizeInBytes = 1024 >> -(Ext2SuperBlock->log2_fragment_size); } Ext2FragmentSizeInSectors = Ext2FragmentSizeInBytes / Ext2DiskGeometry.BytesPerSector; DPRINTM(DPRINT_FILESYSTEM, "Ext2FragmentSizeInBytes: %d\n", Ext2FragmentSizeInBytes); @@ -709,11 +696,11 @@ } // Calculate the number of inodes in one block - Ext2InodesPerBlock = Ext2BlockSizeInBytes / EXT3_INODE_SIZE(Ext2SuperBlock); + Ext2InodesPerBlock = Ext2BlockSizeInBytes / EXT2_INODE_SIZE(Ext2SuperBlock); DPRINTM(DPRINT_FILESYSTEM, "Ext2InodesPerBlock: %d\n", Ext2InodesPerBlock); // Calculate the number of group descriptors in one block - Ext2GroupDescPerBlock = EXT3_DESC_PER_BLOCK(Ext2SuperBlock); + Ext2GroupDescPerBlock = EXT2_DESC_PER_BLOCK(Ext2SuperBlock); DPRINTM(DPRINT_FILESYSTEM, "Ext2GroupDescPerBlock: %d\n", Ext2GroupDescPerBlock); return TRUE; @@ -754,7 +741,7 @@ // Now read the group descriptors for (CurrentGroupDescBlock=0; CurrentGroupDescBlock<GroupDescBlockCount; CurrentGroupDescBlock++) { - if (!Ext2ReadBlock(Ext2SuperBlock->s_first_data_block + 1 + CurrentGroupDescBlock, (PVOID)FILESYSBUFFER)) + if (!Ext2ReadBlock(Ext2SuperBlock->first_data_block + 1 + CurrentGroupDescBlock, (PVOID)FILESYSBUFFER)) { return FALSE; } @@ -778,7 +765,7 @@ } // Make sure it is a directory inode - if ((InodePointer->i_mode & EXT2_S_IFMT) != EXT2_S_IFDIR) + if ((InodePointer->mode & EXT2_S_IFMT) != EXT2_S_IFDIR) { FileSystemError("Inode is not a directory."); return FALSE; @@ -826,12 +813,12 @@ BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer) { - CHAR ErrorString[80]; + CHAR ErrorString[80]; DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer); // Make sure its a valid block - if (BlockNumber > Ext2SuperBlock->s_blocks_count) + if (BlockNumber > Ext2SuperBlock->total_blocks) { sprintf(ErrorString, "Error reading block %d - block out of range.", (int) BlockNumber); FileSystemError(ErrorString); @@ -872,7 +859,7 @@ ULONG Ext2GetGroupDescBlockNumber(ULONG Group) { - return (((Group * sizeof(EXT2_GROUP_DESC)) / Ext2GroupDescPerBlock) + Ext2SuperBlock->s_first_data_block + 1); + return (((Group * sizeof(EXT2_GROUP_DESC)) / Ext2GroupDescPerBlock) + Ext2SuperBlock->first_data_block + 1); } ULONG Ext2GetGroupDescOffsetInBlock(ULONG Group) @@ -882,31 +869,31 @@ ULONG Ext2GetInodeGroupNumber(ULONG Inode) { - return ((Inode - 1) / Ext2SuperBlock->s_inodes_per_group); + return ((Inode - 1) / Ext2SuperBlock->inodes_per_group); } ULONG Ext2GetInodeBlockNumber(ULONG Inode) { - return (((Inode - 1) % Ext2SuperBlock->s_inodes_per_group) / Ext2InodesPerBlock); + return (((Inode - 1) % Ext2SuperBlock->inodes_per_group) / Ext2InodesPerBlock); } ULONG Ext2GetInodeOffsetInBlock(ULONG Inode) { - return (((Inode - 1) % Ext2SuperBlock->s_inodes_per_group) % Ext2InodesPerBlock); + return (((Inode - 1) % Ext2SuperBlock->inodes_per_group) % Ext2InodesPerBlock); } BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer) { - ULONG InodeGroupNumber; - ULONG InodeBlockNumber; - ULONG InodeOffsetInBlock; - CHAR ErrorString[80]; + ULONG InodeGroupNumber; + ULONG InodeBlockNumber; + ULONG InodeOffsetInBlock; + CHAR ErrorString[80]; EXT2_GROUP_DESC GroupDescriptor; DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadInode() Inode = %d\n", Inode); // Make sure its a valid inode - if ((Inode < 1) || (Inode > Ext2SuperBlock->s_inodes_count)) + if ((Inode < 1) || (Inode > Ext2SuperBlock->total_inodes)) { sprintf(ErrorString, "Error reading inode %ld - inode out of range.", Inode); FileSystemError(ErrorString); @@ -928,7 +915,7 @@ } // Add the start block of the inode table to the inode block number - InodeBlockNumber += GroupDescriptor.bg_inode_table; + InodeBlockNumber += GroupDescriptor.inode_table_id; DPRINTM(DPRINT_FILESYSTEM, "InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber); // Read the block @@ -938,29 +925,34 @@ } // Copy the data to their buffer - RtlCopyMemory(InodeBuffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + (InodeOffsetInBlock * EXT3_INODE_SIZE(Ext2SuperBlock))), sizeof(EXT2_INODE)); + RtlCopyMemory(InodeBuffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + (InodeOffsetInBlock * EXT2_INODE_SIZE(Ext2SuperBlock))), sizeof(EXT2_INODE)); 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); + DPRINTM(DPRINT_FILESYSTEM, "mode = 0x%x\n", InodeBuffer->mode); + DPRINTM(DPRINT_FILESYSTEM, "uid = %d\n", InodeBuffer->uid); + DPRINTM(DPRINT_FILESYSTEM, "size = %d\n", InodeBuffer->size); + DPRINTM(DPRINT_FILESYSTEM, "atime = %d\n", InodeBuffer->atime); + DPRINTM(DPRINT_FILESYSTEM, "ctime = %d\n", InodeBuffer->ctime); + DPRINTM(DPRINT_FILESYSTEM, "mtime = %d\n", InodeBuffer->mtime); + DPRINTM(DPRINT_FILESYSTEM, "dtime = %d\n", InodeBuffer->dtime); + DPRINTM(DPRINT_FILESYSTEM, "gid = %d\n", InodeBuffer->gid); + DPRINTM(DPRINT_FILESYSTEM, "nlinks = %d\n", InodeBuffer->nlinks); + DPRINTM(DPRINT_FILESYSTEM, "blockcnt = %d\n", InodeBuffer->blockcnt); + DPRINTM(DPRINT_FILESYSTEM, "flags = 0x%x\n", InodeBuffer->flags); + DPRINTM(DPRINT_FILESYSTEM, "osd1 = 0x%x\n", InodeBuffer->osd1); + DPRINTM(DPRINT_FILESYSTEM, "dir_blocks = { %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u }\n", + InodeBuffer->blocks.dir_blocks[0], InodeBuffer->blocks.dir_blocks[1], InodeBuffer->blocks.dir_blocks[ 2], InodeBuffer->blocks.dir_blocks[ 3], + InodeBuffer->blocks.dir_blocks[4], InodeBuffer->blocks.dir_blocks[5], InodeBuffer->blocks.dir_blocks[ 6], InodeBuffer->blocks.dir_blocks[ 7], + InodeBuffer->blocks.dir_blocks[8], InodeBuffer->blocks.dir_blocks[9], InodeBuffer->blocks.dir_blocks[10], InodeBuffer->blocks.dir_blocks[11]); + DPRINTM(DPRINT_FILESYSTEM, "indir_block = %u\n", InodeBuffer->blocks.indir_block); + DPRINTM(DPRINT_FILESYSTEM, "double_indir_block = %u\n", InodeBuffer->blocks.double_indir_block); + DPRINTM(DPRINT_FILESYSTEM, "tripple_indir_block = %u\n", InodeBuffer->blocks.tripple_indir_block); + DPRINTM(DPRINT_FILESYSTEM, "version = %d\n", InodeBuffer->version); + DPRINTM(DPRINT_FILESYSTEM, "acl = %d\n", InodeBuffer->acl); + DPRINTM(DPRINT_FILESYSTEM, "dir_acl = %d\n", InodeBuffer->dir_acl); + DPRINTM(DPRINT_FILESYSTEM, "fragment_addr = %d\n", InodeBuffer->fragment_addr); + DPRINTM(DPRINT_FILESYSTEM, "osd2 = { %d, %d, %d }\n", + InodeBuffer->osd2[0], InodeBuffer->osd2[1], InodeBuffer->osd2[2]); return TRUE; } @@ -979,12 +971,12 @@ RtlCopyMemory(GroupBuffer, &Ext2GroupDescriptors[Group], sizeof(EXT2_GROUP_DESC)); 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); + DPRINTM(DPRINT_FILESYSTEM, "block_id = %d\n", GroupBuffer->block_id); + DPRINTM(DPRINT_FILESYSTEM, "inode_id = %d\n", GroupBuffer->inode_id); + DPRINTM(DPRINT_FILESYSTEM, "inode_table_id = %d\n", GroupBuffer->inode_table_id); + DPRINTM(DPRINT_FILESYSTEM, "free_blocks = %d\n", GroupBuffer->free_blocks); + DPRINTM(DPRINT_FILESYSTEM, "free_inodes = %d\n", GroupBuffer->free_inodes); + DPRINTM(DPRINT_FILESYSTEM, "used_dirs = %d\n", GroupBuffer->used_dirs); return TRUE; } @@ -1017,19 +1009,19 @@ } RtlZeroMemory(BlockList, BlockCount * sizeof(ULONG)); - CurrentBlockInList = 0; // Copy the direct block pointers - for (CurrentBlock=0; CurrentBlockInList<BlockCount && CurrentBlock<EXT3_NDIR_BLOCKS; CurrentBlock++) - { - BlockList[CurrentBlockInList] = Inode->i_block[CurrentBlock]; - CurrentBlockInList++; + for (CurrentBlockInList = CurrentBlock = 0; + CurrentBlockInList < BlockCount && CurrentBlock < INDIRECT_BLOCKS; + CurrentBlock++, CurrentBlockInList++) + { + BlockList[CurrentBlockInList] = Inode->blocks.dir_blocks[CurrentBlock]; } // Copy the indirect block pointers if (CurrentBlockInList < BlockCount) { - if (!Ext2CopyIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->i_block[EXT3_IND_BLOCK])) + if (!Ext2CopyIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->blocks.indir_block)) { MmHeapFree(BlockList); return FALSE; @@ -1039,7 +1031,7 @@ // Copy the double indirect block pointers if (CurrentBlockInList < BlockCount) { - if (!Ext2CopyDoubleIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->i_block[EXT3_DIND_BLOCK])) + if (!Ext2CopyDoubleIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->blocks.double_indir_block)) { MmHeapFree(BlockList); return FALSE; @@ -1049,7 +1041,7 @@ // Copy the triple indirect block pointers if (CurrentBlockInList < BlockCount) { - if (!Ext2CopyTripleIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->i_block[EXT3_TIND_BLOCK])) + if (!Ext2CopyTripleIndirectBlockPointers(BlockList, &CurrentBlockInList, BlockCount, Inode->blocks.tripple_indir_block)) { MmHeapFree(BlockList); return FALSE; @@ -1061,21 +1053,21 @@ ULONGLONG Ext2GetInodeFileSize(PEXT2_INODE Inode) { - if ((Inode->i_mode & EXT2_S_IFMT) == EXT2_S_IFDIR) - { - return (ULONGLONG)(Inode->i_size); + if ((Inode->mode & EXT2_S_IFMT) == EXT2_S_IFDIR) + { + return (ULONGLONG)(Inode->size); } else { - return ((ULONGLONG)(Inode->i_size) | ((ULONGLONG)(Inode->i_dir_acl) << 32)); + return ((ULONGLONG)(Inode->size) | ((ULONGLONG)(Inode->dir_acl) << 32)); } } BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG IndirectBlock) { ULONG* BlockBuffer = (ULONG*)FILESYSBUFFER; - ULONG CurrentBlock; - ULONG BlockPointersPerBlock; + ULONG CurrentBlock; + ULONG BlockPointersPerBlock; DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyIndirectBlockPointers() BlockCount = %d\n", BlockCount); @@ -1098,8 +1090,8 @@ BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG DoubleIndirectBlock) { ULONG* BlockBuffer; - ULONG CurrentBlock; - ULONG BlockPointersPerBlock; + ULONG CurrentBlock; + ULONG BlockPointersPerBlock; DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyDoubleIndirectBlockPointers() BlockCount = %d\n", BlockCount); @@ -1133,8 +1125,8 @@ BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG TripleIndirectBlock) { ULONG* BlockBuffer; - ULONG CurrentBlock; - ULONG BlockPointersPerBlock; + ULONG CurrentBlock; + ULONG BlockPointersPerBlock; DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyTripleIndirectBlockPointers() BlockCount = %d\n", BlockCount); @@ -1289,7 +1281,7 @@ // // Check if SuperBlock is valid. If yes, return Ext2 function table // - if (SuperBlock.s_magic == EXT3_SUPER_MAGIC) + if (SuperBlock.magic == EXT2_MAGIC) { // // Compatibility hack as long as FS is not using underlying device DeviceId Modified: trunk/reactos/boot/freeldr/freeldr/fs/fsrec.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fsrec.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fsrec.c [iso-8859-1] Sun Aug 9 00:39:04 2009 @@ -83,7 +83,7 @@ return FALSE; } - if (SuperBlock->s_magic == EXT3_SUPER_MAGIC) + if (SuperBlock->magic == EXT2_MAGIC) { return TRUE; } Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h [iso-8859-1] Sun Aug 9 00:39:04 2009 @@ -20,615 +20,182 @@ #ifndef __EXT2_H #define __EXT2_H - /* - * linux/include/linux/ext3_fs.h - * - * Copyright (C) 1992, 1993, 1994, 1995 - * Remy Card (card(a)masi.ibp.fr) - * Laboratoire MASI - Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - * - * from - * - * linux/include/linux/minix_fs.h - * - * Copyright (C) 1991, 1992 Linus Torvalds + * grub/fs/ext2.c + * + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc. + * + * 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 GRUB. If not, see <
http://www.gnu.org/licenses/
>. */ -#ifndef _LINUX_EXT3_FS_H -#define _LINUX_EXT3_FS_H - -//#include <linux/types.h> +/* Magic value used to identify an ext2 filesystem. */ +#define EXT2_MAGIC 0xEF53 +/* Amount of indirect blocks in an inode. */ +#define INDIRECT_BLOCKS 12 +/* Maximum lenght of a pathname. */ +#define EXT2_PATH_MAX 4096 +/* Maximum nesting of symlinks, used to prevent a loop. */ +#define EXT2_MAX_SYMLINKCNT 8 + +/* The good old revision and the default inode size. */ +#define EXT2_GOOD_OLD_REVISION 0 +#define EXT2_DYNAMIC_REVISION 1 +#define EXT2_GOOD_OLD_INODE_SIZE 128 + +/* Filetype used in directory entry. */ +#define FILETYPE_UNKNOWN 0 +#define FILETYPE_REG 1 +#define FILETYPE_DIRECTORY 2 +#define FILETYPE_SYMLINK 7 + +/* Filetype information as used in inodes. */ +#define FILETYPE_INO_MASK 0170000 +#define FILETYPE_INO_REG 0100000 +#define FILETYPE_INO_DIRECTORY 0040000 +#define FILETYPE_INO_SYMLINK 0120000 + +/* The ext2 superblock. */ +struct ext2_sblock +{ + ULONG total_inodes; + ULONG total_blocks; + ULONG reserved_blocks; + ULONG free_blocks; + ULONG free_inodes; + ULONG first_data_block; + ULONG log2_block_size; + ULONG log2_fragment_size; + ULONG blocks_per_group; + ULONG fragments_per_group; + ULONG inodes_per_group; + ULONG mtime; + ULONG utime; + USHORT mnt_count; + USHORT max_mnt_count; + USHORT magic; + USHORT fs_state; + USHORT error_handling; + USHORT minor_revision_level; + ULONG lastcheck; + ULONG checkinterval; + ULONG creator_os; + ULONG revision_level; + USHORT uid_reserved; + USHORT gid_reserved; + ULONG first_inode; + USHORT inode_size; + USHORT block_group_number; + ULONG feature_compatibility; + ULONG feature_incompat; + ULONG feature_ro_compat; + ULONG unique_id[4]; + char volume_name[16]; + char last_mounted_on[64]; + ULONG compression_info; +}; + +/* The ext2 blockgroup. */ +struct ext2_block_group +{ + ULONG block_id; + ULONG inode_id; + ULONG inode_table_id; + USHORT free_blocks; + USHORT free_inodes; + USHORT used_dirs; + USHORT pad; + ULONG reserved[3]; +}; + +/* The ext2 inode. */ +struct ext2_inode +{ + USHORT mode; + USHORT uid; + ULONG size; + ULONG atime; + ULONG ctime; + ULONG mtime; + ULONG dtime; + USHORT gid; + USHORT nlinks; + ULONG blockcnt; /* Blocks of 512 bytes!! */ + ULONG flags; + ULONG osd1; + union + { + struct datablocks + { + ULONG dir_blocks[INDIRECT_BLOCKS]; + ULONG indir_block; + ULONG double_indir_block; + ULONG tripple_indir_block; + } blocks; + char symlink[60]; + }; + ULONG version; + ULONG acl; + ULONG dir_acl; + ULONG fragment_addr; + ULONG osd2[3]; +}; + +/* The header of an ext2 directory entry. */ +#define EXT2_NAME_LEN 255 + +struct ext2_dirent +{ + ULONG inode; + USHORT direntlen; + UCHAR namelen; + UCHAR filetype; + CHAR name[EXT2_NAME_LEN]; +}; /* - * The second extended filesystem constants/structures + * End of code from grub/fs/ext2.c */ -/* - * Define EXT3FS_DEBUG to produce debug messages - */ -#undef EXT3FS_DEBUG - -/* - * Define EXT3_PREALLOCATE to preallocate data blocks for expanding files - */ -#undef EXT3_PREALLOCATE /* @@@ Fix this! */ -#define EXT3_DEFAULT_PREALLOC_BLOCKS 8 - -/* - * The second extended file system version - */ -#define EXT3FS_DATE "10 Jan 2002" -#define EXT3FS_VERSION "2.4-0.9.17" - -/* - * Debug code - */ -#ifdef EXT3FS_DEBUG -#define ext3_debug(f, a...) \ - do { \ - printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ - __FILE__, __LINE__, __FUNCTION__); \ - printk (KERN_DEBUG f, ## a); \ - } while (0) -#else - #ifdef __GNUC__ - #define ext3_debug(f, a...) do {} while (0) - #else - #define ext3_debug - #endif -#endif - -/* - * Special inodes numbers - */ -#define EXT3_BAD_INO 1 /* Bad blocks inode */ -#define EXT3_ROOT_INO 2 /* Root inode */ -#define EXT3_ACL_IDX_INO 3 /* ACL inode */ -#define EXT3_ACL_DATA_INO 4 /* ACL inode */ -#define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */ -#define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */ -#define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */ -#define EXT3_JOURNAL_INO 8 /* Journal inode */ - -/* First non-reserved inode for old ext3 filesystems */ -#define EXT3_GOOD_OLD_FIRST_INO 11 - -/* - * The second extended file system magic number - */ -#define EXT3_SUPER_MAGIC 0xEF53 - -/* - * Maximal count of links to a file - */ -#define EXT3_LINK_MAX 32000 - -/* - * Macro-instructions used to manage several block sizes - */ -#define EXT3_MIN_BLOCK_SIZE 1024 -#define EXT3_MAX_BLOCK_SIZE 4096 -#define EXT3_MIN_BLOCK_LOG_SIZE 10 -#ifdef __KERNEL__ -# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize) -#else -# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size) -#endif -#define EXT3_ACLE_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_acl_entry)) -#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (ULONG)) -#ifdef __KERNEL__ -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) -#else -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) -#endif -#ifdef __KERNEL__ -#define EXT3_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_addr_per_block_bits) -#define EXT3_INODE_SIZE(s) ((s)->u.ext3_sb.s_inode_size) -#define EXT3_FIRST_INO(s) ((s)->u.ext3_sb.s_first_ino) -#else -#define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ - EXT3_GOOD_OLD_INODE_SIZE : \ - (s)->s_inode_size) -#define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ - EXT3_GOOD_OLD_FIRST_INO : \ - (s)->s_first_ino) -#endif - -/* - * Macro-instructions used to manage fragments - */ -#define EXT3_MIN_FRAG_SIZE 1024 -#define EXT3_MAX_FRAG_SIZE 4096 -#define EXT3_MIN_FRAG_LOG_SIZE 10 -#ifdef __KERNEL__ -# define EXT3_FRAG_SIZE(s) ((s)->u.ext3_sb.s_frag_size) -# define EXT3_FRAGS_PER_BLOCK(s) ((s)->u.ext3_sb.s_frags_per_block) -#else -# define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size) -# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s)) -#endif - -/* - * ACL structures - */ -struct ext3_acl_header /* Header of Access Control Lists */ -{ - ULONG aclh_size; - ULONG aclh_file_count; - ULONG aclh_acle_count; - ULONG aclh_first_acle; -}; - -struct ext3_acl_entry /* Access Control List Entry */ -{ - ULONG acle_size; - USHORT acle_perms; /* Access permissions */ - USHORT acle_type; /* Type of entry */ - USHORT acle_tag; /* User or group identity */ - USHORT acle_pad1; - ULONG acle_next; /* Pointer on next entry for the */ - /* same inode or on next free entry */ -}; - -/* - * Structure of a blocks group descriptor - */ -struct ext3_group_desc -{ - ULONG bg_block_bitmap; /* Blocks bitmap block */ - ULONG bg_inode_bitmap; /* Inodes bitmap block */ - ULONG bg_inode_table; /* Inodes table block */ - USHORT bg_free_blocks_count; /* Free blocks count */ - USHORT bg_free_inodes_count; /* Free inodes count */ - USHORT bg_used_dirs_count; /* Directories count */ - USHORT bg_pad; - ULONG bg_reserved[3]; -}; - -/* - * Macro-instructions used to manage group descriptors - */ -#ifdef __KERNEL__ -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->u.ext3_sb.s_blocks_per_group) -# define EXT3_DESC_PER_BLOCK(s) ((s)->u.ext3_sb.s_desc_per_block) -# define EXT3_INODES_PER_GROUP(s) ((s)->u.ext3_sb.s_inodes_per_group) -# define EXT3_DESC_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_desc_per_block_bits) -#else -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) -# define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc)) -# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) -#endif - -/* - * Constants relative to the data blocks - */ -#define EXT3_NDIR_BLOCKS 12 -#define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS -#define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1) -#define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1) -#define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1) - -/* - * Inode flags - */ -#define EXT3_SECRM_FL 0x00000001 /* Secure deletion */ -#define EXT3_UNRM_FL 0x00000002 /* Undelete */ -#define EXT3_COMPR_FL 0x00000004 /* Compress file */ -#define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */ -#define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */ -#define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */ -#define EXT3_NODUMP_FL 0x00000040 /* do not dump file */ -#define EXT3_NOATIME_FL 0x00000080 /* do not update atime */ -/* Reserved for compression usage... */ -#define EXT3_DIRTY_FL 0x00000100 -#define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ -#define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */ -#define EXT3_ECOMPR_FL 0x00000800 /* Compression error */ -/* End compression flags --- maybe not all used */ -#define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */ -#define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */ -#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ -#define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */ - -#define EXT3_FL_USER_VISIBLE 0x00005FFF /* User visible flags */ -#define EXT3_FL_USER_MODIFIABLE 0x000000FF /* User modifiable flags */ - -/* - * Inode dynamic state flags - */ -#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */ -#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */ - -/* - * ioctl commands - */ -#define EXT3_IOC_GETFLAGS _IOR('f', 1, long) -#define EXT3_IOC_SETFLAGS _IOW('f', 2, long) -#define EXT3_IOC_GETVERSION _IOR('f', 3, long) -#define EXT3_IOC_SETVERSION _IOW('f', 4, long) -#define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long) -#define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long) -#ifdef CONFIG_JBD_DEBUG -#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) -#endif - -/* - * Structure of an inode on the disk - */ -struct ext3_inode { - USHORT i_mode; /* File mode */ - USHORT i_uid; /* Low 16 bits of Owner Uid */ - ULONG i_size; /* Size in bytes */ - ULONG i_atime; /* Access time */ - ULONG i_ctime; /* Creation time */ - ULONG i_mtime; /* Modification time */ - ULONG i_dtime; /* Deletion Time */ - USHORT i_gid; /* Low 16 bits of Group Id */ - USHORT i_links_count; /* Links count */ - ULONG i_blocks; /* Blocks count */ - ULONG i_flags; /* File flags */ - union { - struct { - ULONG l_i_reserved1; - } linux1; - struct { - ULONG h_i_translator; - } hurd1; - struct { - ULONG m_i_reserved1; - } masix1; - } osd1; /* OS dependent 1 */ - ULONG i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ - ULONG i_generation; /* File version (for NFS) */ - ULONG i_file_acl; /* File ACL */ - ULONG i_dir_acl; /* Directory ACL */ - ULONG i_faddr; /* Fragment address */ - union { - struct { - UCHAR l_i_frag; /* Fragment number */ - UCHAR l_i_fsize; /* Fragment size */ - USHORT i_pad1; - USHORT l_i_uid_high; /* these 2 fields */ - USHORT l_i_gid_high; /* were reserved2[0] */ - ULONG l_i_reserved2; - } linux2; - struct { - UCHAR h_i_frag; /* Fragment number */ - UCHAR h_i_fsize; /* Fragment size */ - USHORT h_i_mode_high; - USHORT h_i_uid_high; - USHORT h_i_gid_high; - ULONG h_i_author; - } hurd2; - struct { - UCHAR m_i_frag; /* Fragment number */ - UCHAR m_i_fsize; /* Fragment size */ - USHORT m_pad1; - ULONG m_i_reserved2[2]; - } masix2; - } osd2; /* OS dependent 2 */ -}; - -#define i_size_high i_dir_acl - -#if defined(__KERNEL__) || defined(__linux__) -#define i_reserved1 osd1.linux1.l_i_reserved1 -#define i_frag osd2.linux2.l_i_frag -#define i_fsize osd2.linux2.l_i_fsize -#define i_uid_low i_uid -#define i_gid_low i_gid -#define i_uid_high osd2.linux2.l_i_uid_high -#define i_gid_high osd2.linux2.l_i_gid_high -#define i_reserved2 osd2.linux2.l_i_reserved2 - -#elif defined(__GNU__) - -#define i_translator osd1.hurd1.h_i_translator -#define i_frag osd2.hurd2.h_i_frag; -#define i_fsize osd2.hurd2.h_i_fsize; -#define i_uid_high osd2.hurd2.h_i_uid_high -#define i_gid_high osd2.hurd2.h_i_gid_high -#define i_author osd2.hurd2.h_i_author - -#elif defined(__masix__) - -#define i_reserved1 osd1.masix1.m_i_reserved1 -#define i_frag osd2.masix2.m_i_frag -#define i_fsize osd2.masix2.m_i_fsize -#define i_reserved2 osd2.masix2.m_i_reserved2 - -#endif /* defined(__KERNEL__) || defined(__linux__) */ - -/* - * File system states - */ -#define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */ -#define EXT3_ERROR_FS 0x0002 /* Errors detected */ -#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ - -/* - * Mount flags - */ -#define EXT3_MOUNT_CHECK 0x0001 /* Do mount-time checks */ -#define EXT3_MOUNT_GRPID 0x0004 /* Create files with directory's group */ -#define EXT3_MOUNT_DEBUG 0x0008 /* Some debugging messages */ -#define EXT3_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ -#define EXT3_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ -#define EXT3_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ -#define EXT3_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ -#define EXT3_MOUNT_NOLOAD 0x0100 /* Don't use existing journal*/ -#define EXT3_MOUNT_ABORT 0x0200 /* Fatal error detected */ -#define EXT3_MOUNT_DATA_FLAGS 0x0C00 /* Mode for data writes: */ - #define EXT3_MOUNT_JOURNAL_DATA 0x0400 /* Write data to journal */ - #define EXT3_MOUNT_ORDERED_DATA 0x0800 /* Flush data before commit */ - #define EXT3_MOUNT_WRITEBACK_DATA 0x0C00 /* No data ordering */ -#define EXT3_MOUNT_UPDATE_JOURNAL 0x1000 /* Update the journal format */ -#define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */ - -/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ -#ifndef _LINUX_EXT2_FS_H -#define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt -#define set_opt(o, opt) o |= EXT3_MOUNT_##opt -#define test_opt(sb, opt) ((sb)->u.ext3_sb.s_mount_opt & \ - EXT3_MOUNT_##opt) -#else -#define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD -#define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT -#endif - -#define ext3_set_bit ext2_set_bit -#define ext3_clear_bit ext2_clear_bit -#define ext3_test_bit ext2_test_bit -#define ext3_find_first_zero_bit ext2_find_first_zero_bit -#define ext3_find_next_zero_bit ext2_find_next_zero_bit - -/* - * Maximal mount counts between two filesystem checks - */ -#define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ -#define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */ - -/* - * Behaviour when detecting errors - */ -#define EXT3_ERRORS_CONTINUE 1 /* Continue execution */ -#define EXT3_ERRORS_RO 2 /* Remount fs read-only */ -#define EXT3_ERRORS_PANIC 3 /* Panic */ -#define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE - -/* - * Structure of the super block - */ -struct ext3_super_block { -/*00*/ ULONG s_inodes_count; /* Inodes count */ - ULONG s_blocks_count; /* Blocks count */ - ULONG s_r_blocks_count; /* Reserved blocks count */ - ULONG s_free_blocks_count; /* Free blocks count */ -/*10*/ ULONG s_free_inodes_count; /* Free inodes count */ - ULONG s_first_data_block; /* First Data Block */ - ULONG s_log_block_size; /* Block size */ - LONG s_log_frag_size; /* Fragment size */ -/*20*/ ULONG s_blocks_per_group; /* # Blocks per group */ - ULONG s_frags_per_group; /* # Fragments per group */ - ULONG s_inodes_per_group; /* # Inodes per group */ - ULONG s_mtime; /* Mount time */ -/*30*/ ULONG s_wtime; /* Write time */ - USHORT s_mnt_count; /* Mount count */ - SHORT s_max_mnt_count; /* Maximal mount count */ - USHORT s_magic; /* Magic signature */ - USHORT s_state; /* File system state */ - USHORT s_errors; /* Behaviour when detecting errors */ - USHORT s_minor_rev_level; /* minor revision level */ -/*40*/ ULONG s_lastcheck; /* time of last check */ - ULONG s_checkinterval; /* max. time between checks */ - ULONG s_creator_os; /* OS */ - ULONG s_rev_level; /* Revision level */ -/*50*/ USHORT s_def_resuid; /* Default uid for reserved blocks */ - USHORT s_def_resgid; /* Default gid for reserved blocks */ - /* - * These fields are for EXT3_DYNAMIC_REV superblocks only. - * - * Note: the difference between the compatible feature set and - * the incompatible feature set is that if there is a bit set - * in the incompatible feature set that the kernel doesn't - * know about, it should refuse to mount the filesystem. - * - * e2fsck's requirements are more strict; if it doesn't know - * about a feature in either the compatible or incompatible - * feature set, it must abort and not try to meddle with - * things it doesn't understand... - */ - ULONG s_first_ino; /* First non-reserved inode */ - USHORT s_inode_size; /* size of inode structure */ - USHORT s_block_group_nr; /* block group # of this superblock */ - ULONG s_feature_compat; /* compatible feature set */ -/*60*/ ULONG s_feature_incompat; /* incompatible feature set */ - ULONG s_feature_ro_compat; /* readonly-compatible feature set */ -/*68*/ UCHAR s_uuid[16]; /* 128-bit uuid for volume */ -/*78*/ char s_volume_name[16]; /* volume name */ -/*88*/ char s_last_mounted[64]; /* directory where last mounted */ -/*C8*/ ULONG s_algorithm_usage_bitmap; /* For compression */ - /* - * Performance hints. Directory preallocation should only - * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on. - */ - UCHAR s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ - UCHAR s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ - USHORT s_padding1; - /* - * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. - */ -/*D0*/ UCHAR s_journal_uuid[16]; /* uuid of journal superblock */ -/*E0*/ ULONG s_journal_inum; /* inode number of journal file */ - ULONG s_journal_dev; /* device number of journal file */ - ULONG s_last_orphan; /* start of list of inodes to delete */ - -/*EC*/ ULONG s_reserved[197]; /* Padding to the end of the block */ -}; - -#ifdef __KERNEL__ -#define EXT3_SB(sb) (&((sb)->u.ext3_sb)) -#define EXT3_I(inode) (&((inode)->u.ext3_i)) -#else -/* Assume that user mode programs are passing in an ext3fs superblock, not - * a kernel struct super_block. This will allow us to call the feature-test - * macros from user land. */ -#define EXT3_SB(sb) (sb) -#endif - -#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime - -/* - * Codes for operating systems - */ -#define EXT3_OS_LINUX 0 -#define EXT3_OS_HURD 1 -#define EXT3_OS_MASIX 2 -#define EXT3_OS_FREEBSD 3 -#define EXT3_OS_LITES 4 - -/* - * Revision levels - */ -#define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */ -#define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ - -#define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV -#define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV - -#define EXT3_GOOD_OLD_INODE_SIZE 128 - -/* - * Feature set definitions - */ - -#define EXT3_HAS_COMPAT_FEATURE(sb,mask) \ - ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) -#define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \ - ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) -#define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \ - ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) -#define EXT3_SET_COMPAT_FEATURE(sb,mask) \ - EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) -#define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \ - EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) -#define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \ - EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) -#define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \ - EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) -#define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ - EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) -#define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \ - EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) - -#define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001 -#define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 -#define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008 -#define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010 -#define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020 - -#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 -#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 -#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 - -#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001 -#define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002 -#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ - -#define EXT3_FEATURE_COMPAT_SUPP 0 -/*#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \ - EXT3_FEATURE_INCOMPAT_RECOVER)*/ -#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE) -#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \ - EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \ - EXT3_FEATURE_RO_COMPAT_BTREE_DIR) - -/* - * Default values for user and/or group using reserved blocks - */ -#define EXT3_DEF_RESUID 0 -#define EXT3_DEF_RESGID 0 - -/* - * Structure of a directory entry - */ -#define EXT3_NAME_LEN 255 - -struct ext3_dir_entry { - ULONG inode; /* Inode number */ - USHORT rec_len; /* Directory entry length */ - USHORT name_len; /* Name length */ - CHAR name[EXT3_NAME_LEN]; /* File name */ -}; - -/* - * The new version of the directory entry. Since EXT3 structures are - * stored in intel byte order, and the name_len field could never be - * bigger than 255 chars, it's safe to reclaim the extra byte for the - * file_type field. - */ -struct ext3_dir_entry_2 { - ULONG inode; /* Inode number */ - USHORT rec_len; /* Directory entry length */ - UCHAR name_len; /* Name length */ - UCHAR file_type; - CHAR name[EXT3_NAME_LEN]; /* File name */ -}; - -/* - * Ext3 directory file types. Only the low 3 bits are used. The - * other bits are reserved for now. - */ -#define EXT3_FT_UNKNOWN 0 -#define EXT3_FT_REG_FILE 1 -#define EXT3_FT_DIR 2 -#define EXT3_FT_CHRDEV 3 -#define EXT3_FT_BLKDEV 4 -#define EXT3_FT_FIFO 5 -#define EXT3_FT_SOCK 6 -#define EXT3_FT_SYMLINK 7 - -#define EXT3_FT_MAX 8 - -/* - * EXT3_DIR_PAD defines the directory entries boundaries - * - * NOTE: It must be a multiple of 4 - */ -#define EXT3_DIR_PAD 4 -#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) -#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ - ~EXT3_DIR_ROUND) - -#ifdef __KERNEL__ -/* - * Describe an inode's exact location on disk and in memory - */ -struct ext3_iloc -{ - struct buffer_head *bh; - struct ext3_inode *raw_inode; - unsigned long block_group; -}; - - - -#endif /* __KERNEL__ */ - -#endif /* _LINUX_EXT3_FS_H */ - - - -typedef struct ext3_super_block EXT2_SUPER_BLOCK, *PEXT2_SUPER_BLOCK; -typedef struct ext3_inode EXT2_INODE, *PEXT2_INODE; -typedef struct ext3_group_desc EXT2_GROUP_DESC, *PEXT2_GROUP_DESC; -typedef struct ext3_dir_entry_2 EXT2_DIR_ENTRY, *PEXT2_DIR_ENTRY; - -// EXT2_INODE::i_mode values +typedef struct ext2_sblock EXT2_SUPER_BLOCK, *PEXT2_SUPER_BLOCK; +typedef struct ext2_inode EXT2_INODE, *PEXT2_INODE; +typedef struct ext2_block_group EXT2_GROUP_DESC, *PEXT2_GROUP_DESC; +typedef struct ext2_dirent EXT2_DIR_ENTRY, *PEXT2_DIR_ENTRY; + +/* Special inode numbers. */ +#define EXT2_ROOT_INO 2 + +/* Feature set definitions. */ +#define EXT3_FEATURE_INCOMPAT_SUPP 0x0002 + +/* Log2 size of ext2 block in bytes. */ +#define LOG2_BLOCK_SIZE(sb) (sb->log2_block_size + 10) + +/* The size of an ext2 block in bytes. */ +#define EXT2_BLOCK_SIZE(sb) (1 << LOG2_BLOCK_SIZE(sb)) + +/* The revision level. */ +#define EXT2_REVISION(sb) (sb->revision_level) + +/* The inode size. */ +#define EXT2_INODE_SIZE(sb) (EXT2_REVISION(sb) == EXT2_GOOD_OLD_REVISION \ + ? EXT2_GOOD_OLD_INODE_SIZE \ + : sb->inode_size) + +#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(struct ext2_block_group)) + +// EXT2_INODE::mode values #define EXT2_S_IRWXO 0x0007 // Other mask #define EXT2_S_IXOTH 0x0001 // ---------x execute #define EXT2_S_IWOTH 0x0002 // --------w- write @@ -657,15 +224,15 @@ #define EXT2_S_IFLNK 0xA000 // Symbolic link #define EXT2_S_IFSOCK 0xC000 // Socket -#define FAST_SYMLINK_MAX_NAME_SIZE (EXT3_N_BLOCKS * sizeof(ULONG)) /* 60 bytes */ +#define FAST_SYMLINK_MAX_NAME_SIZE 60 typedef struct { - ULONGLONG FileSize; // File size - ULONGLONG FilePointer; // File pointer + ULONGLONG FileSize; // File size + ULONGLONG FilePointer; // File pointer ULONG* FileBlockList; // File block list - UCHAR DriveNumber; // Drive number of open file - EXT2_INODE Inode; // File's inode + UCHAR DriveNumber; // Drive number of open file + EXT2_INODE Inode; // File's inode } EXT2_FILE_INFO, * PEXT2_FILE_INFO; const DEVVTBL* Ext2Mount(ULONG DeviceId);
15 years, 4 months
1
0
0
0
[hpoussin] 42540: Remove dead code
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Aug 8 23:50:15 2009 New Revision: 42540 URL:
http://svn.reactos.org/svn/reactos?rev=42540&view=rev
Log: Remove dead code Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c trunk/reactos/boot/freeldr/freeldr/include/fs.h Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] Sat Aug 8 23:50:15 2009 @@ -142,41 +142,6 @@ // Do not check for error; this function is // supposed to always succeed // -} - -ULONG FsGetFilePointer(PFILE FileHandle) -{ - ULONG FileId = (ULONG)FileHandle; - FILEINFORMATION Information; - LONG ret; - - // - // Query file informations - // - ret = ArcGetFileInformation(FileId, &Information); - - // - // Check for error - // - if (ret != ESUCCESS || Information.CurrentAddress.HighPart != 0) - return 0; - - // - // Return file pointer position - // - return Information.CurrentAddress.LowPart; -} - -BOOLEAN FsIsEndOfFile(PFILE FileHandle) -{ - if (FsGetFilePointer(FileHandle) >= FsGetFileSize(FileHandle)) - { - return TRUE; - } - else - { - return FALSE; - } } /* Modified: trunk/reactos/boot/freeldr/freeldr/include/fs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] Sat Aug 8 23:50:15 2009 @@ -54,8 +54,6 @@ BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); ULONG FsGetFileSize(PFILE FileHandle); VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer); -ULONG FsGetFilePointer(PFILE FileHandle); -BOOLEAN FsIsEndOfFile(PFILE FileHandle); ULONG FsGetNumPathParts(PCSTR Path); VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path);
15 years, 4 months
1
0
0
0
[hpoussin] 42539: Use Arc* infrastructure to read the .inf file
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Aug 8 23:23:23 2009 New Revision: 42539 URL:
http://svn.reactos.org/svn/reactos?rev=42539&view=rev
Log: Use Arc* infrastructure to read the .inf file Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inffi…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] Sat Aug 8 23:23:23 2009 @@ -873,91 +873,107 @@ PCSTR FileName, PULONG ErrorLine) { - PFILE FileHandle; - PCHAR FileBuffer; - ULONG FileSize; - PINFCACHE Cache; - BOOLEAN Success; - - - *InfHandle = NULL; - *ErrorLine = (ULONG)-1; - - - /* Open the inf file */ - FileHandle = FsOpenFile (FileName); - if (FileHandle == NULL) - { -// DPRINT("NtOpenFile() failed (Status %lx)\n", Status); - return FALSE; - } - -// DPRINT("NtOpenFile() successful\n"); - - /* Query file size */ - FileSize = FsGetFileSize (FileHandle); - if (FileSize == 0) - { -// DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status); - FsCloseFile (FileHandle); - return FALSE; - } - -// DPRINT("File size: %lu\n", FileLength); - - /* Allocate file buffer */ - FileBuffer = MmHeapAlloc (FileSize + 1); - if (FileBuffer == NULL) - { -// DPRINT1("RtlAllocateHeap() failed\n"); - FsCloseFile (FileHandle); - return FALSE; - } - - /* Read file */ - Success = FsReadFile(FileHandle, FileSize, NULL, FileBuffer); - - FsCloseFile (FileHandle); - if (!Success) - { -// DPRINT("FsReadFile() failed\n"); - MmHeapFree (FileBuffer); - return FALSE; - } - - /* Append string terminator */ - FileBuffer[FileSize] = 0; - - /* Allocate infcache header */ - Cache = (PINFCACHE)MmHeapAlloc (sizeof(INFCACHE)); - if (Cache == NULL) - { -// DPRINT("RtlAllocateHeap() failed\n"); - MmHeapFree (FileBuffer); - return FALSE; - } - - /* Initialize inicache header */ - RtlZeroMemory(Cache, - sizeof(INFCACHE)); - - /* Parse the inf buffer */ - Success = InfpParseBuffer (Cache, - FileBuffer, - FileBuffer + FileSize, - ErrorLine); - if (!Success) - { - MmHeapFree (Cache); - Cache = NULL; - } - - /* Free file buffer */ - MmHeapFree (FileBuffer); - - *InfHandle = (HINF)Cache; - - return Success; + FILEINFORMATION Information; + ULONG FileId; + PCHAR FileBuffer; + ULONG FileSize, Count; + PINFCACHE Cache; + BOOLEAN Success; + LONG ret; + + *InfHandle = NULL; + *ErrorLine = (ULONG)-1; + + // + // Open the .inf file + // + FileId = FsOpenFile(FileName); + if (!FileId) + { + return FALSE; + } + + // + // Query file size + // + ret = ArcGetFileInformation(FileId, &Information); + if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0) + { + ArcClose(FileId); + return FALSE; + } + FileSize = Information.EndingAddress.LowPart; + + // + // Allocate buffer to cache the file + // + FileBuffer = MmHeapAlloc(FileSize + 1); + if (!FileBuffer) + { + ArcClose(FileId); + return FALSE; + } + + // + // Read file into memory + // + ret = ArcRead(FileId, FileBuffer, FileSize, &Count); + if (ret != ESUCCESS || Count != FileSize) + { + ArcClose(FileId); + MmHeapFree(FileBuffer); + return FALSE; + } + + // + // We don't need the file anymore. Close it + // + ArcClose(FileId); + + // + // Append string terminator + // + FileBuffer[FileSize] = 0; + + // + // Allocate infcache header + // + Cache = (PINFCACHE)MmHeapAlloc(sizeof(INFCACHE)); + if (!Cache) + { + MmHeapFree (FileBuffer); + return FALSE; + } + + // + // Initialize inicache header + // + RtlZeroMemory(Cache, sizeof(INFCACHE)); + + // + // Parse the inf buffer + // + Success = InfpParseBuffer(Cache, + FileBuffer, + FileBuffer + FileSize, + ErrorLine); + if (!Success) + { + MmHeapFree(Cache); + Cache = NULL; + } + + // + // Free file buffer, as it has been parsed + // + MmHeapFree(FileBuffer); + + // + // Return .inf parsed contents + // + *InfHandle = (HINF)Cache; + + return Success; }
15 years, 4 months
1
0
0
0
[hpoussin] 42538: Fix some typos and make PFILE a ULONG
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Aug 8 23:11:40 2009 New Revision: 42538 URL:
http://svn.reactos.org/svn/reactos?rev=42538&view=rev
Log: Fix some typos and make PFILE a ULONG Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c trunk/reactos/boot/freeldr/freeldr/fs/fat.c trunk/reactos/boot/freeldr/freeldr/fs/fs.c trunk/reactos/boot/freeldr/freeldr/include/fs.h trunk/reactos/boot/freeldr/freeldr/include/reactos.h trunk/reactos/boot/freeldr/freeldr/linuxboot.c trunk/reactos/boot/freeldr/freeldr/miscboot.c trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ex…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -21,12 +21,12 @@ #include <debug.h> BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount); -FILE* Ext2OpenFile(PCSTR FileName); +PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName); BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer); -BOOLEAN Ext2ReadFileBig(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); +BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); BOOLEAN Ext2ReadSuperBlock(VOID); BOOLEAN Ext2ReadGroupDescriptors(VOID); BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer); @@ -102,7 +102,7 @@ * Tries to open the file 'name' and returns true or false * for success and failure respectively */ -FILE* Ext2OpenFile(PCSTR FileName) +PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName) { EXT2_FILE_INFO TempExt2FileInfo; PEXT2_FILE_INFO FileHandle; @@ -194,7 +194,7 @@ RtlCopyMemory(FileHandle, &TempExt2FileInfo, sizeof(EXT2_FILE_INFO)); - return (FILE*)FileHandle; + return FileHandle; } } @@ -360,9 +360,8 @@ * Reads BytesToRead from open file and * returns the number of bytes read in BytesRead */ -BOOLEAN Ext2ReadFileBig(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer) -{ - PEXT2_FILE_INFO Ext2FileInfo = (PEXT2_FILE_INFO)FileHandle; +BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer) +{ ULONG BlockNumber; ULONG BlockNumberIndex; ULONG OffsetInBlock; @@ -1223,7 +1222,7 @@ LONG Ext2Read(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) { - PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); ULONGLONG BytesReadBig; BOOLEAN ret; Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fa…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -33,7 +33,7 @@ BOOLEAN FatReadCluster(ULONG ClusterNumber, PVOID Buffer); BOOLEAN FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID Buffer); BOOLEAN FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer); -BOOLEAN FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); +BOOLEAN FatReadFile(PFAT_FILE_INFO FatFileInfo, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN gCacheEnabled = FALSE; @@ -1224,9 +1224,8 @@ * Reads BytesToRead from open file and * returns the number of bytes read in BytesRead */ -BOOLEAN FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer) -{ - PFAT_FILE_INFO FatFileInfo = (PFAT_FILE_INFO)FileHandle; +BOOLEAN FatReadFile(PFAT_FILE_INFO FatFileInfo, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer) +{ ULONG ClusterNumber; ULONG OffsetInCluster; ULONG LengthInCluster; Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -62,7 +62,7 @@ if (ret == ESUCCESS) return (PFILE)FileId; else - return NULL; + return (PFILE)0; } VOID FsCloseFile(PFILE FileHandle) Modified: trunk/reactos/boot/freeldr/freeldr/include/fs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -34,8 +34,7 @@ #define FS_EXT2 3 #define FS_ISO9660 5 -#define FILE VOID -#define PFILE FILE * +#define PFILE ULONG VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable); VOID FsSetDeviceSpecific(ULONG FileId, VOID* Specific); Modified: trunk/reactos/boot/freeldr/freeldr/include/reactos.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/reactos.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/reactos.h [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -98,9 +98,9 @@ VOID FASTCALL FrLdrSetupPae(ULONG Magic); VOID FASTCALL FrLdrSetupPageDirectory(VOID); VOID FASTCALL FrLdrGetPaeMode(VOID); -BOOLEAN NTAPI FrLdrMapKernel(FILE *KernelImage); +BOOLEAN NTAPI FrLdrMapKernel(PFILE KernelImage); ULONG_PTR NTAPI FrLdrCreateModule(LPCSTR ModuleName); -ULONG_PTR NTAPI FrLdrLoadModule(FILE *ModuleImage, LPCSTR ModuleName, PULONG ModuleSize); +ULONG_PTR NTAPI FrLdrLoadModule(PFILE ModuleImage, LPCSTR ModuleName, PULONG ModuleSize); BOOLEAN NTAPI FrLdrCloseModule(ULONG_PTR ModuleBase, ULONG dwModuleSize); VOID NTAPI FrLdrStartup(ULONG Magic); typedef VOID (FASTCALL *ROS_KERNEL_ENTRY_POINT)(ULONG Magic, PROS_LOADER_PARAMETER_BLOCK LoaderBlock); @@ -108,7 +108,7 @@ PVOID NTAPI FrLdrMapImage( - IN FILE *Image, + IN PFILE Image, IN PCHAR ShortName, IN ULONG ImageType ); @@ -116,7 +116,7 @@ PVOID NTAPI FrLdrReadAndMapImage( - IN FILE *Image, + IN PFILE Image, IN PCHAR ShortName, IN ULONG ImageType ); Modified: trunk/reactos/boot/freeldr/freeldr/linuxboot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/linux…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/linuxboot.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/linuxboot.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -43,8 +43,8 @@ VOID LoadAndBootLinux(PCSTR OperatingSystemName, PCSTR Description) { - PFILE LinuxKernel = NULL; - PFILE LinuxInitrdFile = NULL; + PFILE LinuxKernel = 0; + PFILE LinuxInitrdFile = 0; CHAR TempString[260]; UiDrawBackdrop(); @@ -81,7 +81,7 @@ // Open the kernel LinuxKernel = FsOpenFile(LinuxKernelName); - if (LinuxKernel == NULL) + if (!LinuxKernel) { sprintf(TempString, "Linux kernel \'%s\' not found.", LinuxKernelName); UiMessageBox(TempString); @@ -92,7 +92,7 @@ if (LinuxHasInitrd) { LinuxInitrdFile = FsOpenFile(LinuxInitrdName); - if (LinuxInitrdFile == NULL) + if (!LinuxInitrdFile) { sprintf(TempString, "Linux initrd image \'%s\' not found.", LinuxInitrdName); UiMessageBox(TempString); @@ -178,11 +178,11 @@ LinuxBootFailed: - if (LinuxKernel != NULL) + if (LinuxKernel) { FsCloseFile(LinuxKernel); } - if (LinuxInitrdFile != NULL) + if (LinuxInitrdFile) { FsCloseFile(LinuxInitrdFile); } Modified: trunk/reactos/boot/freeldr/freeldr/miscboot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/miscb…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/miscboot.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/miscboot.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -58,7 +58,7 @@ } FilePointer = FsOpenFile(FileName); - if (FilePointer == NULL) + if (!FilePointer) { strcat(FileName, " not found."); UiMessageBox(FileName); Modified: trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -65,7 +65,7 @@ ULONG_PTR NTAPI -FrLdrLoadModule(FILE *ModuleImage, +FrLdrLoadModule(PFILE ModuleImage, LPCSTR ModuleName, PULONG ModuleSize) { @@ -435,7 +435,7 @@ PVOID NTAPI -FrLdrReadAndMapImage(IN FILE *Image, +FrLdrReadAndMapImage(IN PFILE Image, IN PCHAR Name, IN ULONG ImageType) { @@ -674,7 +674,7 @@ PVOID NTAPI -FrLdrMapImage(IN FILE *Image, +FrLdrMapImage(IN PFILE Image, IN PCHAR Name, IN ULONG ImageType) { Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] Sat Aug 8 23:11:40 2009 @@ -67,7 +67,7 @@ FilePointer = FsOpenFile(szFileName); /* Try under the system root in the main dir and drivers */ - if (FilePointer == NULL) + if (!FilePointer) { strcpy(value, SystemRoot); if(value[strlen(value)-1] != '\\') @@ -76,7 +76,7 @@ FilePointer = FsOpenFile(value); } - if (FilePointer == NULL) + if (!FilePointer) { strcpy(value, SystemRoot); if(value[strlen(value)-1] != '\\') @@ -86,7 +86,7 @@ FilePointer = FsOpenFile(value); } - if (FilePointer == NULL) + if (!FilePointer) { strcpy(value, SystemRoot); if(value[strlen(value)-1] != '\\') @@ -97,7 +97,7 @@ } /* Make sure we did */ - if (FilePointer == NULL) { + if (!FilePointer) { /* Fail if file wasn't opened */ strcpy(value, szFileName); @@ -201,7 +201,7 @@ FilePointer = FsOpenFile(szFileName); /* Make sure we did */ - if (FilePointer == NULL) { + if (!FilePointer) { /* Fail if file wasn't opened */ strcpy(value, szFileName); @@ -847,7 +847,7 @@ DPRINTM(DPRINT_REACTOS, "SystemHive: '%s'", szFileName); FilePointer = FsOpenFile(szFileName); - if (FilePointer == NULL) + if (!FilePointer) { UiMessageBox("Could not find the System hive!"); return;
15 years, 4 months
1
0
0
0
[hpoussin] 42537: - Half-convert FAT, Ext2 and NTFS filesytems to provide new ARC file infrastructure. This allows removing some compatibility code in fs.c - Remove use of FsOpenBootVolume() and FsOpenSystemVolume(). If callers don't want a file on boot volume, they need to use the new ArcOpen/ArcSeek/ArcRead/ArcClose functions instead of the old FsOpenFile/FsSetFilePointer/FsReadFile/FsCloseFile
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Aug 8 22:53:10 2009 New Revision: 42537 URL:
http://svn.reactos.org/svn/reactos?rev=42537&view=rev
Log: - Half-convert FAT, Ext2 and NTFS filesytems to provide new ARC file infrastructure. This allows removing some compatibility code in fs.c - Remove use of FsOpenBootVolume() and FsOpenSystemVolume(). If callers don't want a file on boot volume, they need to use the new ArcOpen/ArcSeek/ArcRead/ArcClose functions instead of the old FsOpenFile/FsSetFilePointer/FsReadFile/FsCloseFile Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c trunk/reactos/boot/freeldr/freeldr/bootmgr.c trunk/reactos/boot/freeldr/freeldr/disk/disk.c trunk/reactos/boot/freeldr/freeldr/fs/ext2.c trunk/reactos/boot/freeldr/freeldr/fs/fat.c trunk/reactos/boot/freeldr/freeldr/fs/fs.c trunk/reactos/boot/freeldr/freeldr/fs/iso.c trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c trunk/reactos/boot/freeldr/freeldr/include/arch.h trunk/reactos/boot/freeldr/freeldr/include/disk.h trunk/reactos/boot/freeldr/freeldr/include/fs.h trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h trunk/reactos/boot/freeldr/freeldr/include/machine.h trunk/reactos/boot/freeldr/freeldr/linuxboot.c trunk/reactos/boot/freeldr/freeldr/machine.c trunk/reactos/boot/freeldr/freeldr/miscboot.c trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -264,11 +264,7 @@ BOOLEAN PpcDiskGetSystemVolume( char *SystemPath, char *RemainingPath, - PULONG Device, - PULONG DriveNumber, - PULONGLONG StartSector, - PULONGLONG SectorCount, - int *FsType ) { + PULONG Device ) { char *remain = strchr(SystemPath, '\\'); if( remain ) { strcpy( RemainingPath, remain+1 ); @@ -278,7 +274,7 @@ *Device = 0; // Hack to be a bit easier on ram CacheSizeLimit = 64 * 1024; - return MachDiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType); + return TRUE; } BOOLEAN PpcDiskGetBootPath( char *OutBootPath, unsigned Size ) { Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/bootm…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/bootmgr.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -31,12 +31,6 @@ LONG TimeOut; ULONG SelectedOperatingSystem; - if (!FsOpenBootVolume()) - { - UiMessageBoxCritical("Error opening boot partition for file access."); - return; - } - // FIXME: if possible, only detect and register ARC devices... if (!MachHwDetect()) { Modified: trunk/reactos/boot/freeldr/freeldr/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -241,22 +241,19 @@ BOOLEAN DiskGetSystemVolume(char *SystemPath, char *RemainingPath, - PULONG Device, - PULONG DriveNumber, - PULONGLONG StartSector, - PULONGLONG SectorCount, - int *FsType) + PULONG Device) { ULONG PartitionNumber; PARTITION_TABLE_ENTRY PartitionTableEntry; UCHAR VolumeType; CHAR BootPath[256]; unsigned i, RosPartition; + ULONG DriveNumber; /* * Verify system path */ - if (!DissectArcPath(SystemPath, BootPath, DriveNumber, &PartitionNumber)) + if (!DissectArcPath(SystemPath, BootPath, &DriveNumber, &PartitionNumber)) { return FALSE; } @@ -278,7 +275,7 @@ RosPartition = 0; while (1) { - if (!MachDiskGetPartitionEntry(*DriveNumber, ++i, &PartitionTableEntry)) + if (!MachDiskGetPartitionEntry(DriveNumber, ++i, &PartitionTableEntry)) { return FALSE; } @@ -294,33 +291,28 @@ } /* Check for ISO9660 file system type */ - if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber)) + if (DriveNumber >= 0x80 && FsRecIsIso9660(DriveNumber)) { DPRINTM(DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"); if (NULL != Device) { - ((char *)Device)[0] = (char)(*DriveNumber); + ((char *)Device)[0] = (char)DriveNumber; ((char *)Device)[1] = (char)i; } - *StartSector = 0; - *SectorCount = 0; - *FsType = FS_ISO9660; return TRUE; } - if (!FsRecognizeVolume(*DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) + if (!FsRecognizeVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) { return FALSE; } if (NULL != Device) { - ((char *)Device)[0] = (char)(*DriveNumber); + ((char *)Device)[0] = (char)DriveNumber; ((char *)Device)[1] = (char)i; } - *StartSector = PartitionTableEntry.SectorCountBeforePartition; - *SectorCount = PartitionTableEntry.PartitionSectorCount; switch (VolumeType) { @@ -330,16 +322,10 @@ case PARTITION_XINT13: case PARTITION_FAT32: case PARTITION_FAT32_XINT13: - *FsType = FS_FAT; - return TRUE; case PARTITION_EXT2: - *FsType = FS_EXT2; - return TRUE; case PARTITION_NTFS: - *FsType = FS_NTFS; return TRUE; default: - *FsType = 0; return FALSE; } Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ex…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -20,6 +20,31 @@ #include <freeldr.h> #include <debug.h> +BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount); +FILE* Ext2OpenFile(PCSTR FileName); +BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); +BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); +BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer); + +BOOLEAN Ext2ReadFileBig(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); +BOOLEAN Ext2ReadSuperBlock(VOID); +BOOLEAN Ext2ReadGroupDescriptors(VOID); +BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer); +BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer); +BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer); +ULONG Ext2GetGroupDescBlockNumber(ULONG Group); +ULONG Ext2GetGroupDescOffsetInBlock(ULONG Group); +ULONG Ext2GetInodeGroupNumber(ULONG Inode); +ULONG Ext2GetInodeBlockNumber(ULONG Inode); +ULONG Ext2GetInodeOffsetInBlock(ULONG Inode); +BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer); +BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer); +ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode); +ULONGLONG Ext2GetInodeFileSize(PEXT2_INODE Inode); +BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG IndirectBlock); +BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG DoubleIndirectBlock); +BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG TripleIndirectBlock); + GEOMETRY Ext2DiskGeometry; // Ext2 file system disk geometry PEXT2_SUPER_BLOCK Ext2SuperBlock = NULL; // Ext2 file system super block @@ -517,43 +542,6 @@ } return TRUE; -} - -BOOLEAN Ext2ReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer) -{ - BOOLEAN Success; - ULONGLONG BytesReadBig; - - Success = Ext2ReadFileBig(FileHandle, BytesToRead, &BytesReadBig, Buffer); - *BytesRead = (ULONG)BytesReadBig; - return Success; -} - -ULONG Ext2GetFileSize(FILE *FileHandle) -{ - PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileSize() FileSize = %d\n", Ext2FileHandle->FileSize); - - return Ext2FileHandle->FileSize; -} - -VOID Ext2SetFilePointer(FILE *FileHandle, ULONG NewFilePointer) -{ - PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "Ext2SetFilePointer() NewFilePointer = %d\n", NewFilePointer); - - Ext2FileHandle->FilePointer = NewFilePointer; -} - -ULONG Ext2GetFilePointer(FILE *FileHandle) -{ - PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFilePointer() FilePointer = %d\n", Ext2FileHandle->FilePointer); - - return Ext2FileHandle->FilePointer; } BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer) @@ -1178,12 +1166,144 @@ return TRUE; } -const FS_VTBL Ext2Vtbl = { - Ext2OpenVolume, - Ext2OpenFile, - NULL, - Ext2ReadFile, - Ext2GetFileSize, - Ext2SetFilePointer, - Ext2GetFilePointer, +LONG Ext2Close(ULONG FileId) +{ + PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + + MmHeapFree(FileHandle); + + return ESUCCESS; +} + +LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information) +{ + PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + + RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + Information->EndingAddress.LowPart = FileHandle->FileSize; + Information->CurrentAddress.LowPart = FileHandle->FilePointer; + + DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n", + Information->EndingAddress.LowPart); + DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FilePointer = %d\n", + Information->CurrentAddress.LowPart); + + return ESUCCESS; +} + +LONG Ext2Open(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) +{ + PEXT2_FILE_INFO FileHandle; + ULONG DeviceId; + + if (OpenMode != OpenReadOnly) + return EACCES; + + DeviceId = FsGetDeviceId(*FileId); + + DPRINTM(DPRINT_FILESYSTEM, "Ext2Open() FileName = %s\n", Path); + + // + // Call old open method + // + FileHandle = Ext2OpenFile(Path); + + // + // Check for error + // + if (!FileHandle) + return ENOENT; + + // + // Success. Remember the handle + // + FsSetDeviceSpecific(*FileId, FileHandle); + return ESUCCESS; +} + +LONG Ext2Read(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) +{ + PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + ULONGLONG BytesReadBig; + BOOLEAN ret; + + // + // Read data + // + ret = Ext2ReadFileBig(FileHandle, N, &BytesReadBig, Buffer); + *Count = (ULONG)BytesReadBig; + + // + // Check for success + // + if (ret) + return ESUCCESS; + else + return EIO; +} + +LONG Ext2Seek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode) +{ + PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + + DPRINTM(DPRINT_FILESYSTEM, "Ext2Seek() NewFilePointer = %lu\n", Position->LowPart); + + if (SeekMode != SeekAbsolute) + return EINVAL; + if (Position->HighPart != 0) + return EINVAL; + if (Position->LowPart >= FileHandle->FileSize) + return EINVAL; + + FileHandle->FilePointer = Position->LowPart; + return ESUCCESS; +} + +const DEVVTBL Ext2FuncTable = +{ + Ext2Close, + Ext2GetFileInformation, + Ext2Open, + Ext2Read, + Ext2Seek, }; + +const DEVVTBL* Ext2Mount(ULONG DeviceId) +{ + EXT2_SUPER_BLOCK SuperBlock; + LARGE_INTEGER Position; + ULONG Count; + LONG ret; + + // + // Read the SuperBlock + // + Position.HighPart = 0; + Position.LowPart = 2 * 512; + ret = ArcSeek(DeviceId, &Position, SeekAbsolute); + if (ret != ESUCCESS) + return NULL; + ret = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count); + if (ret != ESUCCESS || Count != sizeof(SuperBlock)) + return NULL; + + // + // Check if SuperBlock is valid. If yes, return Ext2 function table + // + if (SuperBlock.s_magic == EXT3_SUPER_MAGIC) + { + // + // Compatibility hack as long as FS is not using underlying device DeviceId + // + ULONG DriveNumber; + ULONGLONG StartSector; + ULONGLONG SectorCount; + int Type; + if (!MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type)) + return NULL; + Ext2OpenVolume(DriveNumber, StartSector, SectorCount); + return &Ext2FuncTable; + } + else + return NULL; +} Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fa…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -21,6 +21,20 @@ #define NDEBUG #include <debug.h> + +ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount); +PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory); +BOOLEAN FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); +LONG FatLookupFile(PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer); +void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry); +BOOLEAN FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer); +ULONG FatCountClustersInChain(ULONG StartCluster); +ULONG* FatGetClusterChainArray(ULONG StartCluster); +BOOLEAN FatReadCluster(ULONG ClusterNumber, PVOID Buffer); +BOOLEAN FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID Buffer); +BOOLEAN FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer); +BOOLEAN FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); +BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN gCacheEnabled = FALSE; @@ -778,11 +792,10 @@ /* * FatLookupFile() * This function searches the file system for the - * specified filename and fills in a FAT_FILE_INFO structure - * with info describing the file, etc. returns true - * if the file exists or false otherwise + * specified filename and fills in an FAT_FILE_INFO structure + * with info describing the file, etc. returns ARC error code */ -BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer) +LONG FatLookupFile(PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer) { UINT32 i; ULONG NumberOfPathParts; @@ -825,7 +838,7 @@ DirectoryBuffer = FatBufferDirectory(DirectoryStartCluster, &DirectorySize, (i == 0) ); if (DirectoryBuffer == NULL) { - return FALSE; + return ENOMEM; } // @@ -836,7 +849,7 @@ if (!FatXSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart, &FatFileInfo)) { MmHeapFree(DirectoryBuffer); - return FALSE; + return ENOENT; } } else @@ -844,7 +857,7 @@ if (!FatSearchDirectoryBufferForFile(DirectoryBuffer, DirectorySize, PathPart, &FatFileInfo)) { MmHeapFree(DirectoryBuffer); - return FALSE; + return ENOENT; } } @@ -863,7 +876,7 @@ memcpy(FatFileInfoPointer, &FatFileInfo, sizeof(FAT_FILE_INFO)); - return TRUE; + return ESUCCESS; } /* @@ -1006,35 +1019,6 @@ *ClusterPointer = fat; return TRUE; -} - -/* - * FatOpenFile() - * Tries to open the file 'name' and returns true or false - * for success and failure respectively - */ -FILE* FatOpenFile(PCSTR FileName) -{ - FAT_FILE_INFO TempFatFileInfo; - PFAT_FILE_INFO FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "FatOpenFile() FileName = %s\n", FileName); - - if (!FatLookupFile(FileName, &TempFatFileInfo)) - { - return NULL; - } - - FileHandle = MmHeapAlloc(sizeof(FAT_FILE_INFO)); - - if (FileHandle == NULL) - { - return NULL; - } - - memcpy(FileHandle, &TempFatFileInfo, sizeof(FAT_FILE_INFO)); - - return (FILE*)FileHandle; } ULONG FatCountClustersInChain(ULONG StartCluster) @@ -1394,33 +1378,6 @@ return TRUE; } -ULONG FatGetFileSize(FILE *FileHandle) -{ - PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "FatGetFileSize() FileSize = %d\n", FatFileHandle->FileSize); - - return FatFileHandle->FileSize; -} - -VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer) -{ - PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "FatSetFilePointer() NewFilePointer = %d\n", NewFilePointer); - - FatFileHandle->FilePointer = NewFilePointer; -} - -ULONG FatGetFilePointer(FILE *FileHandle) -{ - PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle; - - DPRINTM(DPRINT_FILESYSTEM, "FatGetFilePointer() FilePointer = %d\n", FatFileHandle->FilePointer); - - return FatFileHandle->FilePointer; -} - BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer) { if (gCacheEnabled) @@ -1443,12 +1400,147 @@ } } -const FS_VTBL FatVtbl = { - FatOpenVolume, - FatOpenFile, - NULL, - FatReadFile, - FatGetFileSize, - FatSetFilePointer, - FatGetFilePointer, +LONG FatClose(ULONG FileId) +{ + PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + + MmHeapFree(FileHandle); + + return ESUCCESS; +} + +LONG FatGetFileInformation(ULONG FileId, FILEINFORMATION* Information) +{ + PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + + RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + Information->EndingAddress.LowPart = FileHandle->FileSize; + Information->CurrentAddress.LowPart = FileHandle->FilePointer; + + DPRINTM(DPRINT_FILESYSTEM, "FatGetFileInformation() FileSize = %d\n", + Information->EndingAddress.LowPart); + DPRINTM(DPRINT_FILESYSTEM, "FatGetFileInformation() FilePointer = %d\n", + Information->CurrentAddress.LowPart); + + return ESUCCESS; +} + +LONG FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) +{ + FAT_FILE_INFO TempFileInfo; + PFAT_FILE_INFO FileHandle; + ULONG DeviceId; + LONG ret; + + if (OpenMode != OpenReadOnly) + return EACCES; + + DeviceId = FsGetDeviceId(*FileId); + + DPRINTM(DPRINT_FILESYSTEM, "FatOpen() FileName = %s\n", Path); + + RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo)); + ret = FatLookupFile(Path, DeviceId, &TempFileInfo); + if (ret != ESUCCESS) + return ENOENT; + + FileHandle = MmHeapAlloc(sizeof(FAT_FILE_INFO)); + if (!FileHandle) + return ENOMEM; + + RtlCopyMemory(FileHandle, &TempFileInfo, sizeof(FAT_FILE_INFO)); + + FsSetDeviceSpecific(*FileId, FileHandle); + return ESUCCESS; +} + +LONG FatRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) +{ + PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + BOOLEAN ret; + + // + // Call old read method + // + ret = FatReadFile(FileHandle, N, Count, Buffer); + + // + // Check for success + // + if (ret) + return ESUCCESS; + else + return EIO; +} + +LONG FatSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode) +{ + PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); + + DPRINTM(DPRINT_FILESYSTEM, "FatSeek() NewFilePointer = %lu\n", Position->LowPart); + + if (SeekMode != SeekAbsolute) + return EINVAL; + if (Position->HighPart != 0) + return EINVAL; + if (Position->LowPart >= FileHandle->FileSize) + return EINVAL; + + FileHandle->FilePointer = Position->LowPart; + return ESUCCESS; +} + +const DEVVTBL FatFuncTable = +{ + FatClose, + FatGetFileInformation, + FatOpen, + FatRead, + FatSeek, }; + +const DEVVTBL* FatMount(ULONG DeviceId) +{ + UCHAR Buffer[512]; + PFAT_BOOTSECTOR BootSector = (PFAT_BOOTSECTOR)Buffer; + PFAT32_BOOTSECTOR BootSector32 = (PFAT32_BOOTSECTOR)Buffer; + PFATX_BOOTSECTOR BootSectorX = (PFATX_BOOTSECTOR)Buffer; + LARGE_INTEGER Position; + ULONG Count; + LONG ret; + + // + // Read the BootSector + // + Position.HighPart = 0; + Position.LowPart = 0; + ret = ArcSeek(DeviceId, &Position, SeekAbsolute); + if (ret != ESUCCESS) + return NULL; + ret = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count); + if (ret != ESUCCESS || Count != sizeof(Buffer)) + return NULL; + + // + // Check if BootSector is valid. If yes, return FAT function table + // + if (RtlEqualMemory(BootSector->FileSystemType, "FAT12 ", 8) || + RtlEqualMemory(BootSector->FileSystemType, "FAT16 ", 8) || + RtlEqualMemory(BootSector32->FileSystemType, "FAT32 ", 8) || + RtlEqualMemory(BootSectorX->FileSystemType, "FATX", 4)) + { + // + // Compatibility hack as long as FS is not using underlying device DeviceId + // + ULONG DriveNumber; + ULONGLONG StartSector; + ULONGLONG SectorCount; + int Type; + if (!MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type)) + return NULL; + FatOpenVolume(DriveNumber, StartSector, SectorCount); + return &FatFuncTable; + } + else + return NULL; +} Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -24,31 +24,28 @@ #include <debug.h> ///////////////////////////////////////////////////////////////////////////////////////////// -// DATA -///////////////////////////////////////////////////////////////////////////////////////////// - -const FS_VTBL* pFSVtbl = NULL; // Type of filesystem on boot device, set by FsOpenVolume() -PVOID FsStaticBufferDisk = 0, FsStaticBufferData = 0; - -///////////////////////////////////////////////////////////////////////////////////////////// // FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////// -static BOOLEAN CompatArcOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount) -{ - // - // Always return success - // - return TRUE; -} - -static FILE* CompatArcOpenFile(PCSTR FileName) +VOID FileSystemError(PCSTR ErrorString) +{ + DPRINTM(DPRINT_FILESYSTEM, "%s\n", ErrorString); + + UiMessageBox(ErrorString); +} + +PFILE FsOpenFile(PCSTR FileName) { CHAR FullPath[MAX_PATH]; ULONG FileId; LONG ret; // + // Print status message + // + DPRINTM(DPRINT_FILESYSTEM, "Opening file '%s'...\n", FileName); + + // // Create full file name // MachDiskGetBootPath(FullPath, sizeof(FullPath)); @@ -63,261 +60,24 @@ // Check for success // if (ret == ESUCCESS) - return (FILE*)FileId; + return (PFILE)FileId; else return NULL; } -static BOOLEAN CompatArcReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer) +VOID FsCloseFile(PFILE FileHandle) { ULONG FileId = (ULONG)FileHandle; - LONG ret; - - // - // Read the file - // - ret = ArcRead(FileId, Buffer, BytesToRead, BytesRead); - - // - // Check for success - // - if (ret == ESUCCESS) - return TRUE; - else - return FALSE; -} - -ULONG CompatArcGetFileSize(FILE *FileHandle) -{ - ULONG FileId = (ULONG)FileHandle; - FILEINFORMATION Information; - LONG ret; - - // - // Query file informations - // - ret = ArcGetFileInformation(FileId, &Information); - - // - // Check for error - // - if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0) - return 0; - - // - // Return file size - // - return Information.EndingAddress.LowPart; -} - -VOID CompatArcSetFilePointer(FILE *FileHandle, ULONG NewFilePointer) -{ - ULONG FileId = (ULONG)FileHandle; - LARGE_INTEGER Position; - - // - // Set file position - // - Position.HighPart = 0; - Position.LowPart = NewFilePointer; - ArcSeek(FileId, &Position, SeekAbsolute); + + // + // Close the handle + // + ArcClose(FileId); // // Do not check for error; this function is // supposed to always succeed // -} - -ULONG CompatArcGetFilePointer(FILE *FileHandle) -{ - ULONG FileId = (ULONG)FileHandle; - FILEINFORMATION Information; - LONG ret; - - // - // Query file informations - // - ret = ArcGetFileInformation(FileId, &Information); - - // - // Check for error - // - if (ret != ESUCCESS || Information.CurrentAddress.HighPart != 0) - return 0; - - // - // Return file pointer position - // - return Information.CurrentAddress.LowPart; -} - -static const FS_VTBL CompatArcVtbl = -{ - CompatArcOpenVolume, - CompatArcOpenFile, - NULL, - CompatArcReadFile, - CompatArcGetFileSize, - CompatArcSetFilePointer, - CompatArcGetFilePointer, -}; - -VOID FileSystemError(PCSTR ErrorString) -{ - DPRINTM(DPRINT_FILESYSTEM, "%s\n", ErrorString); - - UiMessageBox(ErrorString); -} - -/* - * - * BOOLEAN FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type); - * - * This function is called to open a disk volume for file access. - * It must be called before any of the file functions will work. - * - */ -static BOOLEAN FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type) -{ - CHAR ErrorText[80]; - - if( !FsStaticBufferDisk ) - FsStaticBufferDisk = MmAllocateMemory( 0x20000 ); - if( !FsStaticBufferDisk ) - { - FileSystemError("could not allocate filesystem static buffer"); - return FALSE; - } - FsStaticBufferData = ((PCHAR)FsStaticBufferDisk) + 0x10000; - - switch (Type) - { - case FS_FAT: - pFSVtbl = &FatVtbl; - break; - case FS_NTFS: - pFSVtbl = &NtfsVtbl; - break; - case FS_EXT2: - pFSVtbl = &Ext2Vtbl; - break; - case FS_ISO9660: - pFSVtbl = &CompatArcVtbl; - break; - default: - pFSVtbl = NULL; - break; - } - - if (pFSVtbl && pFSVtbl->OpenVolume) - { - return (*pFSVtbl->OpenVolume)(DriveNumber, StartSector, SectorCount); - } - else - { - sprintf(ErrorText, "Unsupported file system. Type: 0x%x", Type); - FileSystemError(ErrorText); - } - - return FALSE; -} -/* - * - * BOOLEAN FsOpenBootVolume() - * - * This function is called to open the boot disk volume for file access. - * It must be called before any of the file functions will work. - */ -BOOLEAN FsOpenBootVolume() -{ - ULONG DriveNumber; - ULONGLONG StartSector; - ULONGLONG SectorCount; - int Type; - - if (! MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type)) - { - FileSystemError("Unable to locate boot partition\n"); - return FALSE; - } - - return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type); -} - -BOOLEAN FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device) -{ - ULONG DriveNumber; - ULONGLONG StartSector; - ULONGLONG SectorCount; - int Type; - - if (! MachDiskGetSystemVolume(SystemPath, RemainingPath, Device, - &DriveNumber, &StartSector, &SectorCount, - &Type)) - { - FileSystemError("Unable to locate system partition\n"); - return FALSE; - } - - return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type); -} - - -PFILE FsOpenFile(PCSTR FileName) -{ - PFILE FileHandle = NULL; - - // - // Print status message - // - DPRINTM(DPRINT_FILESYSTEM, "Opening file '%s'...\n", FileName); - - // - // Check and see if the first character is '\' or '/' and remove it if so - // - while ((*FileName == '\\') || (*FileName == '/')) - { - FileName++; - } - - // - // Check file system type and pass off to appropriate handler - // - if (pFSVtbl && pFSVtbl->OpenFile) - { - FileHandle = pFSVtbl->OpenFile(FileName); - } - else - { - FileSystemError("Error: Unknown filesystem."); - } - - // - // Check return value - // - if (FileHandle != NULL) - { - DPRINTM(DPRINT_FILESYSTEM, "FsOpenFile() succeeded. FileHandle: 0x%x\n", FileHandle); - } - else - { - DPRINTM(DPRINT_FILESYSTEM, "FsOpenFile() failed.\n"); - } - - return FileHandle; -} - -VOID FsCloseFile(PFILE FileHandle) -{ - if (pFSVtbl) - { - if (pFSVtbl->CloseFile) - (*pFSVtbl->CloseFile)(FileHandle); - } - else - { - FileSystemError("Error: Unknown filesystem."); - } } /* @@ -326,61 +86,85 @@ */ BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer) { - // - // Set the number of bytes read equal to zero - // - if (BytesRead != NULL) - { - *BytesRead = 0; - } - - if (pFSVtbl && pFSVtbl->ReadFile) - { - return (*pFSVtbl->ReadFile)(FileHandle, BytesToRead, BytesRead, Buffer); - } + ULONG FileId = (ULONG)FileHandle; + LONG ret; + + // + // Read the file + // + ret = ArcRead(FileId, Buffer, BytesToRead, BytesRead); + + // + // Check for success + // + if (ret == ESUCCESS) + return TRUE; else - { - FileSystemError("Unknown file system."); return FALSE; - } } ULONG FsGetFileSize(PFILE FileHandle) { - if (pFSVtbl && pFSVtbl->GetFileSize) - { - return (*pFSVtbl->GetFileSize)(FileHandle); - } - else - { - FileSystemError("Unknown file system."); + ULONG FileId = (ULONG)FileHandle; + FILEINFORMATION Information; + LONG ret; + + // + // Query file informations + // + ret = ArcGetFileInformation(FileId, &Information); + + // + // Check for error + // + if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0) return 0; - } + + // + // Return file size + // + return Information.EndingAddress.LowPart; } VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer) { - if (pFSVtbl && pFSVtbl->SetFilePointer) - { - (*pFSVtbl->SetFilePointer)(FileHandle, NewFilePointer); - } - else - { - FileSystemError("Unknown file system."); - } + ULONG FileId = (ULONG)FileHandle; + LARGE_INTEGER Position; + + // + // Set file position + // + Position.HighPart = 0; + Position.LowPart = NewFilePointer; + ArcSeek(FileId, &Position, SeekAbsolute); + + // + // Do not check for error; this function is + // supposed to always succeed + // } ULONG FsGetFilePointer(PFILE FileHandle) { - if (pFSVtbl && pFSVtbl->SetFilePointer) - { - return (*pFSVtbl->GetFilePointer)(FileHandle); - } - else - { - FileSystemError("Unknown file system."); + ULONG FileId = (ULONG)FileHandle; + FILEINFORMATION Information; + LONG ret; + + // + // Query file informations + // + ret = ArcGetFileInformation(FileId, &Information); + + // + // Check for error + // + if (ret != ESUCCESS || Information.CurrentAddress.HighPart != 0) return 0; - } + + // + // Return file pointer position + // + return Information.CurrentAddress.LowPart; } BOOLEAN FsIsEndOfFile(PFILE FileHandle) @@ -448,71 +232,6 @@ DPRINTM(DPRINT_FILESYSTEM, "FatGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer); } - -LONG CompatFsClose(ULONG FileId) -{ - PFILE FileHandle = FsGetDeviceSpecific(FileId); - - FsCloseFile(FileHandle); - return ESUCCESS; -} - -LONG CompatFsGetFileInformation(ULONG FileId, FILEINFORMATION* Information) -{ - PFILE FileHandle = FsGetDeviceSpecific(FileId); - - memset(Information, 0, sizeof(FILEINFORMATION)); - Information->EndingAddress.LowPart = FsGetFileSize(FileHandle); - Information->CurrentAddress.LowPart = FsGetFilePointer(FileHandle); - return ESUCCESS; -} - -LONG CompatFsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) -{ - PFILE FileHandle; - static BOOLEAN bVolumeOpened = FALSE; - - if (!bVolumeOpened) - { - bVolumeOpened = FsOpenBootVolume(); - if (!bVolumeOpened) - return EIO; - } - - FileHandle = FsOpenFile(Path); - if (!FileHandle) - return EIO; - FsSetDeviceSpecific(*FileId, FileHandle); - return ESUCCESS; -} - -LONG CompatFsRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) -{ - PFILE FileHandle = FsGetDeviceSpecific(FileId); - BOOLEAN ret; - - ret = FsReadFile(FileHandle, N, Count, Buffer); - return (ret ? ESUCCESS : EFAULT); -} - -LONG CompatFsSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode) -{ - PFILE FileHandle = FsGetDeviceSpecific(FileId); - - if (SeekMode != SeekAbsolute) - return EINVAL; - - FsSetFilePointer(FileHandle, Position->LowPart); - return ESUCCESS; -} - -const DEVVTBL CompatFsFuncTable = { - CompatFsClose, - CompatFsGetFileInformation, - CompatFsOpen, - CompatFsRead, - CompatFsSeek, -}; #define MAX_FDS 60 typedef struct tagFILEDATA @@ -640,9 +359,16 @@ /* Try to detect the file system */ FileData[DeviceId].FileFuncTable = IsoMount(DeviceId); if (!FileData[DeviceId].FileFuncTable) + FileData[DeviceId].FileFuncTable = FatMount(DeviceId); + if (!FileData[DeviceId].FileFuncTable) + FileData[DeviceId].FileFuncTable = NtfsMount(DeviceId); + if (!FileData[DeviceId].FileFuncTable) + FileData[DeviceId].FileFuncTable = Ext2Mount(DeviceId); + if (!FileData[DeviceId].FileFuncTable) { - /* FIXME: we link there to old infrastructure... */ - FileData[DeviceId].FileFuncTable = &CompatFsFuncTable; + /* Error, unable to detect file system */ + FileData[DeviceId].FuncTable = NULL; + return ENODEV; } pDevice->DeviceId = DeviceId; @@ -670,6 +396,10 @@ if (i == MAX_FDS) return EMFILE; + /* Skip leading backslash, if any */ + if (*FileName == '\\') + FileName++; + /* Open the file */ FileData[i].FuncTable = FileData[DeviceId].FileFuncTable; FileData[i].DeviceId = DeviceId; Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/is…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/iso.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/iso.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -271,9 +271,6 @@ DPRINTM(DPRINT_FILESYSTEM, "IsoOpen() FileName = %s\n", Path); - if (*Path == '\\') - Path++; - RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo)); ret = IsoLookupFile(Path, DeviceId, &TempFileInfo); if (ret != ESUCCESS) @@ -507,7 +504,7 @@ // // Check if PVD is valid. If yes, return ISO9660 function table // - if (Pvd->VdType == 1 && RtlCompareMemory(Pvd->StandardId, "CD001", 5) == 5) + if (Pvd->VdType == 1 && RtlEqualMemory(Pvd->StandardId, "CD001", 5)) return &Iso9660FuncTable; else return NULL; Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/nt…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -760,74 +760,156 @@ return TRUE; } -FILE* NtfsOpenFile(PCSTR FileName) +LONG NtfsClose(ULONG FileId) +{ + PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); + + NtfsReleaseAttributeContext(FileHandle->DataContext); + MmHeapFree(FileHandle); + + return ESUCCESS; +} + +LONG NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information) +{ + PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); + + RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + Information->EndingAddress.LowPart = (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record); + Information->CurrentAddress.LowPart = FileHandle->Offset; + + DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n", + Information->EndingAddress.LowPart); + DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FilePointer = %d\n", + Information->CurrentAddress.LowPart); + + return ESUCCESS; +} + +LONG NtfsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) { PNTFS_FILE_HANDLE FileHandle; PNTFS_MFT_RECORD MftRecord; - + ULONG DeviceId; + + // + // Check parameters + // + if (OpenMode != OpenReadOnly) + return EACCES; + + // + // Get underlying device + // + DeviceId = FsGetDeviceId(*FileId); + + DPRINTM(DPRINT_FILESYSTEM, "NtfsOpen() FileName = %s\n", Path); + + // + // Allocate file structure + // FileHandle = MmHeapAlloc(sizeof(NTFS_FILE_HANDLE) + NtfsMftRecordSize); - if (FileHandle == NULL) - { + if (!FileHandle) + { + return ENOMEM; + } + RtlZeroMemory(FileHandle, sizeof(NTFS_FILE_HANDLE) + NtfsMftRecordSize); + + // + // Search file entry + // + MftRecord = (PNTFS_MFT_RECORD)(FileHandle + 1); + if (!NtfsLookupFile(Path, MftRecord, &FileHandle->DataContext)) + { + MmHeapFree(FileHandle); + return ENOENT; + } + + return ESUCCESS; +} + +LONG NtfsRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) +{ + PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); + ULONGLONG BytesRead64; + + // + // Read file + // + BytesRead64 = NtfsReadAttribute(FileHandle->DataContext, FileHandle->Offset, Buffer, N); + *Count = (ULONG)BytesRead64; + + // + // Check for success + // + if (BytesRead64 > 0) + return ESUCCESS; + else + return EIO; +} + +LONG NtfsSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode) +{ + PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); + + DPRINTM(DPRINT_FILESYSTEM, "NtfsSeek() NewFilePointer = %lu\n", Position->LowPart); + + if (SeekMode != SeekAbsolute) + return EINVAL; + if (Position->HighPart != 0) + return EINVAL; + if (Position->LowPart >= (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record)) + return EINVAL; + + FileHandle->Offset = Position->LowPart; + return ESUCCESS; +} + +const DEVVTBL NtfsFuncTable = +{ + NtfsClose, + NtfsGetFileInformation, + NtfsOpen, + NtfsRead, + NtfsSeek, +}; + +const DEVVTBL* NtfsMount(ULONG DeviceId) +{ + NTFS_BOOTSECTOR BootSector; + LARGE_INTEGER Position; + ULONG Count; + LONG ret; + + // + // Read the BootSector + // + Position.HighPart = 0; + Position.LowPart = 0; + ret = ArcSeek(DeviceId, &Position, SeekAbsolute); + if (ret != ESUCCESS) return NULL; - } - - MftRecord = (PNTFS_MFT_RECORD)(FileHandle + 1); - if (!NtfsLookupFile(FileName, MftRecord, &FileHandle->DataContext)) - { - MmHeapFree(FileHandle); + ret = ArcRead(DeviceId, &BootSector, sizeof(BootSector), &Count); + if (ret != ESUCCESS || Count != sizeof(BootSector)) return NULL; - } - - FileHandle->Offset = 0; - - return (FILE*)FileHandle; -} - -VOID NtfsCloseFile(FILE *File) -{ - PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File; - NtfsReleaseAttributeContext(FileHandle->DataContext); - MmHeapFree(FileHandle); -} - -BOOLEAN NtfsReadFile(FILE *File, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer) -{ - PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File; - ULONGLONG BytesRead64; - BytesRead64 = NtfsReadAttribute(FileHandle->DataContext, FileHandle->Offset, Buffer, BytesToRead); - if (BytesRead64) - { - *BytesRead = (ULONG)BytesRead64; - FileHandle->Offset += BytesRead64; - return TRUE; - } - return FALSE; -} - -ULONG NtfsGetFileSize(FILE *File) -{ - PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File; - return (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record); -} - -VOID NtfsSetFilePointer(FILE *File, ULONG NewFilePointer) -{ - PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File; - FileHandle->Offset = NewFilePointer; -} - -ULONG NtfsGetFilePointer(FILE *File) -{ - PNTFS_FILE_HANDLE FileHandle = (PNTFS_FILE_HANDLE)File; - return FileHandle->Offset; -} - -const FS_VTBL NtfsVtbl = { - NtfsOpenVolume, - NtfsOpenFile, - NtfsCloseFile, - NtfsReadFile, - NtfsGetFileSize, - NtfsSetFilePointer, - NtfsGetFilePointer, -}; + + // + // Check if BootSector is valid. If yes, return NTFS function table + // + if (RtlEqualMemory(BootSector.SystemId, "NTFS", 4)) + { + // + // Compatibility hack as long as FS is not using underlying device DeviceId + // + ULONG DriveNumber; + ULONGLONG StartSector; + ULONGLONG SectorCount; + int Type; + if (!MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type)) + return NULL; + NtfsOpenVolume(DriveNumber, StartSector, SectorCount); + return &NtfsFuncTable; + } + else + return NULL; +} Modified: trunk/reactos/boot/freeldr/freeldr/include/arch.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -47,7 +47,6 @@ #define FILESYSBUFFER 0x80000 /* Buffer to store file system data (e.g. cluster buffer for FAT) */ #define DISKREADBUFFER 0x90000 /* Buffer to store data read in from the disk via the BIOS */ #elif defined(_M_PPC) || defined(_M_MIPS) || defined(_M_ARM) -extern PVOID FsStaticBufferDisk, FsStaticBufferData; #define DISKREADBUFFER 0x80000000 #define FILESYSBUFFER 0x80000000 #endif Modified: trunk/reactos/boot/freeldr/freeldr/include/disk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -130,9 +130,7 @@ BOOLEAN DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType); BOOLEAN DiskGetSystemVolume(char *SystemPath, char *RemainingPath, - PULONG Device, PULONG DriveNumber, - PULONGLONG StartSector, - PULONGLONG SectorCount, int *FsType); + PULONG Device); BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); VOID DiskGetBootDevice(PULONG BootDevice); BOOLEAN DiskBootingFromFloppy(VOID); Modified: trunk/reactos/boot/freeldr/freeldr/include/fs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -50,8 +50,6 @@ LONG ArcSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode); VOID FileSystemError(PCSTR ErrorString); -BOOLEAN FsOpenBootVolume(); -BOOLEAN FsOpenSystemVolume(PCHAR SystemPath, PCHAR RemainingPath, PULONG BootDevice); PFILE FsOpenFile(PCSTR FileName); VOID FsCloseFile(PFILE FileHandle); BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); @@ -62,15 +60,4 @@ ULONG FsGetNumPathParts(PCSTR Path); VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path); -typedef struct -{ - BOOLEAN (*OpenVolume)(UCHAR DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount); - PFILE (*OpenFile)(PCSTR FileName); - VOID (*CloseFile)(PFILE FileHandle); - BOOLEAN (*ReadFile)(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); - ULONG (*GetFileSize)(PFILE FileHandle); - VOID (*SetFilePointer)(PFILE FileHandle, ULONG NewFilePointer); - ULONG (*GetFilePointer)(PFILE FileHandle); -} FS_VTBL; - #endif // #defined __FS_H Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs/ext2.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -668,37 +668,6 @@ EXT2_INODE Inode; // File's inode } EXT2_FILE_INFO, * PEXT2_FILE_INFO; - - -BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount); -FILE* Ext2OpenFile(PCSTR FileName); -BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); -BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); -BOOLEAN Ext2ReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); -ULONG Ext2GetFileSize(FILE *FileHandle); -VOID Ext2SetFilePointer(FILE *FileHandle, ULONG NewFilePointer); -ULONG Ext2GetFilePointer(FILE *FileHandle); -BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer); - -BOOLEAN Ext2ReadFileBig(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); -BOOLEAN Ext2ReadSuperBlock(VOID); -BOOLEAN Ext2ReadGroupDescriptors(VOID); -BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer); -BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer); -BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer); -ULONG Ext2GetGroupDescBlockNumber(ULONG Group); -ULONG Ext2GetGroupDescOffsetInBlock(ULONG Group); -ULONG Ext2GetInodeGroupNumber(ULONG Inode); -ULONG Ext2GetInodeBlockNumber(ULONG Inode); -ULONG Ext2GetInodeOffsetInBlock(ULONG Inode); -BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer); -BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer); -ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode); -ULONGLONG Ext2GetInodeFileSize(PEXT2_INODE Inode); -BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG IndirectBlock); -BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG DoubleIndirectBlock); -BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG TripleIndirectBlock); - -extern const FS_VTBL Ext2Vtbl; +const DEVVTBL* Ext2Mount(ULONG DeviceId); #endif // #defined __EXT2_H Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs/fat.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -152,28 +152,6 @@ ULONG DriveNumber; } FAT_FILE_INFO, * PFAT_FILE_INFO; - - -BOOLEAN FatOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount); -ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount); -PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory); -BOOLEAN FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); -BOOLEAN FatLookupFile(PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer); -void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry); -BOOLEAN FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer); -FILE* FatOpenFile(PCSTR FileName); -ULONG FatCountClustersInChain(ULONG StartCluster); -ULONG* FatGetClusterChainArray(ULONG StartCluster); -BOOLEAN FatReadCluster(ULONG ClusterNumber, PVOID Buffer); -BOOLEAN FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID Buffer); -BOOLEAN FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer); -BOOLEAN FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); -ULONG FatGetFileSize(FILE *FileHandle); -VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer); -ULONG FatGetFilePointer(FILE *FileHandle); -BOOLEAN FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer); - - #define ATTR_NORMAL 0x00 #define ATTR_READONLY 0x01 #define ATTR_HIDDEN 0x02 @@ -191,6 +169,6 @@ #define ISFATX(FT) ((FT) == FATX16 || (FT) == FATX32) -extern const FS_VTBL FatVtbl; +const DEVVTBL* FatMount(ULONG DeviceId); #endif // #defined __FAT_H Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs/iso.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -99,8 +99,6 @@ ULONG DriveNumber; } ISO_FILE_INFO, * PISO_FILE_INFO; -extern const FS_VTBL Iso9660Vtbl; - const DEVVTBL* IsoMount(ULONG DeviceId); #endif // #defined __FAT_H Modified: trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/fs/ntfs.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -222,14 +222,6 @@ } NTFS_FILE_HANDLE, *PNTFS_FILE_HANDLE; #include <poppack.h> -BOOLEAN NtfsOpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount); -FILE* NtfsOpenFile(PCSTR FileName); -VOID NtfsCloseFile(FILE *FileHandle); -BOOLEAN NtfsReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer); -ULONG NtfsGetFileSize(FILE *FileHandle); -VOID NtfsSetFilePointer(FILE *FileHandle, ULONG NewFilePointer); -ULONG NtfsGetFilePointer(FILE *FileHandle); - -extern const FS_VTBL NtfsVtbl; +const DEVVTBL* NtfsMount(ULONG DeviceId); #endif // #defined __NTFS_H Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -63,7 +63,7 @@ ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); BOOLEAN (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType); - BOOLEAN (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType); + BOOLEAN (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device); BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size); VOID (*DiskGetBootDevice)(PULONG BootDevice); BOOLEAN (*DiskBootingFromFloppy)(VOID); @@ -104,11 +104,7 @@ BOOLEAN MachDiskGetSystemVolume(char *SystemPath, char *RemainingPath, - PULONG Device, - PULONG DriveNumber, - PULONGLONG StartSector, - PULONGLONG SectorCount, - int *FsType); + PULONG Device); BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size); VOID MachDiskGetBootDevice(PULONG BootDevice); BOOLEAN MachDiskBootingFromFloppy(); @@ -140,7 +136,7 @@ #define MachBeep() MachVtbl.Beep() #define MachPrepareForReactOS(a) MachVtbl.PrepareForReactOS(a) #define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType)) -#define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType)) +#define MachDiskGetSystemVolume(SysPath, RemPath, Dev) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev)) #define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size)) #define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice) #define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy() Modified: trunk/reactos/boot/freeldr/freeldr/linuxboot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/linux…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/linuxboot.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/linuxboot.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -73,9 +73,9 @@ UiMessageBox("Invalid boot path"); goto LinuxBootFailed; } - if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL)) - { - UiMessageBox("Failed to open boot drive."); + if (!MachDiskGetSystemVolume(LinuxBootPath, NULL, NULL)) + { + UiMessageBox("Failed to get system volume."); goto LinuxBootFailed; } Modified: trunk/reactos/boot/freeldr/freeldr/machine.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/machi…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -333,15 +333,9 @@ BOOLEAN MachDiskGetSystemVolume(char *SystemPath, char *RemainingPath, - PULONG Device, - PULONG DriveNumber, - PULONGLONG StartSector, - PULONGLONG SectorCount, - int *FsType) -{ - return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device, - DriveNumber, StartSector, SectorCount, - FsType); + PULONG Device) +{ + return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device); } BOOLEAN Modified: trunk/reactos/boot/freeldr/freeldr/miscboot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/miscb…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/miscboot.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/miscboot.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -51,9 +51,9 @@ return; } - if (!FsOpenSystemVolume(FileName, FileName, NULL)) - { - UiMessageBox("Failed to open boot drive."); + if (!MachDiskGetSystemVolume(FileName, FileName, NULL)) + { + UiMessageBox("Failed to get system volume."); return; } Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -756,11 +756,11 @@ RamDiskSwitchFromBios(); /* - * Try to open system drive - */ - if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice)) - { - UiMessageBox("Failed to open system drive."); + * Try to get system volume + */ + if (!MachDiskGetSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice)) + { + UiMessageBox("Failed to get system volume."); return; } Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -119,13 +119,6 @@ /* set boot device */ MachDiskGetBootDevice(&LoaderBlock.BootDevice); - /* Open boot drive */ - if (!FsOpenBootVolume()) - { - UiMessageBox("Failed to open boot drive."); - return; - } - UiDrawStatusText("Loading txtsetup.sif..."); /* Open 'txtsetup.sif' */ for (i = MachDiskBootingFromFloppy() ? 0 : 1; ; i++) @@ -201,13 +194,6 @@ if (MachDiskBootingFromFloppy()) { UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER"); - - /* Open boot drive */ - if (!FsOpenBootVolume()) - { - UiMessageBox("Failed to open boot drive."); - return; - } /* FIXME: check volume label or disk marker file */ } Modified: trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/setupldr2.c [iso-8859-1] Sat Aug 8 22:53:10 2009 @@ -186,9 +186,6 @@ NULL }; - /* Try to open system drive */ - FsOpenBootVolume(); - /* Open 'txtsetup.sif' from any of source paths */ MachDiskGetBootPath(SystemPath, sizeof(SystemPath)); for (i = MachDiskBootingFromFloppy() ? 0 : 1; ; i++)
15 years, 4 months
1
0
0
0
[gschneider] 42536: Supply default ansi codepage when converting from unicode, fixes 365 kernel32 comm winetests
by gschneider@svn.reactos.org
Author: gschneider Date: Sat Aug 8 22:20:16 2009 New Revision: 42536 URL:
http://svn.reactos.org/svn/reactos?rev=42536&view=rev
Log: Supply default ansi codepage when converting from unicode, fixes 365 kernel32 comm winetests Modified: trunk/reactos/dll/win32/kernel32/misc/commdcb.c Modified: trunk/reactos/dll/win32/kernel32/misc/commdcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/commdcb.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/commdcb.c [iso-8859-1] Sat Aug 8 22:20:16 2009 @@ -627,7 +627,7 @@ DWORD dwErr; dwErr = ERROR_INVALID_PARAMETER; - cchAscii = WideCharToMultiByte(20127, 0, lpDef, -1, NULL, 0, NULL, NULL); + cchAscii = WideCharToMultiByte(CP_ACP, 0, lpDef, -1, NULL, 0, NULL, NULL); bRet = cchAscii > 0; @@ -641,7 +641,7 @@ if(bRet) { bInvalidChars = FALSE; - cchAscii = WideCharToMultiByte(20127, 0, lpDef, -1, pszAscii, cchAscii, NULL, &bInvalidChars); + cchAscii = WideCharToMultiByte(CP_ACP, 0, lpDef, -1, pszAscii, cchAscii, NULL, &bInvalidChars); bRet = cchAscii > 0 && !bInvalidChars;
15 years, 4 months
1
0
0
0
← Newer
1
...
41
42
43
44
45
46
47
...
66
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Results per page:
10
25
50
100
200