ReactOS  r74405
contextmenu.cpp
Go to the documentation of this file.
1 /* Copyright (c) Mark Harmstone 2016
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 #ifndef __REACTOS__
19 #include <windows.h>
20 #include <winternl.h>
21 #else
22 #define WIN32_NO_STATUS
23 #include <windef.h>
24 #include <winbase.h>
25 #include <strsafe.h>
26 #include <ndk/iofuncs.h>
27 #endif
28 
29 #define NO_SHLWAPI_STRFCNS
30 #include <shlwapi.h>
31 
32 #include "contextmenu.h"
33 #include "resource.h"
34 #ifndef __REACTOS__
35 #include "../btrfsioctl.h"
36 #else
37 #include "../../drivers/filesystems/btrfs/btrfsioctl.h"
38 #endif
39 
40 #define NEW_SUBVOL_VERBA "newsubvol"
41 #define NEW_SUBVOL_VERBW L"newsubvol"
42 #define SNAPSHOT_VERBA "snapshot"
43 #define SNAPSHOT_VERBW L"snapshot"
44 
45 #ifndef __REACTOS__
46 // FIXME - is there a way to link to the proper header files without breaking everything?
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #define STATUS_SUCCESS (NTSTATUS)0x00000000
56 #endif
57 
58 typedef struct _KEY_NAME_INFORMATION {
60  WCHAR Name[1];
62 
64 
65 extern HMODULE module;
66 
67 // FIXME - don't assume subvol's top inode is 0x100
68 
70  if (riid == IID_IUnknown || riid == IID_IContextMenu) {
71  *ppObj = static_cast<IContextMenu*>(this);
72  AddRef();
73  return S_OK;
74  } else if (riid == IID_IShellExtInit) {
75  *ppObj = static_cast<IShellExtInit*>(this);
76  AddRef();
77  return S_OK;
78  }
79 
80  *ppObj = NULL;
81  return E_NOINTERFACE;
82 }
83 
85  HANDLE h;
87  btrfs_get_file_ids bgfi;
89 
90  if (!pidlFolder) {
91  FORMATETC format = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
92  UINT num_files, i;
93  WCHAR fn[MAX_PATH];
94  HDROP hdrop;
95 
96  if (!pdtobj)
97  return E_FAIL;
98 
99  stgm.tymed = TYMED_HGLOBAL;
100 
101  if (FAILED(pdtobj->GetData(&format, &stgm)))
102  return E_INVALIDARG;
103 
104  stgm_set = TRUE;
105 
106  hdrop = (HDROP)GlobalLock(stgm.hGlobal);
107 
108  if (!hdrop) {
110  stgm_set = FALSE;
111  return E_INVALIDARG;
112  }
113 
114  num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, NULL, 0);
115 
116  for (i = 0; i < num_files; i++) {
117  if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) {
119 
120  if (h != INVALID_HANDLE_VALUE) {
121  Status = NtFsControlFile(h, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_GET_FILE_IDS, NULL, 0, &bgfi, sizeof(btrfs_get_file_ids));
122 
123  if (Status == STATUS_SUCCESS && bgfi.inode == 0x100 && !bgfi.top) {
124  WCHAR parpath[MAX_PATH];
125  HANDLE h2;
126 
127  StringCchCopyW(parpath, sizeof(parpath) / sizeof(WCHAR), fn);
128 
129  PathRemoveFileSpecW(parpath);
130 
132 
133  if (h2 == INVALID_HANDLE_VALUE) {
134  CloseHandle(h);
135  return E_FAIL;
136  }
137 
138  ignore = FALSE;
139  bg = FALSE;
140 
141  CloseHandle(h2);
142  CloseHandle(h);
143  return S_OK;
144  }
145 
146  CloseHandle(h);
147  }
148  }
149  }
150 
151  return S_OK;
152  }
153 
154  if (!SHGetPathFromIDListW(pidlFolder, path))
155  return E_FAIL;
156 
157  // check we have permissions to create new subdirectory
158 
160 
161  if (h == INVALID_HANDLE_VALUE)
162  return E_FAIL;
163 
164  // check is Btrfs volume
165 
166  Status = NtFsControlFile(h, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_GET_FILE_IDS, NULL, 0, &bgfi, sizeof(btrfs_get_file_ids));
167 
168  if (Status != STATUS_SUCCESS) {
169  CloseHandle(h);
170  return E_FAIL;
171  }
172 
173  CloseHandle(h);
174 
175  ignore = FALSE;
176  bg = TRUE;
177 
178  return S_OK;
179 }
180 
182  WCHAR str[256];
183 
184  if (ignore)
185  return E_INVALIDARG;
186 
187  if (uFlags & CMF_DEFAULTONLY)
188  return S_OK;
189 
190  if (!bg) {
191  if (LoadStringW(module, IDS_CREATE_SNAPSHOT, str, sizeof(str) / sizeof(WCHAR)) == 0)
192  return E_FAIL;
193 
194  if (!InsertMenuW(hmenu, indexMenu, MF_BYPOSITION, idCmdFirst, str))
195  return E_FAIL;
196 
197  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 1);
198  }
199 
200  if (LoadStringW(module, IDS_NEW_SUBVOL, str, sizeof(str) / sizeof(WCHAR)) == 0)
201  return E_FAIL;
202 
203  if (!InsertMenuW(hmenu, indexMenu, MF_BYPOSITION, idCmdFirst, str))
204  return E_FAIL;
205 
206  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 1);
207 }
208 
209 static void ShowError(HWND hwnd, ULONG err) {
210  WCHAR* buf;
211 
213  err, 0, (WCHAR*)&buf, 0, NULL) == 0) {
214  MessageBoxW(hwnd, L"FormatMessage failed", L"Error", MB_ICONERROR);
215  return;
216  }
217 
218  MessageBoxW(hwnd, buf, L"Error", MB_ICONERROR);
219 
220  LocalFree(buf);
221 }
222 
225  HMODULE ntdll = LoadLibraryW(L"ntdll.dll");
226 
227  if (!ntdll) {
228  MessageBoxW(hwnd, L"Error loading ntdll.dll", L"Error", MB_ICONERROR);
229  return;
230  }
231 
232  RtlNtStatusToDosError = (_RtlNtStatusToDosError)GetProcAddress(ntdll, "RtlNtStatusToDosError");
233 
234  if (!ntdll) {
235  MessageBoxW(hwnd, L"Error loading RtlNtStatusToDosError in ntdll.dll", L"Error", MB_ICONERROR);
236  FreeLibrary(ntdll);
237  return;
238  }
239 
240  ShowError(hwnd, RtlNtStatusToDosError(Status));
241 
242  FreeLibrary(ntdll);
243 }
244 
245 static void create_snapshot(HWND hwnd, WCHAR* fn) {
246  HANDLE h;
249  btrfs_get_file_ids bgfi;
250 
252 
253  if (h != INVALID_HANDLE_VALUE) {
254  Status = NtFsControlFile(h, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_GET_FILE_IDS, NULL, 0, &bgfi, sizeof(btrfs_get_file_ids));
255 
256  if (Status == STATUS_SUCCESS && bgfi.inode == 0x100 && !bgfi.top) {
257  WCHAR parpath[MAX_PATH], subvolname[MAX_PATH], templ[MAX_PATH], name[MAX_PATH], searchpath[MAX_PATH];
258  HANDLE h2, fff;
260  ULONG namelen, pathend;
261  WIN32_FIND_DATAW wfd;
263 
264  StringCchCopyW(parpath, sizeof(parpath) / sizeof(WCHAR), fn);
265  PathRemoveFileSpecW(parpath);
266 
267  StringCchCopyW(subvolname, sizeof(subvolname) / sizeof(WCHAR), fn);
268  PathStripPathW(subvolname);
269 
271 
272  if (h2 == INVALID_HANDLE_VALUE) {
273  ShowError(hwnd, GetLastError());
274  CloseHandle(h);
275  return;
276  }
277 
279  ShowError(hwnd, GetLastError());
280  CloseHandle(h);
281  CloseHandle(h2);
282  return;
283  }
284 
285  GetLocalTime(&time);
286 
287  if (StringCchPrintfW(name, sizeof(name) / sizeof(WCHAR), templ, subvolname, time.wYear, time.wMonth, time.wDay) == STRSAFE_E_INSUFFICIENT_BUFFER) {
288  MessageBoxW(hwnd, L"Filename too long.\n", L"Error", MB_ICONERROR);
289  CloseHandle(h);
290  CloseHandle(h2);
291  return;
292  }
293 
294  StringCchCopyW(searchpath, sizeof(searchpath) / sizeof(WCHAR), parpath);
295  StringCchCatW(searchpath, sizeof(searchpath) / sizeof(WCHAR), L"\\");
296  pathend = wcslen(searchpath);
297 
298  StringCchCatW(searchpath, sizeof(searchpath) / sizeof(WCHAR), name);
299 
300  fff = FindFirstFileW(searchpath, &wfd);
301 
302  if (fff != INVALID_HANDLE_VALUE) {
303  ULONG i = wcslen(searchpath), num = 2;
304 
305  do {
306  FindClose(fff);
307 
308  searchpath[i] = 0;
309  if (StringCchPrintfW(searchpath, sizeof(searchpath) / sizeof(WCHAR), L"%s (%u)", searchpath, num) == STRSAFE_E_INSUFFICIENT_BUFFER) {
310  MessageBoxW(hwnd, L"Filename too long.\n", L"Error", MB_ICONERROR);
311  CloseHandle(h);
312  CloseHandle(h2);
313  return;
314  }
315 
316  fff = FindFirstFileW(searchpath, &wfd);
317  num++;
318  } while (fff != INVALID_HANDLE_VALUE);
319  }
320 
321  namelen = wcslen(&searchpath[pathend]) * sizeof(WCHAR);
322 
324  bcs->subvol = h;
325  bcs->namelen = namelen;
326  memcpy(bcs->name, &searchpath[pathend], namelen);
327 
328  Status = NtFsControlFile(h2, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_CREATE_SNAPSHOT, NULL, 0, bcs, sizeof(btrfs_create_snapshot) - 1 + namelen);
329 
330  if (Status != STATUS_SUCCESS)
331  ShowNtStatusError(hwnd, Status);
332 
333  CloseHandle(h2);
334  }
335 
336  CloseHandle(h);
337  } else
338  ShowError(hwnd, GetLastError());
339 }
340 
342  if (ignore)
343  return E_INVALIDARG;
344 
345  if (!bg) {
346  if ((IS_INTRESOURCE(pici->lpVerb) && pici->lpVerb == 0) || !strcmp(pici->lpVerb, SNAPSHOT_VERBA)) {
347  UINT num_files, i;
348  WCHAR fn[MAX_PATH];
349 
350  if (!stgm_set)
351  return E_FAIL;
352 
353  num_files = DragQueryFileW((HDROP)stgm.hGlobal, 0xFFFFFFFF, NULL, 0);
354 
355  if (num_files == 0)
356  return E_FAIL;
357 
358  for (i = 0; i < num_files; i++) {
359  if (DragQueryFileW((HDROP)stgm.hGlobal, i, fn, sizeof(fn) / sizeof(MAX_PATH))) {
360  create_snapshot(pici->hwnd, fn);
361  }
362  }
363 
364  return S_OK;
365  }
366 
367  return E_FAIL;
368  }
369 
370  if ((IS_INTRESOURCE(pici->lpVerb) && pici->lpVerb == 0) || !strcmp(pici->lpVerb, NEW_SUBVOL_VERBA)) {
371  HANDLE h;
374  ULONG pathlen, searchpathlen, pathend;
375  WCHAR name[MAX_PATH], *searchpath;
376  HANDLE fff;
377  WIN32_FIND_DATAW wfd;
378 
380  ShowError(pici->hwnd, GetLastError());
381  return E_FAIL;
382  }
383 
385 
386  if (h == INVALID_HANDLE_VALUE) {
387  ShowError(pici->hwnd, GetLastError());
388  return E_FAIL;
389  }
390 
391  pathlen = wcslen(path);
392 
393  searchpathlen = pathlen + wcslen(name) + 10;
394  searchpath = (WCHAR*)malloc(searchpathlen * sizeof(WCHAR));
395 
396  StringCchCopyW(searchpath, searchpathlen, path);
397  StringCchCatW(searchpath, searchpathlen, L"\\");
398  pathend = wcslen(searchpath);
399 
400  StringCchCatW(searchpath, searchpathlen, name);
401 
402  fff = FindFirstFileW(searchpath, &wfd);
403 
404  if (fff != INVALID_HANDLE_VALUE) {
405  ULONG i = wcslen(searchpath), num = 2;
406 
407  do {
408  FindClose(fff);
409 
410  searchpath[i] = 0;
411  if (StringCchPrintfW(searchpath, searchpathlen, L"%s (%u)", searchpath, num) == STRSAFE_E_INSUFFICIENT_BUFFER) {
412  MessageBoxW(pici->hwnd, L"Filename too long.\n", L"Error", MB_ICONERROR);
413  CloseHandle(h);
414  return E_FAIL;
415  }
416 
417  fff = FindFirstFileW(searchpath, &wfd);
418  num++;
419  } while (fff != INVALID_HANDLE_VALUE);
420  }
421 
422  Status = NtFsControlFile(h, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_CREATE_SUBVOL, NULL, 0, &searchpath[pathend], wcslen(&searchpath[pathend]) * sizeof(WCHAR));
423 
424  free(searchpath);
425 
426  if (Status != STATUS_SUCCESS) {
427  CloseHandle(h);
428  ShowNtStatusError(pici->hwnd, Status);
429  return E_FAIL;
430  }
431 
432  CloseHandle(h);
433 
434  return S_OK;
435  }
436 
437  return E_FAIL;
438 }
439 
441  if (ignore)
442  return E_INVALIDARG;
443 
444  if (idCmd != 0)
445  return E_INVALIDARG;
446 
447  switch (uFlags) {
448  case GCS_HELPTEXTA:
450  return S_OK;
451  else
452  return E_FAIL;
453 
454  case GCS_HELPTEXTW:
455  if (LoadStringW(module, bg ? IDS_NEW_SUBVOL_HELP_TEXT : IDS_CREATE_SNAPSHOT_HELP_TEXT, (LPWSTR)pszName, cchMax))
456  return S_OK;
457  else
458  return E_FAIL;
459 
460  case GCS_VALIDATEA:
461  case GCS_VALIDATEW:
462  return S_OK;
463 
464  case GCS_VERBA:
465  return StringCchCopyA(pszName, cchMax, bg ? NEW_SUBVOL_VERBA : SNAPSHOT_VERBA);
466 
467  case GCS_VERBW:
468  return StringCchCopyW((STRSAFE_LPWSTR)pszName, cchMax, bg ? NEW_SUBVOL_VERBW : SNAPSHOT_VERBW);
469 
470  default:
471  return E_INVALIDARG;
472  }
473 }
DWORD *typedef PVOID
Definition: winlogon.h:52
#define STATUS_SUCCESS
Definition: contextmenu.cpp:55
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
Definition: iofuncs.h:719
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:598
#define REFIID
Definition: guiddef.h:113
#define CloseHandle
Definition: compat.h:398
ULONG __stdcall AddRef()
Definition: contextmenu.h:44
VOID(* PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
Definition: nt_native.h:877
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
void WINAPI PathStripPathW(LPWSTR lpszPath)
Definition: path.c:663
static HMENU hmenu
Definition: win.c:79
virtual HRESULT __stdcall QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
Definition: bidi.c:75
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2000
USHORT wMonth
Definition: rtltypes.h:1568
#define NEW_SUBVOL_VERBW
Definition: contextmenu.cpp:41
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
virtual HRESULT __stdcall GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180
REFIID riid
Definition: precomp.h:44
#define free
Definition: debug_ros.c:5
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
#define IDS_SNAPSHOT_FILENAME
Definition: resource.h:12
HMODULE module
Definition: main.cpp:35
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1245
#define TRUE
Definition: numbers.c:17
HANDLE HWND
Definition: compat.h:13
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1041
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define NTSYSCALLAPI
Definition: ntbasedef.h:196
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:63
__u16 time
Definition: mkdosfs.c:366
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
char * LPSTR
Definition: xmlstorage.h:182
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:548
#define WCHAR
Definition: msvc.h:43
#define E_FAIL
Definition: ddrawi.h:102
GLint namelen
Definition: glext.h:7232
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
#define SEVERITY_SUCCESS
Definition: winerror.h:64
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define FILE_SHARE_READ
Definition: compat.h:125
#define SNAPSHOT_VERBA
Definition: contextmenu.cpp:42
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
virtual HRESULT __stdcall InvokeCommand(LPCMINVOKECOMMANDINFO pici)
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
struct _KEY_NAME_INFORMATION KEY_NAME_INFORMATION
#define FILE_TRAVERSE
Definition: nt_native.h:643
USHORT wYear
Definition: rtltypes.h:1567
GLenum GLclampf GLint i
Definition: glfuncs.h:14
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
int int int * err
Definition: fci.h:172
#define FSCTL_BTRFS_CREATE_SNAPSHOT
Definition: btrfsioctl.h:8
#define MF_BYPOSITION
Definition: winuser.h:203
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
void ShowNtStatusError(HWND hwnd, NTSTATUS Status)
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:391
#define IDS_NEW_SUBVOL_HELP_TEXT
Definition: resource.h:6
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:464
#define CF_HDROP
Definition: constants.h:397
#define IDS_CREATE_SNAPSHOT
Definition: resource.h:10
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:395
#define OPEN_EXISTING
Definition: compat.h:426
#define FSCTL_BTRFS_CREATE_SUBVOL
Definition: btrfsioctl.h:7
STGMEDIUM stgm
Definition: contextmenu.h:72
#define FreeLibrary(x)
Definition: compat.h:405
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
virtual HRESULT __stdcall Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
Definition: contextmenu.cpp:84
LONG HRESULT
Definition: typedefs.h:78
HANDLE HKEY
Definition: registry.h:24
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define MAX_PATH
Definition: compat.h:26
GLuint GLuint num
Definition: glext.h:9618
#define __stdcall
Definition: typedefs.h:26
static PIO_STATUS_BLOCK iosb
Definition: file.c:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
UINT cchMax
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE ApcRoutine
Definition: iofuncs.h:719
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define SNAPSHOT_VERBW
Definition: contextmenu.cpp:43
#define MB_ICONERROR
Definition: winuser.h:781
#define FILE_ADD_SUBDIRECTORY
Definition: nt_native.h:635
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define FSCTL_BTRFS_GET_FILE_IDS
Definition: btrfsioctl.h:6
#define WINAPI
Definition: msvc.h:20
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:392
static HANDLE FileHandle
Definition: cabinet.c:47
USHORT wDay
Definition: rtltypes.h:1570
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
#define NEW_SUBVOL_VERBA
Definition: contextmenu.cpp:40
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
LONG NTSTATUS
Definition: DriverTester.h:11
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
ULONG(WINAPI * _RtlNtStatusToDosError)(NTSTATUS Status)
Definition: contextmenu.cpp:63
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
Definition: services.c:311
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
unsigned int UINT
Definition: ndis.h:50
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG FsControlCode
Definition: fltkernel.h:1369
#define CreateFileW
Definition: compat.h:400
HANDLE HMODULE
Definition: typedefs.h:76
DWORD UINT uFlags
Definition: wglext.h:734
Definition: name.c:23
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FALSE
Definition: numbers.c:16
#define IDS_NEW_SUBVOL
Definition: resource.h:7
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define GetProcAddress(x, y)
Definition: compat.h:410
#define malloc
Definition: debug_ros.c:4
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: contextmenu.cpp:69
#define IDS_NEW_SUBVOL_FILENAME
Definition: resource.h:9
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:68
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
static void ShowError(HWND hwnd, ULONG err)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IDS_CREATE_SNAPSHOT_HELP_TEXT
Definition: resource.h:11
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:318
static void create_snapshot(HWND hwnd, WCHAR *fn)
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:500