ReactOS 0.4.15-dev-7788-g1ad9096
devices.h
Go to the documentation of this file.
1/* Copyright (c) Mark Harmstone 2016-17
2 *
3 * This file is part of WinBtrfs.
4 *
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.
9 *
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.
14 *
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/>. */
17
18#pragma once
19
20#ifndef __REACTOS__
21#include <windows.h>
22#include <winternl.h>
23#else
24#define WIN32_NO_STATUS
25#include <windef.h>
26#include <winbase.h>
27#include <ndk/iofuncs.h>
28#include <ndk/iotypes.h>
29#endif
30#include <shlobj.h>
31#ifndef __REACTOS__
32#include "../btrfsioctl.h"
33#else
34#include "btrfsioctl.h"
35#endif
36
37typedef struct {
38 wstring pnp_name;
40 wstring drive;
41 wstring fstype;
48 bool ignore;
50 bool is_disk;
51} device;
52
53typedef struct {
54 const WCHAR* name;
55 const char* magic;
60
61// This list is compiled from information in libblkid, part of util-linux
62// and likewise under the LGPL. Thanks!
63
64const static fs_identifier fs_ident[] = {
65 { L"BeFS", "BFS1", 4, 0x20, 0 },
66 { L"BeFS", "1SFB", 4, 0x20, 0 },
67 { L"BeFS", "BFS1", 4, 0x220, 0 },
68 { L"BeFS", "1SFB", 4, 0x220, 0 },
69 { L"BFS", "\xce\xfa\xad\x1b", 4, 0, 0 },
70 { L"RomFS", "-rom1fs-", 8, 0, 0 },
71 { L"SquashFS", "hsqs", 4, 0, 0 },
72 { L"SquashFS", "sqsh", 4, 0, 0 },
73 { L"SquashFS", "hsqs", 4, 0, 0 },
74 { L"UBIFS", "\x31\x18\x10\x06", 4, 0, 0 },
75 { L"XFS", "XFSB", 4, 0, 0 },
76 { L"ext2", "\123\357", 2, 0x38, 1 },
77 { L"F2FS", "\x10\x20\xF5\xF2", 4, 0, 1 },
78 { L"HFS", "BD", 2, 0, 1 },
79 { L"HFS", "BD", 2, 0, 1 },
80 { L"HFS", "H+", 2, 0, 1 },
81 { L"HFS", "HX", 2, 0, 1 },
82 { L"Minix", "\177\023", 2, 0x10, 1 },
83 { L"Minix", "\217\023", 2, 0x10, 1 },
84 { L"Minix", "\023\177", 2, 0x10, 1 },
85 { L"Minix", "\023\217", 2, 0x10, 1 },
86 { L"Minix", "\150\044", 2, 0x10, 1 },
87 { L"Minix", "\170\044", 2, 0x10, 1 },
88 { L"Minix", "\044\150", 2, 0x10, 1 },
89 { L"Minix", "\044\170", 2, 0x10, 1 },
90 { L"Minix", "\132\115", 2, 0x10, 1 },
91 { L"Minix", "\115\132", 2, 0x10, 1 },
92 { L"OCFS", "OCFSV2", 6, 0, 1 },
93 { L"SysV", "\x2b\x55\x44", 3, 0x400, 1 },
94 { L"SysV", "\x44\x55\x2b", 3, 0x400, 1 },
95 { L"VXFS", "\365\374\001\245", 4, 0, 1 },
96 { L"OCFS", "OCFSV2", 6, 0, 2 },
97 { L"ExFAT", "EXFAT ", 8, 3 },
98 { L"NTFS", "NTFS ", 8, 3 },
99 { L"NetWare", "SPB5", 4, 0, 4 },
100 { L"OCFS", "OCFSV2", 6, 0, 4 },
101 { L"HPFS", "\x49\xe8\x95\xf9", 4, 0, 8 },
102 { L"OCFS", "OracleCFS", 9, 0, 8 },
103 { L"OCFS", "OCFSV2", 6, 0, 8 },
104 { L"ReFS", "\000\000\000ReFS\000", 8 },
105 { L"ReiserFS", "ReIsErFs", 8, 0x34, 8 },
106 { L"ReiserFS", "ReIsErFs", 8, 20, 8 },
107 { L"ISO9660", "CD001", 5, 1, 32, },
108 { L"ISO9660", "CDROM", 5, 9, 32, },
109 { L"JFS", "JFS1", 4, 0, 32 },
110 { L"OCFS", "ORCLDISK", 8, 32 },
111 { L"UDF", "BEA01", 5, 1, 32 },
112 { L"UDF", "BOOT2", 5, 1, 32 },
113 { L"UDF", "CD001", 5, 1, 32 },
114 { L"UDF", "CDW02", 5, 1, 32 },
115 { L"UDF", "NSR02", 5, 1, 32 },
116 { L"UDF", "NSR03", 5, 1, 32 },
117 { L"UDF", "TEA01", 5, 1, 32 },
118 { L"Btrfs", "_BHRfS_M", 8, 0x40, 64 },
119 { L"GFS", "\x01\x16\x19\x70", 4, 0, 64 },
120 { L"GFS", "\x01\x16\x19\x70", 4, 0, 64 },
121 { L"ReiserFS", "ReIsEr2Fs", 9, 0x34, 64 },
122 { L"ReiserFS", "ReIsEr3Fs", 9, 0x34, 64 },
123 { L"ReiserFS", "ReIsErFs", 8, 0x34, 64 },
124 { L"ReiserFS", "ReIsEr4", 7, 0, 64 },
125 { L"VMFS", "\x0d\xd0\x01\xc0", 4, 0, 1024 },
126 { L"VMFS", "\x5e\xf1\xab\x2f", 4, 0, 2048 },
127 { L"FAT", "MSWIN", 5, 0x52, 0 },
128 { L"FAT", "FAT32 ", 8, 0x52, 0 },
129 { L"FAT", "MSDOS", 5, 0x36, 0 },
130 { L"FAT", "FAT16 ", 8, 0x36, 0 },
131 { L"FAT", "FAT12 ", 8, 0x36, 0 },
132 { L"FAT", "FAT ", 8, 0x36, 0 },
133 { L"FAT", "\353", 1, 0, 0 },
134 { L"FAT", "\351", 1, 0, 0},
135 { L"FAT", "\125\252", 2, 0x1fe, 0 },
136 { nullptr, 0, 0, 0 }
137};
138
140public:
142 void ShowDialog();
143 void AddDevice(HWND hwndDlg);
145
146private:
148
154};
155
157public:
159 void ShowDialog(HWND hwnd, const wstring& fn, uint64_t dev_id);
160
161private:
162 void do_resize(HWND hwndDlg);
163
165 wstring fn;
168};
INT_PTR CALLBACK DeviceAddDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: devices.cpp:568
HINSTANCE hinst
Definition: devices.h:149
vector< device > device_list
Definition: devices.h:153
void ShowDialog()
Definition: devices.cpp:644
WCHAR * cmdline
Definition: devices.h:151
device * sel
Definition: devices.h:152
void populate_device_tree(HWND tree)
Definition: devices.cpp:331
void do_resize(HWND hwndDlg)
Definition: devices.cpp:656
void ShowDialog(HWND hwnd, const wstring &fn, uint64_t dev_id)
Definition: devices.cpp:838
WCHAR new_size_text[255]
Definition: devices.h:166
uint64_t dev_id
Definition: devices.h:164
uint64_t new_size
Definition: devices.h:164
INT_PTR CALLBACK DeviceResizeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: devices.cpp:697
btrfs_device dev_info
Definition: devices.h:167
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
UINT32 uint32_t
Definition: types.h:75
UINT64 uint64_t
Definition: types.h:77
static const fs_identifier fs_ident[]
Definition: devices.h:64
#define CALLBACK
Definition: compat.h:35
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
DRIVER_ADD_DEVICE AddDevice
Definition: parport.h:72
Definition: devices.h:37
ULONG disk_num
Definition: devices.h:42
BTRFS_UUID dev_uuid
Definition: devices.h:47
ULONG part_num
Definition: devices.h:43
bool multi_device
Definition: devices.h:49
bool has_parts
Definition: devices.h:45
bool ignore
Definition: devices.h:48
wstring friendly_name
Definition: devices.h:39
wstring drive
Definition: devices.h:40
wstring fstype
Definition: devices.h:41
BTRFS_UUID fs_uuid
Definition: devices.h:46
uint64_t size
Definition: devices.h:44
wstring pnp_name
Definition: devices.h:38
bool is_disk
Definition: devices.h:50
const char * magic
Definition: devices.h:55
uint32_t kboff
Definition: devices.h:58
const WCHAR * name
Definition: devices.h:54
uint32_t sboff
Definition: devices.h:57
ULONG magiclen
Definition: devices.h:56
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t ULONG
Definition: typedefs.h:59
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
__wchar_t WCHAR
Definition: xmlstorage.h:180