mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 15:22:11 +00:00
[BTRFS][UBTRFS][SHELLBTRFS] Upgrade to 1.7.5 (#4417)
v1.7.5 (2020-10-31): - Fixed text display issue in shell extension - Added support for mingw 8 - Fixed LXSS permissions not working in new versions of Windows - Fixed issue where truncating an inline file wouldn't change its size - Fixed crash with Quibble where driver would try to use AVX2 before Windows had enabled it
This commit is contained in:
parent
0604273535
commit
b826992ab2
15 changed files with 166 additions and 195 deletions
|
@ -42,7 +42,9 @@
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
|
|
||||||
static uint64_t convtypes2[] = { BLOCK_FLAG_SINGLE, BLOCK_FLAG_DUPLICATE, BLOCK_FLAG_RAID0, BLOCK_FLAG_RAID1, BLOCK_FLAG_RAID5, BLOCK_FLAG_RAID6, BLOCK_FLAG_RAID10 };
|
static uint64_t convtypes2[] = { BLOCK_FLAG_SINGLE, BLOCK_FLAG_DUPLICATE, BLOCK_FLAG_RAID0, BLOCK_FLAG_RAID1,
|
||||||
|
BLOCK_FLAG_RAID5, BLOCK_FLAG_RAID1C3, BLOCK_FLAG_RAID6, BLOCK_FLAG_RAID10,
|
||||||
|
BLOCK_FLAG_RAID1C4 };
|
||||||
|
|
||||||
static WCHAR hex_digit(uint8_t u) {
|
static WCHAR hex_digit(uint8_t u) {
|
||||||
if (u >= 0xa && u <= 0xf)
|
if (u >= 0xa && u <= 0xf)
|
||||||
|
@ -245,7 +247,7 @@ void BtrfsBalance::RefreshBalanceDlg(HWND hwndDlg, bool first) {
|
||||||
CheckDlgButton(hwndDlg, IDC_METADATA, BST_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_METADATA, BST_UNCHECKED);
|
||||||
CheckDlgButton(hwndDlg, IDC_SYSTEM, BST_UNCHECKED);
|
CheckDlgButton(hwndDlg, IDC_SYSTEM, BST_UNCHECKED);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_BALANCE_PROGRESS), PBM_SETPOS, 0, 0);
|
SendMessageW(GetDlgItem(hwndDlg, IDC_BALANCE_PROGRESS), PBM_SETPOS, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_DATA_OPTIONS), IsDlgButtonChecked(hwndDlg, IDC_DATA) == BST_CHECKED ? true : false);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DATA_OPTIONS), IsDlgButtonChecked(hwndDlg, IDC_DATA) == BST_CHECKED ? true : false);
|
||||||
|
@ -566,10 +568,10 @@ INT_PTR CALLBACK BtrfsBalance::BalanceOptsDlgProc(HWND hwndDlg, UINT uMsg, WPARA
|
||||||
|
|
||||||
wstring_sprintf(t, u, bd->dev_id, s.c_str());
|
wstring_sprintf(t, u, bd->dev_id, s.c_str());
|
||||||
|
|
||||||
SendMessage(devcb, CB_ADDSTRING, 0, (LPARAM)t.c_str());
|
SendMessageW(devcb, CB_ADDSTRING, 0, (LPARAM)t.c_str());
|
||||||
|
|
||||||
if (opts->devid == bd->dev_id)
|
if (opts->devid == bd->dev_id)
|
||||||
SendMessage(devcb, CB_SETCURSEL, num_devices, 0);
|
SendMessageW(devcb, CB_SETCURSEL, num_devices, 0);
|
||||||
|
|
||||||
num_devices++;
|
num_devices++;
|
||||||
|
|
||||||
|
@ -592,10 +594,10 @@ INT_PTR CALLBACK BtrfsBalance::BalanceOptsDlgProc(HWND hwndDlg, UINT uMsg, WPARA
|
||||||
if (!load_string(module, convtypes[i], s))
|
if (!load_string(module, convtypes[i], s))
|
||||||
throw last_error(GetLastError());
|
throw last_error(GetLastError());
|
||||||
|
|
||||||
SendMessage(convcb, CB_ADDSTRING, 0, (LPARAM)s.c_str());
|
SendMessageW(convcb, CB_ADDSTRING, 0, (LPARAM)s.c_str());
|
||||||
|
|
||||||
if (opts->convert == convtypes2[i])
|
if (opts->convert == convtypes2[i])
|
||||||
SendMessage(convcb, CB_SETCURSEL, i, 0);
|
SendMessageW(convcb, CB_SETCURSEL, i, 0);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
@ -839,10 +841,10 @@ static INT_PTR CALLBACK stub_BalanceOptsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
BtrfsBalance* bb;
|
BtrfsBalance* bb;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bb = (BtrfsBalance*)lParam;
|
bb = (BtrfsBalance*)lParam;
|
||||||
} else {
|
} else {
|
||||||
bb = (BtrfsBalance*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bb = (BtrfsBalance*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bb)
|
if (bb)
|
||||||
|
@ -964,10 +966,10 @@ static INT_PTR CALLBACK stub_BalanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar
|
||||||
BtrfsBalance* bb;
|
BtrfsBalance* bb;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bb = (BtrfsBalance*)lParam;
|
bb = (BtrfsBalance*)lParam;
|
||||||
} else {
|
} else {
|
||||||
bb = (BtrfsBalance*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bb = (BtrfsBalance*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bb)
|
if (bb)
|
||||||
|
|
|
@ -75,7 +75,7 @@ static void find_devices(HWND hwnd, const GUID* guid, const mountmgr& mm, vector
|
||||||
|
|
||||||
static const wstring dosdevices = L"\\DosDevices\\";
|
static const wstring dosdevices = L"\\DosDevices\\";
|
||||||
|
|
||||||
h = SetupDiGetClassDevs(guid, nullptr, 0, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
|
h = SetupDiGetClassDevsW(guid, nullptr, 0, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
|
||||||
|
|
||||||
if (h != INVALID_HANDLE_VALUE) {
|
if (h != INVALID_HANDLE_VALUE) {
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
|
@ -629,10 +629,10 @@ static INT_PTR CALLBACK stub_DeviceAddDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wP
|
||||||
BtrfsDeviceAdd* bda;
|
BtrfsDeviceAdd* bda;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bda = (BtrfsDeviceAdd*)lParam;
|
bda = (BtrfsDeviceAdd*)lParam;
|
||||||
} else {
|
} else {
|
||||||
bda = (BtrfsDeviceAdd*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bda = (BtrfsDeviceAdd*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bda)
|
if (bda)
|
||||||
|
@ -824,10 +824,10 @@ static INT_PTR CALLBACK stub_DeviceResizeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
BtrfsDeviceResize* bdr;
|
BtrfsDeviceResize* bdr;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bdr = (BtrfsDeviceResize*)lParam;
|
bdr = (BtrfsDeviceResize*)lParam;
|
||||||
} else
|
} else
|
||||||
bdr = (BtrfsDeviceResize*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bdr = (BtrfsDeviceResize*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
if (bdr)
|
if (bdr)
|
||||||
return bdr->DeviceResizeDlgProc(hwndDlg, uMsg, wParam, lParam);
|
return bdr->DeviceResizeDlgProc(hwndDlg, uMsg, wParam, lParam);
|
||||||
|
|
|
@ -435,11 +435,11 @@ void BtrfsPropSheet::set_cmdline(const wstring& cmdline) {
|
||||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, nullptr);
|
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, nullptr);
|
||||||
|
|
||||||
if (h == INVALID_HANDLE_VALUE)
|
if (h == INVALID_HANDLE_VALUE)
|
||||||
return;
|
throw last_error(GetLastError());
|
||||||
|
|
||||||
Status = NtQueryInformationFile(h, &iosb, &fai, sizeof(FILE_ACCESS_INFORMATION), FileAccessInformation);
|
Status = NtQueryInformationFile(h, &iosb, &fai, sizeof(FILE_ACCESS_INFORMATION), FileAccessInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return;
|
throw ntstatus_error(Status);
|
||||||
|
|
||||||
if (fai.AccessFlags & FILE_READ_ATTRIBUTES)
|
if (fai.AccessFlags & FILE_READ_ATTRIBUTES)
|
||||||
can_change_perms = fai.AccessFlags & WRITE_DAC;
|
can_change_perms = fai.AccessFlags & WRITE_DAC;
|
||||||
|
@ -453,7 +453,10 @@ void BtrfsPropSheet::set_cmdline(const wstring& cmdline) {
|
||||||
|
|
||||||
Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii2, sizeof(btrfs_inode_info));
|
Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii2, sizeof(btrfs_inode_info));
|
||||||
|
|
||||||
if (NT_SUCCESS(Status) && !bii2.top) {
|
if (!NT_SUCCESS(Status))
|
||||||
|
throw ntstatus_error(Status);
|
||||||
|
|
||||||
|
if (!bii2.top) {
|
||||||
LARGE_INTEGER filesize;
|
LARGE_INTEGER filesize;
|
||||||
|
|
||||||
subvol = bii2.subvol;
|
subvol = bii2.subvol;
|
||||||
|
@ -740,7 +743,7 @@ void BtrfsPropSheet::set_size_on_disk(HWND hwndDlg) {
|
||||||
if (cr != old_text)
|
if (cr != old_text)
|
||||||
SetDlgItemTextW(hwndDlg, IDC_COMPRESSION_RATIO, cr.c_str());
|
SetDlgItemTextW(hwndDlg, IDC_COMPRESSION_RATIO, cr.c_str());
|
||||||
|
|
||||||
uint64_t extent_size = (allocsize - sparsesize - sizes[0]) / sector_size;
|
uint64_t extent_size = (allocsize - sparsesize - sizes[0]) / (sector_size == 0 ? 4096 : sector_size);
|
||||||
|
|
||||||
if (num_extents == 0 || extent_size <= 1)
|
if (num_extents == 0 || extent_size <= 1)
|
||||||
ratio = 0.0f;
|
ratio = 0.0f;
|
||||||
|
@ -751,7 +754,6 @@ void BtrfsPropSheet::set_size_on_disk(HWND hwndDlg) {
|
||||||
|
|
||||||
GetDlgItemTextW(hwndDlg, IDC_FRAGMENTATION, old_text, sizeof(old_text) / sizeof(WCHAR));
|
GetDlgItemTextW(hwndDlg, IDC_FRAGMENTATION, old_text, sizeof(old_text) / sizeof(WCHAR));
|
||||||
|
|
||||||
|
|
||||||
if (frag != old_text)
|
if (frag != old_text)
|
||||||
SetDlgItemTextW(hwndDlg, IDC_FRAGMENTATION, frag.c_str());
|
SetDlgItemTextW(hwndDlg, IDC_FRAGMENTATION, frag.c_str());
|
||||||
}
|
}
|
||||||
|
@ -813,7 +815,7 @@ static INT_PTR CALLBACK SizeDetailsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
|
||||||
{
|
{
|
||||||
BtrfsPropSheet* bps = (BtrfsPropSheet*)lParam;
|
BtrfsPropSheet* bps = (BtrfsPropSheet*)lParam;
|
||||||
|
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
|
||||||
|
|
||||||
bps->update_size_details_dialog(hwndDlg);
|
bps->update_size_details_dialog(hwndDlg);
|
||||||
|
|
||||||
|
@ -832,7 +834,7 @@ static INT_PTR CALLBACK SizeDetailsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
{
|
{
|
||||||
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
if (bps) {
|
if (bps) {
|
||||||
bps->update_size_details_dialog(hwndDlg);
|
bps->update_size_details_dialog(hwndDlg);
|
||||||
|
@ -853,18 +855,18 @@ static INT_PTR CALLBACK SizeDetailsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
|
||||||
|
|
||||||
static void set_check_box(HWND hwndDlg, ULONG id, uint64_t min, uint64_t max) {
|
static void set_check_box(HWND hwndDlg, ULONG id, uint64_t min, uint64_t max) {
|
||||||
if (min && max) {
|
if (min && max) {
|
||||||
SendDlgItemMessage(hwndDlg, id, BM_SETCHECK, BST_CHECKED, 0);
|
SendDlgItemMessageW(hwndDlg, id, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
} else if (!min && !max) {
|
} else if (!min && !max) {
|
||||||
SendDlgItemMessage(hwndDlg, id, BM_SETCHECK, BST_UNCHECKED, 0);
|
SendDlgItemMessageW(hwndDlg, id, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
} else {
|
} else {
|
||||||
LONG_PTR style;
|
LONG_PTR style;
|
||||||
|
|
||||||
style = GetWindowLongPtr(GetDlgItem(hwndDlg, id), GWL_STYLE);
|
style = GetWindowLongPtrW(GetDlgItem(hwndDlg, id), GWL_STYLE);
|
||||||
style &= ~BS_AUTOCHECKBOX;
|
style &= ~BS_AUTOCHECKBOX;
|
||||||
style |= BS_AUTO3STATE;
|
style |= BS_AUTO3STATE;
|
||||||
SetWindowLongPtr(GetDlgItem(hwndDlg, id), GWL_STYLE, style);
|
SetWindowLongPtrW(GetDlgItem(hwndDlg, id), GWL_STYLE, style);
|
||||||
|
|
||||||
SendDlgItemMessage(hwndDlg, id, BM_SETCHECK, BST_INDETERMINATE, 0);
|
SendDlgItemMessageW(hwndDlg, id, BM_SETCHECK, BST_INDETERMINATE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,13 +997,13 @@ void BtrfsPropSheet::init_propsheet(HWND hwndDlg) {
|
||||||
|
|
||||||
comptype = GetDlgItem(hwndDlg, IDC_COMPRESS_TYPE);
|
comptype = GetDlgItem(hwndDlg, IDC_COMPRESS_TYPE);
|
||||||
|
|
||||||
while (SendMessage(comptype, CB_GETCOUNT, 0, 0) > 0) {
|
while (SendMessageW(comptype, CB_GETCOUNT, 0, 0) > 0) {
|
||||||
SendMessage(comptype, CB_DELETESTRING, 0, 0);
|
SendMessageW(comptype, CB_DELETESTRING, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_compression_type != max_compression_type) {
|
if (min_compression_type != max_compression_type) {
|
||||||
SendMessage(comptype, CB_ADDSTRING, 0, (LPARAM)L"");
|
SendMessageW(comptype, CB_ADDSTRING, 0, (LPARAM)L"");
|
||||||
SendMessage(comptype, CB_SETCURSEL, 0, 0);
|
SendMessageW(comptype, CB_SETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -1011,13 +1013,13 @@ void BtrfsPropSheet::init_propsheet(HWND hwndDlg) {
|
||||||
if (!load_string(module, comp_types[i], t))
|
if (!load_string(module, comp_types[i], t))
|
||||||
throw last_error(GetLastError());
|
throw last_error(GetLastError());
|
||||||
|
|
||||||
SendMessage(comptype, CB_ADDSTRING, 0, (LPARAM)t.c_str());
|
SendMessageW(comptype, CB_ADDSTRING, 0, (LPARAM)t.c_str());
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_compression_type == max_compression_type) {
|
if (min_compression_type == max_compression_type) {
|
||||||
SendMessage(comptype, CB_SETCURSEL, min_compression_type, 0);
|
SendMessageW(comptype, CB_SETCURSEL, min_compression_type, 0);
|
||||||
compress_type = min_compression_type;
|
compress_type = min_compression_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,12 +1089,12 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
PROPSHEETPAGE* psp = (PROPSHEETPAGE*)lParam;
|
PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)lParam;
|
||||||
BtrfsPropSheet* bps = (BtrfsPropSheet*)psp->lParam;
|
BtrfsPropSheet* bps = (BtrfsPropSheet*)psp->lParam;
|
||||||
|
|
||||||
EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
|
EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
|
||||||
|
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
|
||||||
|
|
||||||
bps->init_propsheet(hwndDlg);
|
bps->init_propsheet(hwndDlg);
|
||||||
|
|
||||||
|
@ -1101,7 +1103,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
if (bps && !bps->readonly) {
|
if (bps && !bps->readonly) {
|
||||||
switch (HIWORD(wParam)) {
|
switch (HIWORD(wParam)) {
|
||||||
|
@ -1256,7 +1258,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PSN_APPLY: {
|
case PSN_APPLY: {
|
||||||
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
bps->apply_changes(hwndDlg);
|
bps->apply_changes(hwndDlg);
|
||||||
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
|
||||||
|
@ -1269,7 +1271,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
PNMLINK pNMLink = (PNMLINK)lParam;
|
PNMLINK pNMLink = (PNMLINK)lParam;
|
||||||
|
|
||||||
if (pNMLink->item.iLink == 0)
|
if (pNMLink->item.iLink == 0)
|
||||||
DialogBoxParamW(module, MAKEINTRESOURCEW(IDD_SIZE_DETAILS), hwndDlg, SizeDetailsDlgProc, GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
|
DialogBoxParamW(module, MAKEINTRESOURCEW(IDD_SIZE_DETAILS), hwndDlg, SizeDetailsDlgProc, GetWindowLongPtrW(hwndDlg, GWLP_USERDATA));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1278,7 +1280,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
{
|
{
|
||||||
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
BtrfsPropSheet* bps = (BtrfsPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
if (bps) {
|
if (bps) {
|
||||||
bps->set_size_on_disk(hwndDlg);
|
bps->set_size_on_disk(hwndDlg);
|
||||||
|
@ -1299,7 +1301,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
HRESULT __stdcall BtrfsPropSheet::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) {
|
HRESULT __stdcall BtrfsPropSheet::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) {
|
||||||
try {
|
try {
|
||||||
PROPSHEETPAGE psp;
|
PROPSHEETPAGEW psp;
|
||||||
HPROPSHEETPAGE hPage;
|
HPROPSHEETPAGE hPage;
|
||||||
INITCOMMONCONTROLSEX icex;
|
INITCOMMONCONTROLSEX icex;
|
||||||
|
|
||||||
|
@ -1315,15 +1317,15 @@ HRESULT __stdcall BtrfsPropSheet::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPAR
|
||||||
psp.dwSize = sizeof(psp);
|
psp.dwSize = sizeof(psp);
|
||||||
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
|
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
|
||||||
psp.hInstance = module;
|
psp.hInstance = module;
|
||||||
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROP_SHEET);
|
psp.pszTemplate = MAKEINTRESOURCEW(IDD_PROP_SHEET);
|
||||||
psp.hIcon = 0;
|
psp.hIcon = 0;
|
||||||
psp.pszTitle = MAKEINTRESOURCE(IDS_PROP_SHEET_TITLE);
|
psp.pszTitle = MAKEINTRESOURCEW(IDS_PROP_SHEET_TITLE);
|
||||||
psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
|
psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
|
||||||
psp.pcRefParent = (UINT*)&objs_loaded;
|
psp.pcRefParent = (UINT*)&objs_loaded;
|
||||||
psp.pfnCallback = nullptr;
|
psp.pfnCallback = nullptr;
|
||||||
psp.lParam = (LPARAM)this;
|
psp.lParam = (LPARAM)this;
|
||||||
|
|
||||||
hPage = CreatePropertySheetPage(&psp);
|
hPage = CreatePropertySheetPageW(&psp);
|
||||||
|
|
||||||
if (hPage) {
|
if (hPage) {
|
||||||
if (pfnAddPage(hPage, lParam)) {
|
if (pfnAddPage(hPage, lParam)) {
|
||||||
|
@ -1353,6 +1355,7 @@ void CALLBACK ShowPropSheetW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int
|
||||||
BtrfsPropSheet bps;
|
BtrfsPropSheet bps;
|
||||||
PROPSHEETPAGEW psp;
|
PROPSHEETPAGEW psp;
|
||||||
PROPSHEETHEADERW psh;
|
PROPSHEETHEADERW psh;
|
||||||
|
INITCOMMONCONTROLSEX icex;
|
||||||
wstring title;
|
wstring title;
|
||||||
|
|
||||||
set_dpi_aware();
|
set_dpi_aware();
|
||||||
|
@ -1361,6 +1364,12 @@ void CALLBACK ShowPropSheetW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int
|
||||||
|
|
||||||
bps.set_cmdline(lpszCmdLine);
|
bps.set_cmdline(lpszCmdLine);
|
||||||
|
|
||||||
|
icex.dwSize = sizeof(icex);
|
||||||
|
icex.dwICC = ICC_LINK_CLASS;
|
||||||
|
|
||||||
|
if (!InitCommonControlsEx(&icex))
|
||||||
|
throw string_error(IDS_INITCOMMONCONTROLSEX_FAILED);
|
||||||
|
|
||||||
psp.dwSize = sizeof(psp);
|
psp.dwSize = sizeof(psp);
|
||||||
psp.dwFlags = PSP_USETITLE;
|
psp.dwFlags = PSP_USETITLE;
|
||||||
psp.hInstance = module;
|
psp.hInstance = module;
|
||||||
|
@ -1381,7 +1390,8 @@ void CALLBACK ShowPropSheetW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int
|
||||||
psh.nPages = 1;
|
psh.nPages = 1;
|
||||||
psh.ppsp = &psp;
|
psh.ppsp = &psp;
|
||||||
|
|
||||||
PropertySheetW(&psh);
|
if (PropertySheetW(&psh) < 0)
|
||||||
|
throw last_error(GetLastError());
|
||||||
} catch (const exception& e) {
|
} catch (const exception& e) {
|
||||||
error_message(hwnd, e.what());
|
error_message(hwnd, e.what());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1513,10 +1513,10 @@ static INT_PTR CALLBACK stub_RecvProgressDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
BtrfsRecv* br;
|
BtrfsRecv* br;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
br = (BtrfsRecv*)lParam;
|
br = (BtrfsRecv*)lParam;
|
||||||
} else {
|
} else {
|
||||||
br = (BtrfsRecv*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
br = (BtrfsRecv*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (br)
|
if (br)
|
||||||
|
|
|
@ -514,10 +514,10 @@ static INT_PTR CALLBACK stub_SendDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
BtrfsSend* bs;
|
BtrfsSend* bs;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bs = (BtrfsSend*)lParam;
|
bs = (BtrfsSend*)lParam;
|
||||||
} else
|
} else
|
||||||
bs = (BtrfsSend*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bs = (BtrfsSend*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
if (bs)
|
if (bs)
|
||||||
return bs->SendDlgProc(hwndDlg, uMsg, wParam, lParam);
|
return bs->SendDlgProc(hwndDlg, uMsg, wParam, lParam);
|
||||||
|
|
|
@ -61,8 +61,8 @@ IDI_ICON1 ICON "subvol.ico"
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,7,4,0
|
FILEVERSION 1,7,5,0
|
||||||
PRODUCTVERSION 1,7,4,0
|
PRODUCTVERSION 1,7,5,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.4"
|
VALUE "FileVersion", "1.7.5"
|
||||||
VALUE "InternalName", "btrfs"
|
VALUE "InternalName", "btrfs"
|
||||||
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-20"
|
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-20"
|
||||||
VALUE "OriginalFilename", "shellbtrfs.dll"
|
VALUE "OriginalFilename", "shellbtrfs.dll"
|
||||||
VALUE "ProductName", "WinBtrfs"
|
VALUE "ProductName", "WinBtrfs"
|
||||||
VALUE "ProductVersion", "1.7.4"
|
VALUE "ProductVersion", "1.7.5"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -567,10 +567,10 @@ static INT_PTR CALLBACK stub_UsageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
|
||||||
BtrfsVolPropSheet* bvps;
|
BtrfsVolPropSheet* bvps;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bvps = (BtrfsVolPropSheet*)lParam;
|
bvps = (BtrfsVolPropSheet*)lParam;
|
||||||
} else {
|
} else {
|
||||||
bvps = (BtrfsVolPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bvps = (BtrfsVolPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bvps)
|
if (bvps)
|
||||||
|
@ -943,10 +943,10 @@ static INT_PTR CALLBACK stub_StatsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
|
||||||
BtrfsVolPropSheet* bvps;
|
BtrfsVolPropSheet* bvps;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bvps = (BtrfsVolPropSheet*)lParam;
|
bvps = (BtrfsVolPropSheet*)lParam;
|
||||||
} else {
|
} else {
|
||||||
bvps = (BtrfsVolPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bvps = (BtrfsVolPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bvps)
|
if (bvps)
|
||||||
|
@ -1250,10 +1250,10 @@ static INT_PTR CALLBACK stub_DeviceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPara
|
||||||
BtrfsVolPropSheet* bvps;
|
BtrfsVolPropSheet* bvps;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bvps = (BtrfsVolPropSheet*)lParam;
|
bvps = (BtrfsVolPropSheet*)lParam;
|
||||||
} else {
|
} else {
|
||||||
bvps = (BtrfsVolPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bvps = (BtrfsVolPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bvps)
|
if (bvps)
|
||||||
|
@ -1331,13 +1331,13 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
PROPSHEETPAGE* psp = (PROPSHEETPAGE*)lParam;
|
PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)lParam;
|
||||||
BtrfsVolPropSheet* bps = (BtrfsVolPropSheet*)psp->lParam;
|
BtrfsVolPropSheet* bps = (BtrfsVolPropSheet*)psp->lParam;
|
||||||
btrfs_device* bd;
|
btrfs_device* bd;
|
||||||
|
|
||||||
EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
|
EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
|
||||||
|
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)bps);
|
||||||
|
|
||||||
bps->readonly = true;
|
bps->readonly = true;
|
||||||
bd = bps->devices;
|
bd = bps->devices;
|
||||||
|
@ -1386,7 +1386,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
BtrfsVolPropSheet* bps = (BtrfsVolPropSheet*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
BtrfsVolPropSheet* bps = (BtrfsVolPropSheet*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
if (bps) {
|
if (bps) {
|
||||||
switch (HIWORD(wParam)) {
|
switch (HIWORD(wParam)) {
|
||||||
|
@ -1428,7 +1428,7 @@ static INT_PTR CALLBACK PropSheetDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
HRESULT __stdcall BtrfsVolPropSheet::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) {
|
HRESULT __stdcall BtrfsVolPropSheet::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) {
|
||||||
try {
|
try {
|
||||||
PROPSHEETPAGE psp;
|
PROPSHEETPAGEW psp;
|
||||||
HPROPSHEETPAGE hPage;
|
HPROPSHEETPAGE hPage;
|
||||||
INITCOMMONCONTROLSEX icex;
|
INITCOMMONCONTROLSEX icex;
|
||||||
|
|
||||||
|
@ -1444,15 +1444,15 @@ HRESULT __stdcall BtrfsVolPropSheet::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, L
|
||||||
psp.dwSize = sizeof(psp);
|
psp.dwSize = sizeof(psp);
|
||||||
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
|
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE;
|
||||||
psp.hInstance = module;
|
psp.hInstance = module;
|
||||||
psp.pszTemplate = MAKEINTRESOURCE(IDD_VOL_PROP_SHEET);
|
psp.pszTemplate = MAKEINTRESOURCEW(IDD_VOL_PROP_SHEET);
|
||||||
psp.hIcon = 0;
|
psp.hIcon = 0;
|
||||||
psp.pszTitle = MAKEINTRESOURCE(IDS_VOL_PROP_SHEET_TITLE);
|
psp.pszTitle = MAKEINTRESOURCEW(IDS_VOL_PROP_SHEET_TITLE);
|
||||||
psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
|
psp.pfnDlgProc = (DLGPROC)PropSheetDlgProc;
|
||||||
psp.pcRefParent = (UINT*)&objs_loaded;
|
psp.pcRefParent = (UINT*)&objs_loaded;
|
||||||
psp.pfnCallback = nullptr;
|
psp.pfnCallback = nullptr;
|
||||||
psp.lParam = (LPARAM)this;
|
psp.lParam = (LPARAM)this;
|
||||||
|
|
||||||
hPage = CreatePropertySheetPage(&psp);
|
hPage = CreatePropertySheetPageW(&psp);
|
||||||
|
|
||||||
if (hPage) {
|
if (hPage) {
|
||||||
if (pfnAddPage(hPage, lParam)) {
|
if (pfnAddPage(hPage, lParam)) {
|
||||||
|
@ -1594,10 +1594,10 @@ static INT_PTR __stdcall dlg_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
BtrfsChangeDriveLetter* bcdl;
|
BtrfsChangeDriveLetter* bcdl;
|
||||||
|
|
||||||
if (uMsg == WM_INITDIALOG) {
|
if (uMsg == WM_INITDIALOG) {
|
||||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
|
||||||
bcdl = (BtrfsChangeDriveLetter*)lParam;
|
bcdl = (BtrfsChangeDriveLetter*)lParam;
|
||||||
} else
|
} else
|
||||||
bcdl = (BtrfsChangeDriveLetter*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
bcdl = (BtrfsChangeDriveLetter*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
|
||||||
|
|
||||||
return bcdl->DlgProc(hwndDlg, uMsg, wParam, lParam);
|
return bcdl->DlgProc(hwndDlg, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,7,4,0
|
FILEVERSION 1,7,5,0
|
||||||
PRODUCTVERSION 1,7,4,0
|
PRODUCTVERSION 1,7,5,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.4"
|
VALUE "FileVersion", "1.7.5"
|
||||||
VALUE "InternalName", "ubtrfs"
|
VALUE "InternalName", "ubtrfs"
|
||||||
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-20"
|
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-20"
|
||||||
VALUE "OriginalFilename", "ubtrfs.dll"
|
VALUE "OriginalFilename", "ubtrfs.dll"
|
||||||
VALUE "ProductName", "WinBtrfs"
|
VALUE "ProductName", "WinBtrfs"
|
||||||
VALUE "ProductVersion", "1.7.4"
|
VALUE "ProductVersion", "1.7.5"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -5923,7 +5923,7 @@ static void check_cpu() {
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
{
|
{
|
||||||
uint32_t eax, ebx, ecx, edx, xcr0;
|
uint32_t eax, ebx, ecx, edx;
|
||||||
|
|
||||||
__cpuid(1, eax, ebx, ecx, edx);
|
__cpuid(1, eax, ebx, ecx, edx);
|
||||||
|
|
||||||
|
@ -5935,10 +5935,17 @@ static void check_cpu() {
|
||||||
if (__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx))
|
if (__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx))
|
||||||
have_avx2 = ebx & bit_AVX2;
|
have_avx2 = ebx & bit_AVX2;
|
||||||
|
|
||||||
if (have_avx2) { // check if supported by OS
|
if (have_avx2) {
|
||||||
__asm__("xgetbv" : "=a" (xcr0) : "c" (0) : "edx" );
|
// check Windows has enabled AVX2 - Windows 10 doesn't immediately
|
||||||
|
|
||||||
if ((xcr0 & 6) != 6)
|
if (__readcr4() & (1 << 18)) {
|
||||||
|
uint32_t xcr0;
|
||||||
|
|
||||||
|
__asm__("xgetbv" : "=a" (xcr0) : "c" (0) : "edx" );
|
||||||
|
|
||||||
|
if ((xcr0 & 6) != 6)
|
||||||
|
have_avx2 = false;
|
||||||
|
} else
|
||||||
have_avx2 = false;
|
have_avx2 = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5954,9 +5961,14 @@ static void check_cpu() {
|
||||||
have_avx2 = cpu_info[1] & (1 << 5);
|
have_avx2 = cpu_info[1] & (1 << 5);
|
||||||
|
|
||||||
if (have_avx2) {
|
if (have_avx2) {
|
||||||
uint32_t xcr0 = (uint32_t)_xgetbv(0);
|
// check Windows has enabled AVX2 - Windows 10 doesn't immediately
|
||||||
|
|
||||||
if ((xcr0 & 6) != 6)
|
if (__readcr4() & (1 << 18)) {
|
||||||
|
uint32_t xcr0 = (uint32_t)_xgetbv(0);
|
||||||
|
|
||||||
|
if ((xcr0 & 6) != 6)
|
||||||
|
have_avx2 = false;
|
||||||
|
} else
|
||||||
have_avx2 = false;
|
have_avx2 = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = 05/24/2020,1.7.3.0
|
DriverVer = 10/31/2020,1.7.5.0
|
||||||
CatalogFile = btrfs.cat
|
CatalogFile = btrfs.cat
|
||||||
|
|
||||||
[DestinationDirs]
|
[DestinationDirs]
|
||||||
|
|
|
@ -51,8 +51,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,7,4,0
|
FILEVERSION 1,7,5,0
|
||||||
PRODUCTVERSION 1,7,4,0
|
PRODUCTVERSION 1,7,5,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.4"
|
VALUE "FileVersion", "1.7.5"
|
||||||
VALUE "InternalName", "btrfs"
|
VALUE "InternalName", "btrfs"
|
||||||
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-20"
|
VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-20"
|
||||||
VALUE "OriginalFilename", "btrfs.sys"
|
VALUE "OriginalFilename", "btrfs.sys"
|
||||||
VALUE "ProductName", "WinBtrfs"
|
VALUE "ProductName", "WinBtrfs"
|
||||||
VALUE "ProductVersion", "1.7.4"
|
VALUE "ProductVersion", "1.7.5"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -201,17 +201,8 @@ typedef struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER {
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#define __drv_aliasesMem
|
#define __drv_aliasesMem
|
||||||
#define _Requires_lock_held_(a)
|
|
||||||
#define _Requires_exclusive_lock_held_(a)
|
|
||||||
#define _Releases_lock_(a)
|
|
||||||
#define _Releases_exclusive_lock_(a)
|
|
||||||
#define _Dispatch_type_(a)
|
#define _Dispatch_type_(a)
|
||||||
#define _Create_lock_level_(a)
|
|
||||||
#define _Lock_level_order_(a,b)
|
#define _Lock_level_order_(a,b)
|
||||||
#define _Has_lock_level_(a)
|
|
||||||
#define _Requires_lock_not_held_(a)
|
|
||||||
#define _Acquires_exclusive_lock_(a)
|
|
||||||
#define _Acquires_shared_lock_(a)
|
|
||||||
#endif
|
#endif
|
||||||
#endif // __REACTOS__
|
#endif // __REACTOS__
|
||||||
|
|
||||||
|
|
|
@ -3593,22 +3593,19 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
LARGE_INTEGER zero;
|
LARGE_INTEGER zero;
|
||||||
|
|
||||||
if (fileref->fcb->type == BTRFS_TYPE_DIRECTORY || is_subvol_readonly(fileref->fcb->subvol, Irp)) {
|
if (fileref->fcb->type == BTRFS_TYPE_DIRECTORY || is_subvol_readonly(fileref->fcb->subvol, Irp)) {
|
||||||
free_fileref(fileref);
|
Status = STATUS_ACCESS_DENIED;
|
||||||
|
goto end;
|
||||||
return STATUS_ACCESS_DENIED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Vcb->readonly) {
|
if (Vcb->readonly) {
|
||||||
free_fileref(fileref);
|
Status = STATUS_MEDIA_WRITE_PROTECTED;
|
||||||
|
goto end;
|
||||||
return STATUS_MEDIA_WRITE_PROTECTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zero.QuadPart = 0;
|
zero.QuadPart = 0;
|
||||||
if (!MmCanFileBeTruncated(&fileref->fcb->nonpaged->segment_object, &zero)) {
|
if (!MmCanFileBeTruncated(&fileref->fcb->nonpaged->segment_object, &zero)) {
|
||||||
free_fileref(fileref);
|
Status = STATUS_USER_MAPPED_FILE;
|
||||||
|
goto end;
|
||||||
return STATUS_USER_MAPPED_FILE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3622,10 +3619,7 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
granted_access, &Status)) {
|
granted_access, &Status)) {
|
||||||
SeUnlockSubjectContext(&IrpSp->Parameters.Create.SecurityContext->AccessState->SubjectSecurityContext);
|
SeUnlockSubjectContext(&IrpSp->Parameters.Create.SecurityContext->AccessState->SubjectSecurityContext);
|
||||||
TRACE("SeAccessCheck failed, returning %08lx\n", Status);
|
TRACE("SeAccessCheck failed, returning %08lx\n", Status);
|
||||||
|
goto end;
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SeUnlockSubjectContext(&IrpSp->Parameters.Create.SecurityContext->AccessState->SubjectSecurityContext);
|
SeUnlockSubjectContext(&IrpSp->Parameters.Create.SecurityContext->AccessState->SubjectSecurityContext);
|
||||||
|
@ -3638,10 +3632,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
while (sf) {
|
while (sf) {
|
||||||
if (sf->delete_on_close) {
|
if (sf->delete_on_close) {
|
||||||
TRACE("could not open as deletion pending\n");
|
TRACE("could not open as deletion pending\n");
|
||||||
|
Status = STATUS_DELETE_PENDING;
|
||||||
free_fileref(fileref);
|
goto end;
|
||||||
|
|
||||||
return STATUS_DELETE_PENDING;
|
|
||||||
}
|
}
|
||||||
sf = sf->parent;
|
sf = sf->parent;
|
||||||
}
|
}
|
||||||
|
@ -3651,9 +3643,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
is_subvol_readonly(fileref->fcb->subvol, Irp) || fileref->fcb == Vcb->dummy_fcb || Vcb->readonly;
|
is_subvol_readonly(fileref->fcb->subvol, Irp) || fileref->fcb == Vcb->dummy_fcb || Vcb->readonly;
|
||||||
|
|
||||||
if (options & FILE_DELETE_ON_CLOSE && (fileref == Vcb->root_fileref || readonly)) {
|
if (options & FILE_DELETE_ON_CLOSE && (fileref == Vcb->root_fileref || readonly)) {
|
||||||
free_fileref(fileref);
|
Status = STATUS_CANNOT_DELETE;
|
||||||
|
goto end;
|
||||||
return STATUS_CANNOT_DELETE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readonly) {
|
if (readonly) {
|
||||||
|
@ -3681,9 +3672,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
*granted_access &= allowed;
|
*granted_access &= allowed;
|
||||||
IrpSp->Parameters.Create.SecurityContext->AccessState->PreviouslyGrantedAccess &= allowed;
|
IrpSp->Parameters.Create.SecurityContext->AccessState->PreviouslyGrantedAccess &= allowed;
|
||||||
} else if (*granted_access & ~allowed) {
|
} else if (*granted_access & ~allowed) {
|
||||||
free_fileref(fileref);
|
Status = Vcb->readonly ? STATUS_MEDIA_WRITE_PROTECTED : STATUS_ACCESS_DENIED;
|
||||||
|
goto end;
|
||||||
return Vcb->readonly ? STATUS_MEDIA_WRITE_PROTECTED : STATUS_ACCESS_DENIED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3709,24 +3699,20 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
|
|
||||||
Irp->Tail.Overlay.AuxiliaryBuffer = (void*)data;
|
Irp->Tail.Overlay.AuxiliaryBuffer = (void*)data;
|
||||||
|
|
||||||
free_fileref(fileref);
|
Status = STATUS_REPARSE;
|
||||||
|
goto end;
|
||||||
return STATUS_REPARSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileref->fcb->type == BTRFS_TYPE_DIRECTORY && !fileref->fcb->ads) {
|
if (fileref->fcb->type == BTRFS_TYPE_DIRECTORY && !fileref->fcb->ads) {
|
||||||
if (options & FILE_NON_DIRECTORY_FILE && !(fileref->fcb->atts & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
if (options & FILE_NON_DIRECTORY_FILE && !(fileref->fcb->atts & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||||
free_fileref(fileref);
|
Status = STATUS_FILE_IS_A_DIRECTORY;
|
||||||
|
goto end;
|
||||||
return STATUS_FILE_IS_A_DIRECTORY;
|
|
||||||
}
|
}
|
||||||
} else if (options & FILE_DIRECTORY_FILE) {
|
} else if (options & FILE_DIRECTORY_FILE) {
|
||||||
TRACE("returning STATUS_NOT_A_DIRECTORY (type = %u)\n", fileref->fcb->type);
|
TRACE("returning STATUS_NOT_A_DIRECTORY (type = %u)\n", fileref->fcb->type);
|
||||||
|
Status = STATUS_NOT_A_DIRECTORY;
|
||||||
free_fileref(fileref);
|
goto end;
|
||||||
|
|
||||||
return STATUS_NOT_A_DIRECTORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileref->open_count > 0) {
|
if (fileref->open_count > 0) {
|
||||||
|
@ -3738,9 +3724,7 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
else
|
else
|
||||||
WARN("IoCheckShareAccess failed, returning %08lx\n", Status);
|
WARN("IoCheckShareAccess failed, returning %08lx\n", Status);
|
||||||
|
|
||||||
free_fileref(fileref);
|
goto end;
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IoUpdateShareAccess(FileObject, &fileref->fcb->share_access);
|
IoUpdateShareAccess(FileObject, &fileref->fcb->share_access);
|
||||||
|
@ -3749,12 +3733,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
|
|
||||||
if (*granted_access & FILE_WRITE_DATA || options & FILE_DELETE_ON_CLOSE) {
|
if (*granted_access & FILE_WRITE_DATA || options & FILE_DELETE_ON_CLOSE) {
|
||||||
if (!MmFlushImageSection(&fileref->fcb->nonpaged->segment_object, MmFlushForWrite)) {
|
if (!MmFlushImageSection(&fileref->fcb->nonpaged->segment_object, MmFlushForWrite)) {
|
||||||
|
Status = (options & FILE_DELETE_ON_CLOSE) ? STATUS_CANNOT_DELETE : STATUS_SHARING_VIOLATION;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
goto end2;
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return (options & FILE_DELETE_ON_CLOSE) ? STATUS_CANNOT_DELETE : STATUS_SHARING_VIOLATION;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3762,9 +3742,7 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
Status = FsRtlCheckOplock(fcb_oplock(fileref->fcb), Irp, NULL, NULL, NULL);
|
Status = FsRtlCheckOplock(fcb_oplock(fileref->fcb), Irp, NULL, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
WARN("FsRtlCheckOplock returned %08lx\n", Status);
|
WARN("FsRtlCheckOplock returned %08lx\n", Status);
|
||||||
free_fileref(fileref);
|
goto end2;
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF || RequestedDisposition == FILE_SUPERSEDE) {
|
if (RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF || RequestedDisposition == FILE_SUPERSEDE) {
|
||||||
|
@ -3774,43 +3752,26 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
|
|
||||||
if ((RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF) && readonly) {
|
if ((RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF) && readonly) {
|
||||||
WARN("cannot overwrite readonly file\n");
|
WARN("cannot overwrite readonly file\n");
|
||||||
|
Status = STATUS_ACCESS_DENIED;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
goto end2;
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return STATUS_ACCESS_DENIED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fileref->fcb->ads && (IrpSp->Parameters.Create.FileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != ((fileref->fcb->atts & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN)))) {
|
if (!fileref->fcb->ads && (IrpSp->Parameters.Create.FileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != ((fileref->fcb->atts & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN)))) {
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
Status = STATUS_ACCESS_DENIED;
|
||||||
|
goto end2;
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return STATUS_ACCESS_DENIED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileref->fcb->ads) {
|
if (fileref->fcb->ads) {
|
||||||
Status = stream_set_end_of_file_information(Vcb, 0, fileref->fcb, fileref, false);
|
Status = stream_set_end_of_file_information(Vcb, 0, fileref->fcb, fileref, false);
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
ERR("stream_set_end_of_file_information returned %08lx\n", Status);
|
ERR("stream_set_end_of_file_information returned %08lx\n", Status);
|
||||||
|
goto end2;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Status = truncate_file(fileref->fcb, 0, Irp, rollback);
|
Status = truncate_file(fileref->fcb, 0, Irp, rollback);
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
ERR("truncate_file returned %08lx\n", Status);
|
ERR("truncate_file returned %08lx\n", Status);
|
||||||
|
goto end2;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3819,12 +3780,7 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
ERR("extend_file returned %08lx\n", Status);
|
ERR("extend_file returned %08lx\n", Status);
|
||||||
|
goto end2;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3838,12 +3794,7 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
Status = IoCheckEaBufferValidity(Irp->AssociatedIrp.SystemBuffer, IrpSp->Parameters.Create.EaLength, &offset);
|
Status = IoCheckEaBufferValidity(Irp->AssociatedIrp.SystemBuffer, IrpSp->Parameters.Create.EaLength, &offset);
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
ERR("IoCheckEaBufferValidity returned %08lx (error at offset %lu)\n", Status, offset);
|
ERR("IoCheckEaBufferValidity returned %08lx (error at offset %lu)\n", Status, offset);
|
||||||
|
goto end2;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileref->fcb->ealen = 4;
|
fileref->fcb->ealen = 4;
|
||||||
|
@ -3872,12 +3823,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
fileref->fcb->ea_xattr.Buffer = ExAllocatePoolWithTag(pool_type, IrpSp->Parameters.Create.EaLength, ALLOC_TAG);
|
fileref->fcb->ea_xattr.Buffer = ExAllocatePoolWithTag(pool_type, IrpSp->Parameters.Create.EaLength, ALLOC_TAG);
|
||||||
if (!fileref->fcb->ea_xattr.Buffer) {
|
if (!fileref->fcb->ea_xattr.Buffer) {
|
||||||
ERR("out of memory\n");
|
ERR("out of memory\n");
|
||||||
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
goto end2;
|
||||||
|
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileref->fcb->ea_xattr.Length = fileref->fcb->ea_xattr.MaximumLength = (USHORT)IrpSp->Parameters.Create.EaLength;
|
fileref->fcb->ea_xattr.Length = fileref->fcb->ea_xattr.MaximumLength = (USHORT)IrpSp->Parameters.Create.EaLength;
|
||||||
|
@ -3914,10 +3861,7 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
Status = delete_fileref(dc->fileref, NULL, false, NULL, rollback);
|
Status = delete_fileref(dc->fileref, NULL, false, NULL, rollback);
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
ERR("delete_fileref returned %08lx\n", Status);
|
ERR("delete_fileref returned %08lx\n", Status);
|
||||||
|
goto end2;
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -3973,11 +3917,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
if (ffei->Flags & FILE_NEED_EA) {
|
if (ffei->Flags & FILE_NEED_EA) {
|
||||||
WARN("returning STATUS_ACCESS_DENIED as no EA knowledge\n");
|
WARN("returning STATUS_ACCESS_DENIED as no EA knowledge\n");
|
||||||
|
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
Status = STATUS_ACCESS_DENIED;
|
||||||
|
goto end2;
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return STATUS_ACCESS_DENIED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ffei->NextEntryOffset == 0)
|
if (ffei->NextEntryOffset == 0)
|
||||||
|
@ -3994,11 +3935,8 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
if (!ccb) {
|
if (!ccb) {
|
||||||
ERR("out of memory\n");
|
ERR("out of memory\n");
|
||||||
|
|
||||||
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto end2;
|
||||||
free_fileref(fileref);
|
|
||||||
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(ccb, sizeof(*ccb));
|
RtlZeroMemory(ccb, sizeof(*ccb));
|
||||||
|
@ -4076,7 +4014,17 @@ static NTSTATUS open_file2(device_extension* Vcb, ULONG RequestedDisposition, PO
|
||||||
#endif
|
#endif
|
||||||
InterlockedIncrement(&Vcb->open_files);
|
InterlockedIncrement(&Vcb->open_files);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
end2:
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
IoRemoveShareAccess(FileObject, &fileref->fcb->share_access);
|
||||||
|
|
||||||
|
end:
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
free_fileref(fileref);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS open_fileref_by_inode(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension* Vcb,
|
NTSTATUS open_fileref_by_inode(_Requires_exclusive_lock_held_(_Curr_->fcb_lock) device_extension* Vcb,
|
||||||
|
|
|
@ -5807,7 +5807,7 @@ NTSTATUS __stdcall drv_set_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
|
||||||
goto end2;
|
goto end2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Irp->RequestorMode == KernelMode) {
|
if (Irp->RequestorMode == KernelMode || ccb->access & FILE_WRITE_ATTRIBUTES) {
|
||||||
RtlCopyMemory(&fcb->inode_item.st_uid, item->value.Buffer, sizeof(uint32_t));
|
RtlCopyMemory(&fcb->inode_item.st_uid, item->value.Buffer, sizeof(uint32_t));
|
||||||
fcb->sd_dirty = true;
|
fcb->sd_dirty = true;
|
||||||
fcb->sd_deleted = false;
|
fcb->sd_deleted = false;
|
||||||
|
@ -5822,7 +5822,7 @@ NTSTATUS __stdcall drv_set_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
|
||||||
goto end2;
|
goto end2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Irp->RequestorMode == KernelMode)
|
if (Irp->RequestorMode == KernelMode || ccb->access & FILE_WRITE_ATTRIBUTES)
|
||||||
RtlCopyMemory(&fcb->inode_item.st_gid, item->value.Buffer, sizeof(uint32_t));
|
RtlCopyMemory(&fcb->inode_item.st_gid, item->value.Buffer, sizeof(uint32_t));
|
||||||
|
|
||||||
RemoveEntryList(&item->list_entry);
|
RemoveEntryList(&item->list_entry);
|
||||||
|
@ -5834,7 +5834,7 @@ NTSTATUS __stdcall drv_set_ea(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
|
||||||
goto end2;
|
goto end2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Irp->RequestorMode == KernelMode) {
|
if (Irp->RequestorMode == KernelMode || ccb->access & FILE_WRITE_ATTRIBUTES) {
|
||||||
uint32_t allowed = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH | S_ISGID | S_ISVTX | S_ISUID;
|
uint32_t allowed = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH | S_ISGID | S_ISVTX | S_ISUID;
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
|
|
||||||
|
|
|
@ -3298,6 +3298,14 @@ NTSTATUS truncate_file(fcb* fcb, uint64_t end, PIRP Irp, LIST_ENTRY* rollback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fcb->inode_item.st_blocks += end;
|
fcb->inode_item.st_blocks += end;
|
||||||
|
|
||||||
|
fcb->inode_item.st_size = end;
|
||||||
|
fcb->inode_item_changed = true;
|
||||||
|
TRACE("setting st_size to %I64x\n", end);
|
||||||
|
|
||||||
|
fcb->Header.AllocationSize.QuadPart = sector_align(fcb->inode_item.st_size, fcb->Vcb->superblock.sector_size);
|
||||||
|
fcb->Header.FileSize.QuadPart = fcb->inode_item.st_size;
|
||||||
|
fcb->Header.ValidDataLength.QuadPart = fcb->inode_item.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(buf);
|
ExFreePool(buf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue