VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core/HostDevice.cpp
blob: f48d84d7c997cfb4204ddbb16001f69a60618257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { c
/*
 Derived from source code of TrueCrypt 7.1a, which is
 Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
 by the TrueCrypt License 3.0.

 Modifications and additions to the original source code (contained in this file)
 and all other portions of this file are Copyright (c) 2013-2017 IDRIX
 and are governed by the Apache License 2.0 the full text of which is
 contained in the file License.txt included in VeraCrypt binary and source
 code distribution packages.
*/

#include "HostDevice.h"
#include "Platform/SerializerFactory.h"

namespace VeraCrypt
{
	void HostDevice::Deserialize (shared_ptr <Stream> stream)
	{
		Serializer sr (stream);
		MountPoint = sr.DeserializeWString ("MountPoint");
		sr.Deserialize ("Name", Name);
		Path = sr.DeserializeWString ("Path");
		sr.Deserialize ("Removable", Removable);
		sr.Deserialize ("Size", Size);
		sr.Deserialize ("SystemNumber", SystemNumber);

		uint32 partitionCount;
		sr.Deserialize ("Partitions", partitionCount);
		for (uint32 i = 0; i < partitionCount; i++)
			Partitions.push_back (Serializable::DeserializeNew <HostDevice> (stream));
	}

	void HostDevice::Serialize (shared_ptr <Stream> stream) const
	{
		Serializable::Serialize (stream);
		Serializer sr (stream);
		sr.Serialize ("MountPoint", wstring (MountPoint));
		sr.Serialize ("Name", Name);
		sr.Serialize ("Path", wstring (Path));
		sr.Serialize ("Removable", Removable);
		sr.Serialize ("Size", Size);
		sr.Serialize ("SystemNumber", SystemNumber);

		sr.Serialize ("Partitions", (uint32) Partitions.size());
		foreach_ref (const HostDevice &partition, Partitions)
			partition.Serialize (stream);
	}

	TC_SERIALIZER_FACTORY_ADD_CLASS (HostDevice);
}
f" alt=">>" style="margin-top: 5px"> <a href="Volume%20Clones.html">Volume Clones</a> </p></div> <div class="wikidoc"> <div> <h2>Volume Clones</h2> <p>Never create a new VeraCrypt volume by cloning an existing VeraCrypt volume. Always use the VeraCrypt Volume Creation Wizard to create a new VeraCrypt volume. If you clone a volume and then start using both this volume and its clone in a way that both eventually contain different data, then you might aid cryptanalysis (both volumes will share a single key set). This is especially critical when the volume contains a hidden volume. Also note that plausible deniability (see section <a href="Plausible%20Deniability.html"><em>Plausible Deniability</em></a>) is impossible in such cases. See also the chapter <a href="How%20to%20Back%20Up%20Securely.html"> <em>How to Back Up Securely</em></a>.</p> </div> </div><div class="ClearBoth"></div></body></html>