Merge branch 'trunk'
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index fe03638..7b17a23 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -5344,6 +5344,10 @@
     vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
     vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1,
                             &descriptorSet, 0, NULL);
+    VkViewport viewport = {0, 0, 16, 16, 0, 1};
+    VkRect2D scissor = {{0, 0}, {16, 16}};
+    vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport);
+    vkCmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissor);
     Draw(1, 0, 0, 0);
     m_commandBuffer->EndRenderPass();
     m_commandBuffer->EndCommandBuffer();
@@ -5356,6 +5360,7 @@
     submit_info.pCommandBuffers = &m_commandBuffer->handle();
     vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
     m_errorMonitor->VerifyFound();
+
     // Now re-update descriptor with valid sampler and delete image
     img_info.sampler = sampler2;
     vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
@@ -5365,6 +5370,8 @@
     vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
     vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1,
                             &descriptorSet, 0, NULL);
+    vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport);
+    vkCmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissor);
     Draw(1, 0, 0, 0);
     m_commandBuffer->EndRenderPass();
     m_commandBuffer->EndCommandBuffer();
@@ -5386,6 +5393,8 @@
     vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
     vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1,
                             &descriptorSet, 0, NULL);
+    vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport);
+    vkCmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissor);
     Draw(1, 0, 0, 0);
     m_commandBuffer->EndRenderPass();
     m_commandBuffer->EndCommandBuffer();
@@ -10188,6 +10197,11 @@
     m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo);
     vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
 
+    VkViewport viewport = {0, 0, 16, 16, 0, 1};
+    VkRect2D scissor = {{0, 0}, {16, 16}};
+    vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport);
+    vkCmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissor);
+
     // Render triangle (the error should trigger on the attempt to draw).
     Draw(3, 1, 0, 0);
 
@@ -11878,6 +11892,12 @@
     vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
     vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1,
                             &descriptor_set, 0, nullptr);
+
+    VkViewport viewport = {0, 0, 16, 16, 0, 1};
+    VkRect2D scissor = {{0, 0}, {16, 16}};
+    vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport);
+    vkCmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissor);
+
     Draw(1, 0, 0, 0);
     m_commandBuffer->EndRenderPass();
     m_commandBuffer->EndCommandBuffer();
@@ -11889,11 +11909,12 @@
     // Submit cmd buffer and then destroy sampler while in-flight
     vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
 
-    vkDestroySampler(m_device->device(), sampler, nullptr);
+    vkDestroySampler(m_device->device(), sampler, nullptr); // Destroyed too soon
     m_errorMonitor->VerifyFound();
     vkQueueWaitIdle(m_device->m_queue);
+
     // Now we can actually destroy sampler
-    vkDestroySampler(m_device->device(), sampler, nullptr);
+    vkDestroySampler(m_device->device(), sampler, NULL); // Destroyed for real
     vkDestroyImageView(m_device->device(), view, NULL);
     vkDestroyPipelineLayout(m_device->device(), pipeline_layout, NULL);
     vkDestroyDescriptorSetLayout(m_device->device(), ds_layout, NULL);
@@ -13997,7 +14018,7 @@
     TEST_DESCRIPTION("Test that an error is produced for a shader consuming an input attachment "
                      "which is not included in the subpass description -- array case");
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
-                                         "consumes input attachment index 1 but not provided in subpass");
+                                         "consumes input attachment index 0 but not provided in subpass");
 
     ASSERT_NO_FATAL_FAILURE(InitState());
 
@@ -14011,10 +14032,10 @@
                            "}\n";
     char const *fsSource = "#version 450\n"
                            "\n"
-                           "layout(input_attachment_index=0, set=0, binding=0) uniform subpassInput xs[2];\n"
+                           "layout(input_attachment_index=0, set=0, binding=0) uniform subpassInput xs[1];\n"
                            "layout(location=0) out vec4 color;\n"
                            "void main() {\n"
-                           "   color = subpassLoad(xs[1]);\n"
+                           "   color = subpassLoad(xs[0]);\n"
                            "}\n";
 
     VkShaderObj vs(m_device, vsSource, VK_SHADER_STAGE_VERTEX_BIT, this);
diff --git a/windowsRuntimeInstaller/configure_runtime.c b/windowsRuntimeInstaller/configure_runtime.c
index f952897..d594bd3 100644
--- a/windowsRuntimeInstaller/configure_runtime.c
+++ b/windowsRuntimeInstaller/configure_runtime.c
@@ -205,7 +205,8 @@
     fprintf(log, "API Name: %s\n", api_name);

     

     // This makes System32 and SysWOW64 not do any redirection (well, until 128-bit is a thing)

-    Wow64DisableWow64FsRedirection(NULL);

+    PVOID useless;

+    Wow64DisableWow64FsRedirection(&useless);

     

     // Update System32 (on all systems) and SysWOW64 on 64-bit system

     struct SDKVersion latest_runtime_version;

@@ -357,14 +358,14 @@
         for(int j = 0; j < valueCount; ++j) {

 

             TCHAR name[COPY_BUFFER_SIZE], value[COPY_BUFFER_SIZE];

-            DWORD type, buffSize = COPY_BUFFER_SIZE;

-            RegEnumValue(subKey, j, name, &buffSize, NULL, &type, value, &buffSize);

+            DWORD type, nameSize = COPY_BUFFER_SIZE, valSize = COPY_BUFFER_SIZE;

+            LSTATUS ret = RegEnumValue(subKey, j, name, &nameSize, NULL, &type, value, &valSize);

             if(type == REG_SZ && !strcmp("InstallDir", name)) {

                 *install_paths = realloc(*install_paths, sizeof(char*) * ((*count) + 1));

                 (*install_paths)[*count] = malloc(sizeof(char) * COPY_BUFFER_SIZE);

                 strcpy((*install_paths)[*count], value);

                 found_installation = true;

-            } else if(type == REG_SZ && !strncmp("DisplayVersion", name, 8)) {

+            } else if(type == REG_SZ && !strcmp("DisplayVersion", name)) {

                 *install_versions = realloc(*install_versions, sizeof(struct SDKVersion) * ((*count) + 1));

                 CHECK_ERROR(read_version(value, (*install_versions) + *count));

                 found_version = true;