27static const GUID CLSID_ShellBtrfsIconHandler = { 0x2690b74f, 0xf353, 0x422d, { 0xbb, 0x12, 0x40, 0x15, 0x81, 0xee, 0xf8, 0xf0 } };
28static const GUID CLSID_ShellBtrfsContextMenu = { 0x2690b74f, 0xf353, 0x422d, { 0xbb, 0x12, 0x40, 0x15, 0x81, 0xee, 0xf8, 0xf1 } };
29static const GUID CLSID_ShellBtrfsPropSheet = { 0x2690b74f, 0xf353, 0x422d, { 0xbb, 0x12, 0x40, 0x15, 0x81, 0xee, 0xf8, 0xf2 } };
30static const GUID CLSID_ShellBtrfsVolPropSheet = { 0x2690b74f, 0xf353, 0x422d, { 0xbb, 0x12, 0x40, 0x15, 0x81, 0xee, 0xf8, 0xf3 } };
32#define COM_DESCRIPTION_ICON_HANDLER L"WinBtrfs shell extension (icon handler)"
33#define COM_DESCRIPTION_CONTEXT_MENU L"WinBtrfs shell extension (context menu)"
34#define COM_DESCRIPTION_PROP_SHEET L"WinBtrfs shell extension (property sheet)"
35#define COM_DESCRIPTION_VOL_PROP_SHEET L"WinBtrfs shell extension (volume property sheet)"
36#define ICON_OVERLAY_NAME L"WinBtrfs"
59 if (!SetProcessDpiAwareness)
77 nb = to_wstring(
size);
90 fmt.lpThousandSep = thou;
91 fmt.NegativeOrder = 0;
100 if (*
c >=
'0' && *
c <
'9') {
102 fmt.Grouping += *
c -
'0';
108 if (
fmt.Grouping % 10 == 0)
130 if (
size >= 1152921504606846976) {
133 }
else if (
size >= 1125899906842624) {
136 }
else if (
size >= 1099511627776) {
139 }
else if (
size >= 1073741824) {
142 }
else if (
size >= 1048576) {
170 return L"(error retrieving message)";
178 while (
s.length() > 0 && (
s.substr(
s.length() - 1, 1) ==
L"\r" ||
s.substr(
s.length() - 1, 1) ==
L"\n"))
179 s =
s.substr(0,
s.length() - 1);
190 return L"(error loading ntdll.dll)";
196 return L"(error loading RtlNtStatusToDosError)";
215 s = wstring(retstr,
len);
222#pragma warning(disable: 4996)
312 wstring inproc, clsidkeyname;
319 inproc =
L"CLSID\\"s + clsidstring +
L"\\InprocServer32"s;
320 clsidkeyname =
L"CLSID\\"s + clsidstring;
322 inproc = wstring(
L"CLSID\\") + clsidstring + wstring(
L"\\InprocServer32");
323 clsidkeyname = wstring(
L"CLSID\\") + clsidstring;
356 nullptr,
nullptr,
nullptr,
nullptr,
nullptr);
403 wstring
path = wstring(
L"CLSID\\") + clsidstring;
421 wstring
path =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers\\"s +
name;
423 wstring
path = wstring(
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers\\") +
name;
439 wstring
path = wstring(
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers\\") +
name;
559 size_t found =
fn.rfind(
L"\\");
565 if (found == wstring::npos) {
569 path =
fn.substr(0, found);
570 file =
fn.substr(found + 1);
595 if (
args.size() >= 1)
600 size_t found =
fn.rfind(
L"\\");
606 if (found == wstring::npos) {
610 path =
fn.substr(0, found);
611 file =
fn.substr(found + 1);
641 if (
args.size() >= 2)
657 args.reserve(num_args);
659 for (
unsigned int i = 0;
i < (
unsigned int)num_args;
i++) {
682 buf = (
char*)
malloc(utf8len +
sizeof(
char));
704#pragma warning(disable: 4996)
770 errnum, 0, (
WCHAR*)&
buf, 0,
nullptr) == 0)
805 throw runtime_error(
"Error loading RtlNtStatusToDosError in ntdll.dll.");
ios_base &_STLP_CALL dec(ios_base &__s)
static unsigned char bytes[4]
#define IDS_OUT_OF_MEMORY
#define RegCloseKey(hKey)
#define FSCTL_BTRFS_CREATE_SNAPSHOT
#define FSCTL_BTRFS_CREATE_SUBVOL
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
ntstatus_error(NTSTATUS Status)
string_error(int resno,...)
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
STDAPI DllRegisterServer(void)
static const GUID CLSID_ShellBtrfsIconHandler
static void create_snapshot2(const wstring &source, const wstring &fn)
#define COM_DESCRIPTION_ICON_HANDLER
HRESULT(WINAPI * _SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS value)
static void reg_delete_tree(HKEY hkey, const wstring &keyname)
STDAPI DllUnregisterServer(void)
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, void *lpReserved)
#define ICON_OVERLAY_NAME
static void unreg_icon_overlay(const wstring &name)
static void reg_icon_overlay(const GUID clsid, const wstring &name)
@ PROCESS_SYSTEM_DPI_AWARE
@ PROCESS_PER_MONITOR_DPI_AWARE
static const GUID CLSID_ShellBtrfsVolPropSheet
bool load_string(HMODULE module, UINT id, wstring &s)
static void unreg_context_menu_handler(const wstring &filetype, const wstring &name)
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
wstring format_message(ULONG last_error)
void error_message(HWND hwnd, const char *msg)
void CALLBACK CreateSnapshotW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
static void unregister_clsid(const GUID clsid)
static void reg_context_menu_handler(const GUID clsid, const wstring &filetype, const wstring &name)
wstring format_ntstatus(NTSTATUS Status)
#define COM_DESCRIPTION_PROP_SHEET
void wstring_sprintf(wstring &s, wstring fmt,...)
static string utf16_to_utf8(const wstring_view &utf16)
static void unreg_prop_sheet_handler(const wstring &filetype, const wstring &name)
void format_size(uint64_t size, wstring &s, bool show_bytes)
static void register_clsid(const GUID clsid, const WCHAR *description)
void CALLBACK CreateSubvolW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
enum _PROCESS_DPI_AWARENESS PROCESS_DPI_AWARENESS
static void reg_prop_sheet_handler(const GUID clsid, const wstring &filetype, const wstring &name)
static void create_subvol(const wstring &fn)
#define COM_DESCRIPTION_CONTEXT_MENU
void command_line_to_args(LPWSTR cmdline, vector< wstring > &args)
static const GUID CLSID_ShellBtrfsContextMenu
wstring utf8_to_utf16(const string_view &utf8)
STDAPI DllCanUnloadNow(void)
ULONG(WINAPI * _RtlNtStatusToDosError)(NTSTATUS Status)
#define COM_DESCRIPTION_VOL_PROP_SHEET
static void write_reg_key(HKEY root, const wstring &keyname, const WCHAR *val, const wstring &data)
static const GUID CLSID_ShellBtrfsPropSheet
#define IDS_REGCLOSEKEY_FAILED
#define IDS_REGCREATEKEY_FAILED
#define IDS_REGSETVALUEEX_FAILED
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
#define DLL_PROCESS_ATTACH
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define ERROR_NO_MORE_ITEMS
#define WideCharToMultiByte
#define MultiByteToWideChar
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLsizei bufsize
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
HLOCAL NTAPI LocalFree(HLOCAL hMem)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define memcpy(s1, s2, n)
#define FILE_FLAG_BACKUP_SEMANTICS
static PIO_STATUS_BLOCK iosb
static ACCESS_MASK const OBJECT_ATTRIBUTES ULONG const UNICODE_STRING ULONG PULONG dispos
static float(__cdecl *square_half_float)(float x
#define FILE_SHARE_DELETE
#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 LOCALE_USER_DEFAULT
#define offsetof(TYPE, MEMBER)
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
bool load_string(HMODULE module, UINT id, wstring &s)
static GLenum _GLUfuncptr fn
DWORD WINAPI GetLastError(void)
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define CLASS_E_CLASSNOTAVAILABLE
#define HKEY_LOCAL_MACHINE
#define HKEY_CLASSES_ROOT
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)