2020
2121namespace FredEmmott ::OpenXRLayers {
2222
23- static constexpr auto SubKey {
23+ static constexpr auto ImplicitSubKey {
2424 L" SOFTWARE\\ Khronos\\ OpenXR\\ 1\\ ApiLayers\\ Implicit" };
25+ static constexpr auto ExplicitSubKey {
26+ L" SOFTWARE\\ Khronos\\ OpenXR\\ 1\\ ApiLayers\\ Explicit" };
2527
2628WindowsAPILayerStore::WindowsAPILayerStore (
2729 std::string_view displayName,
30+ APILayer::Kind kind,
2831 RegistryBitness bitness,
2932 HKEY rootKey,
3033 REGSAM desiredAccess)
3134 : mDisplayName (displayName),
35+ mLayerKind (kind),
3236 mRegistryBitness(bitness),
3337 mRootKey(rootKey) {
3438 REGSAM samFlags {desiredAccess};
@@ -43,7 +47,7 @@ WindowsAPILayerStore::WindowsAPILayerStore(
4347 if (
4448 RegCreateKeyExW (
4549 rootKey,
46- SubKey ,
50+ (kind == APILayer::Kind::Implicit) ? ImplicitSubKey : ExplicitSubKey ,
4751 0 ,
4852 nullptr ,
4953 REG_OPTION_NON_VOLATILE,
@@ -59,11 +63,15 @@ WindowsAPILayerStore::WindowsAPILayerStore(
5963 return ;
6064 }
6165 mEvent .reset (CreateEvent (nullptr , false , false , nullptr ));
62- this ->Poll ();
66+ this ->WindowsAPILayerStore :: Poll ();
6367}
6468
6569WindowsAPILayerStore::~WindowsAPILayerStore () = default ;
6670
71+ APILayer::Kind WindowsAPILayerStore::GetKind () const noexcept {
72+ return mLayerKind ;
73+ }
74+
6775std::string WindowsAPILayerStore::GetDisplayName () const noexcept {
6876 return mDisplayName ;
6977}
@@ -139,20 +147,23 @@ class ReadOnlyWindowsAPILayerStore final : public WindowsAPILayerStore {
139147 public:
140148 ReadOnlyWindowsAPILayerStore (
141149 std::string_view displayName,
150+ APILayer::Kind kind,
142151 RegistryBitness bitness,
143152 HKEY rootKey)
144- : WindowsAPILayerStore(displayName, bitness, rootKey, KEY_READ) {}
153+ : WindowsAPILayerStore(displayName, kind, bitness, rootKey, KEY_READ) {}
145154};
146155
147156class ReadWriteWindowsAPILayerStore final : public WindowsAPILayerStore,
148157 public ReadWriteAPILayerStore {
149158 public:
150159 ReadWriteWindowsAPILayerStore (
151160 std::string_view displayName,
161+ APILayer::Kind kind,
152162 RegistryBitness bitness,
153163 HKEY rootKey)
154164 : WindowsAPILayerStore(
155165 displayName,
166+ kind,
156167 bitness,
157168 rootKey,
158169 KEY_READ | KEY_WRITE) {}
@@ -220,19 +231,32 @@ class ReadWriteWindowsAPILayerStore final : public WindowsAPILayerStore,
220231template <class TInterface , class TConcrete >
221232std::span<const TInterface*> GetStaticStores () noexcept {
222233 using RB = WindowsAPILayerStore::RegistryBitness;
234+ using enum APILayer::Kind;
223235 static const TConcrete sHKLM64 {
224- " Win64-HKLM" , RB::Wow64_64, HKEY_LOCAL_MACHINE};
236+ " Win64-HKLM" , Implicit, RB::Wow64_64, HKEY_LOCAL_MACHINE};
225237 static const TConcrete sHKCU64 {
226- " Win64-HKCU" , RB::Wow64_64, HKEY_CURRENT_USER};
238+ " Win64-HKCU" , Implicit, RB::Wow64_64, HKEY_CURRENT_USER};
227239 static const TConcrete sHKLM32 {
228- " Win32-HKLM" , RB::Wow64_32, HKEY_LOCAL_MACHINE};
240+ " Win32-HKLM" , Implicit, RB::Wow64_32, HKEY_LOCAL_MACHINE};
229241 static const TConcrete sHKCU32 {
230- " Win32-HKCU" , RB::Wow64_32, HKEY_CURRENT_USER};
242+ " Win32-HKCU" , Implicit, RB::Wow64_32, HKEY_CURRENT_USER};
243+ static const TConcrete sExplicitHKLM64 {
244+ " Explicit Win64-HKLM" , Explicit, RB::Wow64_64, HKEY_LOCAL_MACHINE};
245+ static const TConcrete sExplicitHKCU64 {
246+ " Explicit Win64-HKCU" , Explicit, RB::Wow64_64, HKEY_CURRENT_USER};
247+ static const TConcrete sExplicitHKLM32 {
248+ " Explicit Win32-HKLM" , Explicit, RB::Wow64_32, HKEY_LOCAL_MACHINE};
249+ static const TConcrete sExplicitHKCU32 {
250+ " Explicit Win32-HKCU" , Explicit, RB::Wow64_32, HKEY_CURRENT_USER};
231251 static const TInterface* sStores [] {
232252 &sHKLM64 ,
233253 &sHKCU64 ,
234254 &sHKLM32 ,
235255 &sHKCU32 ,
256+ &sExplicitHKLM64 ,
257+ &sExplicitHKCU64 ,
258+ &sExplicitHKLM32 ,
259+ &sExplicitHKCU32 ,
236260 };
237261 return sStores ;
238262}
0 commit comments