1 /* Copyright (c) Mark Harmstone 2016-17
3 * This file is part of WinBtrfs.
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.
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.
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/>. */
24 #define WIN32_NO_STATUS
27 #include <ndk/iofuncs.h>
28 #include <ndk/iotypes.h>
34 #include "../btrfsioctl.h"
36 #include "btrfsioctl.h"
40 std::wstring pnp_name
;
41 std::wstring friendly_name
;
63 // This list is compiled from information in libblkid, part of util-linux
64 // and likewise under the LGPL. Thanks!
66 const static fs_identifier fs_ident
[] = {
67 { L
"BeFS", "BFS1", 4, 0x20, 0 },
68 { L
"BeFS", "1SFB", 4, 0x20, 0 },
69 { L
"BeFS", "BFS1", 4, 0x220, 0 },
70 { L
"BeFS", "1SFB", 4, 0x220, 0 },
71 { L
"BFS", "\xce\xfa\xad\x1b", 4, 0, 0 },
72 { L
"RomFS", "-rom1fs-", 8, 0, 0 },
73 { L
"SquashFS", "hsqs", 4, 0, 0 },
74 { L
"SquashFS", "sqsh", 4, 0, 0 },
75 { L
"SquashFS", "hsqs", 4, 0, 0 },
76 { L
"UBIFS", "\x31\x18\x10\x06", 4, 0, 0 },
77 { L
"XFS", "XFSB", 4, 0, 0 },
78 { L
"ext2", "\123\357", 2, 0x38, 1 },
79 { L
"F2FS", "\x10\x20\xF5\xF2", 4, 0, 1 },
80 { L
"HFS", "BD", 2, 0, 1 },
81 { L
"HFS", "BD", 2, 0, 1 },
82 { L
"HFS", "H+", 2, 0, 1 },
83 { L
"HFS", "HX", 2, 0, 1 },
84 { L
"Minix", "\177\023", 2, 0x10, 1 },
85 { L
"Minix", "\217\023", 2, 0x10, 1 },
86 { L
"Minix", "\023\177", 2, 0x10, 1 },
87 { L
"Minix", "\023\217", 2, 0x10, 1 },
88 { L
"Minix", "\150\044", 2, 0x10, 1 },
89 { L
"Minix", "\170\044", 2, 0x10, 1 },
90 { L
"Minix", "\044\150", 2, 0x10, 1 },
91 { L
"Minix", "\044\170", 2, 0x10, 1 },
92 { L
"Minix", "\132\115", 2, 0x10, 1 },
93 { L
"Minix", "\115\132", 2, 0x10, 1 },
94 { L
"OCFS", "OCFSV2", 6, 0, 1 },
95 { L
"SysV", "\x2b\x55\x44", 3, 0x400, 1 },
96 { L
"SysV", "\x44\x55\x2b", 3, 0x400, 1 },
97 { L
"VXFS", "\365\374\001\245", 4, 0, 1 },
98 { L
"OCFS", "OCFSV2", 6, 0, 2 },
99 { L
"ExFAT", "EXFAT ", 8, 3 },
100 { L
"NTFS", "NTFS ", 8, 3 },
101 { L
"NetWare", "SPB5", 4, 0, 4 },
102 { L
"OCFS", "OCFSV2", 6, 0, 4 },
103 { L
"HPFS", "\x49\xe8\x95\xf9", 4, 0, 8 },
104 { L
"OCFS", "OracleCFS", 9, 0, 8 },
105 { L
"OCFS", "OCFSV2", 6, 0, 8 },
106 { L
"ReFS", "\000\000\000ReFS\000", 8 },
107 { L
"ReiserFS", "ReIsErFs", 8, 0x34, 8 },
108 { L
"ReiserFS", "ReIsErFs", 8, 20, 8 },
109 { L
"ISO9660", "CD001", 5, 1, 32, },
110 { L
"ISO9660", "CDROM", 5, 9, 32, },
111 { L
"JFS", "JFS1", 4, 0, 32 },
112 { L
"OCFS", "ORCLDISK", 8, 32 },
113 { L
"UDF", "BEA01", 5, 1, 32 },
114 { L
"UDF", "BOOT2", 5, 1, 32 },
115 { L
"UDF", "CD001", 5, 1, 32 },
116 { L
"UDF", "CDW02", 5, 1, 32 },
117 { L
"UDF", "NSR02", 5, 1, 32 },
118 { L
"UDF", "NSR03", 5, 1, 32 },
119 { L
"UDF", "TEA01", 5, 1, 32 },
120 { L
"Btrfs", "_BHRfS_M", 8, 0x40, 64 },
121 { L
"GFS", "\x01\x16\x19\x70", 4, 0, 64 },
122 { L
"GFS", "\x01\x16\x19\x70", 4, 0, 64 },
123 { L
"ReiserFS", "ReIsEr2Fs", 9, 0x34, 64 },
124 { L
"ReiserFS", "ReIsEr3Fs", 9, 0x34, 64 },
125 { L
"ReiserFS", "ReIsErFs", 8, 0x34, 64 },
126 { L
"ReiserFS", "ReIsEr4", 7, 0, 64 },
127 { L
"VMFS", "\x0d\xd0\x01\xc0", 4, 0, 1024 },
128 { L
"VMFS", "\x5e\xf1\xab\x2f", 4, 0, 2048 },
129 { L
"FAT", "MSWIN", 5, 0x52, 0 },
130 { L
"FAT", "FAT32 ", 8, 0x52, 0 },
131 { L
"FAT", "MSDOS", 5, 0x36, 0 },
132 { L
"FAT", "FAT16 ", 8, 0x36, 0 },
133 { L
"FAT", "FAT12 ", 8, 0x36, 0 },
134 { L
"FAT", "FAT ", 8, 0x36, 0 },
135 { L
"FAT", "\353", 1, 0, 0 },
136 { L
"FAT", "\351", 1, 0, 0},
137 { L
"FAT", "\125\252", 2, 0x1fe, 0 },
141 class BtrfsDeviceAdd
{
143 INT_PTR CALLBACK
DeviceAddDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
145 void AddDevice(HWND hwndDlg
);
146 BtrfsDeviceAdd(HINSTANCE hinst
, HWND hwnd
, WCHAR
* cmdline
);
149 void populate_device_tree(HWND tree
);
155 std::vector
<device
> device_list
;
158 class BtrfsDeviceResize
{
160 INT_PTR CALLBACK
DeviceResizeDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
161 void ShowDialog(HWND hwnd
, WCHAR
* fn
, UINT64 dev_id
);
164 void do_resize(HWND hwndDlg
);
166 UINT64 dev_id
, new_size
;
167 WCHAR fn
[MAX_PATH
], new_size_text
[255];
168 btrfs_device dev_info
;