Registry.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace AppSecInc
4 {
6  namespace Registry
7  {
8  /*
9  \fn KeyExists
10  \brief Checks whether a registry key, and optionally registry value, exists
11  \param root HKEY_LOCAL_MACHINE, etc.
12  \param key path to the registry key
13  \param name name of the value to check, if blank only checks the key
14  */
15  bool KeyExists(HKEY root, const std::wstring& key, const std::wstring& name = L"");
16 
17  /*
18  \fn GetStringValue
19  \brief Get a string value from registry
20  \param root HKEY_LOCAL_MACHINE, etc.
21  \param key path to the registry key
22  \param name name of the value to fetch
23  */
24  std::wstring GetStringValue(HKEY root, const std::wstring& key, const std::wstring& name = L"");
25 
26  /*
27  \fn CopyBranch
28  \brief Copy an entire branch of the registry from one location to another
29  \param sourceRoot HKEY_LOCAL_MACHINE, etc.
30  \param keySrcRoot source path to the registry key that is being copied
31  \param targetRoot HKEY_LOCAL_MACHINE, etc.
32  \param keyDestRoot destination path to the registry key that will be created
33  */
34  void CopyBranch(HKEY sourceRoot, const std::wstring& keySrcRoot, HKEY destRoot, const std::wstring& keyDestRoot);
35 
36  /*
37  \fn DeleteBranch
38  \brief Delete an entire branch of the registry
39  \param root HKEY_LOCAL_MACHINE, etc.
40  \param key path to the registry key to be deleted
41  */
42  void DeleteBranch(HKEY root, const std::wstring& key);
43 
44  /*
45  \fn CreateKey
46  \brief Create a registry key
47  \param root HKEY_LOCAL_MACHINE, etc.
48  \param key path to the registry key to be added
49  */
50  void CreateKey(HKEY root, const std::wstring& key);
51 
52  /*
53  \fn SetStringValue
54  \brief Creates a string name / value pair
55  \param root HKEY_LOCAL_MACHINE, etc.
56  \param key path to the registry key where the name / value is to be set
57  \param name
58  \param value
59  */
60  void SetStringValue(HKEY root, const std::wstring& key, const std::wstring &name, const std::wstring& value);
61  }
62 }
void CreateKey(HKEY root, const std::wstring &key)
Definition: Registry.cpp:160
void SetStringValue(HKEY root, const std::wstring &key, const std::wstring &name, const std::wstring &value)
Definition: Registry.cpp:171
std::wstring GetStringValue(HKEY root, const std::wstring &key, const std::wstring &name=L"")
Definition: Registry.cpp:47
void DeleteBranch(HKEY root, const std::wstring &key)
Definition: Registry.cpp:130
bool KeyExists(HKEY root, const std::wstring &key, const std::wstring &name=L"")
Definition: Registry.cpp:4
void CopyBranch(HKEY sourceRoot, const std::wstring &keySrcRoot, HKEY destRoot, const std::wstring &keyDestRoot)
Definition: Registry.cpp:79


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com