Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Registry.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5namespace Stroika::Foundation::Common::Platform::Windows {
6
7 /*
8 ********************************************************************************
9 ********************************* RegistryKey **********************************
10 ********************************************************************************
11 */
12 constexpr RegistryKey::RegistryKey (HKEY hkey, bool owned)
13 : fKey_ (hkey)
14 , fOwned_{owned}
15 {
16 static_assert (nullptr != INVALID_HANDLE_VALUE);
17 Require (hkey != nullptr);
18 Require (hkey != INVALID_HANDLE_VALUE);
19 }
20 inline RegistryKey::~RegistryKey ()
21 {
22 Assert (nullptr != INVALID_HANDLE_VALUE);
23 Assert (fKey_ != nullptr);
24 Assert (fKey_ != INVALID_HANDLE_VALUE);
25 if (fOwned_) {
26 ::RegCloseKey (fKey_);
27 }
28 }
29 inline RegistryKey::operator HKEY () const
30 {
31 Ensure (fKey_ != nullptr);
32 Ensure (fKey_ != INVALID_HANDLE_VALUE);
33 return fKey_;
34 }
35
36}