https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2da53310a4b21da9cc804b88185df8a6076bd2e7

commit 2da53310a4b21da9cc804b88185df8a6076bd2e7
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Sat May 26 10:58:48 2018 +0200
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Sat May 26 10:58:48 2018 +0200

    [SHELLBTRFS] Upgrade to 1.0.2
    
    CORE-14655
---
 dll/shellext/shellbtrfs/contextmenu.cpp |  4 ++++
 dll/shellext/shellbtrfs/recv.cpp        |  1 +
 dll/shellext/shellbtrfs/scrub.cpp       |  8 ++++++--
 dll/shellext/shellbtrfs/send.cpp        |  4 ++--
 dll/shellext/shellbtrfs/shellbtrfs.rc   | 10 +++++-----
 media/doc/README.FSD                    |  2 +-
 6 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/dll/shellext/shellbtrfs/contextmenu.cpp 
b/dll/shellext/shellbtrfs/contextmenu.cpp
index 1e004ceea1..a306190799 100644
--- a/dll/shellext/shellbtrfs/contextmenu.cpp
+++ b/dll/shellext/shellbtrfs/contextmenu.cpp
@@ -900,6 +900,7 @@ BOOL BtrfsContextMenu::reflink_copy(HWND hwnd, const WCHAR* 
fn, const WCHAR* dir
 
                         if (stream == INVALID_HANDLE_VALUE) {
                             ShowError(hwnd, GetLastError());
+                            FindClose(h);
                             goto end;
                         }
 
@@ -909,6 +910,7 @@ BOOL BtrfsContextMenu::reflink_copy(HWND hwnd, const WCHAR* 
fn, const WCHAR* dir
 
                         if (!ReadFile(stream, data, fsd.StreamSize.QuadPart, 
&bytesret, NULL)) {
                             ShowError(hwnd, GetLastError());
+                            FindClose(h);
                             free(data);
                             CloseHandle(stream);
                             goto end;
@@ -922,6 +924,7 @@ BOOL BtrfsContextMenu::reflink_copy(HWND hwnd, const WCHAR* 
fn, const WCHAR* dir
                     if (stream == INVALID_HANDLE_VALUE) {
                         ShowError(hwnd, GetLastError());
 
+                        FindClose(h);
                         if (data) free(data);
 
                         goto end;
@@ -930,6 +933,7 @@ BOOL BtrfsContextMenu::reflink_copy(HWND hwnd, const WCHAR* 
fn, const WCHAR* dir
                     if (data) {
                         if (!WriteFile(stream, data, fsd.StreamSize.QuadPart, 
&bytesret, NULL)) {
                             ShowError(hwnd, GetLastError());
+                            FindClose(h);
                             free(data);
                             CloseHandle(stream);
                             goto end;
diff --git a/dll/shellext/shellbtrfs/recv.cpp b/dll/shellext/shellbtrfs/recv.cpp
index c3597fa412..5c1ab3646e 100644
--- a/dll/shellext/shellbtrfs/recv.cpp
+++ b/dll/shellext/shellbtrfs/recv.cpp
@@ -1649,6 +1649,7 @@ BOOL BtrfsRecv::do_recv(HANDLE f, UINT64* pos, UINT64 
size) {
 
             if (!ReadFile(f, data, cmd.length, NULL, NULL)) {
                 ShowRecvError(IDS_RECV_READFILE_FAILED, GetLastError(), 
format_message(GetLastError()).c_str());
+                free(data);
                 b = FALSE;
                 break;
             }
diff --git a/dll/shellext/shellbtrfs/scrub.cpp 
b/dll/shellext/shellbtrfs/scrub.cpp
index 9e184221ca..87359a5561 100644
--- a/dll/shellext/shellbtrfs/scrub.cpp
+++ b/dll/shellext/shellbtrfs/scrub.cpp
@@ -620,15 +620,19 @@ void CALLBACK StartScrubW(HWND hwnd, HINSTANCE hinst, 
LPWSTR lpszCmdLine, int nC
         if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | 
TOKEN_QUERY, &token))
             goto end;
 
-        if (!LookupPrivilegeValueW(NULL, L"SeManageVolumePrivilege", &luid))
+        if (!LookupPrivilegeValueW(NULL, L"SeManageVolumePrivilege", &luid)) {
+            CloseHandle(token);
             goto end;
+        }
 
         tp.PrivilegeCount = 1;
         tp.Privileges[0].Luid = luid;
         tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
 
-        if (!AdjustTokenPrivileges(token, FALSE, &tp, 
sizeof(TOKEN_PRIVILEGES), NULL, NULL))
+        if (!AdjustTokenPrivileges(token, FALSE, &tp, 
sizeof(TOKEN_PRIVILEGES), NULL, NULL)) {
+            CloseHandle(token);
             goto end;
+        }
 
         CloseHandle(token);
 
diff --git a/dll/shellext/shellbtrfs/send.cpp b/dll/shellext/shellbtrfs/send.cpp
index 220d5e212c..cbe5f7e26c 100644
--- a/dll/shellext/shellbtrfs/send.cpp
+++ b/dll/shellext/shellbtrfs/send.cpp
@@ -157,7 +157,7 @@ DWORD BtrfsSend::Thread() {
         goto end2;
     }
 
-    memcpy(header.magic, BTRFS_SEND_MAGIC, sizeof(BTRFS_SEND_MAGIC));
+    memcpy(header.magic, BTRFS_SEND_MAGIC, sizeof(header.magic));
     header.version = 1;
 
     if (!WriteFile(stream, &header, sizeof(header), NULL, NULL)) {
@@ -654,7 +654,7 @@ static void send_subvol(std::wstring subvol, std::wstring 
file, std::wstring par
     if (!NT_SUCCESS(Status))
         goto end2;
 
-    memcpy(header.magic, BTRFS_SEND_MAGIC, sizeof(BTRFS_SEND_MAGIC));
+    memcpy(header.magic, BTRFS_SEND_MAGIC, sizeof(header.magic));
     header.version = 1;
 
     if (!WriteFile(stream, &header, sizeof(header), NULL, NULL))
diff --git a/dll/shellext/shellbtrfs/shellbtrfs.rc 
b/dll/shellext/shellbtrfs/shellbtrfs.rc
index 23d46d238b..5e2938ed1d 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,0,1,0
- PRODUCTVERSION 1,0,1,0
+ FILEVERSION 1,0,2,0
+ PRODUCTVERSION 1,0,2,0
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -78,12 +78,12 @@ BEGIN
         BLOCK "080904b0"
         BEGIN
             VALUE "FileDescription", "WinBtrfs shell extension"
-            VALUE "FileVersion", "1.0.1"
+            VALUE "FileVersion", "1.0.2"
             VALUE "InternalName", "btrfs"
-            VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-17"
+            VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-18"
             VALUE "OriginalFilename", "shellbtrfs.dll"
             VALUE "ProductName", "WinBtrfs"
-            VALUE "ProductVersion", "1.0.1"
+            VALUE "ProductVersion", "1.0.2"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/media/doc/README.FSD b/media/doc/README.FSD
index e0faa8491d..52540f06c0 100644
--- a/media/doc/README.FSD
+++ b/media/doc/README.FSD
@@ -4,7 +4,7 @@
 The following FSD are shared with: https://github.com/maharmstone/btrfs.
 
 reactos/drivers/filesystems/btrfs           # Synced to 1.0.2
-reactos/dll/shellext/shellbtrfs             # Synced to 1.0.1
+reactos/dll/shellext/shellbtrfs             # Synced to 1.0.2
 reactos/sdk/lib/fslib/btrfslib              # Synced to 1.0.1
 
 The following FSD are shared with: http://www.ext2fsd.com/

Reply via email to