ReactOS  0.4.14-dev-41-g31d7680
contextmenu.cpp File Reference
#include "shellext.h"
#include <windows.h>
#include <strsafe.h>
#include <stddef.h>
#include <winternl.h>
#include <wincodec.h>
#include <sstream>
#include <iostream>
#include <shlwapi.h>
#include "contextmenu.h"
#include "resource.h"
#include "../btrfsioctl.h"
Include dependency graph for contextmenu.cpp:

Go to the source code of this file.

Classes

struct  reparse_header
 

Macros

#define NO_SHLWAPI_STRFCNS
 
#define NEW_SUBVOL_VERBA   "newsubvol"
 
#define NEW_SUBVOL_VERBW   L"newsubvol"
 
#define SNAPSHOT_VERBA   "snapshot"
 
#define SNAPSHOT_VERBW   L"snapshot"
 
#define REFLINK_VERBA   "reflink"
 
#define REFLINK_VERBW   L"reflink"
 
#define RECV_VERBA   "recvsubvol"
 
#define RECV_VERBW   L"recvsubvol"
 
#define SEND_VERBA   "sendsubvol"
 
#define SEND_VERBW   L"sendsubvol"
 

Functions

static void path_remove_file (wstring &path)
 
static bool get_volume_path_parent (const WCHAR *fn, WCHAR *volpath, ULONG volpathlen)
 
static bool show_reflink_paste (const wstring &path)
 
static void InitBitmapInfo (BITMAPINFO *pbmi, ULONG cbInfo, LONG cx, LONG cy, WORD bpp)
 
static HRESULT Create32BitHBITMAP (HDC hdc, const SIZE *psize, void **ppvBits, HBITMAP *phBmp)
 
static void path_strip_path (wstring &path)
 
static void create_snapshot (HWND hwnd, const wstring &fn)
 
static uint64_t __inline sector_align (uint64_t n, uint64_t a)
 
static void reflink_copy2 (const wstring &srcfn, const wstring &destdir, const wstring &destname)
 
