31#define __cpuidex __cpuidex_
71 ULONG uuidlen, genlen;
161 ULONG uuidlen, genlen, paruuidlen, partransidlen;
201 if (partransidlen <
sizeof(
uint64_t))
209 bfs.
uuid = *parent_uuid;
213 parpathw,
sizeof(parpathw));
223 if (parpath.substr(parpath.length() - 1) ==
L"\\")
224 parpath = parpath.substr(0, parpath.length() - 1);
286 wstring nameu, pathlinku;
305 ULONG rdevlen, modelen;
344 bmn->
st_rdev = rdev ? *rdev : 0;
362 if (rdblen >= 0x10000)
431 wstring pathu, path_tou;
458 wstring pathu, path_linku;
477 path_linku =
utf8_to_utf16(
string(path_link, path_link_len));
561 xattrname =
string(xattrnamebuf, xattrnamelen);
589 if (xattrdatalen > 0) {
590 if (!
WriteFile(
h, xattrdata, xattrdatalen,
nullptr,
nullptr))
606 else if (xattrname ==
EA_EA)
621 memcpy(bsxa->
data, xattrname.c_str(), xattrname.length());
622 memcpy(&bsxa->
data[xattrname.length()], xattrdata, xattrdatalen);
655 xattrname =
string(xattrnamebuf, xattrnamelen);
689 else if (xattrname ==
EA_EA)
704 memcpy(bsxa->
data, xattrname.c_str(), xattrname.length());
772 memset(&fbi, 0,
sizeof(FILE_BASIC_INFO));
774 fbi.LastWriteTime.QuadPart = -1;
794 ULONG i, offsetlen, cloneoffsetlen, cloneuuidlen, clonetransidlen, clonelenlen;
795 wstring pathu, clonepathu, clonepar;
835 if (clonetransidlen <
sizeof(
uint64_t))
851 if (cloneoffsetlen <
sizeof(
uint64_t))
854 for (
i = 0;
i <
cache.size();
i++) {
865 bfs.
uuid = *cloneuuid;
869 cloneparw,
sizeof(cloneparw));
879 if (clonepar.substr(clonepar.length() - 1) ==
L"\\")
880 clonepar = clonepar.substr(0, clonepar.length() - 1);
882 clonepar += cloneparw;
1023 ULONG uidlen, gidlen;
1071 return (
t->seconds * 10000000) + (
t->nanoseconds / 100) + 116444736000000000;
1077 FILE_BASIC_INFO fbi;
1098 memset(&fbi, 0,
sizeof(FILE_BASIC_INFO));
1128 file = fff.cFileName;
1154 if (
cmd->length > 0)
1202 if (
cmd.length > 0) {
1356 attrib &= ~FILE_ATTRIBUTE_READONLY;
1366#if defined(_X86_) || defined(_AMD64_)
1367static void check_cpu() {
1368 bool have_sse42 =
false;
1376 if (__get_cpuid(1, &
eax, &
ebx, &ecx, &
edx))
1377 have_sse42 = ecx & bit_SSE4_2;
1384 have_sse42 = (
unsigned int)cpu_info[2] & (1 << 20);
1467 this->
hwnd = hwndDlg;
1536#if defined(_X86_) || defined(_AMD64_)
1567 tp->PrivilegeCount = 3;
1570#pragma clang diagnostic push
1571#pragma clang diagnostic ignored "-Warray-bounds"
1579 tp->Privileges[0].Luid = luid;
1587 tp->Privileges[1].Luid = luid;
1595 tp->Privileges[2].Luid = luid;
1604 #pragma clang diagnostic pop
1635 if (
args.size() >= 2) {
1649 tp->PrivilegeCount = 3;
1652#pragma clang diagnostic push
1653#pragma clang diagnostic ignored "-Warray-bounds"
1661 tp->Privileges[0].Luid = luid;
1669 tp->Privileges[1].Luid = luid;
1677 tp->Privileges[2].Luid = luid;
1681#pragma clang diagnostic pop
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
unsigned short int uint16_t
#define IDS_OUT_OF_MEMORY
#define FSCTL_BTRFS_CREATE_SNAPSHOT
#define FSCTL_BTRFS_SET_INODE_INFO
#define FSCTL_BTRFS_SET_XATTR
#define FSCTL_BTRFS_RESERVE_SUBVOL
#define FSCTL_BTRFS_MKNOD
#define FSCTL_BTRFS_FIND_SUBVOL
#define FSCTL_BTRFS_RECEIVED_SUBVOL
#define FSCTL_BTRFS_CREATE_SUBVOL
void cmd_removexattr(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_chmod(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_subvol(HWND hwnd, btrfs_send_command *cmd, uint8_t *data, const win_handle &parent)
void cmd_write(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_rmdir(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_snapshot(HWND hwnd, btrfs_send_command *cmd, uint8_t *data, const win_handle &parent)
void cmd_clone(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
bool find_tlv(uint8_t *data, ULONG datalen, uint16_t type, void **value, ULONG *len)
void cmd_setxattr(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void Open(HWND hwnd, const wstring &file, const wstring &path, bool quiet)
void cmd_mkfile(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void add_cache_entry(BTRFS_UUID *uuid, uint64_t transid, const wstring &path)
void cmd_link(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_unlink(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_rename(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
INT_PTR CALLBACK RecvProgressDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void cmd_truncate(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_chown(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void cmd_utimes(HWND hwnd, btrfs_send_command *cmd, uint8_t *data)
void do_recv(const win_handle &f, uint64_t *pos, uint64_t size, const win_handle &parent)
#define OFN_FILEMUSTEXIST
struct tagOFNW OPENFILENAMEW
#define NT_SUCCESS(StatCode)
void error_message(HWND hwnd, const char *msg)
wstring format_ntstatus(NTSTATUS Status)
void wstring_sprintf(wstring &s, wstring fmt,...)
void command_line_to_args(LPWSTR cmdline, vector< wstring > &args)
wstring utf8_to_utf16(const string_view &utf8)
#define IDS_RECV_CSUM_ERROR
#define IDS_RECV_DUPLICATE_EXTENTS_FAILED
#define IDS_RECV_CANT_CREATE_FILE
#define IDD_RECV_PROGRESS
#define IDS_RECV_SETXATTR_FAILED
#define IDS_RECV_SETFILEPOINTER_FAILED
#define IDS_RECV_FILE_TRUNCATED
#define IDS_RECV_CANT_FIND_CLONE_SUBVOL
#define IDS_RECV_NOT_A_SEND_STREAM
#define IDS_RECV_RECEIVED_SUBVOL_FAILED
#define IDS_RECV_REMOVEDIRECTORY_FAILED
#define IDS_RECV_GETFILEATTRIBUTES_FAILED
#define IDS_RECV_RESERVE_SUBVOL_FAILED
#define IDS_RECV_SETINODEINFO_FAILED
#define IDS_RECV_SETENDOFFILE_FAILED
#define IDS_RECV_WRITEFILE_FAILED
#define IDS_RECV_CREATE_SNAPSHOT_FAILED
#define IDS_RECV_UNKNOWN_COMMAND
#define IDS_RECV_CANT_OPEN_PATH
#define IDS_RECV_CANT_OPEN_FILE
#define IDS_RECV_CREATETHREAD_FAILED
#define IDS_RECV_READFILE_FAILED
#define IDS_RECV_GETVOLUMEPATHNAME_FAILED
#define IDS_RECV_MOVEFILE_FAILED
#define IDS_RECV_FIND_SUBVOL_FAILED
#define IDS_RECV_SET_REPARSE_POINT_FAILED
#define IDS_RECV_UNSUPPORTED_VERSION
#define IDS_RECV_SETFILEATTRIBUTES_FAILED
#define IDC_RECV_PROGRESS
#define IDS_RECV_MKNOD_FAILED
#define IDS_RECV_SHORT_PARAM
#define IDS_RECV_BUTTON_OK
#define IDS_RECV_CANCELLED
#define IDS_RECV_CREATEHARDLINK_FAILED
#define IDS_RECV_SUCCESS_PLURAL
#define IDS_RECV_GETFILESIZEEX_FAILED
#define IDS_RECV_MISSING_PARAM
#define IDS_RECV_DELETEFILE_FAILED
#define IDS_RECV_CREATE_SUBVOL_FAILED
#define IDS_RECV_CANT_FIND_PARENT_SUBVOL
#define IDS_RECV_PATH_TOO_LONG
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
#define INVALID_SET_FILE_POINTER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define GetCurrentProcess()
#define crc32(crc, buf, len)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI CreateHardLinkW(IN LPCWSTR lpFileName, IN LPCWSTR lpExistingFileName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
#define BTRFS_SEND_CMD_RMDIR
#define BTRFS_SEND_TLV_PATH
#define BTRFS_SEND_TLV_CLONE_UUID
#define BTRFS_SEND_CMD_SET_XATTR
#define BTRFS_SEND_CMD_MKFILE
#define BTRFS_SEND_TLV_CLONE_OFFSET
#define BTRFS_SEND_TLV_XATTR_DATA
#define BTRFS_SEND_CMD_UPDATE_EXTENT
#define BTRFS_SEND_CMD_WRITE
#define BTRFS_SEND_CMD_UTIMES
#define BTRFS_SEND_CMD_CHMOD
#define BTRFS_SEND_CMD_LINK
#define BTRFS_SEND_CMD_RENAME
#define BTRFS_SEND_TLV_TRANSID
#define BTRFS_SEND_TLV_UUID
#define BTRFS_SEND_TLV_GID
#define BTRFS_SEND_TLV_DATA
#define BTRFS_SEND_CMD_MKFIFO
#define BTRFS_SEND_CMD_SUBVOL
#define BTRFS_SEND_TLV_MODE
#define BTRFS_SEND_CMD_SNAPSHOT
#define BTRFS_SEND_TLV_UID
#define BTRFS_SEND_CMD_TRUNCATE
#define BTRFS_SEND_TLV_XATTR_NAME
#define BTRFS_SEND_TLV_MTIME
#define BTRFS_SEND_TLV_CLONE_PATH
#define BTRFS_SEND_TLV_CLONE_LENGTH
#define BTRFS_SEND_TLV_OFFSET
#define BTRFS_SEND_CMD_CHOWN
#define BTRFS_SEND_TLV_CLONE_CTRANSID
#define BTRFS_SEND_CMD_MKNOD
#define BTRFS_SEND_TLV_SIZE
#define BTRFS_SEND_CMD_END
#define BTRFS_SEND_CMD_UNLINK
#define BTRFS_SEND_CMD_REMOVE_XATTR
#define BTRFS_SEND_CMD_SYMLINK
#define BTRFS_SEND_CMD_CLONE
#define BTRFS_SEND_CMD_MKSOCK
#define BTRFS_SEND_TLV_PATH_LINK
#define BTRFS_SEND_TLV_INODE
#define BTRFS_SEND_TLV_ATIME
#define BTRFS_SEND_TLV_CTIME
#define BTRFS_SEND_TLV_OTIME
#define BTRFS_SEND_TLV_RDEV
#define BTRFS_SEND_TLV_PATH_TO
#define BTRFS_SEND_CMD_MKDIR
#define FILE_OPEN_REPARSE_POINT
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat GLfloat h
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 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 token
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
format_message(j_common_ptr cinfo, char *buffer)
int const JOCTET unsigned int datalen
#define memcpy(s1, s2, n)
#define FILE_FLAG_POSIX_SEMANTICS
#define FILE_FLAG_BACKUP_SEMANTICS
static PIO_STATUS_BLOCK iosb
static float(__cdecl *square_half_float)(float x
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
#define FILE_ATTRIBUTE_READONLY
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_SHARE_DELETE
#define FILE_WRITE_ATTRIBUTES
#define FILE_ATTRIBUTE_DIRECTORY
#define FILE_ADD_SUBDIRECTORY
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)
#define FILE_ATTRIBUTE_REPARSE_POINT
#define FSCTL_SET_REPARSE_POINT
const string EA_DOSATTRIB
static DWORD WINAPI global_recv_thread(LPVOID lpParameter)
void CALLBACK RecvSubvolGUIW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
static __inline uint64_t unix_time_to_win(BTRFS_TIME *t)
static INT_PTR CALLBACK stub_RecvProgressDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void CALLBACK RecvSubvolW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
static void delete_directory(const wstring &dir)
static bool check_csum(btrfs_send_command *cmd, uint8_t *data)
#define offsetof(TYPE, MEMBER)
#define FSCTL_DUPLICATE_EXTENTS_TO_FILE
#define SYMLINK_FLAG_RELATIVE
#define BTRFS_TYPE_DIRECTORY
#define BTRFS_TYPE_SOCKET
#define BTRFS_TYPE_CHARDEV
#define BTRFS_TYPE_BLOCKDEV
LARGE_INTEGER SourceFileOffset
LARGE_INTEGER TargetFileOffset
struct _REPARSE_DATA_BUFFER::@312::@314 SymbolicLinkReparseBuffer
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define GetWindowLongPtrW
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAKEINTRESOURCEW(i)
#define SetWindowLongPtrW
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IO_REPARSE_TAG_SYMLINK
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
#define TOKEN_ADJUST_PRIVILEGES
struct _LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES
#define SE_PRIVILEGE_ENABLED