summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLenny Komow <lenny@lunarg.com>2017-01-13 14:20:57 -0700
committerLenny Komow <lenny@lunarg.com>2017-01-13 14:20:57 -0700
commitea162204a37b1a581d913b7284c968a7714c1ede (patch)
treefe7897ef5db1687326ac7411167ba2cf9c45324f
parentc44ffcd5b0bd5b895ddd90ad97f22b81dffadcae (diff)
winsdk: Allow Configuring layers for older SDKs
Change-Id: I9b13d7c43ee159f935d289ea939ac3c2c1e54875
-rw-r--r--windowsRuntimeInstaller/configure_runtime.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/windowsRuntimeInstaller/configure_runtime.c b/windowsRuntimeInstaller/configure_runtime.c
index 2041f426..f952897d 100644
--- a/windowsRuntimeInstaller/configure_runtime.c
+++ b/windowsRuntimeInstaller/configure_runtime.c
@@ -598,18 +598,27 @@ int update_registry_layers(FILE* log, enum Platform platform, const struct SDKVe
return 0;
}
+ size_t preferred_sdk = count;
for(size_t i = 0; i < count; ++i) {
- if(compare_versions(install_versions + i, version) == 0) {
- if(platform == PLATFORM_X64) {
- CHECK_ERROR_HANDLED(add_explicit_layers(log, install_paths[i], PLATFORM_X64, api_name),
- { free_installations(install_paths, install_versions, count); });
- fprintf(log, "\n");
+ int cmp = compare_versions(install_versions + i, version);
+ if(cmp <= 0 && cmp >= -2) {
+ if(preferred_sdk == count ||
+ (compare_versions(install_versions + i, install_versions + preferred_sdk) > 0)) {
+ preferred_sdk = i;
}
- CHECK_ERROR_HANDLED(add_explicit_layers(log, install_paths[i], PLATFORM_X86, api_name),
+ }
+ }
+
+ if(preferred_sdk < count) {
+ if(platform == PLATFORM_X64) {
+ CHECK_ERROR_HANDLED(add_explicit_layers(log, install_paths[preferred_sdk], PLATFORM_X64, api_name),
{ free_installations(install_paths, install_versions, count); });
- break;
+ fprintf(log, "\n");
}
+ CHECK_ERROR_HANDLED(add_explicit_layers(log, install_paths[preferred_sdk], PLATFORM_X86, api_name),
+ { free_installations(install_paths, install_versions, count); });
}
+
free_installations(install_paths, install_versions, count);
return 0;
}