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
February 2017
----- 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
13 participants
353 discussions
Start a n
N
ew thread
[tfaber] 73826: [USBSTOR] - Fix a broken assert (yes, calling NTOHL is wrong, ContiguousLogicBlocksByte0 is the MSB). CID 701077
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Feb 18 11:47:40 2017 New Revision: 73826 URL:
http://svn.reactos.org/svn/reactos?rev=73826&view=rev
Log: [USBSTOR] - Fix a broken assert (yes, calling NTOHL is wrong, ContiguousLogicBlocksByte0 is the MSB). CID 701077 Modified: trunk/reactos/drivers/usb/usbstor/scsi.c Modified: trunk/reactos/drivers/usb/usbstor/scsi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbstor/scsi.c…
============================================================================== --- trunk/reactos/drivers/usb/usbstor/scsi.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbstor/scsi.c [iso-8859-1] Sat Feb 18 11:47:40 2017 @@ -1201,7 +1201,7 @@ // sanity check // Temp = (Cmd.ContiguousLogicBlocksByte0 << 8 | Cmd.ContiguousLogicBlocksByte1); - ASSERT(NTOHL(Temp == BlockCount)); + ASSERT(Temp == BlockCount); DPRINT("USBSTOR_SendReadWrite BlockAddress %x%x%x%x BlockCount %lu BlockLength %lu\n", Cmd.LogicalBlockByte0, Cmd.LogicalBlockByte1, Cmd.LogicalBlockByte2, Cmd.LogicalBlockByte3, BlockCount, PDODeviceExtension->BlockLength);
7 years, 10 months
1
0
0
0
[mjansen] 73825: [GDI32_APITEST] Add tests for GetFontResourceInfoW. Patch by Katayama Hirofumi MZ. CORE-6621
by mjansen@svn.reactos.org
Author: mjansen Date: Sat Feb 18 11:25:31 2017 New Revision: 73825 URL:
http://svn.reactos.org/svn/reactos?rev=73825&view=rev
Log: [GDI32_APITEST] Add tests for GetFontResourceInfoW. Patch by Katayama Hirofumi MZ. CORE-6621 Added: trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c (with props) Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt trunk/rostests/apitests/gdi32/testlist.c Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists…
============================================================================== --- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Sat Feb 18 11:25:31 2017 @@ -44,6 +44,7 @@ GetCurrentObject.c GetDIBColorTable.c GetDIBits.c + GetFontResourceInfoW.c GetGlyphIndices.c GetObject.c GetRandomRgn.c Added: trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetFontRes…
============================================================================== --- trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c (added) +++ trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c [iso-8859-1] Sat Feb 18 11:25:31 2017 @@ -0,0 +1,433 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for GetFontResourceInfoW + * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ +#include <apitest.h> +#include <wingdi.h> +#include <winnls.h> +#include <stdio.h> + +/* GetFontResourceInfoW is undocumented */ +BOOL WINAPI GetFontResourceInfoW(LPCWSTR lpFileName, DWORD *pdwBufSize, void* lpBuffer, DWORD dwType); + +/* structure of test entry */ +typedef struct GFRI_ENTRY +{ + LPCWSTR File; + WCHAR FontInfo[64]; + INT FontCount; + WCHAR FaceNames[10][64]; +} GFRI_ENTRY; + +/* test entries */ +static const GFRI_ENTRY TestEntries[] = +{ + { L"symbol.ttf", L"Symbol|", 1, { L"Symbol" } }, + { L"tahoma.ttf", L"Tahoma|", 1, { L"Tahoma" } }, + { L"tahomabd.ttf", L"Tahoma Bold|", 1, { L"Tahoma" } } +}; + +/* Japanese */ +static const GFRI_ENTRY AdditionalTestEntriesJapanese[] = +{ + { + /* MS Gothic & MS UI Gothic & MS PGothic */ + L"msgothic.ttc", + { + 0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0x0020, + 0x0026, 0x0020, 0x004D, 0x0053, 0x0020, 0x0055, 0x0049, 0x0020, + 0x0047, 0x006F, 0x0074, 0x0068, 0x0069, 0x0063, 0x0020, 0x0026, + 0x0020, 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, + 0x30AF, L'|', 0 + }, + 6, + { + { 0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }, + { L'@', 0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }, + L"MS UI Gothic", + L"@MS UI Gothic", + { 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }, + { L'@', 0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 } + } + } +}; + +/* English */ +static const GFRI_ENTRY AdditionalTestEntriesEnglish[] = +{ + { + /* MS Gothic & MS UI Gothic & MS PGothic */ + L"msgothic.ttc", + L"MS Gothic & MS UI Gothic & MS PGothic|", + 6, + { + L"MS Gothic", + L"@MS Gothic", + L"MS UI Gothic", + L"@MS UI Gothic", + L"MS PGothic", + L"@MS PGothic" + } + } +}; + +static void +GetSystemFontDirectory(LPWSTR pszDir) +{ + GetWindowsDirectoryW(pszDir, MAX_PATH); + lstrcatW(pszDir, L"\\Fonts"); +} + +static void +GetSystemFontPath(LPWSTR pszPath, LPCWSTR pszFile) +{ + GetSystemFontDirectory(pszPath); + lstrcatW(pszPath, L"\\"); + lstrcatW(pszPath, pszFile); +} + +static INT +GetMultiSzLength(const WCHAR *pszz) +{ + INT Len, TotalLen = 0; + for (;;) + { + Len = lstrlenW(pszz); + TotalLen += Len + 1; + pszz += Len + 1; + if (*pszz == 0) + break; + } + ++TotalLen; + return TotalLen; +} + +static void +ReplaceChars(WCHAR *pch, INT Len, WCHAR From, WCHAR To) +{ + while (Len > 0) + { + if (*pch == From) + { + *pch = To; + } + //printf("0x%04X, ", *pch); + ++pch; + --Len; + } +} + +static void +SzFromMultiSz(WCHAR *pszz) +{ + INT Length = GetMultiSzLength(pszz); + //printf("Length: %d\n", Length); + if (Length > 0) + { + ReplaceChars(pszz, Length - 1, L'\0', L'|'); + pszz[Length - 1] = 0; + } + else + { + pszz[0] = 0; + } + //printf("pszz: %S\n", pszz); +} + +static void +Test_GetFontResourceInfoW_case0(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry) +{ + BOOL Ret; + DWORD Size, Case = 0; + DWORD Data; + + /* data NULL, size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + + /* data NULL, size non-zero */ + Size = 1024; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 0); + ok_int(Size, 1024); + + /* size zero */ + Data = 0xDEADFACE; + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, &Data, Case); + ok_int(Ret, 1); + ok_int(Data, 0xDEADFACE); + ok_int(Size, 4); + + /* size non-zero */ + Data = 0xDEADFACE; + Size = sizeof(Data); + Ret = GetFontResourceInfoW(pszFilePath, &Size, &Data, Case); + ok_int(Ret, 1); + ok_int(Data, Entry->FontCount); + ok_int(Size, 4); +} + +static void +Test_GetFontResourceInfoW_case1(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry) +{ + BOOL Ret; + DWORD Size, Case = 1; + static WCHAR Data[1024 / sizeof(WCHAR)]; + + /* data NULL, size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 1); + /* FIXME: What's the result of Size? */ + ok(Size != 0, "Size expected non-zero but zero\n"); + + /* data NULL, size non-zero */ + Size = 1024; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 0); + ok_int(Size, 1024); + + /* size zero */ + Size = 0; + CopyMemory(Data, L"ABC\0", sizeof(L"ABC\0")); + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + /* FIXME: What's the result of Size? */ + ok(Size != 0, "Size expected non-zero but zero\n"); + ok(lstrcmpiW(Data, L"ABC") == 0, "data mismatched: \"%S\"\n", Data); + + /* size non-zero */ + Size = 1024; + CopyMemory(Data, L"ABC\0", sizeof(L"ABC\0")); + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + /* FIXME: What's the result of Size? */ + ok(Size != 0, "Size expected non-zero but zero\n"); + + SzFromMultiSz(Data); + ok(lstrcmpiW(Data, Entry->FontInfo) == 0, "data mismatched: \"%S\" and \"%S\"\n", + Data, Entry->FontInfo); +#if 0 + if (lstrcmpiW(Data, Entry->FontInfo) != 0) + { + int i, len = lstrlenW(Data) + 1; + for (i = 0; i < len; ++i) + { + printf("0x%04X <=> 0x%04X\n", Data[i], Entry->FontInfo[i]); + } + } +#endif +} + +static void +Test_GetFontResourceInfoW_case2(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry) +{ + BOOL Ret; + DWORD i, Size, Case = 2; + static LOGFONTW Data[100]; + + /* data NULL, size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 1); + ok_int(Size, Entry->FontCount * sizeof(LOGFONTW)); + + /* data NULL, size non-zero */ + Size = 1024; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 0); + ok_int(Size, 1024); + + /* size zero */ + Size = 0; + ZeroMemory(Data, sizeof(Data)); + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + ok_int(Size, Entry->FontCount * sizeof(LOGFONTW)); + + /* size non-zero */ + Size = sizeof(Data); + ZeroMemory(Data, sizeof(Data)); + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + ok_int(Size, Entry->FontCount * sizeof(LOGFONTW)); + for (i = 0; i < Entry->FontCount; ++i) + { + ok(lstrcmpiW(Data[i].lfFaceName, Entry->FaceNames[i]) == 0, + "face name #%d mismatched: \"%S\" and \"%S\"\n", (int)i, Data[i].lfFaceName, Entry->FaceNames[i]); +#if 0 + if (lstrcmpiW(Data[i].lfFaceName, Entry->FaceNames[i]) != 0) + { + int k, len = lstrlenW(Data[i].lfFaceName); + for (k = 0; k < len; ++k) + { + printf("0x%04X <=> 0x%04X\n", Entry->FaceNames[i][k], Data[i].lfFaceName[k]); + } + } +#endif + } +} + +static void +Test_GetFontResourceInfoW_case3(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry) +{ + BOOL Ret; + DWORD Size, Case = 3; + DWORD Data[2]; + + /* data NULL, size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + + /* data NULL, size non-zero */ + Size = sizeof(Data); + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 0); + ok_int(Size, 8); + + /* size zero */ + Size = 0; + Data[0] = 0xDEADFACE; + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + ok_int(Data[0], 0xDEADFACE); + + /* size non-zero */ + Size = sizeof(Data); + Data[0] = 0xDEADFACE; + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + ok_int(Data[0], 1); +} + +static void +Test_GetFontResourceInfoW_case4(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry) +{ + BOOL Ret; + DWORD Size, Case = 4; + WCHAR Data[MAX_PATH]; + + /* data NULL, size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 1); + ok_int(Size, (lstrlenW(pszFilePath) + 1) * sizeof(WCHAR)); + + /* data NULL, size non-zero */ + Size = MAX_PATH; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 0); + ok_int(Size, MAX_PATH); + + /* size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + ok_int(Size, (lstrlenW(pszFilePath) + 1) * sizeof(WCHAR)); + + /* size non-zero */ + Size = MAX_PATH; + Ret = GetFontResourceInfoW(pszFilePath, &Size, Data, Case); + ok_int(Ret, 1); + ok_int(Size, (lstrlenW(pszFilePath) + 1) * sizeof(WCHAR)); + ok(lstrcmpiW(pszFilePath, Data) == 0, "data mismatched: \"%S\"\n", Data); +} + +static void +Test_GetFontResourceInfoW_case5(LPCWSTR pszFilePath, const GFRI_ENTRY *Entry) +{ + BOOL Ret; + DWORD Size, Case = 5; + DWORD Data; + + /* data NULL, size zero */ + Size = 0; + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + + /* data NULL, size non-zero */ + Size = sizeof(Data); + Ret = GetFontResourceInfoW(pszFilePath, &Size, NULL, Case); + ok_int(Ret, 0); + ok_int(Size, 4); + + /* size zero */ + Size = 0; + Data = 0xDEADFACE; + Ret = GetFontResourceInfoW(pszFilePath, &Size, &Data, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + ok_int(Data, 0xDEADFACE); + + /* size non-zero */ + Size = sizeof(Data); + Data = 0xDEADFACE; + Ret = GetFontResourceInfoW(pszFilePath, &Size, &Data, Case); + ok_int(Ret, 1); + ok_int(Size, 4); + ok_int(Data, 0); +} + +static void +DoEntry(const GFRI_ENTRY *Entry) +{ + WCHAR szPath[MAX_PATH]; + + GetSystemFontPath(szPath, Entry->File); + printf("GetSystemFontPath: %S\n", szPath); + if (GetFileAttributesW(szPath) == 0xFFFFFFFF) + { + skip("Font file \"%S\" was not found\n", szPath); + return; + } + + Test_GetFontResourceInfoW_case0(szPath, Entry); + Test_GetFontResourceInfoW_case1(szPath, Entry); + Test_GetFontResourceInfoW_case2(szPath, Entry); + Test_GetFontResourceInfoW_case3(szPath, Entry); + Test_GetFontResourceInfoW_case4(szPath, Entry); + Test_GetFontResourceInfoW_case5(szPath, Entry); +} + +START_TEST(GetFontResourceInfoW) +{ + INT i; + const GFRI_ENTRY *Entry; + + printf("sizeof(LOGFONTW) == %u\n", (int)sizeof(LOGFONTW)); + + for (i = 0; i < _countof(TestEntries); ++i) + { + Entry = &TestEntries[i]; + DoEntry(Entry); + } + + if (PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_JAPANESE) + { + /* Japanese */ + for (i = 0; i < _countof(AdditionalTestEntriesJapanese); ++i) + { + Entry = &AdditionalTestEntriesJapanese[i]; + DoEntry(Entry); + } + } + else + { + /* non-Japanese */ + for (i = 0; i < _countof(AdditionalTestEntriesEnglish); ++i) + { + Entry = &AdditionalTestEntriesEnglish[i]; + DoEntry(Entry); + } + } +} Propchange: trunk/rostests/apitests/gdi32/GetFontResourceInfoW.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/gdi32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c…
============================================================================== --- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Sat Feb 18 11:25:31 2017 @@ -45,9 +45,10 @@ extern void func_GetCurrentObject(void); extern void func_GetDIBColorTable(void); extern void func_GetDIBits(void); +extern void func_GetFontResourceInfoW(void); extern void func_GetGlyphIndices(void); +extern void func_GetObject(void); extern void func_GetPixel(void); -extern void func_GetObject(void); extern void func_GetRandomRgn(void); extern void func_GetStockObject(void); extern void func_GetTextExtentExPoint(void); @@ -116,6 +117,7 @@ { "GetCurrentObject", func_GetCurrentObject }, { "GetDIBColorTable", func_GetDIBColorTable }, { "GetDIBits", func_GetDIBits }, + { "GetFontResourceInfoW", func_GetFontResourceInfoW }, { "GetGlyphIndices", func_GetGlyphIndices }, { "GetPixel", func_GetPixel }, { "GetObject", func_GetObject },
7 years, 10 months
1
0
0
0
[tfaber] 73824: [PSDK] - Fix KsFilterFactoryGetDevice CORE-11794
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Feb 18 09:30:59 2017 New Revision: 73824 URL:
http://svn.reactos.org/svn/reactos?rev=73824&view=rev
Log: [PSDK] - Fix KsFilterFactoryGetDevice CORE-11794 Modified: trunk/reactos/sdk/include/psdk/ks.h Modified: trunk/reactos/sdk/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/ks.h?rev=…
============================================================================== --- trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] Sat Feb 18 09:30:59 2017 @@ -5064,10 +5064,20 @@ _IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI +PKSDEVICE +NTAPI +KsGetDevice( + _In_ PVOID Object); + +_IRQL_requires_max_(PASSIVE_LEVEL) +static __inline PKSDEVICE KsFilterFactoryGetDevice( - _In_ PKSFILTERFACTORY FilterFactory); + _In_ PKSFILTERFACTORY FilterFactory) +{ + return KsGetDevice((PVOID)FilterFactory); +} /* etc. */ #endif /* avstream */
7 years, 10 months
1
0
0
0
[khornicek] 73823: [SHELL32] - Make the "Open with" dialog start in Program Files as is done in Windows (doesn't really changes anything because comdlg32 doesn't expand environment variables).
by khornicek@svn.reactos.org
Author: khornicek Date: Fri Feb 17 23:39:39 2017 New Revision: 73823 URL:
http://svn.reactos.org/svn/reactos?rev=73823&view=rev
Log: [SHELL32] - Make the "Open with" dialog start in Program Files as is done in Windows (doesn't really changes anything because comdlg32 doesn't expand environment variables). Modified: trunk/reactos/dll/win32/shell32/COpenWithMenu.cpp Modified: trunk/reactos/dll/win32/shell32/COpenWithMenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/COpenWit…
============================================================================== --- trunk/reactos/dll/win32/shell32/COpenWithMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/COpenWithMenu.cpp [iso-8859-1] Fri Feb 17 23:39:39 2017 @@ -907,6 +907,7 @@ ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; ofn.nMaxFile = (sizeof(wszPath) / sizeof(WCHAR)); ofn.lpstrFile = wszPath; + ofn.lpstrInitialDir = L"%programfiles%"; /* Init title */ if (LoadStringW(shell32_hInstance, IDS_OPEN_WITH, wszTitle, sizeof(wszTitle) / sizeof(WCHAR)))
7 years, 10 months
1
0
0
0
[pschweitzer] 73822: [FASTFAT] Generalize the usage of functions pointers for FatX vs Fat specific code (direntry). This should also help speeding up FastFAT.
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Fri Feb 17 22:25:03 2017 New Revision: 73822 URL:
http://svn.reactos.org/svn/reactos?rev=73822&view=rev
Log: [FASTFAT] Generalize the usage of functions pointers for FatX vs Fat specific code (direntry). This should also help speeding up FastFAT. Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c trunk/reactos/drivers/filesystems/fastfat/create.c trunk/reactos/drivers/filesystems/fastfat/direntry.c trunk/reactos/drivers/filesystems/fastfat/dirwr.c trunk/reactos/drivers/filesystems/fastfat/fcb.c trunk/reactos/drivers/filesystems/fastfat/finfo.c trunk/reactos/drivers/filesystems/fastfat/fsctl.c trunk/reactos/drivers/filesystems/fastfat/vfat.h Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -85,7 +85,7 @@ pFcb->OpenHandleCount == 0) { if (vfatFCBIsDirectory(pFcb) && - !VfatIsDirectoryEmpty(pFcb, vfatVolumeIsFatX(DeviceExt))) + !VfatIsDirectoryEmpty(DeviceExt, pFcb)) { pFcb->Flags &= ~FCB_DELETE_PENDING; } Modified: trunk/reactos/drivers/filesystems/fastfat/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -296,7 +296,7 @@ while (TRUE) { - Status = DeviceExt->GetNextDirEntry(&Context, &Page, Parent, DirContext, First); + Status = VfatGetNextDirEntry(DeviceExt, &Context, &Page, Parent, DirContext, First); First = FALSE; if (Status == STATUS_NO_MORE_ENTRIES) { Modified: trunk/reactos/drivers/filesystems/fastfat/direntry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -39,7 +39,6 @@ return cluster; } -static BOOLEAN FATIsDirectoryEmpty( PVFATFCB Fcb) @@ -108,7 +107,6 @@ return TRUE; } -static BOOLEAN FATXIsDirectoryEmpty( PVFATFCB Fcb) @@ -166,17 +164,6 @@ } return TRUE; -} - -BOOLEAN -VfatIsDirectoryEmpty( - PVFATFCB Fcb, - BOOLEAN IsFatX) -{ - if (IsFatX) - return FATXIsDirectoryEmpty(Fcb); - else - return FATIsDirectoryEmpty(Fcb); } NTSTATUS Modified: trunk/reactos/drivers/filesystems/fastfat/dirwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -815,22 +815,6 @@ return STATUS_SUCCESS; } -NTSTATUS -VfatAddEntry( - IN PDEVICE_EXTENSION DeviceExt, - IN PUNICODE_STRING NameU, - IN PVFATFCB *Fcb, - IN PVFATFCB ParentFcb, - IN ULONG RequestedOptions, - IN UCHAR ReqAttr, - IN PVFAT_MOVE_CONTEXT MoveContext) -{ - if (vfatVolumeIsFatX(DeviceExt)) - return FATXAddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); - else - return FATAddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); -} - /* * deleting an existing FAT entry */ @@ -978,18 +962,6 @@ return STATUS_SUCCESS; } -NTSTATUS -VfatDelEntry( - IN PDEVICE_EXTENSION DeviceExt, - IN PVFATFCB pFcb, - OUT PVFAT_MOVE_CONTEXT MoveContext) -{ - if (vfatVolumeIsFatX(DeviceExt)) - return FATXDelEntry(DeviceExt, pFcb, MoveContext); - else - return FATDelEntry(DeviceExt, pFcb, MoveContext); -} - /* * move an existing FAT entry */ @@ -1031,4 +1003,23 @@ return Status; } +extern BOOLEAN FATXIsDirectoryEmpty(PVFATFCB Fcb); +extern BOOLEAN FATIsDirectoryEmpty(PVFATFCB Fcb); +extern NTSTATUS FATGetNextDirEntry(PVOID *pContext, PVOID *pPage, PVFATFCB pDirFcb, PVFAT_DIRENTRY_CONTEXT DirContext, BOOLEAN First); +extern NTSTATUS FATXGetNextDirEntry(PVOID *pContext, PVOID *pPage, PVFATFCB pDirFcb, PVFAT_DIRENTRY_CONTEXT DirContext, BOOLEAN First); + +VFAT_DISPATCH FatXDispatch = { + .IsDirectoryEmpty = FATXIsDirectoryEmpty, + .AddEntry = FATXAddEntry, + .DelEntry = FATXDelEntry, + .GetNextDirEntry = FATXGetNextDirEntry, +}; + +VFAT_DISPATCH FatDispatch = { + .IsDirectoryEmpty = FATIsDirectoryEmpty, + .AddEntry = FATAddEntry, + .DelEntry = FATDelEntry, + .GetNextDirEntry = FATGetNextDirEntry, +}; + /* EOF */ Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -797,7 +797,8 @@ while (TRUE) { - status = pDeviceExt->GetNextDirEntry(&Context, + status = VfatGetNextDirEntry(pDeviceExt, + &Context, &Page, pDirectoryFCB, &DirContext, Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -357,7 +357,7 @@ return STATUS_CANNOT_DELETE; } - if (vfatFCBIsDirectory(FCB) && !VfatIsDirectoryEmpty(FCB, vfatVolumeIsFatX(DeviceExt))) + if (vfatFCBIsDirectory(FCB) && !VfatIsDirectoryEmpty(DeviceExt, FCB)) { /* can't delete a non-empty directory */ Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] Fri Feb 17 22:25:03 2017 @@ -29,6 +29,9 @@ #define NDEBUG #include <debug.h> + +extern VFAT_DISPATCH FatXDispatch; +extern VFAT_DISPATCH FatDispatch; /* FUNCTIONS ****************************************************************/ @@ -465,13 +468,13 @@ DeviceExt->FatInfo.FatType == FATX32) { DeviceExt->Flags |= VCB_IS_FATX; - DeviceExt->GetNextDirEntry = FATXGetNextDirEntry; DeviceExt->BaseDateYear = 2000; + RtlCopyMemory(&DeviceExt->Dispatch, &FatXDispatch, sizeof(VFAT_DISPATCH)); } else { - DeviceExt->GetNextDirEntry = FATGetNextDirEntry; DeviceExt->BaseDateYear = 1980; + RtlCopyMemory(&DeviceExt->Dispatch, &FatDispatch, sizeof(VFAT_DISPATCH)); } DeviceExt->StorageDevice = DeviceToMount; 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] Fri Feb 17 22:25:03 2017 @@ -260,6 +260,7 @@ struct _VFATFCB; struct _VFAT_DIRENTRY_CONTEXT; +struct _VFAT_MOVE_CONTEXT; typedef struct _HASHENTRY { @@ -275,7 +276,18 @@ typedef NTSTATUS (*PFIND_AND_MARK_AVAILABLE_CLUSTER)(PDEVICE_EXTENSION,PULONG); typedef NTSTATUS (*PWRITE_CLUSTER)(PDEVICE_EXTENSION,ULONG,ULONG,PULONG); +typedef BOOLEAN (*PIS_DIRECTORY_EMPTY)(struct _VFATFCB*); +typedef NTSTATUS (*PADD_ENTRY)(PDEVICE_EXTENSION,PUNICODE_STRING,struct _VFATFCB**,struct _VFATFCB*,ULONG,UCHAR,struct _VFAT_MOVE_CONTEXT*); +typedef NTSTATUS (*PDEL_ENTRY)(PDEVICE_EXTENSION,struct _VFATFCB*,struct _VFAT_MOVE_CONTEXT*); typedef NTSTATUS (*PGET_NEXT_DIR_ENTRY)(PVOID*,PVOID*,struct _VFATFCB*,struct _VFAT_DIRENTRY_CONTEXT*,BOOLEAN); + +typedef struct _VFAT_DISPATCH +{ + PIS_DIRECTORY_EMPTY IsDirectoryEmpty; + PADD_ENTRY AddEntry; + PDEL_ENTRY DelEntry; + PGET_NEXT_DIR_ENTRY GetNextDirEntry; +} VFAT_DISPATCH, *PVFAT_DISPATCH; typedef struct DEVICE_EXTENSION { @@ -303,9 +315,6 @@ PWRITE_CLUSTER WriteCluster; ULONG CleanShutBitMask; - /* Pointers to functions for manipulating directory entries. */ - PGET_NEXT_DIR_ENTRY GetNextDirEntry; - ULONG BaseDateYear; LIST_ENTRY VolumeListEntry; @@ -320,7 +329,52 @@ /* VPBs for dismount */ PVPB IoVPB; PVPB SpareVPB; + + /* Pointers to functions for manipulating directory entries. */ + VFAT_DISPATCH Dispatch; } DEVICE_EXTENSION, VCB, *PVCB; + +FORCEINLINE +BOOLEAN +VfatIsDirectoryEmpty(PDEVICE_EXTENSION DeviceExt, + struct _VFATFCB* Fcb) +{ + return DeviceExt->Dispatch.IsDirectoryEmpty(Fcb); +} + +FORCEINLINE +NTSTATUS +VfatAddEntry(PDEVICE_EXTENSION DeviceExt, + PUNICODE_STRING NameU, + struct _VFATFCB** Fcb, + struct _VFATFCB* ParentFcb, + ULONG RequestedOptions, + UCHAR ReqAttr, + struct _VFAT_MOVE_CONTEXT* MoveContext) +{ + return DeviceExt->Dispatch.AddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); +} + +FORCEINLINE +NTSTATUS +VfatDelEntry(PDEVICE_EXTENSION DeviceExt, + struct _VFATFCB* Fcb, + struct _VFAT_MOVE_CONTEXT* MoveContext) +{ + return DeviceExt->Dispatch.DelEntry(DeviceExt, Fcb, MoveContext); +} + +FORCEINLINE +NTSTATUS +VfatGetNextDirEntry(PDEVICE_EXTENSION DeviceExt, + PVOID *pContext, + PVOID *pPage, + struct _VFATFCB* pDirFcb, + struct _VFAT_DIRENTRY_CONTEXT* DirContext, + BOOLEAN First) +{ + return DeviceExt->Dispatch.GetNextDirEntry(pContext, pPage, pDirFcb, DirContext, First); +} #define VFAT_BREAK_ON_CORRUPTION 1 @@ -640,49 +694,12 @@ PDEVICE_EXTENSION pDeviceExt, PDIR_ENTRY pDirEntry); -BOOLEAN -VfatIsDirectoryEmpty( - PVFATFCB Fcb, - BOOLEAN IsFatX); - -NTSTATUS -FATGetNextDirEntry( - PVOID *pContext, - PVOID *pPage, - IN PVFATFCB pDirFcb, - IN PVFAT_DIRENTRY_CONTEXT DirContext, - BOOLEAN First); - -NTSTATUS -FATXGetNextDirEntry( - PVOID *pContext, - PVOID *pPage, - IN PVFATFCB pDirFcb, - IN PVFAT_DIRENTRY_CONTEXT DirContext, - BOOLEAN First); - /* dirwr.c */ - -NTSTATUS -VfatAddEntry( - PDEVICE_EXTENSION DeviceExt, - PUNICODE_STRING PathNameU, - PVFATFCB* Fcb, - PVFATFCB ParentFcb, - ULONG RequestedOptions, - UCHAR ReqAttr, - PVFAT_MOVE_CONTEXT MoveContext); NTSTATUS VfatUpdateEntry( PVFATFCB pFcb, IN BOOLEAN IsFatX); - -NTSTATUS -VfatDelEntry( - PDEVICE_EXTENSION, - PVFATFCB, - PVFAT_MOVE_CONTEXT); BOOLEAN vfatFindDirSpace(
7 years, 10 months
1
0
0
0
[pschweitzer] 73821: [FASTFAT] In the FCB, get rid of the FCB_IS_FATX_ENTRY flag. It makes no sense to have it on each and every file as the VCB already has such flag
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Fri Feb 17 21:24:12 2017 New Revision: 73821 URL:
http://svn.reactos.org/svn/reactos?rev=73821&view=rev
Log: [FASTFAT] In the FCB, get rid of the FCB_IS_FATX_ENTRY flag. It makes no sense to have it on each and every file as the VCB already has such flag Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c trunk/reactos/drivers/filesystems/fastfat/create.c trunk/reactos/drivers/filesystems/fastfat/dir.c trunk/reactos/drivers/filesystems/fastfat/direntry.c trunk/reactos/drivers/filesystems/fastfat/dirwr.c trunk/reactos/drivers/filesystems/fastfat/fcb.c trunk/reactos/drivers/filesystems/fastfat/finfo.c trunk/reactos/drivers/filesystems/fastfat/flush.c trunk/reactos/drivers/filesystems/fastfat/rw.c trunk/reactos/drivers/filesystems/fastfat/vfat.h trunk/reactos/drivers/filesystems/fastfat/volume.c Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -78,14 +78,14 @@ if (BooleanFlagOn(pFcb->Flags, FCB_IS_DIRTY)) { - VfatUpdateEntry (pFcb); + VfatUpdateEntry (pFcb, vfatVolumeIsFatX(DeviceExt)); } if (BooleanFlagOn(pFcb->Flags, FCB_DELETE_PENDING) && pFcb->OpenHandleCount == 0) { if (vfatFCBIsDirectory(pFcb) && - !VfatIsDirectoryEmpty(pFcb)) + !VfatIsDirectoryEmpty(pFcb, vfatVolumeIsFatX(DeviceExt))) { pFcb->Flags &= ~FCB_DELETE_PENDING; } Modified: trunk/reactos/drivers/filesystems/fastfat/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -119,7 +119,7 @@ *(Vpb->VolumeLabel) = 0; Vpb->VolumeLabelLength = 0; - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { SizeDirEntry = sizeof(FATX_DIR_ENTRY); EntriesPerPage = FATX_ENTRIES_PER_PAGE; @@ -151,7 +151,7 @@ if (ENTRY_VOLUME(DeviceExt, Entry)) { /* copy volume label */ - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { StringO.Buffer = (PCHAR)Entry->FatX.Filename; StringO.MaximumLength = StringO.Length = Entry->FatX.FilenameLength; @@ -259,7 +259,7 @@ if (rcFcb) { ULONG startIndex = rcFcb->startIndex; - if (BooleanFlagOn(rcFcb->Flags, FCB_IS_FATX_ENTRY) && !vfatFCBIsRoot(Parent)) + if (vfatVolumeIsFatX(DeviceExt) && !vfatFCBIsRoot(Parent)) { startIndex += 2; } @@ -947,7 +947,7 @@ { *pFcb->Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL; *pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE; - VfatUpdateEntry(pFcb); + VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt)); } ExAcquireResourceExclusiveLite(&(pFcb->MainResource), TRUE); Modified: trunk/reactos/drivers/filesystems/fastfat/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/dir.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/dir.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -127,7 +127,7 @@ DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { FsdDosDateTimeToSystemTime(DeviceExt, DirContext->DirEntry.FatX.CreationDate, @@ -220,7 +220,7 @@ DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { FsdDosDateTimeToSystemTime(DeviceExt, DirContext->DirEntry.FatX.CreationDate, @@ -285,7 +285,7 @@ pInfo->EaSize = 0; - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { pInfo->FileNameLength = DirContext->LongNameU.Length; Modified: trunk/reactos/drivers/filesystems/fastfat/direntry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -27,7 +27,7 @@ cluster = pFatDirEntry->Fat.FirstCluster | (pFatDirEntry->Fat.FirstClusterHigh << 16); } - else if (BooleanFlagOn(pDeviceExt->Flags, VCB_IS_FATX)) + else if (vfatVolumeIsFatX(pDeviceExt)) { cluster = pFatDirEntry->FatX.FirstCluster; } @@ -170,9 +170,10 @@ BOOLEAN VfatIsDirectoryEmpty( - PVFATFCB Fcb) + PVFATFCB Fcb, + BOOLEAN IsFatX) { - if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) + if (IsFatX) return FATXIsDirectoryEmpty(Fcb); else return FATIsDirectoryEmpty(Fcb); Modified: trunk/reactos/drivers/filesystems/fastfat/dirwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -21,7 +21,8 @@ */ NTSTATUS VfatUpdateEntry( - IN PVFATFCB pFcb) + IN PVFATFCB pFcb, + IN BOOLEAN IsFatX) { PVOID Context; PDIR_ENTRY PinEntry; @@ -31,7 +32,7 @@ ASSERT(pFcb); - if (BooleanFlagOn(pFcb->Flags, FCB_IS_FATX_ENTRY)) + if (IsFatX) { SizeDirEntry = sizeof(FATX_DIR_ENTRY); dirIndex = pFcb->startIndex; @@ -90,7 +91,7 @@ DPRINT("vfatRenameEntry(%p, %p, %wZ, %d)\n", DeviceExt, pFcb, FileName, CaseChangeOnly); - if (BooleanFlagOn(pFcb->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(DeviceExt)) { VFAT_DIRENTRY_CONTEXT DirContext; @@ -162,7 +163,7 @@ ULONG SizeDirEntry; FileOffset.QuadPart = 0; - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) SizeDirEntry = sizeof(FATX_DIR_ENTRY); else SizeDirEntry = sizeof(FAT_DIR_ENTRY); @@ -248,7 +249,7 @@ } _SEH2_END; - if (DeviceExt->Flags & VCB_IS_FATX) + if (vfatVolumeIsFatX(DeviceExt)) memset(pFatEntry, 0xff, DeviceExt->FatInfo.BytesPerCluster); else RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster); @@ -267,7 +268,7 @@ } _SEH2_END; - if (DeviceExt->Flags & VCB_IS_FATX) + if (vfatVolumeIsFatX(DeviceExt)) memset(pFatEntry, 0xff, SizeDirEntry); else RtlZeroMemory(pFatEntry, SizeDirEntry); @@ -824,7 +825,7 @@ IN UCHAR ReqAttr, IN PVFAT_MOVE_CONTEXT MoveContext) { - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) return FATXAddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); else return FATAddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); @@ -927,7 +928,7 @@ ASSERT(pFcb); ASSERT(pFcb->parentFcb); - ASSERT(BooleanFlagOn(pFcb->Flags, FCB_IS_FATX_ENTRY)); + ASSERT(vfatVolumeIsFatX(DeviceExt)); StartIndex = pFcb->startIndex; @@ -983,7 +984,7 @@ IN PVFATFCB pFcb, OUT PVFAT_MOVE_CONTEXT MoveContext) { - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) return FATXDelEntry(DeviceExt, pFcb, MoveContext); else return FATDelEntry(DeviceExt, pFcb, MoveContext); Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -136,11 +136,8 @@ } RtlZeroMemory(rcFCB, sizeof(VFATFCB)); vfatInitFcb(rcFCB, pFileNameU); - if (BooleanFlagOn(pVCB->Flags, VCB_IS_FATX)) - { - rcFCB->Flags |= FCB_IS_FATX_ENTRY; + if (vfatVolumeIsFatX(pVCB)) rcFCB->Attributes = &rcFCB->entry.FatX.Attrib; - } else rcFCB->Attributes = &rcFCB->entry.Fat.Attrib; rcFCB->Hash.Hash = vfatNameHash(0, &rcFCB->PathNameU); @@ -371,7 +368,7 @@ RtlCopyMemory(&Fcb->entry, &DirContext->DirEntry, sizeof (DIR_ENTRY)); RtlCopyUnicodeString(&Fcb->ShortNameU, &DirContext->ShortNameU); Fcb->Hash.Hash = vfatNameHash(0, &Fcb->PathNameU); - if (Vcb->Flags & VCB_IS_FATX) + if (vfatVolumeIsFatX(Vcb)) { Fcb->ShortHash.Hash = Fcb->Hash.Hash; } @@ -401,7 +398,7 @@ } } } - else if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) + else if (vfatVolumeIsFatX(Vcb)) { Size = Fcb->entry.FatX.FileSize; } @@ -411,7 +408,7 @@ } Fcb->dirIndex = DirContext->DirIndex; Fcb->startIndex = DirContext->StartIndex; - if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY) && !vfatFCBIsRoot(Fcb)) + if (vfatVolumeIsFatX(Vcb) && !vfatFCBIsRoot(Fcb)) { ASSERT(DirContext->DirIndex >= 2 && DirContext->StartIndex >= 2); Fcb->dirIndex = DirContext->DirIndex-2; @@ -453,7 +450,7 @@ Fcb->DirNameU.Buffer = Fcb->PathNameU.Buffer; vfatSplitPathName(&Fcb->PathNameU, &Fcb->DirNameU, &Fcb->LongNameU); Fcb->Hash.Hash = vfatNameHash(0, &Fcb->PathNameU); - if (BooleanFlagOn(pVCB->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(pVCB)) { Fcb->ShortHash.Hash = Fcb->Hash.Hash; } @@ -637,7 +634,7 @@ UNICODE_STRING NameU = RTL_CONSTANT_STRING(L"\\"); FCB = vfatNewFCB(pVCB, &NameU); - if (BooleanFlagOn(FCB->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(pVCB)) { memset(FCB->entry.FatX.Filename, ' ', 42); FCB->entry.FatX.FileSize = pVCB->FatInfo.rootDirectorySectors * pVCB->FatInfo.BytesPerSector; Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -165,7 +165,7 @@ /* Check volume label bit */ ASSERT(0 == (*FCB->Attributes & _A_VOLID)); - if (BooleanFlagOn(FCB->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(DeviceExt)) { if (BasicInfo->CreationTime.QuadPart != 0 && BasicInfo->CreationTime.QuadPart != -1) { @@ -230,7 +230,7 @@ DPRINT("Setting attributes 0x%02x\n", *FCB->Attributes); } - VfatUpdateEntry(FCB); + VfatUpdateEntry(FCB, vfatVolumeIsFatX(DeviceExt)); return STATUS_SUCCESS; } @@ -254,7 +254,7 @@ if (*BufferLength < sizeof(FILE_BASIC_INFORMATION)) return STATUS_BUFFER_OVERFLOW; - if (BooleanFlagOn(FCB->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(DeviceExt)) { FsdDosDateTimeToSystemTime(DeviceExt, FCB->entry.FatX.CreationDate, @@ -313,9 +313,7 @@ PDEVICE_OBJECT DeviceObject, PFILE_DISPOSITION_INFORMATION DispositionInfo) { -#if DBG PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; -#endif DPRINT("FsdSetDispositionInformation(<%wZ>, Delete %u)\n", &FCB->PathNameU, DispositionInfo->DeleteFile); @@ -359,7 +357,7 @@ return STATUS_CANNOT_DELETE; } - if (vfatFCBIsDirectory(FCB) && !VfatIsDirectoryEmpty(FCB)) + if (vfatFCBIsDirectory(FCB) && !VfatIsDirectoryEmpty(FCB, vfatVolumeIsFatX(DeviceExt))) { /* can't delete a non-empty directory */ @@ -1043,7 +1041,7 @@ if (*BufferLength < sizeof(FILE_NETWORK_OPEN_INFORMATION)) return(STATUS_BUFFER_OVERFLOW); - if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(DeviceExt)) { FsdDosDateTimeToSystemTime(DeviceExt, Fcb->entry.FatX.CreationDate, @@ -1184,7 +1182,8 @@ PFILE_OBJECT FileObject, PVFATFCB Fcb, ULONG Size, - ULONG ClusterSize) + ULONG ClusterSize, + BOOLEAN IsFatX) { if (Size > 0) { @@ -1196,7 +1195,7 @@ } if (!vfatFCBIsDirectory(Fcb)) { - if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) + if (IsFatX) Fcb->entry.FatX.FileSize = Size; else Fcb->entry.Fat.FileSize = Size; @@ -1221,7 +1220,7 @@ ULONG ClusterSize = DeviceExt->FatInfo.BytesPerCluster; ULONG NewSize = AllocationSize->u.LowPart; ULONG NCluster; - BOOLEAN AllocSizeChanged = FALSE, IsFatX = BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY); + BOOLEAN AllocSizeChanged = FALSE, IsFatX = vfatVolumeIsFatX(DeviceExt); DPRINT("VfatSetAllocationSizeInformation(File <%wZ>, AllocationSize %d %u)\n", &Fcb->PathNameU, AllocationSize->HighPart, AllocationSize->LowPart); @@ -1348,7 +1347,7 @@ return STATUS_DISK_FULL; } } - UpdateFileSize(FileObject, Fcb, NewSize, ClusterSize); + UpdateFileSize(FileObject, Fcb, NewSize, ClusterSize, vfatVolumeIsFatX(DeviceExt)); } else if (NewSize + ClusterSize <= Fcb->RFCB.AllocationSize.u.LowPart) { @@ -1364,7 +1363,7 @@ AllocSizeChanged = TRUE; /* FIXME: Use the cached cluster/offset better way. */ Fcb->LastCluster = Fcb->LastOffset = 0; - UpdateFileSize(FileObject, Fcb, NewSize, ClusterSize); + UpdateFileSize(FileObject, Fcb, NewSize, ClusterSize, vfatVolumeIsFatX(DeviceExt)); if (NewSize > 0) { Status = OffsetToCluster(DeviceExt, FirstCluster, @@ -1408,14 +1407,14 @@ } else { - UpdateFileSize(FileObject, Fcb, NewSize, ClusterSize); + UpdateFileSize(FileObject, Fcb, NewSize, ClusterSize, vfatVolumeIsFatX(DeviceExt)); } /* Update the on-disk directory entry */ Fcb->Flags |= FCB_IS_DIRTY; if (AllocSizeChanged) { - VfatUpdateEntry(Fcb); + VfatUpdateEntry(Fcb, vfatVolumeIsFatX(DeviceExt)); } return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/filesystems/fastfat/flush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/flush.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/flush.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -35,7 +35,7 @@ if (BooleanFlagOn(Fcb->Flags, FCB_IS_DIRTY)) { - Status = VfatUpdateEntry(Fcb); + Status = VfatUpdateEntry(Fcb, vfatVolumeIsFatX(DeviceExt)); if (!NT_SUCCESS(Status)) { IoStatus.Status = Status; Modified: trunk/reactos/drivers/filesystems/fastfat/rw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -1017,7 +1017,7 @@ // set dates and times KeQuerySystemTime (&SystemTime); - if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(IrpContext->DeviceExt)) { FsdSystemTimeToDosDateTime(IrpContext->DeviceExt, &SystemTime, &Fcb->entry.FatX.UpdateDate, 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] Fri Feb 17 21:24:12 2017 @@ -197,9 +197,9 @@ #define LONGNAME_MAX_LENGTH 256 // max length for a long filename -#define ENTRY_DELETED(DeviceExt, DirEntry) (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX) ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat))) -#define ENTRY_VOLUME(DeviceExt, DirEntry) (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX) ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat))) -#define ENTRY_END(DeviceExt, DirEntry) (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX) ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat))) +#define ENTRY_DELETED(DeviceExt, DirEntry) (vfatVolumeIsFatX(DeviceExt) ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat))) +#define ENTRY_VOLUME(DeviceExt, DirEntry) (vfatVolumeIsFatX(DeviceExt) ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat))) +#define ENTRY_END(DeviceExt, DirEntry) (vfatVolumeIsFatX(DeviceExt) ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat))) #define FAT_ENTRY_DELETED(DirEntry) ((DirEntry)->Filename[0] == 0xe5) #define FAT_ENTRY_END(DirEntry) ((DirEntry)->Filename[0] == 0) @@ -346,7 +346,6 @@ #define FCB_IS_PAGE_FILE 0x0008 #define FCB_IS_VOLUME 0x0010 #define FCB_IS_DIRTY 0x0020 -#define FCB_IS_FATX_ENTRY 0x0040 typedef struct _VFATFCB { @@ -530,6 +529,13 @@ return BooleanFlagOn(*FCB->Attributes, FILE_ATTRIBUTE_READONLY); } +FORCEINLINE +BOOLEAN +vfatVolumeIsFatX(PDEVICE_EXTENSION DeviceExt) +{ + return BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX); +} + /* blockdev.c */ NTSTATUS @@ -636,7 +642,8 @@ BOOLEAN VfatIsDirectoryEmpty( - PVFATFCB Fcb); + PVFATFCB Fcb, + BOOLEAN IsFatX); NTSTATUS FATGetNextDirEntry( @@ -668,7 +675,8 @@ NTSTATUS VfatUpdateEntry( - PVFATFCB pFcb); + PVFATFCB pFcb, + IN BOOLEAN IsFatX); NTSTATUS VfatDelEntry( Modified: trunk/reactos/drivers/filesystems/fastfat/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/volume.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/volume.c [iso-8859-1] Fri Feb 17 21:24:12 2017 @@ -59,7 +59,7 @@ *BufferLength -= DeviceObject->Vpb->VolumeLabelLength; } - if (BooleanFlagOn(DeviceExt->VolumeFcb->Flags, FCB_IS_FATX_ENTRY)) + if (vfatVolumeIsFatX(DeviceExt)) { FsdDosDateTimeToSystemTime(DeviceExt, DeviceExt->VolumeFcb->entry.FatX.CreationDate, @@ -260,7 +260,7 @@ return STATUS_NAME_TOO_LONG; } - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { if (FsLabelInfo->VolumeLabelLength / sizeof(WCHAR) > 42) return STATUS_NAME_TOO_LONG; @@ -289,7 +289,7 @@ if (!NT_SUCCESS(Status)) return Status; - if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) + if (vfatVolumeIsFatX(DeviceExt)) { RtlCopyMemory(VolumeLabelDirEntry.FatX.Filename, cString, LabelLen); memset(&VolumeLabelDirEntry.FatX.Filename[LabelLen], ' ', 42 - LabelLen);
7 years, 10 months
1
0
0
0
[pschweitzer] 73820: [FASTFAT] Fix a typo brought in r73819
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Fri Feb 17 18:06:38 2017 New Revision: 73820 URL:
http://svn.reactos.org/svn/reactos?rev=73820&view=rev
Log: [FASTFAT] Fix a typo brought in r73819 Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Fri Feb 17 18:06:38 2017 @@ -120,7 +120,7 @@ pFcb->PathNameU.Length - pFcb->LongNameU.Length, NULL, NULL, - VfatIsDirectoryEmpty(pFcb) ? + vfatFCBIsDirectory(pFcb) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME, FILE_ACTION_REMOVED, NULL);
7 years, 10 months
1
0
0
0
[pschweitzer] 73819: [FASTFAT] More FastFAT cleanup. Except a light performances boost due to useless checks removal in read/write and to some functions inlining More to follow...
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Fri Feb 17 17:58:18 2017 New Revision: 73819 URL:
http://svn.reactos.org/svn/reactos?rev=73819&view=rev
Log: [FASTFAT] More FastFAT cleanup. Except a light performances boost due to useless checks removal in read/write and to some functions inlining More to follow... Modified: trunk/reactos/drivers/filesystems/fastfat/blockdev.c trunk/reactos/drivers/filesystems/fastfat/cleanup.c trunk/reactos/drivers/filesystems/fastfat/close.c trunk/reactos/drivers/filesystems/fastfat/create.c trunk/reactos/drivers/filesystems/fastfat/dir.c trunk/reactos/drivers/filesystems/fastfat/direntry.c trunk/reactos/drivers/filesystems/fastfat/dirwr.c trunk/reactos/drivers/filesystems/fastfat/fastio.c trunk/reactos/drivers/filesystems/fastfat/fcb.c trunk/reactos/drivers/filesystems/fastfat/finfo.c trunk/reactos/drivers/filesystems/fastfat/flush.c trunk/reactos/drivers/filesystems/fastfat/fsctl.c trunk/reactos/drivers/filesystems/fastfat/misc.c trunk/reactos/drivers/filesystems/fastfat/rw.c trunk/reactos/drivers/filesystems/fastfat/vfat.h trunk/reactos/drivers/filesystems/fastfat/volume.c Modified: trunk/reactos/drivers/filesystems/fastfat/blockdev.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/blockdev.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/blockdev.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -56,7 +56,7 @@ } if (0 == InterlockedDecrement((PLONG)&IrpContext->RefCount) && - IrpContext->Flags & IRPCONTEXT_PENDINGRETURNED) + BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_PENDINGRETURNED)) { KeSetEvent(&IrpContext->Event, IO_NO_INCREMENT, FALSE); } Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -35,7 +35,7 @@ if (!pFcb) return STATUS_SUCCESS; - if (pFcb->Flags & FCB_IS_VOLUME) + if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME)) { pFcb->OpenHandleCount--; @@ -76,12 +76,12 @@ NULL); } - if (pFcb->Flags & FCB_IS_DIRTY) + if (BooleanFlagOn(pFcb->Flags, FCB_IS_DIRTY)) { VfatUpdateEntry (pFcb); } - if (pFcb->Flags & FCB_DELETE_PENDING && + if (BooleanFlagOn(pFcb->Flags, FCB_DELETE_PENDING) && pFcb->OpenHandleCount == 0) { if (vfatFCBIsDirectory(pFcb) && @@ -109,7 +109,7 @@ /* Uninitialize the cache (should be done even if caching was never initialized) */ CcUninitializeCacheMap(FileObject, &pFcb->RFCB.FileSize, NULL); - if (pFcb->Flags & FCB_DELETE_PENDING && + if (BooleanFlagOn(pFcb->Flags, FCB_DELETE_PENDING) && pFcb->OpenHandleCount == 0) { VfatDelEntry(DeviceExt, pFcb, NULL); @@ -120,8 +120,8 @@ pFcb->PathNameU.Length - pFcb->LongNameU.Length, NULL, NULL, - ((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? - FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), + VfatIsDirectoryEmpty(pFcb) ? + FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME, FILE_ACTION_REMOVED, NULL); } @@ -138,7 +138,7 @@ } #ifdef ENABLE_SWAPOUT - if (DeviceExt->Flags & VCB_DISMOUNT_PENDING) + if (BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING)) { VfatCheckForDismount(DeviceExt, FALSE); } Modified: trunk/reactos/drivers/filesystems/fastfat/close.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/close.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/close.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -39,7 +39,7 @@ return STATUS_SUCCESS; } - if (pFcb->Flags & FCB_IS_VOLUME) + if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME)) { DPRINT("Volume\n"); FileObject->FsContext2 = NULL; Modified: trunk/reactos/drivers/filesystems/fastfat/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -57,7 +57,7 @@ RtlOemStringToUnicodeString(NameU, &StringA, FALSE); - if (pEntry->lCase & VFAT_CASE_LOWER_BASE) + if (BooleanFlagOn(pEntry->lCase, VFAT_CASE_LOWER_BASE)) { RtlDowncaseUnicodeString(NameU, NameU, FALSE); } @@ -81,7 +81,7 @@ StringA.Length++); StringA.MaximumLength = StringA.Length; RtlOemStringToUnicodeString(NameU, &StringA, FALSE); - if (pEntry->lCase & VFAT_CASE_LOWER_EXT) + if (BooleanFlagOn(pEntry->lCase, VFAT_CASE_LOWER_EXT)) { RtlDowncaseUnicodeString(NameU, NameU, FALSE); } @@ -119,7 +119,7 @@ *(Vpb->VolumeLabel) = 0; Vpb->VolumeLabelLength = 0; - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { SizeDirEntry = sizeof(FATX_DIR_ENTRY); EntriesPerPage = FATX_ENTRIES_PER_PAGE; @@ -151,7 +151,7 @@ if (ENTRY_VOLUME(DeviceExt, Entry)) { /* copy volume label */ - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { StringO.Buffer = (PCHAR)Entry->FatX.Filename; StringO.MaximumLength = StringO.Length = Entry->FatX.FilenameLength; @@ -259,7 +259,7 @@ if (rcFcb) { ULONG startIndex = rcFcb->startIndex; - if ((rcFcb->Flags & FCB_IS_FATX_ENTRY) && !vfatFCBIsRoot(Parent)) + if (BooleanFlagOn(rcFcb->Flags, FCB_IS_FATX_ENTRY) && !vfatFCBIsRoot(Parent)) { startIndex += 2; } @@ -436,7 +436,7 @@ } /* Fail, if we try to overwrite an existing directory */ - if ((!(RequestedOptions & FILE_DIRECTORY_FILE) && (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) && + if ((!BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE) && vfatFCBIsDirectory(Fcb)) && (RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF || RequestedDisposition == FILE_SUPERSEDE)) @@ -445,14 +445,14 @@ return STATUS_OBJECT_NAME_COLLISION; } - if (Fcb->Flags & FCB_DELETE_PENDING) + if (BooleanFlagOn(Fcb->Flags, FCB_DELETE_PENDING)) { vfatReleaseFCB(DeviceExt, Fcb); return STATUS_DELETE_PENDING; } /* Fail, if we try to overwrite a read-only file */ - if ((*Fcb->Attributes & FILE_ATTRIBUTE_READONLY) && + if (vfatFCBIsReadOnly(Fcb) && (RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF)) { @@ -460,7 +460,7 @@ return STATUS_ACCESS_DENIED; } - if ((*Fcb->Attributes & FILE_ATTRIBUTE_READONLY) && + if (vfatFCBIsReadOnly(Fcb) && (RequestedOptions & FILE_DELETE_ON_CLOSE)) { vfatReleaseFCB(DeviceExt, Fcb); @@ -470,7 +470,7 @@ if ((vfatFCBIsRoot(Fcb) || (Fcb->LongNameU.Length == sizeof(WCHAR) && Fcb->LongNameU.Buffer[0] == L'.') || (Fcb->LongNameU.Length == 2 * sizeof(WCHAR) && Fcb->LongNameU.Buffer[0] == L'.' && Fcb->LongNameU.Buffer[1] == L'.')) && - (RequestedOptions & FILE_DELETE_ON_CLOSE)) + BooleanFlagOn(RequestedOptions, FILE_DELETE_ON_CLOSE)) { // we cannot delete a '.', '..' or the root directory vfatReleaseFCB(DeviceExt, Fcb); @@ -513,32 +513,32 @@ Stack = IoGetCurrentIrpStackLocation(Irp); RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff); RequestedOptions = Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS; - PagingFileCreate = (Stack->Flags & SL_OPEN_PAGING_FILE) ? TRUE : FALSE; - OpenTargetDir = (Stack->Flags & SL_OPEN_TARGET_DIRECTORY) ? TRUE : FALSE; + PagingFileCreate = BooleanFlagOn(Stack->Flags, SL_OPEN_PAGING_FILE); + OpenTargetDir = BooleanFlagOn(Stack->Flags, SL_OPEN_TARGET_DIRECTORY); FileObject = Stack->FileObject; DeviceExt = DeviceObject->DeviceExtension; - if (Stack->Parameters.Create.Options & FILE_OPEN_BY_FILE_ID) + if (BooleanFlagOn(Stack->Parameters.Create.Options, FILE_OPEN_BY_FILE_ID)) { return STATUS_NOT_IMPLEMENTED; } /* Check their validity. */ - if (RequestedOptions & FILE_DIRECTORY_FILE && + if (BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE) && RequestedDisposition == FILE_SUPERSEDE) { return STATUS_INVALID_PARAMETER; } - if (RequestedOptions & FILE_DIRECTORY_FILE && - RequestedOptions & FILE_NON_DIRECTORY_FILE) + if (BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE) && + BooleanFlagOn(RequestedOptions, FILE_NON_DIRECTORY_FILE)) { return STATUS_INVALID_PARAMETER; } /* Deny create if the volume is locked */ - if (DeviceExt->Flags & VCB_VOLUME_LOCKED) + if (BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED)) { return STATUS_ACCESS_DENIED; } @@ -569,7 +569,7 @@ return STATUS_INVALID_PARAMETER; } - if (RequestedOptions & FILE_DELETE_ON_CLOSE) + if (BooleanFlagOn(RequestedOptions, FILE_DELETE_ON_CLOSE)) { return STATUS_CANNOT_DELETE; } @@ -798,11 +798,11 @@ RequestedDisposition == FILE_SUPERSEDE) { Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL; - if (!(RequestedOptions & FILE_DIRECTORY_FILE)) + if (!BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE)) Attributes |= FILE_ATTRIBUTE_ARCHIVE; vfatSplitPathName(&PathNameU, NULL, &FileNameU); Status = VfatAddEntry(DeviceExt, &FileNameU, &pFcb, ParentFcb, RequestedOptions, - (UCHAR)(Attributes & FILE_ATTRIBUTE_VALID_FLAGS), NULL); + (UCHAR)FlagOn(Attributes, FILE_ATTRIBUTE_VALID_FLAGS), NULL); vfatReleaseFCB(DeviceExt, ParentFcb); if (NT_SUCCESS(Status)) { @@ -875,22 +875,22 @@ /* * Check the file has the requested attributes */ - if (RequestedOptions & FILE_NON_DIRECTORY_FILE && - *pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) + if (BooleanFlagOn(RequestedOptions, FILE_NON_DIRECTORY_FILE) && + vfatFCBIsDirectory(pFcb)) { VfatCloseFile (DeviceExt, FileObject); return STATUS_FILE_IS_A_DIRECTORY; } - if (RequestedOptions & FILE_DIRECTORY_FILE && - !(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) + if (BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE) && + !vfatFCBIsDirectory(pFcb)) { VfatCloseFile (DeviceExt, FileObject); return STATUS_NOT_A_DIRECTORY; } #ifndef USE_ROS_CC_AND_FS - if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) - { - if (Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA || + if (!vfatFCBIsDirectory(pFcb)) + { + if (BooleanFlagOn(Stack->Parameters.Create.SecurityContext->DesiredAccess, FILE_WRITE_DATA) || RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF || (RequestedOptions & FILE_DELETE_ON_CLOSE)) @@ -901,8 +901,8 @@ DPRINT1("%d %d %d\n", Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA, RequestedDisposition == FILE_OVERWRITE, RequestedDisposition == FILE_OVERWRITE_IF); VfatCloseFile (DeviceExt, FileObject); - return (RequestedOptions & FILE_DELETE_ON_CLOSE) ? STATUS_CANNOT_DELETE - : STATUS_SHARING_VIOLATION; + return (BooleanFlagOn(RequestedOptions, FILE_DELETE_ON_CLOSE)) ? STATUS_CANNOT_DELETE + : STATUS_SHARING_VIOLATION; } } } @@ -919,7 +919,7 @@ */ if (pFcb->RefCount > 1) { - if(!(pFcb->Flags & FCB_IS_PAGE_FILE)) + if(!BooleanFlagOn(pFcb->Flags, FCB_IS_PAGE_FILE)) { VfatCloseFile(DeviceExt, FileObject); return STATUS_INVALID_PARAMETER; @@ -932,7 +932,7 @@ } else { - if (pFcb->Flags & FCB_IS_PAGE_FILE) + if (BooleanFlagOn(pFcb->Flags, FCB_IS_PAGE_FILE)) { VfatCloseFile(DeviceExt, FileObject); return STATUS_INVALID_PARAMETER; @@ -943,7 +943,7 @@ RequestedDisposition == FILE_OVERWRITE_IF || RequestedDisposition == FILE_SUPERSEDE) { - if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) + if (!vfatFCBIsDirectory(pFcb)) { *pFcb->Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL; *pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE; @@ -999,7 +999,7 @@ pFcb->PathNameU.Length - pFcb->LongNameU.Length, NULL, NULL, - ((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(pFcb) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_ADDED, NULL); @@ -1034,7 +1034,7 @@ return STATUS_SUCCESS; } - if (!(IrpContext->Flags & IRPCONTEXT_CANWAIT)) + if (!BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)) { return VfatMarkIrpContextForQueue(IrpContext); } Modified: trunk/reactos/drivers/filesystems/fastfat/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/dir.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/dir.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -127,7 +127,7 @@ DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { FsdDosDateTimeToSystemTime(DeviceExt, DirContext->DirEntry.FatX.CreationDate, @@ -144,7 +144,7 @@ pInfo->ChangeTime = pInfo->LastWriteTime; - if (DirContext->DirEntry.FatX.Attrib & FILE_ATTRIBUTE_DIRECTORY) + if (BooleanFlagOn(DirContext->DirEntry.FatX.Attrib, FILE_ATTRIBUTE_DIRECTORY)) { pInfo->EndOfFile.QuadPart = 0; pInfo->AllocationSize.QuadPart = 0; @@ -178,7 +178,7 @@ pInfo->ChangeTime = pInfo->LastWriteTime; - if (DirContext->DirEntry.Fat.Attrib & FILE_ATTRIBUTE_DIRECTORY) + if (BooleanFlagOn(DirContext->DirEntry.Fat.Attrib, FILE_ATTRIBUTE_DIRECTORY)) { pInfo->EndOfFile.QuadPart = 0; pInfo->AllocationSize.QuadPart = 0; @@ -220,7 +220,7 @@ DirContext->LongNameU.Buffer, DirContext->LongNameU.Length); - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { FsdDosDateTimeToSystemTime(DeviceExt, DirContext->DirEntry.FatX.CreationDate, @@ -285,7 +285,7 @@ pInfo->EaSize = 0; - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { pInfo->FileNameLength = DirContext->LongNameU.Length; @@ -314,7 +314,7 @@ pInfo->ChangeTime = pInfo->LastWriteTime; - if (DirContext->DirEntry.FatX.Attrib & FILE_ATTRIBUTE_DIRECTORY) + if (BooleanFlagOn(DirContext->DirEntry.FatX.Attrib, FILE_ATTRIBUTE_DIRECTORY)) { pInfo->EndOfFile.QuadPart = 0; pInfo->AllocationSize.QuadPart = 0; @@ -364,7 +364,7 @@ pInfo->ChangeTime = pInfo->LastWriteTime; - if (DirContext->DirEntry.Fat.Attrib & FILE_ATTRIBUTE_DIRECTORY) + if (BooleanFlagOn(DirContext->DirEntry.Fat.Attrib, FILE_ATTRIBUTE_DIRECTORY)) { pInfo->EndOfFile.QuadPart = 0; pInfo->AllocationSize.QuadPart = 0; @@ -497,11 +497,11 @@ pCcb->SearchPattern.Length = sizeof(WCHAR); } - if (IrpContext->Stack->Flags & SL_INDEX_SPECIFIED) + if (BooleanFlagOn(IrpContext->Stack->Flags, SL_INDEX_SPECIFIED)) { DirContext.DirIndex = pCcb->Entry = Stack->Parameters.QueryDirectory.FileIndex; } - else if (FirstQuery || (IrpContext->Stack->Flags & SL_RESTART_SCAN)) + else if (FirstQuery || BooleanFlagOn(IrpContext->Stack->Flags, SL_RESTART_SCAN)) { DirContext.DirIndex = pCcb->Entry = 0; } @@ -579,7 +579,7 @@ pCcb->Entry = ++DirContext.DirIndex; BufferLength -= Buffer0->NextEntryOffset; - if (IrpContext->Stack->Flags & SL_RETURN_SINGLE_ENTRY) + if (BooleanFlagOn(IrpContext->Stack->Flags, SL_RETURN_SINGLE_ENTRY)) break; Buffer += Buffer0->NextEntryOffset; @@ -653,7 +653,7 @@ break; } - if (Status == STATUS_PENDING && IrpContext->Flags & IRPCONTEXT_COMPLETE) + if (Status == STATUS_PENDING && BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_COMPLETE)) { return VfatMarkIrpContextForQueue(IrpContext); } Modified: trunk/reactos/drivers/filesystems/fastfat/direntry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -27,7 +27,7 @@ cluster = pFatDirEntry->Fat.FirstCluster | (pFatDirEntry->Fat.FirstClusterHigh << 16); } - else if (pDeviceExt->Flags & VCB_IS_FATX) + else if (BooleanFlagOn(pDeviceExt->Flags, VCB_IS_FATX)) { cluster = pFatDirEntry->FatX.FirstCluster; } @@ -172,7 +172,7 @@ VfatIsDirectoryEmpty( PVFATFCB Fcb) { - if (Fcb->Flags & FCB_IS_FATX_ENTRY) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) return FATXIsDirectoryEmpty(Fcb); else return FATIsDirectoryEmpty(Fcb); Modified: trunk/reactos/drivers/filesystems/fastfat/dirwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -31,7 +31,7 @@ ASSERT(pFcb); - if (pFcb->Flags & FCB_IS_FATX_ENTRY) + if (BooleanFlagOn(pFcb->Flags, FCB_IS_FATX_ENTRY)) { SizeDirEntry = sizeof(FATX_DIR_ENTRY); dirIndex = pFcb->startIndex; @@ -44,7 +44,7 @@ DPRINT("updEntry dirIndex %u, PathName \'%wZ\'\n", dirIndex, &pFcb->PathNameU); - if (vfatFCBIsRoot(pFcb) || (pFcb->Flags & (FCB_IS_FAT|FCB_IS_VOLUME))) + if (vfatFCBIsRoot(pFcb) || BooleanFlagOn(pFcb->Flags, FCB_IS_FAT | FCB_IS_VOLUME)) { return STATUS_SUCCESS; } @@ -90,7 +90,7 @@ DPRINT("vfatRenameEntry(%p, %p, %wZ, %d)\n", DeviceExt, pFcb, FileName, CaseChangeOnly); - if (pFcb->Flags & FCB_IS_FATX_ENTRY) + if (BooleanFlagOn(pFcb->Flags, FCB_IS_FATX_ENTRY)) { VFAT_DIRENTRY_CONTEXT DirContext; @@ -162,7 +162,7 @@ ULONG SizeDirEntry; FileOffset.QuadPart = 0; - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) SizeDirEntry = sizeof(FATX_DIR_ENTRY); else SizeDirEntry = sizeof(FAT_DIR_ENTRY); @@ -304,6 +304,7 @@ BOOLEAN BaseAllLower, BaseAllUpper; BOOLEAN ExtensionAllLower, ExtensionAllUpper; BOOLEAN InExtension; + BOOLEAN IsDirectory; WCHAR c; ULONG CurrentCluster; LARGE_INTEGER SystemTime, FileOffset; @@ -323,6 +324,7 @@ DPRINT("addEntry: Name='%wZ', Dir='%wZ'\n", NameU, &ParentFcb->PathNameU); DirContext.LongNameU = *NameU; + IsDirectory = BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE); /* nb of entry needed for long name+normal entry */ nbSlots = (DirContext.LongNameU.Length / sizeof(WCHAR) + 12) / 13 + 1; @@ -480,7 +482,7 @@ /* set attributes */ DirContext.DirEntry.Fat.Attrib = ReqAttr; - if (RequestedOptions & FILE_DIRECTORY_FILE) + if (IsDirectory) { DirContext.DirEntry.Fat.Attrib |= FILE_ATTRIBUTE_DIRECTORY; } @@ -534,7 +536,7 @@ return STATUS_DISK_FULL; } DirContext.DirIndex = DirContext.StartIndex + nbSlots - 1; - if (RequestedOptions & FILE_DIRECTORY_FILE) + if (IsDirectory) { /* If we aren't moving, use next */ if (MoveContext == NULL) @@ -653,7 +655,7 @@ DPRINT("new : entry=%11.11s\n", (*Fcb)->entry.Fat.Filename); DPRINT("new : entry=%11.11s\n", DirContext.DirEntry.Fat.Filename); - if (RequestedOptions & FILE_DIRECTORY_FILE) + if (IsDirectory) { FileOffset.QuadPart = 0; _SEH2_TRY @@ -759,7 +761,7 @@ /* set attributes */ DirContext.DirEntry.FatX.Attrib = ReqAttr; - if (RequestedOptions & FILE_DIRECTORY_FILE) + if (BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE)) { DirContext.DirEntry.FatX.Attrib |= FILE_ATTRIBUTE_DIRECTORY; } @@ -822,7 +824,7 @@ IN UCHAR ReqAttr, IN PVFAT_MOVE_CONTEXT MoveContext) { - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) return FATXAddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); else return FATAddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext); @@ -925,7 +927,7 @@ ASSERT(pFcb); ASSERT(pFcb->parentFcb); - ASSERT(pFcb->Flags & FCB_IS_FATX_ENTRY); + ASSERT(BooleanFlagOn(pFcb->Flags, FCB_IS_FATX_ENTRY)); StartIndex = pFcb->startIndex; @@ -981,7 +983,7 @@ IN PVFATFCB pFcb, OUT PVFAT_MOVE_CONTEXT MoveContext) { - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) return FATXDelEntry(DeviceExt, pFcb, MoveContext); else return FATDelEntry(DeviceExt, pFcb, MoveContext); Modified: trunk/reactos/drivers/filesystems/fastfat/fastio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fastio.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fastio.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -131,7 +131,7 @@ FsRtlEnterFileSystem(); - if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + if (!BooleanFlagOn(FCB->Flags, FCB_IS_PAGE_FILE)) { if (!ExAcquireResourceSharedLite(&FCB->MainResource, Wait)) { @@ -146,7 +146,7 @@ Buffer, &BufferLength); - if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + if (!BooleanFlagOn(FCB->Flags, FCB_IS_PAGE_FILE)) { ExReleaseResourceLite(&FCB->MainResource); } @@ -192,7 +192,7 @@ FsRtlEnterFileSystem(); - if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + if (!BooleanFlagOn(FCB->Flags, FCB_IS_PAGE_FILE)) { if (!ExAcquireResourceSharedLite(&FCB->MainResource, Wait)) { @@ -205,7 +205,7 @@ Buffer, &BufferLength); - if (!(FCB->Flags & FCB_IS_PAGE_FILE)) + if (!BooleanFlagOn(FCB->Flags, FCB_IS_PAGE_FILE)) { ExReleaseResourceLite(&FCB->MainResource); } @@ -691,7 +691,7 @@ UNREFERENCED_PARAMETER(DeviceObject); /* Make sure it is not a volume lock */ - ASSERT(!(Fcb->Flags & FCB_IS_VOLUME)); + ASSERT(!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME)); /* Acquire the resource */ ExAcquireResourceExclusiveLite(&(Fcb->MainResource), TRUE); @@ -715,7 +715,7 @@ UNREFERENCED_PARAMETER(DeviceObject); /* Make sure it is not a volume lock */ - ASSERT(!(Fcb->Flags & FCB_IS_VOLUME)); + ASSERT(!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME)); /* Release the resource */ ExReleaseResourceLite(&(Fcb->MainResource)); Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -136,7 +136,7 @@ } RtlZeroMemory(rcFCB, sizeof(VFATFCB)); vfatInitFcb(rcFCB, pFileNameU); - if (pVCB->Flags & VCB_IS_FATX) + if (BooleanFlagOn(pVCB->Flags, VCB_IS_FATX)) { rcFCB->Flags |= FCB_IS_FATX_ENTRY; rcFCB->Attributes = &rcFCB->entry.FatX.Attrib; @@ -281,13 +281,6 @@ } BOOLEAN -vfatFCBIsDirectory( - PVFATFCB FCB) -{ - return ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY); -} - -BOOLEAN vfatFCBIsRoot( PVFATFCB FCB) { @@ -408,7 +401,7 @@ } } } - else if (Fcb->Flags & FCB_IS_FATX_ENTRY) + else if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) { Size = Fcb->entry.FatX.FileSize; } @@ -418,7 +411,7 @@ } Fcb->dirIndex = DirContext->DirIndex; Fcb->startIndex = DirContext->StartIndex; - if ((Fcb->Flags & FCB_IS_FATX_ENTRY) && !vfatFCBIsRoot(Fcb)) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY) && !vfatFCBIsRoot(Fcb)) { ASSERT(DirContext->DirIndex >= 2 && DirContext->StartIndex >= 2); Fcb->dirIndex = DirContext->DirIndex-2; @@ -460,7 +453,7 @@ Fcb->DirNameU.Buffer = Fcb->PathNameU.Buffer; vfatSplitPathName(&Fcb->PathNameU, &Fcb->DirNameU, &Fcb->LongNameU); Fcb->Hash.Hash = vfatNameHash(0, &Fcb->PathNameU); - if (pVCB->Flags & VCB_IS_FATX) + if (BooleanFlagOn(pVCB->Flags, VCB_IS_FATX)) { Fcb->ShortHash.Hash = Fcb->Hash.Hash; } @@ -644,7 +637,7 @@ UNICODE_STRING NameU = RTL_CONSTANT_STRING(L"\\"); FCB = vfatNewFCB(pVCB, &NameU); - if (FCB->Flags & FCB_IS_FATX_ENTRY) + if (BooleanFlagOn(FCB->Flags, FCB_IS_FATX_ENTRY)) { memset(FCB->entry.FatX.Filename, ' ', 42); FCB->entry.FatX.FileSize = pVCB->FatInfo.rootDirectorySectors * pVCB->FatInfo.BytesPerSector; Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -338,7 +338,7 @@ return STATUS_SUCCESS; } - if (*FCB->Attributes & FILE_ATTRIBUTE_READONLY) + if (vfatFCBIsReadOnly(FCB)) { return STATUS_CANNOT_DELETE; } @@ -398,7 +398,7 @@ if (ReplaceIfExists) { /* If that's a directory or a read-only file, we're not allowed */ - if (vfatFCBIsDirectory(TargetFcb) || ((*TargetFcb->Attributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY)) + if (vfatFCBIsDirectory(TargetFcb) || vfatFCBIsReadOnly(TargetFcb)) { DPRINT("And this is a readonly file!\n"); vfatReleaseFCB(DeviceExt, *ParentFCB); @@ -791,7 +791,7 @@ FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, NULL, - ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(FCB) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_RENAMED_OLD_NAME, NULL); @@ -804,7 +804,7 @@ FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, NULL, - ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(FCB) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_RENAMED_NEW_NAME, NULL); @@ -834,7 +834,7 @@ FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, NULL, - ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(FCB) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), (DeletedTarget ? FILE_ACTION_REMOVED : FILE_ACTION_RENAMED_OLD_NAME), NULL); @@ -862,7 +862,7 @@ FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, NULL, - ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(FCB) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_RENAMED_NEW_NAME, NULL); @@ -905,7 +905,7 @@ FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, NULL, - ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(FCB) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_REMOVED, NULL); @@ -933,7 +933,7 @@ FCB->PathNameU.Length - FCB->LongNameU.Length, NULL, NULL, - ((*FCB->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + (vfatFCBIsDirectory(FCB) ? FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), FILE_ACTION_ADDED, NULL); Modified: trunk/reactos/drivers/filesystems/fastfat/flush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/flush.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/flush.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -33,7 +33,7 @@ IoStatus.Status = STATUS_SUCCESS; } - if (Fcb->Flags & FCB_IS_DIRTY) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_DIRTY)) { Status = VfatUpdateEntry(Fcb); if (!NT_SUCCESS(Status)) @@ -157,7 +157,7 @@ Fcb = (PVFATFCB)IrpContext->FileObject->FsContext; ASSERT(Fcb); - if (Fcb->Flags & FCB_IS_VOLUME) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME)) { ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, TRUE); Status = VfatFlushVolume(IrpContext->DeviceExt, Fcb); Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -816,8 +816,8 @@ Flags = (PULONG)IrpContext->Irp->AssociatedIrp.SystemBuffer; *Flags = 0; - if ((IrpContext->DeviceExt->VolumeFcb->Flags & VCB_IS_DIRTY) && - !(IrpContext->DeviceExt->VolumeFcb->Flags & VCB_CLEAR_DIRTY)) + if (BooleanFlagOn(IrpContext->DeviceExt->VolumeFcb->Flags, VCB_IS_DIRTY) && + !BooleanFlagOn(IrpContext->DeviceExt->VolumeFcb->Flags, VCB_CLEAR_DIRTY)) { *Flags |= VOLUME_IS_DIRTY; } @@ -837,7 +837,7 @@ DPRINT("VfatMarkVolumeDirty(IrpContext %p)\n", IrpContext); DeviceExt = IrpContext->DeviceExt; - if (!(DeviceExt->VolumeFcb->Flags & VCB_IS_DIRTY)) + if (!BooleanFlagOn(DeviceExt->VolumeFcb->Flags, VCB_IS_DIRTY)) { Status = GetNextCluster(DeviceExt, 1, &eocMark); if (NT_SUCCESS(Status)) @@ -870,14 +870,14 @@ Fcb = FileObject->FsContext; /* Only allow locking with the volume open */ - if (!(Fcb->Flags & FCB_IS_VOLUME)) + if (!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME)) { return STATUS_ACCESS_DENIED; } /* Bail out if it's already in the demanded state */ - if (((DeviceExt->Flags & VCB_VOLUME_LOCKED) && Lock) || - (!(DeviceExt->Flags & VCB_VOLUME_LOCKED) && !Lock)) + if ((BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED) && Lock) || + (!BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED) && !Lock)) { return STATUS_ACCESS_DENIED; } @@ -921,13 +921,13 @@ /* We HAVE to be locked. Windows also allows dismount with no lock * but we're here mainly for 1st stage, so KISS */ - if (!(DeviceExt->Flags & VCB_VOLUME_LOCKED)) + if (!BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED)) { return STATUS_ACCESS_DENIED; } /* Race condition? */ - if (DeviceExt->Flags & VCB_DISMOUNT_PENDING) + if (BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING)) { return STATUS_VOLUME_DISMOUNTED; } @@ -937,7 +937,7 @@ ExAcquireResourceExclusiveLite(&DeviceExt->FatResource, TRUE); - if (DeviceExt->VolumeFcb->Flags & VCB_CLEAR_DIRTY) + if (BooleanFlagOn(DeviceExt->VolumeFcb->Flags, VCB_CLEAR_DIRTY)) { /* Set clean shutdown bit */ Status = GetNextCluster(DeviceExt, 1, &eocMark); Modified: trunk/reactos/drivers/filesystems/fastfat/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/misc.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/misc.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -76,7 +76,7 @@ return STATUS_INVALID_DEVICE_REQUEST; } - if (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) + if (vfatFCBIsDirectory(Fcb)) { return STATUS_INVALID_PARAMETER; } @@ -106,6 +106,7 @@ IN PVFAT_IRP_CONTEXT IrpContext) { NTSTATUS Status; + BOOLEAN QueueIrp, CompleteIrp; DPRINT("VfatDispatchRequest (IrpContext %p), is called for %s\n", IrpContext, IrpContext->MajorFunction >= IRP_MJ_MAXIMUM_FUNCTION ? "????" : MajorFunctionNames[IrpContext->MajorFunction]); @@ -181,17 +182,20 @@ Status = STATUS_DRIVER_INTERNAL_ERROR; } - ASSERT((!(IrpContext->Flags & IRPCONTEXT_COMPLETE) && !(IrpContext->Flags & IRPCONTEXT_QUEUE)) || - ((IrpContext->Flags & IRPCONTEXT_COMPLETE) && !(IrpContext->Flags & IRPCONTEXT_QUEUE)) || - (!(IrpContext->Flags & IRPCONTEXT_COMPLETE) && (IrpContext->Flags & IRPCONTEXT_QUEUE))); - - if (IrpContext->Flags & IRPCONTEXT_COMPLETE) + QueueIrp = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_QUEUE); + CompleteIrp = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_COMPLETE); + + ASSERT((!CompleteIrp && !QueueIrp) || + (CompleteIrp && !QueueIrp) || + (!CompleteIrp && QueueIrp)); + + if (CompleteIrp) { IrpContext->Irp->IoStatus.Status = Status; IoCompleteRequest(IrpContext->Irp, IrpContext->PriorityBoost); } - if (IrpContext->Flags & IRPCONTEXT_QUEUE) + if (QueueIrp) { /* Reset our status flags before queueing the IRP */ IrpContext->Flags |= IRPCONTEXT_COMPLETE; Modified: trunk/reactos/drivers/filesystems/fastfat/rw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -155,7 +155,7 @@ ASSERT(Length % BytesPerSector == 0); /* Is this a read of the FAT? */ - if (Fcb->Flags & FCB_IS_FAT) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_FAT)) { ReadOffset.QuadPart += DeviceExt->FatInfo.FATStart * BytesPerSector; Status = VfatReadDiskPartial(IrpContext, &ReadOffset, Length, 0, TRUE); @@ -172,7 +172,7 @@ } /* Is this a read of the Volume ? */ - if (Fcb->Flags & FCB_IS_VOLUME) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME)) { Status = VfatReadDiskPartial(IrpContext, &ReadOffset, Length, 0, TRUE); if (NT_SUCCESS(Status)) @@ -367,7 +367,7 @@ ASSERT(Length % BytesPerSector == 0); /* Is this a write of the volume? */ - if (Fcb->Flags & FCB_IS_VOLUME) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME)) { Status = VfatWriteDiskPartial(IrpContext, &WriteOffset, Length, 0, TRUE); if (!NT_SUCCESS(Status)) @@ -378,7 +378,7 @@ } /* Is this a write to the FAT? */ - if (Fcb->Flags & FCB_IS_FAT) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_FAT)) { WriteOffset.u.LowPart += DeviceExt->FatInfo.FATStart * BytesPerSector; IrpContext->RefCount = 1; @@ -547,7 +547,7 @@ LARGE_INTEGER ByteOffset; PVOID Buffer; ULONG BytesPerSector; - BOOLEAN PagingIo, CanWait, IsVolume; + BOOLEAN PagingIo, CanWait, IsVolume, NoCache; ASSERT(IrpContext); @@ -568,7 +568,7 @@ Fcb = IrpContext->FileObject->FsContext; ASSERT(Fcb); - if (Fcb->Flags & FCB_IS_PAGE_FILE) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_PAGE_FILE)) { PFATINFO FatInfo = &IrpContext->DeviceExt->FatInfo; IrpContext->Stack->Parameters.Read.ByteOffset.QuadPart += FatInfo->dataStart * FatInfo->BytesPerSector; @@ -587,9 +587,10 @@ PagingIo = BooleanFlagOn(IrpContext->Irp->Flags, IRP_PAGING_IO); CanWait = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT); IsVolume = BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME); + NoCache = BooleanFlagOn(IrpContext->Irp->Flags, IRP_NOCACHE); /* fail if file is a directory and no paged read */ - if (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY && !PagingIo) + if (vfatFCBIsDirectory(Fcb) && !PagingIo) { Status = STATUS_INVALID_PARAMETER; goto ByeBye; @@ -617,7 +618,7 @@ goto ByeBye; } - if (IrpContext->Irp->Flags & (IRP_PAGING_IO | IRP_NOCACHE) || IsVolume) + if (NoCache || PagingIo || IsVolume) { if (ByteOffset.u.LowPart % BytesPerSector != 0 || Length % BytesPerSector != 0) { @@ -660,8 +661,7 @@ Buffer = VfatGetUserBuffer(IrpContext->Irp, PagingIo); - if (!(IrpContext->Irp->Flags & (IRP_NOCACHE|IRP_PAGING_IO)) && - !(Fcb->Flags & (FCB_IS_PAGE_FILE|FCB_IS_VOLUME))) + if (!PagingIo && !NoCache && !IsVolume) { // cached read Status = STATUS_SUCCESS; @@ -744,7 +744,7 @@ else { IrpContext->Irp->IoStatus.Status = Status; - if (IrpContext->FileObject->Flags & FO_SYNCHRONOUS_IO && + if (BooleanFlagOn(IrpContext->FileObject->Flags, FO_SYNCHRONOUS_IO) && !PagingIo && (NT_SUCCESS(Status) || Status == STATUS_END_OF_FILE)) { @@ -771,7 +771,7 @@ ULONG Length = 0; PVOID Buffer; ULONG BytesPerSector; - BOOLEAN PagingIo, CanWait, IsVolume; + BOOLEAN PagingIo, CanWait, IsVolume, IsFAT, NoCache; ASSERT(IrpContext); @@ -792,7 +792,7 @@ Fcb = IrpContext->FileObject->FsContext; ASSERT(Fcb); - if (Fcb->Flags & FCB_IS_PAGE_FILE) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_PAGE_FILE)) { PFATINFO FatInfo = &IrpContext->DeviceExt->FatInfo; IrpContext->Stack->Parameters.Write.ByteOffset.QuadPart += FatInfo->dataStart * FatInfo->BytesPerSector; @@ -808,9 +808,11 @@ PagingIo = BooleanFlagOn(IrpContext->Irp->Flags, IRP_PAGING_IO); CanWait = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT); IsVolume = BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME); + IsFAT = BooleanFlagOn(Fcb->Flags, FCB_IS_FAT); + NoCache = BooleanFlagOn(IrpContext->Irp->Flags, IRP_NOCACHE); /* fail if file is a directory and no paged read */ - if (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY && !PagingIo) + if (vfatFCBIsDirectory(Fcb) && !PagingIo) { Status = STATUS_INVALID_PARAMETER; goto ByeBye; @@ -831,7 +833,7 @@ goto ByeBye; } - if (Fcb->Flags & (FCB_IS_FAT | FCB_IS_VOLUME) || + if (IsFAT || IsVolume || vfatDirEntryGetFirstCluster(IrpContext->DeviceExt, &Fcb->entry) == 1) { if (ByteOffset.QuadPart + Length > Fcb->RFCB.FileSize.QuadPart) @@ -842,7 +844,7 @@ } } - if (IrpContext->Irp->Flags & (IRP_PAGING_IO|IRP_NOCACHE) || IsVolume) + if (PagingIo || NoCache || IsVolume) { if (ByteOffset.u.LowPart % BytesPerSector != 0 || Length % BytesPerSector != 0) { @@ -889,7 +891,7 @@ Resource = &Fcb->MainResource; } - if ((Fcb->Flags & FCB_IS_PAGE_FILE) || PagingIo) + if (PagingIo) { if (!ExAcquireResourceSharedLite(Resource, CanWait)) { @@ -929,8 +931,7 @@ Buffer = VfatGetUserBuffer(IrpContext->Irp, PagingIo); - if (!(Fcb->Flags & (FCB_IS_FAT|FCB_IS_VOLUME)) && - !PagingIo && + if (!IsFAT && !IsVolume && !PagingIo && ByteOffset.u.LowPart + Length > Fcb->RFCB.FileSize.u.LowPart) { LARGE_INTEGER AllocationSize; @@ -943,8 +944,7 @@ } } - if (!(IrpContext->Irp->Flags & (IRP_NOCACHE|IRP_PAGING_IO)) && - !(Fcb->Flags & (FCB_IS_PAGE_FILE|FCB_IS_VOLUME))) + if (!NoCache && !PagingIo && !IsVolume) { // cached write @@ -1008,17 +1008,16 @@ } Metadata: - if (!PagingIo && - !(Fcb->Flags & (FCB_IS_FAT|FCB_IS_VOLUME))) - { - if(!(*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) + if (!PagingIo && !IsFAT && !IsVolume) + { + if(!vfatFCBIsDirectory(Fcb)) { LARGE_INTEGER SystemTime; ULONG Filter; // set dates and times KeQuerySystemTime (&SystemTime); - if (Fcb->Flags & FCB_IS_FATX_ENTRY) + if (BooleanFlagOn(Fcb->Flags, FCB_IS_FATX_ENTRY)) { FsdSystemTimeToDosDateTime(IrpContext->DeviceExt, &SystemTime, &Fcb->entry.FatX.UpdateDate, @@ -1069,7 +1068,7 @@ else { IrpContext->Irp->IoStatus.Status = Status; - if (IrpContext->FileObject->Flags & FO_SYNCHRONOUS_IO && + if (BooleanFlagOn(IrpContext->FileObject->Flags, FO_SYNCHRONOUS_IO) && !PagingIo && NT_SUCCESS(Status)) { IrpContext->FileObject->CurrentByteOffset.QuadPart = 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] Fri Feb 17 17:58:18 2017 @@ -516,6 +516,20 @@ return STATUS_PENDING; } +FORCEINLINE +BOOLEAN +vfatFCBIsDirectory(PVFATFCB FCB) +{ + return BooleanFlagOn(*FCB->Attributes, FILE_ATTRIBUTE_DIRECTORY); +} + +FORCEINLINE +BOOLEAN +vfatFCBIsReadOnly(PVFATFCB FCB) +{ + return BooleanFlagOn(*FCB->Attributes, FILE_ATTRIBUTE_READONLY); +} + /* blockdev.c */ NTSTATUS Modified: trunk/reactos/drivers/filesystems/fastfat/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/volume.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/volume.c [iso-8859-1] Fri Feb 17 17:58:18 2017 @@ -59,7 +59,7 @@ *BufferLength -= DeviceObject->Vpb->VolumeLabelLength; } - if (DeviceExt->VolumeFcb->Flags & FCB_IS_FATX_ENTRY) + if (BooleanFlagOn(DeviceExt->VolumeFcb->Flags, FCB_IS_FATX_ENTRY)) { FsdDosDateTimeToSystemTime(DeviceExt, DeviceExt->VolumeFcb->entry.FatX.CreationDate, @@ -260,7 +260,7 @@ return STATUS_NAME_TOO_LONG; } - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { if (FsLabelInfo->VolumeLabelLength / sizeof(WCHAR) > 42) return STATUS_NAME_TOO_LONG; @@ -289,7 +289,7 @@ if (!NT_SUCCESS(Status)) return Status; - if (DeviceExt->Flags & VCB_IS_FATX) + if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX)) { RtlCopyMemory(VolumeLabelDirEntry.FatX.Filename, cString, LabelLen); memset(&VolumeLabelDirEntry.FatX.Filename[LabelLen], ' ', 42 - LabelLen);
7 years, 10 months
1
0
0
0
[gadamopoulos] 73818: [SHELL32] -Expand the name of the cpl file because CreateActCtx needs a full path.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Feb 17 17:23:17 2017 New Revision: 73818 URL:
http://svn.reactos.org/svn/reactos?rev=73818&view=rev
Log: [SHELL32] -Expand the name of the cpl file because CreateActCtx needs a full path. Modified: trunk/reactos/dll/win32/shell32/wine/control.c Modified: trunk/reactos/dll/win32/shell32/wine/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/con…
============================================================================== --- trunk/reactos/dll/win32/shell32/wine/control.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/wine/control.c [iso-8859-1] Fri Feb 17 17:23:17 2017 @@ -30,6 +30,8 @@ #include <shellapi.h> #include <wine/debug.h> +#include <strsafe.h> + #include "cpanel.h" #include "wine/unicode.h" @@ -57,6 +59,7 @@ ACTCTXW ActCtx = {sizeof(ACTCTX), ACTCTX_FLAG_RESOURCE_NAME_VALID}; ULONG_PTR cookie; BOOL bActivated; + WCHAR fileBuffer[MAX_PATH]; #endif CPlApplet* applet; DWORD len; @@ -86,7 +89,9 @@ applet->hWnd = hWnd; #ifdef __REACTOS__ - ActCtx.lpSource = applet->cmd; + StringCchCopy(fileBuffer, MAX_PATH, applet->cmd); + SearchPath(NULL, fileBuffer, NULL, MAX_PATH, fileBuffer, NULL); + ActCtx.lpSource = fileBuffer; ActCtx.lpResourceName = (LPCWSTR)123; applet->hActCtx = CreateActCtx(&ActCtx); bActivated = (applet->hActCtx != INVALID_HANDLE_VALUE ? ActivateActCtx(applet->hActCtx, &cookie) : FALSE);
7 years, 10 months
1
0
0
0
[mjansen] 73817: [DBGHELP] Add experimental rsym support. CORE-12773
by mjansen@svn.reactos.org
Author: mjansen Date: Fri Feb 17 16:18:15 2017 New Revision: 73817 URL:
http://svn.reactos.org/svn/reactos?rev=73817&view=rev
Log: [DBGHELP] Add experimental rsym support. CORE-12773 Added: trunk/reactos/dll/win32/dbghelp/rsym.c (with props) Modified: trunk/reactos/dll/win32/dbghelp/CMakeLists.txt trunk/reactos/dll/win32/dbghelp/dbghelp_private.h trunk/reactos/dll/win32/dbghelp/pe_module.c Modified: trunk/reactos/dll/win32/dbghelp/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dbghelp/CMakeLis…
============================================================================== --- trunk/reactos/dll/win32/dbghelp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dbghelp/CMakeLists.txt [iso-8859-1] Fri Feb 17 16:18:15 2017 @@ -63,6 +63,7 @@ path.c pe_module.c rosstubs.c + rsym.c source.c stabs.c stack.c Modified: trunk/reactos/dll/win32/dbghelp/dbghelp_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dbghelp/dbghelp_…
============================================================================== --- trunk/reactos/dll/win32/dbghelp/dbghelp_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dbghelp/dbghelp_private.h [iso-8859-1] Fri Feb 17 16:18:15 2017 @@ -713,6 +713,12 @@ struct image_file_map* fmap) DECLSPEC_HIDDEN; extern BOOL dwarf2_virtual_unwind(struct cpu_stack_walk* csw, DWORD_PTR ip, CONTEXT* context, ULONG_PTR* cfa) DECLSPEC_HIDDEN; + +/* rsym.c */ +extern BOOL rsym_parse(struct module* module, unsigned long load_offset, + const void* rsym, int rsymlen) DECLSPEC_HIDDEN; + + /* stack.c */ #ifndef DBGHELP_STATIC_LIB Modified: trunk/reactos/dll/win32/dbghelp/pe_module.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dbghelp/pe_modul…
============================================================================== --- trunk/reactos/dll/win32/dbghelp/pe_module.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dbghelp/pe_module.c [iso-8859-1] Fri Feb 17 16:18:15 2017 @@ -507,6 +507,32 @@ #ifndef DBGHELP_STATIC_LIB /****************************************************************** + * pe_load_rsym + * + * look for ReactOS's own rsym format + */ +static BOOL pe_load_rsym(struct module* module) +{ + struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap; + struct image_section_map sect_rsym; + BOOL ret = FALSE; + + if (pe_find_section(fmap, ".rossym", §_rsym)) + { + const char* rsym = image_map_section(§_rsym); + if (rsym != IMAGE_NO_MAP) + { + ret = rsym_parse(module, module->module.BaseOfImage, + rsym, image_get_map_size(§_rsym)); + } + image_unmap_section(§_rsym); + } + TRACE("%s the RSYM debug info\n", ret ? "successfully loaded" : "failed to load"); + + return ret; +} + +/****************************************************************** * pe_load_dbg_file * * loads a .dbg file @@ -704,7 +730,9 @@ ret = pe_load_dwarf(module) || ret; #ifndef DBGHELP_STATIC_LIB ret = pe_load_msc_debug_info(pcs, module) || ret; + ret = pe_load_rsym(module) || ret; #endif + ret = ret || pe_load_coff_symbol_table(module); /* FIXME */ /* if we still have no debug info (we could only get SymExport at this * point), then do the SymExport except if we have an ELF container, Added: trunk/reactos/dll/win32/dbghelp/rsym.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dbghelp/rsym.c?r…
============================================================================== --- trunk/reactos/dll/win32/dbghelp/rsym.c (added) +++ trunk/reactos/dll/win32/dbghelp/rsym.c [iso-8859-1] Fri Feb 17 16:18:15 2017 @@ -0,0 +1,181 @@ +/* + * PROJECT: ReactOS dbghelp extension + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Parse rsym information for use with dbghelp + * PROGRAMMER: Mark Jansen + */ + +#include "dbghelp_private.h" +#include <reactos/rossym.h> + +WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_rsym); + + +typedef struct rsym_file_entry_s +{ + const char* File; + unsigned Source; +} rsym_file_entry_t; + +typedef struct rsym_func_entry_s +{ + ULONG_PTR Address; + struct symt_function* func; + struct rsym_func_entry_s* next; +} rsym_func_entry_t; + + + +/****************************************************************** + * rsym_finalize_function (copied from stabs_finalize_function) + * + * Ends function creation: mainly: + * - cleans up line number information + * - tries to set up a debug-start tag (FIXME: heuristic to be enhanced) + */ +static void rsym_finalize_function(struct module* module, struct symt_function* func) +{ + IMAGEHLP_LINE64 il; + struct location loc; + + if (!func) return; + symt_normalize_function(module, func); + /* To define the debug-start of the function, we use the second line number. + * Not 100% bullet proof, but better than nothing + */ + if (symt_fill_func_line_info(module, func, func->address, &il) && + symt_get_func_line_next(module, &il)) + { + loc.kind = loc_absolute; + loc.offset = il.Address - func->address; + symt_add_function_point(module, func, SymTagFuncDebugStart, + &loc, NULL); + } +} + + +static int is_metadata_sym(const char* name) +{ + ULONG len = name ? strlen(name) : 0; + return len > 3 && name[0] == '_' && name[1] != '_' && name[len-1] == '_' && name[len-2] == '_'; +}; + +static int use_raw_address(const char* name) +{ + if (!name) + return 0; + + if (!strcmp(name, "__ImageBase")) + return 1; + + if (!strcmp(name, "__RUNTIME_PSEUDO_RELOC_LIST__")) + return 1; + + return 0; +} + + +BOOL rsym_parse(struct module* module, unsigned long load_offset, + const void* rsym_ptr, int rsymlen) +{ + const ROSSYM_HEADER* RosSymHeader; + const ROSSYM_ENTRY* First, *Last, *Entry; + const CHAR* Strings; + + struct pool pool; + struct sparse_array file_table, func_table; + rsym_func_entry_t* first_func = NULL; + + + RosSymHeader = rsym_ptr; + + if (RosSymHeader->SymbolsOffset < sizeof(ROSSYM_HEADER) + || RosSymHeader->StringsOffset < RosSymHeader->SymbolsOffset + RosSymHeader->SymbolsLength + || rsymlen < RosSymHeader->StringsOffset + RosSymHeader->StringsLength + || 0 != (RosSymHeader->SymbolsLength % sizeof(ROSSYM_ENTRY))) + { + WARN("Invalid ROSSYM_HEADER\n"); + return FALSE; + } + + First = (const ROSSYM_ENTRY *)((const char*)rsym_ptr + RosSymHeader->SymbolsOffset); + Last = First + RosSymHeader->SymbolsLength / sizeof(ROSSYM_ENTRY); + Strings = (const CHAR*)rsym_ptr + RosSymHeader->StringsOffset; + + pool_init(&pool, 65536); + sparse_array_init(&file_table, sizeof(rsym_file_entry_t), 64); + sparse_array_init(&func_table, sizeof(rsym_func_entry_t), 128); + + for (Entry = First; Entry != Last; Entry++) + { + ULONG Address = load_offset + Entry->Address; + if (!Entry->FileOffset) + { + rsym_func_entry_t* func = sparse_array_find(&func_table, Entry->FunctionOffset); + + /* We do not want to define a data point where there is already a function! */ + if (!func || func->Address != Address) + { + const char* SymbolName = Strings + Entry->FunctionOffset; + if (!is_metadata_sym(SymbolName)) + { + /* TODO: How should we determine the size? */ + ULONG Size = sizeof(ULONG); + if (use_raw_address(SymbolName)) + Address = Entry->Address; + + symt_new_public(module, NULL, SymbolName, Address, Size); + } + else + { + /* Maybe use it to fill some metadata? */ + } + } + } + else + { + rsym_file_entry_t* file = sparse_array_find(&file_table, Entry->FileOffset); + rsym_func_entry_t* func = sparse_array_find(&func_table, Entry->FunctionOffset); + + if (!file) + { + file = sparse_array_add(&file_table, Entry->FileOffset, &pool); + file->File = Strings + Entry->FileOffset; + file->Source = source_new(module, NULL, Strings + Entry->FileOffset); + } + + if (!func) + { + func = sparse_array_add(&func_table, Entry->FunctionOffset, &pool); + func->func = symt_new_function(module, NULL, Strings + Entry->FunctionOffset, + Address, 0, NULL); + func->Address = Address; + func->next = first_func; + first_func = func; + } + + /* TODO: What if we have multiple chunks scattered around? */ + symt_add_func_line(module, func->func, file->Source, Entry->SourceLine, Address - func->Address); + } + } + + while (first_func) + { + /* TODO: Size of function? */ + rsym_finalize_function(module, first_func->func); + first_func = first_func->next; + } + + module->module.SymType = SymDia; + module->module.CVSig = 'R' | ('S' << 8) | ('Y' << 16) | ('M' << 24); + module->module.LineNumbers = TRUE; + module->module.GlobalSymbols = TRUE; + module->module.TypeInfo = FALSE; + module->module.SourceIndexed = TRUE; + module->module.Publics = TRUE; + + pool_destroy(&pool); + + return TRUE; +} + Propchange: trunk/reactos/dll/win32/dbghelp/rsym.c ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 10 months
1
0
0
0
← Newer
1
...
16
17
18
19
20
21
22
...
36
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
Results per page:
10
25
50
100
200