ReactOS  0.4.14-dev-49-gfb4591c
propsheet.h
Go to the documentation of this file.
1 /* Copyright (c) Mark Harmstone 2016-17
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 #include <shlobj.h>
21 #include <deque>
22 #ifndef __REACTOS__
23 #include "../btrfsioctl.h"
24 #else
25 #include "btrfsioctl.h"
26 #endif
27 
28 #ifndef S_IRUSR
29 #define S_IRUSR 0000400
30 #endif
31 
32 #ifndef S_IWUSR
33 #define S_IWUSR 0000200
34 #endif
35 
36 #ifndef S_IXUSR
37 #define S_IXUSR 0000100
38 #endif
39 
40 #ifndef S_IRGRP
41 #define S_IRGRP (S_IRUSR >> 3)
42 #endif
43 
44 #ifndef S_IWGRP
45 #define S_IWGRP (S_IWUSR >> 3)
46 #endif
47 
48 #ifndef S_IXGRP
49 #define S_IXGRP (S_IXUSR >> 3)
50 #endif
51 
52 #ifndef S_IROTH
53 #define S_IROTH (S_IRGRP >> 3)
54 #endif
55 
56 #ifndef S_IWOTH
57 #define S_IWOTH (S_IWGRP >> 3)
58 #endif
59 
60 #ifndef S_IXOTH
61 #define S_IXOTH (S_IXGRP >> 3)
62 #endif
63 
64 #ifndef S_ISUID
65 #define S_ISUID 0004000
66 #endif
67 
68 #ifndef S_ISGID
69 #define S_ISGID 0002000
70 #endif
71 
72 #ifndef S_ISVTX
73 #define S_ISVTX 0001000
74 #endif
75 
76 #define BTRFS_INODE_NODATASUM 0x001
77 #define BTRFS_INODE_NODATACOW 0x002
78 #define BTRFS_INODE_READONLY 0x004
79 #define BTRFS_INODE_NOCOMPRESS 0x008
80 #define BTRFS_INODE_PREALLOC 0x010
81 #define BTRFS_INODE_SYNC 0x020
82 #define BTRFS_INODE_IMMUTABLE 0x040
83 #define BTRFS_INODE_APPEND 0x080
84 #define BTRFS_INODE_NODUMP 0x100
85 #define BTRFS_INODE_NOATIME 0x200
86 #define BTRFS_INODE_DIRSYNC 0x400
87 #define BTRFS_INODE_COMPRESS 0x800
88 
89 extern LONG objs_loaded;
90 
92 public:
94  refcount = 0;
95  ignore = true;
96  stgm_set = false;
97  readonly = false;
98  flags_changed = false;
99  perms_changed = false;
100  uid_changed = false;
101  gid_changed = false;
102  compress_type_changed = false;
103  ro_changed = false;
104  can_change_perms = false;
105  show_admin_button = false;
106  thread = nullptr;
107  mode = mode_set = 0;
108  flags = flags_set = 0;
109  has_subvols = false;
110  filename = L"";
111 
112  sizes[0] = sizes[1] = sizes[2] = sizes[3] = sizes[4] = 0;
114  size_format[0] = 0;
115  cr_format[0] = 0;
116 
118  }
119 
120  virtual ~BtrfsPropSheet() {
121  if (stgm_set) {
122  GlobalUnlock(stgm.hGlobal);
124  }
125 
127  }
128 
129  // IUnknown
130 
131  HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj);
132 
135  }
136 
139 
140  if (rc == 0)
141  delete this;
142 
143  return rc;
144  }
145 
146  // IShellExtInit
147 
148  virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject* pdtobj, HKEY hkeyProgID);
149 
150  // IShellPropSheetExt
151 
153  virtual HRESULT __stdcall ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam);
154 
155  void init_propsheet(HWND hwndDlg);
157  void change_perm_flag(HWND hDlg, ULONG perm, UINT state);
158  void change_uid(HWND hDlg, uint32_t uid);
159  void change_gid(HWND hDlg, uint32_t gid);
160  void apply_changes(HWND hDlg);
161  void set_size_on_disk(HWND hwndDlg);
163  void do_search(const wstring& fn);
164  void update_size_details_dialog(HWND hDlg);
165  void open_as_admin(HWND hwndDlg);
166  void set_cmdline(const wstring& cmdline);
167 
168  bool readonly;
180 
181 private:
183  bool ignore;
184  STGMEDIUM stgm;
185  bool stgm_set;
189  wstring filename;
190 
191  void apply_changes_file(HWND hDlg, const wstring& fn);
192  HRESULT check_file(const wstring& fn, UINT i, UINT num_files, UINT* sv);
194 };
uint64_t subvol
Definition: propsheet.h:175
void change_uid(HWND hDlg, uint32_t uid)
Definition: propsheet.cpp:738
bool uid_changed
Definition: propsheet.h:186
#define REFIID
Definition: guiddef.h:118
void set_cmdline(const wstring &cmdline)
Definition: propsheet.cpp:393
void update_size_details_dialog(HWND hDlg)
Definition: propsheet.cpp:756
void change_gid(HWND hDlg, uint32_t gid)
Definition: propsheet.cpp:747
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2036
bool various_inodes
Definition: propsheet.h:178
bool various_gids
Definition: propsheet.h:178
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
uint8_t max_compression_type
Definition: propsheet.h:176
REFIID riid
Definition: precomp.h:44
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: propsheet.cpp:66
uint64_t max_flags
Definition: propsheet.h:174
HRESULT load_file_list()
Definition: propsheet.cpp:297
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:309
TCHAR * cmdline
Definition: stretchblt.cpp:32
const char * filename
Definition: ioapi.h:135
virtual HRESULT __stdcall ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
Definition: propsheet.cpp:1303
WCHAR size_format[255]
Definition: propsheet.h:171
uint64_t totalsize
Definition: propsheet.h:187
uint64_t allocsize
Definition: propsheet.h:187
void change_inode_flag(HWND hDlg, uint64_t flag, UINT state)
Definition: propsheet.cpp:562
void apply_changes_file(HWND hDlg, const wstring &fn)
Definition: propsheet.cpp:581
ULONG __stdcall Release()
Definition: propsheet.h:137
uint8_t type
Definition: propsheet.h:176
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void do_search(const wstring &fn)
Definition: propsheet.cpp:81
uint8_t min_compression_type
Definition: propsheet.h:176
bool has_subvols
Definition: propsheet.h:178
uint32_t mode
Definition: propsheet.h:173
long LONG
Definition: pedump.c:60
uint64_t min_flags
Definition: propsheet.h:174
LONG objs_loaded
Definition: main.cpp:48
DWORD search_list_thread()
Definition: propsheet.cpp:146
LONG_PTR LPARAM
Definition: windef.h:208
bool various_subvols
Definition: propsheet.h:178
uint32_t uid
Definition: propsheet.h:177
bool various_uids
Definition: propsheet.h:178
uint32_t mode_set
Definition: propsheet.h:173
wstring filename
Definition: propsheet.h:189
void set_size_on_disk(HWND hwndDlg)
Definition: propsheet.cpp:695
bool compress_type_changed
Definition: propsheet.h:178
uint32_t min_mode
Definition: propsheet.h:173
__wchar_t WCHAR
Definition: xmlstorage.h:180
bool perms_changed
Definition: propsheet.h:186
virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
Definition: propsheet.cpp:340
LONG HRESULT
Definition: typedefs.h:77
bool gid_changed
Definition: propsheet.h:186
unsigned long DWORD
Definition: ntddk_ex.h:95
#define __stdcall
Definition: typedefs.h:25
deque< wstring > search_list
Definition: propsheet.h:188
GLbitfield flags
Definition: glext.h:7161
HANDLE thread
Definition: propsheet.h:172
uint64_t sparsesize
Definition: propsheet.h:187
WCHAR cr_format[255]
Definition: propsheet.h:171
bool can_change_perms
Definition: propsheet.h:169
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
static int state
Definition: maze.c:121
virtual ~BtrfsPropSheet()
Definition: propsheet.h:120
GLenum mode
Definition: glext.h:6217
BYTE uint8_t
Definition: msvideo1.c:66
STGMEDIUM stgm
Definition: propsheet.h:184
void change_perm_flag(HWND hDlg, ULONG perm, UINT state)
Definition: propsheet.cpp:722
uint8_t compress_type
Definition: propsheet.h:176
uint32_t gid
Definition: propsheet.h:177
bool flags_changed
Definition: propsheet.h:186
UINT64 uint64_t
Definition: types.h:77
ULONG __stdcall AddRef()
Definition: propsheet.h:133
#define InterlockedIncrement
Definition: armddk.h:53
virtual HRESULT __stdcall AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: propsheet.cpp:1260
uint64_t sizes[5]
Definition: propsheet.h:187
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
bool various_types
Definition: propsheet.h:178
UINT32 uint32_t
Definition: types.h:75
void apply_changes(HWND hDlg)
Definition: propsheet.cpp:663
bool show_admin_button
Definition: propsheet.h:178
unsigned int ULONG
Definition: retypes.h:1
void init_propsheet(HWND hwndDlg)
Definition: propsheet.cpp:882
uint32_t max_mode
Definition: propsheet.h:173
uint64_t flags_set
Definition: propsheet.h:174
uint64_t rdev
Definition: propsheet.h:175
uint64_t flags
Definition: propsheet.h:174
HRESULT check_file(const wstring &fn, UINT i, UINT num_files, UINT *sv)
Definition: propsheet.cpp:164
void open_as_admin(HWND hwndDlg)
Definition: propsheet.cpp:834
LPARAM lParam
Definition: combotst.c:139
bool can_change_nocow
Definition: propsheet.h:170
uint64_t inode
Definition: propsheet.h:175