void CALLBACK ReflinkCopyW (HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
 

Macro Definition Documentation

◆ NEW_SUBVOL_VERBA

#define NEW_SUBVOL_VERBA   "newsubvol"

Definition at line 49 of file contextmenu.cpp.

◆ NEW_SUBVOL_VERBW

#define NEW_SUBVOL_VERBW   L"newsubvol"

Definition at line 50 of file contextmenu.cpp.

◆ NO_SHLWAPI_STRFCNS

#define NO_SHLWAPI_STRFCNS

Definition at line 38 of file contextmenu.cpp.

◆ RECV_VERBA

#define RECV_VERBA   "recvsubvol"

Definition at line 55 of file contextmenu.cpp.

◆ RECV_VERBW

#define RECV_VERBW   L"recvsubvol"

Definition at line 56 of file contextmenu.cpp.

◆ REFLINK_VERBA

#define REFLINK_VERBA   "reflink"

Definition at line 53 of file contextmenu.cpp.

◆ REFLINK_VERBW

#define REFLINK_VERBW   L"reflink"

Definition at line 54 of file contextmenu.cpp.

◆ SEND_VERBA

#define SEND_VERBA   "sendsubvol"

Definition at line 57 of file contextmenu.cpp.

◆ SEND_VERBW

#define SEND_VERBW   L"sendsubvol"

Definition at line 58 of file contextmenu.cpp.

◆ SNAPSHOT_VERBA

#define SNAPSHOT_VERBA   "snapshot"

Definition at line 51 of file contextmenu.cpp.

◆ SNAPSHOT_VERBW

#define SNAPSHOT_VERBW   L"snapshot"

Definition at line 52 of file contextmenu.cpp.

Function Documentation

◆ Create32BitHBITMAP()

static HRESULT Create32BitHBITMAP ( HDC  hdc,
const SIZE psize,
void **  ppvBits,
HBITMAP phBmp 
)
static

Definition at line 275 of file contextmenu.cpp.

275  {
276  BITMAPINFO bmi;
277  HDC hdcUsed;
278 
279  *phBmp = nullptr;
280 
281  InitBitmapInfo(&bmi, sizeof(bmi), psize->cx, psize->cy, 32);
282 
283  hdcUsed = hdc ? hdc : GetDC(nullptr);
284 
285  if (hdcUsed) {
286  *phBmp = CreateDIBSection(hdcUsed, &bmi, DIB_RGB_COLORS, ppvBits, nullptr, 0);
287  if (hdc != hdcUsed)
288  ReleaseDC(nullptr, hdcUsed);
289  }
290 
291  return !*phBmp ? E_OUTOFMEMORY : S_OK;
292 }
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG cx
Definition: windef.h:319
HDC hdc
Definition: main.c:9
#define S_OK
Definition: intsafe.h:59
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
static void InitBitmapInfo(BITMAPINFO *pbmi, ULONG cbInfo, LONG cx, LONG cy, WORD bpp)
#define DIB_RGB_COLORS
Definition: wingdi.h:366
LONG cy
Definition: windef.h:320

Referenced by BtrfsContextMenu::get_uac_icon().

◆ create_snapshot()

static void create_snapshot ( HWND  hwnd,
const wstring &  fn 
)
static

Definition at line 451 of file contextmenu.cpp.

451  {
452  win_handle h;
455  btrfs_get_file_ids bgfi;
456 
458 
459  if (h != INVALID_HANDLE_VALUE) {
460  Status = NtFsControlFile(h, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_FILE_IDS, nullptr, 0, &bgfi, sizeof(btrfs_get_file_ids));
461 
462  if (NT_SUCCESS(Status) && bgfi.inode == 0x100 && !bgfi.top) {
463  wstring subvolname, parpath, searchpath, temp1, name, nameorig;
464  win_handle h2;
466  ULONG namelen;
467  WIN32_FIND_DATAW wfd;
469 
470  parpath = fn;
471  path_remove_file(parpath);
472 
473  subvolname = fn;
474  path_strip_path(subvolname);
475 
477 
478  if (h2 == INVALID_HANDLE_VALUE)
479  throw last_error(GetLastError());
480 
482  throw last_error(GetLastError());
483 
484  GetLocalTime(&time);
485 
486  wstring_sprintf(name, temp1, subvolname.c_str(), time.wYear, time.wMonth, time.wDay);
487  nameorig = name;
488 
489  searchpath = parpath + L"\\" + name;
490 
491  fff_handle fff = FindFirstFileW(searchpath.c_str(), &wfd);
492 
493  if (fff != INVALID_HANDLE_VALUE) {
494  ULONG num = 2;
495 
496  do {
497 #ifndef __REACTOS__
498  name = nameorig + L" (" + to_wstring(num) + L")";
499 #else
500  {
501  WCHAR buffer[32];
502 
503  swprintf(buffer, L"%d", num);
504  name = nameorig + L" (" + buffer + L")";
505  }
506 #endif
507  searchpath = parpath + L"\\" + name;
508 
509  fff = FindFirstFileW(searchpath.c_str(), &wfd);
510  num++;
511  } while (fff != INVALID_HANDLE_VALUE);
512  }
513 
514  namelen = name.length() * sizeof(WCHAR);
515 
517  bcs->readonly = false;
518  bcs->posix = false;
519  bcs->subvol = h;
520  bcs->namelen = (uint16_t)namelen;
521  memcpy(bcs->name, name.c_str(), namelen);
522 
523  Status = NtFsControlFile(h2, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_CREATE_SNAPSHOT, bcs, sizeof(btrfs_create_snapshot) - 1 + namelen, nullptr, 0);
524 
525  if (!NT_SUCCESS(Status))
526  throw ntstatus_error(Status);
527  }
528  } else
529  throw last_error(GetLastError());
530 }
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define IDS_SNAPSHOT_FILENAME
Definition: resource.h:14
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
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)
__u16 time
Definition: mkdosfs.c:366
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define uint16_t
Definition: nsiface.idl:60
GLint namelen
Definition: glext.h:7232
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FILE_TRAVERSE
Definition: nt_native.h:643
#define FSCTL_BTRFS_CREATE_SNAPSHOT
Definition: btrfsioctl.h:9
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
#define OPEN_EXISTING
Definition: compat.h:426
void wstring_sprintf(wstring &s, wstring fmt,...)
Definition: main.cpp:225
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define swprintf(buf, format,...)
Definition: sprintf.c:56
GLuint GLuint num
Definition: glext.h:9618
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
#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:7
Status
Definition: gdiplustypes.h:24
static void path_remove_file(wstring &path)
static void path_strip_path(wstring &path)
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define CreateFileW
Definition: compat.h:400
Definition: name.c:36
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by BtrfsContextMenu::InvokeCommand().

◆ get_volume_path_parent()

static bool get_volume_path_parent ( const WCHAR fn,
WCHAR volpath,
ULONG  volpathlen 
)
static

Definition at line 185 of file contextmenu.cpp.

