ReactOS  0.4.14-dev-593-g1793dcc
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  num_extents = 0;
115  sector_size = 0;
116  size_format[0] = 0;
117  cr_format[0] = 0;
118  frag_format[0] = 0;
119 
121  }
122 
123  virtual ~BtrfsPropSheet() {
124  if (stgm_set) {
125  GlobalUnlock(stgm.hGlobal);
127  }
128 
130  }
131 
132  // IUnknown
133 
134  HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj);
135 
138  }
139 
142 
143  if (rc == 0)
144  delete this;
145 
146  return rc;
147  }
148 
149  // IShellExtInit
150 
151  virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject* pdtobj, HKEY hkeyProgID);
152 
153  // IShellPropSheetExt
154 
156  virtual HRESULT __stdcall ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam);
157 
158  void init_propsheet(HWND hwndDlg);
160  void change_perm_flag(HWND hDlg, ULONG perm, UINT state);
161  void change_uid(HWND hDlg, uint32_t uid);
162  void change_gid(HWND hDlg, uint32_t gid);
163  void apply_changes(HWND hDlg);
164  void set_size_on_disk(HWND hwndDlg);
166  void do_search(const wstring& fn);
167  void update_size_details_dialog(HWND hDlg);
168  void open_as_admin(HWND hwndDlg);
169  void set_cmdline(const wstring& cmdline);
170 
171  bool readonly;
183 
184 private:
186  bool ignore;
187  STGMEDIUM stgm;
188  bool stgm_set;
192  wstring filename;
194 
195  void apply_changes_file(HWND hDlg, const wstring& fn);
196  HRESULT check_file(const wstring& fn, UINT i, UINT num_files, UINT* sv);
198 };
uint64_t subvol
Definition: propsheet.h:178
void change_uid(HWND hDlg, uint32_t uid)
Definition: propsheet.cpp:775
bool uid_changed
Definition: propsheet.h:189
#define REFIID
Definition: guiddef.h:118
void set_cmdline(const wstring &cmdline)
Definition: propsheet.cpp:414
void update_size_details_dialog(HWND hDlg)
Definition: propsheet.cpp:793
WCHAR frag_format[255]
Definition: propsheet.h:174
void change_gid(HWND hDlg, uint32_t gid)
Definition: propsheet.cpp:784
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
bool various_inodes
Definition: propsheet.h:181
bool various_gids
Definition: propsheet.h:181
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
uint8_t max_compression_type
Definition: propsheet.h:179
REFIID riid
Definition: precomp.h:44
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: propsheet.cpp:73
uint64_t max_flags
Definition: propsheet.h:177
HRESULT load_file_list()
Definition: propsheet.cpp:318
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:1343
WCHAR size_format[255]
Definition: propsheet.h:174
uint64_t totalsize
Definition: propsheet.h:190
uint64_t allocsize
Definition: propsheet.h:190
void change_inode_flag(HWND hDlg, uint64_t flag, UINT state)
Definition: propsheet.cpp:583
void apply_changes_file(HWND hDlg, const wstring &fn)
Definition: propsheet.cpp:602
ULONG __stdcall Release()
Definition: propsheet.h:140
uint8_t type
Definition: propsheet.h:179
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:88
uint8_t min_compression_type
Definition: propsheet.h:179
bool has_subvols
Definition: propsheet.h:181
uint32_t mode
Definition: propsheet.h:176
long LONG
Definition: pedump.c:60
uint64_t min_flags
Definition: propsheet.h:177
LONG objs_loaded
Definition: main.cpp:48
uint64_t num_extents
Definition: propsheet.h:190
uint32_t sector_size
Definition: propsheet.h:193
DWORD search_list_thread()
Definition: propsheet.cpp:154
LONG_PTR LPARAM
Definition: windef.h:208
bool various_subvols
Definition: propsheet.h:181
uint32_t uid
Definition: propsheet.h:180
bool various_uids
Definition: propsheet.h:181
uint32_t mode_set
Definition: propsheet.h:176
wstring filename
Definition: propsheet.h:192
void set_size_on_disk(HWND hwndDlg)
Definition: propsheet.cpp:717
bool compress_type_changed
Definition: propsheet.h:181
uint32_t min_mode
Definition: propsheet.h:176
__wchar_t WCHAR
Definition: xmlstorage.h:180
bool perms_changed
Definition: propsheet.h:189
virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
Definition: propsheet.cpp:361
LONG HRESULT
Definition: typedefs.h:77
bool gid_changed
Definition: propsheet.h:189
unsigned long DWORD
Definition: ntddk_ex.h:95
#define __stdcall
Definition: typedefs.h:25
deque< wstring > search_list
Definition: propsheet.h:191
GLbitfield flags
Definition: glext.h:7161
HANDLE thread
Definition: propsheet.h:175
uint64_t sparsesize
Definition: propsheet.h:190
WCHAR cr_format[255]
Definition: propsheet.h:174
bool can_change_perms
Definition: propsheet.h:172
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:123
GLenum mode
Definition: glext.h:6217
BYTE uint8_t
Definition: msvideo1.c:66
STGMEDIUM stgm
Definition: propsheet.h:187
void change_perm_flag(HWND hDlg, ULONG perm, UINT state)
Definition: propsheet.cpp:759
uint8_t compress_type
Definition: propsheet.h:179
uint32_t gid
Definition: propsheet.h:180
bool flags_changed
Definition: propsheet.h:189
UINT64 uint64_t
Definition: types.h:77
ULONG __stdcall AddRef()
Definition: propsheet.h:136
#define InterlockedIncrement
Definition: armddk.h:53
virtual HRESULT __stdcall AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: propsheet.cpp:1300
uint64_t sizes[5]
Definition: propsheet.h:190
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
bool various_types
Definition: propsheet.h:181
UINT32 uint32_t
Definition: types.h:75
void apply_changes(HWND hDlg)
Definition: propsheet.cpp:685
bool show_admin_button
Definition: propsheet.h:181
unsigned int ULONG
Definition: retypes.h:1
void init_propsheet(HWND hwndDlg)
Definition: propsheet.cpp:919
uint32_t max_mode
Definition: propsheet.h:176
uint64_t flags_set
Definition: propsheet.h:177
uint64_t rdev
Definition: propsheet.h:178
uint64_t flags
Definition: propsheet.h:177
HRESULT check_file(const wstring &fn, UINT i, UINT num_files, UINT *sv)
Definition: propsheet.cpp:172
void open_as_admin(HWND hwndDlg)
Definition: propsheet.cpp:871
LPARAM lParam
Definition: combotst.c:139
bool can_change_nocow
Definition: propsheet.h:173
uint64_t inode
Definition: propsheet.h:178