Add support for regkeys to set Quirks bits depending on VkInstance's pApplicationInfo->pApplicationName and pApplicationInfo->pEngineName properties.
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com Signed-off-by: Daniel Koch dkoch@nvidia.com --- dlls/winevulkan/vulkan.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index a9a341209f8..e78ca1eda62 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -655,22 +655,44 @@ fail: return res; }
+static LSTATUS wine_vk_open_regkey_with_suffix(HKEY *key, const char *path_prefix, const char *path_suffix, BOOL allow_null_suffix) +{ + char buf[MAX_PATH]; + + if (!allow_null_suffix && !path_suffix) + return ERROR_INVALID_PARAMETER; + + lstrcpynA(buf, path_prefix, MAX_PATH); + if (path_suffix) + { + strncat(buf, path_suffix, MAX_PATH - strlen(buf)); + } + return RegOpenKeyA(HKEY_CURRENT_USER, buf, key); +}
static void wine_vk_process_quirks(const VkApplicationInfo *pApplicationInfo, struct VkInstance_T *object) { uint8_t validKeysMask = 0; int keyIndex = 0; - HKEY keys[1]; + HKEY keys[3]; int i;
memset(&keys, 0, sizeof(keys));
/* Match regkey settings in the following order, breaking early if settings * are found: + * pApplicationInfo->pApplicationName + * @@ Wine registry key: HKCU\Software\Wine\Vulkan\pApplicationName<pApplicationName> + * pApplicationInfo->pEngineName + * @@ Wine registry key: HKCU\Software\Wine\Vulkan\pEngineName<pEngineName> * global defaults * @@ Wine registry key: HKCU\Software\Wine\Vulkan */ - if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\Wine\Vulkan", keys + keyIndex++) == 0) + if (wine_vk_open_regkey_with_suffix(keys + keyIndex++, "Software\Wine\Vulkan\pApplicationName\", pApplicationInfo->pApplicationName, FALSE) == 0) + validKeysMask |= (1 << (keyIndex - 1)); + if (wine_vk_open_regkey_with_suffix(keys + keyIndex++, "Software\Wine\Vulkan\pEngineName\", pApplicationInfo->pEngineName, FALSE) == 0) + validKeysMask |= (1 << (keyIndex - 1)); + if (wine_vk_open_regkey_with_suffix(keys + keyIndex++, "Software\Wine\Vulkan", NULL, TRUE) == 0) validKeysMask |= (1 << (keyIndex - 1));
/* Load Global Quirks */