winsdk: Create layer registry if it doesn't exist
authorLenny Komow <lenny@lunarg.com>
Wed, 17 Aug 2016 20:50:13 +0000 (14:50 -0600)
committerLenny Komow <lenny@lunarg.com>
Wed, 17 Aug 2016 20:52:34 +0000 (14:52 -0600)
windowsRuntimeInstaller/configure_runtime.c

index 10cf571..bc5a6b0 100644 (file)
@@ -160,11 +160,11 @@ int update_registry_layers(FILE* log, enum Platform platform, const struct SDKVe
 // extension (input) - The file extensions of the file to be updated\r
 // path (input) - The directory of the file (usually System32 or SysWOW64)\r
 // abi_major (input) - The ABI major version to be updated\r
-// leave_abi_major (input) - Whether or not the ABI number be left on the output filename\r
+// append_abi_major (input) - Whether or not the ABI number should be appended to the filename\r
 // latest_version (output) - The version of the runtime which the file was updated to\r
 // Returns: Zero on success, an error code on failure\r
 int update_system_file(FILE* log, const char* name, const char* extension, const char* path,\r
-    long abi_major, bool leave_abi_major, struct SDKVersion* latest_version);\r
+    long abi_major, bool append_abi_major, struct SDKVersion* latest_version);\r
 \r
 // Update vulkan.dll and vulkaninfo.exe in all of the windows directories (System32 and SysWOW64)\r
 //\r
@@ -225,8 +225,10 @@ int add_explicit_layers(FILE* log, const char* install_path, enum Platform platf
     if(platform == PLATFORM_X64) {\r
         flags |= KEY_WOW64_64KEY;\r
     }\r
-    if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers",\r
-        0, flags, &hKey) != ERROR_SUCCESS) {\r
+    \r
+    // Create (if needed) and open the explicit layer key\r
+    if(RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers",\r
+        0, NULL, REG_OPTION_NON_VOLATILE, flags, NULL, &hKey, NULL) != ERROR_SUCCESS) {\r
         return 20;\r
     }\r
 \r
@@ -476,8 +478,10 @@ int remove_explicit_layers(FILE* log, const char** install_paths, size_t count,
         if(platform == PLATFORM_X64) {\r
             flags |= KEY_WOW64_64KEY;\r
         }\r
-        if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers",\r
-            0, flags, &hKey) != ERROR_SUCCESS) {\r
+\r
+        // Create (if needed) and open the explicit layer key\r
+        if(RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers",\r
+            0, NULL, REG_OPTION_NON_VOLATILE, flags, NULL, &hKey, NULL) != ERROR_SUCCESS) {\r
             return 160;\r
         }\r
 \r
@@ -553,6 +557,8 @@ int update_registry_layers(FILE* log, enum Platform platform, const struct SDKVe
     return 0;\r
 }\r
 \r
+//int update_system_file(FILE* log, const char* name, const char* extension, const char* path,\r
+//    long abi_major, bool append_abi_major, struct SDKVersion* latest_version)\r
 int update_system_file(FILE* log, const char* name, const char* extension, const char* path,\r
     long abi_major, bool leave_abi_major, struct SDKVersion* latest_version)\r
 {\r