1 /*
2  * Copyright (C) 2011-2019 Daniel Scharrer
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the author(s) be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  *    claim that you wrote the original software. If you use this software
14  *    in a product, an acknowledgment in the product documentation would be
15  *    appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  *    misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  */
20 
21 /*!
22  * \file
23  *
24  * Structures for Windows registry entries stored in Inno Setup files.
25  */
26 #ifndef INNOEXTRACT_SETUP_REGISTRY_HPP
27 #define INNOEXTRACT_SETUP_REGISTRY_HPP
28 
29 #include <string>
30 #include <iosfwd>
31 
32 #include "setup/item.hpp"
33 #include "setup/windows.hpp"
34 #include "util/enum.hpp"
35 #include "util/flags.hpp"
36 
37 namespace setup {
38 
39 struct info;
40 
41 struct registry_entry : public item {
42 
43 	FLAGS(flags,
44 		CreateValueIfDoesntExist,
45 		UninsDeleteValue,
46 		UninsClearValue,
47 		UninsDeleteEntireKey,
48 		UninsDeleteEntireKeyIfEmpty,
49 		PreserveStringType,
50 		DeleteKey,
51 		DeleteValue,
52 		NoError,
53 		DontCreateKey,
54 		Bits32,
55 		Bits64
56 	);
57 
58 	enum hive_name {
59 		HKCR,
60 		HKCU,
61 		HKLM,
62 		HKU,
63 		HKPD,
64 		HKCC,
65 		HKDD,
66 		Unset,
67 	};
68 
69 	enum value_type {
70 		None,
71 		String,
72 		ExpandString,
73 		DWord,
74 		Binary,
75 		MultiString,
76 		QWord,
77 	};
78 
79 	std::string key;
80 	std::string name; // empty string means (Default) key
81 	std::string value;
82 
83 	std::string permissions;
84 
85 	hive_name hive;
86 
87 	int permission; //!< index into the permission entry list
88 
89 	value_type type;
90 
91 	flags options;
92 
93 	void load(std::istream & is, const info & i);
94 
95 };
96 
97 } // namespace setup
98 
99 NAMED_FLAGS(setup::registry_entry::flags)
100 NAMED_ENUM(setup::registry_entry::hive_name)
101 NAMED_ENUM(setup::registry_entry::value_type)
102 
103 #endif // INNOEXTRACT_SETUP_REGISTRY_HPP
104