25 #define WIN32_NO_STATUS 38 #define NO_SHLWAPI_STRFCNS 44 #include "../btrfsioctl.h" 49 #define NEW_SUBVOL_VERBA "newsubvol" 50 #define NEW_SUBVOL_VERBW L"newsubvol" 51 #define SNAPSHOT_VERBA "snapshot" 52 #define SNAPSHOT_VERBW L"snapshot" 53 #define REFLINK_VERBA "reflink" 54 #define REFLINK_VERBW L"reflink" 55 #define RECV_VERBA "recvsubvol" 56 #define RECV_VERBW L"recvsubvol" 57 #define SEND_VERBA "sendsubvol" 58 #define SEND_VERBW L"sendsubvol" 72 *ppObj = static_cast<IContextMenu*>(
this);
75 }
else if (
riid == IID_IShellExtInit) {
76 *ppObj = static_cast<IShellExtInit*>(
this);
91 FORMATETC
format = {
CF_HDROP,
nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
99 stgm.tymed = TYMED_HGLOBAL;
116 for (
i = 0;
i < num_files;
i++) {
236 if (num_files == 0) {
258 return !
wcscmp(volpath1, volpath2);
300 hr =
CoCreateInstance(CLSID_WICImagingFactory,
nullptr, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (
void **)&
factory);
346 if (
uFlags & CMF_DEFAULTONLY)
360 if (idCmdFirst + entries <= idCmdLast) {
373 mii.
wID = idCmdFirst + entries;
390 if (idCmdFirst + 1 <= idCmdLast) {
403 mii.
wID = idCmdFirst + 1;
463 wstring subvolname, parpath, searchpath, temp1,
name, nameorig;
487 searchpath = parpath +
L"\\" +
name;
496 name = nameorig +
L" (" + to_wstring(
num) +
L")";
505 searchpath = parpath +
L"\\" +
name;
515 bcs->readonly =
false;
533 n = (
n +
a) & ~(
a - 1);
540 WCHAR*
name, volpath1[255], volpath2[255];
541 wstring dirw, newpath;
570 if (
wcscmp(volpath1, volpath2))
619 memcpy(bcs->
name, destname.c_str(), destname.length() *
sizeof(
WCHAR));
691 wstring namew =
name;
748 if (fff.cFileName[0] ==
'.' && (fff.cFileName[1] == 0 || (fff.cFileName[1] ==
'.' && fff.cFileName[2] == 0)))
753 fn2 += fff.cFileName;
782 FILE_STANDARD_INFO fsi;
783 FILE_END_OF_FILE_INFO feofi;
808 feofi.EndOfFile = fsi.EndOfFile;
819 while (
offset < alloc_size) {
829 ULONG streambufsize = 0;
833 streambufsize += 0x1000;
844 auto fsi = reinterpret_cast<FILE_STREAM_INFORMATION*>(
streambuf.data());
847 if (fsi->StreamNameLength > 0) {
848 wstring sn = wstring(fsi->StreamName, fsi->StreamNameLength /
sizeof(
WCHAR));
850 if (sn !=
L"::$DATA" && sn.length() > 6 && sn.substr(sn.length() - 6, 6) ==
L":$DATA") {
895 if (fsi->NextEntryOffset == 0)
898 fsi = reinterpret_cast<FILE_STREAM_INFORMATION*>(reinterpret_cast<char*>(fsi) + fsi->NextEntryOffset);
929 while (xa2->valuelen > 0) {
943 FILE_DISPOSITION_INFO fdi;
945 fdi.DeleteFile =
true;
974 for (
i = 0;
i < num_files;
i++) {
998 for (
i = 0;
i < num_files;
i++) {
1002 t +=
L"\",SendSubvolGUI ";
1007 sei.
cbSize =
sizeof(sei);
1030 wstring
name, nameorig, searchpath;
1053 name = nameorig +
L" (" + to_wstring(
num) +
L")";
1095 t +=
L"\",RecvSubvolGUI ";
1100 sei.
cbSize =
sizeof(sei);
1139 for (
i = 0;
i < num_files;
i++) {
1204 }
else if (idCmd == 1) {
1261 }
else if (idCmd == 1) {
1288 }
else if (idCmd == 2) {
1320 static void reflink_copy2(
const wstring& srcfn,
const wstring& destdir,
const wstring& destname) {
1322 FILE_BASIC_INFO fbi;
1352 memcpy(bcs->
name, destname.c_str(), destname.length() *
sizeof(
WCHAR));
1435 if (fff.cFileName[0] ==
'.' && (fff.cFileName[1] == 0 || (fff.cFileName[1] ==
'.' && fff.cFileName[2] == 0)))
1440 fn2 += fff.cFileName;
1474 FILE_STANDARD_INFO fsi;
1475 FILE_END_OF_FILE_INFO feofi;
1500 feofi.EndOfFile = fsi.EndOfFile;
1511 while (
offset < alloc_size) {
1521 ULONG streambufsize = 0;
1525 streambufsize += 0x1000;
1536 auto fsi = reinterpret_cast<FILE_STREAM_INFORMATION*>(
streambuf.data());
1539 if (fsi->StreamNameLength > 0) {
1540 wstring sn = wstring(fsi->StreamName, fsi->StreamNameLength /
sizeof(
WCHAR));
1542 if (sn !=
L"::$DATA" && sn.length() > 6 && sn.substr(sn.length() - 6, 6) ==
L":$DATA") {
1587 if (fsi->NextEntryOffset == 0)
1590 fsi = reinterpret_cast<FILE_STREAM_INFORMATION*>(reinterpret_cast<char*>(fsi) + fsi->NextEntryOffset);
1621 while (xa2->valuelen > 0) {
1635 FILE_DISPOSITION_INFO fdi;
1637 fdi.DeleteFile =
true;
1651 if (
args.size() >= 2) {
1652 bool dest_is_dir =
false;
1653 wstring
dest =
args[
args.size() - 1], destdir, destname;
1667 if (destdir.substr(destdir.
length() - 1, 1) !=
L"\\")
1674 size_t found =
dest.rfind(
L"\\");
1680 destdir =
dest.substr(0, found);
1681 destname =
dest.substr(found + 1);
1688 for (
unsigned int i = 0;
i <
args.size() - 1;
i++) {
1695 size_t found =
path.rfind(
L"\\");
1705 if (!
wcscmp(volpath1, volpath2)) {
1708 reflink_copy2(
path + ffd.cFileName, destdir, dest_is_dir ? ffd.cFileName : destname);
static short search(int val, const short *table, int size)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
static PIO_STATUS_BLOCK iosb
#define ERROR_FILE_EXISTS
#define FILE_ATTRIBUTE_SPARSE_FILE
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
_Must_inspect_result_ _Out_ LPSIZE psize
BITMAPINFOHEADER bmiHeader
#define BTRFS_TYPE_SOCKET
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
HDC WINAPI GetDC(_In_opt_ HWND)
static GLenum _GLUfuncptr fn
#define SEE_MASK_NOCLOSEPROCESS
#define BTRFS_TYPE_BLOCKDEV
_In_ HBITMAP _In_ UINT _In_ UINT _Inout_ LPBITMAPINFO pbmi
#define SUBVOL_ROOT_INODE
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
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
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
#define INVALID_HANDLE_VALUE
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
DWORD WINAPI GetLastError(VOID)
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
#define BTRFS_TYPE_CHARDEV
#define FSCTL_GET_REPARSE_POINT
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IDS_RECV_SUBVOL_HELP
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLfloat GLfloat GLfloat GLfloat h
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
GLenum GLuint GLenum GLsizei const GLchar * buf
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
void error_message(HWND hwnd, const char *msg)
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
#define IDS_SEND_SUBVOL_HELP
#define FSCTL_BTRFS_CREATE_SNAPSHOT
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
#define BTRFS_INODE_COMPRESS
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
_Out_opt_ int _Out_opt_ int * cy
#define IDS_NEW_SUBVOL_HELP_TEXT
#define offsetof(TYPE, MEMBER)
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
#define IDS_CREATE_SNAPSHOT
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
#define MAKE_HRESULT(sev, fac, code)
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
#define FILE_ATTRIBUTE_REPARSE_POINT
#define FSCTL_BTRFS_CREATE_SUBVOL
#define FILE_ATTRIBUTE_DIRECTORY
#define IDS_REFLINK_PASTE_HELP
void wstring_sprintf(wstring &s, wstring fmt,...)
LARGE_INTEGER SourceFileOffset
GLboolean GLboolean GLboolean b
#define IS_INTRESOURCE(i)
int const char int stream_size
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
#define NT_SUCCESS(StatCode)
_STLP_DECLSPEC _Stl_aligned_buffer< ostream > cerr
int WINAPI GetSystemMetrics(_In_ int)
#define FSCTL_BTRFS_GET_XATTRS
unsigned __int3264 UINT_PTR
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
BOOL compression_type_changed
BOOL WINAPI CloseClipboard(void)
#define FILE_SHARE_DELETE
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
#define FSCTL_BTRFS_MKNOD
#define FILE_ADD_SUBDIRECTORY
#define memcpy(s1, s2, n)
#define FSCTL_BTRFS_GET_FILE_IDS
int _cdecl swprintf(const WCHAR *,...)
#define FSCTL_BTRFS_SET_INODE_INFO
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
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)
#define STATUS_BUFFER_OVERFLOW
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
GLsizei GLsizei GLchar * source
#define FSCTL_BTRFS_GET_INODE_INFO
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
void command_line_to_args(LPWSTR cmdline, vector< wstring > &args)
#define ReadFile(a, b, c, d, e)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
BOOL WINAPI CreateDirectoryExW(IN LPCWSTR lpTemplateDirectory, IN LPCWSTR lpNewDirectory, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
LARGE_INTEGER TargetFileOffset
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define IDS_CANT_REFLINK_DIFFERENT_FS
#define FileStandardInformation
#define FSCTL_GET_INTEGRITY_INFORMATION
#define FILE_FLAG_BACKUP_SEMANTICS
#define FSCTL_BTRFS_SET_XATTR
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
int strcmp(const char *String1, const char *String2)
#define RtlZeroMemory(Destination, Length)
basic_streambuf< char, char_traits< char > > streambuf
#define FSCTL_SET_INTEGRITY_INFORMATION
#define IDS_NEW_SUBVOL_FILENAME
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define MAKEINTRESOURCEW(i)
#define FSCTL_SET_REPARSE_POINT
#define ERROR_ALREADY_EXISTS
GLboolean GLboolean GLboolean GLboolean a
static struct msdos_boot_sector bs
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
#define FILE_OPEN_REPARSE_POINT
#define IDS_REFLINK_PASTE
struct tagMENUITEMINFOW MENUITEMINFOW
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define IDS_CREATE_SNAPSHOT_HELP_TEXT
#define FSCTL_DUPLICATE_EXTENTS_TO_FILE
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint const GLchar * name