[BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.7.7 (#4417)

v1.7.7 (2021-04-12):

- Fixed deadlock on high load
- Fixed free space issue when installing Genshin Impact
- Fixed issue when copying files with wildcards in command prompt
- Increased speed of directory lookups
This commit is contained in:
Vincent Franchomme 2022-04-28 21:35:05 +02:00 committed by Hermès BÉLUSCA - MAÏTO
parent c982533ea9
commit 98654b54b4
9 changed files with 37 additions and 33 deletions

View file

@ -61,8 +61,8 @@ IDI_ICON1 ICON "subvol.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,6,0 FILEVERSION 1,7,7,0
PRODUCTVERSION 1,7,6,0 PRODUCTVERSION 1,7,7,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -78,12 +78,12 @@ BEGIN
BLOCK "080904b0" BLOCK "080904b0"
BEGIN BEGIN
VALUE "FileDescription", "WinBtrfs shell extension" VALUE "FileDescription", "WinBtrfs shell extension"
VALUE "FileVersion", "1.7.6" VALUE "FileVersion", "1.7.7"
VALUE "InternalName", "btrfs" VALUE "InternalName", "btrfs"
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21"
VALUE "OriginalFilename", "shellbtrfs.dll" VALUE "OriginalFilename", "shellbtrfs.dll"
VALUE "ProductName", "WinBtrfs" VALUE "ProductName", "WinBtrfs"
VALUE "ProductVersion", "1.7.6" VALUE "ProductVersion", "1.7.7"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1476,7 +1476,7 @@ HRESULT __stdcall BtrfsVolPropSheet::ReplacePage(UINT uPageID, LPFNADDPROPSHEETP
void BtrfsChangeDriveLetter::do_change(HWND hwndDlg) { void BtrfsChangeDriveLetter::do_change(HWND hwndDlg) {
unsigned int sel = (unsigned int)SendDlgItemMessageW(hwndDlg, IDC_DRIVE_LETTER_COMBO, CB_GETCURSEL, 0, 0); unsigned int sel = (unsigned int)SendDlgItemMessageW(hwndDlg, IDC_DRIVE_LETTER_COMBO, CB_GETCURSEL, 0, 0);
if (sel >= 0 && sel < letters.size()) { if (sel < letters.size()) {
wstring dd; wstring dd;
if (fn.length() == 3 && fn[1] == L':' && fn[2] == L'\\') { if (fn.length() == 3 && fn[1] == L':' && fn[2] == L'\\') {

View file

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,6,0 FILEVERSION 1,7,7,0
PRODUCTVERSION 1,7,6,0 PRODUCTVERSION 1,7,7,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -68,12 +68,12 @@ BEGIN
BLOCK "080904b0" BLOCK "080904b0"
BEGIN BEGIN
VALUE "FileDescription", "Btrfs utility DLL" VALUE "FileDescription", "Btrfs utility DLL"
VALUE "FileVersion", "1.7.6" VALUE "FileVersion", "1.7.7"
VALUE "InternalName", "ubtrfs" VALUE "InternalName", "ubtrfs"
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21"
VALUE "OriginalFilename", "ubtrfs.dll" VALUE "OriginalFilename", "ubtrfs.dll"
VALUE "ProductName", "WinBtrfs" VALUE "ProductName", "WinBtrfs"
VALUE "ProductVersion", "1.7.6" VALUE "ProductVersion", "1.7.7"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -2,7 +2,7 @@
;;; WinBtrfs ;;; WinBtrfs
;;; ;;;
;;; ;;;
;;; Copyright (c) 2016-20 Mark Harmstone ;;; Copyright (c) 2016-21 Mark Harmstone
;;; ;;;
[Version] [Version]
@ -10,7 +10,7 @@ Signature = "$Windows NT$"
Class = Volume Class = Volume
ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f} ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f}
Provider = %Me% Provider = %Me%
DriverVer = 01/14/2021,1.7.6.0 DriverVer = 04/12/2021,1.7.7.0
CatalogFile = btrfs.cat CatalogFile = btrfs.cat
[DestinationDirs] [DestinationDirs]

View file

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,6,0 FILEVERSION 1,7,7,0
PRODUCTVERSION 1,7,6,0 PRODUCTVERSION 1,7,7,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -68,12 +68,12 @@ BEGIN
BLOCK "080904b0" BLOCK "080904b0"
BEGIN BEGIN
VALUE "FileDescription", "WinBtrfs" VALUE "FileDescription", "WinBtrfs"
VALUE "FileVersion", "1.7.6" VALUE "FileVersion", "1.7.7"
VALUE "InternalName", "btrfs" VALUE "InternalName", "btrfs"
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21" VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-21"
VALUE "OriginalFilename", "btrfs.sys" VALUE "OriginalFilename", "btrfs.sys"
VALUE "ProductName", "WinBtrfs" VALUE "ProductName", "WinBtrfs"
VALUE "ProductVersion", "1.7.6" VALUE "ProductVersion", "1.7.7"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -195,6 +195,10 @@ NTSTATUS find_file_in_dir(PUNICODE_STRING filename, fcb* fcb, root** subvol, uin
} else } else
fnus = *filename; fnus = *filename;
Status = check_file_name_valid(filename, false, false);
if (!NT_SUCCESS(Status))
return Status;
hash = calc_crc32c(0xffffffff, (uint8_t*)fnus.Buffer, fnus.Length); hash = calc_crc32c(0xffffffff, (uint8_t*)fnus.Buffer, fnus.Length);
c = hash >> 24; c = hash >> 24;
@ -1604,6 +1608,9 @@ NTSTATUS open_fileref_child(_Requires_lock_held_(_Curr_->tree_lock) _Requires_ex
TRACE("could not find %.*S\n", (int)(name->Length / sizeof(WCHAR)), name->Buffer); TRACE("could not find %.*S\n", (int)(name->Length / sizeof(WCHAR)), name->Buffer);
return lastpart ? STATUS_OBJECT_NAME_NOT_FOUND : STATUS_OBJECT_PATH_NOT_FOUND; return lastpart ? STATUS_OBJECT_NAME_NOT_FOUND : STATUS_OBJECT_PATH_NOT_FOUND;
} else if (Status == STATUS_OBJECT_NAME_INVALID) {
TRACE("invalid filename: %.*S\n", (int)(name->Length / sizeof(WCHAR)), name->Buffer);
return Status;
} else if (!NT_SUCCESS(Status)) { } else if (!NT_SUCCESS(Status)) {
ERR("find_file_in_dir returned %08lx\n", Status); ERR("find_file_in_dir returned %08lx\n", Status);
return Status; return Status;
@ -1804,7 +1811,7 @@ NTSTATUS open_fileref(_Requires_lock_held_(_Curr_->tree_lock) _Requires_exclusiv
Status = open_fileref_child(Vcb, sf, &nb->us, cs, lastpart, streampart, pooltype, &sf2, Irp); Status = open_fileref_child(Vcb, sf, &nb->us, cs, lastpart, streampart, pooltype, &sf2, Irp);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
if (Status == STATUS_OBJECT_PATH_NOT_FOUND || Status == STATUS_OBJECT_NAME_NOT_FOUND) if (Status == STATUS_OBJECT_PATH_NOT_FOUND || Status == STATUS_OBJECT_NAME_NOT_FOUND || Status == STATUS_OBJECT_NAME_INVALID)
TRACE("open_fileref_child returned %08lx\n", Status); TRACE("open_fileref_child returned %08lx\n", Status);
else else
ERR("open_fileref_child returned %08lx\n", Status); ERR("open_fileref_child returned %08lx\n", Status);
@ -4668,7 +4675,7 @@ loaded:
TRACE("file doesn't exist, returning STATUS_OBJECT_NAME_NOT_FOUND\n"); TRACE("file doesn't exist, returning STATUS_OBJECT_NAME_NOT_FOUND\n");
goto exit; goto exit;
} }
} else if (Status == STATUS_OBJECT_PATH_NOT_FOUND) { } else if (Status == STATUS_OBJECT_PATH_NOT_FOUND || Status == STATUS_OBJECT_NAME_INVALID) {
TRACE("open_fileref returned %08lx\n", Status); TRACE("open_fileref returned %08lx\n", Status);
goto exit; goto exit;
} else { } else {

View file

@ -326,7 +326,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileBothDirectoryInformation\n"); TRACE("FileBothDirectoryInformation\n");
needed = sizeof(FILE_BOTH_DIR_INFORMATION) - sizeof(WCHAR) + de->name.Length; needed = offsetof(FILE_BOTH_DIR_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -366,7 +366,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileDirectoryInformation\n"); TRACE("FileDirectoryInformation\n");
needed = sizeof(FILE_DIRECTORY_INFORMATION) - sizeof(WCHAR) + de->name.Length; needed = offsetof(FILE_DIRECTORY_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -404,7 +404,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileFullDirectoryInformation\n"); TRACE("FileFullDirectoryInformation\n");
needed = sizeof(FILE_FULL_DIR_INFORMATION) - sizeof(WCHAR) + de->name.Length; needed = offsetof(FILE_FULL_DIR_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -443,7 +443,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileIdBothDirectoryInformation\n"); TRACE("FileIdBothDirectoryInformation\n");
needed = sizeof(FILE_ID_BOTH_DIR_INFORMATION) - sizeof(WCHAR) + de->name.Length; needed = offsetof(FILE_ID_BOTH_DIR_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -484,7 +484,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileIdFullDirectoryInformation\n"); TRACE("FileIdFullDirectoryInformation\n");
needed = sizeof(FILE_ID_FULL_DIR_INFORMATION) - sizeof(WCHAR) + de->name.Length; needed = offsetof(FILE_ID_FULL_DIR_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -529,7 +529,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileIdExtdDirectoryInformation\n"); TRACE("FileIdExtdDirectoryInformation\n");
needed = offsetof(FILE_ID_EXTD_DIR_INFORMATION, FileName[0]) + de->name.Length; needed = offsetof(FILE_ID_EXTD_DIR_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -572,7 +572,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileIdExtdBothDirectoryInformation\n"); TRACE("FileIdExtdBothDirectoryInformation\n");
needed = offsetof(FILE_ID_EXTD_BOTH_DIR_INFORMATION, FileName[0]) + de->name.Length; needed = offsetof(FILE_ID_EXTD_BOTH_DIR_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -622,7 +622,7 @@ static NTSTATUS query_dir_item(fcb* fcb, ccb* ccb, void* buf, LONG* len, PIRP Ir
TRACE("FileNamesInformation\n"); TRACE("FileNamesInformation\n");
needed = sizeof(FILE_NAMES_INFORMATION) - sizeof(WCHAR) + de->name.Length; needed = offsetof(FILE_NAMES_INFORMATION, FileName) + de->name.Length;
if (needed > *len) { if (needed > *len) {
TRACE("buffer overflow - %li > %lu\n", needed, *len); TRACE("buffer overflow - %li > %lu\n", needed, *len);
@ -839,7 +839,8 @@ static NTSTATUS query_directory(PIRP Irp) {
if (FsRtlDoesNameContainWildCards(IrpSp->Parameters.QueryDirectory.FileName)) { if (FsRtlDoesNameContainWildCards(IrpSp->Parameters.QueryDirectory.FileName)) {
has_wildcard = true; has_wildcard = true;
specific_file = false; specific_file = false;
} } else if (!initial)
return STATUS_NO_MORE_FILES;
} }
if (ccb->query_string.Buffer) if (ccb->query_string.Buffer)

View file

@ -354,18 +354,11 @@ static BOOLEAN __stdcall fast_io_write(PFILE_OBJECT FileObject, PLARGE_INTEGER F
return false; return false;
} }
if (!ExAcquireResourceExclusiveLite(fcb->Header.Resource, Wait)) {
ExReleaseResourceLite(&fcb->Vcb->tree_lock);
FsRtlExitFileSystem();
return false;
}
ret = FsRtlCopyWrite(FileObject, FileOffset, Length, Wait, LockKey, Buffer, IoStatus, DeviceObject); ret = FsRtlCopyWrite(FileObject, FileOffset, Length, Wait, LockKey, Buffer, IoStatus, DeviceObject);
if (ret) if (ret)
fcb->inode_item.st_size = fcb->Header.FileSize.QuadPart; fcb->inode_item.st_size = fcb->Header.FileSize.QuadPart;
ExReleaseResourceLite(fcb->Header.Resource);
ExReleaseResourceLite(&fcb->Vcb->tree_lock); ExReleaseResourceLite(&fcb->Vcb->tree_lock);
FsRtlExitFileSystem(); FsRtlExitFileSystem();

View file

@ -307,6 +307,9 @@ static NTSTATUS vol_query_device_name(volume_device_extension* vde, PIRP Irp) {
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
PMOUNTDEV_NAME name; PMOUNTDEV_NAME name;
if (IrpSp->FileObject && IrpSp->FileObject->FsContext)
return STATUS_INVALID_PARAMETER;
if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_NAME)) { if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_NAME)) {
Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME); Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME);
return STATUS_BUFFER_TOO_SMALL; return STATUS_BUFFER_TOO_SMALL;