From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winevulkan/make_vulkan | 3 ++- dlls/winevulkan/vulkan_thunks.c | 38 ++++++++++++++++++++++++++++++--- dlls/winevulkan/winevk.xml | 11 ++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 dlls/winevulkan/winevk.xml
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 22cca40f15b..48a0134a092 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2989,7 +2989,7 @@ class VkGenerator(object): # Note: unions are stored in structs for dependency reasons, # see comment in parsing section. for struct in self.registry.structs: - if struct.required: + if struct.required and struct.name != "SECURITY_ATTRIBUTES": LOGGER.debug("Generating struct: {0}".format(struct.name)) f.write(struct.definition(align=True)) f.write("\n") @@ -3128,6 +3128,7 @@ class VkRegistry(object): self.video_copyright = video_root.find('./comment').text
root.extend(video_root) + root.extend(ET.parse("winevk.xml").getroot())
self._parse_enums(root) self._parse_types(root) diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index f2ceb7b7fed..ba79adb23db 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -578,6 +578,13 @@ typedef struct VkVideoPictureResourceInfoKHR32 VkImageView DECLSPEC_ALIGN(8) imageViewBinding; } VkVideoPictureResourceInfoKHR32;
+typedef struct SECURITY_ATTRIBUTES32 +{ + DWORD nLength; + PTR32 lpSecurityDescriptor; + BOOL bInheritHandle; +} SECURITY_ATTRIBUTES32; + typedef struct StdVideoAV1SequenceHeader32 { StdVideoAV1SequenceHeaderFlags flags; @@ -9958,6 +9965,31 @@ static void convert_VkMemoryAllocateInfo_win64_to_host(struct conversion_context } #endif /* _WIN64 */
+static void convert_SECURITY_ATTRIBUTES_win32_to_host(const SECURITY_ATTRIBUTES32 *in, SECURITY_ATTRIBUTES *out) +{ + if (!in) return; + + out->nLength = in->nLength; + out->lpSecurityDescriptor = UlongToPtr(in->lpSecurityDescriptor); + out->bInheritHandle = in->bInheritHandle; +} + +static const SECURITY_ATTRIBUTES *convert_SECURITY_ATTRIBUTES_array_win32_to_host(struct conversion_context *ctx, const SECURITY_ATTRIBUTES32 *in, uint32_t count) +{ + SECURITY_ATTRIBUTES *out; + unsigned int i; + + if (!in || !count) return NULL; + + out = conversion_context_alloc(ctx, count * sizeof(*out)); + for (i = 0; i < count; i++) + { + convert_SECURITY_ATTRIBUTES_win32_to_host(&in[i], &out[i]); + } + + return out; +} + static void convert_VkMemoryAllocateInfo_win32_to_host(struct conversion_context *ctx, const VkMemoryAllocateInfo32 *in, VkMemoryAllocateInfo *out) { const VkBaseInStructure32 *in_header; @@ -10003,7 +10035,7 @@ static void convert_VkMemoryAllocateInfo_win32_to_host(struct conversion_context const VkExportMemoryWin32HandleInfoKHR32 *in_ext = (const VkExportMemoryWin32HandleInfoKHR32 *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR; out_ext->pNext = NULL; - out_ext->pAttributes = UlongToPtr(in_ext->pAttributes); + out_ext->pAttributes = convert_SECURITY_ATTRIBUTES_array_win32_to_host(ctx, (const SECURITY_ATTRIBUTES32 *)UlongToPtr(in_ext->pAttributes), 1); out_ext->dwAccess = in_ext->dwAccess; out_ext->name = (LPCWSTR)UlongToPtr(in_ext->name); out_header->pNext = (void *)out_ext; @@ -22499,7 +22531,7 @@ static void convert_VkFenceCreateInfo_win32_to_host(struct conversion_context *c const VkExportFenceWin32HandleInfoKHR32 *in_ext = (const VkExportFenceWin32HandleInfoKHR32 *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR; out_ext->pNext = NULL; - out_ext->pAttributes = UlongToPtr(in_ext->pAttributes); + out_ext->pAttributes = convert_SECURITY_ATTRIBUTES_array_win32_to_host(ctx, (const SECURITY_ATTRIBUTES32 *)UlongToPtr(in_ext->pAttributes), 1); out_ext->dwAccess = in_ext->dwAccess; out_ext->name = (LPCWSTR)UlongToPtr(in_ext->name); out_header->pNext = (void *)out_ext; @@ -26390,7 +26422,7 @@ static void convert_VkSemaphoreCreateInfo_win32_to_host(struct conversion_contex const VkExportSemaphoreWin32HandleInfoKHR32 *in_ext = (const VkExportSemaphoreWin32HandleInfoKHR32 *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR; out_ext->pNext = NULL; - out_ext->pAttributes = UlongToPtr(in_ext->pAttributes); + out_ext->pAttributes = convert_SECURITY_ATTRIBUTES_array_win32_to_host(ctx, (const SECURITY_ATTRIBUTES32 *)UlongToPtr(in_ext->pAttributes), 1); out_ext->dwAccess = in_ext->dwAccess; out_ext->name = (LPCWSTR)UlongToPtr(in_ext->name); out_header->pNext = (void *)out_ext; diff --git a/dlls/winevulkan/winevk.xml b/dlls/winevulkan/winevk.xml new file mode 100644 index 00000000000..58421b063e0 --- /dev/null +++ b/dlls/winevulkan/winevk.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<registry> + <types> + <type requires="windows.h" name="BOOL"/> + <type category="struct" name="SECURITY_ATTRIBUTES"> + <member><type>DWORD</type> <name>nLength</name></member> + <member><type>void</type>* <name>lpSecurityDescriptor</name></member> + <member><type>BOOL</type> <name>bInheritHandle</name></member> + </type> + </types> +</registry>