xref: /reactos/dll/shellext/shellbtrfs/send.h (revision 3c774903)
1 /* Copyright (c) Mark Harmstone 2017
2  *
3  * This file is part of WinBtrfs.
4  *
5  * WinBtrfs is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public Licence as published by
7  * the Free Software Foundation, either version 3 of the Licence, or
8  * (at your option) any later version.
9  *
10  * WinBtrfs is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public Licence for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public Licence
16  * along with WinBtrfs.  If not, see <http://www.gnu.org/licenses/>. */
17 
18 #pragma once
19 
20 #ifdef __REACTOS__
21 #include "btrfs.h"
22 #include <stdlib.h>
23 #else
24 #include "../btrfs.h"
25 #endif
26 #include <string>
27 #include <vector>
28 
29 class BtrfsSend {
30 public:
31     BtrfsSend() {
32         started = FALSE;
33         file[0] = 0;
34         dirh = INVALID_HANDLE_VALUE;
35         stream = INVALID_HANDLE_VALUE;
36         subvol = L"";
37         buf = NULL;
38         incremental = FALSE;
39     }
40 
41     ~BtrfsSend() {
42         if (buf)
43             free(buf);
44     }
45 
46     void Open(HWND hwnd, WCHAR* path);
47     INT_PTR SendDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
48     DWORD Thread();
49 
50 private:
51     void StartSend(HWND hwnd);
52     void Browse(HWND hwnd);
53     void BrowseParent(HWND hwnd);
54     void AddClone(HWND hwnd);
55     void RemoveClone(HWND hwnd);
56     void ShowSendError(UINT msg, ...);
57 
58     BOOL started;
59     BOOL incremental;
60     WCHAR file[MAX_PATH], closetext[255];
61     HANDLE thread, dirh, stream;
62     HWND hwnd;
63     std::wstring subvol;
64     char* buf;
65     std::vector <std::wstring> clones;
66 };
67