libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
RegistryKey.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright © 2002 by J.M.McGuiness, coder@hussar.me.uk
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Lesser General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2.1 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public
15 ** License along with this library; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
19 // This file uses the MFC.
20 
21 #pragma once
22 
23 #include <atlbase.h>
24 
25 #include "../../../core/non_copyable.hpp"
26 #include "../../../core/ttypes.hpp"
27 
28 namespace jmmcg { namespace NTUtils {
29 
30  class win_exception;
31 
32  class AFX_EXT_CLASS RegistryKey : protected non_copyable {
33  public:
35 
36  __stdcall RegistryKey();
37  __stdcall RegistryKey(HKEY p, const tstring &n);
38  __stdcall ~RegistryKey();
39  long __fastcall Create(HKEY p, const tstring &n);
40  long __fastcall Open(HKEY parent, const tstring &n);
41  long __fastcall SetValue(const tstring &val, const tstring &key_name);
42  long __fastcall SetValue(const tstring &val, const tstring &key_name, const DWORD type);
43  long __fastcall SetValue(const unsigned long val, const tstring &key_name);
44  HKEY __fastcall hkey() noexcept(true);
45 
46  private:
47  HKEY parent;
48  bool delete_key;
49  tstring name;
50  CRegKey key;
51  };
52 
53  inline
55  }
56 
57  inline
59  Create(parent, n);
60  }
61 
62  inline
64  return key.m_hKey;
65  }
66 
67 } }