layers: Fix layer setting loading from registries

Change-Id: I346968ac3e01b93e1b40e403a6ed5ccbf23c5a5d
diff --git a/layers/vk_layer_config.cpp b/layers/vk_layer_config.cpp
index 5671039..8967916 100644
--- a/layers/vk_layer_config.cpp
+++ b/layers/vk_layer_config.cpp
@@ -202,7 +202,7 @@
 #if defined(WIN32)
     HKEY hive;
     LSTATUS err = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Khronos\\Vulkan\\Settings", 0, KEY_READ, &hive);
-    if (err != ERROR_SUCCESS) {
+    if (err == ERROR_SUCCESS) {
         char name[2048];
         DWORD i = 0, name_size = sizeof(name), type, value, value_size = sizeof(value);
         while (ERROR_SUCCESS ==
@@ -213,7 +213,7 @@
             }
 
             // Check if this actually points to a file
-            if ((stat(name, &info) != 0) || (info.st_mode & S_IFREG)) {
+            if ((stat(name, &info) != 0) || !(info.st_mode & S_IFREG)) {
                 continue;
             }