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
2026
April
March
February
January
2025
December
November
October
September
August
July
June
May
April
March
February
January
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
----- 2026 -----
April 2026
March 2026
February 2026
January 2026
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 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
81390 discussions
Start a n
N
ew thread
[reactos] 03/03: [SMSS] Use the new IsNEC_98 macro defined for user-mode.
by Hermès Bélusca-Maïto
25 Nov '20
25 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a0721ebdd33f7c32546ed…
commit a0721ebdd33f7c32546edd3cfaf966c64860988c Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Thu Nov 26 00:25:05 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Nov 26 00:29:34 2020 +0100 [SMSS] Use the new IsNEC_98 macro defined for user-mode. --- base/system/smss/pagefile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/system/smss/pagefile.c b/base/system/smss/pagefile.c index 51429a18867..0e3b6746746 100644 --- a/base/system/smss/pagefile.c +++ b/base/system/smss/pagefile.c @@ -851,8 +851,8 @@ SmpCreateVolumeDescriptors(VOID) wcscpy(Buffer, L"\\??\\A:\\"); RtlInitUnicodeString(&VolumePath, Buffer); - /* Start with the C drive except on weird Japanese NECs... */ - StartChar = SharedUserData->AlternativeArchitecture ? L'A' : L'C'; + /* Start with the C drive, except on NEC PC-98 */ + StartChar = IsNEC_98 ? L'A' : L'C'; for (Drive = StartChar, DriveDiff = StartChar - L'A'; Drive <= L'Z'; Drive++, DriveDiff++) { /* Skip the disk if it's not in the drive map */
1
0
0
0
[reactos] 02/03: [NDK][XDK] Add some missing macros for run-time checks of X86 system architecture (NEC support).
by Hermès Bélusca-Maïto
25 Nov '20
25 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9feab8e95afd57e2a973c…
commit 9feab8e95afd57e2a973c4ef660dc3db55016552 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Thu Nov 26 00:17:50 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Nov 26 00:29:34 2020 +0100 [NDK][XDK] Add some missing macros for run-time checks of X86 system architecture (NEC support). --- sdk/include/ndk/ketypes.h | 23 +++++++++++++++++++++++ sdk/include/xdk/ketypes.h | 1 + sdk/include/xdk/x86/ke.h | 21 +++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/sdk/include/ndk/ketypes.h b/sdk/include/ndk/ketypes.h index 7a8c614a8de..bd9409d5d26 100644 --- a/sdk/include/ndk/ketypes.h +++ b/sdk/include/ndk/ketypes.h @@ -221,6 +221,29 @@ typedef CCHAR KPROCESSOR_MODE; // #define SharedUserData ((KUSER_SHARED_DATA *)USER_SHARED_DATA) +/* Macros for user-mode run-time checks of X86 system architecture */ +#ifdef _X86_ + +#ifndef IsNEC_98 +#define IsNEC_98 (SharedUserData->AlternativeArchitecture == NEC98x86) +#endif + +#ifndef IsNotNEC_98 +#define IsNotNEC_98 (SharedUserData->AlternativeArchitecture != NEC98x86) +#endif + +/* User-mode cannot override the architecture */ +#ifndef SetNEC_98 +#define SetNEC_98 +#endif + +/* User-mode cannot override the architecture */ +#ifndef SetNotNEC_98 +#define SetNotNEC_98 +#endif + +#endif + // // Maximum WOW64 Entries in KUSER_SHARED_DATA // diff --git a/sdk/include/xdk/ketypes.h b/sdk/include/xdk/ketypes.h index d8abc4089c2..23a05de1b68 100644 --- a/sdk/include/xdk/ketypes.h +++ b/sdk/include/xdk/ketypes.h @@ -892,6 +892,7 @@ typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE { EndAlternatives } ALTERNATIVE_ARCHITECTURE_TYPE; +/* Correctly define these run-time definitions for non X86 machines */ #ifndef _X86_ #ifndef IsNEC_98 diff --git a/sdk/include/xdk/x86/ke.h b/sdk/include/xdk/x86/ke.h index c4be5220fa0..4b66e2a9d37 100644 --- a/sdk/include/xdk/x86/ke.h +++ b/sdk/include/xdk/x86/ke.h @@ -335,4 +335,25 @@ KeGetCurrentProcessorNumber(VOID) return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number)); } +/* Macros for kernel-mode run-time checks of X86 system architecture */ +#ifdef IsNEC_98 +#undef IsNEC_98 +#endif +#define IsNEC_98 (SharedUserData->AlternativeArchitecture == NEC98x86) + +#ifdef IsNotNEC_98 +#undef IsNotNEC_98 +#endif +#define IsNotNEC_98 (SharedUserData->AlternativeArchitecture != NEC98x86) + +#ifdef SetNEC_98 +#undef SetNEC_98 +#endif +#define SetNEC_98 (SharedUserData->AlternativeArchitecture = NEC98x86) + +#ifdef SetNotNEC_98 +#undef SetNotNEC_98 +#endif +#define SetNotNEC_98 (SharedUserData->AlternativeArchitecture = StandardDesign) + $endif (_NTDDK_)
1
0
0
0
[reactos] 01/03: [XDK] Minor formatting; remove some extra newlines at end of files.
by Hermès Bélusca-Maïto
25 Nov '20
25 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c295fb95e9da150da4b4a…
commit c295fb95e9da150da4b4ad5f0db71ed087c76e40 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Thu Nov 26 00:07:40 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Nov 26 00:29:20 2020 +0100 [XDK] Minor formatting; remove some extra newlines at end of files. --- sdk/include/xdk/arm/ke.h | 4 +--- sdk/include/xdk/ia64/ke.h | 1 - sdk/include/xdk/mips/ke.h | 2 +- sdk/include/xdk/ppc/ke.h | 3 +-- sdk/include/xdk/x86/ke.h | 4 ---- 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sdk/include/xdk/arm/ke.h b/sdk/include/xdk/arm/ke.h index 74e5bdda2c3..dc344b30c11 100644 --- a/sdk/include/xdk/arm/ke.h +++ b/sdk/include/xdk/arm/ke.h @@ -347,9 +347,7 @@ KeGetPcr( #if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) FORCEINLINE ULONG -KeGetCurrentProcessorNumber( - VOID) - +KeGetCurrentProcessorNumber(VOID) { return *((PUCHAR)KeGetPcr() + 0x580); } diff --git a/sdk/include/xdk/ia64/ke.h b/sdk/include/xdk/ia64/ke.h index 27ff06ad3f0..7a8e7a45809 100644 --- a/sdk/include/xdk/ia64/ke.h +++ b/sdk/include/xdk/ia64/ke.h @@ -35,4 +35,3 @@ NTAPI KeGetCurrentThread(VOID); $endif - diff --git a/sdk/include/xdk/mips/ke.h b/sdk/include/xdk/mips/ke.h index 31384ad4d27..d3d8820e2f8 100644 --- a/sdk/include/xdk/mips/ke.h +++ b/sdk/include/xdk/mips/ke.h @@ -1,4 +1,5 @@ $if (_WDMDDK_) +/** Kernel definitions for MIPS **/ #error MIPS Headers are totally incorrect // @@ -63,4 +64,3 @@ NTAPI KeRaiseIrqlToSynchLevel(VOID); $endif - diff --git a/sdk/include/xdk/ppc/ke.h b/sdk/include/xdk/ppc/ke.h index b3a81bc7aa9..d7101618a95 100644 --- a/sdk/include/xdk/ppc/ke.h +++ b/sdk/include/xdk/ppc/ke.h @@ -1,4 +1,5 @@ $if (_WDMDDK_) +/** Kernel definitions for PPC **/ /* Interrupt request levels */ #define PASSIVE_LEVEL 0 @@ -103,5 +104,3 @@ NTAPI KeRaiseIrqlToSynchLevel(VOID); $endif - - diff --git a/sdk/include/xdk/x86/ke.h b/sdk/include/xdk/x86/ke.h index f7ef92c2972..c4be5220fa0 100644 --- a/sdk/include/xdk/x86/ke.h +++ b/sdk/include/xdk/x86/ke.h @@ -336,7 +336,3 @@ KeGetCurrentProcessorNumber(VOID) } $endif (_NTDDK_) - - - -
1
0
0
0
[reactos] 01/01: [SETUPLIB] Add two hacks in partlist.c for temporarily setting consistently the disk partition style.
by Hermès Bélusca-Maïto
24 Nov '20
24 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a59cecd89ddfd7e4b84e5…
commit a59cecd89ddfd7e4b84e57032538fd915a2d468d Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Tue Nov 24 04:34:56 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Nov 24 04:37:52 2020 +0100 [SETUPLIB] Add two hacks in partlist.c for temporarily setting consistently the disk partition style. Add two hacks in UpdateDiskLayout() and WritePartitions() so that the disk partition style is consistently set to a known value MBR, especially when that disk was previously new and uninitialized (RAW). A proper fix will be developed later when support for GPT is added. --- base/setup/lib/utils/partlist.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/setup/lib/utils/partlist.c b/base/setup/lib/utils/partlist.c index 6682f0a36a8..008dd9947a9 100644 --- a/base/setup/lib/utils/partlist.c +++ b/base/setup/lib/utils/partlist.c @@ -2881,6 +2881,9 @@ UpdateDiskLayout( } } + // HACK: See the FIXMEs in WritePartitions(): (Re)set the PartitionStyle to MBR. + DiskEntry->DiskStyle = PARTITION_STYLE_MBR; + DiskEntry->Dirty = TRUE; #ifdef DUMP_PARTITION_TABLE @@ -3926,6 +3929,9 @@ WritePartitions( // DiskEntry->NoMbr was TRUE (instead of NewDisk). // + // HACK: Parts of FIXMEs described above: (Re)set the PartitionStyle to MBR. + DiskEntry->DiskStyle = PARTITION_STYLE_MBR; + /* The layout has been successfully updated, the disk is not dirty anymore */ DiskEntry->Dirty = FALSE;
1
0
0
0
[reactos] 02/02: [SETUPLIB][USETUP] Cleanup some code in USETUP. Redefine FormatPartition() and ChkdskPartition() helpers so that they wrap the needed init steps for formatting/chkdsk'ing.
by Hermès Bélusca-Maïto
24 Nov '20
24 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=05cd77028cad3c198dba9…
commit 05cd77028cad3c198dba936cf9e74a9a578db5b9 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Tue Nov 24 02:26:52 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Nov 24 03:24:41 2020 +0100 [SETUPLIB][USETUP] Cleanup some code in USETUP. Redefine FormatPartition() and ChkdskPartition() helpers so that they wrap the needed init steps for formatting/chkdsk'ing. These helpers now accept a PPARTENTRY, together with the usual formatting/chkdsk parameters. The helpers now determine the actual NT path to use, and can perform the init steps on the partition before performing the actual operation. In particular, FormatPartition() is now made GPT-compliant. The partition type retrieved by FileSystemToMBRPartitionType() is now used as a hint for choosing FAT32 over FAT12/16, and only in the case of a MBR partition that is *NOT* a recognized OEM partition, it is used for updating the corresponding partition type. (OEM partitions must retain their original type.) The OEM partition types we (and NT) can recognize are specified e.g. in the Microsoft Open-Specification [MS-DMRP] Appendix B
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dmrp/5f5043…
Introduce an IsOEMPartition() macro to help checking for these types (its name is based on the Is***Partition() macros from ntdddisk.h, and from a dmdskmgr.dll export of similar name). --- base/setup/lib/fsutil.c | 132 +++++++++++++++++++++++++++++--- base/setup/lib/fsutil.h | 22 ++++-- base/setup/lib/utils/partlist.h | 19 +++++ base/setup/usetup/chkdsk.c | 23 +++--- base/setup/usetup/chkdsk.h | 8 +- base/setup/usetup/format.c | 23 +++--- base/setup/usetup/format.h | 4 +- base/setup/usetup/usetup.c | 164 +++++++++++----------------------------- 8 files changed, 230 insertions(+), 165 deletions(-) diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c index f71acef487e..c244111a381 100644 --- a/base/setup/lib/fsutil.c +++ b/base/setup/lib/fsutil.c @@ -666,19 +666,90 @@ Quit: // Formatting routines // -BOOLEAN -PreparePartitionForFormatting( - IN struct _PARTENTRY* PartEntry, - IN PCWSTR FileSystemName) +NTSTATUS +ChkdskPartition( + IN PPARTENTRY PartEntry, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PFMIFSCALLBACK Callback) { + NTSTATUS Status; + PDISKENTRY DiskEntry = PartEntry->DiskEntry; + // UNICODE_STRING PartitionRootPath; + WCHAR PartitionRootPath[MAX_PATH]; // PathBuffer + + ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0); + + /* HACK: Do not try to check a partition with an unknown filesystem */ + if (!*PartEntry->FileSystem) + { + PartEntry->NeedsCheck = FALSE; + return STATUS_SUCCESS; + } + + /* Set PartitionRootPath */ + RtlStringCchPrintfW(PartitionRootPath, ARRAYSIZE(PartitionRootPath), + L"\\Device\\Harddisk%lu\\Partition%lu", + DiskEntry->DiskNumber, + PartEntry->PartitionNumber); + DPRINT("PartitionRootPath: %S\n", PartitionRootPath); + + /* Check the partition */ + Status = ChkdskFileSystem(PartitionRootPath, + PartEntry->FileSystem, + FixErrors, + Verbose, + CheckOnlyIfDirty, + ScanDrive, + Callback); + if (!NT_SUCCESS(Status)) + return Status; + + PartEntry->NeedsCheck = FALSE; + return STATUS_SUCCESS; +} + +NTSTATUS +FormatPartition( + IN PPARTENTRY PartEntry, + IN PCWSTR FileSystemName, + IN FMIFS_MEDIA_FLAG MediaFlag, + IN PCWSTR Label, + IN BOOLEAN QuickFormat, + IN ULONG ClusterSize, + IN PFMIFSCALLBACK Callback) +{ + NTSTATUS Status; + PDISKENTRY DiskEntry = PartEntry->DiskEntry; UCHAR PartitionType; + // UNICODE_STRING PartitionRootPath; + WCHAR PartitionRootPath[MAX_PATH]; // PathBuffer + + ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0); if (!FileSystemName || !*FileSystemName) { DPRINT1("No file system specified?\n"); - return FALSE; + return STATUS_UNRECOGNIZED_VOLUME; } + /* + * Prepare the partition for formatting (for MBR disks, reset the + * partition type), and adjust the filesystem name in case of FAT + * vs. FAT32, depending on the geometry of the partition. + */ + +// FIXME: Do this only if QuickFormat == FALSE? What about FAT handling? + + /* + * Retrieve a partition type as a hint only. It will be used to determine + * whether to actually use FAT12/16 or FAT32 filesystem, depending on the + * geometry of the partition. If the partition resides on an MBR disk, + * the partition style will be reset to this value as well, unless the + * partition is OEM. + */ PartitionType = FileSystemToMBRPartitionType(FileSystemName, PartEntry->StartSector.QuadPart, PartEntry->SectorCount.QuadPart); @@ -686,33 +757,70 @@ PreparePartitionForFormatting( { /* Unknown file system */ DPRINT1("Unknown file system '%S'\n", FileSystemName); - return FALSE; + return STATUS_UNRECOGNIZED_VOLUME; } - SetMBRPartitionType(PartEntry, PartitionType); + /* Reset the MBR partition type, unless this is an OEM partition */ + if (DiskEntry->DiskStyle == PARTITION_STYLE_MBR) + { + if (!IsOEMPartition(PartEntry->PartitionType)) + SetMBRPartitionType(PartEntry, PartitionType); + } /* * Adjust the filesystem name in case of FAT vs. FAT32, according to - * the type of partition set by FileSystemToPartitionType(). + * the type of partition returned by FileSystemToMBRPartitionType(). */ if (wcsicmp(FileSystemName, L"FAT") == 0) { - if ((/*PartEntry->*/PartitionType == PARTITION_FAT32) || - (/*PartEntry->*/PartitionType == PARTITION_FAT32_XINT13)) + if ((PartitionType == PARTITION_FAT32) || + (PartitionType == PARTITION_FAT32_XINT13)) { FileSystemName = L"FAT32"; } } + /* Commit the partition changes to the disk */ + Status = WritePartitions(DiskEntry); + if (!NT_SUCCESS(Status)) + { + DPRINT1("WritePartitions(disk %lu) failed, Status 0x%08lx\n", + DiskEntry->DiskNumber, Status); + return STATUS_PARTITION_FAILURE; + } + + /* Set PartitionRootPath */ + RtlStringCchPrintfW(PartitionRootPath, ARRAYSIZE(PartitionRootPath), + L"\\Device\\Harddisk%lu\\Partition%lu", + DiskEntry->DiskNumber, + PartEntry->PartitionNumber); + DPRINT("PartitionRootPath: %S\n", PartitionRootPath); + + /* Format the partition */ + Status = FormatFileSystem(PartitionRootPath, + FileSystemName, + MediaFlag, + Label, + QuickFormat, + ClusterSize, + Callback); + if (!NT_SUCCESS(Status)) + return Status; + // -// FIXME: Do this now, or after the partition was actually formatted?? +// TODO: Here, call a partlist.c function that update the actual +// FS name and the label fields of the volume. // + PartEntry->FormatState = Formatted; + /* Set the new partition's file system proper */ RtlStringCbCopyW(PartEntry->FileSystem, sizeof(PartEntry->FileSystem), FileSystemName); - return TRUE; + PartEntry->New = FALSE; + + return STATUS_SUCCESS; } /* EOF */ diff --git a/base/setup/lib/fsutil.h b/base/setup/lib/fsutil.h index 7696be6dec8..1056cfb658d 100644 --- a/base/setup/lib/fsutil.h +++ b/base/setup/lib/fsutil.h @@ -101,11 +101,23 @@ InstallBtrfsBootCode( // Formatting routines // -struct _PARTENTRY; // Defined in partlist.h +NTSTATUS +ChkdskPartition( + IN PPARTENTRY PartEntry, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PFMIFSCALLBACK Callback); -BOOLEAN -PreparePartitionForFormatting( - IN struct _PARTENTRY* PartEntry, - IN PCWSTR FileSystemName); +NTSTATUS +FormatPartition( + IN PPARTENTRY PartEntry, + IN PCWSTR FileSystemName, + IN FMIFS_MEDIA_FLAG MediaFlag, + IN PCWSTR Label, + IN BOOLEAN QuickFormat, + IN ULONG ClusterSize, + IN PFMIFSCALLBACK Callback); /* EOF */ diff --git a/base/setup/lib/utils/partlist.h b/base/setup/lib/utils/partlist.h index 4dd108ba15c..2669b9ecdef 100644 --- a/base/setup/lib/utils/partlist.h +++ b/base/setup/lib/utils/partlist.h @@ -20,6 +20,25 @@ typedef struct _PARTITION_TYPE extern PARTITION_TYPE PartitionTypes[NUM_PARTITION_TYPE_ENTRIES]; +/* EXTRA HANDFUL MACROS *****************************************************/ + +// NOTE: They should be moved into some global header. + +/* OEM MBR partition types recognized by NT (see [MS-DMRP] Appendix B) */ +#define PARTITION_EISA 0x12 // EISA partition +#define PARTITION_HIBERNATION 0x84 // Hibernation partition for laptops +#define PARTITION_DIAGNOSTIC 0xA0 // Diagnostic partition on some Hewlett-Packard (HP) notebooks +#define PARTITION_DELL 0xDE // Dell partition +#define PARTITION_IBM 0xFE // IBM Initial Microprogram Load (IML) partition + +#define IsOEMPartition(PartitionType) \ + ( ((PartitionType) == PARTITION_EISA) || \ + ((PartitionType) == PARTITION_HIBERNATION) || \ + ((PartitionType) == PARTITION_DIAGNOSTIC) || \ + ((PartitionType) == PARTITION_DELL) || \ + ((PartitionType) == PARTITION_IBM) ) + + /* PARTITION UTILITY FUNCTIONS **********************************************/ typedef enum _FORMATSTATE diff --git a/base/setup/usetup/chkdsk.c b/base/setup/usetup/chkdsk.c index 615e7022c0e..b302dc94581 100644 --- a/base/setup/usetup/chkdsk.c +++ b/base/setup/usetup/chkdsk.c @@ -16,7 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* COPYRIGHT: See COPYING in the top level directory +/* + * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup * FILE: base/setup/usetup/chkdsk.c * PURPOSE: Filesystem chkdsk support functions @@ -52,11 +53,9 @@ ChkdskCallback( return TRUE; } - NTSTATUS -ChkdskPartition( - IN PUNICODE_STRING DriveRoot, - IN PCWSTR FileSystemName) +DoChkdsk( + IN PPARTENTRY PartEntry) { NTSTATUS Status; @@ -71,13 +70,13 @@ ChkdskPartition( ProgressSetStepCount(ChkdskProgressBar, 100); - Status = ChkdskFileSystem_UStr(DriveRoot, - FileSystemName, - TRUE, /* FixErrors */ - FALSE, /* Verbose */ - TRUE, /* CheckOnlyIfDirty */ - FALSE, /* ScanDrive */ - ChkdskCallback); /* Callback */ + // TODO: Think about which values could be defaulted... + Status = ChkdskPartition(PartEntry, + TRUE, /* FixErrors */ + FALSE, /* Verbose */ + TRUE, /* CheckOnlyIfDirty */ + FALSE, /* ScanDrive */ + ChkdskCallback); /* Callback */ DestroyProgressBar(ChkdskProgressBar); ChkdskProgressBar = NULL; diff --git a/base/setup/usetup/chkdsk.h b/base/setup/usetup/chkdsk.h index 3207d2f7f69..594c9b13b61 100644 --- a/base/setup/usetup/chkdsk.h +++ b/base/setup/usetup/chkdsk.h @@ -16,7 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* COPYRIGHT: See COPYING in the top level directory +/* + * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup * FILE: base/setup/usetup/chkdsk.h * PURPOSE: Filesystem chkdsk support functions @@ -26,8 +27,7 @@ #pragma once NTSTATUS -ChkdskPartition( - IN PUNICODE_STRING DriveRoot, - IN PCWSTR FileSystemName); +DoChkdsk( + IN PPARTENTRY PartEntry); /* EOF */ diff --git a/base/setup/usetup/format.c b/base/setup/usetup/format.c index 4abb464ba3e..cc0603ed07b 100644 --- a/base/setup/usetup/format.c +++ b/base/setup/usetup/format.c @@ -16,7 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* COPYRIGHT: See COPYING in the top level directory +/* + * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup * FILE: base/setup/usetup/format.c * PURPOSE: Filesystem format support functions @@ -87,10 +88,9 @@ FormatCallback( return TRUE; } - NTSTATUS -FormatPartition( - IN PUNICODE_STRING DriveRoot, +DoFormat( + IN PPARTENTRY PartEntry, IN PCWSTR FileSystemName, IN BOOLEAN QuickFormat) { @@ -107,13 +107,14 @@ FormatPartition( ProgressSetStepCount(FormatProgressBar, 100); - Status = FormatFileSystem_UStr(DriveRoot, - FileSystemName, - FMIFS_HARDDISK, /* MediaFlag */ - NULL, /* Label */ - QuickFormat, /* QuickFormat */ - 0, /* ClusterSize */ - FormatCallback); /* Callback */ + // TODO: Think about which values could be defaulted... + Status = FormatPartition(PartEntry, + FileSystemName, + FMIFS_HARDDISK, /* MediaFlag */ + NULL, /* Label */ + QuickFormat, /* QuickFormat */ + 0, /* ClusterSize */ + FormatCallback); /* Callback */ DestroyProgressBar(FormatProgressBar); FormatProgressBar = NULL; diff --git a/base/setup/usetup/format.h b/base/setup/usetup/format.h index b84ae57559d..80c5a85039c 100644 --- a/base/setup/usetup/format.h +++ b/base/setup/usetup/format.h @@ -27,8 +27,8 @@ #pragma once NTSTATUS -FormatPartition( - IN PUNICODE_STRING DriveRoot, +DoFormat( + IN PPARTENTRY PartEntry, IN PCWSTR FileSystemName, IN BOOLEAN QuickFormat); diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c index 01907778721..e8de2666026 100644 --- a/base/setup/usetup/usetup.c +++ b/base/setup/usetup/usetup.c @@ -2766,7 +2766,6 @@ SelectFileSystemPage(PINPUT_RECORD Ir) * partition on the system. Otherwise if we install on a removable disk * use the install partition as the system partition. */ - // TODO: Include that logic inside the FindSupportedSystemPartition() function? if (InstallPartition->DiskEntry->MediaType == FixedMedia) { SystemPartition = FindSupportedSystemPartition(PartitionList, @@ -2949,17 +2948,11 @@ SelectFileSystemPage(PINPUT_RECORD Ir) */ if (!SystemPartition->IsPartitioned) { - // if (IsUnattendedSetup) - { - CreatePrimaryPartition(PartitionList, - SystemPartition, - 0LL, // SystemPartition->SectorCount.QuadPart, - TRUE); - ASSERT(SystemPartition->IsPartitioned); - } - // else - { - } + CreatePrimaryPartition(PartitionList, + SystemPartition, + 0LL, // SystemPartition->SectorCount.QuadPart, + TRUE); + ASSERT(SystemPartition->IsPartitioned); } /* Set it as such */ @@ -3363,16 +3356,9 @@ FormatPartitionPage(PINPUT_RECORD Ir) PPARTENTRY PartEntry; PDISKENTRY DiskEntry; PFILE_SYSTEM_ITEM SelectedFileSystem; - UNICODE_STRING PartitionRootPath; WCHAR PathBuffer[MAX_PATH]; CHAR Buffer[MAX_PATH]; -#ifndef NDEBUG - ULONG Line; - ULONG i; - PPARTITION_INFORMATION PartitionInfo; -#endif - DPRINT("FormatPartitionPage()\n"); MUIDisplayPage(FORMAT_PARTITION_PAGE); @@ -3413,82 +3399,40 @@ FormatPartitionPage(PINPUT_RECORD Ir) /* * Remove the "Press ENTER to continue" message prompt when the ENTER * key is pressed as the user wants to begin the partition formatting. - */ + */ MUIClearStyledText(FORMAT_PARTITION_PAGE, TEXT_ID_FORMAT_PROMPT, TEXT_TYPE_REGULAR); CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); - if (!PreparePartitionForFormatting(PartEntry, SelectedFileSystem->FileSystem)) + /* Format the partition */ + Status = DoFormat(PartEntry, + SelectedFileSystem->FileSystem, + SelectedFileSystem->QuickFormat); + if (Status == STATUS_PARTITION_FAILURE) { - /* FIXME: show an error dialog */ + MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER); /* Reset the filesystem list */ ResetFileSystemList(); - return QUIT_PAGE; } - -#ifndef NDEBUG - CONSOLE_PrintTextXY(6, 12, - "Cylinders: %I64u Tracks/Cyl: %lu Sectors/Trk: %lu Bytes/Sec: %lu %c", - DiskEntry->Cylinders, - DiskEntry->TracksPerCylinder, - DiskEntry->SectorsPerTrack, - DiskEntry->BytesPerSector, - DiskEntry->Dirty ? '*' : ' '); - - Line = 13; - - for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++) - { - PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i]; - - CONSOLE_PrintTextXY(6, Line, - "%2u: %2lu %c %12I64u %12I64u %02x", - i, - PartitionInfo->PartitionNumber, - PartitionInfo->BootIndicator ? 'A' : '-', - PartitionInfo->StartingOffset.QuadPart / DiskEntry->BytesPerSector, - PartitionInfo->PartitionLength.QuadPart / DiskEntry->BytesPerSector, - PartitionInfo->PartitionType); - Line++; - } -#endif - - /* Commit the partition changes to the disk */ - Status = WritePartitions(DiskEntry); - if (!NT_SUCCESS(Status)) + else if (Status == STATUS_UNRECOGNIZED_VOLUME) { - DPRINT1("WritePartitions(disk %lu) failed, Status 0x%08lx\n", - DiskEntry->DiskNumber, Status); - - MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER); + /* FIXME: show an error dialog */ + // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer); /* Reset the filesystem list */ ResetFileSystemList(); - return QUIT_PAGE; } - - /* Set PartitionRootPath */ - RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), - L"\\Device\\Harddisk%lu\\Partition%lu", - DiskEntry->DiskNumber, - PartEntry->PartitionNumber); - RtlInitUnicodeString(&PartitionRootPath, PathBuffer); - DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath); - - /* Format the partition */ - Status = FormatPartition(&PartitionRootPath, - PartEntry->FileSystem, - SelectedFileSystem->QuickFormat); - if (Status == STATUS_NOT_SUPPORTED) + else if (Status == STATUS_NOT_SUPPORTED) { - sprintf(Buffer, - "Setup is currently unable to format a partition in %S.\n" - "\n" - " \x07 Press ENTER to continue Setup.\n" - " \x07 Press F3 to quit Setup.", - SelectedFileSystem->FileSystem /* PartEntry->FileSystem */); + RtlStringCbPrintfA(Buffer, + sizeof(Buffer), + "Setup is currently unable to format a partition in %S.\n" + "\n" + " \x07 Press ENTER to continue Setup.\n" + " \x07 Press F3 to quit Setup.", + SelectedFileSystem->FileSystem); PopupError(Buffer, MUIGetString(STRING_QUITCONTINUE), @@ -3520,28 +3464,20 @@ FormatPartitionPage(PINPUT_RECORD Ir) } else if (!NT_SUCCESS(Status)) { + /** HACK!! **/ + RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), + L"\\Device\\Harddisk%lu\\Partition%lu", + DiskEntry->DiskNumber, + PartEntry->PartitionNumber); + DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status); MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer); /* Reset the filesystem list */ ResetFileSystemList(); - return QUIT_PAGE; } -// -// TODO: Here, call a partlist.c function that update the actual FS name -// and the label fields of the volume. -// - PartEntry->FormatState = Formatted; - // PartEntry->FileSystem = FileSystem; - PartEntry->New = FALSE; - -#ifndef NDEBUG - CONSOLE_SetStatusText(" Done. Press any key ..."); - CONSOLE_ConInKey(Ir); -#endif - return SELECT_FILE_SYSTEM_PAGE; } } @@ -3567,10 +3503,7 @@ static PAGE_NUMBER CheckFileSystemPage(PINPUT_RECORD Ir) { NTSTATUS Status; - PDISKENTRY DiskEntry; PPARTENTRY PartEntry; - UNICODE_STRING PartitionRootPath; - WCHAR PathBuffer[MAX_PATH]; CHAR Buffer[MAX_PATH]; if (PartitionList == NULL) @@ -3579,7 +3512,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir) return QUIT_PAGE; } - if (!GetNextUncheckedPartition(PartitionList, &DiskEntry, &PartEntry)) + if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry)) { return INSTALL_DIRECTORY_PAGE; } @@ -3587,29 +3520,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir) ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0); CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART)); - CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n", PartEntry->PartitionType, (*PartEntry->FileSystem ? PartEntry->FileSystem : L"n/a")); - /* HACK: Do not try to check a partition with an unknown filesystem */ - if (!*PartEntry->FileSystem) - { - PartEntry->NeedsCheck = FALSE; - return CHECK_FILE_SYSTEM_PAGE; - } - - /* Set PartitionRootPath */ - RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), - L"\\Device\\Harddisk%lu\\Partition%lu", - DiskEntry->DiskNumber, - PartEntry->PartitionNumber); - RtlInitUnicodeString(&PartitionRootPath, PathBuffer); - DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath); - /* Check the partition */ - Status = ChkdskPartition(&PartitionRootPath, PartEntry->FileSystem); + Status = DoChkdsk(PartEntry); if (Status == STATUS_NOT_SUPPORTED) { /* @@ -3650,8 +3567,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir) } else if (!NT_SUCCESS(Status)) { - DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status); - sprintf(Buffer, "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n", Status); + DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", Status); + + RtlStringCbPrintfA(Buffer, + sizeof(Buffer), + "ChkDsk detected some disk errors.\n(Status 0x%08lx).\n", + Status); + PopupError(Buffer, MUIGetString(STRING_CONTINUE), Ir, POPUP_WAIT_ENTER); @@ -4307,7 +4229,8 @@ BootLoaderPage(PINPUT_RECORD Ir) CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); - ASSERT(SystemPartition->IsPartitioned && SystemPartition->PartitionNumber != 0); + /* We must have a supported system partition by now */ + ASSERT(SystemPartition && SystemPartition->IsPartitioned && SystemPartition->PartitionNumber != 0); RtlFreeUnicodeString(&USetupData.SystemRootPath); RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), @@ -4806,7 +4729,7 @@ ProgressCountdown( TimeElapsed = NtGetTickCount() - StartTime; if (TimeElapsed < TimerDiv) { - /* Convert the time to NT Format */ + /* Convert the time to NT format */ Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL; Status = NtWaitForSingleObject(StdInput, FALSE, &Timeout); } @@ -4987,7 +4910,6 @@ RunUSetup(VOID) CONSOLE_Flush(); // CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); - // CONSOLE_Flush(); switch (Page) { @@ -5041,6 +4963,7 @@ RunUSetup(VOID) Page = LayoutSettingsPage(&Ir); break; + /* Partitioning pages */ case SELECT_PARTITION_PAGE: Page = SelectPartitionPage(&Ir); break; @@ -5065,6 +4988,7 @@ RunUSetup(VOID) Page = DeletePartitionPage(&Ir); break; + /* Filesystem partition operations pages */ case SELECT_FILE_SYSTEM_PAGE: Page = SelectFileSystemPage(&Ir); break; @@ -5077,6 +5001,7 @@ RunUSetup(VOID) Page = CheckFileSystemPage(&Ir); break; + /* Installation pages */ case INSTALL_DIRECTORY_PAGE: Page = InstallDirectoryPage(&Ir); break; @@ -5093,6 +5018,7 @@ RunUSetup(VOID) Page = RegistryPage(&Ir); break; + /* Bootloader installation pages */ case BOOT_LOADER_PAGE: Page = BootLoaderPage(&Ir); break;
1
0
0
0
[reactos] 01/02: [SETUPLIB] Make InferFileSystem() compatible for both MBR and GPT disks. Simplify the FSREC interface a bit.
by Hermès Bélusca-Maïto
24 Nov '20
24 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9735a8379fbdc315fb7df…
commit 9735a8379fbdc315fb7df97b2d3c3a49b068a912 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Tue Nov 24 01:49:41 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Nov 24 03:24:36 2020 +0100 [SETUPLIB] Make InferFileSystem() compatible for both MBR and GPT disks. Simplify the FSREC interface a bit. Instead of providing an MBR partition type to InferFileSystem(), make it call IOCTL_DISK_GET_PARTITION_INFO(_EX) to determine whether the partition pointed by the path/handle is MBR or GPT. Then, only if it's MBR, we retrieve its partition type in order to "guess" an adequate file system name, in case the latter was not recognized already via regular ways (via GetFileSystemName() / NtQueryVolumeInformationFile()). - Remove the GetFileSystemNameByHandle() and InferFileSystemByHandle() functions. Instead, make the other GetFileSystemName*() and InferFileSystem*() functions accept a HANDLE as an alternative to the already-existing partition path string. These parameters are exclusive to each other. - Rename SetPartitionType() -> SetMBRPartitionType(), and FileSystemToPartitionType() -> FileSystemToMBRPartitionType() in order to really clarify what they do (since this code is meant for MBR partitions only, not GPT ones). --- base/setup/lib/fsutil.c | 8 +- base/setup/lib/utils/fsrec.c | 276 +++++++++++++++++++++++++++------------- base/setup/lib/utils/fsrec.h | 29 ++--- base/setup/lib/utils/partlist.c | 18 ++- base/setup/lib/utils/partlist.h | 2 +- 5 files changed, 214 insertions(+), 119 deletions(-) diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c index 3d49be888d7..f71acef487e 100644 --- a/base/setup/lib/fsutil.c +++ b/base/setup/lib/fsutil.c @@ -679,9 +679,9 @@ PreparePartitionForFormatting( return FALSE; } - PartitionType = FileSystemToPartitionType(FileSystemName, - &PartEntry->StartSector, - &PartEntry->SectorCount); + PartitionType = FileSystemToMBRPartitionType(FileSystemName, + PartEntry->StartSector.QuadPart, + PartEntry->SectorCount.QuadPart); if (PartitionType == PARTITION_ENTRY_UNUSED) { /* Unknown file system */ @@ -689,7 +689,7 @@ PreparePartitionForFormatting( return FALSE; } - SetPartitionType(PartEntry, PartitionType); + SetMBRPartitionType(PartEntry, PartitionType); /* * Adjust the filesystem name in case of FAT vs. FAT32, according to diff --git a/base/setup/lib/utils/fsrec.c b/base/setup/lib/utils/fsrec.c index 918e2fb69a3..0b42113a805 100644 --- a/base/setup/lib/utils/fsrec.c +++ b/base/setup/lib/utils/fsrec.c @@ -19,26 +19,27 @@ /* FUNCTIONS ****************************************************************/ /* NOTE: Ripped & adapted from base/system/autochk/autochk.c */ +static inline NTSTATUS -GetFileSystemNameByHandle( +GetFileSystemNameWorker( IN HANDLE PartitionHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize) { NTSTATUS Status; - IO_STATUS_BLOCK IoStatusBlock; UCHAR Buffer[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + MAX_PATH * sizeof(WCHAR)]; PFILE_FS_ATTRIBUTE_INFORMATION FileFsAttribute = (PFILE_FS_ATTRIBUTE_INFORMATION)Buffer; /* Retrieve the FS attributes */ Status = NtQueryVolumeInformationFile(PartitionHandle, - &IoStatusBlock, + IoStatusBlock, FileFsAttribute, sizeof(Buffer), FileFsAttributeInformation); if (!NT_SUCCESS(Status)) { - DPRINT1("NtQueryVolumeInformationFile failed, Status 0x%08lx\n", Status); + DPRINT1("NtQueryVolumeInformationFile() failed, Status 0x%08lx\n", Status); return Status; } @@ -52,69 +53,97 @@ GetFileSystemNameByHandle( NTSTATUS GetFileSystemName_UStr( - IN PUNICODE_STRING PartitionPath, + IN PUNICODE_STRING PartitionPath OPTIONAL, + IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize) { NTSTATUS Status; OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE PartitionHandle; IO_STATUS_BLOCK IoStatusBlock; - /* Open the partition */ - InitializeObjectAttributes(&ObjectAttributes, - PartitionPath, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = NtOpenFile(&PartitionHandle, - FILE_GENERIC_READ /* | SYNCHRONIZE */, - &ObjectAttributes, - &IoStatusBlock, - FILE_SHARE_READ | FILE_SHARE_WRITE, - 0 /* FILE_SYNCHRONOUS_IO_NONALERT */); - if (!NT_SUCCESS(Status)) + if (PartitionPath && PartitionHandle) + return STATUS_INVALID_PARAMETER; + + /* Open the partition if a path has been given; + * otherwise just use the provided handle. */ + if (PartitionPath) { - DPRINT1("Failed to open partition '%wZ', Status 0x%08lx\n", PartitionPath, Status); - return Status; + InitializeObjectAttributes(&ObjectAttributes, + PartitionPath, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenFile(&PartitionHandle, + FILE_GENERIC_READ /* | SYNCHRONIZE */, + &ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE, + 0 /* FILE_SYNCHRONOUS_IO_NONALERT */); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to open partition '%wZ', Status 0x%08lx\n", + PartitionPath, Status); + return Status; + } } /* Retrieve the FS attributes */ - Status = GetFileSystemNameByHandle(PartitionHandle, FileSystemName, FileSystemNameSize); + Status = GetFileSystemNameWorker(PartitionHandle, + &IoStatusBlock, + FileSystemName, + FileSystemNameSize); if (!NT_SUCCESS(Status)) { - DPRINT1("GetFileSystemNameByHandle() failed for partition '%wZ', Status 0x%08lx\n", - PartitionPath, Status); + DPRINT1("GetFileSystemName() failed for partition '%wZ' (0x%p), Status 0x%08lx\n", + PartitionPath, PartitionHandle, Status); } - /* Close the partition */ - NtClose(PartitionHandle); + if (PartitionPath) + { + /* Close the partition */ + NtClose(PartitionHandle); + } return Status; } NTSTATUS GetFileSystemName( - IN PCWSTR Partition, + IN PCWSTR PartitionPath OPTIONAL, + IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize) { - UNICODE_STRING PartitionPath; + UNICODE_STRING PartitionPathU; + + if (PartitionPath && PartitionHandle) + return STATUS_INVALID_PARAMETER; + + if (PartitionPath) + RtlInitUnicodeString(&PartitionPathU, PartitionPath); - RtlInitUnicodeString(&PartitionPath, Partition); - return GetFileSystemName_UStr(&PartitionPath, + return GetFileSystemName_UStr(PartitionPath ? &PartitionPathU : NULL, + PartitionPath ? NULL : PartitionHandle, FileSystemName, FileSystemNameSize); } +static inline NTSTATUS -InferFileSystemByHandle( +InferFileSystemWorker( IN HANDLE PartitionHandle, - IN UCHAR PartitionType, + OUT PIO_STATUS_BLOCK IoStatusBlock, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize) { - NTSTATUS Status; + NTSTATUS Status, Status2; + union + { + PARTITION_INFORMATION_EX InfoEx; + PARTITION_INFORMATION Info; + } PartInfo; + UCHAR PartitionType; if (FileSystemNameSize < sizeof(WCHAR)) return STATUS_BUFFER_TOO_SMALL; @@ -122,25 +151,81 @@ InferFileSystemByHandle( *FileSystemName = L'\0'; /* Try to infer a file system using NT file system recognition */ - Status = GetFileSystemNameByHandle(PartitionHandle, - FileSystemName, - FileSystemNameSize); + Status = GetFileSystemName_UStr(NULL, PartitionHandle, + FileSystemName, + FileSystemNameSize); if (NT_SUCCESS(Status) && *FileSystemName) - { goto Quit; + + /* + * Check whether the partition is MBR, and if so, retrieve its MBR + * partition type and try to infer a preferred file system for it. + */ + + // NOTE: Use Status2 in order not to clobber the original Status. + Status2 = NtDeviceIoControlFile(PartitionHandle, + NULL, + NULL, + NULL, + IoStatusBlock, + IOCTL_DISK_GET_PARTITION_INFO_EX, + NULL, + 0, + &PartInfo.InfoEx, + sizeof(PartInfo.InfoEx)); + if (!NT_SUCCESS(Status2)) + { + DPRINT1("IOCTL_DISK_GET_PARTITION_INFO_EX failed (Status %lx)\n", Status2); + + if (Status2 != STATUS_INVALID_DEVICE_REQUEST) + goto Quit; + + /* + * We could have failed because the partition is on a dynamic + * MBR or GPT data disk, so retry with the non-EX IOCTL. + */ + Status2 = NtDeviceIoControlFile(PartitionHandle, + NULL, + NULL, + NULL, + IoStatusBlock, + IOCTL_DISK_GET_PARTITION_INFO, + NULL, + 0, + &PartInfo.Info, + sizeof(PartInfo.Info)); + if (!NT_SUCCESS(Status2)) + { + /* We failed again, bail out */ + DPRINT1("IOCTL_DISK_GET_PARTITION_INFO failed (Status %lx)\n", Status2); + goto Quit; + } + + /* The partition is supposed to be on an MBR disk; retrieve its type */ + PartitionType = PartInfo.Info.PartitionType; + } + else + { + /* We succeeded; retrieve the partition type only if it is on an MBR disk */ + if (PartInfo.InfoEx.PartitionStyle != PARTITION_STYLE_MBR) + { + /* Disk is not MBR, bail out */ + goto Quit; + } + PartitionType = PartInfo.InfoEx.Mbr.PartitionType; } /* - * Try to infer a preferred file system for this partition, given its ID. + * Given an MBR partition type, try to infer a preferred file system. * - * WARNING: This is partly a hack, since partitions with the same ID can - * be formatted with different file systems: for example, usual Linux + * WARNING: This is partly a hack, since partitions with the same type + * can be formatted with different file systems: for example, usual Linux * partitions that are formatted in EXT2/3/4, ReiserFS, etc... have the - * same partition ID 0x83. + * same partition type 0x83. * * The proper fix is to make a function that detects the existing FS - * from a given partition (not based on the partition ID). - * On the contrary, for unformatted partitions with a given ID, the + * from a given partition (not based on the partition type). + * On the contrary, for unformatted partitions with a given type, the * following code is OK. */ if ((PartitionType == PARTITION_FAT_12) || @@ -170,93 +255,110 @@ InferFileSystemByHandle( } Quit: - if (*FileSystemName) + if (*FileSystemName && wcsicmp(FileSystemName, L"NTFS") == 0) { // WARNING: We cannot write on this FS yet! - if (PartitionType == PARTITION_IFS) - { - DPRINT1("Recognized file system '%S' that doesn't have write support yet!\n", - FileSystemName); - } + DPRINT1("Recognized file system '%S' that doesn't have write support yet!\n", + FileSystemName); } - DPRINT1("InferFileSystem -- PartitionType: 0x%02X ; FileSystem (guessed): %S\n", - PartitionType, *FileSystemName ? FileSystemName : L"None"); - return Status; } NTSTATUS InferFileSystem( - IN PCWSTR Partition, - IN UCHAR PartitionType, + IN PCWSTR PartitionPath OPTIONAL, + IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize) { NTSTATUS Status; - UNICODE_STRING PartitionPath; + UNICODE_STRING PartitionPathU; OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE PartitionHandle; IO_STATUS_BLOCK IoStatusBlock; - /* Open the partition */ - RtlInitUnicodeString(&PartitionPath, Partition); - InitializeObjectAttributes(&ObjectAttributes, - &PartitionPath, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = NtOpenFile(&PartitionHandle, - FILE_GENERIC_READ /* | SYNCHRONIZE */, - &ObjectAttributes, - &IoStatusBlock, - FILE_SHARE_READ | FILE_SHARE_WRITE, - 0 /* FILE_SYNCHRONOUS_IO_NONALERT */); - if (!NT_SUCCESS(Status)) + if (PartitionPath && PartitionHandle) + return STATUS_INVALID_PARAMETER; + + /* Open the partition if a path has been given; + * otherwise just use the provided handle. */ + if (PartitionPath) { - DPRINT1("Failed to open partition '%wZ', Status 0x%08lx\n", &PartitionPath, Status); - return Status; + RtlInitUnicodeString(&PartitionPathU, PartitionPath); + InitializeObjectAttributes(&ObjectAttributes, + &PartitionPathU, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenFile(&PartitionHandle, + FILE_GENERIC_READ /* | SYNCHRONIZE */, + &ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE, + 0 /* FILE_SYNCHRONOUS_IO_NONALERT */); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to open partition '%S', Status 0x%08lx\n", + PartitionPath, Status); + return Status; + } } /* Retrieve the FS */ - Status = InferFileSystemByHandle(PartitionHandle, - PartitionType, - FileSystemName, - FileSystemNameSize); + Status = InferFileSystemWorker(PartitionHandle, + &IoStatusBlock, + FileSystemName, + FileSystemNameSize); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InferFileSystem() failed for partition '%S' (0x%p), Status 0x%08lx\n", + PartitionPath, PartitionHandle, Status); + } + else + { + DPRINT1("InferFileSystem(): FileSystem (guessed): %S\n", + *FileSystemName ? FileSystemName : L"None"); + } - /* Close the partition */ - NtClose(PartitionHandle); + if (PartitionPath) + { + /* Close the partition */ + NtClose(PartitionHandle); + } return Status; } UCHAR -FileSystemToPartitionType( +FileSystemToMBRPartitionType( IN PCWSTR FileSystem, - IN PULARGE_INTEGER StartSector, - IN PULARGE_INTEGER SectorCount) + IN ULONGLONG StartSector, + IN ULONGLONG SectorCount) { - ASSERT(FileSystem && StartSector && SectorCount); + ASSERT(FileSystem); + + if (SectorCount == 0) + return PARTITION_ENTRY_UNUSED; if (wcsicmp(FileSystem, L"FAT") == 0 || wcsicmp(FileSystem, L"FAT32") == 0 || wcsicmp(FileSystem, L"RAW") == 0) { - if (SectorCount->QuadPart < 8192) + if (SectorCount < 8192ULL) { /* FAT12 CHS partition (disk is smaller than 4.1MB) */ return PARTITION_FAT_12; } - else if (StartSector->QuadPart < 1450560) + else if (StartSector < 1450560ULL) { /* Partition starts below the 8.4GB boundary ==> CHS partition */ - if (SectorCount->QuadPart < 65536) + if (SectorCount < 65536ULL) { /* FAT16 CHS partition (partition size < 32MB) */ return PARTITION_FAT_16; } - else if (SectorCount->QuadPart < 1048576) + else if (SectorCount < 1048576ULL) { /* FAT16 CHS partition (partition size < 512MB) */ return PARTITION_HUGE; @@ -271,7 +373,7 @@ FileSystemToPartitionType( { /* Partition starts above the 8.4GB boundary ==> LBA partition */ - if (SectorCount->QuadPart < 1048576) + if (SectorCount < 1048576ULL) { /* FAT16 LBA partition (partition size < 512MB) */ return PARTITION_XINT13; diff --git a/base/setup/lib/utils/fsrec.h b/base/setup/lib/utils/fsrec.h index 197cdd6e9f6..47f770691d5 100644 --- a/base/setup/lib/utils/fsrec.h +++ b/base/setup/lib/utils/fsrec.h @@ -8,42 +8,31 @@ #pragma once -NTSTATUS -GetFileSystemNameByHandle( - IN HANDLE PartitionHandle, - IN OUT PWSTR FileSystemName, - IN SIZE_T FileSystemNameSize); - NTSTATUS GetFileSystemName_UStr( - IN PUNICODE_STRING PartitionPath, + IN PUNICODE_STRING PartitionPath OPTIONAL, + IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize); NTSTATUS GetFileSystemName( - IN PCWSTR Partition, - IN OUT PWSTR FileSystemName, - IN SIZE_T FileSystemNameSize); - -NTSTATUS -InferFileSystemByHandle( - IN HANDLE PartitionHandle, - IN UCHAR PartitionType, + IN PCWSTR PartitionPath OPTIONAL, + IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize); NTSTATUS InferFileSystem( - IN PCWSTR Partition, - IN UCHAR PartitionType, + IN PCWSTR PartitionPath OPTIONAL, + IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize); UCHAR -FileSystemToPartitionType( +FileSystemToMBRPartitionType( IN PCWSTR FileSystem, - IN PULARGE_INTEGER StartSector, - IN PULARGE_INTEGER SectorCount); + IN ULONGLONG StartSector, + IN ULONGLONG SectorCount); /* EOF */ diff --git a/base/setup/lib/utils/partlist.c b/base/setup/lib/utils/partlist.c index 3837a83e255..6682f0a36a8 100644 --- a/base/setup/lib/utils/partlist.c +++ b/base/setup/lib/utils/partlist.c @@ -906,7 +906,10 @@ InitializePartitionEntry( PartEntry->New = TRUE; PartEntry->IsPartitioned = TRUE; - PartEntry->PartitionType = FileSystemToPartitionType(L"RAW", &PartEntry->StartSector, &PartEntry->SectorCount); +// FIXME: Use FileSystemToMBRPartitionType() only for MBR, otherwise use PARTITION_BASIC_DATA_GUID. + PartEntry->PartitionType = FileSystemToMBRPartitionType(L"RAW", + PartEntry->StartSector.QuadPart, + PartEntry->SectorCount.QuadPart); ASSERT(PartEntry->PartitionType != PARTITION_ENTRY_UNUSED); PartEntry->FormatState = Unformatted; @@ -1018,12 +1021,11 @@ AddPartitionToDisk( ASSERT(NT_SUCCESS(Status)); /* We don't have a FS, try to guess one */ - Status = InferFileSystemByHandle(PartitionHandle, - PartEntry->PartitionType, - PartEntry->FileSystem, - sizeof(PartEntry->FileSystem)); + Status = InferFileSystem(NULL, PartitionHandle, + PartEntry->FileSystem, + sizeof(PartEntry->FileSystem)); if (!NT_SUCCESS(Status)) - DPRINT1("InferFileSystemByHandle() failed, Status 0x%08lx\n", Status); + DPRINT1("InferFileSystem() failed, Status 0x%08lx\n", Status); } if (*PartEntry->FileSystem) { @@ -4105,12 +4107,14 @@ SetMountedDeviceValues( } VOID -SetPartitionType( +SetMBRPartitionType( IN PPARTENTRY PartEntry, IN UCHAR PartitionType) { PDISKENTRY DiskEntry = PartEntry->DiskEntry; + ASSERT(DiskEntry->DiskStyle == PARTITION_STYLE_MBR); + PartEntry->PartitionType = PartitionType; DiskEntry->Dirty = TRUE; diff --git a/base/setup/lib/utils/partlist.h b/base/setup/lib/utils/partlist.h index fb548b0e2ed..4dd108ba15c 100644 --- a/base/setup/lib/utils/partlist.h +++ b/base/setup/lib/utils/partlist.h @@ -349,7 +349,7 @@ SetMountedDeviceValues( IN PPARTLIST List); VOID -SetPartitionType( +SetMBRPartitionType( IN PPARTENTRY PartEntry, IN UCHAR PartitionType);
1
0
0
0
[reactos] 01/01: [FSLIB][FMIFS][AUTOCHK][SETUPLIB] Use more Windows-compatible (but not fully compatible yet) Format() and Chkdsk() ULIB functions.
by Hermès Bélusca-Maïto
22 Nov '20
22 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8d3e80e43725828f00533…
commit 8d3e80e43725828f0053347536f1df28ad089b7f Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Nov 22 05:35:37 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Nov 22 21:57:07 2020 +0100 [FSLIB][FMIFS][AUTOCHK][SETUPLIB] Use more Windows-compatible (but not fully compatible yet) Format() and Chkdsk() ULIB functions. [AUTOCHK] Add also support for scanning FATX volumes. The Format(), FormatEx(), Chkdsk(), ChkdskEx() functions exposed by the U*.DLL user-mode FS library dlls are different (and have different prototypes) than the similarly-named functions exported by FMIFS.DLL . In particular, what we used to call "xxxChkdskEx()" and "xxxFormatEx()" in our U*.DLL libraries actually correspond more, from their arguments, to the "Chkdsk()" and "Format()" functions in Windows' U*.DLL . Their *Ex() counterparts instead take most of the parameters through a structure passed by pointer. On FMIFS.DLL side, while FMIFS!Chkdsk() calls U*.DLL!Chkdsk() and FMIFS!ChkdskEx() calls U*.DLL!ChkdskEx() (and we do not implement these *Ex() functions at the moment), both FMIFS!Format() and FMIFS!FormatEx() call U*.DLL!Format() instead, while FMIFS!FormatEx2() calls U*.DLL!FormatEx() (that we do not implement yet either) !! To improve that, refactor the calls to these U*.DLL functions so as to respect the more compatible prototypes: They contain the correct number of parameters in a compatible order. However, some of the parameters do not have the same types yet: the strings are kept here in PUNICODE_STRINGS, while on Windows they are passed via an undocumented DSTRING struct, and the FMIFS callback is instead a MESSAGE struct/class on Windows. Finally, the MEDIA_TYPE parameter in U*.DLL!Format() is equivalent, yet not fully 100% in 1-to-1 correspondence, with the FMIFS_MEDIA_FLAG used in the corresponding FMIFS.DLL functions. One thing to notice is that the U*.DLL!Format() (and the Ex) functions support a BOOLEAN (a flag resp.) for telling that a backwards-compatible FS version should be used instead of the (default) latest FS version. This is used e.g. by the FAT FS, where by default FAT32 is selected (depending also on other constraints like, the disk and the partition sizes), unless that bit is set in which case, FAT16 (or 12) is used. --- base/setup/lib/fsutil.c | 90 +++++++++++++++++++++------- base/setup/lib/fsutil.h | 2 +- base/setup/usetup/format.c | 15 +++-- base/system/autochk/CMakeLists.txt | 2 +- base/system/autochk/autochk.c | 55 ++++++++++------- dll/win32/fmifs/chkdsk.c | 36 +++++++---- dll/win32/fmifs/format.c | 62 +++++++++++++++---- dll/win32/fmifs/init.c | 8 ++- dll/win32/fmifs/precomp.h | 6 +- dll/win32/ubtrfs/ubtrfs.spec | 4 +- dll/win32/ucdfs/ucdfs.spec | 4 +- dll/win32/uext2/uext2.spec | 4 +- dll/win32/ufat/ufat.spec | 4 +- dll/win32/ufatx/ufatx.spec | 4 +- dll/win32/uffs/uffs.spec | 4 +- dll/win32/untfs/untfs.spec | 4 +- dll/win32/ureiserfs/ureiserfs.spec | 4 +- sdk/include/reactos/libs/fmifs/fmifs.h | 37 ++++++++---- sdk/include/reactos/libs/fslib/btrfslib.h | 43 +++++++------ sdk/include/reactos/libs/fslib/cdfslib.h | 39 +++++++----- sdk/include/reactos/libs/fslib/ext2lib.h | 39 +++++++----- sdk/include/reactos/libs/fslib/ffslib.h | 39 +++++++----- sdk/include/reactos/libs/fslib/ntfslib.h | 39 +++++++----- sdk/include/reactos/libs/fslib/reiserfslib.h | 39 +++++++----- sdk/include/reactos/libs/fslib/vfatlib.h | 39 +++++++----- sdk/include/reactos/libs/fslib/vfatxlib.h | 35 ++++++++--- sdk/lib/fslib/btrfslib/btrfslib.c | 70 ++++++++++++++++++---- sdk/lib/fslib/cdfslib/cdfslib.c | 43 ++++++++----- sdk/lib/fslib/ext2lib/Mke2fs.c | 56 +++++++++-------- sdk/lib/fslib/ffslib/ffslib.c | 49 +++++++++------ sdk/lib/fslib/ffslib/ffslib.h | 8 --- sdk/lib/fslib/ntfslib/ntfslib.c | 49 +++++++++------ sdk/lib/fslib/ntfslib/ntfslib.h | 8 --- sdk/lib/fslib/reiserfslib/reiserfslib.c | 49 +++++++++------ sdk/lib/fslib/reiserfslib/reiserfslib.h | 8 --- sdk/lib/fslib/vfatlib/vfatlib.c | 84 +++++++++++++++----------- sdk/lib/fslib/vfatxlib/vfatxlib.c | 73 ++++++++++++---------- 37 files changed, 741 insertions(+), 413 deletions(-) diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c index fec1aa7283a..3d49be888d7 100644 --- a/base/setup/lib/fsutil.c +++ b/base/setup/lib/fsutil.c @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS Setup Library * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) - * PURPOSE: Filesystem support functions + * PURPOSE: Filesystem Format and ChkDsk support functions. * COPYRIGHT: Copyright 2003-2019 Casper S. Hornstrup (chorns(a)users.sourceforge.net) * Copyright 2017-2020 Hermes Belusca-Maito */ @@ -122,8 +122,8 @@ C_ASSERT(sizeof(BTRFS_BOOTSECTOR) == BTRFS_BOOTSECTOR_SIZE); typedef struct _FILE_SYSTEM { PCWSTR FileSystemName; - FORMATEX FormatFunc; - CHKDSKEX ChkdskFunc; + PULIB_FORMAT FormatFunc; + PULIB_CHKDSK ChkdskFunc; } FILE_SYSTEM, *PFILE_SYSTEM; /* The list of file systems on which we can install ReactOS */ @@ -137,7 +137,7 @@ static FILE_SYSTEM RegisteredFileSystems[] = { L"FATX" , VfatxFormat, VfatxChkdsk }, { L"NTFS" , NtfsFormat, NtfsChkdsk }, #endif - { L"BTRFS", BtrfsFormatEx, BtrfsChkdskEx }, + { L"BTRFS", BtrfsFormat, BtrfsChkdsk }, #if 0 { L"EXT2" , Ext2Format, Ext2Chkdsk }, { L"EXT3" , Ext2Format, Ext2Chkdsk }, @@ -224,22 +224,36 @@ ChkdskFileSystem_UStr( IN PFMIFSCALLBACK Callback) { PFILE_SYSTEM FileSystem; + NTSTATUS Status; + BOOLEAN Success; FileSystem = GetFileSystemByName(FileSystemName); if (!FileSystem || !FileSystem->ChkdskFunc) { - // BOOLEAN Argument = FALSE; - // Callback(DONE, 0, &Argument); + // Success = FALSE; + // Callback(DONE, 0, &Success); return STATUS_NOT_SUPPORTED; } - return FileSystem->ChkdskFunc(DriveRoot, - FixErrors, - Verbose, - CheckOnlyIfDirty, - ScanDrive, - Callback); + Status = STATUS_SUCCESS; + Success = FileSystem->ChkdskFunc(DriveRoot, + Callback, + FixErrors, + Verbose, + CheckOnlyIfDirty, + ScanDrive, + NULL, + NULL, + NULL, + NULL, + (PULONG)&Status); + if (!Success) + DPRINT1("ChkdskFunc() failed with Status 0x%lx\n", Status); + + // Callback(DONE, 0, &Success); + + return Status; } NTSTATUS @@ -277,22 +291,58 @@ FormatFileSystem_UStr( IN PFMIFSCALLBACK Callback) { PFILE_SYSTEM FileSystem; + BOOLEAN Success; + BOOLEAN BackwardCompatible = FALSE; // Default to latest FS versions. + MEDIA_TYPE MediaType; FileSystem = GetFileSystemByName(FileSystemName); if (!FileSystem || !FileSystem->FormatFunc) { - // BOOLEAN Argument = FALSE; - // Callback(DONE, 0, &Argument); + // Success = FALSE; + // Callback(DONE, 0, &Success); return STATUS_NOT_SUPPORTED; } - return FileSystem->FormatFunc(DriveRoot, - MediaFlag, - Label, - QuickFormat, - ClusterSize, - Callback); + /* Set the BackwardCompatible flag in case we format with older FAT12/16 */ + if (wcsicmp(FileSystemName, L"FAT") == 0) + BackwardCompatible = TRUE; + // else if (wcsicmp(FileSystemName, L"FAT32") == 0) + // BackwardCompatible = FALSE; + + /* Convert the FMIFS MediaFlag to a NT MediaType */ + // FIXME: Actually covert all the possible flags. + switch (MediaFlag) + { + case FMIFS_FLOPPY: + MediaType = F5_320_1024; // FIXME: This is hardfixed! + break; + case FMIFS_REMOVABLE: + MediaType = RemovableMedia; + break; + case FMIFS_HARDDISK: + MediaType = FixedMedia; + break; + default: + DPRINT1("Unknown FMIFS MediaFlag %d, converting 1-to-1 to NT MediaType\n", + MediaFlag); + MediaType = (MEDIA_TYPE)MediaFlag; + break; + } + + Success = FileSystem->FormatFunc(DriveRoot, + Callback, + QuickFormat, + BackwardCompatible, + MediaType, + Label, + ClusterSize); + if (!Success) + DPRINT1("FormatFunc() failed\n"); + + // Callback(DONE, 0, &Success); + + return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); } NTSTATUS diff --git a/base/setup/lib/fsutil.h b/base/setup/lib/fsutil.h index ef5e6a3ccd8..7696be6dec8 100644 --- a/base/setup/lib/fsutil.h +++ b/base/setup/lib/fsutil.h @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS Setup Library * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) - * PURPOSE: Filesystem support functions + * PURPOSE: Filesystem Format and ChkDsk support functions. * COPYRIGHT: Copyright 2003-2019 Casper S. Hornstrup (chorns(a)users.sourceforge.net) * Copyright 2017-2020 Hermes Belusca-Maito */ diff --git a/base/setup/usetup/format.c b/base/setup/usetup/format.c index 08e029ce543..4abb464ba3e 100644 --- a/base/setup/usetup/format.c +++ b/base/setup/usetup/format.c @@ -55,24 +55,27 @@ FormatCallback( break; } - /*case OUTPUT: +#if 0 + case OUTPUT: { PTEXTOUTPUT Output; output = (PTEXTOUTPUT) Argument; DPRINT("%s\n", output->Output); break; - }*/ + } +#endif case DONE: { - /*PBOOLEAN Success;*/ + // PBOOLEAN Success; DPRINT("Done\n"); - - /*Success = (PBOOLEAN)Argument; +#if 0 + Success = (PBOOLEAN)Argument; if (*Success == FALSE) { DPRINT("FormatEx was unable to complete successfully.\n\n"); - }*/ + } +#endif break; } diff --git a/base/system/autochk/CMakeLists.txt b/base/system/autochk/CMakeLists.txt index e7a9fb1f388..d2c03339285 100644 --- a/base/system/autochk/CMakeLists.txt +++ b/base/system/autochk/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(autochk WIN32 autochk.c autochk.rc) set_module_type(autochk nativecui) -target_link_libraries(autochk nt ext2lib vfatlib ntfslib cdfslib ffslib reiserfslib btrfslib) +target_link_libraries(autochk nt vfatlib vfatxlib ntfslib btrfslib ext2lib ffslib reiserfslib cdfslib) add_importlibs(autochk ntdll) add_cd_file(TARGET autochk DESTINATION reactos/system32 FOR all) diff --git a/base/system/autochk/autochk.c b/base/system/autochk/autochk.c index 72b010f8d85..33d3593d776 100644 --- a/base/system/autochk/autochk.c +++ b/base/system/autochk/autochk.c @@ -27,11 +27,12 @@ #include <fmifs/fmifs.h> #include <fslib/vfatlib.h> +#include <fslib/vfatxlib.h> #include <fslib/ntfslib.h> -#include <fslib/ext2lib.h> #include <fslib/btrfslib.h> -#include <fslib/reiserfslib.h> +#include <fslib/ext2lib.h> #include <fslib/ffslib.h> +#include <fslib/reiserfslib.h> #include <fslib/cdfslib.h> #define NDEBUG @@ -42,20 +43,21 @@ typedef struct _FILESYSTEM_CHKDSK { WCHAR Name[10]; - CHKDSKEX ChkdskFunc; + PULIB_CHKDSK ChkdskFunc; } FILESYSTEM_CHKDSK, *PFILESYSTEM_CHKDSK; -FILESYSTEM_CHKDSK FileSystems[10] = +FILESYSTEM_CHKDSK FileSystems[] = { { L"FAT", VfatChkdsk }, { L"FAT32", VfatChkdsk }, + { L"FATX" , VfatxChkdsk }, { L"NTFS", NtfsChkdsk }, + { L"BTRFS", BtrfsChkdsk }, { L"EXT2", Ext2Chkdsk }, { L"EXT3", Ext2Chkdsk }, { L"EXT4", Ext2Chkdsk }, - { L"Btrfs", BtrfsChkdskEx }, - { L"RFSD", ReiserfsChkdsk }, { L"FFS", FfsChkdsk }, + { L"RFSD", ReiserfsChkdsk }, { L"CDFS", CdfsChkdsk }, }; @@ -379,7 +381,7 @@ ChkdskCallback( case DONE: Status = (PBOOLEAN)Argument; - if (*Status != FALSE) + if (*Status == FALSE) { PrintString("The file system check was unable to complete successfully.\r\n\r\n"); // Error = TRUE; @@ -396,6 +398,7 @@ CheckVolume( IN BOOLEAN CheckOnlyIfDirty) { NTSTATUS Status; + BOOLEAN Success; PCWSTR DisplayName; UNICODE_STRING VolumePathU; ULONG Count; @@ -450,15 +453,21 @@ CheckVolume( } /* Check whether the volume is dirty */ - Status = FileSystems[Count].ChkdskFunc(&VolumePathU, - FALSE, // FixErrors - TRUE, // Verbose - TRUE, // CheckOnlyIfDirty - FALSE, // ScanDrive - ChkdskCallback); + Status = STATUS_SUCCESS; + Success = FileSystems[Count].ChkdskFunc(&VolumePathU, + ChkdskCallback, + FALSE, // FixErrors + TRUE, // Verbose + TRUE, // CheckOnlyIfDirty + FALSE, // ScanDrive + NULL, + NULL, + NULL, + NULL, + (PULONG)&Status); /* Perform the check either when the volume is dirty or a check is forced */ - if ((Status == STATUS_DISK_CORRUPT_ERROR) || !CheckOnlyIfDirty) + if (Success && ((Status == STATUS_DISK_CORRUPT_ERROR) || !CheckOnlyIfDirty)) { /* Let the user decide whether to repair */ if (Status == STATUS_DISK_CORRUPT_ERROR) @@ -474,12 +483,18 @@ CheckVolume( if (!KeyboardHandle || WaitForKeyboard(KeyboardHandle, TimeOut) == STATUS_TIMEOUT) { PrintString("The system will now check the file system.\r\n\r\n"); - Status = FileSystems[Count].ChkdskFunc(&VolumePathU, - TRUE, // FixErrors - TRUE, // Verbose - CheckOnlyIfDirty, - FALSE, // ScanDrive - ChkdskCallback); + Status = STATUS_SUCCESS; + Success = FileSystems[Count].ChkdskFunc(&VolumePathU, + ChkdskCallback, + TRUE, // FixErrors + TRUE, // Verbose + CheckOnlyIfDirty, + FALSE, // ScanDrive + NULL, + NULL, + NULL, + NULL, + (PULONG)&Status); } else { diff --git a/dll/win32/fmifs/chkdsk.c b/dll/win32/fmifs/chkdsk.c index ba6839ff181..c3be682eeea 100644 --- a/dll/win32/fmifs/chkdsk.c +++ b/dll/win32/fmifs/chkdsk.c @@ -28,7 +28,8 @@ Chkdsk( { PIFS_PROVIDER Provider; UNICODE_STRING usDriveRoot; - BOOLEAN Argument = FALSE; + NTSTATUS Status; + BOOLEAN Success = FALSE; WCHAR VolumeName[MAX_PATH]; //CURDIR CurDir; @@ -36,7 +37,7 @@ Chkdsk( if (!Provider) { /* Unknown file system */ - Callback(DONE, 0, &Argument); + Callback(DONE, 0, &Success); return; } @@ -46,22 +47,33 @@ Chkdsk( RtlCreateUnicodeString(&usDriveRoot, VolumeName); /* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */ #else - if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH) || + if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, RTL_NUMBER_OF(VolumeName)) || !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir)) { - /* Report an error. */ - Callback(DONE, 0, &Argument); + /* Report an error */ + Callback(DONE, 0, &Success); return; } #endif - DPRINT("ChkdskEx - %S\n", Format); - Provider->ChkdskEx(&usDriveRoot, - CorrectErrors, - Verbose, - CheckOnlyIfDirty, - ScanDrive, - Callback); + DPRINT("Chkdsk() - %S\n", Format); + Status = STATUS_SUCCESS; + Success = Provider->Chkdsk(&usDriveRoot, + Callback, + CorrectErrors, + Verbose, + CheckOnlyIfDirty, + ScanDrive, + NULL, + NULL, + NULL, + NULL, + (PULONG)&Status); + if (!Success) + DPRINT1("Chkdsk() failed with Status 0x%lx\n", Status); + + /* Report success */ + Callback(DONE, 0, &Success); RtlFreeUnicodeString(&usDriveRoot); } diff --git a/dll/win32/fmifs/format.c b/dll/win32/fmifs/format.c index 266002e08a3..82fa203b1e4 100644 --- a/dll/win32/fmifs/format.c +++ b/dll/win32/fmifs/format.c @@ -47,15 +47,21 @@ FormatEx( PIFS_PROVIDER Provider; UNICODE_STRING usDriveRoot; UNICODE_STRING usLabel; - BOOLEAN Argument = FALSE; + BOOLEAN Success = FALSE; + BOOLEAN BackwardCompatible = FALSE; // Default to latest FS versions. + MEDIA_TYPE MediaType; WCHAR VolumeName[MAX_PATH]; //CURDIR CurDir; +// +// TODO: Convert filesystem Format into ULIB format string. +// + Provider = GetProvider(Format); if (!Provider) { /* Unknown file system */ - Callback(DONE, 0, &Argument); + Callback(DONE, 0, &Success); return; } @@ -65,24 +71,56 @@ FormatEx( RtlCreateUnicodeString(&usDriveRoot, VolumeName); /* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */ #else - if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH) || + if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, RTL_NUMBER_OF(VolumeName)) || !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir)) { - /* Report an error. */ - Callback(DONE, 0, &Argument); + /* Report an error */ + Callback(DONE, 0, &Success); return; } #endif RtlInitUnicodeString(&usLabel, Label); - DPRINT("FormatEx - %S\n", Format); - Provider->FormatEx(&usDriveRoot, - MediaFlag, - &usLabel, - QuickFormat, - ClusterSize, - Callback); + /* Set the BackwardCompatible flag in case we format with older FAT12/16 */ + if (wcsicmp(Format, L"FAT") == 0) + BackwardCompatible = TRUE; + // else if (wcsicmp(Format, L"FAT32") == 0) + // BackwardCompatible = FALSE; + + /* Convert the FMIFS MediaFlag to a NT MediaType */ + // FIXME: Actually covert all the possible flags. + switch (MediaFlag) + { + case FMIFS_FLOPPY: + MediaType = F5_320_1024; // FIXME: This is hardfixed! + break; + case FMIFS_REMOVABLE: + MediaType = RemovableMedia; + break; + case FMIFS_HARDDISK: + MediaType = FixedMedia; + break; + default: + DPRINT1("Unknown FMIFS MediaFlag %d, converting 1-to-1 to NT MediaType\n", + MediaFlag); + MediaType = (MEDIA_TYPE)MediaFlag; + break; + } + + DPRINT("Format() - %S\n", Format); + Success = Provider->Format(&usDriveRoot, + Callback, + QuickFormat, + BackwardCompatible, + MediaType, + &usLabel, + ClusterSize); + if (!Success) + DPRINT1("Format() failed\n"); + + /* Report success */ + Callback(DONE, 0, &Success); RtlFreeUnicodeString(&usDriveRoot); } diff --git a/dll/win32/fmifs/init.c b/dll/win32/fmifs/init.c index e895f5ef9ca..b03e83a6775 100644 --- a/dll/win32/fmifs/init.c +++ b/dll/win32/fmifs/init.c @@ -66,9 +66,11 @@ AddProvider( RtlZeroMemory(Provider, RequiredSize); /* Get function pointers */ - Provider->ChkdskEx = (CHKDSKEX)GetProcAddress(hMod, "ChkdskEx"); - //Provider->Extend = (EXTEND)GetProcAddress(hMod, "Extend"); - Provider->FormatEx = (FORMATEX)GetProcAddress(hMod, "FormatEx"); + Provider->Chkdsk = (PULIB_CHKDSK)GetProcAddress(hMod, "Chkdsk"); + //Provider->ChkdskEx = (PULIB_CHKDSKEX)GetProcAddress(hMod, "ChkdskEx"); + //Provider->Extend = (PULIB_EXTEND)GetProcAddress(hMod, "Extend"); + Provider->Format = (PULIB_FORMAT)GetProcAddress(hMod, "Format"); + //Provider->FormatEx = (PULIB_FORMATEX)GetProcAddress(hMod, "FormatEx"); RtlCopyMemory(Provider->Name, FileSystem->Buffer, FileSystem->Length); diff --git a/dll/win32/fmifs/precomp.h b/dll/win32/fmifs/precomp.h index 0d2218f47f8..1a31415b696 100644 --- a/dll/win32/fmifs/precomp.h +++ b/dll/win32/fmifs/precomp.h @@ -33,9 +33,11 @@ typedef struct _IFS_PROVIDER { LIST_ENTRY ListEntry; - CHKDSKEX ChkdskEx; + PULIB_CHKDSK Chkdsk; + PVOID ChkdskEx; PVOID Extend; - FORMATEX FormatEx; + PULIB_FORMAT Format; + PVOID FormatEx; WCHAR Name[1]; } IFS_PROVIDER, *PIFS_PROVIDER; diff --git a/dll/win32/ubtrfs/ubtrfs.spec b/dll/win32/ubtrfs/ubtrfs.spec index b797157b4c2..ddf1db7f8e6 100644 --- a/dll/win32/ubtrfs/ubtrfs.spec +++ b/dll/win32/ubtrfs/ubtrfs.spec @@ -1,5 +1,5 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) BtrfsChkdskEx -@ stdcall FormatEx(ptr long ptr long long ptr) BtrfsFormatEx +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) BtrfsChkdsk +@ stdcall Format(ptr ptr long long long ptr long) BtrfsFormat @ stdcall GetFilesystemInformation(long long ptr) @ stdcall SetIncompatFlags(int64) diff --git a/dll/win32/ucdfs/ucdfs.spec b/dll/win32/ucdfs/ucdfs.spec index 5ad590f9a7c..b425670db98 100644 --- a/dll/win32/ucdfs/ucdfs.spec +++ b/dll/win32/ucdfs/ucdfs.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) CdfsChkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) CdfsFormat +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) CdfsChkdsk +@ stdcall Format(ptr ptr long long long ptr long) CdfsFormat diff --git a/dll/win32/uext2/uext2.spec b/dll/win32/uext2/uext2.spec index fb2d99b0981..cd8682132e5 100644 --- a/dll/win32/uext2/uext2.spec +++ b/dll/win32/uext2/uext2.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) Ext2Chkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) Ext2Format +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) Ext2Chkdsk +@ stdcall Format(ptr ptr long long long ptr long) Ext2Format diff --git a/dll/win32/ufat/ufat.spec b/dll/win32/ufat/ufat.spec index cc7532f0712..19cd54669cf 100644 --- a/dll/win32/ufat/ufat.spec +++ b/dll/win32/ufat/ufat.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) VfatChkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) VfatFormat +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) VfatChkdsk +@ stdcall Format(ptr ptr long long long ptr long) VfatFormat diff --git a/dll/win32/ufatx/ufatx.spec b/dll/win32/ufatx/ufatx.spec index 40ab9e02736..aff06f9c8c6 100644 --- a/dll/win32/ufatx/ufatx.spec +++ b/dll/win32/ufatx/ufatx.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) VfatxChkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) VfatxFormat +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) VfatxChkdsk +@ stdcall Format(ptr ptr long long long ptr long) VfatxFormat diff --git a/dll/win32/uffs/uffs.spec b/dll/win32/uffs/uffs.spec index 8c5627af99a..f06e34356a9 100644 --- a/dll/win32/uffs/uffs.spec +++ b/dll/win32/uffs/uffs.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) FfsChkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) FfsFormat +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) FfsChkdsk +@ stdcall Format(ptr ptr long long long ptr long) FfsFormat diff --git a/dll/win32/untfs/untfs.spec b/dll/win32/untfs/untfs.spec index 29c777772eb..bcdeca48e95 100644 --- a/dll/win32/untfs/untfs.spec +++ b/dll/win32/untfs/untfs.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) NtfsChkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) NtfsFormat +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) NtfsChkdsk +@ stdcall Format(ptr ptr long long long ptr long) NtfsFormat diff --git a/dll/win32/ureiserfs/ureiserfs.spec b/dll/win32/ureiserfs/ureiserfs.spec index 5a86418e1fd..496546ae682 100644 --- a/dll/win32/ureiserfs/ureiserfs.spec +++ b/dll/win32/ureiserfs/ureiserfs.spec @@ -1,2 +1,2 @@ -@ stdcall ChkdskEx(ptr long long long long ptr) ReiserfsChkdsk -@ stdcall FormatEx(ptr long ptr long long ptr) ReiserfsFormat +@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) ReiserfsChkdsk +@ stdcall Format(ptr ptr long long long ptr long) ReiserfsFormat diff --git a/sdk/include/reactos/libs/fmifs/fmifs.h b/sdk/include/reactos/libs/fmifs/fmifs.h index c2c8b80e7cc..482b3b02457 100644 --- a/sdk/include/reactos/libs/fmifs/fmifs.h +++ b/sdk/include/reactos/libs/fmifs/fmifs.h @@ -152,6 +152,9 @@ FormatEx( IN ULONG ClusterSize, IN PFMIFSCALLBACK Callback); +/* FormatEx2 command in FMIFS */ +// FIXME! + BOOLEAN NTAPI QueryAvailableFileSystemFormat( IN DWORD Index, @@ -194,23 +197,33 @@ SetLabel( /* Functions provided by u*.dll */ -typedef NTSTATUS -(NTAPI *FORMATEX)( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); - -typedef NTSTATUS -(NTAPI *CHKDSKEX)( +typedef BOOLEAN +(NTAPI *PULIB_CHKDSK)( IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); + +// FIXME: PULIB_CHKDSKEX of u*.dll works with ChkdskEx() of FMIFS.DLL + +typedef BOOLEAN +(NTAPI *PULIB_FORMAT)( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); + +// FIXME: PULIB_FORMATEX of u*.dll works with FormatEx2() of FMIFS.DLL #ifdef __cplusplus } diff --git a/sdk/include/reactos/libs/fslib/btrfslib.h b/sdk/include/reactos/libs/fslib/btrfslib.h index e97f7ca9cc9..53ec74538d4 100644 --- a/sdk/include/reactos/libs/fslib/btrfslib.h +++ b/sdk/include/reactos/libs/fslib/btrfslib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/btrfslib.h * PURPOSE: Public definitions for BtrFS filesystem library */ + #ifndef __BTRFSLIB_H #define __BTRFSLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI -BtrfsChkdskEx( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); +BOOLEAN +NTAPI +BtrfsChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI -BtrfsFormatEx( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); +BOOLEAN +NTAPI +BtrfsFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__BTRFSLIB_H */ +#endif /* __BTRFSLIB_H */ diff --git a/sdk/include/reactos/libs/fslib/cdfslib.h b/sdk/include/reactos/libs/fslib/cdfslib.h index a49cabf0bbf..60023b65d30 100644 --- a/sdk/include/reactos/libs/fslib/cdfslib.h +++ b/sdk/include/reactos/libs/fslib/cdfslib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/cdfslib.h * PURPOSE: Public definitions for CDFS filesystem library */ + #ifndef __CDFSLIB_H #define __CDFSLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI +BOOLEAN +NTAPI CdfsChkdsk( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI +BOOLEAN +NTAPI CdfsFormat( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__CDFSLIB_H */ +#endif /* __CDFSLIB_H */ diff --git a/sdk/include/reactos/libs/fslib/ext2lib.h b/sdk/include/reactos/libs/fslib/ext2lib.h index 596bbcbf9e8..b368aa3323c 100644 --- a/sdk/include/reactos/libs/fslib/ext2lib.h +++ b/sdk/include/reactos/libs/fslib/ext2lib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/ext2lib.h * PURPOSE: Public definitions for ext2 filesystem library */ + #ifndef __EXT2LIB_H #define __EXT2LIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI +BOOLEAN +NTAPI Ext2Chkdsk( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI +BOOLEAN +NTAPI Ext2Format( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__EXT2LIB_H */ +#endif /* __EXT2LIB_H */ diff --git a/sdk/include/reactos/libs/fslib/ffslib.h b/sdk/include/reactos/libs/fslib/ffslib.h index 31e3f257364..4703c06ee9b 100644 --- a/sdk/include/reactos/libs/fslib/ffslib.h +++ b/sdk/include/reactos/libs/fslib/ffslib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/ffslib.h * PURPOSE: Public definitions for FFS filesystem library */ + #ifndef __FFSLIB_H #define __FFSLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI +BOOLEAN +NTAPI FfsChkdsk( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI +BOOLEAN +NTAPI FfsFormat( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__FFSLIB_H */ +#endif /* __FFSLIB_H */ diff --git a/sdk/include/reactos/libs/fslib/ntfslib.h b/sdk/include/reactos/libs/fslib/ntfslib.h index d4647d4cb05..f1677a40597 100644 --- a/sdk/include/reactos/libs/fslib/ntfslib.h +++ b/sdk/include/reactos/libs/fslib/ntfslib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/ntfslib.h * PURPOSE: Public definitions for NTFS filesystem library */ + #ifndef __NTFSLIB_H #define __NTFSLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI +BOOLEAN +NTAPI NtfsChkdsk( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI +BOOLEAN +NTAPI NtfsFormat( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__NTFSLIB_H */ +#endif /* __NTFSLIB_H */ diff --git a/sdk/include/reactos/libs/fslib/reiserfslib.h b/sdk/include/reactos/libs/fslib/reiserfslib.h index ed7bd2f79a0..519abe0495e 100644 --- a/sdk/include/reactos/libs/fslib/reiserfslib.h +++ b/sdk/include/reactos/libs/fslib/reiserfslib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/reiserfslib.h * PURPOSE: Public definitions for ReiserFS filesystem library */ + #ifndef __REISERFSLIB_H #define __REISERFSLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI +BOOLEAN +NTAPI ReiserfsChkdsk( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI +BOOLEAN +NTAPI ReiserfsFormat( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__REISERFSLIB_H */ +#endif /* __REISERFSLIB_H */ diff --git a/sdk/include/reactos/libs/fslib/vfatlib.h b/sdk/include/reactos/libs/fslib/vfatlib.h index 9e635cd086d..cceebe6e70b 100644 --- a/sdk/include/reactos/libs/fslib/vfatlib.h +++ b/sdk/include/reactos/libs/fslib/vfatlib.h @@ -4,27 +4,36 @@ * FILE: include/reactos/libs/fslib/vfatlib.h * PURPOSE: Public definitions for vfat filesystem library */ + #ifndef __VFATLIB_H #define __VFATLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI +BOOLEAN +NTAPI VfatChkdsk( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); -NTSTATUS NTAPI +BOOLEAN +NTAPI VfatFormat( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__VFATLIB_H */ +#endif /* __VFATLIB_H */ diff --git a/sdk/include/reactos/libs/fslib/vfatxlib.h b/sdk/include/reactos/libs/fslib/vfatxlib.h index 767ec58a2b1..57960c1ae06 100644 --- a/sdk/include/reactos/libs/fslib/vfatxlib.h +++ b/sdk/include/reactos/libs/fslib/vfatxlib.h @@ -4,17 +4,36 @@ * FILE: include/reactos/libs/fslib/vfatxlib.h * PURPOSE: Public definitions for vfat filesystem library */ + #ifndef __VFATXLIB_H #define __VFATXLIB_H #include <fmifs/fmifs.h> -NTSTATUS NTAPI -VfatxFormat (PUNICODE_STRING DriveRoot, - FMIFS_MEDIA_FLAG MediaFlag, - PUNICODE_STRING Label, - BOOLEAN QuickFormat, - ULONG ClusterSize, - PFMIFSCALLBACK Callback); +BOOLEAN +NTAPI +VfatxChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus); + +BOOLEAN +NTAPI +VfatxFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize); -#endif /*__VFATLIB_H */ +#endif /* __VFATXLIB_H */ diff --git a/sdk/lib/fslib/btrfslib/btrfslib.c b/sdk/lib/fslib/btrfslib/btrfslib.c index b5222e57551..d176204b2a2 100644 --- a/sdk/lib/fslib/btrfslib/btrfslib.c +++ b/sdk/lib/fslib/btrfslib/btrfslib.c @@ -181,6 +181,7 @@ ULONG def_sector_size = 0, def_node_size = 0; uint64_t def_incompat_flags = BTRFS_INCOMPAT_FLAGS_EXTENDED_IREF | BTRFS_INCOMPAT_FLAGS_SKINNY_METADATA; uint16_t def_csum_type = CSUM_TYPE_CRC32C; +#ifndef __REACTOS__ // the following definitions come from fmifs.h in ReactOS typedef struct { @@ -237,12 +238,32 @@ typedef enum { typedef BOOLEAN (NTAPI* PFMIFSCALLBACK)(CALLBACKCOMMAND Command, ULONG SubAction, PVOID ActionInfo); +#else + +#include <fmifs/fmifs.h> + +#endif // __REACTOS__ + #ifndef __REACTOS__ NTSTATUS WINAPI ChkdskEx(PUNICODE_STRING DriveRoot, BOOLEAN FixErrors, BOOLEAN Verbose, BOOLEAN CheckOnlyIfDirty, + BOOLEAN ScanDrive, PFMIFSCALLBACK Callback) { #else -NTSTATUS NTAPI BtrfsChkdskEx(PUNICODE_STRING DriveRoot, BOOLEAN FixErrors, BOOLEAN Verbose, BOOLEAN CheckOnlyIfDirty, +BOOLEAN +NTAPI +BtrfsChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) +{ #endif - BOOLEAN ScanDrive, PFMIFSCALLBACK Callback) { // STUB if (Callback) { @@ -254,7 +275,12 @@ NTSTATUS NTAPI BtrfsChkdskEx(PUNICODE_STRING DriveRoot, BOOLEAN FixErrors, BOOLE Callback(OUTPUT, 0, &TextOut); } +#ifndef __REACTOS__ return STATUS_SUCCESS; +#else + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; +#endif } static btrfs_root* add_root(LIST_ENTRY* roots, uint64_t id) { @@ -1316,11 +1342,7 @@ static void check_cpu() { } #endif -#ifndef __REACTOS__ static NTSTATUS NTAPI FormatEx2(PUNICODE_STRING DriveRoot, FMIFS_MEDIA_FLAG MediaFlag, PUNICODE_STRING Label, -#else -NTSTATUS NTAPI BtrfsFormatEx(PUNICODE_STRING DriveRoot, FMIFS_MEDIA_FLAG MediaFlag, PUNICODE_STRING Label, -#endif // __REACTOS__ BOOLEAN QuickFormat, ULONG ClusterSize, PFMIFSCALLBACK Callback) { NTSTATUS Status; @@ -1479,14 +1501,44 @@ end: Status = STATUS_SUCCESS; } +#ifndef __REACTOS__ if (Callback) { bool success = NT_SUCCESS(Status); Callback(DONE, 0, (PVOID)&success); } +#endif return Status; } +#ifdef __REACTOS__ + +BOOLEAN +NTAPI +BtrfsFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) +{ + NTSTATUS Status; + + if (BackwardCompatible) + { + // DPRINT1("BackwardCompatible == TRUE is unsupported!\n"); + return FALSE; + } + + Status = FormatEx2(DriveRoot, (FMIFS_MEDIA_FLAG)MediaType, Label, QuickFormat, ClusterSize, Callback); + + return NT_SUCCESS(Status); +} + +#else + BOOL __stdcall FormatEx(DSTRING* root, STREAM_MESSAGE* message, options* opts, uint32_t unk1) { UNICODE_STRING DriveRoot, Label; NTSTATUS Status; @@ -1505,15 +1557,13 @@ BOOL __stdcall FormatEx(DSTRING* root, STREAM_MESSAGE* message, options* opts, u Label.Buffer = NULL; } -#ifndef __REACTOS__ Status = FormatEx2(&DriveRoot, FMIFS_HARDDISK, &Label, opts && opts->flags & FORMAT_FLAG_QUICK_FORMAT, 0, NULL); -#else - Status = BtrfsFormatEx(&DriveRoot, FMIFS_HARDDISK, &Label, opts && opts->flags & FORMAT_FLAG_QUICK_FORMAT, 0, NULL); -#endif return NT_SUCCESS(Status); } +#endif // __REACTOS__ + void __stdcall SetSizes(ULONG sector, ULONG node) { if (sector != 0) def_sector_size = sector; diff --git a/sdk/lib/fslib/cdfslib/cdfslib.c b/sdk/lib/fslib/cdfslib/cdfslib.c index 296ac6650dc..7052de2870a 100644 --- a/sdk/lib/fslib/cdfslib/cdfslib.c +++ b/sdk/lib/fslib/cdfslib/cdfslib.c @@ -12,26 +12,37 @@ #define NDEBUG #include <debug.h> -NTSTATUS NTAPI -CdfsChkdsk(IN PUNICODE_STRING DriveRoot, +BOOLEAN +NTAPI +CdfsFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) +{ + // Not possible for CDFS (ISO-9660). + return FALSE; +} + +BOOLEAN +NTAPI +CdfsChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { UNIMPLEMENTED; - return STATUS_SUCCESS; -} - -NTSTATUS NTAPI -CdfsFormat(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) -{ - // Not possible for CDFS (ISO-9660). - return STATUS_NOT_SUPPORTED; + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; } diff --git a/sdk/lib/fslib/ext2lib/Mke2fs.c b/sdk/lib/fslib/ext2lib/Mke2fs.c index 91506ad7d69..b3dc5e14c8d 100644 --- a/sdk/lib/fslib/ext2lib/Mke2fs.c +++ b/sdk/lib/fslib/ext2lib/Mke2fs.c @@ -798,16 +798,18 @@ Ext2TotalBlocks(PEXT2_FILESYS Ext2Sys, ULONG DataBlocks) } -NTSTATUS +BOOLEAN NTAPI -Ext2Format(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) +Ext2Format( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) { - BOOLEAN bRet = FALSE; + BOOLEAN bRet; NTSTATUS Status = STATUS_UNSUCCESSFUL; /* Super Block: 1024 bytes long */ EXT2_SUPER_BLOCK Ext2Sb; @@ -819,6 +821,9 @@ Ext2Format(IN PUNICODE_STRING DriveRoot, ULONG start; ULONG ret_blk; + // FIXME: + UNREFERENCED_PARAMETER(BackwardCompatible); + UNREFERENCED_PARAMETER(MediaType); if (Callback != NULL) { @@ -868,6 +873,7 @@ Ext2Format(IN PUNICODE_STRING DriveRoot, bLocked = TRUE; } + Status = STATUS_UNSUCCESSFUL; // Initialize if (!ext2_initialize_sb(&FileSys)) @@ -917,7 +923,6 @@ Ext2Format(IN PUNICODE_STRING DriveRoot, ext2_print_super(&Ext2Sb); bRet = ext2_allocate_tables(&FileSys); - if (!bRet) { goto clean_up; @@ -942,6 +947,7 @@ Ext2Format(IN PUNICODE_STRING DriveRoot, if (start > rsv) start -= rsv; + bRet = TRUE; if (start > 0) bRet = zero_blocks(&FileSys, start, blocks - start, &ret_blk, NULL); @@ -969,14 +975,12 @@ Ext2Format(IN PUNICODE_STRING DriveRoot, if (!ext2_flush(&FileSys)) { - bRet = false; DPRINT1("Mke2fs: Warning, had trouble writing out superblocks.\n"); goto clean_up; } DPRINT("Mke2fs: Writing superblocks and filesystem accounting information done!\n"); - bRet = true; Status = STATUS_SUCCESS; clean_up: @@ -995,23 +999,25 @@ clean_up: Ext2CloseDevice(&FileSys); - if (Callback != NULL) - { - Callback(DONE, 0, (PVOID)&bRet); - } - - return Status; + return NT_SUCCESS(Status); } -NTSTATUS +BOOLEAN NTAPI -Ext2Chkdsk(IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) +Ext2Chkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { UNIMPLEMENTED; - return STATUS_SUCCESS; + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; } diff --git a/sdk/lib/fslib/ffslib/ffslib.c b/sdk/lib/fslib/ffslib/ffslib.c index 2c7f3ed4ba5..75e361f17e2 100644 --- a/sdk/lib/fslib/ffslib/ffslib.c +++ b/sdk/lib/fslib/ffslib/ffslib.c @@ -5,32 +5,45 @@ * PURPOSE: FFS lib * PROGRAMMERS: Pierre Schweitzer */ -#include "ffslib.h" + +#define NTOS_MODE_USER +#include <ndk/umtypes.h> +#include <fmifs/fmifs.h> #define NDEBUG #include <debug.h> -NTSTATUS NTAPI -FfsFormat(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +FfsFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) { UNIMPLEMENTED; - return STATUS_SUCCESS; + return TRUE; } - -NTSTATUS NTAPI -FfsChkdsk(IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +FfsChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { UNIMPLEMENTED; - return STATUS_SUCCESS; + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; } diff --git a/sdk/lib/fslib/ffslib/ffslib.h b/sdk/lib/fslib/ffslib/ffslib.h deleted file mode 100644 index 1ee1a87b2e4..00000000000 --- a/sdk/lib/fslib/ffslib/ffslib.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS FFS library - * FILE: lib/fslib/ffslib/ffslib.h - */ -#define NTOS_MODE_USER -#include <ndk/umtypes.h> -#include <fmifs/fmifs.h> diff --git a/sdk/lib/fslib/ntfslib/ntfslib.c b/sdk/lib/fslib/ntfslib/ntfslib.c index d99f63e8703..b3f4433e4d9 100644 --- a/sdk/lib/fslib/ntfslib/ntfslib.c +++ b/sdk/lib/fslib/ntfslib/ntfslib.c @@ -5,32 +5,45 @@ * PURPOSE: NTFS lib * PROGRAMMERS: Pierre Schweitzer */ -#include "ntfslib.h" + +#define NTOS_MODE_USER +#include <ndk/umtypes.h> +#include <fmifs/fmifs.h> #define NDEBUG #include <debug.h> -NTSTATUS NTAPI -NtfsFormat(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +NtfsFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) { UNIMPLEMENTED; - return STATUS_SUCCESS; + return TRUE; } - -NTSTATUS NTAPI -NtfsChkdsk(IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +NtfsChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { UNIMPLEMENTED; - return STATUS_SUCCESS; + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; } diff --git a/sdk/lib/fslib/ntfslib/ntfslib.h b/sdk/lib/fslib/ntfslib/ntfslib.h deleted file mode 100644 index 200dfeeba6b..00000000000 --- a/sdk/lib/fslib/ntfslib/ntfslib.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS NTFS FS library - * FILE: lib/fslib/ntfslib/ntfslib.h - */ -#define NTOS_MODE_USER -#include <ndk/umtypes.h> -#include <fmifs/fmifs.h> diff --git a/sdk/lib/fslib/reiserfslib/reiserfslib.c b/sdk/lib/fslib/reiserfslib/reiserfslib.c index 7356e143326..1f68f0200a8 100644 --- a/sdk/lib/fslib/reiserfslib/reiserfslib.c +++ b/sdk/lib/fslib/reiserfslib/reiserfslib.c @@ -5,32 +5,45 @@ * PURPOSE: ReiserFS lib * PROGRAMMERS: Pierre Schweitzer */ -#include "reiserfslib.h" + +#define NTOS_MODE_USER +#include <ndk/umtypes.h> +#include <fmifs/fmifs.h> #define NDEBUG #include <debug.h> -NTSTATUS NTAPI -ReiserfsFormat(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +ReiserfsFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) { UNIMPLEMENTED; - return STATUS_SUCCESS; + return TRUE; } - -NTSTATUS NTAPI -ReiserfsChkdsk(IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +ReiserfsChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { UNIMPLEMENTED; - return STATUS_SUCCESS; + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; } diff --git a/sdk/lib/fslib/reiserfslib/reiserfslib.h b/sdk/lib/fslib/reiserfslib/reiserfslib.h deleted file mode 100644 index 147c97e8a1d..00000000000 --- a/sdk/lib/fslib/reiserfslib/reiserfslib.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS ReiserFS library - * FILE: lib/fslib/reiserfslib/reiserfslib.h - */ -#define NTOS_MODE_USER -#include <ndk/umtypes.h> -#include <fmifs/fmifs.h> diff --git a/sdk/lib/fslib/vfatlib/vfatlib.c b/sdk/lib/fslib/vfatlib/vfatlib.c index 82c1282fbf0..fec1f736c20 100644 --- a/sdk/lib/fslib/vfatlib/vfatlib.c +++ b/sdk/lib/fslib/vfatlib/vfatlib.c @@ -45,14 +45,16 @@ ULONG FsCheckFlags; PVOID FsCheckMemQueue; ULONG FsCheckTotalFiles; -NTSTATUS +BOOLEAN NTAPI -VfatFormat(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) +VfatFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) { OBJECT_ATTRIBUTES ObjectAttributes; DISK_GEOMETRY DiskGeometry; @@ -64,6 +66,10 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, DPRINT("VfatFormat(DriveRoot '%wZ')\n", DriveRoot); + // FIXME: + UNREFERENCED_PARAMETER(BackwardCompatible); + UNREFERENCED_PARAMETER(MediaType); + Context.TotalSectorCount = 0; Context.CurrentSectorCount = 0; Context.Callback = Callback; @@ -84,8 +90,8 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, FILE_SYNCHRONOUS_IO_ALERT); if (!NT_SUCCESS(Status)) { - DPRINT1("NtOpenFile() failed with status 0x%.08x\n", Status); - return Status; + DPRINT1("NtOpenFile() failed with status 0x%08x\n", Status); + return FALSE; } Status = NtDeviceIoControlFile(FileHandle, @@ -100,9 +106,9 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, sizeof(DISK_GEOMETRY)); if (!NT_SUCCESS(Status)) { - DPRINT("IOCTL_DISK_GET_DRIVE_GEOMETRY failed with status 0x%.08x\n", Status); + DPRINT("IOCTL_DISK_GET_DRIVE_GEOMETRY failed with status 0x%08x\n", Status); NtClose(FileHandle); - return Status; + return FALSE; } if (DiskGeometry.MediaType == FixedMedia) @@ -129,9 +135,9 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, sizeof(PARTITION_INFORMATION)); if (!NT_SUCCESS(Status)) { - DPRINT("IOCTL_DISK_GET_PARTITION_INFO failed with status 0x%.08x\n", Status); + DPRINT("IOCTL_DISK_GET_PARTITION_INFO failed with status 0x%08x\n", Status); NtClose(FileHandle); - return Status; + return FALSE; } } else @@ -214,7 +220,7 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, if (Callback != NULL) { Context.Percent = 0; - Callback (PROGRESS, 0, (PVOID)&Context.Percent); + Callback(PROGRESS, 0, (PVOID)&Context.Percent); } LockStatus = NtFsControlFile(FileHandle, @@ -306,15 +312,8 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, NtClose(FileHandle); - if (Callback != NULL) - { - Context.Success = (BOOLEAN)(NT_SUCCESS(Status)); - Callback(DONE, 0, (PVOID)&Context.Success); - } - - DPRINT("VfatFormat() done. Status 0x%.08x\n", Status); - - return Status; + DPRINT("VfatFormat() done. Status 0x%08x\n", Status); + return NT_SUCCESS(Status); } @@ -370,14 +369,20 @@ VfatPrint(PCHAR Format, ...) } -NTSTATUS +BOOLEAN NTAPI -VfatChkdsk(IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) +VfatChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { BOOLEAN verify; BOOLEAN salvage_files; @@ -385,6 +390,11 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, DOS_FS fs; NTSTATUS Status; + UNREFERENCED_PARAMETER(pUnknown1); + UNREFERENCED_PARAMETER(pUnknown2); + UNREFERENCED_PARAMETER(pUnknown3); + UNREFERENCED_PARAMETER(pUnknown4); + RtlZeroMemory(&fs, sizeof(fs)); /* Store callback pointer */ @@ -416,7 +426,8 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, if (!NT_SUCCESS(Status)) { fs_close(FALSE); - return STATUS_DISK_CORRUPT_ERROR; + *ExitStatus = (ULONG)STATUS_DISK_CORRUPT_ERROR; + return FALSE; } if (CheckOnlyIfDirty && !fs_isdirty()) @@ -426,14 +437,17 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, fs_lock(FALSE); /* No need to check FS */ - return (fs_close(FALSE) == 0 ? STATUS_SUCCESS : STATUS_DISK_CORRUPT_ERROR); + Status = (fs_close(FALSE) == 0 ? STATUS_SUCCESS : STATUS_DISK_CORRUPT_ERROR); + *ExitStatus = (ULONG)Status; + return (Status == STATUS_SUCCESS); } else if (CheckOnlyIfDirty && fs_isdirty()) { if (!(FsCheckFlags & FSCHECK_READ_WRITE) && !(FsCheckFlags & FSCHECK_INTERACTIVE)) { fs_close(FALSE); - return STATUS_DISK_CORRUPT_ERROR; + *ExitStatus = (ULONG)STATUS_DISK_CORRUPT_ERROR; + return FALSE; } } @@ -503,7 +517,9 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, //
https://support.microsoft.com/en-us/kb/265533
/* Close the volume */ - return (fs_close(FsCheckFlags & FSCHECK_READ_WRITE) == 0 ? STATUS_SUCCESS : STATUS_DISK_CORRUPT_ERROR); + Status = (fs_close(FsCheckFlags & FSCHECK_READ_WRITE) == 0 ? STATUS_SUCCESS : STATUS_DISK_CORRUPT_ERROR); + *ExitStatus = (ULONG)Status; + return (Status == STATUS_SUCCESS); } /* EOF */ diff --git a/sdk/lib/fslib/vfatxlib/vfatxlib.c b/sdk/lib/fslib/vfatxlib/vfatxlib.c index 4f40cad7593..d5b73e37f12 100644 --- a/sdk/lib/fslib/vfatxlib/vfatxlib.c +++ b/sdk/lib/fslib/vfatxlib/vfatxlib.c @@ -15,13 +15,16 @@ #define NDEBUG #include <debug.h> -NTSTATUS NTAPI -VfatxFormat(IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +VfatxFormat( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN QuickFormat, + IN BOOLEAN BackwardCompatible, + IN MEDIA_TYPE MediaType, + IN PUNICODE_STRING Label, + IN ULONG ClusterSize) { OBJECT_ATTRIBUTES ObjectAttributes; DISK_GEOMETRY DiskGeometry; @@ -33,6 +36,15 @@ VfatxFormat(IN PUNICODE_STRING DriveRoot, DPRINT("VfatxFormat(DriveRoot '%wZ')\n", DriveRoot); + // FIXME: + UNREFERENCED_PARAMETER(MediaType); + + if (BackwardCompatible) + { + DPRINT1("BackwardCompatible == TRUE is unsupported!\n"); + return FALSE; + } + Context.TotalSectorCount = 0; Context.CurrentSectorCount = 0; Context.Callback = Callback; @@ -53,8 +65,8 @@ VfatxFormat(IN PUNICODE_STRING DriveRoot, FILE_SYNCHRONOUS_IO_ALERT); if (!NT_SUCCESS(Status)) { - DPRINT("NtOpenFile() failed with status 0x%.08x\n", Status); - return Status; + DPRINT("NtOpenFile() failed with status 0x%08x\n", Status); + return FALSE; } Status = NtDeviceIoControlFile(FileHandle, @@ -69,9 +81,9 @@ VfatxFormat(IN PUNICODE_STRING DriveRoot, sizeof(DISK_GEOMETRY)); if (!NT_SUCCESS(Status)) { - DPRINT("IOCTL_DISK_GET_DRIVE_GEOMETRY failed with status 0x%.08x\n", Status); + DPRINT("IOCTL_DISK_GET_DRIVE_GEOMETRY failed with status 0x%08x\n", Status); NtClose(FileHandle); - return Status; + return FALSE; } if (DiskGeometry.MediaType == FixedMedia) @@ -98,9 +110,9 @@ VfatxFormat(IN PUNICODE_STRING DriveRoot, sizeof(PARTITION_INFORMATION)); if (!NT_SUCCESS(Status)) { - DPRINT("IOCTL_DISK_GET_PARTITION_INFO failed with status 0x%.08x\n", Status); + DPRINT("IOCTL_DISK_GET_PARTITION_INFO failed with status 0x%08x\n", Status); NtClose(FileHandle); - return Status; + return FALSE; } } else @@ -141,27 +153,28 @@ VfatxFormat(IN PUNICODE_STRING DriveRoot, &Context); NtClose(FileHandle); - if (Callback != NULL) - { - Context.Success = (BOOLEAN)(NT_SUCCESS(Status)); - Callback(DONE, 0, (PVOID)&Context.Success); - } - - DPRINT("VfatxFormat() done. Status 0x%.08x\n", Status); - - return Status; + DPRINT("VfatxFormat() done. Status 0x%08x\n", Status); + return NT_SUCCESS(Status); } -NTSTATUS NTAPI -VfatxChkdsk(IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback) +BOOLEAN +NTAPI +VfatxChkdsk( + IN PUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID pUnknown1, + IN PVOID pUnknown2, + IN PVOID pUnknown3, + IN PVOID pUnknown4, + IN PULONG ExitStatus) { UNIMPLEMENTED; - return STATUS_SUCCESS; + *ExitStatus = (ULONG)STATUS_SUCCESS; + return TRUE; } VOID
1
0
0
0
[reactos] 02/02: [BTRFSLIB] Reduce the diff with upstream, and fix a memory leak.
by Hermès Bélusca-Maïto
22 Nov '20
22 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cdaa5d5fc78d5abd25cfd…
commit cdaa5d5fc78d5abd25cfdb007a8b50d285500eca Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Nov 22 05:57:00 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Nov 22 21:34:13 2020 +0100 [BTRFSLIB] Reduce the diff with upstream, and fix a memory leak. - Reduce the diff with upstream by aliasing malloc() and free() with RtlAllocateHeap() and RtlFreeHeap() respectively. - Fix a memory leak in the failure code path of the do-while memory reallocation loop for IOCTL_BTRFS_QUERY_FILESYSTEMS in is_mounted_multi_device(). --- sdk/lib/fslib/btrfslib/btrfslib.c | 153 +++----------------------------------- 1 file changed, 10 insertions(+), 143 deletions(-) diff --git a/sdk/lib/fslib/btrfslib/btrfslib.c b/sdk/lib/fslib/btrfslib/btrfslib.c index f47a47cd3be..b5222e57551 100644 --- a/sdk/lib/fslib/btrfslib/btrfslib.c +++ b/sdk/lib/fslib/btrfslib/btrfslib.c @@ -59,6 +59,11 @@ #endif #endif // __REACTOS__ +#ifdef __REACTOS__ +#define malloc(size) RtlAllocateHeap(RtlGetProcessHeap(), 0, (size)) +#define free(ptr) RtlFreeHeap(RtlGetProcessHeap(), 0, (ptr)) +#endif + #define SHA256_HASH_SIZE 32 void calc_sha256(uint8_t* hash, const void* input, size_t len); @@ -255,16 +260,10 @@ NTSTATUS NTAPI BtrfsChkdskEx(PUNICODE_STRING DriveRoot, BOOLEAN FixErrors, BOOLE static btrfs_root* add_root(LIST_ENTRY* roots, uint64_t id) { btrfs_root* root; -#ifdef __REACTOS__ - root = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(btrfs_root)); -#else root = malloc(sizeof(btrfs_root)); -#endif root->id = id; -#ifndef __REACTOS__ RtlZeroMemory(&root->header, sizeof(tree_header)); -#endif InitializeListHead(&root->items); InsertTailList(roots, &root->list_entry); @@ -285,24 +284,14 @@ static void free_roots(LIST_ENTRY* roots) { btrfs_item* item = CONTAINING_RECORD(le3, btrfs_item, list_entry); if (item->data) -#ifdef __REACTOS__ - RtlFreeHeap(RtlGetProcessHeap(), 0, item->data); - - RtlFreeHeap(RtlGetProcessHeap(), 0, item); -#else free(item->data); free(item); -#endif le3 = le4; } -#ifdef __REACTOS__ - RtlFreeHeap(RtlGetProcessHeap(), 0, r); -#else free(r); -#endif le = le2; } @@ -316,13 +305,8 @@ static void free_chunks(LIST_ENTRY* chunks) { LIST_ENTRY *le2 = le->Flink; btrfs_chunk* c = CONTAINING_RECORD(le, btrfs_chunk, list_entry); -#ifndef __REACTOS__ free(c->chunk_item); free(c); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, c->chunk_item); - RtlFreeHeap(RtlGetProcessHeap(), 0, c); -#endif le = le2; } @@ -332,11 +316,7 @@ static void add_item(btrfs_root* r, uint64_t obj_id, uint8_t obj_type, uint64_t LIST_ENTRY* le; btrfs_item* item; -#ifndef __REACTOS__ item = malloc(sizeof(btrfs_item)); -#else - item = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(btrfs_item)); -#endif item->key.obj_id = obj_id; item->key.obj_type = obj_type; @@ -346,11 +326,7 @@ static void add_item(btrfs_root* r, uint64_t obj_id, uint8_t obj_type, uint64_t if (size == 0) item->data = NULL; else { -#ifndef __REACTOS__ item->data = malloc(size); -#else - item->data = RtlAllocateHeap(RtlGetProcessHeap(), 0, size); -#endif memcpy(item->data, data, size); } @@ -423,20 +399,12 @@ static btrfs_chunk* add_chunk(LIST_ENTRY* chunks, uint64_t flags, btrfs_root* ch if (dev->dev_item.num_bytes - dev->dev_item.bytes_used < stripes * size) // not enough space return NULL; -#ifndef __REACTOS__ c = malloc(sizeof(btrfs_chunk)); -#else - c = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(btrfs_chunk)); -#endif c->offset = off; c->lastoff = off; c->used = 0; -#ifndef __REACTOS__ c->chunk_item = malloc(sizeof(CHUNK_ITEM) + (stripes * sizeof(CHUNK_ITEM_STRIPE))); -#else - c->chunk_item = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(CHUNK_ITEM) + (stripes * sizeof(CHUNK_ITEM_STRIPE))); -#endif c->chunk_item->size = size; c->chunk_item->root_id = BTRFS_ROOT_EXTENT; @@ -630,11 +598,7 @@ static NTSTATUS write_roots(HANDLE h, LIST_ENTRY* roots, uint32_t node_size, BTR NTSTATUS Status; uint8_t* tree; -#ifndef __REACTOS__ tree = malloc(node_size); -#else - tree = RtlAllocateHeap(RtlGetProcessHeap(), 0, node_size); -#endif le = roots->Flink; while (le != roots) { @@ -683,22 +647,14 @@ static NTSTATUS write_roots(HANDLE h, LIST_ENTRY* roots, uint32_t node_size, BTR Status = write_data(h, r->header.address, r->c, tree, node_size); if (!NT_SUCCESS(Status)) { -#ifndef __REACTOS__ free(tree); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, tree); -#endif return Status; } le = le->Flink; } -#ifndef __REACTOS__ free(tree); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, tree); -#endif return STATUS_SUCCESS; } @@ -798,12 +754,8 @@ static NTSTATUS write_superblocks(HANDLE h, btrfs_dev* dev, btrfs_root* chunk_ro le = le->Flink; } -#ifndef __REACTOS__ sb = malloc(sblen); memset(sb, 0, sblen); -#else - sb = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sblen); -#endif sb->uuid = *fsuuid; sb->flags = 1; @@ -837,11 +789,7 @@ static NTSTATUS write_superblocks(HANDLE h, btrfs_dev* dev, btrfs_root* chunk_ro for (unsigned int i = 0; i < label->Length / sizeof(WCHAR); i++) { #endif if (label->Buffer[i] == '/' || label->Buffer[i] == '\\') { -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif return STATUS_INVALID_VOLUME_LABEL; } } @@ -855,9 +803,6 @@ static NTSTATUS write_superblocks(HANDLE h, btrfs_dev* dev, btrfs_root* chunk_ro } if (WideCharToMultiByte(CP_UTF8, 0, label->Buffer, label->Length / sizeof(WCHAR), sb->label, utf8len, NULL, NULL) == 0) { - free(sb); - return STATUS_INVALID_VOLUME_LABEL; - } #else as.Buffer = sb->label; as.Length = 0; @@ -865,10 +810,10 @@ static NTSTATUS write_superblocks(HANDLE h, btrfs_dev* dev, btrfs_root* chunk_ro if (!NT_SUCCESS(RtlUnicodeStringToAnsiString(&as, label, FALSE))) { - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); +#endif + free(sb); return STATUS_INVALID_VOLUME_LABEL; } -#endif } sb->cache_generation = 0xffffffffffffffff; @@ -893,22 +838,14 @@ static NTSTATUS write_superblocks(HANDLE h, btrfs_dev* dev, btrfs_root* chunk_ro Status = NtWriteFile(h, NULL, NULL, NULL, &iosb, sb, sblen, &off, NULL); if (!NT_SUCCESS(Status)) { -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif return Status; } i++; } -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif return STATUS_SUCCESS; } @@ -941,11 +878,7 @@ GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime) static void add_inode_ref(btrfs_root* r, uint64_t inode, uint64_t parent, uint64_t index, const char* name) { uint16_t name_len = (uint16_t)strlen(name); -#ifndef __REACTOS__ INODE_REF* ir = malloc(offsetof(INODE_REF, name[0]) + name_len); -#else - INODE_REF* ir = RtlAllocateHeap(RtlGetProcessHeap(), 0, offsetof(INODE_REF, name[0]) + name_len); -#endif ir->index = 0; ir->n = name_len; @@ -953,11 +886,7 @@ static void add_inode_ref(btrfs_root* r, uint64_t inode, uint64_t parent, uint64 add_item(r, inode, TYPE_INODE_REF, parent, ir, (uint16_t)offsetof(INODE_REF, name[0]) + ir->n); -#ifndef __REACTOS__ free(ir); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, ir); -#endif } static void init_fs_tree(btrfs_root* r, uint32_t node_size) { @@ -1007,22 +936,14 @@ static NTSTATUS clear_first_megabyte(HANDLE h) { LARGE_INTEGER zero; uint8_t* mb; -#ifndef __REACTOS__ mb = malloc(0x100000); memset(mb, 0, 0x100000); -#else - mb = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 0x100000); -#endif zero.QuadPart = 0; Status = NtWriteFile(h, NULL, NULL, NULL, &iosb, mb, 0x100000, &zero, NULL); -#ifndef __REACTOS__ free(mb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, mb); -#endif return Status; } @@ -1035,13 +956,9 @@ static bool is_ssd(HANDLE h) { IDENTIFY_DEVICE_DATA* idd; aptelen = sizeof(ATA_PASS_THROUGH_EX) + 512; -#ifndef __REACTOS__ apte = malloc(aptelen); RtlZeroMemory(apte, aptelen); -#else - apte = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, aptelen); -#endif apte->Length = sizeof(ATA_PASS_THROUGH_EX); apte->AtaFlags = ATA_FLAGS_DATA_IN; @@ -1056,20 +973,12 @@ static bool is_ssd(HANDLE h) { idd = (IDENTIFY_DEVICE_DATA*)((uint8_t*)apte + sizeof(ATA_PASS_THROUGH_EX)); if (idd->NominalMediaRotationRate == 1) { -#ifndef __REACTOS__ free(apte); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, apte); -#endif return true; } } -#ifndef __REACTOS__ free(apte); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, apte); -#endif return false; } @@ -1077,11 +986,7 @@ static bool is_ssd(HANDLE h) { static void add_dir_item(btrfs_root* root, uint64_t inode, uint32_t hash, uint64_t key_objid, uint8_t key_type, uint64_t key_offset, uint64_t transid, uint8_t type, const char* name) { uint16_t name_len = (uint16_t)strlen(name); -#ifndef __REACTOS__ DIR_ITEM* di = malloc(offsetof(DIR_ITEM, name[0]) + name_len); -#else - DIR_ITEM* di = RtlAllocateHeap(RtlGetProcessHeap(), 0, offsetof(DIR_ITEM, name[0]) + name_len); -#endif di->key.obj_id = key_objid; di->key.obj_type = key_type; @@ -1094,11 +999,7 @@ static void add_dir_item(btrfs_root* root, uint64_t inode, uint32_t hash, uint64 add_item(root, inode, TYPE_DIR_ITEM, hash, di, (uint16_t)(offsetof(DIR_ITEM, name[0]) + di->m + di->n)); -#ifndef __REACTOS__ free(di); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, di); -#endif } static void set_default_subvol(btrfs_root* root_root, uint32_t node_size) { @@ -1292,50 +1193,30 @@ static bool is_mounted_multi_device(HANDLE h, uint32_t sector_size) { if (sblen & (sector_size - 1)) sblen = (sblen & sector_size) + sector_size; -#ifndef __REACTOS__ sb = malloc(sblen); -#else - sb = RtlAllocateHeap(RtlGetProcessHeap(), 0, sblen); -#endif off.QuadPart = superblock_addrs[0]; Status = NtReadFile(h, NULL, NULL, NULL, &iosb, sb, sblen, &off, NULL); if (!NT_SUCCESS(Status)) { -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif return false; } if (sb->magic != BTRFS_MAGIC) { -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif return false; } if (!check_superblock_checksum(sb)) { -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif return false; } fsuuid = sb->uuid; devuuid = sb->dev_item.device_uuid; -#ifndef __REACTOS__ free(sb); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, sb); -#endif us.Length = us.MaximumLength = (USHORT)(wcslen(btrfs) * sizeof(WCHAR)); us.Buffer = btrfs; @@ -1352,16 +1233,14 @@ static bool is_mounted_multi_device(HANDLE h, uint32_t sector_size) { do { bfssize += 1024; -#ifndef __REACTOS__ if (bfs) free(bfs); bfs = malloc(bfssize); -#else - if (bfs) RtlFreeHeap(RtlGetProcessHeap(), 0, bfs); - bfs = RtlAllocateHeap(RtlGetProcessHeap(), 0, bfssize); -#endif Status = NtDeviceIoControlFile(h2, NULL, NULL, NULL, &iosb, IOCTL_BTRFS_QUERY_FILESYSTEMS, NULL, 0, bfs, bfssize); if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW) { +#ifdef __REACTOS__ + if (bfs) free(bfs); +#endif NtClose(h2); return false; } @@ -1393,11 +1272,7 @@ end: NtClose(h2); if (bfs) -#ifndef __REACTOS__ free(bfs); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, bfs); -#endif return ret; } @@ -1589,22 +1464,14 @@ end: ULONG mdnsize; mdnsize = (ULONG)(offsetof(MOUNTDEV_NAME, Name[0]) + DriveRoot->Length); -#ifndef __REACTOS__ mdn = malloc(mdnsize); -#else - mdn = RtlAllocateHeap(RtlGetProcessHeap(), 0, mdnsize); -#endif mdn->NameLength = DriveRoot->Length; memcpy(mdn->Name, DriveRoot->Buffer, DriveRoot->Length); NtDeviceIoControlFile(btrfsh, NULL, NULL, NULL, &iosb, IOCTL_BTRFS_PROBE_VOLUME, mdn, mdnsize, NULL, 0); -#ifndef __REACTOS__ free(mdn); -#else - RtlFreeHeap(RtlGetProcessHeap(), 0, mdn); -#endif NtClose(btrfsh); }
1
0
0
0
[reactos] 01/02: [FMIFS] Whitespaces formatting only.
by Hermès Bélusca-Maïto
22 Nov '20
22 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=65758cc3b453ef59c9159…
commit 65758cc3b453ef59c91593eec70d56b837e35d26 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Nov 22 05:39:40 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Nov 22 21:34:04 2020 +0100 [FMIFS] Whitespaces formatting only. --- sdk/include/reactos/libs/fmifs/fmifs.h | 236 ++++++++++++++++----------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/sdk/include/reactos/libs/fmifs/fmifs.h b/sdk/include/reactos/libs/fmifs/fmifs.h index 14bf5310f2f..c2c8b80e7cc 100644 --- a/sdk/include/reactos/libs/fmifs/fmifs.h +++ b/sdk/include/reactos/libs/fmifs/fmifs.h @@ -13,12 +13,12 @@ * --- * * 1999-02-18 (Emanuele Aliberti) - * Normalized function names. + * Normalized function names. * * --- * * 2006-09-04 (Herv� Poussineau) - * Add some prototypes + * Add some prototypes * */ @@ -29,97 +29,97 @@ extern "C" { /* Output command */ typedef struct { - ULONG Lines; - PCHAR Output; + ULONG Lines; + PCHAR Output; } TEXTOUTPUT, *PTEXTOUTPUT; /* media flags */ typedef enum { - FMIFS_UNKNOWN0, - FMIFS_UNKNOWN1, - FMIFS_UNKNOWN2, - FMIFS_UNKNOWN3, - FMIFS_UNKNOWN4, - FMIFS_UNKNOWN5, - FMIFS_UNKNOWN6, - FMIFS_UNKNOWN7, - FMIFS_FLOPPY, - FMIFS_UNKNOWN9, - FMIFS_UNKNOWN10, - FMIFS_REMOVABLE, - FMIFS_HARDDISK, - FMIFS_UNKNOWN13, - FMIFS_UNKNOWN14, - FMIFS_UNKNOWN15, - FMIFS_UNKNOWN16, - FMIFS_UNKNOWN17, - FMIFS_UNKNOWN18, - FMIFS_UNKNOWN19, - FMIFS_UNKNOWN20, - FMIFS_UNKNOWN21, - FMIFS_UNKNOWN22, - FMIFS_UNKNOWN23, + FMIFS_UNKNOWN0, + FMIFS_UNKNOWN1, + FMIFS_UNKNOWN2, + FMIFS_UNKNOWN3, + FMIFS_UNKNOWN4, + FMIFS_UNKNOWN5, + FMIFS_UNKNOWN6, + FMIFS_UNKNOWN7, + FMIFS_FLOPPY, + FMIFS_UNKNOWN9, + FMIFS_UNKNOWN10, + FMIFS_REMOVABLE, + FMIFS_HARDDISK, + FMIFS_UNKNOWN13, + FMIFS_UNKNOWN14, + FMIFS_UNKNOWN15, + FMIFS_UNKNOWN16, + FMIFS_UNKNOWN17, + FMIFS_UNKNOWN18, + FMIFS_UNKNOWN19, + FMIFS_UNKNOWN20, + FMIFS_UNKNOWN21, + FMIFS_UNKNOWN22, + FMIFS_UNKNOWN23, } FMIFS_MEDIA_FLAG; /* Callback command types */ typedef enum { - PROGRESS, - DONEWITHSTRUCTURE, - UNKNOWN2, - UNKNOWN3, - UNKNOWN4, - UNKNOWN5, - INSUFFICIENTRIGHTS, - FSNOTSUPPORTED, - VOLUMEINUSE, - UNKNOWN9, - UNKNOWNA, - DONE, - UNKNOWNC, - UNKNOWND, - OUTPUT, - STRUCTUREPROGRESS, - CLUSTERSIZETOOSMALL, + PROGRESS, + DONEWITHSTRUCTURE, + UNKNOWN2, + UNKNOWN3, + UNKNOWN4, + UNKNOWN5, + INSUFFICIENTRIGHTS, + FSNOTSUPPORTED, + VOLUMEINUSE, + UNKNOWN9, + UNKNOWNA, + DONE, + UNKNOWNC, + UNKNOWND, + OUTPUT, + STRUCTUREPROGRESS, + CLUSTERSIZETOOSMALL, } CALLBACKCOMMAND; /* FMIFS callback definition */ typedef BOOLEAN (NTAPI* PFMIFSCALLBACK)( - IN CALLBACKCOMMAND Command, - IN ULONG SubAction, - IN PVOID ActionInfo); + IN CALLBACKCOMMAND Command, + IN ULONG SubAction, + IN PVOID ActionInfo); /* Chkdsk command in FMIFS */ VOID NTAPI Chkdsk( - IN PWCHAR DriveRoot, - IN PWCHAR Format, - IN BOOLEAN CorrectErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PVOID Unused2, - IN PVOID Unused3, - IN PFMIFSCALLBACK Callback); - -/* ChkdskEx command in FMIFS (not in the original) */ + IN PWCHAR DriveRoot, + IN PWCHAR Format, + IN BOOLEAN CorrectErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID Unused2, + IN PVOID Unused3, + IN PFMIFSCALLBACK Callback); + +/* ChkdskEx command in FMIFS */ VOID NTAPI ChkdskEx( - IN PWCHAR DriveRoot, - IN PWCHAR Format, - IN BOOLEAN CorrectErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PVOID Unused2, - IN PVOID Unused3, - IN PFMIFSCALLBACK Callback); + IN PWCHAR DriveRoot, + IN PWCHAR Format, + IN BOOLEAN CorrectErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PVOID Unused2, + IN PVOID Unused3, + IN PFMIFSCALLBACK Callback); FMIFS_MEDIA_FLAG NTAPI ComputeFmMediaType( - IN ULONG MediaType); + IN ULONG MediaType); /* DiskCopy command in FMIFS */ VOID NTAPI @@ -128,89 +128,89 @@ DiskCopy(VOID); /* Enable/Disable volume compression */ BOOLEAN NTAPI EnableVolumeCompression( - IN PWCHAR DriveRoot, - IN USHORT Compression); + IN PWCHAR DriveRoot, + IN USHORT Compression); /* Format command in FMIFS */ VOID NTAPI Format( - IN PWCHAR DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PWCHAR Format, - IN PWCHAR Label, - IN BOOLEAN QuickFormat, - IN PFMIFSCALLBACK Callback); + IN PWCHAR DriveRoot, + IN FMIFS_MEDIA_FLAG MediaFlag, + IN PWCHAR Format, + IN PWCHAR Label, + IN BOOLEAN QuickFormat, + IN PFMIFSCALLBACK Callback); /* FormatEx command in FMIFS */ VOID NTAPI FormatEx( - IN PWCHAR DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PWCHAR Format, - IN PWCHAR Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PWCHAR DriveRoot, + IN FMIFS_MEDIA_FLAG MediaFlag, + IN PWCHAR Format, + IN PWCHAR Label, + IN BOOLEAN QuickFormat, + IN ULONG ClusterSize, + IN PFMIFSCALLBACK Callback); BOOLEAN NTAPI QueryAvailableFileSystemFormat( - IN DWORD Index, - IN OUT PWCHAR FileSystem, /* FIXME: Probably one minimal size is mandatory, but which one? */ - OUT UCHAR* Major, - OUT UCHAR* Minor, - OUT BOOLEAN* LatestVersion); + IN DWORD Index, + IN OUT PWCHAR FileSystem, /* FIXME: Probably one minimal size is mandatory, but which one? */ + OUT UCHAR* Major, + OUT UCHAR* Minor, + OUT BOOLEAN* LatestVersion); BOOL NTAPI QueryDeviceInformation( - IN PWCHAR DriveRoot, - OUT ULONG* Buffer, /* That is probably some 4-bytes structure */ - IN ULONG BufferSize); /* 4 */ + IN PWCHAR DriveRoot, + OUT ULONG* Buffer, /* That is probably some 4-bytes structure */ + IN ULONG BufferSize); /* 4 */ BOOL NTAPI QueryFileSystemName( - IN PWCHAR DriveRoot, - OUT PWCHAR FileSystem OPTIONAL, /* FIXME: Probably one minimal size is mandatory, but which one? */ - OUT UCHAR* Unknown2 OPTIONAL, /* Always 0? */ - OUT UCHAR* Unknown3 OPTIONAL, /* Always 0? */ - OUT ULONG* Unknown4 OPTIONAL); /* Always 0? */ + IN PWCHAR DriveRoot, + OUT PWCHAR FileSystem OPTIONAL, /* FIXME: Probably one minimal size is mandatory, but which one? */ + OUT UCHAR* Unknown2 OPTIONAL, /* Always 0? */ + OUT UCHAR* Unknown3 OPTIONAL, /* Always 0? */ + OUT ULONG* Unknown4 OPTIONAL); /* Always 0? */ BOOLEAN NTAPI QueryLatestFileSystemVersion( - IN PWCHAR FileSystem, - OUT UCHAR* Major OPTIONAL, - OUT UCHAR* Minor OPTIONAL); + IN PWCHAR FileSystem, + OUT UCHAR* Major OPTIONAL, + OUT UCHAR* Minor OPTIONAL); BOOL NTAPI QuerySupportedMedia( - IN PWCHAR DriveRoot, - OUT FMIFS_MEDIA_FLAG *CurrentMedia OPTIONAL, - IN ULONG Unknown3, - OUT PULONG Unknown4); /* Always 1? */ + IN PWCHAR DriveRoot, + OUT FMIFS_MEDIA_FLAG *CurrentMedia OPTIONAL, + IN ULONG Unknown3, + OUT PULONG Unknown4); /* Always 1? */ BOOL NTAPI SetLabel( - IN PWCHAR DriveRoot, - IN PWCHAR Label); + IN PWCHAR DriveRoot, + IN PWCHAR Label); /* Functions provided by u*.dll */ typedef NTSTATUS (NTAPI *FORMATEX)( - IN PUNICODE_STRING DriveRoot, - IN FMIFS_MEDIA_FLAG MediaFlag, - IN PUNICODE_STRING Label, - IN BOOLEAN QuickFormat, - IN ULONG ClusterSize, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN FMIFS_MEDIA_FLAG MediaFlag, + IN PUNICODE_STRING Label, + IN BOOLEAN QuickFormat, + IN ULONG ClusterSize, + IN PFMIFSCALLBACK Callback); typedef NTSTATUS (NTAPI *CHKDSKEX)( - IN PUNICODE_STRING DriveRoot, - IN BOOLEAN FixErrors, - IN BOOLEAN Verbose, - IN BOOLEAN CheckOnlyIfDirty, - IN BOOLEAN ScanDrive, - IN PFMIFSCALLBACK Callback); + IN PUNICODE_STRING DriveRoot, + IN BOOLEAN FixErrors, + IN BOOLEAN Verbose, + IN BOOLEAN CheckOnlyIfDirty, + IN BOOLEAN ScanDrive, + IN PFMIFSCALLBACK Callback); #ifdef __cplusplus }
1
0
0
0
[reactos] 01/01: [NTOS:KD] Change the way we detect if exception if from KernelMode/UserMode
by Hervé Poussineau
22 Nov '20
22 Nov '20
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1a3c607f532cd4658719a…
commit 1a3c607f532cd4658719a3ce104cb9f0a2a72a01 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Nov 22 18:13:51 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Nov 22 18:17:59 2020 +0100 [NTOS:KD] Change the way we detect if exception if from KernelMode/UserMode CORE-17381 --- ntoskrnl/kd/kdio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 50f011c7f02..c1b01dec20b 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -56,7 +56,6 @@ static ULONG KdbgNextApiNumber = DbgKdContinueApi; static CONTEXT KdbgContext; static EXCEPTION_RECORD64 KdbgExceptionRecord; static BOOLEAN KdbgFirstChanceException; -static KPROCESSOR_MODE KdbgPreviousMode; static NTSTATUS KdbgContinueStatus = STATUS_SUCCESS; /* LOCKING FUNCTIONS *********************************************************/ @@ -581,7 +580,6 @@ KdSendPacket( KdbgNextApiNumber = DbgKdGetContextApi; KdbgExceptionRecord = WaitStateChange->u.Exception.ExceptionRecord; KdbgFirstChanceException = WaitStateChange->u.Exception.FirstChance; - KdbgPreviousMode = ((PKTHREAD)(ULONG_PTR)WaitStateChange->Thread)->PreviousMode; return; } } @@ -601,7 +599,7 @@ KdSendPacket( } Result = KdbEnterDebuggerException(&KdbgExceptionRecord, - KdbgPreviousMode, + KdbgContext.SegCs & 1, &KdbgContext, KdbgFirstChanceException); #else
1
0
0
0
← Newer
1
...
729
730
731
732
733
734
735
...
8139
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
Results per page:
10
25
50
100
200