ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2015
----- 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
17 participants
535 discussions
Start a n
N
ew thread
[sginsberg] 69170: Fix the FSDs to use the INIT_SECTION-style and add the alloc_text-s required for MSVC. Please make sure to add section declarations for both compilers for any new functions!
by sginsberg@svn.reactos.org
Author: sginsberg Date: Thu Sep 10 12:00:28 2015 New Revision: 69170 URL:
http://svn.reactos.org/svn/reactos?rev=69170&view=rev
Log: Fix the FSDs to use the INIT_SECTION-style and add the alloc_text-s required for MSVC. Please make sure to add section declarations for both compilers for any new functions! Modified: trunk/reactos/drivers/filesystems/cdfs/cdfs.c trunk/reactos/drivers/filesystems/cdfs/cdfs.h trunk/reactos/drivers/filesystems/fastfat/iface.c trunk/reactos/drivers/filesystems/fastfat/vfat.h trunk/reactos/drivers/filesystems/mup/mup.c trunk/reactos/drivers/filesystems/mup/mup.h trunk/reactos/drivers/filesystems/ntfs/ntfs.c trunk/reactos/drivers/filesystems/ntfs/ntfs.h Modified: trunk/reactos/drivers/filesystems/cdfs/cdfs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/c…
============================================================================== --- trunk/reactos/drivers/filesystems/cdfs/cdfs.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/cdfs/cdfs.c [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -32,6 +32,10 @@ #define NDEBUG #include <debug.h> +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#endif + /* GLOBALS ******************************************************************/ PCDFS_GLOBAL_DATA CdfsGlobalData; @@ -39,7 +43,7 @@ /* FUNCTIONS ****************************************************************/ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) Modified: trunk/reactos/drivers/filesystems/cdfs/cdfs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/c…
============================================================================== --- trunk/reactos/drivers/filesystems/cdfs/cdfs.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/cdfs/cdfs.h [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -7,10 +7,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define CDFS_BASIC_SECTOR 2048 Modified: trunk/reactos/drivers/filesystems/fastfat/iface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/iface.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/iface.c [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -30,6 +30,11 @@ #define NDEBUG #include <debug.h> +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#endif + + /* GLOBALS *****************************************************************/ PVFAT_GLOBAL_DATA VfatGlobalData; @@ -43,7 +48,7 @@ * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry( Modified: trunk/reactos/drivers/filesystems/fastfat/vfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -8,10 +8,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define USE_ROS_CC_AND_FS Modified: trunk/reactos/drivers/filesystems/mup/mup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/mu…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/mup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/mup.c [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -32,6 +32,36 @@ #define NDEBUG #include <debug.h> +NTSTATUS +NTAPI +DriverEntry( + PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath +); + +NTSTATUS +DfsDriverEntry( + PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath +); + +VOID +MupInitializeData( + VOID +); + +VOID +MupInitializeVcb( + PMUP_VCB Vcb +); + +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#pragma alloc_text(INIT, DfsDriverEntry) +#pragma alloc_text(INIT, MupInitializeData) +#pragma alloc_text(INIT, MupInitializeVcb) +#endif + ERESOURCE MupGlobalLock; ERESOURCE MupPrefixTableLock; ERESOURCE MupCcbListLock; @@ -53,9 +83,9 @@ /* FUNCTIONS ****************************************************************/ -INIT_FUNCTION +INIT_SECTION VOID -MupInitializeData() +MupInitializeData(VOID) { ExInitializeResourceLite(&MupGlobalLock); ExInitializeResourceLite(&MupPrefixTableLock); @@ -79,7 +109,7 @@ ExDeleteResourceLite(&MupVcbLock); } -INIT_FUNCTION +INIT_SECTION VOID MupInitializeVcb(PMUP_VCB Vcb) { @@ -2522,7 +2552,7 @@ MupUninitializeData(); } -INIT_FUNCTION +INIT_SECTION NTSTATUS DfsDriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) @@ -2541,7 +2571,7 @@ * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, Modified: trunk/reactos/drivers/filesystems/mup/mup.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/mu…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/mup.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/mup.h [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -8,10 +8,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/ntfs.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/ntfs.c [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -31,6 +31,11 @@ #define NDEBUG #include <debug.h> +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#pragma alloc_text(INIT, NtfsInitializeFunctionPointers) +#endif + /* GLOBALS *****************************************************************/ PNTFS_GLOBAL_DATA NtfsGlobalData = NULL; @@ -44,7 +49,7 @@ * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, @@ -123,7 +128,7 @@ * DriverObject = object describing this driver * RETURNS: Nothing */ -INIT_FUNCTION +INIT_SECTION VOID NTAPI NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject) Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Thu Sep 10 12:00:28 2015 @@ -6,10 +6,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define CACHEPAGESIZE(pDeviceExt) \
9 years, 3 months
1
0
0
0
[tfaber] 69169: [KMTESTS:MM] - Add some more reserved mapping tests for special pool tags and unaligned addresses - Validate MDL pages in MmMdl test
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Sep 10 11:16:53 2015 New Revision: 69169 URL:
http://svn.reactos.org/svn/reactos?rev=69169&view=rev
Log: [KMTESTS:MM] - Add some more reserved mapping tests for special pool tags and unaligned addresses - Validate MDL pages in MmMdl test Modified: trunk/rostests/kmtests/ntos_mm/MmMdl.c trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c Modified: trunk/rostests/kmtests/ntos_mm/MmMdl.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmMdl.c?r…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/MmMdl.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/MmMdl.c [iso-8859-1] Thu Sep 10 11:16:53 2015 @@ -19,6 +19,8 @@ PMDL Mdls[32]; PVOID SystemVas[32]; ULONG i; + PPFN_NUMBER MdlPages; + ULONG MdlPageCount; LowAddress.QuadPart = 0; HighAddress.QuadPart = -1; @@ -34,6 +36,14 @@ ok(MmGetMdlByteCount(Mdl) == 2 * 1024 * 1024, "Byte count: %lu\n", MmGetMdlByteCount(Mdl)); ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl)); ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags); + MdlPages = MmGetMdlPfnArray(Mdl); + MdlPageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(Mdl), MmGetMdlByteCount(Mdl)); + ok(MdlPageCount == 2 * 1024 * 1024 / PAGE_SIZE, "MdlPageCount = %lu\n", MdlPageCount); + for (i = 0; i < MdlPageCount; i++) + { + ok(MdlPages[i] != 0 && MdlPages[i] != (PFN_NUMBER)-1, + "MdlPages[%lu] = 0x%I64x\n", i, (ULONGLONG)MdlPages[i]); + } MmFreePagesFromMdl(Mdl); ExFreePoolWithTag(Mdl, 0); @@ -105,6 +115,14 @@ ok(MmGetMdlByteCount(Mdl) != 2UL * 1024 * 1024 * 1024, "Byte count: %lu\n", MmGetMdlByteCount(Mdl)); ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n", MmGetMdlVirtualAddress(Mdl)); ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags: %lx\n", Mdl->MdlFlags); + MdlPages = MmGetMdlPfnArray(Mdl); + MdlPageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(Mdl), MmGetMdlByteCount(Mdl)); + ok(MdlPageCount < 2UL * 1024 * 1024 * 1024 / PAGE_SIZE, "MdlPageCount = %lu\n", MdlPageCount); + for (i = 0; i < MdlPageCount; i++) + { + ok(MdlPages[i] != 0 && MdlPages[i] != (PFN_NUMBER)-1, + "MdlPages[%lu] = 0x%I64x\n", i, (ULONGLONG)MdlPages[i]); + } SystemVa = MmMapLockedPagesSpecifyCache(Mdl, KernelMode, MmCached, Modified: trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmReserve…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c [iso-8859-1] Thu Sep 10 11:16:53 2015 @@ -35,6 +35,7 @@ ValidateMapping( _In_ PVOID BaseAddress, _In_ ULONG TotalPtes, + _In_ ULONG PoolTag, _In_ ULONG ValidPtes, _In_ PPFN_NUMBER Pfns) { @@ -61,7 +62,7 @@ ok_eq_hex(PointerPte[i].u.Long, 0UL); } Valid = Valid && - ok_eq_tag(PointerPte[-1].u.Long, 'MRmK' & ~1); + ok_eq_tag(PointerPte[-1].u.Long, PoolTag & ~1); Valid = Valid && ok_eq_ulong(PointerPte[-2].u.Long, (TotalPtes + 2) * 2); #endif @@ -72,7 +73,9 @@ static VOID TestMap( - _In_ PVOID Mapping) + _In_ PVOID Mapping, + _In_ ULONG TotalPtes, + _In_ ULONG PoolTag) { PMDL Mdl; PHYSICAL_ADDRESS ZeroPhysical; @@ -99,14 +102,15 @@ MdlPages = (PVOID)(Mdl + 1); BaseAddress = MmMapLockedPagesWithReservedMapping(Mapping, - 'MRmK', - Mdl, - MmCached); - if (BaseAddress) + PoolTag, + Mdl, + MmCached); + ok(BaseAddress != NULL, "MmMapLockedPagesWithReservedMapping failed\n"); + if (!skip(BaseAddress != NULL, "Failed to map MDL\n")) { ok_eq_pointer(BaseAddress, Mapping); - ok_bool_true(ValidateMapping(BaseAddress, 10, 1, MdlPages), + ok_bool_true(ValidateMapping(BaseAddress, TotalPtes, PoolTag, 1, MdlPages), "ValidateMapping returned"); KmtStartSeh() @@ -114,10 +118,35 @@ KmtEndSeh(STATUS_SUCCESS); MmUnmapReservedMapping(BaseAddress, - 'MRmK', - Mdl); - - ok_bool_true(ValidateMapping(Mapping, 10, 0, NULL), + PoolTag, + Mdl); + + ok_bool_true(ValidateMapping(Mapping, TotalPtes, PoolTag, 0, NULL), + "ValidateMapping returned"); + } + + /* Try again but at an unaligned address */ + BaseAddress = MmMapLockedPagesWithReservedMapping((PUCHAR)Mapping + sizeof(ULONG), + PoolTag, + Mdl, + MmCached); + ok(BaseAddress != NULL, "MmMapLockedPagesWithReservedMapping failed\n"); + if (!skip(BaseAddress != NULL, "Failed to map MDL\n")) + { + ok_eq_pointer(BaseAddress, (PUCHAR)Mapping + sizeof(ULONG)); + + ok_bool_true(ValidateMapping(BaseAddress, TotalPtes, PoolTag, 1, MdlPages), + "ValidateMapping returned"); + + KmtStartSeh() + *(volatile ULONG *)BaseAddress = 0x01234567; + KmtEndSeh(STATUS_SUCCESS); + + MmUnmapReservedMapping(BaseAddress, + PoolTag, + Mdl); + + ok_bool_true(ValidateMapping(Mapping, TotalPtes, PoolTag, 0, NULL), "ValidateMapping returned"); } @@ -127,7 +156,7 @@ Mdl = MmAllocatePagesForMdlEx(ZeroPhysical, MaxPhysical, ZeroPhysical, - 10 * PAGE_SIZE, + TotalPtes * PAGE_SIZE, MmCached, 0); if (skip(Mdl != NULL, "No MDL\n")) @@ -138,17 +167,18 @@ MdlPages = (PVOID)(Mdl + 1); BaseAddress = MmMapLockedPagesWithReservedMapping(Mapping, - 'MRmK', - Mdl, - MmCached); - if (BaseAddress) + PoolTag, + Mdl, + MmCached); + ok(BaseAddress != NULL, "MmMapLockedPagesWithReservedMapping failed\n"); + if (!skip(BaseAddress != NULL, "Failed to map MDL\n")) { ok_eq_pointer(BaseAddress, Mapping); - ok_bool_true(ValidateMapping(BaseAddress, 10, 10, MdlPages), - "ValidateMapping returned"); - - for (i = 0; i < 10; i++) + ok_bool_true(ValidateMapping(BaseAddress, TotalPtes, PoolTag, TotalPtes, MdlPages), + "ValidateMapping returned"); + + for (i = 0; i < TotalPtes; i++) { KmtStartSeh() *((volatile ULONG *)BaseAddress + i * PAGE_SIZE / sizeof(ULONG)) = 0x01234567; @@ -156,10 +186,10 @@ } MmUnmapReservedMapping(BaseAddress, - 'MRmK', - Mdl); - - ok_bool_true(ValidateMapping(Mapping, 10, 0, NULL), + PoolTag, + Mdl); + + ok_bool_true(ValidateMapping(Mapping, TotalPtes, PoolTag, 0, NULL), "ValidateMapping returned"); } @@ -169,7 +199,7 @@ Mdl = MmAllocatePagesForMdlEx(ZeroPhysical, MaxPhysical, ZeroPhysical, - 11 * PAGE_SIZE, + (TotalPtes + 1) * PAGE_SIZE, MmCached, 0); if (skip(Mdl != NULL, "No MDL\n")) @@ -178,14 +208,14 @@ } BaseAddress = MmMapLockedPagesWithReservedMapping(Mapping, - 'MRmK', + PoolTag, Mdl, MmCached); ok_eq_pointer(BaseAddress, NULL); if (BaseAddress) { MmUnmapReservedMapping(BaseAddress, - 'MRmK', + PoolTag, Mdl); } @@ -201,7 +231,7 @@ ok(Mapping != NULL, "MmAllocateMappingAddress failed\n"); if (!skip(Mapping != NULL, "No mapping\n")) { - ok_bool_true(ValidateMapping(Mapping, 1, 0, NULL), + ok_bool_true(ValidateMapping(Mapping, 1, 'MRmK', 0, NULL), "ValidateMapping returned"); MmFreeMappingAddress(Mapping, 'MRmK'); @@ -212,7 +242,7 @@ ok(Mapping != NULL, "MmAllocateMappingAddress failed\n"); if (!skip(Mapping != NULL, "No mapping\n")) { - ok_bool_true(ValidateMapping(Mapping, 10, 0, NULL), + ok_bool_true(ValidateMapping(Mapping, 10, 'MRmK', 0, NULL), "ValidateMapping returned"); /* PAGE_FAULT_IN_NONPAGED_AREA can't be caught with SEH */ @@ -221,8 +251,42 @@ (void)*(volatile UCHAR *)Mapping; } - TestMap(Mapping); + TestMap(Mapping, 10, 'MRmK'); MmFreeMappingAddress(Mapping, 'MRmK'); } -} + + /* PoolTag = 0 */ + Mapping = MmAllocateMappingAddress(1, 0); + ok(Mapping == NULL, "MmAllocateMappingAddress failed\n"); + if (Mapping != NULL) + { + MmFreeMappingAddress(Mapping, 0); + } + + /* PoolTag = 1 */ + Mapping = MmAllocateMappingAddress(1, 1); + ok(Mapping != NULL, "MmAllocateMappingAddress failed\n"); + if (Mapping != NULL) + { + ok_bool_true(ValidateMapping(Mapping, 1, 1, 0, NULL), + "ValidateMapping returned"); + + TestMap(Mapping, 1, 1); + + MmFreeMappingAddress(Mapping, 1); + } + + /* Free an unaligned address */ + Mapping = MmAllocateMappingAddress(PAGE_SIZE, 'MRmK'); + ok(Mapping != NULL, "MmAllocateMappingAddress failed\n"); + if (Mapping != NULL) + { + ok_bool_true(ValidateMapping(Mapping, 1, 'MRmK', 0, NULL), + "ValidateMapping returned"); + + TestMap(Mapping, 1, 'MRmK'); + + MmFreeMappingAddress((PUCHAR)Mapping + sizeof(ULONG), 'MRmK'); + } +}
9 years, 3 months
1
0
0
0
[tfaber] 69168: [KMTESTS:MM] - Add a test for MmAllocateMappingAddress/MmMapLockedPagesWithReservedMapping CORE-10147
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Sep 10 09:58:02 2015 New Revision: 69168 URL:
http://svn.reactos.org/svn/reactos?rev=69168&view=rev
Log: [KMTESTS:MM] - Add a test for MmAllocateMappingAddress/MmMapLockedPagesWithReservedMapping CORE-10147 Added: trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c (with props) Modified: trunk/rostests/kmtests/CMakeLists.txt trunk/rostests/kmtests/kmtest_drv/testlist.c Modified: trunk/rostests/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?re…
============================================================================== --- trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] Thu Sep 10 09:58:02 2015 @@ -65,6 +65,7 @@ ntos_ke/KeSpinLock.c ntos_ke/KeTimer.c ntos_mm/MmMdl.c + ntos_mm/MmReservedMapping.c ntos_mm/MmSection.c ntos_mm/ZwAllocateVirtualMemory.c ntos_mm/ZwCreateSection.c Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Thu Sep 10 09:58:02 2015 @@ -41,6 +41,7 @@ KMT_TESTFUNC Test_KernelType; KMT_TESTFUNC Test_MmMdl; KMT_TESTFUNC Test_MmSection; +KMT_TESTFUNC Test_MmReservedMapping; KMT_TESTFUNC Test_NpfsConnect; KMT_TESTFUNC Test_NpfsCreate; KMT_TESTFUNC Test_NpfsFileInfo; @@ -101,6 +102,7 @@ { "-KernelType", Test_KernelType }, { "MmMdl", Test_MmMdl }, { "MmSection", Test_MmSection }, + { "MmReservedMapping", Test_MmReservedMapping }, { "NpfsConnect", Test_NpfsConnect }, { "NpfsCreate", Test_NpfsCreate }, { "NpfsFileInfo", Test_NpfsFileInfo }, Added: trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmReserve…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c (added) +++ trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c [iso-8859-1] Thu Sep 10 09:58:02 2015 @@ -0,0 +1,228 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory + * PURPOSE: Kernel-Mode Test Suite Reserved Mapping test + * PROGRAMMER: Thomas Faber <thomas.faber(a)reactos.org> + */ + +#include <kmt_test.h> + +#ifdef _M_IX86 + +#define PTE_BASE 0xC0000000 +#define MiAddressToPte(x) \ + ((PMMPTE)(((((ULONG)(x)) >> 12) << 2) + PTE_BASE)) +#define MiPteToAddress(_Pte) ((PVOID)((ULONG)(_Pte) << 10)) + +#elif defined(_M_AMD64) + +#define PTI_SHIFT 12L +#define PTE_BASE 0xFFFFF68000000000ULL +PMMPTE +FORCEINLINE +_MiAddressToPte(PVOID Address) +{ + ULONG64 Offset = (ULONG64)Address >> (PTI_SHIFT - 3); + Offset &= 0xFFFFFFFFFULL << 3; + return (PMMPTE)(PTE_BASE + Offset); +} +#define MiAddressToPte(x) _MiAddressToPte((PVOID)(x)) + +#endif + +static +BOOLEAN +ValidateMapping( + _In_ PVOID BaseAddress, + _In_ ULONG TotalPtes, + _In_ ULONG ValidPtes, + _In_ PPFN_NUMBER Pfns) +{ + BOOLEAN Valid = TRUE; +#if defined(_M_IX86) || defined(_M_AMD64) + PMMPTE PointerPte; + ULONG i; + + PointerPte = MiAddressToPte(BaseAddress); + for (i = 0; i < ValidPtes; i++) + { + Valid = Valid && + ok(PointerPte[i].u.Hard.Valid == 1, + "[%lu] PTE %p is not valid\n", i, &PointerPte[i]); + + Valid = Valid && + ok(PointerPte[i].u.Hard.PageFrameNumber == Pfns[i], + "[%lu] PTE %p has PFN %Ix, expected %Ix\n", + i, &PointerPte[i], PointerPte[i].u.Hard.PageFrameNumber, Pfns[i]); + } + for (; i < TotalPtes; i++) + { + Valid = Valid && + ok_eq_hex(PointerPte[i].u.Long, 0UL); + } + Valid = Valid && + ok_eq_tag(PointerPte[-1].u.Long, 'MRmK' & ~1); + Valid = Valid && + ok_eq_ulong(PointerPte[-2].u.Long, (TotalPtes + 2) * 2); +#endif + + return Valid; +} + +static +VOID +TestMap( + _In_ PVOID Mapping) +{ + PMDL Mdl; + PHYSICAL_ADDRESS ZeroPhysical; + PHYSICAL_ADDRESS MaxPhysical; + PVOID BaseAddress; + PPFN_NUMBER MdlPages; + ULONG i; + + ZeroPhysical.QuadPart = 0; + MaxPhysical.QuadPart = 0xffffffffffffffffLL; + + /* Create a one-page MDL and map it */ + Mdl = MmAllocatePagesForMdlEx(ZeroPhysical, + MaxPhysical, + ZeroPhysical, + PAGE_SIZE, + MmCached, + 0); + if (skip(Mdl != NULL, "No MDL\n")) + { + return; + } + + MdlPages = (PVOID)(Mdl + 1); + + BaseAddress = MmMapLockedPagesWithReservedMapping(Mapping, + 'MRmK', + Mdl, + MmCached); + if (BaseAddress) + { + ok_eq_pointer(BaseAddress, Mapping); + + ok_bool_true(ValidateMapping(BaseAddress, 10, 1, MdlPages), + "ValidateMapping returned"); + + KmtStartSeh() + *(volatile ULONG *)BaseAddress = 0x01234567; + KmtEndSeh(STATUS_SUCCESS); + + MmUnmapReservedMapping(BaseAddress, + 'MRmK', + Mdl); + + ok_bool_true(ValidateMapping(Mapping, 10, 0, NULL), + "ValidateMapping returned"); + } + + MmFreePagesFromMdl(Mdl); + + /* Map all pages */ + Mdl = MmAllocatePagesForMdlEx(ZeroPhysical, + MaxPhysical, + ZeroPhysical, + 10 * PAGE_SIZE, + MmCached, + 0); + if (skip(Mdl != NULL, "No MDL\n")) + { + return; + } + + MdlPages = (PVOID)(Mdl + 1); + + BaseAddress = MmMapLockedPagesWithReservedMapping(Mapping, + 'MRmK', + Mdl, + MmCached); + if (BaseAddress) + { + ok_eq_pointer(BaseAddress, Mapping); + + ok_bool_true(ValidateMapping(BaseAddress, 10, 10, MdlPages), + "ValidateMapping returned"); + + for (i = 0; i < 10; i++) + { + KmtStartSeh() + *((volatile ULONG *)BaseAddress + i * PAGE_SIZE / sizeof(ULONG)) = 0x01234567; + KmtEndSeh(STATUS_SUCCESS); + } + + MmUnmapReservedMapping(BaseAddress, + 'MRmK', + Mdl); + + ok_bool_true(ValidateMapping(Mapping, 10, 0, NULL), + "ValidateMapping returned"); + } + + MmFreePagesFromMdl(Mdl); + + /* Try to map more pages than we reserved */ + Mdl = MmAllocatePagesForMdlEx(ZeroPhysical, + MaxPhysical, + ZeroPhysical, + 11 * PAGE_SIZE, + MmCached, + 0); + if (skip(Mdl != NULL, "No MDL\n")) + { + return; + } + + BaseAddress = MmMapLockedPagesWithReservedMapping(Mapping, + 'MRmK', + Mdl, + MmCached); + ok_eq_pointer(BaseAddress, NULL); + if (BaseAddress) + { + MmUnmapReservedMapping(BaseAddress, + 'MRmK', + Mdl); + } + + MmFreePagesFromMdl(Mdl); +} + +START_TEST(MmReservedMapping) +{ + PVOID Mapping; + + /* one byte - single page */ + Mapping = MmAllocateMappingAddress(1, 'MRmK'); + ok(Mapping != NULL, "MmAllocateMappingAddress failed\n"); + if (!skip(Mapping != NULL, "No mapping\n")) + { + ok_bool_true(ValidateMapping(Mapping, 1, 0, NULL), + "ValidateMapping returned"); + + MmFreeMappingAddress(Mapping, 'MRmK'); + } + + /* 10 pages */ + Mapping = MmAllocateMappingAddress(10 * PAGE_SIZE, 'MRmK' & ~1); + ok(Mapping != NULL, "MmAllocateMappingAddress failed\n"); + if (!skip(Mapping != NULL, "No mapping\n")) + { + ok_bool_true(ValidateMapping(Mapping, 10, 0, NULL), + "ValidateMapping returned"); + + /* PAGE_FAULT_IN_NONPAGED_AREA can't be caught with SEH */ + if (0) + { + (void)*(volatile UCHAR *)Mapping; + } + + TestMap(Mapping); + + MmFreeMappingAddress(Mapping, 'MRmK'); + } +} Propchange: trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c ------------------------------------------------------------------------------ svn:eol-style = native
9 years, 3 months
1
0
0
0
[ion] 69167: [BOOTMGFW] - UNIX strikes again.
by ion@svn.reactos.org
Author: ion Date: Thu Sep 10 05:24:50 2015 New Revision: 69167 URL:
http://svn.reactos.org/svn/reactos?rev=69167&view=rev
Log: [BOOTMGFW] - UNIX strikes again. Modified: trunk/reactos/boot/environ/lib/io/fat.c Modified: trunk/reactos/boot/environ/lib/io/fat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/fat.c?…
============================================================================== --- trunk/reactos/boot/environ/lib/io/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/fat.c [iso-8859-1] Thu Sep 10 05:24:50 2015 @@ -9,7 +9,7 @@ /* INCLUDES ******************************************************************/ #include "bl.h" -#include "..\drivers\filesystems\fs_rec\fs_rec.h" +#include "../drivers/filesystems/fs_rec/fs_rec.h" /* DATA VARIABLES ************************************************************/
9 years, 3 months
1
0
0
0
[ion] 69166: [BOOTMGFW]: - Implement read/offset-read frontend interface.
by ion@svn.reactos.org
Author: ion Date: Thu Sep 10 05:19:50 2015 New Revision: 69166 URL:
http://svn.reactos.org/svn/reactos?rev=69166&view=rev
Log: [BOOTMGFW]: - Implement read/offset-read frontend interface. Modified: trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/io/device.c trunk/reactos/boot/environ/lib/io/fat.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Thu Sep 10 05:19:50 2015 @@ -472,7 +472,10 @@ typedef NTSTATUS (*PBL_DEVICE_READ) ( - VOID + _In_ struct _BL_DEVICE_ENTRY* DeviceEntry, + _In_ PVOID Buffer, + _In_ ULONG Size, + _Out_ PULONG BytesRead ); typedef @@ -491,7 +494,8 @@ typedef NTSTATUS (*PBL_DEVICE_SET_INFORMATION) ( - VOID + _In_ struct _BL_DEVICE_ENTRY* DeviceEntry, + _In_ struct _BL_DEVICE_INFORMATION* DeviceInformation ); typedef @@ -894,6 +898,9 @@ BL_PARTITION_TYPE PartitionType; ULONG BlockSize; ULONG Alignment; + ULONGLONG MaxBlock; + ULONGLONG Offset; + ULONG Block; struct { union @@ -1481,6 +1488,21 @@ BlDeviceGetInformation ( _In_ ULONG DeviceId, _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ); + +NTSTATUS +BlDeviceSetInformation ( + _In_ ULONG DeviceId, + _In_ PBL_DEVICE_INFORMATION DeviceInformation + ); + +NTSTATUS +BlDeviceReadAtOffset ( + _In_ ULONG DeviceId, + _In_ ULONG Size, + _In_ ULONGLONG Offset, + _In_ PVOID Buffer, + _Out_ PULONG BytesRead ); /* FILE I/O ROUTINES *********************************************************/ Modified: trunk/reactos/boot/environ/lib/io/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/device…
============================================================================== --- trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] Thu Sep 10 05:19:50 2015 @@ -14,10 +14,8 @@ typedef struct _BL_DEVICE_IO_INFORMATION { - ULONG Unknown0; - ULONG Unknown1; - ULONG Unknown2; - ULONG Unknown3; + ULONGLONG ReadCount; + ULONGLONG WriteCount; } BL_DEVICE_IO_INFORMATION, *PBL_DEVICE_IO_INFORMATION; LIST_ENTRY DmRegisteredDevices; @@ -69,6 +67,12 @@ _Out_ PBL_DEVICE_INFORMATION DeviceInformation ); +NTSTATUS +BlockIoSetInformation ( + _In_ PBL_DEVICE_ENTRY DeviceEntry, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ); + BL_DEVICE_CALLBACKS BlockIoDeviceFunctionTable = { NULL, @@ -76,8 +80,32 @@ NULL, NULL, NULL, - BlockIoGetInformation + BlockIoGetInformation, + BlockIoSetInformation }; + +NTSTATUS +BlockIoSetInformation ( + _In_ PBL_DEVICE_ENTRY DeviceEntry, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ) +{ + PBL_BLOCK_DEVICE BlockDevice; + ULONGLONG Offset; + + BlockDevice = DeviceEntry->DeviceSpecificData; + + Offset = DeviceInformation->BlockDeviceInfo.Block * BlockDevice->BlockSize + DeviceInformation->BlockDeviceInfo.Offset; + if (Offset > ((BlockDevice->MaxBlock + 1) * BlockDevice->BlockSize - 1)) + { + return STATUS_INVALID_PARAMETER; + } + + BlockDevice->Block = Offset / BlockDevice->BlockSize; + BlockDevice->Offset = Offset % BlockDevice->BlockSize; + BlockDevice->Unknown = DeviceInformation->BlockDeviceInfo.Unknown; + return STATUS_SUCCESS; +} NTSTATUS BlockIoGetInformation ( @@ -97,6 +125,39 @@ } NTSTATUS +BlDeviceSetInformation ( + _In_ ULONG DeviceId, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ) +{ + PBL_DEVICE_ENTRY DeviceEntry; + + if (!(DeviceInformation)) + { + return STATUS_INVALID_PARAMETER; + } + + if (DmTableEntries <= DeviceId) + { + return STATUS_INVALID_PARAMETER; + } + + DeviceEntry = DmDeviceTable[DeviceId]; + if (!DeviceEntry) + { + return STATUS_INVALID_PARAMETER; + } + + if (!(DeviceEntry->Flags & 1)) + { + return STATUS_INVALID_PARAMETER; + } + + DeviceInformation->DeviceType = DeviceEntry->DeviceDescriptor->DeviceType; + return DeviceEntry->Callbacks.SetInformation(DeviceEntry, DeviceInformation); +} + +NTSTATUS BlDeviceGetInformation ( _In_ ULONG DeviceId, _Out_ PBL_DEVICE_INFORMATION DeviceInformation @@ -128,6 +189,73 @@ DeviceInformation->DeviceType = DeviceEntry->DeviceDescriptor->DeviceType; return DeviceEntry->Callbacks.GetInformation(DeviceEntry, DeviceInformation); } + +NTSTATUS +BlDeviceRead ( + _In_ ULONG DeviceId, + _In_ PVOID Buffer, + _In_ ULONG Size, + _Out_ PULONG BytesRead + ) +{ + PBL_DEVICE_ENTRY DeviceEntry; // ecx@3 + NTSTATUS Status; + ULONG BytesTransferred; + + if (Buffer + && DmTableEntries > DeviceId + && (DeviceEntry = DmDeviceTable[DeviceId]) != 0 + && DeviceEntry->Flags & 1 + && DeviceEntry->Flags & 2) + { + EfiPrintf(L"Calling read...\r\n"); + Status = DeviceEntry->Callbacks.Read(DeviceEntry, Buffer, Size, &BytesTransferred); + + if (!DeviceEntry->Unknown) + { + DmDeviceIoInformation.ReadCount += BytesTransferred; + } + + if (BytesRead) + { + *BytesRead = BytesTransferred; + } + } + else + { + Status = STATUS_INVALID_PARAMETER; + } + return Status; +} + +NTSTATUS +BlDeviceReadAtOffset ( + _In_ ULONG DeviceId, + _In_ ULONG Size, + _In_ ULONGLONG Offset, + _In_ PVOID Buffer, + _Out_ PULONG BytesRead + ) +{ + NTSTATUS Status; + BL_DEVICE_INFORMATION DeviceInformation; + + Status = BlDeviceGetInformation(DeviceId, &DeviceInformation); + if (Status >= 0) + { + DeviceInformation.BlockDeviceInfo.Block = Offset / DeviceInformation.BlockDeviceInfo.BlockSize; + DeviceInformation.BlockDeviceInfo.Offset = Offset % DeviceInformation.BlockDeviceInfo.BlockSize; + Status = BlDeviceSetInformation(DeviceId, &DeviceInformation); + + if (NT_SUCCESS(Status)) + { + EfiPrintf(L"Block: %d Offset: %d\r\n", DeviceInformation.BlockDeviceInfo.Block, DeviceInformation.BlockDeviceInfo.Offset); + Status = BlDeviceRead(DeviceId, Buffer, Size, BytesRead); + } + } + return Status; +} + BOOLEAN BlpDeviceCompare ( @@ -1496,10 +1624,8 @@ InitializeListHead(&DmRegisteredDevices); /* Initialize device information */ - DmDeviceIoInformation.Unknown0 = 0; - DmDeviceIoInformation.Unknown1 = 0; - DmDeviceIoInformation.Unknown2 = 0; - DmDeviceIoInformation.Unknown3 = 0; + DmDeviceIoInformation.ReadCount = 0; + DmDeviceIoInformation.WriteCount = 0; /* Allocate the device table */ DmDeviceTable = BlMmAllocateHeap(DmTableEntries * sizeof(PVOID)); Modified: trunk/reactos/boot/environ/lib/io/fat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/fat.c?…
============================================================================== --- trunk/reactos/boot/environ/lib/io/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/fat.c [iso-8859-1] Thu Sep 10 05:19:50 2015 @@ -9,6 +9,7 @@ /* INCLUDES ******************************************************************/ #include "bl.h" +#include "..\drivers\filesystems\fs_rec\fs_rec.h" /* DATA VARIABLES ************************************************************/ @@ -25,7 +26,39 @@ _Out_ PBL_FILE_ENTRY* FileEntry ) { - EfiPrintf(L"FAT Mount on Device %d TODO\r\n", DeviceId); + BL_DEVICE_INFORMATION DeviceInformation; + ULONG UnknownFlag; + NTSTATUS Status; + PACKED_BOOT_SECTOR FatBootSector; + + EfiPrintf(L"FAT Mount on Device %d\r\n", DeviceId); + + /* Capture thing */ + BlDeviceGetInformation(DeviceId, &DeviceInformation); + UnknownFlag = DeviceInformation.BlockDeviceInfo.Unknown; + + /* Set thing to 1 */ + DeviceInformation.BlockDeviceInfo.Unknown |= 1; + BlDeviceSetInformation(DeviceId, &DeviceInformation); + + /* Read the boot sector */ + EfiPrintf(L"Reading fat boot sector...\r\n"); + Status = BlDeviceReadAtOffset(DeviceId, + sizeof(FatBootSector), + 0, + &FatBootSector, + NULL); + + /* Restore thing back */ + DeviceInformation.BlockDeviceInfo.Unknown = UnknownFlag; + BlDeviceSetInformation(DeviceId, &DeviceInformation); + if (!NT_SUCCESS(Status)) + { + EfiPrintf(L"Failed reading drive: %lx\r\n", Status); + return Status; + } + + EfiPrintf(L"Drive read\r\n"); EfiStall(3000000); return STATUS_NOT_IMPLEMENTED; }
9 years, 3 months
1
0
0
0
[ion] 69165: [BOOTMGFW] - Implement initial File I/O routines. - We now die on attempting to mount the FAT volume.
by ion@svn.reactos.org
Author: ion Date: Thu Sep 10 04:01:41 2015 New Revision: 69165 URL:
http://svn.reactos.org/svn/reactos?rev=69165&view=rev
Log: [BOOTMGFW] - Implement initial File I/O routines. - We now die on attempting to mount the FAT volume. Modified: trunk/reactos/boot/environ/app/bootmgr/bootmgr.c trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/io/device.c trunk/reactos/boot/environ/lib/io/fat.c trunk/reactos/boot/environ/lib/io/file.c Modified: trunk/reactos/boot/environ/app/bootmgr/bootmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/bootmgr/b…
============================================================================== --- trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] Thu Sep 10 04:01:41 2015 @@ -180,8 +180,7 @@ /* Try to open the file */ EfiPrintf(L"Opening: %s\r\n", FinalPath); -#if 0 - Status = BlFileOpen(DeviceHandle, FinalPath, 1u, &FileHandle); + Status = BlFileOpen(DeviceHandle, FinalPath, 1, &FileHandle); if (!NT_SUCCESS(Status)) { BootDirectory = BcdDirectory; @@ -189,7 +188,6 @@ } BootDirectory = L"\\EFI\\Microsoft\\Boot"; -#endif Quickie: /* Free all the allocations we made */ @@ -205,7 +203,7 @@ /* Close the BCD file */ if (FileHandle != -1) { - //Status = BlFileClose(FileHandle); + Status = BlFileClose(FileHandle); } /* Close the boot device */ Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Thu Sep 10 04:01:41 2015 @@ -265,6 +265,52 @@ /* CALLBACKS *****************************************************************/ +struct _BL_FILE_ENTRY; +typedef +NTSTATUS +(*PBL_FILE_OPEN) ( + _In_ struct _BL_FILE_ENTRY* ParentFileEntry, + _In_ PWCHAR FileName, + _In_ ULONG OpenFlags, + _Out_ struct _BL_FILE_ENTRY** FileEntry + ); + +typedef +NTSTATUS +(*PBL_FILE_CLOSE) ( + _In_ struct _BL_FILE_ENTRY* FileEntry + ); + +typedef +NTSTATUS +(*PBL_FILE_READ) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_FILE_WRITE) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_FILE_GET_NEXT) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_FILE_GET_INFO) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_FILE_SET_INFO) ( + VOID + ); + typedef NTSTATUS (*PBL_FS_INIT_CALLBACK) ( @@ -280,7 +326,9 @@ typedef NTSTATUS (*PBL_FS_MOUNT_CALLBACK) ( - VOID + _In_ ULONG DeviceId, + _In_ ULONG Unknown, + _Out_ struct _BL_FILE_ENTRY** FileEntry ); typedef @@ -397,6 +445,73 @@ _In_ struct _BL_HASH_ENTRY* Entry, _In_ ULONG TableSize ); + +struct _BL_DEVICE_ENTRY; +struct _BL_DEVICE_DESCRIPTOR; +struct _BL_DEVICE_INFORMATION; + +typedef +NTSTATUS +(*PBL_DEVICE_ENUMERATE_DEVICE_CLASS) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_DEVICE_OPEN) ( + _In_ struct _BL_DEVICE_DESCRIPTOR* Device, + _In_ struct _BL_DEVICE_ENTRY* DeviceEntry + ); + +typedef +NTSTATUS +(*PBL_DEVICE_CLOSE) ( + _In_ struct _BL_DEVICE_ENTRY* DeviceEntry + ); + +typedef +NTSTATUS +(*PBL_DEVICE_READ) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_DEVICE_WRITE) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_DEVICE_GET_INFORMATION) ( + _In_ struct _BL_DEVICE_ENTRY* DeviceEntry, + _Out_ struct _BL_DEVICE_INFORMATION* DeviceInformation + ); + +typedef +NTSTATUS +(*PBL_DEVICE_SET_INFORMATION) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_DEVICE_RESET) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_DEVICE_FLUSH) ( + VOID + ); + +typedef +NTSTATUS +(*PBL_DEVICE_CREATE) ( + VOID + ); + /* DATA STRUCTURES ***********************************************************/ @@ -626,9 +741,28 @@ ULONGLONG Maximum; } BL_ADDRESS_RANGE, *PBL_ADDRESS_RANGE; +typedef struct _BL_FILE_CALLBACKS +{ + PBL_FILE_OPEN Open; + PBL_FILE_CLOSE Close; + PBL_FILE_READ Read; + PBL_FILE_WRITE Write; + PBL_FILE_GET_NEXT GetNext; + PBL_FILE_GET_INFO GetInfo; + PBL_FILE_SET_INFO SetInfo; +} BL_FILE_CALLBACKS, *PBL_FILE_CALLBACKS; + typedef struct _BL_FILE_ENTRY { - ULONG DeviceIndex; + ULONG ReferenceCount; + ULONG FileId; + ULONG DeviceId; + ULONG Flags; + PWCHAR FilePath; + ULONG Unknown; + ULONG Unknown1; + ULONG Unknown2; + BL_FILE_CALLBACKS Callbacks; PBL_FILE_DESTROY_CALLBACK DestroyCallback; } BL_FILE_ENTRY, *PBL_FILE_ENTRY; @@ -752,7 +886,7 @@ BL_HASH_VALUE Value; } BL_HASH_NODE, *PBL_HASH_NODE; -typedef struct _BL_BLOCK_DEVICE +typedef struct _BL_BLOCK_DEVICE_INFORMATION { BL_LOCAL_DEVICE_TYPE Type; ULONG DeviceFlags; @@ -774,6 +908,20 @@ } Gpt; }; } Disk; +} BL_BLOCK_DEVICE_INFORMATION, *PBL_BLOCK_DEVICE_INFORMATION; + +typedef struct _BL_DEVICE_INFORMATION +{ + BL_DEVICE_TYPE DeviceType; + union + { + BL_BLOCK_DEVICE_INFORMATION BlockDeviceInfo; + }; +} BL_DEVICE_INFORMATION, *PBL_DEVICE_INFORMATION; + +typedef struct _BL_BLOCK_DEVICE +{ + BL_BLOCK_DEVICE_INFORMATION; ULONGLONG LastBlock; EFI_BLOCK_IO* Protocol; EFI_HANDLE Handle; @@ -784,6 +932,31 @@ EFI_HANDLE Handle; PVOID Interface; } BL_PROTOCOL_HANDLE, *PBL_PROTOCOL_HANDLE; + +typedef struct _BL_DEVICE_CALLBACKS +{ + PBL_DEVICE_ENUMERATE_DEVICE_CLASS EnumerateDeviceClass; + PBL_DEVICE_OPEN Open; + PBL_DEVICE_CLOSE Close; + PBL_DEVICE_READ Read; + PBL_DEVICE_WRITE Write; + PBL_DEVICE_GET_INFORMATION GetInformation; + PBL_DEVICE_SET_INFORMATION SetInformation; + PBL_DEVICE_RESET Reset; + PBL_DEVICE_FLUSH Flush; + PBL_DEVICE_CREATE Create; +} BL_DEVICE_CALLBACKS, *PBL_DEVICE_CALLBACKS; + +typedef struct _BL_DEVICE_ENTRY +{ + ULONG DeviceId; + ULONG Flags; + ULONG Unknown; + ULONG ReferenceCount; + BL_DEVICE_CALLBACKS Callbacks; + PVOID DeviceSpecificData; + PBL_DEVICE_DESCRIPTOR DeviceDescriptor; +} BL_DEVICE_ENTRY, *PBL_DEVICE_ENTRY; /* INLINE ROUTINES ***********************************************************/ @@ -894,11 +1067,6 @@ ); NTSTATUS -FatInitialize ( - VOID - ); - -NTSTATUS BlpDisplayInitialize ( _In_ ULONG Flags ); @@ -1034,6 +1202,20 @@ NTSTATUS BlpTimeCalibratePerformanceCounter ( VOID + ); + +/* FILESYSTEM ROUTINES *******************************************************/ + +NTSTATUS +FatInitialize ( + VOID + ); + +NTSTATUS +FatMount ( + _In_ ULONG DeviceId, + _In_ ULONG Unknown, + _Out_ PBL_FILE_ENTRY* FileEntry ); /* UTILITY ROUTINES **********************************************************/ @@ -1293,6 +1475,27 @@ _In_ ULONG Flags, _In_ ULONG Unknown, _Out_ PULONG DeviceId + ); + +NTSTATUS +BlDeviceGetInformation ( + _In_ ULONG DeviceId, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ); + +/* FILE I/O ROUTINES *********************************************************/ + +NTSTATUS +BlFileClose ( + _In_ ULONG FileId + ); + +NTSTATUS +BlFileOpen ( + _In_ ULONG DeviceId, + _In_ PWCHAR FileName, + _In_ ULONG OpenFlags, + _Out_ PULONG FileId ); /* TEXT CONSOLE ROUTINES *****************************************************/ Modified: trunk/reactos/boot/environ/lib/io/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/device…
============================================================================== --- trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/device.c [iso-8859-1] Thu Sep 10 04:01:41 2015 @@ -12,110 +12,22 @@ /* DATA VARIABLES ************************************************************/ -typedef struct _BL_DEVICE_INFORMATION +typedef struct _BL_DEVICE_IO_INFORMATION { ULONG Unknown0; ULONG Unknown1; ULONG Unknown2; ULONG Unknown3; -} BL_DEVICE_INFORMATION, *PBL_DEVICE_INFORMATION; +} BL_DEVICE_IO_INFORMATION, *PBL_DEVICE_IO_INFORMATION; LIST_ENTRY DmRegisteredDevices; ULONG DmTableEntries; LIST_ENTRY DmRegisteredDevices; PVOID* DmDeviceTable; -BL_DEVICE_INFORMATION DmDeviceIoInformation; +BL_DEVICE_IO_INFORMATION DmDeviceIoInformation; /* FUNCTIONS *****************************************************************/ - -struct _BL_DEVICE_ENTRY; - -typedef -NTSTATUS -(*PBL_DEVICE_ENUMERATE_DEVICE_CLASS) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_OPEN) ( - _In_ PBL_DEVICE_DESCRIPTOR Device, - _In_ struct _BL_DEVICE_ENTRY* DeviceEntry - ); - -typedef -NTSTATUS -(*PBL_DEVICE_CLOSE) ( - _In_ struct _BL_DEVICE_ENTRY* DeviceEntry - ); - -typedef -NTSTATUS -(*PBL_DEVICE_READ) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_WRITE) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_GET_INFORMATION) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_SET_INFORMATION) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_RESET) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_FLUSH) ( - VOID - ); - -typedef -NTSTATUS -(*PBL_DEVICE_CREATE) ( - VOID - ); - -typedef struct _BL_DEVICE_CALLBACKS -{ - PBL_DEVICE_ENUMERATE_DEVICE_CLASS EnumerateDeviceClass; - PBL_DEVICE_OPEN Open; - PBL_DEVICE_CLOSE Close; - PBL_DEVICE_READ Read; - PBL_DEVICE_WRITE Write; - PBL_DEVICE_GET_INFORMATION GetInformation; - PBL_DEVICE_SET_INFORMATION SetInformation; - PBL_DEVICE_RESET Reset; - PBL_DEVICE_FLUSH Flush; - PBL_DEVICE_CREATE Create; -} BL_DEVICE_CALLBACKS, *PBL_DEVICE_CALLBACKS; - -typedef struct _BL_DEVICE_ENTRY -{ - ULONG DeviceId; - ULONG Flags; - ULONG Unknown; - ULONG ReferenceCount; - BL_DEVICE_CALLBACKS Callbacks; - PVOID DeviceSpecificData; - PBL_DEVICE_DESCRIPTOR DeviceDescriptor; -} BL_DEVICE_ENTRY, *PBL_DEVICE_ENTRY; typedef struct _BL_REGISTERED_DEVICE { @@ -151,12 +63,71 @@ _In_ PBL_DEVICE_ENTRY DeviceEntry ); +NTSTATUS +BlockIoGetInformation ( + _In_ PBL_DEVICE_ENTRY DeviceEntry, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ); + BL_DEVICE_CALLBACKS BlockIoDeviceFunctionTable = { NULL, BlockIoOpen, NULL, + NULL, + NULL, + BlockIoGetInformation }; + +NTSTATUS +BlockIoGetInformation ( + _In_ PBL_DEVICE_ENTRY DeviceEntry, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ) +{ + PBL_BLOCK_DEVICE BlockDevice; + + BlockDevice = DeviceEntry->DeviceSpecificData; + + RtlCopyMemory(&DeviceInformation->BlockDeviceInfo, + BlockDevice, + sizeof(DeviceInformation->BlockDeviceInfo)); + DeviceInformation->DeviceType = DiskDevice; + return STATUS_SUCCESS; +} + +NTSTATUS +BlDeviceGetInformation ( + _In_ ULONG DeviceId, + _Out_ PBL_DEVICE_INFORMATION DeviceInformation + ) +{ + PBL_DEVICE_ENTRY DeviceEntry; + + if (!(DeviceInformation)) + { + return STATUS_INVALID_PARAMETER; + } + + if (DmTableEntries <= DeviceId) + { + return STATUS_INVALID_PARAMETER; + } + + DeviceEntry = DmDeviceTable[DeviceId]; + if (!DeviceEntry) + { + return STATUS_INVALID_PARAMETER; + } + + if (!(DeviceEntry->Flags & 1)) + { + return STATUS_INVALID_PARAMETER; + } + + DeviceInformation->DeviceType = DeviceEntry->DeviceDescriptor->DeviceType; + return DeviceEntry->Callbacks.GetInformation(DeviceEntry, DeviceInformation); +} BOOLEAN BlpDeviceCompare ( @@ -879,8 +850,6 @@ NULL, }; - - BL_DEVICE_CALLBACKS UdpFunctionTable = { NULL, @@ -894,9 +863,6 @@ SpOpen, NULL, }; - - - BOOLEAN DeviceTableCompare ( Modified: trunk/reactos/boot/environ/lib/io/fat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/fat.c?…
============================================================================== --- trunk/reactos/boot/environ/lib/io/fat.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/fat.c [iso-8859-1] Thu Sep 10 04:01:41 2015 @@ -17,6 +17,18 @@ PWCHAR FatpLongFileName; /* FUNCTIONS *****************************************************************/ + +NTSTATUS +FatMount ( + _In_ ULONG DeviceId, + _In_ ULONG Unknown, + _Out_ PBL_FILE_ENTRY* FileEntry + ) +{ + EfiPrintf(L"FAT Mount on Device %d TODO\r\n", DeviceId); + EfiStall(3000000); + return STATUS_NOT_IMPLEMENTED; +} NTSTATUS FatInitialize ( Modified: trunk/reactos/boot/environ/lib/io/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/file.c…
============================================================================== --- trunk/reactos/boot/environ/lib/io/file.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/file.c [iso-8859-1] Thu Sep 10 04:01:41 2015 @@ -19,14 +19,459 @@ BL_FILE_SYSTEM_REGISTRATION_TABLE FatRegisterFunctionTable = { FatInitialize, -#if 0 - FatDestroy, + NULL, FatMount, NULL -#endif }; +extern ULONG DmTableEntries; +extern PVOID* DmDeviceTable; + /* FUNCTIONS *****************************************************************/ + +PWCHAR +FileIoCopyParentDirectoryPath ( + _In_ PWCHAR FilePath + ) +{ + ULONG PathSize, PathSizeWithNull; + PWCHAR Backslash, ParentCopy; + + PathSize = wcslen(FilePath) * sizeof(WCHAR); + + PathSizeWithNull = PathSize + sizeof(UNICODE_NULL); + if (PathSizeWithNull < PathSize) + { + return NULL; + } + + ParentCopy = BlMmAllocateHeap(PathSizeWithNull); + if (!ParentCopy) + { + return NULL; + } + wcsncpy(ParentCopy, FilePath, PathSizeWithNull / sizeof(WCHAR)); + + Backslash = wcsrchr(ParentCopy, '\\'); + if (!Backslash) + { + BlMmFreeHeap(ParentCopy); + return NULL; + } + + if (Backslash == ParentCopy) + { + ++Backslash; + } + + *Backslash = UNICODE_NULL; + return ParentCopy; +} + +PWCHAR +FileIoCopyFileName ( + _In_ PWCHAR FilePath + ) +{ + PWCHAR Separator, FileCopy; + ULONG PathSize; + + Separator = wcsrchr(FilePath, '\\'); + if (!Separator) + { + return NULL; + } + + PathSize = wcslen(Separator) * sizeof(WCHAR); + + FileCopy = BlMmAllocateHeap(PathSize); + if (!FileCopy) + { + return NULL; + } + + wcsncpy(FileCopy, Separator + 1, PathSize / sizeof(WCHAR)); + return FileCopy; +} + +BOOLEAN +FileTableCompareWithSubsetAttributes ( + _In_ PVOID Entry, + _In_ PVOID Argument1, + _In_ PVOID Argument2, + _In_ PVOID Argument3, + _In_ PVOID Argument4 + ) +{ + PBL_FILE_ENTRY FileEntry = (PBL_FILE_ENTRY)Entry; + ULONG DeviceId = *(PULONG)Argument1; + PWCHAR FilePath = (PWCHAR)Argument2; + ULONG OpenFlags = *(PULONG)Argument3; + ULONG Unknown = *(PULONG)Argument4; + BOOLEAN Found; + + Found = FALSE; + + if ((FileEntry->DeviceId == DeviceId) && !(_wcsicmp(FileEntry->FilePath, FilePath)) && (FileEntry->Unknown == Unknown)) + { + if ((!(OpenFlags & 1) || (FileEntry->Flags & 2)) && (!(OpenFlags & 2) || (FileEntry->Flags & 4))) + { + if ((!(OpenFlags & 4) || (FileEntry->Flags & 0x10000)) && ((OpenFlags & 4) || !(FileEntry->Flags & 0x10000))) + { + Found = TRUE; + } + } + } + return Found; +} + +BOOLEAN +FileTableCompareWithSameAttributes ( + _In_ PVOID Entry, + _In_ PVOID Argument1, + _In_ PVOID Argument2, + _In_ PVOID Argument3, + _In_ PVOID Argument4 + ) +{ + PBL_FILE_ENTRY FileEntry = (PBL_FILE_ENTRY)Entry; + ULONG DeviceId = *(PULONG)Argument1; + PWCHAR FilePath = (PWCHAR)Argument2; + ULONG OpenFlags = *(PULONG)Argument3; + ULONG Unknown = *(PULONG)Argument4; + BOOLEAN Found; + + Found = FALSE; + + if ((FileEntry->DeviceId == DeviceId) && !(_wcsicmp(FileEntry->FilePath, FilePath)) && (FileEntry->Unknown == Unknown)) + { + if ((!(OpenFlags & 1) || (FileEntry->Flags & 2)) && ((OpenFlags & 1) || !(FileEntry->Flags & 2)) && (!(OpenFlags & 2) || (FileEntry->Flags & 4)) && ((OpenFlags & 2) || !(FileEntry->Flags & 4))) + { + if ((!(OpenFlags & 4) || (FileEntry->Flags & 0x10000)) && ((OpenFlags & 4) || !(FileEntry->Flags & 0x10000))) + { + Found = TRUE; + } + } + } + return Found; +} + +NTSTATUS +FileTableDestroyEntry ( + _In_ PBL_FILE_ENTRY FileEntry, + _In_ ULONG Index + ) +{ + ULONG DeviceId; + PBL_DEVICE_ENTRY DeviceEntry; + NTSTATUS Status; + + DeviceId = FileEntry->DeviceId; + if (DmTableEntries > DeviceId) + { + DeviceEntry = DmDeviceTable[DeviceId]; + if (DeviceEntry) + { + --DeviceEntry->ReferenceCount; + } + } + + Status = FileEntry->Callbacks.Close(FileEntry); + + BlMmFreeHeap(FileEntry); + + FileTable[Index] = NULL; + return Status; +} + +NTSTATUS +FileTablePurgeEntry ( + _In_ PVOID Entry + ) +{ + PBL_FILE_ENTRY FileEntry = (PBL_FILE_ENTRY)Entry; + NTSTATUS Status; + + if (((FileEntry->Flags & 1) || (FileEntry->Flags & 0x10000)) && (FileEntries < 0x200)) + { + Status = STATUS_UNSUCCESSFUL; + } + else + { + Status = FileTableDestroyEntry(FileEntry, FileEntry->FileId); + } + + return Status; +} + +NTSTATUS +BlFileClose ( + _In_ ULONG FileId + ) +{ + PBL_FILE_ENTRY FileEntry; + + if (FileEntries <= FileId) + { + return STATUS_INVALID_PARAMETER; + } + + FileEntry = FileTable[FileId]; + if (!FileEntry) + { + return STATUS_INVALID_PARAMETER; + } + + if (!(FileEntry->Flags & 1)) + { + return STATUS_INVALID_PARAMETER; + } + + --FileEntry->ReferenceCount; + if (!FileEntry->ReferenceCount) + { + FileEntry->Flags &= ~1; + } + + return STATUS_SUCCESS; +} + +NTSTATUS +FileIoOpen ( + _In_ ULONG DeviceId, + _In_ PWCHAR FileName, + _In_ ULONG OpenFlags, + _In_ ULONG Unknown, + _In_ PBL_TBL_LOOKUP_ROUTINE CompareRoutine, + _Out_ PBL_FILE_ENTRY *ReturnFileEntry + ) +{ + PWCHAR FileNameCopy, ParentFileName; + NTSTATUS Status; + PBL_DEVICE_ENTRY DeviceEntry; + PBL_FILE_SYSTEM_ENTRY FileSystem; + ULONG FileId; + PBL_FILE_ENTRY ParentDirectoryEntry, FileEntry; + PLIST_ENTRY NextEntry, ListHead; + + ParentDirectoryEntry = NULL; + FileNameCopy = NULL; + OpenFlags |= 1; + ParentFileName = NULL; + Status = STATUS_SUCCESS; + + if (DmTableEntries <= DeviceId) + { + return STATUS_ACCESS_DENIED; + } + + DeviceEntry = DmDeviceTable[DeviceId]; + if (!DeviceEntry) + { + return STATUS_ACCESS_DENIED; + } + + if ((OpenFlags & 1) && (!(DeviceEntry->Flags & 1) || !(DeviceEntry->Flags & 2))) + { + EfiPrintf(L"Access denied\r\n"); + return STATUS_ACCESS_DENIED; + } + + if ((OpenFlags & 2) && (!(DeviceEntry->Flags & 1) || !(DeviceEntry->Flags & 4))) + { + EfiPrintf(L"Access denied2\r\n"); + return STATUS_ACCESS_DENIED; + } + + FileEntry = (PBL_FILE_ENTRY )BlTblFindEntry(FileTable, + FileEntries, + &FileId, + CompareRoutine, + &DeviceId, + FileName, + &OpenFlags, + &Unknown); + if (FileEntry) + { + EfiPrintf(L"Entry exists: %p\n", FileEntry); + goto FileOpened; + } + + if ((*FileName != OBJ_NAME_PATH_SEPARATOR) || (FileName[1])) + { + ParentFileName = FileIoCopyParentDirectoryPath(FileName); + if (!ParentFileName) + { + Status = STATUS_NO_MEMORY; + goto FileOpenEnd; + } + + Status = FileIoOpen(DeviceId, + ParentFileName, + 5, + Unknown, + FileTableCompareWithSubsetAttributes, + &ParentDirectoryEntry); + if (Status < 0) + { + goto FileOpenEnd; + } + + FileNameCopy = FileIoCopyFileName(FileName); + if (!FileNameCopy) + { + Status = STATUS_NO_MEMORY; + goto FileOpenEnd; + } + + Status = ParentDirectoryEntry->Callbacks.Open(ParentDirectoryEntry, + FileNameCopy, + OpenFlags, + &FileEntry); + } + else + { + EfiPrintf(L"Opening root drive\r\n"); + Status = STATUS_UNSUCCESSFUL; + + ListHead = &RegisteredFileSystems; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + FileSystem = CONTAINING_RECORD(NextEntry, BL_FILE_SYSTEM_ENTRY, ListEntry); + + EfiPrintf(L"Calling filesystem %p mount routine: %p\r\n", FileSystem, FileSystem->MountCallback); + Status = FileSystem->MountCallback(DeviceId, Unknown, &FileEntry); + if (NT_SUCCESS(Status)) + { + break; + } + + NextEntry = NextEntry->Flink; + } + + FileNameCopy = 0; + } + + if (!NT_SUCCESS(Status)) + { + EfiPrintf(L"Could not open file!: %lx\r\n", Status); + goto FileOpenEnd; + } + + FileEntry->Unknown = Unknown; + + if (OpenFlags & 1) + { + FileEntry->Flags |= 2u; + } + + if (OpenFlags & 2) + { + FileEntry->Flags |= 4u; + } + + Status = BlTblSetEntry(&FileTable, + &FileEntries, + (PVOID)FileEntry, + &FileId, + FileTablePurgeEntry); + if (!NT_SUCCESS(Status)) + { + FileEntry->Callbacks.Close(FileEntry); + goto FileOpenEnd; + } + + ++DeviceEntry->ReferenceCount; + Status = STATUS_SUCCESS; + + FileEntry->FileId = FileId; + +FileOpened: + if (++FileEntry->ReferenceCount == 1) + { + FileEntry->Unknown1 = 0; + FileEntry->Unknown2 = 0; + } + + FileEntry->Flags |= 1; + + if (OpenFlags & 0x10) + { + FileEntry->Flags |= 0x10; + } + + if (ReturnFileEntry) + { + *ReturnFileEntry = FileEntry; + } + +FileOpenEnd: + if (ParentDirectoryEntry) + { + BlFileClose(ParentDirectoryEntry->FileId); + } + if (ParentFileName) + { + BlMmFreeHeap(ParentFileName); + } + if (FileNameCopy) + { + BlMmFreeHeap(FileNameCopy); + } + return Status; +} + +NTSTATUS +BlFileOpen ( + _In_ ULONG DeviceId, + _In_ PWCHAR FileName, + _In_ ULONG OpenFlags, + _Out_ PULONG FileId + ) +{ + NTSTATUS Status; + PBL_FILE_ENTRY FileEntry; + BL_DEVICE_INFORMATION DeviceInformation; + + if (!(FileName) || + (*FileName != OBJ_NAME_PATH_SEPARATOR) || + !(FileId) || + !(OpenFlags & 3)) + { + EfiPrintf(L"Invalid file options\r\n"); + return STATUS_INVALID_PARAMETER; + } + + Status = BlDeviceGetInformation(DeviceId, &DeviceInformation); + if (!NT_SUCCESS(Status)) + { + EfiPrintf(L"Get device info failed: %lx\r\n", Status); + return Status; + } + + if ((DeviceInformation.DeviceType != DiskDevice) && + (DeviceInformation.DeviceType != LegacyPartitionDevice) && + (DeviceInformation.DeviceType != UdpDevice)) + { + EfiPrintf(L"Invalid device type\r\n"); + return STATUS_INVALID_PARAMETER; + } + + Status = FileIoOpen(DeviceId, + FileName, + OpenFlags, + 0, + FileTableCompareWithSameAttributes, + &FileEntry); + if (NT_SUCCESS(Status)) + { + EfiPrintf(L"File opened: %lx\r\n", FileEntry->FileId); + *FileId = FileEntry->FileId; + } + + return Status; +} NTSTATUS BlpFileRegisterFileSystem ( @@ -40,14 +485,16 @@ PBL_FILE_SYSTEM_ENTRY FsEntry; NTSTATUS Status; + /* Allocate an entry */ FsEntry = BlMmAllocateHeap(sizeof(*FsEntry)); if (!FsEntry) { return STATUS_NO_MEMORY; } + /* Initialize the file system */ Status = InitCallback(); - if (NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { BlMmFreeHeap(FsEntry); return Status;
9 years, 3 months
1
0
0
0
[hbelusca] 69164: [USER32]: Use FIXME instead of DbgPrint (so that we can get the line of the source file together).
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Sep 10 00:39:18 2015 New Revision: 69164 URL:
http://svn.reactos.org/svn/reactos?rev=69164&view=rev
Log: [USER32]: Use FIXME instead of DbgPrint (so that we can get the line of the source file together). Modified: trunk/reactos/win32ss/user/user32/misc/stubs.c Modified: trunk/reactos/win32ss/user/user32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/s…
============================================================================== --- trunk/reactos/win32ss/user/user32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/stubs.c [iso-8859-1] Thu Sep 10 00:39:18 2015 @@ -41,7 +41,7 @@ WINAPI SetDebugErrorLevel( DWORD dwLevel ) { - DbgPrint("(%lu): stub\n", dwLevel); + FIXME("(%lu): stub\n", dwLevel); }
9 years, 3 months
1
0
0
0
[tfaber] 69163: [REGEDIT] - Properly walk CM_RESOURCE_LIST contents CORE-10146
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Sep 9 22:01:49 2015 New Revision: 69163 URL:
http://svn.reactos.org/svn/reactos?rev=69163&view=rev
Log: [REGEDIT] - Properly walk CM_RESOURCE_LIST contents CORE-10146 Modified: trunk/reactos/base/applications/regedit/edit.c Modified: trunk/reactos/base/applications/regedit/edit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
============================================================================== --- trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] Wed Sep 9 22:01:49 2015 @@ -671,7 +671,12 @@ LVITEMW item; INT iItem; - pFullDescriptor = &resourceValueData->List[fullResourceIndex]; + pFullDescriptor = &resourceValueData->List[0]; + for (i = 0; i < fullResourceIndex; i++) + { + pFullDescriptor = (PVOID)(pFullDescriptor->PartialResourceList.PartialDescriptors + + pFullDescriptor->PartialResourceList.Count); + } pPartialResourceList = &pFullDescriptor->PartialResourceList; /* Interface type */ @@ -697,7 +702,7 @@ hwndLV = GetDlgItem(hwnd, IDC_PORT_LIST); #ifdef _M_AMD64 - wsprintf(buffer, L"0x%16I64x", pDescriptor->u.Port.Start.QuadPart); + wsprintf(buffer, L"0x%016I64x", pDescriptor->u.Port.Start.QuadPart); #else wsprintf(buffer, L"0x%08lx", pDescriptor->u.Port.Start.u.LowPart); #endif @@ -761,7 +766,7 @@ hwndLV = GetDlgItem(hwnd, IDC_MEMORY_LIST); #ifdef _M_AMD64 - wsprintf(buffer, L"0x%16I64x", pDescriptor->u.Memory.Start.QuadPart); + wsprintf(buffer, L"0x%016I64x", pDescriptor->u.Memory.Start.QuadPart); #else wsprintf(buffer, L"0x%08lx", pDescriptor->u.Memory.Start.u.LowPart); #endif @@ -975,10 +980,9 @@ ULONG i; INT iItem; + pFullDescriptor = &resourceValueData->List[0]; for (i = 0; i < resourceValueData->Count; i++) { - pFullDescriptor = &resourceValueData->List[i]; - wsprintf(buffer, L"%lu", pFullDescriptor->BusNumber); item.mask = LVIF_TEXT; @@ -995,6 +999,8 @@ GetInterfaceType(pFullDescriptor->InterfaceType, buffer, 80); ListView_SetItemText(hwnd, iItem, 1, buffer); } + pFullDescriptor = (PVOID)(pFullDescriptor->PartialResourceList.PartialDescriptors + + pFullDescriptor->PartialResourceList.Count); } }
9 years, 3 months
1
0
0
0
[ekohl] 69162: [BOOTDATA] Add missing default locale values.
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Sep 9 20:17:25 2015 New Revision: 69162 URL:
http://svn.reactos.org/svn/reactos?rev=69162&view=rev
Log: [BOOTDATA] Add missing default locale values. Modified: trunk/reactos/boot/bootdata/hivedef.inf Modified: trunk/reactos/boot/bootdata/hivedef.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivedef.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivedef.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivedef.inf [iso-8859-1] Wed Sep 9 20:17:25 2015 @@ -153,28 +153,42 @@ ; International keys HKCU,"Control Panel\International",,0x00000012 HKCU,"Control Panel\International","Locale",0x00000000,"0409" +HKCU,"Control Panel\International","iCalenderType",2,"1" HKCU,"Control Panel\International","iCountry",2,"1" HKCU,"Control Panel\International","iCurrDigits",2,"2" HKCU,"Control Panel\International","iCurrency",2,"0" HKCU,"Control Panel\International","iDate",2,"0" HKCU,"Control Panel\International","iDigits",2,"2" +HKCU,"Control Panel\International","iFirstDayOfWeek",2,"6" +HKCU,"Control Panel\International","iFirstDayOfYear",2,"0" HKCU,"Control Panel\International","iLZero",2,"1" HKCU,"Control Panel\International","iMeasure",2,"1" HKCU,"Control Panel\International","iNegCurr",2,"0" +HKCU,"Control Panel\International","iNegNumber",2,"1" HKCU,"Control Panel\International","iTime",2,"0" +HKCU,"Control Panel\International","iTimePrefix",2,"0" HKCU,"Control Panel\International","iTLZero",2,"0" +HKCU,"Control Panel\International","NumShape",2,"1" HKCU,"Control Panel\International","s1159",2,"AM" HKCU,"Control Panel\International","s2359",2,"PM" HKCU,"Control Panel\International","sCountry",2,"United States" HKCU,"Control Panel\International","sCurrency",2,"$" HKCU,"Control Panel\International","sDate",2,"/" HKCU,"Control Panel\International","sDecimal",2,"." -;HKCU,"Control Panel\International","sLanguage",2,"ENU" +HKCU,"Control Panel\International","sGrouping",2,"3;0" +HKCU,"Control Panel\International","sLanguage",2,"ENU" HKCU,"Control Panel\International","sList",2,"," HKCU,"Control Panel\International","sLongDate",2,"dddd, MMMM dd, yyyy" +HKCU,"Control Panel\International","sMonDecimalSep",2,"." +HKCU,"Control Panel\International","sMonGrouping",2,"3;0" +HKCU,"Control Panel\International","sMonThousandSep",2,"," +HKCU,"Control Panel\International","sNativeDigits",2,"0123456789" +HKCU,"Control Panel\International","sNegativeSign",2,"-" +HKCU,"Control Panel\International","sPositiveSign",2,"" HKCU,"Control Panel\International","sShortDate",2,"M/d/yyyy" HKCU,"Control Panel\International","sThousand",2,"," HKCU,"Control Panel\International","sTime",2,":" +HKCU,"Control Panel\International","sTimeFormat",2,"h:mm:ss tt" HKCU,"Control Panel\International\Geo","Nation",0x00000000,"1" ; Cursors Schemes
9 years, 3 months
1
0
0
0
[sginsberg] 69161: [WIN32SS] Fix the fix by removing the correct parameter. The NtUserChangeDisplaySettings syscall is expected to make use of the lParam pointer (which must be NULL unless the CDS_...
by sginsberg@svn.reactos.org
Author: sginsberg Date: Wed Sep 9 19:56:22 2015 New Revision: 69161 URL:
http://svn.reactos.org/svn/reactos?rev=69161&view=rev
Log: [WIN32SS] Fix the fix by removing the correct parameter. The NtUserChangeDisplaySettings syscall is expected to make use of the lParam pointer (which must be NULL unless the CDS_VIDEOPARAMETERS flag is set). Modified: trunk/reactos/win32ss/include/ntuser.h trunk/reactos/win32ss/user/ntuser/display.c trunk/reactos/win32ss/user/user32/misc/display.c Modified: trunk/reactos/win32ss/include/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
============================================================================== --- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Wed Sep 9 19:56:22 2015 @@ -1696,8 +1696,8 @@ NtUserChangeDisplaySettings( PUNICODE_STRING lpszDeviceName, LPDEVMODEW lpDevMode, - HWND hwnd, - DWORD dwflags); + DWORD dwflags, + LPVOID lParam); BOOL NTAPI Modified: trunk/reactos/win32ss/user/ntuser/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/displa…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Wed Sep 9 19:56:22 2015 @@ -814,8 +814,8 @@ NtUserChangeDisplaySettings( PUNICODE_STRING pustrDevice, LPDEVMODEW lpDevMode, - HWND hWnd, - DWORD dwflags) + DWORD dwflags, + LPVOID lParam) { WCHAR awcDevice[CCHDEVICENAME]; UNICODE_STRING ustrDevice; @@ -823,8 +823,7 @@ LONG lRet; /* Check arguments */ - if ((dwflags != CDS_VIDEOPARAMETERS) || - (hWnd != NULL)) + if ((dwflags != CDS_VIDEOPARAMETERS) && (lParam != NULL)) { EngSetLastError(ERROR_INVALID_PARAMETER); return DISP_CHANGE_BADPARAM; Modified: trunk/reactos/win32ss/user/user32/misc/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/d…
============================================================================== --- trunk/reactos/win32ss/user/user32/misc/display.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/display.c [iso-8859-1] Wed Sep 9 19:56:22 2015 @@ -457,14 +457,14 @@ pDevModeW = GdiConvertToDevmodeW(lpDevMode); if(pDevModeW) { - rc = NtUserChangeDisplaySettings(pDeviceName, pDevModeW, hwnd, dwflags); + rc = NtUserChangeDisplaySettings(pDeviceName, pDevModeW, dwflags, lParam); RtlFreeHeap(GetProcessHeap(), 0, pDevModeW); } else rc = DISP_CHANGE_SUCCESSFUL; } else - rc = NtUserChangeDisplaySettings(pDeviceName, NULL, hwnd, dwflags); + rc = NtUserChangeDisplaySettings(pDeviceName, NULL, dwflags, lParam); if (lpszDeviceName != NULL) RtlFreeUnicodeString(&DeviceName); @@ -509,7 +509,7 @@ else pDeviceName = NULL; - rc = NtUserChangeDisplaySettings(pDeviceName, lpDevMode, hwnd, dwflags); + rc = NtUserChangeDisplaySettings(pDeviceName, lpDevMode, dwflags, lParam); return rc; }
9 years, 3 months
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
54
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
Results per page:
10
25
50
100
200