185  {
186  WCHAR *f, *p;
187  bool b;
188 
190 
191  if (f == fn)
192  return GetVolumePathNameW(fn, volpath, volpathlen);
193 
194  p = (WCHAR*)malloc((f - fn + 1) * sizeof(WCHAR));
195  memcpy(p, fn, (f - fn) * sizeof(WCHAR));
196  p[f - fn] = 0;
197 
198  b = GetVolumePathNameW(p, volpath, volpathlen);
199 
200  free(p);
201 
202  return b;
203 }
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define free
Definition: debug_ros.c:5
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:815
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
#define b
Definition: ke_i.h:79
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define f
Definition: ke_i.h:83
#define malloc
Definition: debug_ros.c:4
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by BtrfsContextMenu::reflink_copy(), ReflinkCopyW(), and show_reflink_paste().

◆ InitBitmapInfo()

static void InitBitmapInfo ( BITMAPINFO pbmi,
ULONG  cbInfo,
LONG  cx,
LONG  cy,
WORD  bpp 
)
static

Definition at line 264 of file contextmenu.cpp.

264  {
265  ZeroMemory(pbmi, cbInfo);
267  pbmi->bmiHeader.biPlanes = 1;
269 
273 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
_In_ HBITMAP _In_ UINT _In_ UINT _Inout_ LPBITMAPINFO pbmi
Definition: ntgdi.h:2780
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define ZeroMemory
Definition: winbase.h:1635
DWORD biCompression
Definition: amvideo.idl:35
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
_Out_opt_ int * cx
Definition: commctrl.h:570
DWORD bpp
Definition: surface.c:181
#define BI_RGB
Definition: precomp.h:34

Referenced by Create32BitHBITMAP().

◆ path_remove_file()

static void path_remove_file ( wstring &  path)
static

Definition at line 426 of file contextmenu.cpp.

426  {
427  size_t bs = path.rfind(L"\\");
428 
429  if (bs == string::npos)
430  return;
431 
432  if (bs == path.find(L"\\")) { // only one backslash
433  path = path.substr(0, bs + 1);
434  return;
435  }
436 
437  path = path.substr(0, bs);
438 }
static const size_t npos
Definition: _string_npos.h:26
static const WCHAR L[]
Definition: oid.c:1250
Definition: services.c:325
static struct msdos_boot_sector bs
Definition: mkdosfs.c:539

Referenced by create_snapshot(), and BtrfsContextMenu::Initialize().

◆ path_strip_path()

static void path_strip_path ( wstring &  path)
static

Definition at line 440 of file contextmenu.cpp.

440  {
441  size_t bs = path.rfind(L"\\");
442 
443  if (bs == string::npos) {
444  path = L"";
445  return;
446  }
447 
448  path = path.substr(bs + 1);
449 }
static const size_t npos
Definition: _string_npos.h:26
static const WCHAR L[]
Definition: oid.c:1250
Definition: services.c:325
static struct msdos_boot_sector bs
Definition: mkdosfs.c:539

Referenced by create_snapshot().

◆ reflink_copy2()

static void reflink_copy2 ( const wstring &  srcfn,
const wstring &  destdir,
const wstring &  destname 
)
static

Definition at line 1301 of file contextmenu.cpp.

1301  {
1303  FILE_BASIC_INFO fbi;
1304  FILETIME atime, mtime;
1305  btrfs_inode_info bii;
1306  btrfs_set_inode_info bsii;
1307  ULONG bytesret;
1308  NTSTATUS Status;
1310  btrfs_set_xattr bsxa;
1311 
1314  throw last_error(GetLastError());
1315 
1316  Status = NtFsControlFile(source, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_INODE_INFO, nullptr, 0, &bii, sizeof(btrfs_inode_info));
1317  if (!NT_SUCCESS(Status))
1318  throw ntstatus_error(Status);
1319 
1320  // if subvol, do snapshot instead
1321  if (bii.inode == SUBVOL_ROOT_INODE) {
1322  ULONG bcslen;
1323  btrfs_create_snapshot* bcs;
1324  win_handle dirh;
1325 
1327  if (dirh == INVALID_HANDLE_VALUE)
1328  throw last_error(GetLastError());
1329 
1330  bcslen = offsetof(btrfs_create_snapshot, name[0]) + (destname.length() * sizeof(WCHAR));
1331  bcs = (btrfs_create_snapshot*)malloc(bcslen);
1332  bcs->subvol = source;
1333  bcs->namelen = (uint16_t)(destname.length() * sizeof(WCHAR));
1334  memcpy(bcs->name, destname.c_str(), destname.length() * sizeof(WCHAR));
1335 
1336  Status = NtFsControlFile(dirh, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_CREATE_SNAPSHOT, bcs, bcslen, nullptr, 0);
1337  if (!NT_SUCCESS(Status)) {
1338  free(bcs);
1339  throw ntstatus_error(Status);
1340  }
1341 
1342  free(bcs);
1343 
1344  return;
1345  }
1346 
1347  if (!GetFileInformationByHandleEx(source, FileBasicInfo, &fbi, sizeof(FILE_BASIC_INFO)))
1348  throw last_error(GetLastError());
1349 
1350  if (bii.type == BTRFS_TYPE_CHARDEV || bii.type == BTRFS_TYPE_BLOCKDEV || bii.type == BTRFS_TYPE_FIFO || bii.type == BTRFS_TYPE_SOCKET) {
1351  win_handle dirh;
1352  ULONG bmnsize;
1353  btrfs_mknod* bmn;
1354 
1356  if (dirh == INVALID_HANDLE_VALUE)
1357  throw last_error(GetLastError());
1358 
1359  bmnsize = offsetof(btrfs_mknod, name[0]) + (destname.length() * sizeof(WCHAR));
1360  bmn = (btrfs_mknod*)malloc(bmnsize);
1361 
1362  bmn->inode = 0;
1363  bmn->type = bii.type;
1364  bmn->st_rdev = bii.st_rdev;
1365  bmn->namelen = (uint16_t)(destname.length() * sizeof(WCHAR));
1366  memcpy(bmn->name, destname.c_str(), bmn->namelen);
1367 
1368  Status = NtFsControlFile(dirh, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_MKNOD, bmn, bmnsize, nullptr, 0);
1369  if (!NT_SUCCESS(Status)) {
1370  free(bmn);
1371  throw ntstatus_error(Status);
1372  }
1373 
1374  free(bmn);
1375 
1376  dest = CreateFileW((destdir + destname).c_str(), GENERIC_READ | GENERIC_WRITE | DELETE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
1377  } else if (fbi.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1378  if (CreateDirectoryExW(srcfn.c_str(), (destdir + destname).c_str(), nullptr))
1380  nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
1381  else
1383  } else
1384  dest = CreateFileW((destdir + destname).c_str(), GENERIC_READ | GENERIC_WRITE | DELETE, 0, nullptr, CREATE_NEW, 0, source);
1385 
1386  if (dest == INVALID_HANDLE_VALUE)
1387  throw last_error(GetLastError());
1388 
1389  memset(&bsii, 0, sizeof(btrfs_set_inode_info));
1390 
1391  bsii.flags_changed = true;
1392  bsii.flags = bii.flags;
1393 
1394  if (bii.flags & BTRFS_INODE_COMPRESS) {
1395  bsii.compression_type_changed = true;
1397  }
1398 
1399  try {
1400  Status = NtFsControlFile(dest, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_SET_INODE_INFO, &bsii, sizeof(btrfs_set_inode_info), nullptr, 0);
1401  if (!NT_SUCCESS(Status))
1402  throw ntstatus_error(Status);
1403 
1404  if (fbi.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1405  if (!(fbi.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
1406  WIN32_FIND_DATAW fff;
1407  wstring qs;
1408 
1409  qs = srcfn;
1410  qs += L"\\*";
1411 
1412  fff_handle h = FindFirstFileW(qs.c_str(), &fff);
1413  if (h != INVALID_HANDLE_VALUE) {
1414  do {
1415  wstring fn2;
1416 
1417  if (fff.cFileName[0] == '.' && (fff.cFileName[1] == 0 || (fff.cFileName[1] == '.' && fff.cFileName[2] == 0)))
1418  continue;
1419 
1420  fn2 = srcfn;
1421  fn2 += L"\\";
1422  fn2 += fff.cFileName;
1423 
1424  reflink_copy2(fn2, destdir + destname + L"\\", fff.cFileName);
1425  } while (FindNextFileW(h, &fff));
1426  }
1427  }
1428 
1429  // CreateDirectoryExW also copies streams, no need to do it here
1430  } else {
1431  WIN32_FIND_STREAM_DATA fsd;
1432 
1433  if (fbi.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
1434  reparse_header rh;
1435  ULONG rplen;
1436  uint8_t* rp;
1437 
1438  if (!DeviceIoControl(source, FSCTL_GET_REPARSE_POINT, nullptr, 0, &rh, sizeof(reparse_header), &bytesret, nullptr)) {
1439  if (GetLastError() != ERROR_MORE_DATA)
1440  throw last_error(GetLastError());
1441  }
1442 
1443  rplen = sizeof(reparse_header) + rh.ReparseDataLength;
1444  rp = (uint8_t*)malloc(rplen);
1445 
1446  try {
1447  if (!DeviceIoControl(source, FSCTL_GET_REPARSE_POINT, nullptr, 0, rp, rplen, &bytesret, nullptr))
1448  throw last_error(GetLastError());
1449 
1450  if (!DeviceIoControl(dest, FSCTL_SET_REPARSE_POINT, rp, rplen, nullptr, 0, &bytesret, nullptr))
1451  throw last_error(GetLastError());
1452  } catch (...) {
1453  free(rp);
1454  throw;
1455  }
1456 
1457  free(rp);
1458  } else {
1459  FILE_STANDARD_INFO fsi;
1460  FILE_END_OF_FILE_INFO feofi;
1464  uint64_t offset, alloc_size;
1465  ULONG maxdup;
1466 
1467  if (!GetFileInformationByHandleEx(source, FileStandardInfo, &fsi, sizeof(FILE_STANDARD_INFO)))
1468  throw last_error(GetLastError());
1469 
1470  if (!DeviceIoControl(source, FSCTL_GET_INTEGRITY_INFORMATION, nullptr, 0, &fgiib, sizeof(FSCTL_GET_INTEGRITY_INFORMATION_BUFFER), &bytesret, nullptr))
1471  throw last_error(GetLastError());
1472 
1473  if (fbi.FileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) {
1474  if (!DeviceIoControl(dest, FSCTL_SET_SPARSE, nullptr, 0, nullptr, 0, &bytesret, nullptr))
1475  throw last_error(GetLastError());
1476  }
1477 
1478  fsiib.ChecksumAlgorithm = fgiib.ChecksumAlgorithm;
1479  fsiib.Reserved = 0;
1480  fsiib.Flags = fgiib.Flags;
1481  if (!DeviceIoControl(dest, FSCTL_SET_INTEGRITY_INFORMATION, &fsiib, sizeof(FSCTL_SET_INTEGRITY_INFORMATION_BUFFER), nullptr, 0, &bytesret, nullptr))
1482  throw last_error(GetLastError());
1483 
1484  feofi.EndOfFile = fsi.EndOfFile;
1485  if (!SetFileInformationByHandle(dest, FileEndOfFileInfo, &feofi, sizeof(FILE_END_OF_FILE_INFO)))
1486  throw last_error(GetLastError());
1487 
1488  ded.FileHandle = source;
1489  maxdup = 0xffffffff - fgiib.ClusterSizeInBytes + 1;
1490 
1491  alloc_size = sector_align(fsi.EndOfFile.QuadPart, fgiib.ClusterSizeInBytes);
1492 
1493  offset = 0;
1494  while (offset < alloc_size) {
1496  ded.ByteCount.QuadPart = maxdup < (alloc_size - offset) ? maxdup : (alloc_size - offset);
1497  if (!DeviceIoControl(dest, FSCTL_DUPLICATE_EXTENTS_TO_FILE, &ded, sizeof(DUPLICATE_EXTENTS_DATA), nullptr, 0, &bytesret, nullptr))
1498  throw last_error(GetLastError());
1499 
1500  offset += ded.ByteCount.QuadPart;
1501  }
1502  }
1503 
1504  fff_handle h = FindFirstStreamW(srcfn.c_str(), FindStreamInfoStandard, &fsd, 0);
1505  if (h != INVALID_HANDLE_VALUE) {
1506  do {
1507  wstring sn;
1508 
1509  sn = fsd.cStreamName;
1510 
1511  if (sn != L"::$DATA" && sn.length() > 6 && sn.substr(sn.length() - 6, 6) == L":$DATA") {
1513  uint8_t* data = nullptr;
1514 
1515  if (fsd.StreamSize.QuadPart > 0) {
1516  wstring fn2;
1517  uint16_t stream_size = (uint16_t)fsd.StreamSize.QuadPart;
1518 
1519  fn2 = srcfn;
1520  fn2 += sn;
1521 
1522  stream = CreateFileW(fn2.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
1523 
1525  throw last_error(GetLastError());
1526 
1527  // We can get away with this because our streams are guaranteed to be below 64 KB -
1528  // don't do this on NTFS!
1530 
1531  if (!ReadFile(stream, data, stream_size, &bytesret, nullptr)) {
1532  free(data);
1533  throw last_error(GetLastError());
1534  }
1535  }
1536 
1537  stream = CreateFileW((destdir + destname + sn).c_str(), GENERIC_READ | GENERIC_WRITE | DELETE, 0, nullptr, CREATE_NEW, 0, nullptr);
1538 
1539  if (stream == INVALID_HANDLE_VALUE) {
1540  if (data) free(data);
1541  throw last_error(GetLastError());
1542  }
1543 
1544  if (data) {
1545  if (!WriteFile(stream, data, (uint32_t)fsd.StreamSize.QuadPart, &bytesret, nullptr)) {
1546  free(data);
1547  throw last_error(GetLastError());
1548  }
1549 
1550  free(data);
1551  }
1552  }
1553  } while (FindNextStreamW(h, &fsd));
1554  }
1555  }
1556 
1557  atime.dwLowDateTime = fbi.LastAccessTime.LowPart;
1558  atime.dwHighDateTime = fbi.LastAccessTime.HighPart;
1559  mtime.dwLowDateTime = fbi.LastWriteTime.LowPart;
1560  mtime.dwHighDateTime = fbi.LastWriteTime.HighPart;
1561  SetFileTime(dest, nullptr, &atime, &mtime);
1562 
1563  Status = NtFsControlFile(source, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_XATTRS, nullptr, 0, &bsxa, sizeof(btrfs_set_xattr));
1564 
1565  if (Status == STATUS_BUFFER_OVERFLOW || (NT_SUCCESS(Status) && bsxa.valuelen > 0)) {
1566  ULONG xalen = 0;
1567  btrfs_set_xattr *xa = nullptr, *xa2;
1568 
1569  do {
1570  xalen += 1024;
1571 
1572  if (xa) free(xa);
1573  xa = (btrfs_set_xattr*)malloc(xalen);
1574 
1575  Status = NtFsControlFile(source, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_GET_XATTRS, nullptr, 0, xa, xalen);
1576  } while (Status == STATUS_BUFFER_OVERFLOW);
1577 
1578  if (!NT_SUCCESS(Status)) {
1579  free(xa);
1580  throw ntstatus_error(Status);
1581  }
1582 
1583  xa2 = xa;
1584  while (xa2->valuelen > 0) {
1585  Status = NtFsControlFile(dest, nullptr, nullptr, nullptr, &iosb, FSCTL_BTRFS_SET_XATTR, xa2,
1586  offsetof(btrfs_set_xattr, data[0]) + xa2->namelen + xa2->valuelen, nullptr, 0);
1587  if (!NT_SUCCESS(Status)) {
1588  free(xa);
1589  throw ntstatus_error(Status);
1590  }
1591  xa2 = (btrfs_set_xattr*)&xa2->data[xa2->namelen + xa2->valuelen];
1592  }
1593 
1594  free(xa);
1595  } else if (!NT_SUCCESS(Status))
1596  throw ntstatus_error(Status);
1597  } catch (...) {
1598  FILE_DISPOSITION_INFO fdi;
1599 
1600  fdi.DeleteFile = true;
1601  SetFileInformationByHandle(dest, FileDispositionInfo, &fdi, sizeof(FILE_DISPOSITION_INFO));
1602 
1603  throw;
1604  }
1605 }
#define FSCTL_SET_SPARSE
Definition: winioctl.h:100
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
uint16_t namelen
Definition: btrfsioctl.h:238
#define FILE_ATTRIBUTE_SPARSE_FILE
Definition: ntifs_ex.h:380
#define BTRFS_TYPE_SOCKET
Definition: shellext.h:85
uint8_t compression_type
Definition: btrfsioctl.h:96
#define BTRFS_TYPE_BLOCKDEV
Definition: shellext.h:83
#define SUBVOL_ROOT_INODE
Definition: propsheet.cpp:42
#define free
Definition: debug_ros.c:5
LONG NTSTATUS
Definition: precomp.h:26
#define BTRFS_TYPE_FIFO
Definition: shellext.h:84
GLintptr offset
Definition: glext.h:5920
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
unsigned short int uint16_t
Definition: acefiex.h:54
#define uint16_t
Definition: nsiface.idl:60
#define BTRFS_TYPE_CHARDEV
Definition: shellext.h:82
#define FSCTL_GET_REPARSE_POINT
Definition: winioctl.h:97
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:1098
#define FILE_TRAVERSE
Definition: nt_native.h:643
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define FILE_ADD_FILE
Definition: nt_native.h:632
#define FSCTL_BTRFS_CREATE_SNAPSHOT
Definition: btrfsioctl.h:9
#define BTRFS_INODE_COMPRESS
Definition: propsheet.h:87
#define GENERIC_WRITE
Definition: nt_native.h:90
#define offsetof(TYPE, MEMBER)
int const char int stream_size
Definition: zlib.h:813
uint64_t st_rdev
Definition: btrfsioctl.h:75
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define OPEN_EXISTING
Definition: compat.h:426
USHORT ReparseDataLength
Definition: contextmenu.cpp:62
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
LARGE_INTEGER SourceFileOffset
Definition: shellext.h:176
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOL WINAPI GetFileInformationByHandleEx(HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class, LPVOID info, DWORD size)
#define FSCTL_BTRFS_GET_XATTRS
Definition: btrfsioctl.h:32
uint64_t flags
Definition: btrfsioctl.h:76
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL compression_type_changed
Definition: btrfsioctl.h:97
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
#define FSCTL_BTRFS_MKNOD
Definition: btrfsioctl.h:30
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
uint64_t inode
Definition: btrfsioctl.h:69
#define FILE_ADD_SUBDIRECTORY
Definition: nt_native.h:635
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GENERIC_READ
Definition: compat.h:124
#define FSCTL_BTRFS_SET_INODE_INFO
Definition: btrfsioctl.h:11
#define ERROR_MORE_DATA
Definition: dderror.h:13
BYTE uint8_t
Definition: msvideo1.c:66
Status
Definition: gdiplustypes.h:24
uint64_t st_rdev
Definition: btrfsioctl.h:237
uint8_t type
Definition: btrfsioctl.h:236
HANDLE WINAPI FindFirstStreamW(IN LPCWSTR lpFileName, IN STREAM_INFO_LEVELS InfoLevel, OUT LPVOID lpFindStreamData, IN DWORD dwFlags)
Definition: find.c:957
UINT64 uint64_t
Definition: types.h:77
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define FSCTL_BTRFS_GET_INODE_INFO
Definition: btrfsioctl.h:10
BOOL WINAPI CreateDirectoryExW(IN LPCWSTR lpTemplateDirectory, IN LPCWSTR lpNewDirectory, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:193
LARGE_INTEGER TargetFileOffset
Definition: shellext.h:177
UINT32 uint32_t
Definition: types.h:75
BOOL WINAPI FindNextStreamW(IN HANDLE hFindStream, OUT LPVOID lpFindStreamData)
Definition: find.c:1115
#define CreateFileW
Definition: compat.h:400
#define FSCTL_GET_INTEGRITY_INFORMATION
Definition: shellext.h:197
uint64_t inode
Definition: btrfsioctl.h:235
BOOL WINAPI SetFileInformationByHandle(HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, LPVOID lpFileInformation, DWORD dwBufferSize)
Definition: reactos.cpp:177
Definition: name.c:36
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
static void reflink_copy2(const wstring &srcfn, const wstring &destdir, const wstring &destname)
WCHAR name[1]
Definition: btrfsioctl.h:239
uint8_t compression_type
Definition: btrfsioctl.h:81
#define FSCTL_BTRFS_SET_XATTR
Definition: btrfsioctl.h:33
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
static char * dest
Definition: rtl.c:135
#define FSCTL_SET_INTEGRITY_INFORMATION
Definition: shellext.h:198
#define CREATE_NEW
Definition: disk.h:69
#define FSCTL_SET_REPARSE_POINT
Definition: winioctl.h:98
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define memset(x, y, z)
Definition: compat.h:39
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
static uint64_t __inline sector_align(uint64_t n, uint64_t a)
LARGE_INTEGER ByteCount
Definition: shellext.h:178
DWORD dwLowDateTime
Definition: mapidefs.h:65
#define DELETE
Definition: nt_native.h:57
LONGLONG QuadPart
Definition: typedefs.h:112
#define FSCTL_DUPLICATE_EXTENTS_TO_FILE
Definition: shellext.h:181
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320

Referenced by ReflinkCopyW().

◆ ReflinkCopyW()

void CALLBACK ReflinkCopyW ( HWND  hwnd,
HINSTANCE  hinst,
LPWSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 1611 of file contextmenu.cpp.

1611  {
1613 
1614  command_line_to_args(lpszCmdLine, args);
1615 
1616  if (args.size() >= 2) {
1617  bool dest_is_dir = false;
1618  wstring dest = args[args.size() - 1], destdir, destname;
1619  WCHAR volpath2[MAX_PATH];
1620 
1621  {
1623  nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
1624 
1625  if (destdirh != INVALID_HANDLE_VALUE) {
1627 
1628  if (GetFileInformationByHandle(destdirh, &bhfi) && bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1629  dest_is_dir = true;
1630 
1631  destdir = dest;
1632  if (destdir.substr(destdir.length() - 1, 1) != L"\\")
1633  destdir += L"\\";
1634  }
1635  }
1636  }
1637 
1638  if (!dest_is_dir) {
1639  size_t found = dest.rfind(L"\\");
1640 
1641  if (found == wstring::npos) {
1642  destdir = L"";
1643  destname = dest;
1644  } else {
1645  destdir = dest.substr(0, found);
1646  destname = dest.substr(found + 1);
1647  }
1648  }
1649 
1650  if (!GetVolumePathNameW(dest.c_str(), volpath2, sizeof(volpath2) / sizeof(WCHAR)))
1651  return;
1652 
1653  for (unsigned int i = 0; i < args.size() - 1; i++) {
1654  WIN32_FIND_DATAW ffd;
1655 
1656  fff_handle h = FindFirstFileW(args[i].c_str(), &ffd);
1657  if (h != INVALID_HANDLE_VALUE) {
1658  WCHAR volpath1[MAX_PATH];
1659  wstring path = args[i];
1660  size_t found = path.rfind(L"\\");
1661 
1662  if (found == wstring::npos)
1663  path = L"";
1664  else
1665  path = path.substr(0, found);
1666 
1667  path += L"\\";
1668 
1669  if (get_volume_path_parent(path.c_str(), volpath1, sizeof(volpath1) / sizeof(WCHAR))) {
1670  if (!wcscmp(volpath1, volpath2)) {
1671  do {
1672  try {
1673  reflink_copy2(path + ffd.cFileName, destdir, dest_is_dir ? ffd.cFileName : destname);
1674  } catch (const exception& e) {
1675  cerr << "Error: " << e.what() << endl;
1676  }
1677  } while (FindNextFileW(h, &ffd));
1678  }
1679  }
1680  }
1681  }
1682  }
1683 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
static const size_t npos
Definition: _string_npos.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:815
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
Definition: match.c:390
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FILE_TRAVERSE
Definition: nt_native.h:643
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
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
#define e
Definition: ke_i.h:82
int length
Definition: match.c:394
#define OPEN_EXISTING
Definition: compat.h:426
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:608
__wchar_t WCHAR
Definition: xmlstorage.h:180
_STLP_DECLSPEC _Stl_aligned_buffer< ostream > cerr
Definition: iostream.cpp:102
static bool get_volume_path_parent(const WCHAR *fn, WCHAR *volpath, ULONG volpathlen)
#define MAX_PATH
Definition: compat.h:26
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
Definition: services.c:325
#define CreateFileW
Definition: compat.h:400
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
static void reflink_copy2(const wstring &srcfn, const wstring &destdir, const wstring &destname)
static char * dest
Definition: rtl.c:135
#define args
Definition: format.c:66
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
void command_line_to_args(LPWSTR cmdline, vector< wstring > args)
Definition: main.cpp:610

◆ sector_align()

◆ show_reflink_paste()

static bool show_reflink_paste ( const wstring &  path)
static

Definition at line 205 of file contextmenu.cpp.

205  {
206  HDROP hdrop;
207  HANDLE lh;
208  ULONG num_files;
209  WCHAR fn[MAX_PATH], volpath1[255], volpath2[255];
210 
212  return false;
213 
214  if (!GetVolumePathNameW(path.c_str(), volpath1, sizeof(volpath1) / sizeof(WCHAR)))
215  return false;
216 
217  if (!OpenClipboard(nullptr))
218  return false;
219 
220  hdrop = (HDROP)GetClipboardData(CF_HDROP);
221 
222  if (!hdrop) {
223  CloseClipboard();
224  return false;
225  }
226 
227  lh = GlobalLock(hdrop);
228 
229  if (!lh) {
230  CloseClipboard();
231  return false;
232  }
233 
234  num_files = DragQueryFileW(hdrop, 0xFFFFFFFF, nullptr, 0);
235 
236  if (num_files == 0) {
237  GlobalUnlock(lh);
238  CloseClipboard();
239  return false;
240  }
241 
242  if (!DragQueryFileW(hdrop, 0, fn, sizeof(fn) / sizeof(WCHAR))) {
243  GlobalUnlock(lh);
244  CloseClipboard();
245  return false;
246  }
247 
248  if (!get_volume_path_parent(fn, volpath2, sizeof(volpath2) / sizeof(WCHAR))) {
249  GlobalUnlock(lh);
250  CloseClipboard();
251  return false;
252  }
253 
254  GlobalUnlock(lh);
255 
256  CloseClipboard();
257 
258  return !wcscmp(volpath1, volpath2);
259 }
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:815
#define CF_HDROP
Definition: constants.h:410
__wchar_t WCHAR
Definition: xmlstorage.h:180
static bool get_volume_path_parent(const WCHAR *fn, WCHAR *volpath, ULONG volpathlen)
#define MAX_PATH
Definition: compat.h:26
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
Definition: services.c:325
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HANDLE WINAPI GetClipboardData(_In_ UINT)
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627

Referenced by BtrfsContextMenu::QueryContextMenu().