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
May 2022
----- 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
31 participants
165 discussions
Start a n
N
ew thread
[reactos] 01/01: [SHELL32] CPrinterFolder: Validate string pointers properly. (#4486)
by Raymond Czerny
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e0b9d6d9cd4e5b5e7d9a4…
commit e0b9d6d9cd4e5b5e7d9a445efeae6d3dc81fd652 Author: Raymond Czerny <chip(a)raymisoft.de> AuthorDate: Thu May 5 16:24:38 2022 +0200 Commit: GitHub <noreply(a)github.com> CommitDate: Thu May 5 16:24:38 2022 +0200 [SHELL32] CPrinterFolder: Validate string pointers properly. (#4486) CORE-18174 Check string pointers before determining the length of strings. --- dll/win32/shell32/folders/CPrinterFolder.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dll/win32/shell32/folders/CPrinterFolder.cpp b/dll/win32/shell32/folders/CPrinterFolder.cpp index 0f437ea5cef..43050b625c9 100644 --- a/dll/win32/shell32/folders/CPrinterFolder.cpp +++ b/dll/win32/shell32/folders/CPrinterFolder.cpp @@ -102,10 +102,13 @@ static LPITEMIDLIST _ILCreatePrinterItem(PRINTER_INFO_4W *pi) PIDLPrinterStruct * p; int size0 = (char*)&tmp.u.cprinter.szName - (char*)&tmp.u.cprinter; int size = size0; - SIZE_T cchPrinterName, cchServerName; + SIZE_T cchPrinterName = 0; + SIZE_T cchServerName = 0; - cchPrinterName = wcslen(pi->pPrinterName); - cchServerName = wcslen(pi->pServerName); + if (pi->pPrinterName) + cchPrinterName = wcslen(pi->pPrinterName); + if (pi->pServerName) + cchServerName = wcslen(pi->pServerName); if ((cchPrinterName + cchServerName) > (MAXUSHORT - 2)) { return NULL;
2 years, 7 months
1
0
0
0
[reactos] 01/01: [NTUSER] NtUserBuildHwndList should return NTSTATUS (#4487)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=056bb94edc3422fe9ab9f…
commit 056bb94edc3422fe9ab9f6c2b45948b26ee2e2f0 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu May 5 22:53:15 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu May 5 22:53:15 2022 +0900 [NTUSER] NtUserBuildHwndList should return NTSTATUS (#4487) A follow-up to #4485 (c2a51c7). CORE-18173 --- win32ss/user/ntuser/window.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c index 5f588406bdd..b6a2c28bab2 100644 --- a/win32ss/user/ntuser/window.c +++ b/win32ss/user/ntuser/window.c @@ -1514,7 +1514,7 @@ NtUserBuildHwndList( ULONG dwCount = 0; if (pcHwndNeeded == NULL) - return ERROR_INVALID_PARAMETER; + return STATUS_INVALID_PARAMETER; UserEnterExclusive(); @@ -1527,7 +1527,7 @@ NtUserBuildHwndList( { if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop())) { - Status = ERROR_INVALID_HANDLE; + Status = STATUS_INVALID_HANDLE; goto Quit; } @@ -1539,7 +1539,7 @@ NtUserBuildHwndList( &Desktop); if(!NT_SUCCESS(Status)) { - Status = ERROR_INVALID_HANDLE; + Status = STATUS_INVALID_HANDLE; goto Quit; } } @@ -1615,14 +1615,14 @@ NtUserBuildHwndList( if (!NT_SUCCESS(Status)) { ERR("Thread Id is not valid!\n"); - Status = ERROR_INVALID_PARAMETER; + Status = STATUS_INVALID_PARAMETER; goto Quit; } if (!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread)) { ObDereferenceObject(Thread); TRACE("Tried to enumerate windows of a non gui thread\n"); - Status = ERROR_INVALID_PARAMETER; + Status = STATUS_INVALID_PARAMETER; goto Quit; }
2 years, 7 months
1
0
0
0
[reactos] 01/01: [NTUSER][USER32] Make NtUserBuildHwndList exclusive (#4485)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c2a51c7249804ab0f1736…
commit c2a51c7249804ab0f17367a0a9cce3f6387d8238 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu May 5 08:49:00 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu May 5 08:49:00 2022 +0900 [NTUSER][USER32] Make NtUserBuildHwndList exclusive (#4485) - Modify prototype of NtUserBuildHwndList function. - Wrap the code by UserEnterExclusive(); and UserLeave();. CORE-18173 --- win32ss/include/ntuser.h | 6 ++--- win32ss/user/ntuser/window.c | 51 +++++++++++++++++++++--------------- win32ss/user/user32/windows/mdi.c | 4 +-- win32ss/user/user32/windows/window.c | 4 +-- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h index 0eea35fffa4..68999e7f932 100644 --- a/win32ss/include/ntuser.h +++ b/win32ss/include/ntuser.h @@ -1561,9 +1561,9 @@ NtUserBuildHwndList( HWND hwndParent, BOOLEAN bChildren, ULONG dwThreadId, - ULONG lParam, - HWND *pWnd, - ULONG *pBufSize); + ULONG cHwnd, + HWND *phwndList, + ULONG *pcHwndNeeded); NTSTATUS NTAPI diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c index cc34e5e6256..5f588406bdd 100644 --- a/win32ss/user/ntuser/window.c +++ b/win32ss/user/ntuser/window.c @@ -1500,22 +1500,24 @@ VOID FASTCALL IntFreeHwndList(PWINDOWLIST pwlTarget) * @implemented */ NTSTATUS -APIENTRY +NTAPI NtUserBuildHwndList( HDESK hDesktop, HWND hwndParent, BOOLEAN bChildren, ULONG dwThreadId, - ULONG lParam, - HWND* pWnd, - ULONG* pBufSize) + ULONG cHwnd, + HWND* phwndList, + ULONG* pcHwndNeeded) { NTSTATUS Status; ULONG dwCount = 0; - if (pBufSize == 0) + if (pcHwndNeeded == NULL) return ERROR_INVALID_PARAMETER; + UserEnterExclusive(); + if (hwndParent || !dwThreadId) { PDESKTOP Desktop; @@ -1525,7 +1527,8 @@ NtUserBuildHwndList( { if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop())) { - return ERROR_INVALID_HANDLE; + Status = ERROR_INVALID_HANDLE; + goto Quit; } if(hDesktop) @@ -1536,7 +1539,8 @@ NtUserBuildHwndList( &Desktop); if(!NT_SUCCESS(Status)) { - return ERROR_INVALID_HANDLE; + Status = ERROR_INVALID_HANDLE; + goto Quit; } } hwndParent = Desktop->DesktopWindow; @@ -1556,13 +1560,13 @@ NtUserBuildHwndList( { if (bGoDown) { - if(dwCount++ < *pBufSize && pWnd) + if (dwCount++ < cHwnd && phwndList) { _SEH2_TRY { - ProbeForWrite(pWnd, sizeof(HWND), 1); - *pWnd = Window->head.h; - pWnd++; + ProbeForWrite(phwndList, sizeof(HWND), 1); + *phwndList = Window->head.h; + phwndList++; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1571,7 +1575,6 @@ NtUserBuildHwndList( _SEH2_END if(!NT_SUCCESS(Status)) { - SetLastNtError(Status); break; } } @@ -1612,13 +1615,15 @@ NtUserBuildHwndList( if (!NT_SUCCESS(Status)) { ERR("Thread Id is not valid!\n"); - return ERROR_INVALID_PARAMETER; + Status = ERROR_INVALID_PARAMETER; + goto Quit; } if (!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread)) { ObDereferenceObject(Thread); TRACE("Tried to enumerate windows of a non gui thread\n"); - return ERROR_INVALID_PARAMETER; + Status = ERROR_INVALID_PARAMETER; + goto Quit; } // Do not use Thread link list due to co_UserFreeWindow!!! @@ -1633,13 +1638,13 @@ NtUserBuildHwndList( Window = ValidateHwndNoErr(List[i]); if (Window && Window->head.pti == W32Thread) { - if (dwCount < *pBufSize && pWnd) + if (dwCount < cHwnd && phwndList) { _SEH2_TRY { - ProbeForWrite(pWnd, sizeof(HWND), 1); - *pWnd = Window->head.h; - pWnd++; + ProbeForWrite(phwndList, sizeof(HWND), 1); + *phwndList = Window->head.h; + phwndList++; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1649,7 +1654,6 @@ NtUserBuildHwndList( if (!NT_SUCCESS(Status)) { ERR("Failure to build window list!\n"); - SetLastNtError(Status); break; } } @@ -1662,8 +1666,13 @@ NtUserBuildHwndList( ObDereferenceObject(Thread); } - *pBufSize = dwCount; - return STATUS_SUCCESS; + *pcHwndNeeded = dwCount; + Status = STATUS_SUCCESS; + +Quit: + SetLastNtError(Status); + UserLeave(); + return Status; } static void IntSendParentNotify( PWND pWindow, UINT msg ) diff --git a/win32ss/user/user32/windows/mdi.c b/win32ss/user/user32/windows/mdi.c index 59a3d06c506..9424b4cfe6e 100644 --- a/win32ss/user/user32/windows/mdi.c +++ b/win32ss/user/user32/windows/mdi.c @@ -145,7 +145,7 @@ HWND* WIN_ListChildren (HWND hWndparent) HANDLE hHeap; NTSTATUS Status; - Status = NtUserBuildHwndList ( NULL, hWndparent, FALSE, 0, 0, NULL, &dwCount ); + Status = NtUserBuildHwndList(NULL, hWndparent, FALSE, 0, dwCount, NULL, &dwCount); if ( !NT_SUCCESS( Status ) ) return 0; @@ -161,7 +161,7 @@ HWND* WIN_ListChildren (HWND hWndparent) } /* now call kernel again to fill the buffer this time */ - Status = NtUserBuildHwndList (NULL, hWndparent, FALSE, 0, 0, pHwnd, &dwCount ); + Status = NtUserBuildHwndList(NULL, hWndparent, FALSE, 0, dwCount, pHwnd, &dwCount); if ( !NT_SUCCESS( Status ) ) { diff --git a/win32ss/user/user32/windows/window.c b/win32ss/user/user32/windows/window.c index 0946c5b68ca..93dd53358c5 100644 --- a/win32ss/user/user32/windows/window.c +++ b/win32ss/user/user32/windows/window.c @@ -701,7 +701,7 @@ User32EnumWindows(HDESK hDesktop, hWndparent, bChildren, dwThreadId, - lParam, + dwCount, NULL, &dwCount); if (!NT_SUCCESS(Status)) @@ -729,7 +729,7 @@ User32EnumWindows(HDESK hDesktop, hWndparent, bChildren, dwThreadId, - lParam, + dwCount, pHwnd, &dwCount); if (!NT_SUCCESS(Status))
2 years, 7 months
1
0
0
0
[reactos] 01/01: [NTUSER] Add Win: comments to window.c
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bbc9a877cc34d1538f2c7…
commit bbc9a877cc34d1538f2c7bdb8c0fcd4d805f4ebf Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed May 4 15:40:46 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed May 4 15:40:46 2022 +0900 [NTUSER] Add Win: comments to window.c CORE-18173 --- win32ss/user/ntuser/window.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c index a740fcc11e8..cc34e5e6256 100644 --- a/win32ss/user/ntuser/window.c +++ b/win32ss/user/ntuser/window.c @@ -1355,6 +1355,7 @@ IntUnlinkWindow(PWND Wnd) Wnd->spwndPrev = Wnd->spwndNext = NULL; } +// Win: ExpandWindowList BOOL FASTCALL IntGrowHwndList(PWINDOWLIST *ppwl) { PWINDOWLIST pwlOld, pwlNew; @@ -1375,6 +1376,7 @@ BOOL FASTCALL IntGrowHwndList(PWINDOWLIST *ppwl) return TRUE; } +// Win: InternalBuildHwndList PWINDOWLIST FASTCALL IntPopulateHwndList(PWINDOWLIST pwl, PWND pwnd, DWORD dwFlags) { ASSERT(!WL_IS_BAD(pwl));
2 years, 7 months
1
0
0
0
[reactos] 01/01: [REACTOS] Add '\n' to debug logs
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=03422451b3b4a7df96a9e…
commit 03422451b3b4a7df96a9e9af5ce7533fd6cb55d9 Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Mon May 2 14:26:10 2022 +0200 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Wed May 4 03:28:38 2022 +0300 [REACTOS] Add '\n' to debug logs on TRACE, WARN, FIXME and ERR calls. Plus a few nit picks. --- base/shell/cmd/choice.c | 2 +- base/shell/cmd/timer.c | 2 +- base/system/userinit/userinit.c | 2 +- dll/appcompat/apphelp/hsdb.c | 6 +++--- dll/appcompat/apphelp/sdbstringtable.c | 2 +- dll/opengl/opengl32/swimpl.c | 2 +- dll/win32/advapi32/reg/hkcr.c | 2 +- dll/win32/advapi32/sec/misc.c | 2 +- dll/win32/advapi32/service/sctrl.c | 2 +- dll/win32/imm32/ime.c | 4 ++-- dll/win32/imm32/regword.c | 4 ++-- dll/win32/iphlpapi/ipstats_reactos.c | 2 +- dll/win32/lsasrv/privileges.c | 2 +- dll/win32/lsasrv/srm.c | 2 +- dll/win32/msafd/misc/dllmain.c | 4 ++-- dll/win32/msafd/misc/event.c | 2 +- dll/win32/msgina/shutdown.c | 2 +- dll/win32/msv1_0/lsa.c | 2 +- dll/win32/netapi32/dssetup.c | 2 +- dll/win32/samlib/samlib.c | 2 +- dll/win32/shell32/CDefView.cpp | 2 +- dll/win32/shell32/CDefaultContextMenu.cpp | 7 ++++--- dll/win32/shell32/COpenWithMenu.cpp | 4 ++-- dll/win32/shell32/CShellLink.cpp | 2 +- dll/win32/shell32/dialogs/folder_options.cpp | 2 +- dll/win32/shell32/shellmenu/CMenuFocusManager.cpp | 2 +- dll/win32/shell32/shellmenu/CStartMenu.cpp | 2 +- modules/rostests/apitests/shell32/ShellState.cpp | 2 +- win32ss/gdi/ntgdi/palette.c | 2 +- win32ss/printing/base/winspool/printers.c | 2 +- win32ss/printing/monitors/localmon/ports.c | 2 +- win32ss/printing/providers/localspl/printers.c | 2 +- win32ss/user/ntuser/input.c | 2 +- win32ss/user/ntuser/msgqueue.c | 5 ++--- win32ss/user/ntuser/painting.c | 2 +- win32ss/user/ntuser/scrollbar.c | 4 ++-- win32ss/user/ntuser/winpos.c | 4 ++-- win32ss/user/user32/misc/usrapihk.c | 2 +- win32ss/user/user32/windows/cursoricon.c | 2 +- win32ss/user/user32/windows/window.c | 2 +- 40 files changed, 52 insertions(+), 52 deletions(-) diff --git a/base/shell/cmd/choice.c b/base/shell/cmd/choice.c index 8cf7c5e665a..c48d0c42c83 100644 --- a/base/shell/cmd/choice.c +++ b/base/shell/cmd/choice.c @@ -282,7 +282,7 @@ loop: case GC_KEYREAD: TRACE ("GC_KEYREAD\n"); TRACE ("elapsed %d msecs\n", GetTickCount () - clk); - TRACE ("read %c", Ch); + TRACE ("read %c\n", Ch); if ((val=IsKeyInString(lpOptions,Ch,bCaseSensitive))==-1) { Beep (440, 50); diff --git a/base/shell/cmd/timer.c b/base/shell/cmd/timer.c index d1051b97874..0c70f9adffa 100644 --- a/base/shell/cmd/timer.c +++ b/base/shell/cmd/timer.c @@ -32,7 +32,7 @@ PrintElapsedTime (DWORD time,INT format) { DWORD h,m,s,ms; - TRACE ("PrintElapsedTime(%d,%d)",time,format); + TRACE("PrintElapsedTime(%lu, %d)\n", time, format); switch (format) { diff --git a/base/system/userinit/userinit.c b/base/system/userinit/userinit.c index 182c823dce7..701e6032016 100644 --- a/base/system/userinit/userinit.c +++ b/base/system/userinit/userinit.c @@ -281,7 +281,7 @@ StartShell(VOID) } else { - WARN("Alternate shell in Safe Mode required but not specified."); + WARN("Alternate shell in Safe Mode required but not specified.\n"); } } } diff --git a/dll/appcompat/apphelp/hsdb.c b/dll/appcompat/apphelp/hsdb.c index 89eb6284e8c..236394e6ad0 100644 --- a/dll/appcompat/apphelp/hsdb.c +++ b/dll/appcompat/apphelp/hsdb.c @@ -474,7 +474,7 @@ BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, RtlInitBuffer(&DosApplicationName.ByteBuffer, (PUCHAR)DosPathBuffer, sizeof(DosPathBuffer)); if (!NT_SUCCESS(RtlEnsureBufferSize(RTL_SKIP_BUFFER_COPY, &DosApplicationName.ByteBuffer, DosApplicationName.String.MaximumLength))) { - SHIM_ERR("Failed to convert allocate buffer."); + SHIM_ERR("Failed to convert allocate buffer.\n"); goto Cleanup; } /* Update the internal buffer to contain the string */ @@ -485,7 +485,7 @@ BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, if (!NT_SUCCESS(RtlNtPathNameToDosPathName(0, &DosApplicationName, &PathType, NULL))) { - SHIM_ERR("Failed to convert %S to DOS Path.", path); + SHIM_ERR("Failed to convert %S to DOS Path.\n", path); goto Cleanup; } @@ -494,7 +494,7 @@ BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, file_name = wcsrchr(DosApplicationName.String.Buffer, '\\'); if (!file_name) { - SHIM_ERR("Failed to find Exe name in %wZ.", &DosApplicationName.String); + SHIM_ERR("Failed to find Exe name in %wZ.\n", &DosApplicationName.String); goto Cleanup; } diff --git a/dll/appcompat/apphelp/sdbstringtable.c b/dll/appcompat/apphelp/sdbstringtable.c index ae88c51aee8..4d9771eeed6 100644 --- a/dll/appcompat/apphelp/sdbstringtable.c +++ b/dll/appcompat/apphelp/sdbstringtable.c @@ -157,7 +157,7 @@ static BOOL HashAddString(struct SdbStringHashTable* table, struct SdbHashEntry* entry = (*position) = SdbAlloc(size); if (!entry) { - SHIM_ERR("Failed to allocate %u bytes.", size); + SHIM_ERR("Failed to allocate %u bytes.\n", size); return FALSE; } entry->Tagid = tagid; diff --git a/dll/opengl/opengl32/swimpl.c b/dll/opengl/opengl32/swimpl.c index bdd60facb4f..504a9bb9848 100644 --- a/dll/opengl/opengl32/swimpl.c +++ b/dll/opengl/opengl32/swimpl.c @@ -1028,7 +1028,7 @@ WRITE_COLOR_SPAN(32, ULONG, 4) static void write_monocolor_span_frontbuffer(struct sw_framebuffer* fb, GLuint n, GLint x, GLint y, const GLubyte mask[], COLORREF Color) { - TRACE("Writing monocolor span at %u %u (%u), Color 0x%08x", x, y, n, Color); + TRACE("Writing monocolor span at %u %u (%u), Color 0x%08x\n", x, y, n, Color); if (mask) { diff --git a/dll/win32/advapi32/reg/hkcr.c b/dll/win32/advapi32/reg/hkcr.c index 65fc9e7c92d..f55a783eb5d 100644 --- a/dll/win32/advapi32/reg/hkcr.c +++ b/dll/win32/advapi32/reg/hkcr.c @@ -39,7 +39,7 @@ GetKeyName(HKEY hKey, PUNICODE_STRING KeyName) NameInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, InfoLength); if (NameInformation == NULL) { - ERR("Failed to allocate %lu bytes", InfoLength); + ERR("Failed to allocate %lu bytes\n", InfoLength); return ERROR_NOT_ENOUGH_MEMORY; } diff --git a/dll/win32/advapi32/sec/misc.c b/dll/win32/advapi32/sec/misc.c index 0e58a8994cf..9dc75a5e27d 100644 --- a/dll/win32/advapi32/sec/misc.c +++ b/dll/win32/advapi32/sec/misc.c @@ -98,7 +98,7 @@ CheckNtMartaPresent(VOID) #if DBG else { - ERR("Failed to initialize ntmarta.dll! Error: 0x%x", ErrorCode); + ERR("Failed to initialize ntmarta.dll! Error: 0x%x\n", ErrorCode); } #endif } diff --git a/dll/win32/advapi32/service/sctrl.c b/dll/win32/advapi32/service/sctrl.c index f437d8e6ecc..d13c1ce8380 100644 --- a/dll/win32/advapi32/service/sctrl.c +++ b/dll/win32/advapi32/service/sctrl.c @@ -671,7 +671,7 @@ ScServiceDispatcher(HANDLE hPipe, break; default: - TRACE("Command %lu received", ControlPacket->dwControl); + TRACE("Command %lu received\n", ControlPacket->dwControl); dwError = ScControlService(lpService, ControlPacket); break; } diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c index a13f59dd498..2703a1e3cad 100644 --- a/dll/win32/imm32/ime.c +++ b/dll/win32/imm32/ime.c @@ -1690,7 +1690,7 @@ BOOL WINAPI ImmConfigureIMEA(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData) REGISTERWORDW RegWordW; LPREGISTERWORDA pRegWordA; - TRACE("(%p, %p, 0x%lX, %p)", hKL, hWnd, dwMode, lpData); + TRACE("(%p, %p, 0x%lX, %p)\n", hKL, hWnd, dwMode, lpData); if (!ValidateHwnd(hWnd) || Imm32IsCrossProcessAccess(hWnd)) return FALSE; @@ -1744,7 +1744,7 @@ BOOL WINAPI ImmConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData) REGISTERWORDA RegWordA; LPREGISTERWORDW pRegWordW; - TRACE("(%p, %p, 0x%lX, %p)", hKL, hWnd, dwMode, lpData); + TRACE("(%p, %p, 0x%lX, %p)\n", hKL, hWnd, dwMode, lpData); if (!ValidateHwnd(hWnd) || Imm32IsCrossProcessAccess(hWnd)) return FALSE; diff --git a/dll/win32/imm32/regword.c b/dll/win32/imm32/regword.c index ecbc4cb35ef..8aec56aa2d2 100644 --- a/dll/win32/imm32/regword.c +++ b/dll/win32/imm32/regword.c @@ -99,7 +99,7 @@ ImmEnumRegisterWordA(HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc, ENUM_WORD_W2A EnumDataW2A; PIMEDPI pImeDpi; - TRACE("(%p, %p, %s, 0x%lX, %s, %p)", hKL, lpfnEnumProc, debugstr_a(lpszReading), + TRACE("(%p, %p, %s, 0x%lX, %s, %p)\n", hKL, lpfnEnumProc, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszRegister), lpData); pImeDpi = Imm32FindOrLoadImeDpi(hKL); @@ -155,7 +155,7 @@ ImmEnumRegisterWordW(HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc, ENUM_WORD_A2W EnumDataA2W; PIMEDPI pImeDpi; - TRACE("(%p, %p, %s, 0x%lX, %s, %p)", hKL, lpfnEnumProc, debugstr_w(lpszReading), + TRACE("(%p, %p, %s, 0x%lX, %s, %p)\n", hKL, lpfnEnumProc, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszRegister), lpData); pImeDpi = Imm32FindOrLoadImeDpi(hKL); diff --git a/dll/win32/iphlpapi/ipstats_reactos.c b/dll/win32/iphlpapi/ipstats_reactos.c index b3cda7eb64a..535264caeee 100644 --- a/dll/win32/iphlpapi/ipstats_reactos.c +++ b/dll/win32/iphlpapi/ipstats_reactos.c @@ -392,7 +392,7 @@ DWORD getNumRoutes(void) memset( &isnmp, 0, sizeof( isnmp ) ); status = tdiGetMibForIpEntity( tcpFile, &entitySet[i], &isnmp ); if( !NT_SUCCESS(status) ) { - ERR("tdiGetMibForIpEntity returned 0x%08lx, for i = %d", status, i); + ERR("tdiGetMibForIpEntity returned 0x%08lx, for i = %d\n", status, i); numRoutes = 0; break; } diff --git a/dll/win32/lsasrv/privileges.c b/dll/win32/lsasrv/privileges.c index 5f6314481af..317c60c2bc6 100644 --- a/dll/win32/lsasrv/privileges.c +++ b/dll/win32/lsasrv/privileges.c @@ -133,7 +133,7 @@ LsarpLookupPrivilegeDisplayName(PRPC_UNICODE_STRING Name, ULONG Index; UINT nLength; - TRACE("LsarpLookupPrivilegeDisplayName(%p 0x%04hu 0x%04hu %p %p)", + TRACE("LsarpLookupPrivilegeDisplayName(%p 0x%04hu 0x%04hu %p %p)\n", Name, ClientLanguage, ClientSystemDefaultLanguage, DisplayName, LanguageReturned); if (Name->Length == 0 || Name->Buffer == NULL) diff --git a/dll/win32/lsasrv/srm.c b/dll/win32/lsasrv/srm.c index 68929e6343f..368f1f76dc2 100644 --- a/dll/win32/lsasrv/srm.c +++ b/dll/win32/lsasrv/srm.c @@ -106,7 +106,7 @@ LsapRmServerThread( &Message.Header); if (!NT_SUCCESS(Status)) { - ERR("LsapRmServerThread - Failed to get message: 0x%lx", Status); + ERR("LsapRmServerThread - Failed to get message: 0x%lx\n", Status); ReplyMessage = NULL; continue; } diff --git a/dll/win32/msafd/misc/dllmain.c b/dll/win32/msafd/misc/dllmain.c index c9e443641b8..7723b93d236 100644 --- a/dll/win32/msafd/misc/dllmain.c +++ b/dll/win32/msafd/misc/dllmain.c @@ -649,7 +649,7 @@ WSPCloseSocket(IN SOCKET Handle, if(!NT_SUCCESS(Status)) { - ERR("NtCreateEvent failed: 0x%08x", Status); + ERR("NtCreateEvent failed: 0x%08x\n", Status); return SOCKET_ERROR; } @@ -664,7 +664,7 @@ WSPCloseSocket(IN SOCKET Handle, if (Status) { if (lpErrno) *lpErrno = Status; - ERR("WSHNotify failed. Error 0x%#x", Status); + ERR("WSHNotify failed. Error 0x%#x\n", Status); NtClose(SockEvent); return SOCKET_ERROR; } diff --git a/dll/win32/msafd/misc/event.c b/dll/win32/msafd/misc/event.c index 581e4ee195d..b3b0da2c743 100644 --- a/dll/win32/msafd/misc/event.c +++ b/dll/win32/msafd/misc/event.c @@ -189,7 +189,7 @@ WSPEnumNetworkEvents( if (Status != STATUS_SUCCESS) { - ERR("Status 0x%08x", Status); + ERR("Status 0x%08x\n", Status); return MsafdReturnWithErrno(Status, lpErrno, 0, NULL); } diff --git a/dll/win32/msgina/shutdown.c b/dll/win32/msgina/shutdown.c index 95b890ba589..559b6c5b243 100644 --- a/dll/win32/msgina/shutdown.c +++ b/dll/win32/msgina/shutdown.c @@ -1408,7 +1408,7 @@ ShellShutdownDialog( /* Help file is called directly here */ else if (dlgValue == IDHELP) { - FIXME("Help is not implemented yet."); + FIXME("Help is not implemented yet.\n"); MessageBoxW(hParent, L"Help is not implemented yet.", L"Message", MB_OK | MB_ICONEXCLAMATION); } else if (dlgValue == -1) diff --git a/dll/win32/msv1_0/lsa.c b/dll/win32/msv1_0/lsa.c index e8e4da8854e..064bbc98323 100644 --- a/dll/win32/msv1_0/lsa.c +++ b/dll/win32/msv1_0/lsa.c @@ -81,7 +81,7 @@ NTAPI LsaSpFreeCredentialsHandle( _In_ LSA_SEC_HANDLE CredentialHandle) { - TRACE("LsaSpFreeCredentialsHandle(0x%p)", CredentialHandle); + TRACE("LsaSpFreeCredentialsHandle(0x%p)\n", CredentialHandle); return STATUS_NOT_IMPLEMENTED; } diff --git a/dll/win32/netapi32/dssetup.c b/dll/win32/netapi32/dssetup.c index 18b93039b56..ced7cfa7889 100644 --- a/dll/win32/netapi32/dssetup.c +++ b/dll/win32/netapi32/dssetup.c @@ -113,7 +113,7 @@ DsRoleGetPrimaryDomainInformation( status = DsSetupBind((LPWSTR)lpServer, &hBinding); if (status) { - TRACE("DsSetupBind() failed (Status %lu\n)", status); + TRACE("DsSetupBind() failed (Status %lu\n)\n", status); return status; } diff --git a/dll/win32/samlib/samlib.c b/dll/win32/samlib/samlib.c index 8df3582e0e4..cd22fecc38a 100644 --- a/dll/win32/samlib/samlib.c +++ b/dll/win32/samlib/samlib.c @@ -93,7 +93,7 @@ PSAMPR_SERVER_NAME_bind(PSAMPR_SERVER_NAME pszSystemName) (nLength - nNameLength != 2)) || (nNameLength == 0)) { - WARN("Invalid server name %S", pszSystemName); + WARN("Invalid server name %S\n", pszSystemName); RpcRaiseException(STATUS_OBJECT_NAME_INVALID); } } diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp index 67889f4aedc..a152ac6c263 100644 --- a/dll/win32/shell32/CDefView.cpp +++ b/dll/win32/shell32/CDefView.cpp @@ -1220,7 +1220,7 @@ LRESULT CDefView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl if (SUCCEEDED(QueryInterface(IID_PPV_ARG(IDropTarget, &pdt)))) { if (FAILED(RegisterDragDrop(m_hWnd, pdt))) - ERR("Registering Drag Drop Failed"); + ERR("Registering Drag Drop Failed\n"); } /* register for receiving notifications */ diff --git a/dll/win32/shell32/CDefaultContextMenu.cpp b/dll/win32/shell32/CDefaultContextMenu.cpp index 05978136e62..62740118a6c 100644 --- a/dll/win32/shell32/CDefaultContextMenu.cpp +++ b/dll/win32/shell32/CDefaultContextMenu.cpp @@ -720,8 +720,9 @@ HRESULT CDefaultContextMenu::DoPaste(LPCMINVOKECOMMANDINFO lpcmi, BOOL bLink) else dwKey = MK_SHIFT; } - else { - ERR("No drop effect obtained"); + else + { + ERR("No drop effect obtained\n"); } GlobalUnlock(medium2.hGlobal); } @@ -850,7 +851,7 @@ CDefaultContextMenu::DoProperties( HRESULT CDefaultContextMenu::DoUndo(LPCMINVOKECOMMANDINFO lpcmi) { - ERR("TODO: Undo"); + ERR("TODO: Undo\n"); return E_NOTIMPL; } diff --git a/dll/win32/shell32/COpenWithMenu.cpp b/dll/win32/shell32/COpenWithMenu.cpp index 5409f449bd2..a7783eaf912 100644 --- a/dll/win32/shell32/COpenWithMenu.cpp +++ b/dll/win32/shell32/COpenWithMenu.cpp @@ -697,7 +697,7 @@ BOOL COpenWithList::SetDefaultHandler(SApp *pApp, LPCWSTR pwszFilename) /* Create file extension key */ if (RegCreateKeyExW(HKEY_CLASSES_ROOT, pwszExt, 0, NULL, 0, KEY_READ|KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS) { - ERR("Cannot open ext key"); + ERR("Cannot open ext key\n"); return FALSE; } @@ -851,7 +851,7 @@ BOOL COpenWithDialog::IsNoOpen(HWND hwnd) return TRUE; else if (dReturnValue == -1) { - ERR("IsNoOpen failed to load the dialog box."); + ERR("IsNoOpen failed to load the dialog box.\n"); return TRUE; } } diff --git a/dll/win32/shell32/CShellLink.cpp b/dll/win32/shell32/CShellLink.cpp index 5fc8ab41867..dfb67d102ae 100644 --- a/dll/win32/shell32/CShellLink.cpp +++ b/dll/win32/shell32/CShellLink.cpp @@ -2572,7 +2572,7 @@ HRESULT STDMETHODCALLTYPE CShellLink::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) HRESULT hr = Resolve(lpici->hwnd, 0); if (FAILED(hr)) { - TRACE("failed to resolve component with error 0x%08x", hr); + TRACE("failed to resolve component with error 0x%08x\n", hr); return hr; } diff --git a/dll/win32/shell32/dialogs/folder_options.cpp b/dll/win32/shell32/dialogs/folder_options.cpp index 527a359e0c8..bad8fc484c8 100644 --- a/dll/win32/shell32/dialogs/folder_options.cpp +++ b/dll/win32/shell32/dialogs/folder_options.cpp @@ -283,7 +283,7 @@ Options_RunDLLCommon(HWND hWnd, HINSTANCE hInst, int fOptions, DWORD nCmdShow) case 1: // show taskbar options dialog - FIXME("notify explorer to show taskbar options dialog"); + FIXME("notify explorer to show taskbar options dialog\n"); //PostMessage(GetShellWindow(), WM_USER+22, fOptions, 0); break; diff --git a/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp b/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp index 615b7091c56..77b7b8edfaa 100644 --- a/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp +++ b/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp @@ -338,7 +338,7 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg) StackEntry * entry = NULL; if (IsTrackedWindow(child, &entry) == S_OK) { - TRACE("MouseMove"); + TRACE("MouseMove\n"); } BOOL isTracking = FALSE; diff --git a/dll/win32/shell32/shellmenu/CStartMenu.cpp b/dll/win32/shell32/shellmenu/CStartMenu.cpp index d701013f160..e21bf851ada 100644 --- a/dll/win32/shell32/shellmenu/CStartMenu.cpp +++ b/dll/win32/shell32/shellmenu/CStartMenu.cpp @@ -530,7 +530,7 @@ RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv) hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidlProgramsAbsolute); if (FAILED_UNEXPECTEDLY(hr)) { - WARN("USER Programs folder not found."); + WARN("USER Programs folder not found.\n"); hr = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_PROGRAMS, &pidlProgramsAbsolute); if (FAILED_UNEXPECTEDLY(hr)) return hr; diff --git a/modules/rostests/apitests/shell32/ShellState.cpp b/modules/rostests/apitests/shell32/ShellState.cpp index d2d26355338..7c50806d2fd 100644 --- a/modules/rostests/apitests/shell32/ShellState.cpp +++ b/modules/rostests/apitests/shell32/ShellState.cpp @@ -165,7 +165,7 @@ START_TEST(ShellState) LPBYTE pb; int ret; - trace("GetVersion(): 0x%08lX", GetVersion()); + trace("GetVersion(): 0x%08lX\n", GetVersion()); osinfo.dwOSVersionInfoSize = sizeof(osinfo); GetVersionEx(&osinfo); diff --git a/win32ss/gdi/ntgdi/palette.c b/win32ss/gdi/ntgdi/palette.c index a36dbf90777..de0fe9c66c8 100644 --- a/win32ss/gdi/ntgdi/palette.c +++ b/win32ss/gdi/ntgdi/palette.c @@ -615,7 +615,7 @@ NtGdiResizePalette( XLATEOBJ *NewXlateObj = (int*) HeapReAlloc(GetProcessHeap(), 0, XlateObj, cEntries * sizeof(int)); if(NewXlateObj == NULL) { - ERR("Can not resize logicalToSystem -- out of memory!"); + ERR("Can not resize logicalToSystem -- out of memory!\n"); GDI_ReleaseObj( hPal ); return FALSE; } diff --git a/win32ss/printing/base/winspool/printers.c b/win32ss/printing/base/winspool/printers.c index f3567d2e650..285696d6a33 100644 --- a/win32ss/printing/base/winspool/printers.c +++ b/win32ss/printing/base/winspool/printers.c @@ -2726,7 +2726,7 @@ QueryColorProfile( { if (!IsValidDevmodeNoSizeW( pdevmode ) ) { - ERR("DeviceCapabilitiesW : Devode Invalid"); + ERR("QueryColorProfile : Devode Invalid\n"); return FALSE; } } diff --git a/win32ss/printing/monitors/localmon/ports.c b/win32ss/printing/monitors/localmon/ports.c index a1f527a548f..47ebc61cf37 100644 --- a/win32ss/printing/monitors/localmon/ports.c +++ b/win32ss/printing/monitors/localmon/ports.c @@ -266,7 +266,7 @@ _CreateNonspooledPort(PLOCALMON_PORT pPort) if (!*p) { // We reached the end of the list without finding a mapping. - ERR("Can't find a suitable mapping for the port \"%S\"!", pPort->pwszPortName); + ERR("Can't find a suitable mapping for the port \"%S\"!\n", pPort->pwszPortName); goto Cleanup; } diff --git a/win32ss/printing/providers/localspl/printers.c b/win32ss/printing/providers/localspl/printers.c index a7865a2d9ef..9bab1ba22ff 100644 --- a/win32ss/printing/providers/localspl/printers.c +++ b/win32ss/printing/providers/localspl/printers.c @@ -1219,7 +1219,7 @@ _LocalOpenPrinterHandle(PWSTR pwszPrinterName, PWSTR pwszJobParameter, PHANDLE p if (pPrinterHandle->hSPLFile == INVALID_HANDLE_VALUE) { dwErrorCode = GetLastError(); - ERR("CreateFileW failed with error %lu for \"%S\"!", dwErrorCode, wszFullPath); + ERR("CreateFileW failed with error %lu for \"%S\"!\n", dwErrorCode, wszFullPath); goto Failure; } diff --git a/win32ss/user/ntuser/input.c b/win32ss/user/ntuser/input.c index cc0c8cf047f..9c2c69b353c 100644 --- a/win32ss/user/ntuser/input.c +++ b/win32ss/user/ntuser/input.c @@ -764,7 +764,7 @@ NtUserSendInput( uRet++; break; case INPUT_HARDWARE: - FIXME("INPUT_HARDWARE not supported!"); + FIXME("INPUT_HARDWARE not supported!\n"); break; default: ERR("SendInput(): Invalid input type: 0x%x\n", SafeInput.type); diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index c82245f6d2d..a674f806e8a 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -766,7 +766,7 @@ AllocateUserMessage(BOOL KEvent) if(!(Message = ExAllocateFromPagedLookasideList(pgSendMsgLookasideList))) { - ERR("AllocateUserMessage(): Not enough memory to allocate a message"); + ERR("AllocateUserMessage(): Not enough memory to allocate a message\n"); return NULL; } RtlZeroMemory(Message, sizeof(USER_SENT_MESSAGE)); @@ -1021,13 +1021,12 @@ co_MsqSendMessageAsync(PTHREADINFO ptiReceiver, BOOL HasPackedLParam, INT HookMessage) { - PTHREADINFO ptiSender; PUSER_SENT_MESSAGE Message; if(!(Message = AllocateUserMessage(FALSE))) { - ERR("MsqSendMessageAsync(): Not enough memory to allocate a message"); + ERR("MsqSendMessageAsync(): Not enough memory to allocate a message\n"); return FALSE; } diff --git a/win32ss/user/ntuser/painting.c b/win32ss/user/ntuser/painting.c index 352c934564d..57e006b7312 100644 --- a/win32ss/user/ntuser/painting.c +++ b/win32ss/user/ntuser/painting.c @@ -2363,7 +2363,7 @@ UserRealizePalette(HDC hdc) if ( hWndDesktop != hWnd ) { PWND pWnd = UserGetWindowObject(hWndDesktop); - ERR("RealizePalette Desktop."); + ERR("RealizePalette Desktop.\n"); hdc = UserGetWindowDC(pWnd); IntPaintDesktop(hdc); UserReleaseDC(pWnd,hdc,FALSE); diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c index 9d5e4005dcb..c4a6f2f1d8b 100644 --- a/win32ss/user/ntuser/scrollbar.c +++ b/win32ss/user/ntuser/scrollbar.c @@ -503,7 +503,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) if(!SBID_IS_VALID(nBar)) /* Assures nBar is 0, 1, or 2 */ { EngSetLastError(ERROR_INVALID_PARAMETER); - ERR("Trying to set scrollinfo for unknown scrollbar type %d", nBar); + ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", nBar); return FALSE; } @@ -1409,7 +1409,7 @@ NtUserEnableScrollBar( if(wSBflags != SB_BOTH && !SBID_IS_VALID(wSBflags)) { EngSetLastError(ERROR_INVALID_PARAMETER); - ERR("Trying to set scrollinfo for unknown scrollbar type %u", wSBflags); + ERR("Trying to set scrollinfo for unknown scrollbar type %u\n", wSBflags); RETURN(FALSE); } diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c index 27f594e554c..7795f0293b6 100644 --- a/win32ss/user/ntuser/winpos.c +++ b/win32ss/user/ntuser/winpos.c @@ -1747,8 +1747,8 @@ co_WinPosSetWindowPos( ASSERT_REFS_CO(Window); - TRACE("pwnd %p, after %p, %d,%d (%dx%d), flags 0x%x", - Window, WndInsertAfter, x, y, cx, cy, flags); + TRACE("pwnd %p, after %p, %d,%d (%dx%d), flags 0x%x\n", + Window, WndInsertAfter, x, y, cx, cy, flags); #if DBG dump_winpos_flags(flags); #endif diff --git a/win32ss/user/user32/misc/usrapihk.c b/win32ss/user/user32/misc/usrapihk.c index c2e91d5f3d9..515fab6c7bd 100644 --- a/win32ss/user/user32/misc/usrapihk.c +++ b/win32ss/user/user32/misc/usrapihk.c @@ -380,7 +380,7 @@ BOOL WINAPI RegisterUserApiHook(PUSERAPIHOOKINFO puah) if (puah->m_size == sizeof(USERAPIHOOKINFO)) { - WARN("RegisterUserApiHook: %S and %S",puah->m_dllname1, puah->m_funname1); + WARN("RegisterUserApiHook: %S and %S\n", puah->m_dllname1, puah->m_funname1); RtlInitUnicodeString(&m_dllname1, puah->m_dllname1); RtlInitUnicodeString(&m_funname1, puah->m_funname1); return NtUserRegisterUserApiHook( &m_dllname1, &m_funname1, 0, 0); diff --git a/win32ss/user/user32/windows/cursoricon.c b/win32ss/user/user32/windows/cursoricon.c index cdca65767c6..1f6b71714aa 100644 --- a/win32ss/user/user32/windows/cursoricon.c +++ b/win32ss/user/user32/windows/cursoricon.c @@ -2474,7 +2474,7 @@ HICON WINAPI CreateIconFromResourceEx( /* Check we were given the right type of resource */ if((fIcon && pCurIconDir->idType == 2) || (!fIcon && pCurIconDir->idType == 1)) { - WARN("Got a %s directory pointer, but called for a %s", fIcon ? "cursor" : "icon", fIcon ? "icon" : "cursor"); + WARN("Got a %s directory pointer, but called for a %s\n", fIcon ? "cursor" : "icon", fIcon ? "icon" : "cursor"); return NULL; } diff --git a/win32ss/user/user32/windows/window.c b/win32ss/user/user32/windows/window.c index cf7f5c9ccc0..0946c5b68ca 100644 --- a/win32ss/user/user32/windows/window.c +++ b/win32ss/user/user32/windows/window.c @@ -1975,7 +1975,7 @@ ScrollWindowEx(HWND hWnd, { if (flags & SW_SMOOTHSCROLL) { - FIXME("SW_SMOOTHSCROLL not supported."); + FIXME("SW_SMOOTHSCROLL not supported.\n"); // Fall through.... } return NtUserScrollWindowEx(hWnd,
2 years, 7 months
1
0
0
0
[reactos] 10/10: [DOC] Update 3rd Party Files (#4417)
by Vincent Franchomme
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=079131faca44db1cabd4b…
commit 079131faca44db1cabd4b4d15e1a320352ad5924 Author: Vincent Franchomme <franchomme.vincent(a)gmail.com> AuthorDate: Thu Apr 28 21:38:30 2022 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue May 3 17:30:11 2022 +0200 [DOC] Update 3rd Party Files (#4417) --- media/doc/3rd Party Files.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/doc/3rd Party Files.txt b/media/doc/3rd Party Files.txt index 84764380be4..772f9dcd072 100644 --- a/media/doc/3rd Party Files.txt +++ b/media/doc/3rd Party Files.txt @@ -77,7 +77,7 @@ Title: WinBtrfs Path: dll/shellext/shellbtrfs Path: drivers/filesystems/btrfs Path: sdk/lib/fslib/btrfslib -Used Version: 1.7.2 +Used Version: 1.8.0 License: LGPL-3.0-or-later (
https://spdx.org/licenses/LGPL-3.0-or-later.html
) URL:
https://github.com/maharmstone/btrfs
2 years, 7 months
1
0
0
0
[reactos] 09/10: [BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.8.0 (#4417)
by Vincent Franchomme
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6e0cf03d922dc4773055f…
commit 6e0cf03d922dc4773055f605e53dd985eb4af462 Author: Vincent Franchomme <franchomme.vincent(a)gmail.com> AuthorDate: Thu Apr 28 21:37:02 2022 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue May 3 17:30:11 2022 +0200 [BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.8.0 (#4417) v1.8 (2022-03-12): - Added minimal support for fs-verity - ~~Added test suite~~ Not in ReactOS - Fixed incorrect disk usage statistics - Fixed potential crashes when renaming stream to file or file to stream - Fixed potential crashes when querying hard links on file - Fixed potential hang when opening oplocked file - Fixed minor issues also uncovered by test suite --- dll/shellext/shellbtrfs/shellbtrfs.rc | 10 ++--- dll/win32/ubtrfs/ubtrfs.rc | 10 ++--- drivers/filesystems/btrfs/btrfs.c | 34 +++-------------- drivers/filesystems/btrfs/btrfs.h | 13 ++++++- drivers/filesystems/btrfs/btrfs.inf | 4 +- drivers/filesystems/btrfs/btrfs.rc | 10 ++--- drivers/filesystems/btrfs/btrfs_drv.h | 1 - drivers/filesystems/btrfs/compress.c | 60 ----------------------------- drivers/filesystems/btrfs/create.c | 67 ++++++++++++++++++++------------- drivers/filesystems/btrfs/dirctrl.c | 12 ------ drivers/filesystems/btrfs/fastio.c | 8 +--- drivers/filesystems/btrfs/fileinfo.c | 31 +++++++++++---- drivers/filesystems/btrfs/flushthread.c | 47 ++--------------------- drivers/filesystems/btrfs/fsctl.c | 6 ++- drivers/filesystems/btrfs/pnp.c | 1 + drivers/filesystems/btrfs/read.c | 27 +------------ drivers/filesystems/btrfs/security.c | 2 +- drivers/filesystems/btrfs/write.c | 2 - 18 files changed, 111 insertions(+), 234 deletions(-) diff --git a/dll/shellext/shellbtrfs/shellbtrfs.rc b/dll/shellext/shellbtrfs/shellbtrfs.rc index 980929f108c..b83d7288147 100644 --- a/dll/shellext/shellbtrfs/shellbtrfs.rc +++ b/dll/shellext/shellbtrfs/shellbtrfs.rc @@ -61,8 +61,8 @@ IDI_ICON1 ICON "subvol.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,9,0 - PRODUCTVERSION 1,7,9,0 + FILEVERSION 1,8,0,0 + PRODUCTVERSION 1,8,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -78,12 +78,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs shell extension" - VALUE "FileVersion", "1.7.9" + VALUE "FileVersion", "1.8.0" VALUE "InternalName", "btrfs" - VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" + VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-22" VALUE "OriginalFilename", "shellbtrfs.dll" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.9" + VALUE "ProductVersion", "1.8.0" END END BLOCK "VarFileInfo" diff --git a/dll/win32/ubtrfs/ubtrfs.rc b/dll/win32/ubtrfs/ubtrfs.rc index 79609cf3464..e723033ba8e 100644 --- a/dll/win32/ubtrfs/ubtrfs.rc +++ b/dll/win32/ubtrfs/ubtrfs.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,9,0 - PRODUCTVERSION 1,7,9,0 + FILEVERSION 1,8,0,0 + PRODUCTVERSION 1,8,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "Btrfs utility DLL" - VALUE "FileVersion", "1.7.9" + VALUE "FileVersion", "1.8.0" VALUE "InternalName", "ubtrfs" - VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" + VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-22" VALUE "OriginalFilename", "ubtrfs.dll" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.9" + VALUE "ProductVersion", "1.8.0" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/btrfs.c b/drivers/filesystems/btrfs/btrfs.c index ea5d2f5cc20..866f80a9205 100644 --- a/drivers/filesystems/btrfs/btrfs.c +++ b/drivers/filesystems/btrfs/btrfs.c @@ -54,7 +54,8 @@ BTRFS_INCOMPAT_FLAGS_COMPRESS_LZO | BTRFS_INCOMPAT_FLAGS_BIG_METADATA | BTRFS_INCOMPAT_FLAGS_RAID56 | \ BTRFS_INCOMPAT_FLAGS_EXTENDED_IREF | BTRFS_INCOMPAT_FLAGS_SKINNY_METADATA | BTRFS_INCOMPAT_FLAGS_NO_HOLES | \ BTRFS_INCOMPAT_FLAGS_COMPRESS_ZSTD | BTRFS_INCOMPAT_FLAGS_METADATA_UUID | BTRFS_INCOMPAT_FLAGS_RAID1C34) -#define COMPAT_RO_SUPPORTED (BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE | BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE_VALID) +#define COMPAT_RO_SUPPORTED (BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE | BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE_VALID | \ + BTRFS_COMPAT_RO_FLAGS_VERITY) static const WCHAR device_name[] = {'\\','B','t','r','f','s',0}; static const WCHAR dosdevice_name[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\','B','t','r','f','s',0}; @@ -3116,7 +3117,8 @@ static NTSTATUS look_for_roots(_Requires_exclusive_lock_held_(_Curr_->tree_lock) reloc_root->root_item.inode.st_blocks = Vcb->superblock.node_size; reloc_root->root_item.inode.st_nlink = 1; reloc_root->root_item.inode.st_mode = 040755; - reloc_root->root_item.inode.flags = 0xffffffff80000000; + reloc_root->root_item.inode.flags = 0x80000000; + reloc_root->root_item.inode.flags_ro = 0xffffffff; reloc_root->root_item.objid = SUBVOL_ROOT_INODE; reloc_root->root_item.bytes_used = Vcb->superblock.node_size; @@ -3840,32 +3842,6 @@ void protect_superblocks(_Inout_ chunk* c) { } } -uint64_t chunk_estimate_phys_size(device_extension* Vcb, chunk* c, uint64_t u) { - uint64_t nfactor, dfactor; - - if (c->chunk_item->type & BLOCK_FLAG_DUPLICATE || c->chunk_item->type & BLOCK_FLAG_RAID1 || c->chunk_item->type & BLOCK_FLAG_RAID10) { - nfactor = 1; - dfactor = 2; - } else if (c->chunk_item->type & BLOCK_FLAG_RAID5) { - nfactor = Vcb->superblock.num_devices - 1; - dfactor = Vcb->superblock.num_devices; - } else if (c->chunk_item->type & BLOCK_FLAG_RAID6) { - nfactor = Vcb->superblock.num_devices - 2; - dfactor = Vcb->superblock.num_devices; - } else if (c->chunk_item->type & BLOCK_FLAG_RAID1C3) { - nfactor = 1; - dfactor = 3; - } else if (c->chunk_item->type & BLOCK_FLAG_RAID1C4) { - nfactor = 1; - dfactor = 4; - } else { - nfactor = 1; - dfactor = 1; - } - - return u * dfactor / nfactor; -} - NTSTATUS find_chunk_usage(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, _In_opt_ PIRP Irp) { LIST_ENTRY* le = Vcb->chunks.Flink; chunk* c; @@ -3898,7 +3874,7 @@ NTSTATUS find_chunk_usage(_In_ _Requires_lock_held_(_Curr_->tree_lock) device_ex TRACE("chunk %I64x has %I64x bytes used\n", c->offset, c->used); - Vcb->superblock.bytes_used += chunk_estimate_phys_size(Vcb, c, bgi->used); + Vcb->superblock.bytes_used += bgi->used; } else { ERR("(%I64x;%I64x,%x,%I64x) is %u bytes, expected %Iu\n", Vcb->extent_root->id, tp.item->key.obj_id, tp.item->key.obj_type, tp.item->key.offset, tp.item->size, sizeof(BLOCK_GROUP_ITEM)); diff --git a/drivers/filesystems/btrfs/btrfs.h b/drivers/filesystems/btrfs/btrfs.h index b0b7fbd0015..962ede35ab9 100644 --- a/drivers/filesystems/btrfs/btrfs.h +++ b/drivers/filesystems/btrfs/btrfs.h @@ -9,6 +9,9 @@ #pragma once #include <stdint.h> +#ifndef __REACTOS__ +#include <assert.h> +#endif // __REACTOS__ static const uint64_t superblock_addrs[] = { 0x10000, 0x4000000, 0x4000000000, 0x4000000000000, 0 }; @@ -101,10 +104,13 @@ static const uint64_t superblock_addrs[] = { 0x10000, 0x4000000, 0x4000000000, 0 #define BTRFS_INODE_DIRSYNC 0x400 #define BTRFS_INODE_COMPRESS 0x800 +#define BTRFS_INODE_RO_VERITY 0x1 + #define BTRFS_SUBVOL_READONLY 0x1 #define BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE 0x1 #define BTRFS_COMPAT_RO_FLAGS_FREE_SPACE_CACHE_VALID 0x2 +#define BTRFS_COMPAT_RO_FLAGS_VERITY 0x4 #define BTRFS_INCOMPAT_FLAGS_MIXED_BACKREF 0x0001 #define BTRFS_INCOMPAT_FLAGS_DEFAULT_SUBVOL 0x0002 @@ -288,7 +294,8 @@ typedef struct { uint32_t st_gid; uint32_t st_mode; uint64_t st_rdev; - uint64_t flags; + uint32_t flags; + uint32_t flags_ro; uint64_t sequence; uint8_t reserved[32]; BTRFS_TIME st_atime; @@ -297,6 +304,10 @@ typedef struct { BTRFS_TIME otime; } INODE_ITEM; +#ifndef __REACTOS__ +static_assert(sizeof(INODE_ITEM) == 0xa0, "INODE_ITEM has wrong size"); +#endif // __REACTOS__ + typedef struct { INODE_ITEM inode; uint64_t generation; diff --git a/drivers/filesystems/btrfs/btrfs.inf b/drivers/filesystems/btrfs/btrfs.inf index faeec384225..18dc5cd25e9 100644 --- a/drivers/filesystems/btrfs/btrfs.inf +++ b/drivers/filesystems/btrfs/btrfs.inf @@ -2,7 +2,7 @@ ;;; WinBtrfs ;;; ;;; -;;; Copyright (c) 2016-21 Mark Harmstone +;;; Copyright (c) 2016-22 Mark Harmstone ;;; [Version] @@ -10,7 +10,7 @@ Signature = "$Windows NT$" Class = Volume ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f} Provider = %Me% -DriverVer = 10/02/2021,1.7.9 +DriverVer = 03/12/2022,1.8.0 CatalogFile = btrfs.cat [DestinationDirs] diff --git a/drivers/filesystems/btrfs/btrfs.rc b/drivers/filesystems/btrfs/btrfs.rc index 6b0d46874ef..59f9d2ccb1f 100644 --- a/drivers/filesystems/btrfs/btrfs.rc +++ b/drivers/filesystems/btrfs/btrfs.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,9,0 - PRODUCTVERSION 1,7,9,0 + FILEVERSION 1,8,0,0 + PRODUCTVERSION 1,8,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs" - VALUE "FileVersion", "1.7.9" + VALUE "FileVersion", "1.8.0" VALUE "InternalName", "btrfs" - VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" + VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-22" VALUE "OriginalFilename", "btrfs.sys" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.9" + VALUE "ProductVersion", "1.8.0" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/btrfs_drv.h b/drivers/filesystems/btrfs/btrfs_drv.h index d033b789934..e06770adfac 100644 --- a/drivers/filesystems/btrfs/btrfs_drv.h +++ b/drivers/filesystems/btrfs/btrfs_drv.h @@ -1152,7 +1152,6 @@ void reap_fcb(fcb* fcb); void reap_fcbs(device_extension* Vcb); void reap_fileref(device_extension* Vcb, file_ref* fr); void reap_filerefs(device_extension* Vcb, file_ref* fr); -uint64_t chunk_estimate_phys_size(device_extension* Vcb, chunk* c, uint64_t u); NTSTATUS utf8_to_utf16(WCHAR* dest, ULONG dest_max, ULONG* dest_len, char* src, ULONG src_len); NTSTATUS utf16_to_utf8(char* dest, ULONG dest_max, ULONG* dest_len, WCHAR* src, ULONG src_len); uint32_t get_num_of_processors(); diff --git a/drivers/filesystems/btrfs/compress.c b/drivers/filesystems/btrfs/compress.c index d5d229905b6..6890add012d 100644 --- a/drivers/filesystems/btrfs/compress.c +++ b/drivers/filesystems/btrfs/compress.c @@ -731,9 +731,6 @@ NTSTATUS lzo_compress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t uint8_t* comp_data; lzo_stream stream; uint32_t* out_size; -#ifdef __REACTOS__ - unsigned int i; -#endif // __REACTOS__ num_pages = (unsigned int)sector_align(inlen, LZO_PAGE_SIZE) / LZO_PAGE_SIZE; @@ -764,11 +761,7 @@ NTSTATUS lzo_compress(uint8_t* inbuf, uint32_t inlen, uint8_t* outbuf, uint32_t stream.in = inbuf; stream.out = comp_data + (2 * sizeof(uint32_t)); -#ifndef __REACTOS__ for (unsigned int i = 0; i < num_pages; i++) { -#else - for (i = 0; i < num_pages; i++) { -#endif // __REACTOS__ uint32_t* pagelen = (uint32_t*)(stream.out - sizeof(uint32_t)); stream.inlen = (uint32_t)min(LZO_PAGE_SIZE, outlen - (i * LZO_PAGE_SIZE)); @@ -891,10 +884,6 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, uint64_t end_data, void LIST_ENTRY* le; uint64_t address, extaddr; void* csum = NULL; -#ifdef __REACTOS__ - int32_t i2; - uint32_t i3, j; -#endif // __REACTOS__ if (fcb->Vcb->options.compress_type != 0 && fcb->prop_compression == PropCompression_None) type = fcb->Vcb->options.compress_type; @@ -934,11 +923,7 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, uint64_t end_data, void if (!NT_SUCCESS(Status)) { ERR("add_calc_job_comp returned %08lx\n", Status); -#ifndef __REACTOS__ for (unsigned int j = 0; j < i; j++) { -#else - for (j = 0; j < i; j++) { -#endif // __REACTOS__ KeWaitForSingleObject(&parts[j].cj->event, Executive, KernelMode, false, NULL); ExFreePool(parts[j].cj); } @@ -950,7 +935,6 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, uint64_t end_data, void Status = STATUS_SUCCESS; -#ifndef __REACTOS__ for (int i = num_parts - 1; i >= 0; i--) { calc_thread_main(fcb->Vcb, parts[i].cj); @@ -959,35 +943,18 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, uint64_t end_data, void if (!NT_SUCCESS(parts[i].cj->Status)) Status = parts[i].cj->Status; } -#else - for (i2 = num_parts - 1; i2 >= 0; i2--) { - calc_thread_main(fcb->Vcb, parts[i].cj); - - KeWaitForSingleObject(&parts[i2].cj->event, Executive, KernelMode, false, NULL); - - if (!NT_SUCCESS(parts[i2].cj->Status)) - Status = parts[i2].cj->Status; - } -#endif // __REACTOS__ if (!NT_SUCCESS(Status)) { ERR("calc job returned %08lx\n", Status); -#ifndef __REACTOS__ for (unsigned int i = 0; i < num_parts; i++) { ExFreePool(parts[i].cj); } -#else - for (i3 = 0; i3 < num_parts; i3++) { - ExFreePool(parts[i3].cj); - } -#endif // __REACTOS__ ExFreePool(parts); return Status; } -#ifndef __REACTOS__ for (unsigned int i = 0; i < num_parts; i++) { if (parts[i].cj->space_left >= fcb->Vcb->superblock.sector_size) { parts[i].compression_type = type; @@ -1013,33 +980,6 @@ NTSTATUS write_compressed(fcb* fcb, uint64_t start_data, uint64_t end_data, void buflen += parts[i].outlen; ExFreePool(parts[i].cj); } -#else - for (i3 = 0; i3 < num_parts; i3++) { - if (parts[i3].cj->space_left >= fcb->Vcb->superblock.sector_size) { - parts[i3].compression_type = type; - parts[i3].outlen = parts[i3].inlen - parts[i3].cj->space_left; - - if (type == BTRFS_COMPRESSION_LZO) - fcb->Vcb->superblock.incompat_flags |= BTRFS_INCOMPAT_FLAGS_COMPRESS_LZO; - else if (type == BTRFS_COMPRESSION_ZSTD) - fcb->Vcb->superblock.incompat_flags |= BTRFS_INCOMPAT_FLAGS_COMPRESS_ZSTD; - - if ((parts[i3].outlen % fcb->Vcb->superblock.sector_size) != 0) { - unsigned int newlen = (unsigned int)sector_align(parts[i3].outlen, fcb->Vcb->superblock.sector_size); - - RtlZeroMemory(parts[i3].buf + parts[i3].outlen, newlen - parts[i3].outlen); - - parts[i3].outlen = newlen; - } - } else { - parts[i3].compression_type = BTRFS_COMPRESSION_NONE; - parts[i3].outlen = (unsigned int)sector_align(parts[i3].inlen, fcb->Vcb->superblock.sector_size); - } - - buflen += parts[i3].outlen; - ExFreePool(parts[i3].cj); - } -#endif // __REACTOS__ // check if first 128 KB of file is incompressible diff --git a/drivers/filesystems/btrfs/create.c b/drivers/filesystems/btrfs/create.c index 17e2e722acc..c5d27d1ce27 100644 --- a/drivers/filesystems/btrfs/create.c +++ b/drivers/filesystems/btrfs/create.c @@ -84,6 +84,8 @@ typedef struct { device_extension* Vcb; ACCESS_MASK granted_access; file_ref* fileref; + NTSTATUS Status; + KEVENT event; } oplock_context; fcb* create_fcb(device_extension* Vcb, POOL_TYPE pool_type) { @@ -2458,7 +2460,7 @@ static NTSTATUS file_create2(_In_ PIRP Irp, _Requires_exclusive_lock_held_(_Curr fileref->fcb = fcb; - if (Irp->Overlay.AllocationSize.QuadPart > 0 && !write_fcb_compressed(fcb)) { + if (Irp->Overlay.AllocationSize.QuadPart > 0 && !write_fcb_compressed(fcb) && fcb->type != BTRFS_TYPE_DIRECTORY) { Status = extend_file(fcb, fileref, Irp->Overlay.AllocationSize.QuadPart, true, NULL, rollback); if (!NT_SUCCESS(Status)) { @@ -2541,9 +2543,6 @@ static NTSTATUS file_create2(_In_ PIRP Irp, _Requires_exclusive_lock_held_(_Curr } } else { UNICODE_STRING fpusuc; -#ifdef __REACTOS__ - UINT32 dc_hash; -#endif Status = RtlUpcaseUnicodeString(&fpusuc, fpus, true); if (!NT_SUCCESS(Status)) { @@ -2560,11 +2559,7 @@ static NTSTATUS file_create2(_In_ PIRP Irp, _Requires_exclusive_lock_held_(_Curr return Status; } -#ifndef __REACTOS__ uint32_t dc_hash = calc_crc32c(0xffffffff, (uint8_t*)fpusuc.Buffer, fpusuc.Length); -#else - dc_hash = calc_crc32c(0xffffffff, (uint8_t*)fpusuc.Buffer, fpusuc.Length); -#endif // __REACTOS__ if (parfileref->fcb->hash_ptrs_uc[dc_hash >> 24]) { LIST_ENTRY* le = parfileref->fcb->hash_ptrs_uc[dc_hash >> 24]; @@ -2669,12 +2664,16 @@ static NTSTATUS create_stream(_Requires_lock_held_(_Curr_->tree_lock) _Requires_ if (parfileref->fcb == Vcb->dummy_fcb) return STATUS_ACCESS_DENIED; + Status = check_file_name_valid(stream, false, true); + if (!NT_SUCCESS(Status)) + return Status; + Status = open_fileref(Vcb, &newpar, fpus, parfileref, false, NULL, NULL, PagedPool, case_sensitive, Irp); if (Status == STATUS_OBJECT_NAME_NOT_FOUND) { UNICODE_STRING fpus2; - Status = check_file_name_valid(fpus, false, true); + Status = check_file_name_valid(fpus, false, false); if (!NT_SUCCESS(Status)) return Status; @@ -3856,7 +3855,7 @@ static NTSTATUS open_file3(device_extension* Vcb, PIRP Irp, ACCESS_MASK granted_ return STATUS_SUCCESS; } -static void oplock_complete(PVOID Context, PIRP Irp) { +static void __stdcall oplock_complete(PVOID Context, PIRP Irp) { NTSTATUS Status; LIST_ENTRY rollback; bool skip_lock; @@ -3924,11 +3923,14 @@ static void oplock_complete(PVOID Context, PIRP Irp) { Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT); - ExFreePool(ctx); + ctx->Status = Status; + + KeSetEvent(&ctx->event, 0, false); } static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, file_ref* fileref, ACCESS_MASK* granted_access, - PFILE_OBJECT FileObject, UNICODE_STRING* fn, ULONG options, PIRP Irp, LIST_ENTRY* rollback) { + PFILE_OBJECT FileObject, UNICODE_STRING* fn, ULONG options, PIRP Irp, LIST_ENTRY* rollback, + oplock_context** opctx) { NTSTATUS Status; file_ref* sf; bool readonly; @@ -3992,6 +3994,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, fi goto end; } + readonly |= fileref->fcb->inode_item.flags_ro & BTRFS_INODE_RO_VERITY; + if (readonly) { ACCESS_MASK allowed; @@ -4090,13 +4094,16 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, fi ctx->Vcb = Vcb; ctx->granted_access = *granted_access; ctx->fileref = fileref; + KeInitializeEvent(&ctx->event, NotificationEvent, false); #ifdef __REACTOS__ Status = FsRtlCheckOplock(fcb_oplock(fileref->fcb), Irp, ctx, (POPLOCK_WAIT_COMPLETE_ROUTINE) oplock_complete, NULL); #else Status = FsRtlCheckOplock(fcb_oplock(fileref->fcb), Irp, ctx, oplock_complete, NULL); #endif /* __REACTOS__ */ - if (Status == STATUS_PENDING) + if (Status == STATUS_PENDING) { + *opctx = ctx; return Status; + } ExFreePool(ctx); @@ -4451,7 +4458,8 @@ NTSTATUS open_fileref_by_inode(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) return STATUS_SUCCESS; } -static NTSTATUS open_file(PDEVICE_OBJECT DeviceObject, _Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, PIRP Irp, LIST_ENTRY* rollback) { +static NTSTATUS open_file(PDEVICE_OBJECT DeviceObject, _Requires_lock_held_(_Curr_->tree_lock) device_extension* Vcb, PIRP Irp, + LIST_ENTRY* rollback, oplock_context** opctx) { PFILE_OBJECT FileObject = NULL; ULONG RequestedDisposition; ULONG options; @@ -4685,9 +4693,10 @@ loaded: goto exit; } - if (NT_SUCCESS(Status)) // file already exists - Status = open_file2(Vcb, RequestedDisposition, fileref, &granted_access, FileObject, &fn, options, Irp, rollback); - else { + if (NT_SUCCESS(Status)) { // file already exists + Status = open_file2(Vcb, RequestedDisposition, fileref, &granted_access, FileObject, &fn, + options, Irp, rollback, opctx); + } else { file_ref* existing_file = NULL; Status = file_create(Irp, Vcb, FileObject, related, loaded_related, &fn, RequestedDisposition, options, &existing_file, rollback); @@ -4695,7 +4704,8 @@ loaded: if (Status == STATUS_OBJECT_NAME_COLLISION) { // already exists fileref = existing_file; - Status = open_file2(Vcb, RequestedDisposition, fileref, &granted_access, FileObject, &fn, options, Irp, rollback); + Status = open_file2(Vcb, RequestedDisposition, fileref, &granted_access, FileObject, &fn, + options, Irp, rollback, opctx); } else { Irp->IoStatus.Information = NT_SUCCESS(Status) ? FILE_CREATED : 0; granted_access = IrpSp->Parameters.Create.SecurityContext->DesiredAccess; @@ -4815,6 +4825,7 @@ NTSTATUS __stdcall drv_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION IrpSp; device_extension* Vcb = DeviceObject->DeviceExtension; bool top_level, locked = false; + oplock_context* opctx = NULL; FsRtlEnterFileSystem(); @@ -4993,7 +5004,7 @@ NTSTATUS __stdcall drv_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { ExAcquireResourceSharedLite(&Vcb->fileref_lock, true); - Status = open_file(DeviceObject, Vcb, Irp, &rollback); + Status = open_file(DeviceObject, Vcb, Irp, &rollback, &opctx); if (!NT_SUCCESS(Status)) do_rollback(Vcb, &rollback); @@ -5007,18 +5018,22 @@ NTSTATUS __stdcall drv_create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { } exit: - Irp->IoStatus.Status = Status; - - if (Status == STATUS_PENDING) - IoMarkIrpPending(Irp); - else + if (Status != STATUS_PENDING) { + Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT); - - TRACE("create returning %08lx\n", Status); + } if (locked) ExReleaseResourceLite(&Vcb->load_lock); + if (Status == STATUS_PENDING) { + KeWaitForSingleObject(&opctx->event, Executive, KernelMode, false, NULL); + Status = opctx->Status; + ExFreePool(opctx); + } + + TRACE("create returning %08lx\n", Status); + if (top_level) IoSetTopLevelIrp(NULL); diff --git a/drivers/filesystems/btrfs/dirctrl.c b/drivers/filesystems/btrfs/dirctrl.c index 6b7b66cba4f..ce42fcf1e5d 100644 --- a/drivers/filesystems/btrfs/dirctrl.c +++ b/drivers/filesystems/btrfs/dirctrl.c @@ -640,18 +640,6 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir return STATUS_SUCCESS; } - case FileObjectIdInformation: - FIXME("STUB: FileObjectIdInformation\n"); - return STATUS_NOT_IMPLEMENTED; - - case FileQuotaInformation: - FIXME("STUB: FileQuotaInformation\n"); - return STATUS_NOT_IMPLEMENTED; - - case FileReparsePointInformation: - FIXME("STUB: FileReparsePointInformation\n"); - return STATUS_NOT_IMPLEMENTED; - default: WARN("Unknown FileInformationClass %u\n", IrpSp->Parameters.QueryDirectory.FileInformationClass); return STATUS_NOT_IMPLEMENTED; diff --git a/drivers/filesystems/btrfs/fastio.c b/drivers/filesystems/btrfs/fastio.c index a5f577efb93..76c2d96dc81 100644 --- a/drivers/filesystems/btrfs/fastio.c +++ b/drivers/filesystems/btrfs/fastio.c @@ -494,10 +494,8 @@ static BOOLEAN __stdcall fast_io_unlock_all_by_key(PFILE_OBJECT FileObject, PVOI #ifdef __REACTOS__ _Function_class_(FAST_IO_ACQUIRE_FILE) -static void __stdcall fast_io_acquire_for_create_section(_In_ PFILE_OBJECT FileObject) { -#else -static void fast_io_acquire_for_create_section(_In_ PFILE_OBJECT FileObject) { #endif /* __REACTOS__ */ +static void __stdcall fast_io_acquire_for_create_section(_In_ PFILE_OBJECT FileObject) { fcb* fcb; TRACE("(%p)\n", FileObject); @@ -516,10 +514,8 @@ static void fast_io_acquire_for_create_section(_In_ PFILE_OBJECT FileObject) { #ifdef __REACTOS__ _Function_class_(FAST_IO_RELEASE_FILE) -static void __stdcall fast_io_release_for_create_section(_In_ PFILE_OBJECT FileObject) { -#else -static void fast_io_release_for_create_section(_In_ PFILE_OBJECT FileObject) { #endif /* __REACTOS__ */ +static void __stdcall fast_io_release_for_create_section(_In_ PFILE_OBJECT FileObject) { fcb* fcb; TRACE("(%p)\n", FileObject); diff --git a/drivers/filesystems/btrfs/fileinfo.c b/drivers/filesystems/btrfs/fileinfo.c index cd21a9ce8f4..16febd612d6 100644 --- a/drivers/filesystems/btrfs/fileinfo.c +++ b/drivers/filesystems/btrfs/fileinfo.c @@ -1679,12 +1679,18 @@ static NTSTATUS rename_stream_to_file(device_extension* Vcb, file_ref* fileref, fileref->fcb->adsdata.Buffer = NULL; fileref->fcb->adsdata.Length = fileref->fcb->adsdata.MaximumLength = 0; + acquire_fcb_lock_exclusive(Vcb); + + RemoveEntryList(&fileref->fcb->list_entry); InsertHeadList(ofr->fcb->list_entry.Blink, &fileref->fcb->list_entry); if (fileref->fcb->subvol->fcbs_ptrs[fileref->fcb->hash >> 24] == &ofr->fcb->list_entry) fileref->fcb->subvol->fcbs_ptrs[fileref->fcb->hash >> 24] = &fileref->fcb->list_entry; RemoveEntryList(&ofr->fcb->list_entry); + + release_fcb_lock(Vcb); + ofr->fcb->list_entry.Flink = ofr->fcb->list_entry.Blink = NULL; mark_fcb_dirty(fileref->fcb); @@ -2475,8 +2481,6 @@ static NTSTATUS rename_file_to_stream(device_extension* Vcb, file_ref* fileref, mark_fileref_dirty(dummyfileref); - free_fileref(dummyfileref); - // change fcb values fileref->fcb->hash_ptrs = NULL; @@ -4577,6 +4581,12 @@ static NTSTATUS fill_in_hard_link_information(FILE_LINKS_INFORMATION* fli, file_ ExAcquireResourceExclusiveLite(&fcb->Vcb->fileref_lock, true); if (IsListEmpty(&fcb->hardlinks)) { + if (!fileref->dc) { + ExReleaseResourceLite(&fcb->Vcb->fileref_lock); + Status = STATUS_INVALID_PARAMETER; + goto end; + } + bytes_needed += sizeof(FILE_LINK_ENTRY_INFORMATION) + fileref->dc->name.Length - sizeof(WCHAR); if (bytes_needed > *length) @@ -4615,7 +4625,7 @@ static NTSTATUS fill_in_hard_link_information(FILE_LINKS_INFORMATION* fli, file_ while (le2 != &parfr->children) { file_ref* fr2 = CONTAINING_RECORD(le2, file_ref, list_entry); - if (fr2->dc->index == hl->index) { + if (fr2->dc && fr2->dc->index == hl->index) { found = true; deleted = fr2->deleted; @@ -4676,6 +4686,7 @@ static NTSTATUS fill_in_hard_link_information(FILE_LINKS_INFORMATION* fli, file_ Status = overflow ? STATUS_BUFFER_OVERFLOW : STATUS_SUCCESS; +end: ExReleaseResourceLite(fcb->Header.Resource); return Status; @@ -5312,7 +5323,7 @@ static NTSTATUS query_info(device_extension* Vcb, PFILE_OBJECT FileObject, PIRP { FILE_STAT_INFORMATION* fsi = Irp->AssociatedIrp.SystemBuffer; - if (IrpSp->Parameters.QueryFile.Length < sizeof(FILE_STAT_LX_INFORMATION)) { + if (IrpSp->Parameters.QueryFile.Length < sizeof(FILE_STAT_INFORMATION)) { WARN("overflow\n"); Status = STATUS_BUFFER_OVERFLOW; goto exit; @@ -5510,10 +5521,12 @@ NTSTATUS __stdcall drv_query_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { ExAcquireResourceSharedLite(fcb->Header.Resource, true); - Status = STATUS_SUCCESS; - - if (fcb->ea_xattr.Length == 0) + if (fcb->ea_xattr.Length == 0) { + Status = STATUS_NO_EAS_ON_FILE; goto end2; + } + + Status = STATUS_SUCCESS; if (IrpSp->Parameters.QueryEa.EaList) { FILE_FULL_EA_INFORMATION *ea, *out; @@ -5610,8 +5623,10 @@ NTSTATUS __stdcall drv_query_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { ULONG i; for (i = 0; i < index; i++) { - if (ea->NextEntryOffset == 0) // last item + if (ea->NextEntryOffset == 0) { // last item + Status = STATUS_NO_MORE_EAS; goto end2; + } ea = (FILE_FULL_EA_INFORMATION*)(((uint8_t*)ea) + ea->NextEntryOffset); } diff --git a/drivers/filesystems/btrfs/flushthread.c b/drivers/filesystems/btrfs/flushthread.c index a574d433192..bdaf15bf69e 100644 --- a/drivers/filesystems/btrfs/flushthread.c +++ b/drivers/filesystems/btrfs/flushthread.c @@ -633,9 +633,6 @@ static NTSTATUS add_parents(device_extension* Vcb, PIRP Irp) { KEY searchkey; traverse_ptr tp; NTSTATUS Status; -#ifdef __REACTOS__ - tree* t2; -#endif searchkey.obj_id = t->root->id; searchkey.obj_type = TYPE_ROOT_ITEM; @@ -677,11 +674,7 @@ static NTSTATUS add_parents(device_extension* Vcb, PIRP Irp) { } } -#ifndef __REACTOS__ tree* t2 = tp.tree; -#else - t2 = tp.tree; -#endif while (t2) { t2->write = true; @@ -2892,9 +2885,6 @@ static NTSTATUS update_chunk_usage(device_extension* Vcb, PIRP Irp, LIST_ENTRY* } if (c->used != c->oldused) { -#ifdef __REACTOS__ - uint64_t old_phys_used, phys_used; -#endif searchkey.obj_id = c->offset; searchkey.obj_type = TYPE_BLOCK_GROUP_ITEM; searchkey.offset = c->chunk_item->size; @@ -2956,19 +2946,7 @@ static NTSTATUS update_chunk_usage(device_extension* Vcb, PIRP Irp, LIST_ENTRY* goto end; } -#ifndef __REACTOS__ - uint64_t old_phys_used = chunk_estimate_phys_size(Vcb, c, c->oldused); - uint64_t phys_used = chunk_estimate_phys_size(Vcb, c, c->used); -#else - old_phys_used = chunk_estimate_phys_size(Vcb, c, c->oldused); - phys_used = chunk_estimate_phys_size(Vcb, c, c->used); -#endif - - if (Vcb->superblock.bytes_used + phys_used > old_phys_used) - Vcb->superblock.bytes_used += phys_used - old_phys_used; - else - Vcb->superblock.bytes_used = 0; - + Vcb->superblock.bytes_used += c->used - c->oldused; c->oldused = c->used; } @@ -4316,7 +4294,7 @@ static NTSTATUS create_chunk(device_extension* Vcb, chunk* c, PIRP Irp) { c->created = false; c->oldused = c->used; - Vcb->superblock.bytes_used += chunk_estimate_phys_size(Vcb, c, c->used); + Vcb->superblock.bytes_used += c->used; return STATUS_SUCCESS; } @@ -5437,9 +5415,6 @@ static NTSTATUS drop_chunk(device_extension* Vcb, chunk* c, LIST_ENTRY* batchlis KEY searchkey; traverse_ptr tp; uint64_t i, factor; -#ifdef __REACTOS__ - uint64_t phys_used; -#endif CHUNK_ITEM_STRIPE* cis = (CHUNK_ITEM_STRIPE*)&c->chunk_item[1];; TRACE("dropping chunk %I64x\n", c->offset); @@ -5706,16 +5681,7 @@ static NTSTATUS drop_chunk(device_extension* Vcb, chunk* c, LIST_ENTRY* batchlis Vcb->superblock.incompat_flags &= ~BTRFS_INCOMPAT_FLAGS_RAID1C34; } -#ifndef __REACTOS__ - uint64_t phys_used = chunk_estimate_phys_size(Vcb, c, c->oldused); -#else - phys_used = chunk_estimate_phys_size(Vcb, c, c->oldused); -#endif // __REACTOS__ - - if (phys_used < Vcb->superblock.bytes_used) - Vcb->superblock.bytes_used -= phys_used; - else - Vcb->superblock.bytes_used = 0; + Vcb->superblock.bytes_used -= c->oldused; ExFreePool(c->chunk_item); ExFreePool(c->devices); @@ -6828,9 +6794,6 @@ static void flush_disk_caches(device_extension* Vcb) { LIST_ENTRY* le; ioctl_context context; ULONG num; -#ifdef __REACTOS__ - unsigned int i; -#endif context.left = 0; @@ -6908,11 +6871,7 @@ nextdev: KeWaitForSingleObject(&context.Event, Executive, KernelMode, false, NULL); -#ifndef __REACTOS__ for (unsigned int i = 0; i < num; i++) { -#else - for (i = 0; i < num; i++) { -#endif if (context.stripes[i].Irp) IoFreeIrp(context.stripes[i].Irp); } diff --git a/drivers/filesystems/btrfs/fsctl.c b/drivers/filesystems/btrfs/fsctl.c index 191dda11aa7..356031e395f 100644 --- a/drivers/filesystems/btrfs/fsctl.c +++ b/drivers/filesystems/btrfs/fsctl.c @@ -387,7 +387,8 @@ static NTSTATUS do_create_snapshot(device_extension* Vcb, PFILE_OBJECT parent, f r->root_item.inode.st_blocks = subvol->root_item.inode.st_blocks; r->root_item.inode.st_nlink = 1; r->root_item.inode.st_mode = __S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; // 40755 - r->root_item.inode.flags = 0xffffffff80000000; // FIXME - find out what these mean + r->root_item.inode.flags = 0x80000000; // FIXME - find out what these mean + r->root_item.inode.flags_ro = 0xffffffff; // FIXME - find out what these mean r->root_item.generation = Vcb->superblock.generation; r->root_item.objid = subvol->root_item.objid; r->root_item.block_number = address; @@ -935,7 +936,8 @@ static NTSTATUS create_subvol(device_extension* Vcb, PFILE_OBJECT FileObject, vo r->root_item.inode.st_blocks = Vcb->superblock.node_size; r->root_item.inode.st_nlink = 1; r->root_item.inode.st_mode = __S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; // 40755 - r->root_item.inode.flags = 0xffffffff80000000; // FIXME - find out what these mean + r->root_item.inode.flags = 0x80000000; // FIXME - find out what these mean + r->root_item.inode.flags_ro = 0xffffffff; // FIXME - find out what these mean if (bcs->readonly) r->root_item.flags |= BTRFS_SUBVOL_READONLY; diff --git a/drivers/filesystems/btrfs/pnp.c b/drivers/filesystems/btrfs/pnp.c index 54426102b9b..5a44b0198a6 100644 --- a/drivers/filesystems/btrfs/pnp.c +++ b/drivers/filesystems/btrfs/pnp.c @@ -200,6 +200,7 @@ static NTSTATUS bus_pnp(bus_device_extension* bde, PIRP Irp) { Status = STATUS_UNSUCCESSFUL; handled = true; break; + case IRP_MN_QUERY_CAPABILITIES: Status = bus_query_capabilities(Irp); handled = true; diff --git a/drivers/filesystems/btrfs/read.c b/drivers/filesystems/btrfs/read.c index 824a1c17b29..a7d4b872659 100644 --- a/drivers/filesystems/btrfs/read.c +++ b/drivers/filesystems/btrfs/read.c @@ -683,9 +683,6 @@ static NTSTATUS read_data_raid5(device_extension* Vcb, uint8_t* buf, uint64_t ad runlength = RtlFindFirstRunClear(&ps->bmp, &index); while (runlength != 0) { -#ifdef __REACTOS__ - uint64_t runstart, runend, start, end; -#endif if (index >= ps->bmplen) break; @@ -695,17 +692,11 @@ static NTSTATUS read_data_raid5(device_extension* Vcb, uint8_t* buf, uint64_t ad if (runlength == 0) break; } -#ifndef __REACTOS__ + uint64_t runstart = ps->address + (index << Vcb->sector_shift); uint64_t runend = runstart + (runlength << Vcb->sector_shift); uint64_t start = max(runstart, addr); uint64_t end = min(runend, addr + length); -#else - runstart = ps->address + (index * Vcb->sector_shift); - runend = runstart + (runlength * Vcb->sector_shift); - start = max(runstart, addr); - end = min(runend, addr + length); -#endif if (end > start) RtlCopyMemory(buf + start - addr, &ps->data[start - ps->address], (ULONG)(end - start)); @@ -1039,9 +1030,6 @@ static NTSTATUS read_data_raid6(device_extension* Vcb, uint8_t* buf, uint64_t ad runlength = RtlFindFirstRunClear(&ps->bmp, &index); while (runlength != 0) { -#ifdef __REACTOS__ - uint64_t runstart, runend, start, end; -#endif if (index >= ps->bmplen) break; @@ -1052,17 +1040,10 @@ static NTSTATUS read_data_raid6(device_extension* Vcb, uint8_t* buf, uint64_t ad break; } -#ifndef __REACTOS__ uint64_t runstart = ps->address + (index << Vcb->sector_shift); uint64_t runend = runstart + (runlength << Vcb->sector_shift); uint64_t start = max(runstart, addr); uint64_t end = min(runend, addr + length); -#else - runstart = ps->address + (index * Vcb->sector_shift); - runend = runstart + (runlength * Vcb->sector_shift); - start = max(runstart, addr); - end = min(runend, addr + length); -#endif if (end > start) RtlCopyMemory(buf + start - addr, &ps->data[start - ps->address], (ULONG)(end - start)); @@ -3191,12 +3172,8 @@ nextitem: RtlCopyMemory(rp->data, rp->buf + rp->bumpoff, rp->read); } else { uint8_t* buf = rp->buf; -#ifdef __REACTOS__ - unsigned int i; - for (i = 0; i < rp->num_extents; i++) { -#else + for (unsigned int i = 0; i < rp->num_extents; i++) { -#endif // __REACTOS__ uint8_t *decomp = NULL, *buf2; ULONG outlen, inlen, off2; uint32_t inpageoff = 0; diff --git a/drivers/filesystems/btrfs/security.c b/drivers/filesystems/btrfs/security.c index c1183de2465..2761c63a915 100644 --- a/drivers/filesystems/btrfs/security.c +++ b/drivers/filesystems/btrfs/security.c @@ -95,7 +95,7 @@ void add_user_mapping(WCHAR* sidstring, ULONG sidstringlength, uint32_t uid) { while (sidstringlength > 0) { val = 0; i = 0; - while (i < sidstringlength && sidstring[i] != '-') { + while (sidstring[i] != '-' && i < sidstringlength) { if (sidstring[i] >= '0' && sidstring[i] <= '9') { val *= 10; val += sidstring[i] - '0'; diff --git a/drivers/filesystems/btrfs/write.c b/drivers/filesystems/btrfs/write.c index f4661598400..f4056508035 100644 --- a/drivers/filesystems/btrfs/write.c +++ b/drivers/filesystems/btrfs/write.c @@ -4228,8 +4228,6 @@ NTSTATUS write_file2(device_extension* Vcb, PIRP Irp, LARGE_INTEGER offset, void if (fcb->ads) make_inline = false; - else if (fcb->type == BTRFS_TYPE_SYMLINK) - make_inline = newlength <= (Vcb->superblock.node_size - sizeof(tree_header) - sizeof(leaf_node) - offsetof(EXTENT_DATA, data[0])); else make_inline = newlength <= fcb->Vcb->options.max_inline;
2 years, 7 months
1
0
0
0
[reactos] 08/10: [BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.7.9 (#4417)
by Vincent Franchomme
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f5556fdc1057d5a254da4…
commit f5556fdc1057d5a254da4343d7277d4d7a54c321 Author: Vincent Franchomme <franchomme.vincent(a)gmail.com> AuthorDate: Thu Apr 28 21:35:58 2022 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue May 3 17:30:11 2022 +0200 [BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.7.9 (#4417) v1.7.9 (2021-10-02): - Fixed deadlock when mounting on Windows 11 - Added support for BitLocker-encrypted volumes - Improved filename checks when renaming or creating hard links - Miscellaneous bug fixes --- dll/shellext/shellbtrfs/shellbtrfs.rc | 8 +- dll/win32/ubtrfs/ubtrfs.rc | 8 +- drivers/filesystems/btrfs/blake2-impl.h | 2 + drivers/filesystems/btrfs/btrfs.c | 56 +++++-- drivers/filesystems/btrfs/btrfs.inf | 2 +- drivers/filesystems/btrfs/btrfs.rc | 8 +- drivers/filesystems/btrfs/btrfs_drv.h | 7 +- drivers/filesystems/btrfs/create.c | 6 +- drivers/filesystems/btrfs/devctrl.c | 6 +- drivers/filesystems/btrfs/fileinfo.c | 22 +-- drivers/filesystems/btrfs/flushthread.c | 5 +- drivers/filesystems/btrfs/fsctl.c | 2 +- drivers/filesystems/btrfs/search.c | 256 ++++++++++++++++++++++++++--- drivers/filesystems/btrfs/zstd/zstd_lazy.c | 2 +- 14 files changed, 317 insertions(+), 73 deletions(-) diff --git a/dll/shellext/shellbtrfs/shellbtrfs.rc b/dll/shellext/shellbtrfs/shellbtrfs.rc index acf070e40f9..980929f108c 100644 --- a/dll/shellext/shellbtrfs/shellbtrfs.rc +++ b/dll/shellext/shellbtrfs/shellbtrfs.rc @@ -61,8 +61,8 @@ IDI_ICON1 ICON "subvol.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,8,0 - PRODUCTVERSION 1,7,8,0 + FILEVERSION 1,7,9,0 + PRODUCTVERSION 1,7,9,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -78,12 +78,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs shell extension" - VALUE "FileVersion", "1.7.8" + VALUE "FileVersion", "1.7.9" VALUE "InternalName", "btrfs" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "OriginalFilename", "shellbtrfs.dll" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.8" + VALUE "ProductVersion", "1.7.9" END END BLOCK "VarFileInfo" diff --git a/dll/win32/ubtrfs/ubtrfs.rc b/dll/win32/ubtrfs/ubtrfs.rc index 2b17773476b..79609cf3464 100644 --- a/dll/win32/ubtrfs/ubtrfs.rc +++ b/dll/win32/ubtrfs/ubtrfs.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,8,0 - PRODUCTVERSION 1,7,8,0 + FILEVERSION 1,7,9,0 + PRODUCTVERSION 1,7,9,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "Btrfs utility DLL" - VALUE "FileVersion", "1.7.8" + VALUE "FileVersion", "1.7.9" VALUE "InternalName", "ubtrfs" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "OriginalFilename", "ubtrfs.dll" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.8" + VALUE "ProductVersion", "1.7.9" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/blake2-impl.h b/drivers/filesystems/btrfs/blake2-impl.h index d6b05c09f15..1bd067b6d28 100644 --- a/drivers/filesystems/btrfs/blake2-impl.h +++ b/drivers/filesystems/btrfs/blake2-impl.h @@ -29,6 +29,8 @@ #define BLAKE2_INLINE inline #endif +#define NATIVE_LITTLE_ENDIAN + static BLAKE2_INLINE uint32_t load32( const void *src ) { #if defined(NATIVE_LITTLE_ENDIAN) diff --git a/drivers/filesystems/btrfs/btrfs.c b/drivers/filesystems/btrfs/btrfs.c index efd80d94357..ea5d2f5cc20 100644 --- a/drivers/filesystems/btrfs/btrfs.c +++ b/drivers/filesystems/btrfs/btrfs.c @@ -4389,10 +4389,8 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { TRACE("(%p, %p)\n", DeviceObject, Irp); - if (DeviceObject != master_devobj) { - Status = STATUS_INVALID_DEVICE_REQUEST; - goto exit; - } + if (DeviceObject != master_devobj) + return STATUS_INVALID_DEVICE_REQUEST; IrpSp = IoGetCurrentIrpStackLocation(Irp); DeviceToMount = IrpSp->Parameters.MountVolume.DeviceObject; @@ -4412,7 +4410,7 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { if (!not_pnp) { Status = STATUS_UNRECOGNIZED_VOLUME; - goto exit2; + goto exit; } } else { PDEVICE_OBJECT pdo; @@ -4451,7 +4449,7 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { if (!vde || vde->type != VCB_TYPE_VOLUME) { vde = NULL; Status = STATUS_UNRECOGNIZED_VOLUME; - goto exit2; + goto exit; } } @@ -4472,11 +4470,13 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { if (pdode->num_children == 0) { ERR("error - number of devices is zero\n"); Status = STATUS_INTERNAL_ERROR; - goto exit2; + ExReleaseResourceLite(&pdode->child_lock); + goto exit; } Status = STATUS_DEVICE_NOT_READY; - goto exit2; + ExReleaseResourceLite(&pdode->child_lock); + goto exit; } le = le2; @@ -4485,6 +4485,7 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { if (pdode->num_children == 0 || pdode->children_loaded == 0) { ERR("error - number of devices is zero\n"); Status = STATUS_INTERNAL_ERROR; + ExReleaseResourceLite(&pdode->child_lock); goto exit; } @@ -4519,6 +4520,10 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { if (!NT_SUCCESS(Status)) { ERR("IoCreateDevice returned %08lx\n", Status); Status = STATUS_UNRECOGNIZED_VOLUME; + + if (pdode) + ExReleaseResourceLite(&pdode->child_lock); + goto exit; } @@ -4558,18 +4563,29 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { else if (Irp->Tail.Overlay.Thread) IoSetHardErrorOrVerifyDevice(Irp, readobj); + if (pdode) + ExReleaseResourceLite(&pdode->child_lock); + goto exit; } if (!vde && Vcb->superblock.num_devices > 1) { ERR("cannot mount multi-device FS with non-PNP device\n"); Status = STATUS_UNRECOGNIZED_VOLUME; + + if (pdode) + ExReleaseResourceLite(&pdode->child_lock); + goto exit; } Status = registry_load_volume_options(Vcb); if (!NT_SUCCESS(Status)) { ERR("registry_load_volume_options returned %08lx\n", Status); + + if (pdode) + ExReleaseResourceLite(&pdode->child_lock); + goto exit; } @@ -4579,9 +4595,15 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { if (pdode && pdode->children_loaded < pdode->num_children && (!Vcb->options.allow_degraded || !finished_probing || degraded_wait)) { ERR("could not mount as %I64u device(s) missing\n", pdode->num_children - pdode->children_loaded); Status = STATUS_DEVICE_NOT_READY; + ExReleaseResourceLite(&pdode->child_lock); goto exit; } + if (pdode) { + // Windows holds DeviceObject->DeviceLock, guaranteeing that mount_vol is serialized + ExReleaseResourceLite(&pdode->child_lock); + } + if (Vcb->options.ignore) { TRACE("ignoring volume\n"); Status = STATUS_UNRECOGNIZED_VOLUME; @@ -5014,10 +5036,6 @@ static NTSTATUS mount_vol(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) { ExInitializeResourceLite(&Vcb->send_load_lock); exit: - if (pdode) - ExReleaseResourceLite(&pdode->child_lock); - -exit2: if (Vcb) { ExReleaseResourceLite(&Vcb->tree_lock); ExReleaseResourceLite(&Vcb->load_lock); @@ -5784,6 +5802,14 @@ NTSTATUS check_file_name_valid(_In_ PUNICODE_STRING us, _In_ bool posix, _In_ bo (!posix && !stream && (us->Buffer[i] == '<' || us->Buffer[i] == '>' || us->Buffer[i] == '"' || us->Buffer[i] == '|' || us->Buffer[i] == '?' || us->Buffer[i] == '*' || (us->Buffer[i] >= 1 && us->Buffer[i] <= 31)))) return STATUS_OBJECT_NAME_INVALID; + + /* Don't allow unpaired surrogates ("WTF-16") */ + + if ((us->Buffer[i] & 0xfc00) == 0xdc00 && (i == 0 || ((us->Buffer[i-1] & 0xfc00) != 0xd800))) + return STATUS_OBJECT_NAME_INVALID; + + if ((us->Buffer[i] & 0xfc00) == 0xd800 && (i == (us->Length / sizeof(WCHAR)) - 1 || ((us->Buffer[i+1] & 0xfc00) != 0xdc00))) + return STATUS_OBJECT_NAME_INVALID; } if (us->Buffer[0] == '.' && (us->Length == sizeof(WCHAR) || (us->Length == 2 * sizeof(WCHAR) && us->Buffer[1] == '.'))) @@ -6290,6 +6316,8 @@ NTSTATUS __stdcall DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_S is_windows_8 = ver.dwMajorVersion > 6 || (ver.dwMajorVersion == 6 && ver.dwMinorVersion >= 2); + KeInitializeSpinLock(&fve_data_lock); + InitializeListHead(&uid_map_list); InitializeListHead(&gid_map_list); @@ -6516,12 +6544,12 @@ NTSTATUS __stdcall DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_S ExInitializeResourceLite(&boot_lock); Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, - (PVOID)&GUID_DEVINTERFACE_VOLUME, DriverObject, volume_notification, DriverObject, ¬ification_entry2); + (PVOID)&GUID_DEVINTERFACE_VOLUME, DriverObject, volume_notification, NULL, ¬ification_entry2); if (!NT_SUCCESS(Status)) ERR("IoRegisterPlugPlayNotification returned %08lx\n", Status); Status = IoRegisterPlugPlayNotification(EventCategoryDeviceInterfaceChange, PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, - (PVOID)&GUID_DEVINTERFACE_HIDDEN_VOLUME, DriverObject, volume_notification, DriverObject, ¬ification_entry3); + (PVOID)&GUID_DEVINTERFACE_HIDDEN_VOLUME, DriverObject, volume_notification, NULL, ¬ification_entry3); if (!NT_SUCCESS(Status)) ERR("IoRegisterPlugPlayNotification returned %08lx\n", Status); diff --git a/drivers/filesystems/btrfs/btrfs.inf b/drivers/filesystems/btrfs/btrfs.inf index b5fa3da9136..faeec384225 100644 --- a/drivers/filesystems/btrfs/btrfs.inf +++ b/drivers/filesystems/btrfs/btrfs.inf @@ -10,7 +10,7 @@ Signature = "$Windows NT$" Class = Volume ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f} Provider = %Me% -DriverVer = 06/07/2021,1.7.8.0 +DriverVer = 10/02/2021,1.7.9 CatalogFile = btrfs.cat [DestinationDirs] diff --git a/drivers/filesystems/btrfs/btrfs.rc b/drivers/filesystems/btrfs/btrfs.rc index 72a541c3f69..6b0d46874ef 100644 --- a/drivers/filesystems/btrfs/btrfs.rc +++ b/drivers/filesystems/btrfs/btrfs.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,8,0 - PRODUCTVERSION 1,7,8,0 + FILEVERSION 1,7,9,0 + PRODUCTVERSION 1,7,9,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs" - VALUE "FileVersion", "1.7.8" + VALUE "FileVersion", "1.7.9" VALUE "InternalName", "btrfs" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "OriginalFilename", "btrfs.sys" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.8" + VALUE "ProductVersion", "1.7.9" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/btrfs_drv.h b/drivers/filesystems/btrfs/btrfs_drv.h index 597e5d62794..d033b789934 100644 --- a/drivers/filesystems/btrfs/btrfs_drv.h +++ b/drivers/filesystems/btrfs/btrfs_drv.h @@ -1317,15 +1317,16 @@ void __stdcall mountmgr_thread(_In_ void* context); _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE) NTSTATUS __stdcall pnp_notification(PVOID NotificationStructure, PVOID Context); -void disk_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath); -void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath); -void volume_removal(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath); +void disk_arrival(PUNICODE_STRING devpath); +bool volume_arrival(PUNICODE_STRING devpath, bool fve_callback); +void volume_removal(PUNICODE_STRING devpath); _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE) NTSTATUS __stdcall volume_notification(PVOID NotificationStructure, PVOID Context); void remove_volume_child(_Inout_ _Requires_exclusive_lock_held_(_Curr_->child_lock) _Releases_exclusive_lock_(_Curr_->child_lock) _In_ volume_device_extension* vde, _In_ volume_child* vc, _In_ bool skip_dev); +extern KSPIN_LOCK fve_data_lock; // in cache.c void init_cache(); diff --git a/drivers/filesystems/btrfs/create.c b/drivers/filesystems/btrfs/create.c index a5a8a2316a2..17e2e722acc 100644 --- a/drivers/filesystems/btrfs/create.c +++ b/drivers/filesystems/btrfs/create.c @@ -1774,11 +1774,11 @@ NTSTATUS open_fileref(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusiv name_bit* nb; nb = CONTAINING_RECORD(RemoveTailList(&parts), name_bit, list_entry); - ExFreePool(nb); + ExFreeToPagedLookasideList(&Vcb->name_bit_lookaside, nb); if (has_stream && !IsListEmpty(&parts)) { nb = CONTAINING_RECORD(RemoveTailList(&parts), name_bit, list_entry); - ExFreePool(nb); + ExFreeToPagedLookasideList(&Vcb->name_bit_lookaside, nb); has_stream = false; } @@ -1877,6 +1877,8 @@ NTSTATUS add_dir_child(fcb* fcb, uint64_t inode, bool subvol, PANSI_STRING utf8, return STATUS_INSUFFICIENT_RESOURCES; } + RtlZeroMemory(dc, sizeof(dir_child)); + dc->utf8.Buffer = ExAllocatePoolWithTag(PagedPool, utf8->Length, ALLOC_TAG); if (!dc->utf8.Buffer) { ERR("out of memory\n"); diff --git a/drivers/filesystems/btrfs/devctrl.c b/drivers/filesystems/btrfs/devctrl.c index 4c729ec4c8e..ecff0f2eec8 100644 --- a/drivers/filesystems/btrfs/devctrl.c +++ b/drivers/filesystems/btrfs/devctrl.c @@ -202,12 +202,12 @@ static NTSTATUS probe_volume(void* data, ULONG length, KPROCESSOR_MODE processor ObDereferenceObject(FileObject); - volume_removal(drvobj, &pnp_name); + volume_removal(&pnp_name); if (RtlCompareMemory(guid, &GUID_DEVINTERFACE_DISK, sizeof(GUID)) == sizeof(GUID)) - disk_arrival(drvobj, &pnp_name); + disk_arrival(&pnp_name); else - volume_arrival(drvobj, &pnp_name); + volume_arrival(&pnp_name, false); return STATUS_SUCCESS; } diff --git a/drivers/filesystems/btrfs/fileinfo.c b/drivers/filesystems/btrfs/fileinfo.c index df8652823e7..cd21a9ce8f4 100644 --- a/drivers/filesystems/btrfs/fileinfo.c +++ b/drivers/filesystems/btrfs/fileinfo.c @@ -2326,7 +2326,7 @@ static NTSTATUS rename_file_to_stream(device_extension* Vcb, file_ref* fileref, dc = ExAllocatePoolWithTag(PagedPool, sizeof(dir_child), ALLOC_TAG); if (!dc) { - ERR("short read\n"); + ERR("out of memory\n"); Status = STATUS_INSUFFICIENT_RESOURCES;; ExFreePool(utf8.Buffer); ExFreePool(utf16.Buffer); @@ -2561,8 +2561,9 @@ static NTSTATUS set_rename_information(device_extension* Vcb, PIRP Irp, PFILE_OB } else { LONG i; - while (fnlen > 0 && (fri->FileName[fnlen - 1] == '/' || fri->FileName[fnlen - 1] == '\\')) + while (fnlen > 0 && (fri->FileName[fnlen - 1] == '/' || fri->FileName[fnlen - 1] == '\\')) { fnlen--; + } if (fnlen == 0) return STATUS_INVALID_PARAMETER; @@ -2621,13 +2622,9 @@ static NTSTATUS set_rename_information(device_extension* Vcb, PIRP Irp, PFILE_OB TRACE("fnus = %.*S\n", (int)(fnus.Length / sizeof(WCHAR)), fnus.Buffer); - for (unsigned int i = 0 ; i < fnus.Length / sizeof(WCHAR); i++) { - if (fnus.Buffer[i] == ':') { - TRACE("colon in filename\n"); - Status = STATUS_OBJECT_NAME_INVALID; - goto end; - } - } + Status = check_file_name_valid(&fnus, false, false); + if (!NT_SUCCESS(Status)) + goto end; origutf8len = fileref->dc->utf8.Length; @@ -3444,8 +3441,9 @@ static NTSTATUS set_link_information(device_extension* Vcb, PIRP Irp, PFILE_OBJE tfofcb = tfo->FsContext; parfcb = tfofcb; - while (fnlen > 0 && (fli->FileName[fnlen - 1] == '/' || fli->FileName[fnlen - 1] == '\\')) + while (fnlen > 0 && (fli->FileName[fnlen - 1] == '/' || fli->FileName[fnlen - 1] == '\\')) { fnlen--; + } if (fnlen == 0) return STATUS_INVALID_PARAMETER; @@ -3485,6 +3483,10 @@ static NTSTATUS set_link_information(device_extension* Vcb, PIRP Irp, PFILE_OBJE TRACE("fnus = %.*S\n", (int)(fnus.Length / sizeof(WCHAR)), fnus.Buffer); + Status = check_file_name_valid(&fnus, false, false); + if (!NT_SUCCESS(Status)) + goto end; + Status = utf16_to_utf8(NULL, 0, &utf8len, fn, (ULONG)fnlen * sizeof(WCHAR)); if (!NT_SUCCESS(Status)) goto end; diff --git a/drivers/filesystems/btrfs/flushthread.c b/drivers/filesystems/btrfs/flushthread.c index 565f400c4b5..a574d433192 100644 --- a/drivers/filesystems/btrfs/flushthread.c +++ b/drivers/filesystems/btrfs/flushthread.c @@ -22,7 +22,10 @@ #include <ntddscsi.h> #include <ntddstor.h> -#define MAX_CSUM_SIZE (4096 - sizeof(tree_header) - sizeof(leaf_node)) +/* cf. __MAX_CSUM_ITEMS in Linux - it needs sizeof(leaf_node) bytes free + * so it can do a split. Linux tries to get it so a run will fit in a + * sector, but the MAX_CSUM_ITEMS logic is wrong... */ +#define MAX_CSUM_SIZE (4096 - sizeof(tree_header) - (2 * sizeof(leaf_node))) // #define DEBUG_WRITE_LOOPS diff --git a/drivers/filesystems/btrfs/fsctl.c b/drivers/filesystems/btrfs/fsctl.c index 310816c272f..191dda11aa7 100644 --- a/drivers/filesystems/btrfs/fsctl.c +++ b/drivers/filesystems/btrfs/fsctl.c @@ -2874,7 +2874,7 @@ static NTSTATUS add_device(device_extension* Vcb, PIRP Irp, KPROCESSOR_MODE proc return STATUS_INTERNAL_ERROR; } - volume_removal(drvobj, &pnp_name); + volume_removal(&pnp_name); ExAcquireResourceExclusiveLite(&Vcb->tree_lock, true); diff --git a/drivers/filesystems/btrfs/search.c b/drivers/filesystems/btrfs/search.c index e604cc99814..96797c208ad 100644 --- a/drivers/filesystems/btrfs/search.c +++ b/drivers/filesystems/btrfs/search.c @@ -27,6 +27,7 @@ #include <initguid.h> #include <wdmguid.h> +#include <ioevent.h> extern ERESOURCE pdo_list_lock; extern LIST_ENTRY pdo_list; @@ -37,11 +38,30 @@ extern bool shutting_down; extern PDEVICE_OBJECT busobj; extern tIoUnregisterPlugPlayNotificationEx fIoUnregisterPlugPlayNotificationEx; extern ERESOURCE boot_lock; +extern PDRIVER_OBJECT drvobj; -typedef void (*pnp_callback)(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath); +typedef void (*pnp_callback)(PUNICODE_STRING devpath); + +#ifndef __REACTOS__ +// not in mingw yet +#ifndef _MSC_VER +DEFINE_GUID(GUID_IO_VOLUME_FVE_STATUS_CHANGE, 0x062998b2, 0xee1f, 0x4b6a, 0xb8, 0x57, 0xe7, 0x6c, 0xbb, 0xe9, 0xa6, 0xda); +#endif +#endif // __REACTOS__ extern PDEVICE_OBJECT master_devobj; +typedef struct { + LIST_ENTRY list_entry; + PDEVICE_OBJECT devobj; + void* notification_entry; + UNICODE_STRING devpath; + WCHAR buf[1]; +} fve_data; + +static LIST_ENTRY fve_data_list = { &fve_data_list, &fve_data_list }; +KSPIN_LOCK fve_data_lock; + static bool fs_ignored(BTRFS_UUID* uuid) { UNICODE_STRING path, ignoreus; NTSTATUS Status; @@ -115,12 +135,187 @@ static bool fs_ignored(BTRFS_UUID* uuid) { return ret; } -static void test_vol(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, - PUNICODE_STRING devpath, DWORD disk_num, DWORD part_num, uint64_t length) { +typedef struct { + PIO_WORKITEM work_item; + PFILE_OBJECT fileobj; + PDEVICE_OBJECT devobj; + UNICODE_STRING devpath; + WCHAR buf[1]; +} fve_callback_context; + +_Function_class_(IO_WORKITEM_ROUTINE) +static void __stdcall fve_callback(PDEVICE_OBJECT DeviceObject, PVOID con) { + fve_callback_context* ctx = con; + + UNUSED(DeviceObject); + + if (volume_arrival(&ctx->devpath, true)) { + KIRQL irql; + LIST_ENTRY* le; + fve_data* d = NULL; + + // volume no longer locked - unregister notification + + KeAcquireSpinLock(&fve_data_lock, &irql); + + le = fve_data_list.Flink; + while (le != &fve_data_list) { + fve_data* d2 = CONTAINING_RECORD(le, fve_data, list_entry); + + if (d2->devobj == ctx->devobj) { + RemoveEntryList(&d2->list_entry); + d = d2; + break; + } + + le = le->Flink; + } + + KeReleaseSpinLock(&fve_data_lock, irql); + + if (d) { + IoUnregisterPlugPlayNotification(d->notification_entry); + ExFreePool(d); + } + } + + IoFreeWorkItem(ctx->work_item); + ExFreePool(ctx); +} + +static NTSTATUS __stdcall event_notification(PVOID NotificationStructure, PVOID Context) { + TARGET_DEVICE_REMOVAL_NOTIFICATION* tdrn = NotificationStructure; + PDEVICE_OBJECT devobj = Context; + PIO_WORKITEM work_item; + fve_callback_context* ctx; + LIST_ENTRY* le; + KIRQL irql; + + if (RtlCompareMemory(&tdrn->Event, &GUID_IO_VOLUME_FVE_STATUS_CHANGE, sizeof(GUID)) != sizeof(GUID)) + return STATUS_SUCCESS; + + /* The FVE event has trailing data, presumably telling us whether the volume has + * been unlocked or whatever, but unfortunately it's undocumented! */ + + work_item = IoAllocateWorkItem(master_devobj); + if (!work_item) { + ERR("out of memory\n"); + return STATUS_SUCCESS; + } + + KeAcquireSpinLock(&fve_data_lock, &irql); + + le = fve_data_list.Flink; + while (le != &fve_data_list) { + fve_data* d = CONTAINING_RECORD(le, fve_data, list_entry); + + if (d->devobj == devobj) { + ctx = ExAllocatePoolWithTag(NonPagedPool, offsetof(fve_callback_context, buf) + d->devpath.Length, + ALLOC_TAG); + + if (!ctx) { + KeReleaseSpinLock(&fve_data_lock, irql); + ERR("out of memory\n"); + IoFreeWorkItem(work_item); + return STATUS_SUCCESS; + } + + RtlCopyMemory(ctx->buf, d->devpath.Buffer, d->devpath.Length); + ctx->devpath.Length = ctx->devpath.MaximumLength = d->devpath.Length; + + KeReleaseSpinLock(&fve_data_lock, irql); + + ctx->devpath.Buffer = ctx->buf; + + ctx->fileobj = tdrn->FileObject; + ctx->devobj = devobj; + ctx->work_item = work_item; + + IoQueueWorkItem(work_item, fve_callback, DelayedWorkQueue, ctx); + + return STATUS_SUCCESS; + } + + le = le->Flink; + } + + KeReleaseSpinLock(&fve_data_lock, irql); + + IoFreeWorkItem(work_item); + + return STATUS_SUCCESS; +} + +static void register_fve_callback(PDEVICE_OBJECT devobj, PFILE_OBJECT fileobj, + PUNICODE_STRING devpath) { + NTSTATUS Status; + KIRQL irql; + LIST_ENTRY* le; + + fve_data* d = ExAllocatePoolWithTag(NonPagedPool, offsetof(fve_data, buf) + devpath->Length, ALLOC_TAG); + if (!d) { + ERR("out of memory\n"); + return; + } + + d->devpath.Buffer = d->buf; + d->devpath.Length = d->devpath.MaximumLength = devpath->Length; + RtlCopyMemory(d->devpath.Buffer, devpath->Buffer, devpath->Length); + + KeAcquireSpinLock(&fve_data_lock, &irql); + + le = fve_data_list.Flink; + while (le != &fve_data_list) { + fve_data* d2 = CONTAINING_RECORD(le, fve_data, list_entry); + + if (d2->devobj == devobj) { + KeReleaseSpinLock(&fve_data_lock, irql); + ExFreePool(d); + return; + } + + le = le->Flink; + } + + KeReleaseSpinLock(&fve_data_lock, irql); + + Status = IoRegisterPlugPlayNotification(EventCategoryTargetDeviceChange, 0, fileobj, drvobj, event_notification, + devobj, &d->notification_entry); + if (!NT_SUCCESS(Status)) { + ERR("IoRegisterPlugPlayNotification returned %08lx\n", Status); + return; + } + + KeAcquireSpinLock(&fve_data_lock, &irql); + + le = fve_data_list.Flink; + while (le != &fve_data_list) { + fve_data* d2 = CONTAINING_RECORD(le, fve_data, list_entry); + + if (d2->devobj == devobj) { + KeReleaseSpinLock(&fve_data_lock, irql); + IoUnregisterPlugPlayNotification(d->notification_entry); + ExFreePool(d); + return; + } + + le = le->Flink; + } + + d->devobj = devobj; + InsertTailList(&fve_data_list, &d->list_entry); + + KeReleaseSpinLock(&fve_data_lock, irql); +} + +static bool test_vol(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, + PUNICODE_STRING devpath, DWORD disk_num, DWORD part_num, uint64_t length, + bool fve_callback) { NTSTATUS Status; ULONG toread; uint8_t* data = NULL; uint32_t sector_size; + bool ret = true; TRACE("%.*S\n", (int)(devpath->Length / sizeof(WCHAR)), devpath->Buffer); @@ -195,11 +390,18 @@ static void test_vol(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, add_volume_device(sb, devpath, length, disk_num, part_num); } } + } else if (Status == STATUS_FVE_LOCKED_VOLUME) { + if (fve_callback) + ret = false; + else + register_fve_callback(DeviceObject, FileObject, devpath); } deref: if (data) ExFreePool(data); + + return ret; } NTSTATUS remove_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath) { @@ -255,7 +457,7 @@ NTSTATUS remove_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath) { return Status; } -void disk_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { +void disk_arrival(PUNICODE_STRING devpath) { PFILE_OBJECT fileobj; PDEVICE_OBJECT devobj; NTSTATUS Status; @@ -265,8 +467,6 @@ void disk_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { IO_STATUS_BLOCK iosb; GET_LENGTH_INFORMATION gli; - UNUSED(DriverObject); - ExAcquireResourceSharedLite(&boot_lock, TRUE); Status = IoGetDeviceObjectPointer(devpath, FILE_READ_ATTRIBUTES, &fileobj, &devobj); @@ -319,7 +519,8 @@ void disk_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { } else TRACE("DeviceType = %lu, DeviceNumber = %lu, PartitionNumber = %lu\n", sdn.DeviceType, sdn.DeviceNumber, sdn.PartitionNumber); - test_vol(devobj, fileobj, devpath, sdn.DeviceNumber, sdn.PartitionNumber, gli.Length.QuadPart); + test_vol(devobj, fileobj, devpath, sdn.DeviceNumber, sdn.PartitionNumber, + gli.Length.QuadPart, false); end: ObDereferenceObject(fileobj); @@ -489,12 +690,13 @@ void remove_volume_child(_Inout_ _Requires_exclusive_lock_held_(_Curr_->child_lo ExReleaseResourceLite(&pdode->child_lock); } -void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { +bool volume_arrival(PUNICODE_STRING devpath, bool fve_callback) { STORAGE_DEVICE_NUMBER sdn; PFILE_OBJECT fileobj; PDEVICE_OBJECT devobj; GET_LENGTH_INFORMATION gli; NTSTATUS Status; + bool ret = true; TRACE("%.*S\n", (int)(devpath->Length / sizeof(WCHAR)), devpath->Buffer); @@ -504,12 +706,12 @@ void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { if (!NT_SUCCESS(Status)) { ExReleaseResourceLite(&boot_lock); ERR("IoGetDeviceObjectPointer returned %08lx\n", Status); - return; + return false; } // make sure we're not processing devices we've created ourselves - if (devobj->DriverObject == DriverObject) + if (devobj->DriverObject == drvobj) goto end; Status = dev_ioctl(devobj, IOCTL_VOLUME_ONLINE, NULL, 0, NULL, 0, true, NULL); @@ -575,22 +777,27 @@ void volume_arrival(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { ExReleaseResourceLite(&pdo_list_lock); } - test_vol(devobj, fileobj, devpath, sdn.DeviceNumber, sdn.PartitionNumber, gli.Length.QuadPart); + ret = test_vol(devobj, fileobj, devpath, sdn.DeviceNumber, sdn.PartitionNumber, + gli.Length.QuadPart, fve_callback); end: ObDereferenceObject(fileobj); ExReleaseResourceLite(&boot_lock); + + return ret; } -void volume_removal(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { +static void volume_arrival2(PUNICODE_STRING devpath) { + volume_arrival(devpath, false); +} + +void volume_removal(PUNICODE_STRING devpath) { LIST_ENTRY* le; UNICODE_STRING devpath2; TRACE("%.*S\n", (int)(devpath->Length / sizeof(WCHAR)), devpath->Buffer); - UNUSED(DriverObject); - devpath2 = *devpath; if (devpath->Length > 4 * sizeof(WCHAR) && devpath->Buffer[0] == '\\' && (devpath->Buffer[1] == '\\' || devpath->Buffer[1] == '?') && @@ -643,7 +850,6 @@ void volume_removal(PDRIVER_OBJECT DriverObject, PUNICODE_STRING devpath) { } typedef struct { - PDRIVER_OBJECT DriverObject; UNICODE_STRING name; pnp_callback func; PIO_WORKITEM work_item; @@ -655,7 +861,7 @@ static void __stdcall do_pnp_callback(PDEVICE_OBJECT DeviceObject, PVOID con) { UNUSED(DeviceObject); - context->func(context->DriverObject, &context->name); + context->func(&context->name); if (context->name.Buffer) ExFreePool(context->name.Buffer); @@ -665,7 +871,7 @@ static void __stdcall do_pnp_callback(PDEVICE_OBJECT DeviceObject, PVOID con) { ExFreePool(context); } -static void enqueue_pnp_callback(PDRIVER_OBJECT DriverObject, PUNICODE_STRING name, pnp_callback func) { +static void enqueue_pnp_callback(PUNICODE_STRING name, pnp_callback func) { PIO_WORKITEM work_item; pnp_callback_context* context; @@ -683,8 +889,6 @@ static void enqueue_pnp_callback(PDRIVER_OBJECT DriverObject, PUNICODE_STRING na return; } - context->DriverObject = DriverObject; - if (name->Length > 0) { context->name.Buffer = ExAllocatePoolWithTag(PagedPool, name->Length, ALLOC_TAG); if (!context->name.Buffer) { @@ -710,12 +914,13 @@ static void enqueue_pnp_callback(PDRIVER_OBJECT DriverObject, PUNICODE_STRING na _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE) NTSTATUS __stdcall volume_notification(PVOID NotificationStructure, PVOID Context) { DEVICE_INTERFACE_CHANGE_NOTIFICATION* dicn = (DEVICE_INTERFACE_CHANGE_NOTIFICATION*)NotificationStructure; - PDRIVER_OBJECT DriverObject = (PDRIVER_OBJECT)Context; + + UNUSED(Context); if (RtlCompareMemory(&dicn->Event, &GUID_DEVICE_INTERFACE_ARRIVAL, sizeof(GUID)) == sizeof(GUID)) - enqueue_pnp_callback(DriverObject, dicn->SymbolicLinkName, volume_arrival); + enqueue_pnp_callback(dicn->SymbolicLinkName, volume_arrival2); else if (RtlCompareMemory(&dicn->Event, &GUID_DEVICE_INTERFACE_REMOVAL, sizeof(GUID)) == sizeof(GUID)) - enqueue_pnp_callback(DriverObject, dicn->SymbolicLinkName, volume_removal); + enqueue_pnp_callback(dicn->SymbolicLinkName, volume_removal); return STATUS_SUCCESS; } @@ -723,12 +928,13 @@ NTSTATUS __stdcall volume_notification(PVOID NotificationStructure, PVOID Contex _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE) NTSTATUS __stdcall pnp_notification(PVOID NotificationStructure, PVOID Context) { DEVICE_INTERFACE_CHANGE_NOTIFICATION* dicn = (DEVICE_INTERFACE_CHANGE_NOTIFICATION*)NotificationStructure; - PDRIVER_OBJECT DriverObject = (PDRIVER_OBJECT)Context; + + UNUSED(Context); if (RtlCompareMemory(&dicn->Event, &GUID_DEVICE_INTERFACE_ARRIVAL, sizeof(GUID)) == sizeof(GUID)) - enqueue_pnp_callback(DriverObject, dicn->SymbolicLinkName, disk_arrival); + enqueue_pnp_callback(dicn->SymbolicLinkName, disk_arrival); else if (RtlCompareMemory(&dicn->Event, &GUID_DEVICE_INTERFACE_REMOVAL, sizeof(GUID)) == sizeof(GUID)) - enqueue_pnp_callback(DriverObject, dicn->SymbolicLinkName, volume_removal); + enqueue_pnp_callback(dicn->SymbolicLinkName, volume_removal); return STATUS_SUCCESS; } diff --git a/drivers/filesystems/btrfs/zstd/zstd_lazy.c b/drivers/filesystems/btrfs/zstd/zstd_lazy.c index 4cf5c88b532..abe51cb2e90 100644 --- a/drivers/filesystems/btrfs/zstd/zstd_lazy.c +++ b/drivers/filesystems/btrfs/zstd/zstd_lazy.c @@ -621,7 +621,7 @@ FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_extDict_selectMLS ( *********************************/ typedef enum { search_hashChain, search_binaryTree } searchMethod_e; -FORCE_INLINE_TEMPLATE size_t +size_t ZSTD_compressBlock_lazy_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
2 years, 7 months
1
0
0
0
[reactos] 07/10: [PSDK][BOOTMGR] Import NTSTATUS definitions of BitLocker (#4417)
by Vincent Franchomme
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=08d100989248ca30eabfa…
commit 08d100989248ca30eabfa315a1443465d7b906f7 Author: Vincent Franchomme <franchomme.vincent(a)gmail.com> AuthorDate: Thu Apr 28 21:36:34 2022 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue May 3 17:30:11 2022 +0200 [PSDK][BOOTMGR] Import NTSTATUS definitions of BitLocker (#4417) --- boot/environ/app/bootmgr/bootmgr.c | 4 ++-- sdk/include/psdk/ntstatus.h | 44 +++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/boot/environ/app/bootmgr/bootmgr.c b/boot/environ/app/bootmgr/bootmgr.c index 1e874cd3a8c..c811a2723c6 100644 --- a/boot/environ/app/bootmgr/bootmgr.c +++ b/boot/environ/app/bootmgr/bootmgr.c @@ -432,7 +432,7 @@ BmpFatalErrorMessageFilter ( *ErrorResourceId = 9019; Result = 2; break; - case 0xC0210000: + case STATUS_FVE_LOCKED_VOLUME: *ErrorResourceId = 9013; break; } @@ -2319,7 +2319,7 @@ BmpTransferExecution ( } /* STATUS_FVE_LOCKED_VOLUME -- bitlocker volume is locked */ - if (Status == 0xC0210000) + if (Status == STATUS_FVE_LOCKED_VOLUME) { /* Launch recovery mode */ *LaunchCode = 4; diff --git a/sdk/include/psdk/ntstatus.h b/sdk/include/psdk/ntstatus.h index bc18d575f7b..6f078ba9a5e 100644 --- a/sdk/include/psdk/ntstatus.h +++ b/sdk/include/psdk/ntstatus.h @@ -1419,7 +1419,6 @@ extern "C" { #define STATUS_SXS_FILE_HASH_MISSING ((NTSTATUS) 0xC0150027) - #define STATUS_FLT_NO_HANDLER_DEFINED ((NTSTATUS)0xC01C0001L) #define STATUS_FLT_CONTEXT_ALREADY_DEFINED ((NTSTATUS)0xC01C0002L) #define STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST ((NTSTATUS)0xC01C0003L) @@ -1452,6 +1451,49 @@ extern "C" { #define STATUS_FLT_REGISTRATION_BUSY ((NTSTATUS)0xC01C0023L) +#define STATUS_FVE_LOCKED_VOLUME ((NTSTATUS)0xC0210000) +#define STATUS_FVE_NOT_ENCRYPTED ((NTSTATUS)0xC0210001) +#define STATUS_FVE_BAD_INFORMATION ((NTSTATUS)0xC0210002) +#define STATUS_FVE_TOO_SMALL ((NTSTATUS)0xC0210003) +#define STATUS_FVE_FAILED_WRONG_FS ((NTSTATUS)0xC0210004) +#define STATUS_FVE_FAILED_BAD_FS ((NTSTATUS)0xC0210005) +#define STATUS_FVE_FS_NOT_EXTENDED ((NTSTATUS)0xC0210006) +#define STATUS_FVE_FS_MOUNTED ((NTSTATUS)0xC0210007) +#define STATUS_FVE_NO_LICENSE ((NTSTATUS)0xC0210008) +#define STATUS_FVE_ACTION_NOT_ALLOWED ((NTSTATUS)0xC0210009) +#define STATUS_FVE_BAD_DATA ((NTSTATUS)0xC021000A) +#define STATUS_FVE_VOLUME_NOT_BOUND ((NTSTATUS)0xC021000B) +#define STATUS_FVE_NOT_DATA_VOLUME ((NTSTATUS)0xC021000C) +#define STATUS_FVE_CONV_READ_ERROR ((NTSTATUS)0xC021000D) +#define STATUS_FVE_CONV_WRITE_ERROR ((NTSTATUS)0xC021000E) +#define STATUS_FVE_OVERLAPPED_UPDATE ((NTSTATUS)0xC021000F) +#define STATUS_FVE_FAILED_SECTOR_SIZE ((NTSTATUS)0xC0210010) +#define STATUS_FVE_FAILED_AUTHENTICATION ((NTSTATUS)0xC0210011) +#define STATUS_FVE_NOT_OS_VOLUME ((NTSTATUS)0xC0210012) +#define STATUS_FVE_KEYFILE_NOT_FOUND ((NTSTATUS)0xC0210013) +#define STATUS_FVE_KEYFILE_INVALID ((NTSTATUS)0xC0210014) +#define STATUS_FVE_KEYFILE_NO_VMK ((NTSTATUS)0xC0210015) +#define STATUS_FVE_TPM_DISABLED ((NTSTATUS)0xC0210016) +#define STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO ((NTSTATUS)0xC0210017) +#define STATUS_FVE_TPM_INVALID_PCR ((NTSTATUS)0xC0210018) +#define STATUS_FVE_TPM_NO_VMK ((NTSTATUS)0xC0210019) +#define STATUS_FVE_PIN_INVALID ((NTSTATUS)0xC021001A) +#define STATUS_FVE_AUTH_INVALID_APPLICATION ((NTSTATUS)0xC021001B) +#define STATUS_FVE_AUTH_INVALID_CONFIG ((NTSTATUS)0xC021001C) +#define STATUS_FVE_DEBUGGER_ENABLED ((NTSTATUS)0xC021001D) +#define STATUS_FVE_DRY_RUN_FAILED ((NTSTATUS)0xC021001E) +#define STATUS_FVE_BAD_METADATA_POINTER ((NTSTATUS)0xC021001F) +#define STATUS_FVE_OLD_METADATA_COPY ((NTSTATUS)0xC0210020) +#define STATUS_FVE_REBOOT_REQUIRED ((NTSTATUS)0xC0210021) +#define STATUS_FVE_RAW_ACCESS ((NTSTATUS)0xC0210022) +#define STATUS_FVE_RAW_BLOCKED ((NTSTATUS)0xC0210023) +#define STATUS_FVE_NO_FEATURE_LICENSE ((NTSTATUS)0xC0210026) +#define STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED ((NTSTATUS)0xC0210027) +#define STATUS_FVE_CONV_RECOVERY_FAILED ((NTSTATUS)0xC0210028) +#define STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG ((NTSTATUS)0xC0210029) +#define STATUS_FVE_VOLUME_TOO_SMALL ((NTSTATUS)0xC0210030) + + #endif /* WIN32_NO_STATUS */ #ifdef __cplusplus
2 years, 7 months
1
0
0
0
[reactos] 06/10: [BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.7.8 (#4417)
by Vincent Franchomme
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3cfd8ab775d8e3028b365…
commit 3cfd8ab775d8e3028b3657907ff27485f7af222c Author: Vincent Franchomme <franchomme.vincent(a)gmail.com> AuthorDate: Thu Apr 28 21:35:40 2022 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue May 3 17:30:11 2022 +0200 [BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.7.8 (#4417) v1.7.8.1 (2021-06-13): - Fixed bug preventing new directories from appearing in listings - Fixed Release version of driver still not working on XP v1.7.8 (2021-06-09): - ~~Upgraded zstd to version 1.5.0~~ Not in ReactOS as it introduces deprecated code - Fixed regression stopping driver from working under XP - Fixed compilation on clang - Fixed corruption issue when Linux mount option inode_cache had been used - Fixed recursion issue involving virtual directory \$Root --- dll/shellext/shellbtrfs/iconoverlay.cpp | 6 +++--- dll/shellext/shellbtrfs/iconoverlay.h | 6 +++--- dll/shellext/shellbtrfs/main.cpp | 10 +++++----- dll/shellext/shellbtrfs/propsheet.cpp | 6 +++--- dll/shellext/shellbtrfs/recv.cpp | 18 +++++++++++++++++ dll/shellext/shellbtrfs/shellbtrfs.rc | 8 ++++---- dll/shellext/shellbtrfs/shellext.h | 10 +++++----- dll/shellext/shellbtrfs/volpropsheet.cpp | 2 +- dll/win32/ubtrfs/ubtrfs.rc | 8 ++++---- drivers/filesystems/btrfs/balance.c | 4 ---- drivers/filesystems/btrfs/btrfs.c | 4 ++-- drivers/filesystems/btrfs/btrfs.h | 1 + drivers/filesystems/btrfs/btrfs.inf | 2 +- drivers/filesystems/btrfs/btrfs.rc | 8 ++++---- drivers/filesystems/btrfs/btrfs_drv.h | 6 +++--- drivers/filesystems/btrfs/dirctrl.c | 7 +++++++ drivers/filesystems/btrfs/flushthread.c | 4 ---- drivers/filesystems/btrfs/fsctl.c | 34 ++++++++++++++------------------ sdk/lib/fslib/btrfslib/btrfslib.c | 2 -- 19 files changed, 79 insertions(+), 67 deletions(-) diff --git a/dll/shellext/shellbtrfs/iconoverlay.cpp b/dll/shellext/shellbtrfs/iconoverlay.cpp index 6cfbe4b6492..1c14c2c322b 100644 --- a/dll/shellext/shellbtrfs/iconoverlay.cpp +++ b/dll/shellext/shellbtrfs/iconoverlay.cpp @@ -43,7 +43,7 @@ HRESULT __stdcall BtrfsIconOverlay::QueryInterface(REFIID riid, void **ppObj) { return E_NOINTERFACE; } -HRESULT __stdcall BtrfsIconOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags) { +HRESULT __stdcall BtrfsIconOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags) noexcept { if (GetModuleFileNameW(module, pwszIconFile, cchMax) == 0) return E_FAIL; @@ -62,7 +62,7 @@ HRESULT __stdcall BtrfsIconOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMa return S_OK; } -HRESULT __stdcall BtrfsIconOverlay::GetPriority(int *pPriority) { +HRESULT __stdcall BtrfsIconOverlay::GetPriority(int *pPriority) noexcept { if (!pPriority) return E_INVALIDARG; @@ -71,7 +71,7 @@ HRESULT __stdcall BtrfsIconOverlay::GetPriority(int *pPriority) { return S_OK; } -HRESULT __stdcall BtrfsIconOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib) { +HRESULT __stdcall BtrfsIconOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib) noexcept { win_handle h; NTSTATUS Status; IO_STATUS_BLOCK iosb; diff --git a/dll/shellext/shellbtrfs/iconoverlay.h b/dll/shellext/shellbtrfs/iconoverlay.h index 24276ddcb9c..4defcbd1d60 100644 --- a/dll/shellext/shellbtrfs/iconoverlay.h +++ b/dll/shellext/shellbtrfs/iconoverlay.h @@ -51,9 +51,9 @@ public: // IShellIconOverlayIdentifier - virtual HRESULT __stdcall GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags); - virtual HRESULT __stdcall GetPriority(int *pPriority); - virtual HRESULT __stdcall IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib); + virtual HRESULT __stdcall GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags) noexcept; + virtual HRESULT __stdcall GetPriority(int *pPriority) noexcept; + virtual HRESULT __stdcall IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib) noexcept; private: LONG refcount; diff --git a/dll/shellext/shellbtrfs/main.cpp b/dll/shellext/shellbtrfs/main.cpp index 55b4121a090..d19db443165 100644 --- a/dll/shellext/shellbtrfs/main.cpp +++ b/dll/shellext/shellbtrfs/main.cpp @@ -243,11 +243,11 @@ void wstring_sprintf(wstring& s, wstring fmt, ...) { #pragma warning(pop) #endif -extern "C" STDAPI DllCanUnloadNow(void) { +STDAPI DllCanUnloadNow(void) { return objs_loaded == 0 ? S_OK : S_FALSE; } -extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { if (rclsid == CLSID_ShellBtrfsIconHandler) { Factory* fact = new Factory; if (!fact) @@ -497,7 +497,7 @@ static void unreg_prop_sheet_handler(const wstring& filetype, const wstring& nam #endif } -extern "C" STDAPI DllRegisterServer(void) { +STDAPI DllRegisterServer(void) { try { register_clsid(CLSID_ShellBtrfsIconHandler, COM_DESCRIPTION_ICON_HANDLER); register_clsid(CLSID_ShellBtrfsContextMenu, COM_DESCRIPTION_CONTEXT_MENU); @@ -520,7 +520,7 @@ extern "C" STDAPI DllRegisterServer(void) { return S_OK; } -extern "C" STDAPI DllUnregisterServer(void) { +STDAPI DllUnregisterServer(void) { try { unreg_prop_sheet_handler(L"Folder", ICON_OVERLAY_NAME); unreg_prop_sheet_handler(L"*", ICON_OVERLAY_NAME); @@ -541,7 +541,7 @@ extern "C" STDAPI DllUnregisterServer(void) { return S_OK; } -extern "C" STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) { +STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) { if (bInstall) return DllRegisterServer(); else diff --git a/dll/shellext/shellbtrfs/propsheet.cpp b/dll/shellext/shellbtrfs/propsheet.cpp index faa7194e664..f31ce2eb85f 100644 --- a/dll/shellext/shellbtrfs/propsheet.cpp +++ b/dll/shellext/shellbtrfs/propsheet.cpp @@ -336,7 +336,7 @@ HRESULT BtrfsPropSheet::load_file_list() { totalsize = allocsize = sparsesize = 0; for (i = 0; i < num_files; i++) { - if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) { + if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(WCHAR))) { HRESULT hr; hr = check_file(fn, i, num_files, &sv); @@ -704,7 +704,7 @@ void BtrfsPropSheet::apply_changes(HWND hDlg) { num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, nullptr, 0); for (i = 0; i < num_files; i++) { - if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) { + if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(WCHAR))) { apply_changes_file(hDlg, fn); } } @@ -882,7 +882,7 @@ void BtrfsPropSheet::open_as_admin(HWND hwndDlg) { GetModuleFileNameW(module, modfn, sizeof(modfn) / sizeof(WCHAR)); for (i = 0; i < num_files; i++) { - if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) { + if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(WCHAR))) { wstring t; SHELLEXECUTEINFOW sei; diff --git a/dll/shellext/shellbtrfs/recv.cpp b/dll/shellext/shellbtrfs/recv.cpp index 0dc3bf859bb..673df5c42fb 100644 --- a/dll/shellext/shellbtrfs/recv.cpp +++ b/dll/shellext/shellbtrfs/recv.cpp @@ -1563,6 +1563,11 @@ extern "C" void CALLBACK RecvSubvolGUIW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszC tp->PrivilegeCount = 3; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warray-bounds" +#endif // __clang__ + if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid)) { free(tp); throw last_error(GetLastError()); @@ -1592,6 +1597,10 @@ extern "C" void CALLBACK RecvSubvolGUIW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszC throw last_error(GetLastError()); } +#ifdef __clang__ + #pragma clang diagnostic pop +#endif // __clang__ + file[0] = 0; memset(&ofn, 0, sizeof(OPENFILENAMEW)); @@ -1636,6 +1645,11 @@ extern "C" void CALLBACK RecvSubvolW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdL tp->PrivilegeCount = 3; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warray-bounds" +#endif // __clang__ + if (!LookupPrivilegeValueW(nullptr, L"SeManageVolumePrivilege", &luid)) { free(tp); return; @@ -1660,6 +1674,10 @@ extern "C" void CALLBACK RecvSubvolW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdL tp->Privileges[2].Luid = luid; tp->Privileges[2].Attributes = SE_PRIVILEGE_ENABLED; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // __clang__ + if (!AdjustTokenPrivileges(token, false, tp, tplen, nullptr, nullptr)) { free(tp); return; diff --git a/dll/shellext/shellbtrfs/shellbtrfs.rc b/dll/shellext/shellbtrfs/shellbtrfs.rc index 26d3d6aa67e..acf070e40f9 100644 --- a/dll/shellext/shellbtrfs/shellbtrfs.rc +++ b/dll/shellext/shellbtrfs/shellbtrfs.rc @@ -61,8 +61,8 @@ IDI_ICON1 ICON "subvol.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,7,0 - PRODUCTVERSION 1,7,7,0 + FILEVERSION 1,7,8,0 + PRODUCTVERSION 1,7,8,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -78,12 +78,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs shell extension" - VALUE "FileVersion", "1.7.7" + VALUE "FileVersion", "1.7.8" VALUE "InternalName", "btrfs" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "OriginalFilename", "shellbtrfs.dll" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.7" + VALUE "ProductVersion", "1.7.8" END END BLOCK "VarFileInfo" diff --git a/dll/shellext/shellbtrfs/shellext.h b/dll/shellext/shellbtrfs/shellext.h index cfa09779213..ed85136f901 100644 --- a/dll/shellext/shellbtrfs/shellext.h +++ b/dll/shellext/shellbtrfs/shellext.h @@ -104,10 +104,6 @@ using namespace std; extern "C" { #endif #ifndef __REACTOS__ -NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, - PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, - PVOID OutputBuffer, ULONG OutputBufferLength); - NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key); @@ -115,11 +111,15 @@ NTSTATUS WINAPI NtSetEaFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, P NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor); +#ifdef _MSC_VER +NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, + PVOID OutputBuffer, ULONG OutputBufferLength); + NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass); NTSTATUS NTAPI NtSetInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass); -#ifdef _MSC_VER #define FileBasicInformation (FILE_INFORMATION_CLASS)4 #define FileStandardInformation (FILE_INFORMATION_CLASS)5 #define FileDispositionInformation (FILE_INFORMATION_CLASS)13 diff --git a/dll/shellext/shellbtrfs/volpropsheet.cpp b/dll/shellext/shellbtrfs/volpropsheet.cpp index a2f50fac2aa..c79bf8b7d30 100644 --- a/dll/shellext/shellbtrfs/volpropsheet.cpp +++ b/dll/shellext/shellbtrfs/volpropsheet.cpp @@ -97,7 +97,7 @@ HRESULT __stdcall BtrfsVolPropSheet::Initialize(PCIDLIST_ABSOLUTE pidlFolder, ID return E_FAIL; } - if (DragQueryFileW((HDROP)stgm.hGlobal, 0, fnbuf, sizeof(fnbuf) / sizeof(MAX_PATH))) { + if (DragQueryFileW((HDROP)stgm.hGlobal, 0, fnbuf, sizeof(fnbuf) / sizeof(WCHAR))) { fn = fnbuf; win_handle h = CreateFileW(fn.c_str(), FILE_TRAVERSE | FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, diff --git a/dll/win32/ubtrfs/ubtrfs.rc b/dll/win32/ubtrfs/ubtrfs.rc index c12381e9f56..2b17773476b 100644 --- a/dll/win32/ubtrfs/ubtrfs.rc +++ b/dll/win32/ubtrfs/ubtrfs.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,7,0 - PRODUCTVERSION 1,7,7,0 + FILEVERSION 1,7,8,0 + PRODUCTVERSION 1,7,8,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "Btrfs utility DLL" - VALUE "FileVersion", "1.7.7" + VALUE "FileVersion", "1.7.8" VALUE "InternalName", "ubtrfs" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "OriginalFilename", "ubtrfs.dll" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.7" + VALUE "ProductVersion", "1.7.8" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/balance.c b/drivers/filesystems/btrfs/balance.c index 6f2b5e55091..143151d001a 100644 --- a/drivers/filesystems/btrfs/balance.c +++ b/drivers/filesystems/btrfs/balance.c @@ -68,10 +68,6 @@ typedef struct { LIST_ENTRY list_entry; } data_reloc_ref; -#ifndef _MSC_VER // not in mingw yet -#define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000 -#endif - #define BALANCE_UNIT 0x100000 // only read 1 MB at a time static NTSTATUS add_metadata_reloc(_Requires_exclusive_lock_held_(_Curr_->tree_lock) device_extension* Vcb, LIST_ENTRY* items, traverse_ptr* tp, diff --git a/drivers/filesystems/btrfs/btrfs.c b/drivers/filesystems/btrfs/btrfs.c index 6c821f12534..efd80d94357 100644 --- a/drivers/filesystems/btrfs/btrfs.c +++ b/drivers/filesystems/btrfs/btrfs.c @@ -397,7 +397,7 @@ static bool get_last_inode(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock return false; } - if (tp.item->key.obj_type == TYPE_INODE_ITEM || (tp.item->key.obj_type == TYPE_ROOT_ITEM && !(tp.item->key.obj_id & 0x8000000000000000))) { + if ((tp.item->key.obj_type == TYPE_INODE_ITEM || tp.item->key.obj_type == TYPE_ROOT_ITEM) && tp.item->key.obj_id <= BTRFS_LAST_FREE_OBJECTID) { r->lastinode = tp.item->key.obj_id; TRACE("last inode for tree %I64x is %I64x\n", r->id, r->lastinode); return true; @@ -408,7 +408,7 @@ static bool get_last_inode(_In_ _Requires_exclusive_lock_held_(_Curr_->tree_lock TRACE("moving on to %I64x,%x,%I64x\n", tp.item->key.obj_id, tp.item->key.obj_type, tp.item->key.offset); - if (tp.item->key.obj_type == TYPE_INODE_ITEM || (tp.item->key.obj_type == TYPE_ROOT_ITEM && !(tp.item->key.obj_id & 0x8000000000000000))) { + if ((tp.item->key.obj_type == TYPE_INODE_ITEM || tp.item->key.obj_type == TYPE_ROOT_ITEM) && tp.item->key.obj_id <= BTRFS_LAST_FREE_OBJECTID) { r->lastinode = tp.item->key.obj_id; TRACE("last inode for tree %I64x is %I64x\n", r->id, r->lastinode); return true; diff --git a/drivers/filesystems/btrfs/btrfs.h b/drivers/filesystems/btrfs/btrfs.h index 6ff680234df..b0b7fbd0015 100644 --- a/drivers/filesystems/btrfs/btrfs.h +++ b/drivers/filesystems/btrfs/btrfs.h @@ -15,6 +15,7 @@ static const uint64_t superblock_addrs[] = { 0x10000, 0x4000000, 0x4000000000, 0 #define BTRFS_MAGIC 0x4d5f53665248425f #define MAX_LABEL_SIZE 0x100 #define SUBVOL_ROOT_INODE 0x100 +#define BTRFS_LAST_FREE_OBJECTID 0xffffffffffffff00 #define TYPE_INODE_ITEM 0x01 #define TYPE_INODE_REF 0x0C diff --git a/drivers/filesystems/btrfs/btrfs.inf b/drivers/filesystems/btrfs/btrfs.inf index e0f6148cdae..b5fa3da9136 100644 --- a/drivers/filesystems/btrfs/btrfs.inf +++ b/drivers/filesystems/btrfs/btrfs.inf @@ -10,7 +10,7 @@ Signature = "$Windows NT$" Class = Volume ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f} Provider = %Me% -DriverVer = 04/12/2021,1.7.7.0 +DriverVer = 06/07/2021,1.7.8.0 CatalogFile = btrfs.cat [DestinationDirs] diff --git a/drivers/filesystems/btrfs/btrfs.rc b/drivers/filesystems/btrfs/btrfs.rc index b4358b2419d..72a541c3f69 100644 --- a/drivers/filesystems/btrfs/btrfs.rc +++ b/drivers/filesystems/btrfs/btrfs.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,7,0 - PRODUCTVERSION 1,7,7,0 + FILEVERSION 1,7,8,0 + PRODUCTVERSION 1,7,8,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs" - VALUE "FileVersion", "1.7.7" + VALUE "FileVersion", "1.7.8" VALUE "InternalName", "btrfs" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "OriginalFilename", "btrfs.sys" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.7.7" + VALUE "ProductVersion", "1.7.8" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/btrfs_drv.h b/drivers/filesystems/btrfs/btrfs_drv.h index 106332d77c4..597e5d62794 100644 --- a/drivers/filesystems/btrfs/btrfs_drv.h +++ b/drivers/filesystems/btrfs/btrfs_drv.h @@ -126,7 +126,7 @@ C_ASSERT(sizeof(bool) == 1); #define BTRFS_VOLUME_PREFIX L"\\Device\\Btrfs{" -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__clang__) #define try __try #define except __except #define finally __finally @@ -1633,7 +1633,7 @@ extern BTRFS_UUID boot_uuid; // not in mingw yet #ifndef _MSC_VER typedef struct { - FSRTL_COMMON_FCB_HEADER DUMMYSTRUCTNAME; + FSRTL_COMMON_FCB_HEADER Header; PFAST_MUTEX FastMutex; LIST_ENTRY FilterContexts; EX_PUSH_LOCK PushLock; @@ -1652,7 +1652,7 @@ typedef struct { #endif #else typedef struct { - FSRTL_COMMON_FCB_HEADER DUMMYSTRUCTNAME; + FSRTL_COMMON_FCB_HEADER Header; PFAST_MUTEX FastMutex; LIST_ENTRY FilterContexts; EX_PUSH_LOCK PushLock; diff --git a/drivers/filesystems/btrfs/dirctrl.c b/drivers/filesystems/btrfs/dirctrl.c index a7f7f0c0953..6b7b66cba4f 100644 --- a/drivers/filesystems/btrfs/dirctrl.c +++ b/drivers/filesystems/btrfs/dirctrl.c @@ -727,6 +727,13 @@ next: if (!dc) return STATUS_NO_MORE_FILES; + if (dc->root_dir && fileref->parent) { // hide $Root dir unless in apparent root, to avoid recursion + if (dc->list_entry_index.Flink == &fileref->fcb->dir_children_index) + return STATUS_NO_MORE_FILES; + + dc = CONTAINING_RECORD(dc->list_entry_index.Flink, dir_child, list_entry_index); + } + de->key = dc->key; de->name = dc->name; de->type = dc->type; diff --git a/drivers/filesystems/btrfs/flushthread.c b/drivers/filesystems/btrfs/flushthread.c index e6354b36822..565f400c4b5 100644 --- a/drivers/filesystems/btrfs/flushthread.c +++ b/drivers/filesystems/btrfs/flushthread.c @@ -46,10 +46,6 @@ typedef struct { static NTSTATUS create_chunk(device_extension* Vcb, chunk* c, PIRP Irp); static NTSTATUS update_tree_extents(device_extension* Vcb, tree* t, PIRP Irp, LIST_ENTRY* rollback); -#ifndef _MSC_VER // not in mingw yet -#define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000 -#endif - _Function_class_(IO_COMPLETION_ROUTINE) static NTSTATUS __stdcall write_completion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID conptr) { write_context* context = conptr; diff --git a/drivers/filesystems/btrfs/fsctl.c b/drivers/filesystems/btrfs/fsctl.c index 8ad58df883f..310816c272f 100644 --- a/drivers/filesystems/btrfs/fsctl.c +++ b/drivers/filesystems/btrfs/fsctl.c @@ -36,10 +36,6 @@ #define SEF_AVOID_PRIVILEGE_CHECK 0x08 // on MSDN but not in any header files(?) -#ifndef _MSC_VER // not in mingw yet -#define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000 -#endif - #define SEF_SACL_AUTO_INHERIT 0x02 extern LIST_ENTRY VcbList; @@ -5030,7 +5026,7 @@ static NTSTATUS get_retrieval_pointers(device_extension* Vcb, PFILE_OBJECT FileO ExAcquireResourceSharedLite(fcb->Header.Resource, true); - try { + _SEH2_TRY { LIST_ENTRY* le = fcb->extents.Flink; extent* first_ext = NULL; unsigned int num_extents = 0, first_extent_num = 0, i; @@ -5067,7 +5063,7 @@ static NTSTATUS get_retrieval_pointers(device_extension* Vcb, PFILE_OBJECT FileO if (!first_ext) { Status = STATUS_END_OF_FILE; - leave; + _SEH2_LEAVE; } out->ExtentCount = num_extents - first_extent_num; @@ -5090,7 +5086,7 @@ static NTSTATUS get_retrieval_pointers(device_extension* Vcb, PFILE_OBJECT FileO if (ext->offset > last_off) { if (outlen < sizeof(LARGE_INTEGER) + sizeof(LARGE_INTEGER)) { Status = STATUS_BUFFER_OVERFLOW; - leave; + _SEH2_LEAVE; } out->Extents[i].NextVcn.QuadPart = ext->offset >> Vcb->sector_shift; @@ -5103,7 +5099,7 @@ static NTSTATUS get_retrieval_pointers(device_extension* Vcb, PFILE_OBJECT FileO if (outlen < sizeof(LARGE_INTEGER) + sizeof(LARGE_INTEGER)) { Status = STATUS_BUFFER_OVERFLOW; - leave; + _SEH2_LEAVE; } out->Extents[i].NextVcn.QuadPart = (ext->offset + ext->extent_data.decoded_size) >> Vcb->sector_shift; @@ -5125,7 +5121,7 @@ static NTSTATUS get_retrieval_pointers(device_extension* Vcb, PFILE_OBJECT FileO if (num_sectors << Vcb->sector_shift > last_off) { if (outlen < sizeof(LARGE_INTEGER) + sizeof(LARGE_INTEGER)) { Status = STATUS_BUFFER_OVERFLOW; - leave; + _SEH2_LEAVE; } out->Extents[i].NextVcn.QuadPart = num_sectors; @@ -5136,9 +5132,9 @@ static NTSTATUS get_retrieval_pointers(device_extension* Vcb, PFILE_OBJECT FileO } Status = STATUS_SUCCESS; - } finally { + } _SEH2_FINALLY { ExReleaseResourceLite(fcb->Header.Resource); - } + } _SEH2_END; return Status; } @@ -5235,7 +5231,7 @@ static NTSTATUS get_csum_info(device_extension* Vcb, PFILE_OBJECT FileObject, bt ExAcquireResourceSharedLite(fcb->Header.Resource, true); - try { + _SEH2_TRY { LIST_ENTRY* le; uint8_t* ptr; uint64_t last_off; @@ -5244,17 +5240,17 @@ static NTSTATUS get_csum_info(device_extension* Vcb, PFILE_OBJECT FileObject, bt if (fcb->ads) { Status = STATUS_INVALID_DEVICE_REQUEST; - leave; + _SEH2_LEAVE; } if (fcb->type == BTRFS_TYPE_DIRECTORY) { Status = STATUS_FILE_IS_A_DIRECTORY; - leave; + _SEH2_LEAVE; } if (fcb->inode_item.flags & BTRFS_INODE_NODATASUM) { Status = STATUS_INVALID_DEVICE_REQUEST; - leave; + _SEH2_LEAVE; } buf->csum_type = Vcb->superblock.csum_type; @@ -5273,7 +5269,7 @@ static NTSTATUS get_csum_info(device_extension* Vcb, PFILE_OBJECT FileObject, bt buf->num_sectors = 0; *retlen = offsetof(btrfs_csum_info, data[0]); Status = STATUS_SUCCESS; - leave; + _SEH2_LEAVE; } le = le->Flink; @@ -5284,7 +5280,7 @@ static NTSTATUS get_csum_info(device_extension* Vcb, PFILE_OBJECT FileObject, bt if (buflen < offsetof(btrfs_csum_info, data[0]) + (buf->csum_length * buf->num_sectors)) { Status = STATUS_BUFFER_OVERFLOW; *retlen = offsetof(btrfs_csum_info, data[0]); - leave; + _SEH2_LEAVE; } ptr = buf->data; @@ -5333,9 +5329,9 @@ static NTSTATUS get_csum_info(device_extension* Vcb, PFILE_OBJECT FileObject, bt *retlen = offsetof(btrfs_csum_info, data[0]) + (buf->csum_length * buf->num_sectors); Status = STATUS_SUCCESS; - } finally { + } _SEH2_FINALLY { ExReleaseResourceLite(fcb->Header.Resource); - } + } _SEH2_END; return Status; } diff --git a/sdk/lib/fslib/btrfslib/btrfslib.c b/sdk/lib/fslib/btrfslib/btrfslib.c index 7c07cdc1d63..695f2f00e8f 100644 --- a/sdk/lib/fslib/btrfslib/btrfslib.c +++ b/sdk/lib/fslib/btrfslib/btrfslib.c @@ -82,8 +82,6 @@ void blake2b(void *out, size_t outlen, const void* in, size_t inlen); #ifdef __cplusplus extern "C" { #endif -NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength); - NTSTATUS NTAPI NtWriteFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key);
2 years, 7 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200