Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2019
- 76 participants
- 1010 discussions
20 Mar '19
We don't support any handle type yet.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/vulkan-1/vulkan-1.spec | 2 +-
dlls/winevulkan/make_vulkan | 5 ++++-
dlls/winevulkan/vulkan.c | 18 ++++++++++++++++++
dlls/winevulkan/vulkan_thunks.c | 3 +++
dlls/winevulkan/vulkan_thunks.h | 2 ++
dlls/winevulkan/winevulkan.spec | 2 +-
include/wine/vulkan.h | 6 ++++++
7 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec
index 104d69382678..88e4eb72f58d 100644
--- a/dlls/vulkan-1/vulkan-1.spec
+++ b/dlls/vulkan-1/vulkan-1.spec
@@ -180,7 +180,7 @@
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
@ stdcall vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalBufferProperties
@ stdcall vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalFenceProperties
-@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
+@ stdcall vkGetPhysicalDeviceExternalSemaphoreProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalSemaphoreProperties
@ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures
@ stdcall vkGetPhysicalDeviceFeatures2(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures2
@ stdcall vkGetPhysicalDeviceFormatProperties(ptr long ptr) winevulkan.wine_vkGetPhysicalDeviceFormatProperties
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 7a4aa4d8d675..8b0ed0c13ecb 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -120,7 +120,6 @@ BLACKLISTED_EXTENSIONS = [
"VK_KHR_external_semaphore",
"VK_KHR_shader_float16_int8",
# Relates to external_semaphore and needs type conversions in bitflags.
- "VK_KHR_external_semaphore_capabilities",
"VK_KHR_shared_presentable_image", # Needs WSI work.
"VK_KHR_win32_keyed_mutex",
"VK_NV_cooperative_matrix",
@@ -166,6 +165,7 @@ FUNCTION_OVERRIDES = {
"vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
"vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
+ "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
"vkGetPhysicalDeviceImageFormatProperties2" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
# Device functions
@@ -204,6 +204,9 @@ FUNCTION_OVERRIDES = {
"vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False},
"vkGetPhysicalDeviceImageFormatProperties2KHR" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
+ # VK_KHR_external_semaphore_capabilities
+ "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False},
+
# VK_KHR_device_group_creation
"vkEnumeratePhysicalDeviceGroupsKHR" : {"dispatch" : True, "driver" : False, "thunk" : False},
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 1728f3b7dcd4..4387aa8b0a22 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1327,6 +1327,24 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevi
return res;
}
+void WINAPI wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceExternalSemaphoreInfo *semaphore_info, VkExternalSemaphoreProperties *properties)
+{
+ TRACE("%p, %p, %p\n", phys_dev, semaphore_info, properties);
+ properties->exportFromImportedHandleTypes = 0;
+ properties->compatibleHandleTypes = 0;
+ properties->externalSemaphoreFeatures = 0;
+}
+
+void WINAPI wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceExternalSemaphoreInfo *semaphore_info, VkExternalSemaphoreProperties *properties)
+{
+ TRACE("%p, %p, %p\n", phys_dev, semaphore_info, properties);
+ properties->exportFromImportedHandleTypes = 0;
+ properties->compatibleHandleTypes = 0;
+ properties->externalSemaphoreFeatures = 0;
+}
+
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{
TRACE("%p, %u, %p\n", hinst, reason, reserved);
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index 225d68927ab2..ae4bcb206059 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -3542,6 +3542,8 @@ static const struct vulkan_func vk_instance_dispatch_table[] =
{"vkGetPhysicalDeviceExternalBufferPropertiesKHR", &wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR},
{"vkGetPhysicalDeviceExternalFenceProperties", &wine_vkGetPhysicalDeviceExternalFenceProperties},
{"vkGetPhysicalDeviceExternalFencePropertiesKHR", &wine_vkGetPhysicalDeviceExternalFencePropertiesKHR},
+ {"vkGetPhysicalDeviceExternalSemaphoreProperties", &wine_vkGetPhysicalDeviceExternalSemaphoreProperties},
+ {"vkGetPhysicalDeviceExternalSemaphorePropertiesKHR", &wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR},
{"vkGetPhysicalDeviceFeatures", &wine_vkGetPhysicalDeviceFeatures},
{"vkGetPhysicalDeviceFeatures2", &wine_vkGetPhysicalDeviceFeatures2},
{"vkGetPhysicalDeviceFeatures2KHR", &wine_vkGetPhysicalDeviceFeatures2KHR},
@@ -3708,6 +3710,7 @@ static const char * const vk_instance_extensions[] =
"VK_KHR_device_group_creation",
"VK_KHR_external_fence_capabilities",
"VK_KHR_external_memory_capabilities",
+ "VK_KHR_external_semaphore_capabilities",
"VK_KHR_get_physical_device_properties2",
"VK_KHR_surface",
"VK_KHR_win32_surface",
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index 5c99ffd580cf..4e14ac796955 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -60,6 +60,8 @@ void WINAPI wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice ph
void WINAPI wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) DECLSPEC_HIDDEN;
void WINAPI wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) DECLSPEC_HIDDEN;
+void WINAPI wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties);
+void WINAPI wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties);
VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index 626b47e4399a..57ee94abe268 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -183,7 +183,7 @@
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
@ stdcall -private wine_vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr)
@ stdcall -private wine_vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr)
-@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
+@ stdcall -private wine_vkGetPhysicalDeviceExternalSemaphoreProperties(ptr ptr ptr)
@ stdcall -private wine_vkGetPhysicalDeviceFeatures(ptr ptr)
@ stdcall -private wine_vkGetPhysicalDeviceFeatures2(ptr ptr)
@ stdcall -private wine_vkGetPhysicalDeviceFormatProperties(ptr long ptr)
diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h
index ae93a5d12048..0754b03c8395 100644
--- a/include/wine/vulkan.h
+++ b/include/wine/vulkan.h
@@ -148,6 +148,8 @@
#define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation"
#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1
#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities"
+#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities"
#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2
#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor"
#define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 1
@@ -5400,6 +5402,8 @@ typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhys
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *, VkExternalSemaphoreProperties *);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *, VkExternalSemaphoreProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice, VkPhysicalDeviceFeatures *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *);
@@ -5658,6 +5662,8 @@ void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice phy
void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties);
void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
+void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties);
+void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties);
void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures);
void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures);
void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures);
--
2.19.2
2
1
20 Mar '19
We don't support any handle type yet.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/vulkan-1/vulkan-1.spec | 2 +-
dlls/winevulkan/make_vulkan | 45 ++++++++++++++++++++------
dlls/winevulkan/vulkan.c | 56 +++++++++++++++++++++++++++++++++
dlls/winevulkan/vulkan_thunks.c | 13 +++-----
dlls/winevulkan/vulkan_thunks.h | 8 +++++
dlls/winevulkan/winevulkan.spec | 2 +-
include/wine/vulkan.h | 6 ++++
7 files changed, 113 insertions(+), 19 deletions(-)
diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec
index ffe6b43c841a..104d69382678 100644
--- a/dlls/vulkan-1/vulkan-1.spec
+++ b/dlls/vulkan-1/vulkan-1.spec
@@ -178,7 +178,7 @@
@ stdcall vkGetInstanceProcAddr(ptr str) winevulkan.wine_vkGetInstanceProcAddr
@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
-@ stub vkGetPhysicalDeviceExternalBufferProperties
+@ stdcall vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalBufferProperties
@ stdcall vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalFenceProperties
@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
@ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 60e0c62194cd..7a4aa4d8d675 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -89,7 +89,6 @@ BLACKLISTED_EXTENSIONS = [
"VK_EXT_validation_features",
"VK_EXT_validation_flags",
"VK_KHR_display",
- "VK_KHR_external_memory_capabilities",
"VK_KHR_get_surface_capabilities2",
"VK_KHR_surface_protected_capabilities",
"VK_NV_external_memory_capabilities",
@@ -165,7 +164,9 @@ FUNCTION_OVERRIDES = {
"vkEnumerateDeviceExtensionProperties" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkEnumeratePhysicalDeviceGroups" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
+ "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
"vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
+ "vkGetPhysicalDeviceImageFormatProperties2" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
# Device functions
"vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False},
@@ -199,6 +200,10 @@ FUNCTION_OVERRIDES = {
# VK_KHR_external_fence_capabilities
"vkGetPhysicalDeviceExternalFencePropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False},
+ # VK_KHR_external_memory_capabilities
+ "vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False},
+ "vkGetPhysicalDeviceImageFormatProperties2KHR" : {"dispatch" : True, "driver" : False, "thunk" : True, "private_thunk" : True},
+
# VK_KHR_device_group_creation
"vkEnumeratePhysicalDeviceGroupsKHR" : {"dispatch" : True, "driver" : False, "thunk" : False},
@@ -418,9 +423,12 @@ class VkFunction(object):
# For some functions we need some extra metadata from FUNCTION_OVERRIDES.
func_info = FUNCTION_OVERRIDES.get(self.name, None)
- self.dispatch = func_info["dispatch"] if func_info is not None else True
- self.driver = func_info["driver"] if func_info is not None else False
- self.thunk_needed = func_info["thunk"] if func_info is not None else True
+ self.dispatch = func_info["dispatch"] if func_info else True
+ self.driver = func_info["driver"] if func_info else False
+ self.thunk_needed = func_info["thunk"] if func_info else True
+ self.private_thunk = func_info["private_thunk"] if func_info and "private_thunk" in func_info else False
+ if self.private_thunk:
+ self.thunk_needed = True
# Required is set while parsing which APIs and types are required
# and is used by the code generation.
@@ -531,6 +539,9 @@ class VkFunction(object):
def needs_thunk(self):
return self.thunk_needed
+ def needs_private_thunk(self):
+ return self.private_thunk
+
def pfn(self, prefix="p", call_conv=None, conv=False):
""" Create function pointer. """
@@ -588,7 +599,10 @@ class VkFunction(object):
return proto
def body(self):
- body = " {0}".format(self.trace())
+ body = ""
+
+ if not self.needs_private_thunk():
+ body += " {0}".format(self.trace())
params = ", ".join([p.variable(conv=False) for p in self.params])
@@ -617,7 +631,8 @@ class VkFunction(object):
else:
body += " {0}_host {1}_host;\n".format(p.type, p.name)
- body += " {0}\n".format(self.trace())
+ if not self.needs_private_thunk():
+ body += " {0}\n".format(self.trace())
# Call any win_to_host conversion calls.
for p in self.params:
@@ -1981,9 +1996,13 @@ class VkGenerator(object):
continue
# Exports symbols for Core functions.
- if not vk_func.is_core_func():
+ if not vk_func.is_core_func() and not vk_func.needs_private_thunk():
f.write("static ")
- f.write(vk_func.thunk(prefix=prefix, call_conv="WINAPI"))
+
+ if vk_func.needs_private_thunk():
+ f.write(vk_func.thunk(prefix="thunk_"))
+ else:
+ f.write(vk_func.thunk(prefix=prefix, call_conv="WINAPI"))
f.write("static const struct vulkan_func vk_device_dispatch_table[] =\n{\n")
for vk_func in self.registry.device_funcs:
@@ -2080,7 +2099,9 @@ class VkGenerator(object):
# Generate prototypes for device and instance functions requiring a custom implementation.
f.write("/* Functions for which we have custom implementations outside of the thunks. */\n")
for vk_func in self.registry.funcs.values():
- if not vk_func.is_required() or vk_func.is_global_func() or vk_func.needs_thunk():
+ if not vk_func.is_required() or vk_func.is_global_func():
+ continue
+ if vk_func.needs_thunk() and not vk_func.needs_private_thunk():
continue
if vk_func.is_core_func():
@@ -2089,6 +2110,12 @@ class VkGenerator(object):
f.write("{0};\n".format(vk_func.prototype("WINAPI", prefix="wine_", postfix="DECLSPEC_HIDDEN")))
f.write("\n")
+ f.write("/* Private thunks */\n")
+ for vk_func in self.registry.funcs.values():
+ if vk_func.needs_private_thunk():
+ f.write("{0};\n".format(vk_func.prototype(prefix="thunk_", postfix="DECLSPEC_HIDDEN")))
+ f.write("\n")
+
for struct in self.host_structs:
f.write(struct.definition(align=False, conv=True, postfix="_host"))
f.write("\n")
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index f4e492c0e5fb..1728f3b7dcd4 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1271,6 +1271,62 @@ void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice
properties->externalFenceFeatures = 0;
}
+void WINAPI wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties)
+{
+ TRACE("%p, %p, %p\n", phys_dev, buffer_info, properties);
+ memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties));
+}
+
+void WINAPI wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties)
+{
+ TRACE("%p, %p, %p\n", phys_dev, buffer_info, properties);
+ memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties));
+}
+
+VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties)
+{
+ VkExternalImageFormatProperties *external_image_properties;
+ VkResult res;
+
+ TRACE("%p, %p, %p\n", phys_dev, format_info, properties);
+
+ res = thunk_vkGetPhysicalDeviceImageFormatProperties2(phys_dev, format_info, properties);
+
+ if ((external_image_properties = wine_vk_find_struct(properties, EXTERNAL_IMAGE_FORMAT_PROPERTIES)))
+ {
+ VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties;
+ p->externalMemoryFeatures = 0;
+ p->exportFromImportedHandleTypes = 0;
+ p->compatibleHandleTypes = 0;
+ }
+
+ return res;
+}
+
+VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties)
+{
+ VkExternalImageFormatProperties *external_image_properties;
+ VkResult res;
+
+ TRACE("%p, %p, %p\n", phys_dev, format_info, properties);
+
+ res = thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(phys_dev, format_info, properties);
+
+ if ((external_image_properties = wine_vk_find_struct(properties, EXTERNAL_IMAGE_FORMAT_PROPERTIES)))
+ {
+ VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties;
+ p->externalMemoryFeatures = 0;
+ p->exportFromImportedHandleTypes = 0;
+ p->compatibleHandleTypes = 0;
+ }
+
+ return res;
+}
+
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{
TRACE("%p, %u, %p\n", hinst, reason, reserved);
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index a52dd79a52e9..225d68927ab2 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -2900,38 +2900,32 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice p
#endif
}
-VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties)
+VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties)
{
#if defined(USE_STRUCT_CONVERSION)
VkResult result;
VkImageFormatProperties2_host pImageFormatProperties_host;
- TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties);
-
convert_VkImageFormatProperties2_win_to_host(pImageFormatProperties, &pImageFormatProperties_host);
result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2(physicalDevice->phys_dev, pImageFormatInfo, &pImageFormatProperties_host);
convert_VkImageFormatProperties2_host_to_win(&pImageFormatProperties_host, pImageFormatProperties);
return result;
#else
- TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2(physicalDevice->phys_dev, pImageFormatInfo, pImageFormatProperties);
#endif
}
-static VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties)
+VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties)
{
#if defined(USE_STRUCT_CONVERSION)
VkResult result;
VkImageFormatProperties2_host pImageFormatProperties_host;
- TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties);
-
convert_VkImageFormatProperties2_win_to_host(pImageFormatProperties, &pImageFormatProperties_host);
result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2KHR(physicalDevice->phys_dev, pImageFormatInfo, &pImageFormatProperties_host);
convert_VkImageFormatProperties2_host_to_win(&pImageFormatProperties_host, pImageFormatProperties);
return result;
#else
- TRACE("%p, %p, %p\n", physicalDevice, pImageFormatInfo, pImageFormatProperties);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2KHR(physicalDevice->phys_dev, pImageFormatInfo, pImageFormatProperties);
#endif
}
@@ -3544,6 +3538,8 @@ static const struct vulkan_func vk_instance_dispatch_table[] =
{"vkEnumeratePhysicalDeviceGroups", &wine_vkEnumeratePhysicalDeviceGroups},
{"vkEnumeratePhysicalDeviceGroupsKHR", &wine_vkEnumeratePhysicalDeviceGroupsKHR},
{"vkEnumeratePhysicalDevices", &wine_vkEnumeratePhysicalDevices},
+ {"vkGetPhysicalDeviceExternalBufferProperties", &wine_vkGetPhysicalDeviceExternalBufferProperties},
+ {"vkGetPhysicalDeviceExternalBufferPropertiesKHR", &wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR},
{"vkGetPhysicalDeviceExternalFenceProperties", &wine_vkGetPhysicalDeviceExternalFenceProperties},
{"vkGetPhysicalDeviceExternalFencePropertiesKHR", &wine_vkGetPhysicalDeviceExternalFencePropertiesKHR},
{"vkGetPhysicalDeviceFeatures", &wine_vkGetPhysicalDeviceFeatures},
@@ -3711,6 +3707,7 @@ static const char * const vk_instance_extensions[] =
"VK_EXT_swapchain_colorspace",
"VK_KHR_device_group_creation",
"VK_KHR_external_fence_capabilities",
+ "VK_KHR_external_memory_capabilities",
"VK_KHR_get_physical_device_properties2",
"VK_KHR_surface",
"VK_KHR_win32_surface",
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index d49a29a22c83..5c99ffd580cf 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -56,10 +56,18 @@ void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool
PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName);
void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue);
void WINAPI wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue);
+void WINAPI wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties);
+void WINAPI wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) DECLSPEC_HIDDEN;
void WINAPI wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) DECLSPEC_HIDDEN;
+VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties);
+VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
+/* Private thunks */
+VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
+VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
+
typedef struct VkAcquireNextImageInfoKHR_host
{
VkStructureType sType;
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index 1c7795d9802f..626b47e4399a 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -181,7 +181,7 @@
@ stdcall -private wine_vkGetInstanceProcAddr(ptr str)
@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
-@ stub vkGetPhysicalDeviceExternalBufferProperties
+@ stdcall -private wine_vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr)
@ stdcall -private wine_vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr)
@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
@ stdcall -private wine_vkGetPhysicalDeviceFeatures(ptr ptr)
diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h
index aedb3684791e..ae93a5d12048 100644
--- a/include/wine/vulkan.h
+++ b/include/wine/vulkan.h
@@ -146,6 +146,8 @@
#define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1"
#define VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION 1
#define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation"
+#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities"
#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2
#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor"
#define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 1
@@ -5394,6 +5396,8 @@ typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice, cons
typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *);
typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout *);
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance, const char *);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice, VkPhysicalDeviceFeatures *);
@@ -5650,6 +5654,8 @@ void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkIma
void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements);
void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout);
PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName);
+void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties);
+void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties);
void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures);
--
2.19.2
2
1
20 Mar '19
We don't support any handle type yet.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/vulkan-1/vulkan-1.spec | 2 +-
dlls/winevulkan/make_vulkan | 7 +++++--
dlls/winevulkan/vulkan.c | 18 ++++++++++++++++++
dlls/winevulkan/vulkan_thunks.c | 3 +++
dlls/winevulkan/vulkan_thunks.h | 2 ++
dlls/winevulkan/winevulkan.spec | 2 +-
include/wine/vulkan.h | 6 ++++++
7 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec
index 2baa8398663d..ffe6b43c841a 100644
--- a/dlls/vulkan-1/vulkan-1.spec
+++ b/dlls/vulkan-1/vulkan-1.spec
@@ -179,7 +179,7 @@
@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
@ stub vkGetPhysicalDeviceExternalBufferProperties
-@ stub vkGetPhysicalDeviceExternalFenceProperties
+@ stdcall vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceExternalFenceProperties
@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
@ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures
@ stdcall vkGetPhysicalDeviceFeatures2(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures2
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 091a1ddaa6d3..60e0c62194cd 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -89,7 +89,6 @@ BLACKLISTED_EXTENSIONS = [
"VK_EXT_validation_features",
"VK_EXT_validation_flags",
"VK_KHR_display",
- "VK_KHR_external_fence_capabilities",
"VK_KHR_external_memory_capabilities",
"VK_KHR_get_surface_capabilities2",
"VK_KHR_surface_protected_capabilities",
@@ -164,8 +163,9 @@ FUNCTION_OVERRIDES = {
"vkCreateDevice" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkDestroyInstance" : {"dispatch" : False, "driver" : True, "thunk" : False },
"vkEnumerateDeviceExtensionProperties" : {"dispatch" : True, "driver" : False, "thunk" : False},
- "vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkEnumeratePhysicalDeviceGroups" : {"dispatch" : True, "driver" : False, "thunk" : False},
+ "vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
+ "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
# Device functions
"vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False},
@@ -196,6 +196,9 @@ FUNCTION_OVERRIDES = {
"vkGetSwapchainImagesKHR": {"dispatch" : True, "driver" : True, "thunk" : True},
"vkQueuePresentKHR": {"dispatch" : True, "driver" : True, "thunk" : True},
+ # VK_KHR_external_fence_capabilities
+ "vkGetPhysicalDeviceExternalFencePropertiesKHR" : {"dispatch" : False, "driver" : False, "thunk" : False},
+
# VK_KHR_device_group_creation
"vkEnumeratePhysicalDeviceGroupsKHR" : {"dispatch" : True, "driver" : False, "thunk" : False},
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index d35719ef7f3e..f4e492c0e5fb 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1253,6 +1253,24 @@ VkResult WINAPI wine_vkEnumeratePhysicalDeviceGroupsKHR(VkInstance instance,
instance->funcs.p_vkEnumeratePhysicalDeviceGroupsKHR, count, properties);
}
+void WINAPI wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceExternalFenceInfo *fence_info, VkExternalFenceProperties *properties)
+{
+ TRACE("%p, %p, %p\n", phys_dev, fence_info, properties);
+ properties->exportFromImportedHandleTypes = 0;
+ properties->compatibleHandleTypes = 0;
+ properties->externalFenceFeatures = 0;
+}
+
+void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice phys_dev,
+ const VkPhysicalDeviceExternalFenceInfo *fence_info, VkExternalFenceProperties *properties)
+{
+ TRACE("%p, %p, %p\n", phys_dev, fence_info, properties);
+ properties->exportFromImportedHandleTypes = 0;
+ properties->compatibleHandleTypes = 0;
+ properties->externalFenceFeatures = 0;
+}
+
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{
TRACE("%p, %u, %p\n", hinst, reason, reserved);
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index 04e18d5ac8a6..a52dd79a52e9 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -3544,6 +3544,8 @@ static const struct vulkan_func vk_instance_dispatch_table[] =
{"vkEnumeratePhysicalDeviceGroups", &wine_vkEnumeratePhysicalDeviceGroups},
{"vkEnumeratePhysicalDeviceGroupsKHR", &wine_vkEnumeratePhysicalDeviceGroupsKHR},
{"vkEnumeratePhysicalDevices", &wine_vkEnumeratePhysicalDevices},
+ {"vkGetPhysicalDeviceExternalFenceProperties", &wine_vkGetPhysicalDeviceExternalFenceProperties},
+ {"vkGetPhysicalDeviceExternalFencePropertiesKHR", &wine_vkGetPhysicalDeviceExternalFencePropertiesKHR},
{"vkGetPhysicalDeviceFeatures", &wine_vkGetPhysicalDeviceFeatures},
{"vkGetPhysicalDeviceFeatures2", &wine_vkGetPhysicalDeviceFeatures2},
{"vkGetPhysicalDeviceFeatures2KHR", &wine_vkGetPhysicalDeviceFeatures2KHR},
@@ -3708,6 +3710,7 @@ static const char * const vk_instance_extensions[] =
{
"VK_EXT_swapchain_colorspace",
"VK_KHR_device_group_creation",
+ "VK_KHR_external_fence_capabilities",
"VK_KHR_get_physical_device_properties2",
"VK_KHR_surface",
"VK_KHR_win32_surface",
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index 518516fd593b..d49a29a22c83 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -56,6 +56,8 @@ void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool
PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName);
void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue);
void WINAPI wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue);
+void WINAPI wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
+void WINAPI wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
typedef struct VkAcquireNextImageInfoKHR_host
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index 97249f66e56e..1c7795d9802f 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -182,7 +182,7 @@
@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
@ stub vkGetPhysicalDeviceExternalBufferProperties
-@ stub vkGetPhysicalDeviceExternalFenceProperties
+@ stdcall -private wine_vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr)
@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
@ stdcall -private wine_vkGetPhysicalDeviceFeatures(ptr ptr)
@ stdcall -private wine_vkGetPhysicalDeviceFeatures2(ptr ptr)
diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h
index 2b8950ac9879..aedb3684791e 100644
--- a/include/wine/vulkan.h
+++ b/include/wine/vulkan.h
@@ -176,6 +176,8 @@
#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace"
#define VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION 1
#define VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME "VK_KHR_create_renderpass2"
+#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1
+#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities"
#define VK_KHR_MAINTENANCE2_SPEC_VERSION 1
#define VK_KHR_MAINTENANCE2_EXTENSION_NAME "VK_KHR_maintenance2"
#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1
@@ -5392,6 +5394,8 @@ typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice, cons
typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *);
typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout *);
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance, const char *);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice, VkPhysicalDeviceFeatures *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *);
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *);
@@ -5646,6 +5650,8 @@ void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkIma
void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements);
void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout);
PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName);
+void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
+void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties);
void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures);
void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures);
void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures);
--
2.19.2
2
1
[PATCH] HID: Handle failure to create device by trying to open it instead
by Aric Stewart 20 Mar '19
by Aric Stewart 20 Mar '19
20 Mar '19
Signed-off-by: Aric Stewart <aric(a)codeweavers.com>
---
dlls/hidclass.sys/device.c | 9 +++++----
dlls/winebus.sys/main.c | 15 ++++++++++++---
2 files changed, 17 insertions(+), 7 deletions(-)
2
1
20 Mar '19
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46846
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/action.c | 236 ++++++++++++-------------------------
dlls/msi/appsearch.c | 172 ++++++++++++---------------
dlls/msi/custom.c | 2 +-
dlls/msi/files.c | 319 +++++++++++++++++++++++++++++++++++++++++----------
dlls/msi/font.c | 20 ++--
dlls/msi/install.c | 2 +-
dlls/msi/media.c | 13 +--
dlls/msi/msi.c | 11 +-
dlls/msi/msipriv.h | 31 ++++-
dlls/msi/package.c | 7 ++
10 files changed, 467 insertions(+), 346 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index d95960590c..b51a21d457 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -718,50 +718,6 @@ MSIFOLDER *msi_get_loaded_folder( MSIPACKAGE *package, const WCHAR *dir )
return NULL;
}
-/*
- * Recursively create all directories in the path.
- * shamelessly stolen from setupapi/queue.c
- */
-BOOL msi_create_full_path( const WCHAR *path )
-{
- BOOL ret = TRUE;
- WCHAR *new_path;
- int len;
-
- new_path = msi_alloc( (strlenW( path ) + 1) * sizeof(WCHAR) );
- strcpyW( new_path, path );
-
- while ((len = strlenW( new_path )) && new_path[len - 1] == '\\')
- new_path[len - 1] = 0;
-
- while (!CreateDirectoryW( new_path, NULL ))
- {
- WCHAR *slash;
- DWORD last_error = GetLastError();
- if (last_error == ERROR_ALREADY_EXISTS) break;
- if (last_error != ERROR_PATH_NOT_FOUND)
- {
- ret = FALSE;
- break;
- }
- if (!(slash = strrchrW( new_path, '\\' )))
- {
- ret = FALSE;
- break;
- }
- len = slash - new_path;
- new_path[len] = 0;
- if (!msi_create_full_path( new_path ))
- {
- ret = FALSE;
- break;
- }
- new_path[len] = '\\';
- }
- msi_free( new_path );
- return ret;
-}
-
void msi_ui_progress( MSIPACKAGE *package, int a, int b, int c, int d )
{
MSIRECORD *row;
@@ -843,8 +799,9 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
TRACE("folder is %s\n", debugstr_w(full_path));
folder = msi_get_loaded_folder( package, dir );
- if (folder->State == FOLDER_STATE_UNINITIALIZED) msi_create_full_path( full_path );
+ if (folder->State == FOLDER_STATE_UNINITIALIZED) msi_create_full_path( package, full_path );
folder->State = FOLDER_STATE_CREATED;
+
return ERROR_SUCCESS;
}
@@ -2054,37 +2011,6 @@ static UINT ITERATE_CostFinalizeConditions(MSIRECORD *row, LPVOID param)
return ERROR_SUCCESS;
}
-VS_FIXEDFILEINFO *msi_get_disk_file_version( LPCWSTR filename )
-{
- static const WCHAR name[] = {'\\',0};
- VS_FIXEDFILEINFO *ptr, *ret;
- LPVOID version;
- DWORD versize, handle;
- UINT sz;
-
- versize = GetFileVersionInfoSizeW( filename, &handle );
- if (!versize)
- return NULL;
-
- version = msi_alloc( versize );
- if (!version)
- return NULL;
-
- GetFileVersionInfoW( filename, 0, versize, version );
-
- if (!VerQueryValueW( version, name, (LPVOID *)&ptr, &sz ))
- {
- msi_free( version );
- return NULL;
- }
-
- ret = msi_alloc( sz );
- memcpy( ret, ptr, sz );
-
- msi_free( version );
- return ret;
-}
-
int msi_compare_file_versions( VS_FIXEDFILEINFO *fi, const WCHAR *version )
{
DWORD ms, ls;
@@ -2110,33 +2036,6 @@ int msi_compare_font_versions( const WCHAR *ver1, const WCHAR *ver2 )
return 0;
}
-DWORD msi_get_disk_file_size( LPCWSTR filename )
-{
- HANDLE file;
- DWORD size;
-
- file = CreateFileW( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
- if (file == INVALID_HANDLE_VALUE)
- return INVALID_FILE_SIZE;
-
- size = GetFileSize( file, NULL );
- CloseHandle( file );
- return size;
-}
-
-BOOL msi_file_hash_matches( MSIFILE *file )
-{
- UINT r;
- MSIFILEHASHINFO hash;
-
- hash.dwFileHashInfoSize = sizeof(MSIFILEHASHINFO);
- r = msi_get_filehash( file->TargetPath, &hash );
- if (r != ERROR_SUCCESS)
- return FALSE;
-
- return !memcmp( &hash, &file->hash, sizeof(MSIFILEHASHINFO) );
-}
-
static WCHAR *create_temp_dir( MSIDATABASE *db )
{
static UINT id;
@@ -2262,17 +2161,17 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
set_target_path( package, file );
if ((comp->assembly && !comp->assembly->installed) ||
- GetFileAttributesW(file->TargetPath) == INVALID_FILE_ATTRIBUTES)
+ msi_get_file_attributes( package, file->TargetPath ) == INVALID_FILE_ATTRIBUTES)
{
comp->Cost += file->FileSize;
continue;
}
- file_size = msi_get_disk_file_size( file->TargetPath );
+ file_size = msi_get_disk_file_size( package, file->TargetPath );
TRACE("%s (size %u)\n", debugstr_w(file->TargetPath), file_size);
if (file->Version)
{
- if ((file_version = msi_get_disk_file_version( file->TargetPath )))
+ if ((file_version = msi_get_disk_file_version( package, file->TargetPath )))
{
if (msi_compare_file_versions( file_version, file->Version ) < 0)
{
@@ -2281,7 +2180,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
msi_free( file_version );
continue;
}
- else if ((font_version = msi_font_version_from_file( file->TargetPath )))
+ else if ((font_version = msi_get_font_file_version( package, file->TargetPath )))
{
if (msi_compare_font_versions( font_version, file->Version ) < 0)
{
@@ -2296,6 +2195,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
comp->Cost += file->FileSize - file_size;
}
}
+
return ERROR_SUCCESS;
}
@@ -3754,6 +3654,24 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
return TRUE;
}
+static HMODULE msi_load_library( MSIPACKAGE *package, const WCHAR *filename, DWORD flags )
+{
+ HMODULE module;
+ msi_disable_fs_redirection( package );
+ module = LoadLibraryExW( filename, NULL, flags );
+ msi_revert_fs_redirection( package );
+ return module;
+}
+
+static HRESULT msi_load_typelib( MSIPACKAGE *package, const WCHAR *filename, REGKIND kind, ITypeLib **lib )
+{
+ HRESULT hr;
+ msi_disable_fs_redirection( package );
+ hr = LoadTypeLibEx( filename, kind, lib );
+ msi_revert_fs_redirection( package );
+ return hr;
+}
+
static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE* package = param;
@@ -3784,7 +3702,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
}
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row);
- module = LoadLibraryExW( file->TargetPath, NULL, LOAD_LIBRARY_AS_DATAFILE );
+ module = msi_load_library( package, file->TargetPath, LOAD_LIBRARY_AS_DATAFILE );
if (module)
{
LPCWSTR guid;
@@ -3821,7 +3739,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
}
else
{
- hr = LoadTypeLibEx(file->TargetPath, REGKIND_REGISTER, &tlib);
+ hr = msi_load_typelib( package, file->TargetPath, REGKIND_REGISTER, &tlib );
if (FAILED(hr))
{
ERR("Failed to load type library: %08x\n", hr);
@@ -3932,7 +3850,7 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row )
return NULL;
}
/* may be needed because of a bug somewhere else */
- msi_create_full_path( link_folder );
+ msi_create_full_path( package, link_folder );
filename = msi_dup_record_field( row, 3 );
msi_reduce_to_long_filename( filename );
@@ -3965,7 +3883,7 @@ WCHAR *msi_build_icon_path( MSIPACKAGE *package, const WCHAR *icon_name )
msi_free( appdata );
}
dest = msi_build_directory_name( 3, folder, szInstaller, package->ProductCode );
- msi_create_full_path( dest );
+ msi_create_full_path( package, dest );
path = msi_build_directory_name( 2, dest, icon_name );
msi_free( folder );
msi_free( dest );
@@ -4069,10 +3987,14 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
full_path = msi_get_target_folder( package, wkdir );
if (full_path) IShellLinkW_SetWorkingDirectory( sl, full_path );
}
- link_file = get_link_file(package, row);
+ link_file = get_link_file(package, row);
TRACE("Writing shortcut to %s\n", debugstr_w(link_file));
+
+ msi_disable_fs_redirection( package );
IPersistFile_Save(pf, link_file, FALSE);
+ msi_revert_fs_redirection( package );
+
msi_free(link_file);
err:
@@ -4130,12 +4052,8 @@ static UINT ITERATE_RemoveShortcuts( MSIRECORD *row, LPVOID param )
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONDATA, row);
link_file = get_link_file( package, row );
-
TRACE("Removing shortcut file %s\n", debugstr_w( link_file ));
- if (!DeleteFileW( link_file ))
- {
- WARN("Failed to remove shortcut file %u\n", GetLastError());
- }
+ if (!msi_delete_file( package, link_file )) WARN("Failed to remove shortcut file %u\n", GetLastError());
msi_free( link_file );
return ERROR_SUCCESS;
@@ -4163,51 +4081,49 @@ static UINT ACTION_RemoveShortcuts( MSIPACKAGE *package )
static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param)
{
- MSIPACKAGE* package = param;
- HANDLE the_file;
- LPWSTR FilePath;
- LPCWSTR FileName;
- CHAR buffer[1024];
+ MSIPACKAGE *package = param;
+ HANDLE handle;
+ WCHAR *icon_path;
+ const WCHAR *filename;
+ char buffer[1024];
DWORD sz;
UINT rc;
- FileName = MSI_RecordGetString(row,1);
- if (!FileName)
+ filename = MSI_RecordGetString( row, 1 );
+ if (!filename)
{
- ERR("Unable to get FileName\n");
+ ERR("Unable to get filename\n");
return ERROR_SUCCESS;
}
- FilePath = msi_build_icon_path(package, FileName);
-
- TRACE("Creating icon file at %s\n",debugstr_w(FilePath));
+ icon_path = msi_build_icon_path( package, filename );
- the_file = CreateFileW(FilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ TRACE("Creating icon file at %s\n", debugstr_w(icon_path));
- if (the_file == INVALID_HANDLE_VALUE)
+ handle = msi_create_file( package, icon_path, GENERIC_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL );
+ if (handle == INVALID_HANDLE_VALUE)
{
- ERR("Unable to create file %s\n",debugstr_w(FilePath));
- msi_free(FilePath);
+ ERR("Unable to create file %s\n", debugstr_w(icon_path));
+ msi_free( icon_path );
return ERROR_SUCCESS;
}
- do
+ do
{
- DWORD write;
+ DWORD count;
sz = 1024;
- rc = MSI_RecordReadStream(row,2,buffer,&sz);
+ rc = MSI_RecordReadStream( row, 2, buffer, &sz );
if (rc != ERROR_SUCCESS)
{
ERR("Failed to get stream\n");
- DeleteFileW(FilePath);
+ msi_delete_file( package, icon_path );
break;
}
- WriteFile(the_file,buffer,sz,&write,NULL);
+ WriteFile( handle, buffer, sz, &count, NULL );
} while (sz == 1024);
- msi_free(FilePath);
- CloseHandle(the_file);
+ msi_free( icon_path );
+ CloseHandle( handle );
return ERROR_SUCCESS;
}
@@ -5405,11 +5321,11 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param )
if ((icon_path = msi_build_icon_path( package, icon )))
{
TRACE("removing icon file %s\n", debugstr_w(icon_path));
- DeleteFileW( icon_path );
+ msi_delete_file( package, icon_path );
if ((p = strrchrW( icon_path, '\\' )))
{
*p = 0;
- RemoveDirectoryW( icon_path );
+ msi_remove_directory( package, icon_path );
}
msi_free( icon_path );
}
@@ -7827,9 +7743,18 @@ static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
return ERROR_SUCCESS;
}
-static void bind_image( const char *filename, const char *path )
+static BOOL msi_bind_image( MSIPACKAGE *package, const char *filename, const char *path )
{
- if (!BindImageEx( 0, filename, path, NULL, NULL ))
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = BindImage( filename, path, NULL );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+static void bind_image( MSIPACKAGE *package, const char *filename, const char *path )
+{
+ if (!msi_bind_image( package, filename, path ))
{
WARN("failed to bind image %u\n", GetLastError());
}
@@ -7851,8 +7776,9 @@ static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
return ERROR_SUCCESS;
}
if (!(filenameA = strdupWtoA( file->TargetPath ))) return ERROR_SUCCESS;
+
path_list = msi_split_string( paths, ';' );
- if (!path_list) bind_image( filenameA, NULL );
+ if (!path_list) bind_image( package, filenameA, NULL );
else
{
for (i = 0; path_list[i] && path_list[i][0]; i++)
@@ -7860,7 +7786,7 @@ static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
deformat_string( package, path_list[i], &pathW );
if ((pathA = strdupWtoA( pathW )))
{
- bind_image( filenameA, pathA );
+ bind_image( package, filenameA, pathA );
msi_free( pathA );
}
msi_free( pathW );
@@ -7868,6 +7794,7 @@ static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param )
}
msi_free( path_list );
msi_free( filenameA );
+
return ERROR_SUCCESS;
}
@@ -7884,10 +7811,8 @@ static UINT ACTION_BindImage( MSIPACKAGE *package )
{
r = MSI_IterateRecords( view, NULL, ITERATE_BindImage, package );
msiobj_release( &view->hdr );
- if (r != ERROR_SUCCESS)
- return r;
}
- return ERROR_SUCCESS;
+ return r;
}
static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, LPCWSTR table )
@@ -8034,12 +7959,8 @@ StandardActions[] =
static UINT ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action)
{
UINT rc = ERROR_FUNCTION_NOT_CALLED;
- void *cookie;
UINT i;
- if (is_wow64 && package->platform == PLATFORM_X64)
- Wow64DisableWow64FsRedirection(&cookie);
-
i = 0;
while (StandardActions[i].action != NULL)
{
@@ -8075,9 +7996,6 @@ static UINT ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action)
i++;
}
- if (is_wow64 && package->platform == PLATFORM_X64)
- Wow64RevertWow64FsRedirection(cookie);
-
return rc;
}
@@ -8087,12 +8005,6 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
TRACE("Performing action (%s)\n", debugstr_w(action));
- if (!msi_init_assembly_caches( package ))
- {
- ERR("can't initialize assembly caches\n");
- return ERROR_FUNCTION_FAILED;
- }
-
package->action_progress_increment = 0;
rc = ACTION_HandleStandardAction(package, action);
diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index 806365191d..047085d1f3 100644
--- a/dlls/msi/appsearch.c
+++ b/dlls/msi/appsearch.c
@@ -81,7 +81,7 @@ void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls)
* Returns ERROR_SUCCESS upon success (where not finding the record counts as
* success), something else on error.
*/
-static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig, LPCWSTR name)
+static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *name )
{
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ',
@@ -155,16 +155,16 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
}
/* Frees any memory allocated in sig */
-static void ACTION_FreeSignature(MSISIGNATURE *sig)
+static void free_signature( MSISIGNATURE *sig )
{
msi_free(sig->File);
msi_free(sig->Languages);
}
-static LPWSTR app_search_file(LPWSTR path, MSISIGNATURE *sig)
+static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
{
VS_FIXEDFILEINFO *info;
- DWORD attr, handle, size;
+ DWORD attr, size;
LPWSTR val = NULL;
LPBYTE buffer;
@@ -173,20 +173,18 @@ static LPWSTR app_search_file(LPWSTR path, MSISIGNATURE *sig)
PathRemoveFileSpecW(path);
PathAddBackslashW(path);
- attr = GetFileAttributesW(path);
- if (attr != INVALID_FILE_ATTRIBUTES &&
- (attr & FILE_ATTRIBUTE_DIRECTORY))
+ attr = msi_get_file_attributes( package, path );
+ if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
return strdupW(path);
return NULL;
}
- attr = GetFileAttributesW(path);
- if (attr == INVALID_FILE_ATTRIBUTES ||
- (attr & FILE_ATTRIBUTE_DIRECTORY))
+ attr = msi_get_file_attributes( package, path );
+ if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY))
return NULL;
- size = GetFileVersionInfoSizeW(path, &handle);
+ size = msi_get_file_version_info( package, path, 0, NULL );
if (!size)
return strdupW(path);
@@ -194,7 +192,8 @@ static LPWSTR app_search_file(LPWSTR path, MSISIGNATURE *sig)
if (!buffer)
return NULL;
- if (!GetFileVersionInfoW(path, 0, size, buffer))
+ size = msi_get_file_version_info( package, path, size, buffer );
+ if (!size)
goto done;
if (!VerQueryValueW(buffer, szBackSlash, (LPVOID)&info, &size) || !info)
@@ -227,7 +226,7 @@ done:
return val;
}
-static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATURE *sig)
+static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ',
@@ -240,7 +239,6 @@ static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MS
'`','S','i','g','n','a','t','u','r','e','`',' ',
'W','H','E','R','E',' ','`','S','i','g','n','a','t','u','r','e','`',' ','=',' ',
'\'','%','s','\'',0};
-
MSIRECORD *row, *rec;
LPCWSTR signature, guid;
BOOL sigpresent = TRUE;
@@ -275,7 +273,7 @@ static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MS
if (!*path)
goto done;
- attr = GetFileAttributesW(path);
+ attr = msi_get_file_attributes( package, path );
if (attr == INVALID_FILE_ATTRIBUTES)
goto done;
@@ -283,7 +281,7 @@ static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MS
if (type != msidbLocatorTypeDirectory && sigpresent && !isdir)
{
- *appValue = app_search_file(path, sig);
+ *appValue = search_file( package, path, sig );
}
else if (!sigpresent && (type != msidbLocatorTypeDirectory || isdir))
{
@@ -302,9 +300,8 @@ static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MS
PathAddBackslashW(path);
lstrcatW(path, MSI_RecordGetString(rec, 2));
- attr = GetFileAttributesW(path);
- if (attr != INVALID_FILE_ATTRIBUTES &&
- !(attr & FILE_ATTRIBUTE_DIRECTORY))
+ attr = msi_get_file_attributes( package, path );
+ if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
*appValue = strdupW(path);
}
@@ -314,8 +311,7 @@ done:
return ERROR_SUCCESS;
}
-static void ACTION_ConvertRegValue(DWORD regType, const BYTE *value, DWORD sz,
- LPWSTR *appValue)
+static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR **appValue )
{
static const WCHAR dwordFmt[] = { '#','%','d','\0' };
static const WCHAR binPre[] = { '#','x','\0' };
@@ -365,10 +361,9 @@ static void ACTION_ConvertRegValue(DWORD regType, const BYTE *value, DWORD sz,
}
}
-static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
- LPCWSTR path, int depth, LPWSTR *appValue);
+static UINT search_directory( MSIPACKAGE *, MSISIGNATURE *, const WCHAR *, int, WCHAR ** );
-static UINT ACTION_AppSearchReg(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATURE *sig)
+static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
@@ -473,13 +468,13 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNAT
switch (type & 0x0f)
{
case msidbLocatorTypeDirectory:
- ACTION_SearchDirectory(package, sig, ptr, 0, appValue);
+ search_directory( package, sig, ptr, 0, appValue );
break;
case msidbLocatorTypeFileName:
- *appValue = app_search_file(ptr, sig);
+ *appValue = search_file( package, ptr, sig );
break;
case msidbLocatorTypeRawValue:
- ACTION_ConvertRegValue(regType, value, sz, appValue);
+ convert_reg_value( regType, value, sz, appValue );
break;
default:
FIXME("unimplemented for type %d (key path %s, value %s)\n",
@@ -520,8 +515,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field)
return strdupW(beg);
}
-static UINT ACTION_AppSearchIni(MSIPACKAGE *package, LPWSTR *appValue,
- MSISIGNATURE *sig)
+static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
{
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ',
@@ -561,10 +555,10 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, LPWSTR *appValue,
switch (type & 0x0f)
{
case msidbLocatorTypeDirectory:
- ACTION_SearchDirectory(package, sig, buf, 0, appValue);
+ search_directory( package, sig, buf, 0, appValue );
break;
case msidbLocatorTypeFileName:
- *appValue = app_search_file(buf, sig);
+ *appValue = search_file( package, buf, sig );
break;
case msidbLocatorTypeRawValue:
*appValue = get_ini_field(buf, field);
@@ -590,8 +584,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, LPWSTR *appValue,
* - what does AppSearch return if the table values are invalid?
* - what if dst is too small?
*/
-static void ACTION_ExpandAnyPath(MSIPACKAGE *package, WCHAR *src, WCHAR *dst,
- size_t len)
+static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR *dst, size_t len )
{
WCHAR *ptr, *deformatted;
@@ -685,20 +678,20 @@ done:
* Return ERROR_SUCCESS in case of success (whether or not the file matches),
* something else if an install-halting error occurs.
*/
-static UINT ACTION_FileVersionMatches(const MSISIGNATURE *sig, LPCWSTR filePath,
- BOOL *matches)
+static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, const WCHAR *filePath,
+ BOOL *matches )
{
UINT len;
void *version;
VS_FIXEDFILEINFO *info = NULL;
- DWORD zero, size = GetFileVersionInfoSizeW( filePath, &zero );
+ DWORD size = msi_get_file_version_info( package, filePath, 0, NULL );
*matches = FALSE;
if (!size) return ERROR_SUCCESS;
if (!(version = msi_alloc( size ))) return ERROR_OUTOFMEMORY;
- if (GetFileVersionInfoW( filePath, 0, size, version ))
+ if (msi_get_file_version_info( package, filePath, size, version ))
VerQueryValueW( version, szBackSlash, (void **)&info, &len );
if (info)
@@ -745,8 +738,8 @@ static UINT ACTION_FileVersionMatches(const MSISIGNATURE *sig, LPCWSTR filePath,
* Return ERROR_SUCCESS in case of success (whether or not the file matches),
* something else if an install-halting error occurs.
*/
-static UINT ACTION_FileMatchesSig(const MSISIGNATURE *sig,
- const WIN32_FIND_DATAW *findData, LPCWSTR fullFilePath, BOOL *matches)
+static UINT file_matches_sig( MSIPACKAGE *package, const MSISIGNATURE *sig, const WIN32_FIND_DATAW *findData,
+ const WCHAR *fullFilePath, BOOL *matches )
{
UINT rc = ERROR_SUCCESS;
@@ -778,7 +771,7 @@ static UINT ACTION_FileMatchesSig(const MSISIGNATURE *sig,
*matches = FALSE;
if (*matches && (sig->MinVersionMS || sig->MinVersionLS ||
sig->MaxVersionMS || sig->MaxVersionLS))
- rc = ACTION_FileVersionMatches(sig, fullFilePath, matches);
+ rc = file_version_matches( package, sig, fullFilePath, matches );
return rc;
}
@@ -790,9 +783,10 @@ static UINT ACTION_FileMatchesSig(const MSISIGNATURE *sig,
* Returns ERROR_SUCCESS on success (which may include non-critical errors),
* something else on failures which should halt the install.
*/
-static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
- MSISIGNATURE *sig, LPCWSTR dir, int depth)
+static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig, const WCHAR *dir,
+ int depth )
{
+ static const WCHAR starDotStarW[] = { '*','.','*',0 };
HANDLE hFind;
WIN32_FIND_DATAW findData;
UINT rc = ERROR_SUCCESS;
@@ -801,10 +795,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
WCHAR *buf;
DWORD len;
- static const WCHAR starDotStarW[] = { '*','.','*',0 };
-
- TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir),
- debugstr_w(sig->File), depth);
+ TRACE("Searching directory %s for file %s, depth %d\n", debugstr_w(dir), debugstr_w(sig->File), depth);
if (depth < 0)
return ERROR_SUCCESS;
@@ -823,14 +814,14 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
PathAddBackslashW(buf);
lstrcatW(buf, sig->File);
- hFind = FindFirstFileW(buf, &findData);
+ hFind = msi_find_first_file( package, buf, &findData );
if (hFind != INVALID_HANDLE_VALUE)
{
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
BOOL matches;
- rc = ACTION_FileMatchesSig(sig, &findData, buf, &matches);
+ rc = file_matches_sig( package, sig, &findData, buf, &matches );
if (rc == ERROR_SUCCESS && matches)
{
TRACE("found file, returning %s\n", debugstr_w(buf));
@@ -846,7 +837,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
PathAddBackslashW(buf);
lstrcatW(buf, starDotStarW);
- hFind = FindFirstFileW(buf, &findData);
+ hFind = msi_find_first_file( package, buf, &findData );
if (hFind != INVALID_HANDLE_VALUE)
{
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
@@ -855,12 +846,10 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
{
lstrcpyW(subpath, dir);
PathAppendW(subpath, findData.cFileName);
- rc = ACTION_RecurseSearchDirectory(package, appValue, sig,
- subpath, depth - 1);
+ rc = recurse_search_directory( package, appValue, sig, subpath, depth - 1 );
}
- while (rc == ERROR_SUCCESS && !*appValue &&
- FindNextFileW(hFind, &findData) != 0)
+ while (rc == ERROR_SUCCESS && !*appValue && msi_find_next_file( package, hFind, &findData ))
{
if (!strcmpW( findData.cFileName, szDot ) ||
!strcmpW( findData.cFileName, szDotDot ))
@@ -869,8 +858,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
lstrcpyW(subpath, dir);
PathAppendW(subpath, findData.cFileName);
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- rc = ACTION_RecurseSearchDirectory(package, appValue,
- sig, subpath, depth - 1);
+ rc = recurse_search_directory( package, appValue, sig, subpath, depth - 1 );
}
FindClose(hFind);
@@ -883,10 +871,9 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
return rc;
}
-static UINT ACTION_CheckDirectory(MSIPACKAGE *package, LPCWSTR dir,
- LPWSTR *appValue)
+static UINT check_directory( MSIPACKAGE *package, const WCHAR *dir, WCHAR **appValue )
{
- DWORD attr = GetFileAttributesW(dir);
+ DWORD attr = msi_get_file_attributes( package, dir );
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
{
@@ -897,7 +884,7 @@ static UINT ACTION_CheckDirectory(MSIPACKAGE *package, LPCWSTR dir,
return ERROR_SUCCESS;
}
-static BOOL ACTION_IsFullPath(LPCWSTR path)
+static BOOL is_full_path( const WCHAR *path )
{
WCHAR first = toupperW(path[0]);
BOOL ret;
@@ -911,26 +898,24 @@ static BOOL ACTION_IsFullPath(LPCWSTR path)
return ret;
}
-static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
- LPCWSTR path, int depth, LPWSTR *appValue)
+static UINT search_directory( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *path, int depth, WCHAR **appValue )
{
UINT rc;
DWORD attr;
LPWSTR val = NULL;
- TRACE("%p, %p, %s, %d, %p\n", package, sig, debugstr_w(path), depth,
- appValue);
+ TRACE("%p, %p, %s, %d, %p\n", package, sig, debugstr_w(path), depth, appValue);
- if (ACTION_IsFullPath(path))
+ if (is_full_path( path ))
{
if (sig->File)
- rc = ACTION_RecurseSearchDirectory(package, &val, sig, path, depth);
+ rc = recurse_search_directory( package, &val, sig, path, depth );
else
{
/* Recursively searching a directory makes no sense when the
* directory to search is the thing you're trying to find.
*/
- rc = ACTION_CheckDirectory(package, path, &val);
+ rc = check_directory( package, path, &val );
}
}
else
@@ -952,16 +937,14 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
lstrcpynW(pathWithDrive + 3, path, ARRAY_SIZE(pathWithDrive) - 3);
if (sig->File)
- rc = ACTION_RecurseSearchDirectory(package, &val, sig,
- pathWithDrive, depth);
+ rc = recurse_search_directory( package, &val, sig, pathWithDrive, depth );
else
- rc = ACTION_CheckDirectory(package, pathWithDrive, &val);
+ rc = check_directory( package, pathWithDrive, &val );
}
}
- attr = GetFileAttributesW(val);
- if (attr != INVALID_FILE_ATTRIBUTES &&
- (attr & FILE_ATTRIBUTE_DIRECTORY) &&
+ attr = msi_get_file_attributes( package, val );
+ if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) &&
val && val[lstrlenW(val) - 1] != '\\')
{
val = msi_realloc(val, (lstrlenW(val) + 2) * sizeof(WCHAR));
@@ -977,10 +960,9 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
return rc;
}
-static UINT ACTION_AppSearchSigName(MSIPACKAGE *package, LPCWSTR sigName,
- MSISIGNATURE *sig, LPWSTR *appValue);
+static UINT search_sig_name( MSIPACKAGE *, const WCHAR *, MSISIGNATURE *, WCHAR ** );
-static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATURE *sig)
+static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
{
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ',
@@ -1014,8 +996,8 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU
{
MSISIGNATURE parentSig;
- ACTION_AppSearchSigName(package, parentName, &parentSig, &parent);
- ACTION_FreeSignature(&parentSig);
+ search_sig_name( package, parentName, &parentSig, &parent );
+ free_signature( &parentSig );
if (!parent)
{
msiobj_release(&row->hdr);
@@ -1032,13 +1014,13 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU
depth = MSI_RecordGetInteger(row,4);
if (sz)
- ACTION_ExpandAnyPath(package, path, expanded, MAX_PATH);
+ expand_any_path( package, path, expanded, MAX_PATH );
else
strcpyW(expanded, path);
if (parent)
{
- attr = GetFileAttributesW(parent);
+ attr = msi_get_file_attributes( package, parent );
if (attr != INVALID_FILE_ATTRIBUTES &&
!(attr & FILE_ATTRIBUTE_DIRECTORY))
{
@@ -1049,45 +1031,42 @@ static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATU
strcpyW(path, parent);
strcatW(path, expanded);
}
- else if (sz)
- strcpyW(path, expanded);
+ else if (sz) strcpyW(path, expanded);
PathAddBackslashW(path);
- rc = ACTION_SearchDirectory(package, sig, path, depth, appValue);
+ rc = search_directory( package, sig, path, depth, appValue );
msi_free(parent);
msiobj_release(&row->hdr);
-
TRACE("returning %d\n", rc);
return rc;
}
-static UINT ACTION_AppSearchSigName(MSIPACKAGE *package, LPCWSTR sigName,
- MSISIGNATURE *sig, LPWSTR *appValue)
+static UINT search_sig_name( MSIPACKAGE *package, const WCHAR *sigName, MSISIGNATURE *sig, WCHAR **appValue )
{
UINT rc;
*appValue = NULL;
- rc = ACTION_AppSearchGetSignature(package, sig, sigName);
+ rc = get_signature( package, sig, sigName );
if (rc == ERROR_SUCCESS)
{
- rc = ACTION_AppSearchComponents(package, appValue, sig);
+ rc = search_components( package, appValue, sig );
if (rc == ERROR_SUCCESS && !*appValue)
{
- rc = ACTION_AppSearchReg(package, appValue, sig);
+ rc = search_reg( package, appValue, sig );
if (rc == ERROR_SUCCESS && !*appValue)
{
- rc = ACTION_AppSearchIni(package, appValue, sig);
+ rc = search_ini( package, appValue, sig );
if (rc == ERROR_SUCCESS && !*appValue)
- rc = ACTION_AppSearchDr(package, appValue, sig);
+ rc = search_dr( package, appValue, sig );
}
}
}
return rc;
}
-static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
+static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
LPCWSTR propName, sigName;
@@ -1102,7 +1081,7 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
TRACE("%s %s\n", debugstr_w(propName), debugstr_w(sigName));
- r = ACTION_AppSearchSigName(package, sigName, &sig, &value);
+ r = search_sig_name( package, sigName, &sig, &value );
if (value)
{
r = msi_set_property( package->db, propName, value, -1 );
@@ -1111,7 +1090,7 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
msi_free(value);
}
- ACTION_FreeSignature(&sig);
+ free_signature( &sig );
uirow = MSI_CreateRecord( 2 );
MSI_RecordSetStringW( uirow, 1, propName );
@@ -1142,7 +1121,7 @@ UINT ACTION_AppSearch(MSIPACKAGE *package)
if (r != ERROR_SUCCESS)
return ERROR_SUCCESS;
- r = MSI_IterateRecords( view, NULL, iterate_appsearch, package );
+ r = MSI_IterateRecords( view, NULL, ITERATE_AppSearch, package );
msiobj_release( &view->hdr );
return r;
}
@@ -1161,7 +1140,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
TRACE("%s\n", debugstr_w(signature));
- ACTION_AppSearchSigName(package, signature, &sig, &value);
+ search_sig_name( package, signature, &sig, &value );
if (value)
{
TRACE("Found signature %s\n", debugstr_w(signature));
@@ -1170,8 +1149,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
r = ERROR_NO_MORE_ITEMS;
}
- ACTION_FreeSignature(&sig);
-
+ free_signature(&sig);
return r;
}
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 3cb0f3170a..8bf0902914 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -1188,7 +1188,7 @@ static UINT HANDLE_CustomType21_22( MSIPACKAGE *package, const WCHAR *source, co
return ERROR_FUNCTION_FAILED;
}
- hFile = CreateFileW(file->TargetPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ hFile = msi_create_file( package, file->TargetPath, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0 );
if (hFile == INVALID_HANDLE_VALUE) return ERROR_FUNCTION_FAILED;
sz = GetFileSize(hFile, &szHighWord);
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 5a88c147e0..92a98f1eca 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-
/*
* Actions dealing with files:
*
@@ -37,7 +36,6 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
-#include "wine/debug.h"
#include "fdi.h"
#include "msi.h"
#include "msidefs.h"
@@ -46,10 +44,202 @@
#include "winreg.h"
#include "shlwapi.h"
#include "patchapi.h"
+#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
+HANDLE msi_create_file( MSIPACKAGE *package, const WCHAR *filename, DWORD access, DWORD sharing, DWORD creation,
+ DWORD flags )
+{
+ HANDLE handle;
+ msi_disable_fs_redirection( package );
+ handle = CreateFileW( filename, access, sharing, NULL, creation, flags, NULL );
+ msi_revert_fs_redirection( package );
+ return handle;
+}
+
+static BOOL msi_copy_file( MSIPACKAGE *package, const WCHAR *src, const WCHAR *dst, BOOL fail_if_exists )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = CopyFileW( src, dst, fail_if_exists );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+BOOL msi_delete_file( MSIPACKAGE *package, const WCHAR *filename )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = DeleteFileW( filename );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+static BOOL msi_create_directory( MSIPACKAGE *package, const WCHAR *path )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = CreateDirectoryW( path, NULL );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+BOOL msi_remove_directory( MSIPACKAGE *package, const WCHAR *path )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = RemoveDirectoryW( path );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+BOOL msi_set_file_attributes( MSIPACKAGE *package, const WCHAR *filename, DWORD attrs )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = SetFileAttributesW( filename, attrs );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+DWORD msi_get_file_attributes( MSIPACKAGE *package, const WCHAR *path )
+{
+ DWORD attrs;
+ msi_disable_fs_redirection( package );
+ attrs = GetFileAttributesW( path );
+ msi_revert_fs_redirection( package );
+ return attrs;
+}
+
+HANDLE msi_find_first_file( MSIPACKAGE *package, const WCHAR *filename, WIN32_FIND_DATAW *data )
+{
+ HANDLE handle;
+ msi_disable_fs_redirection( package );
+ handle = FindFirstFileW( filename, data );
+ msi_revert_fs_redirection( package );
+ return handle;
+}
+
+BOOL msi_find_next_file( MSIPACKAGE *package, HANDLE handle, WIN32_FIND_DATAW *data )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = FindNextFileW( handle, data );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+BOOL msi_move_file( MSIPACKAGE *package, const WCHAR *from, const WCHAR *to, DWORD flags )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = MoveFileExW( from, to, flags );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+static BOOL msi_apply_filepatch( MSIPACKAGE *package, const WCHAR *patch, const WCHAR *old, const WCHAR *new )
+{
+ BOOL ret;
+ msi_disable_fs_redirection( package );
+ ret = ApplyPatchToFileW( patch, old, new, 0 );
+ msi_revert_fs_redirection( package );
+ return ret;
+}
+
+DWORD msi_get_file_version_info( MSIPACKAGE *package, const WCHAR *path, DWORD buflen, BYTE *buffer )
+{
+ DWORD size, handle;
+ msi_disable_fs_redirection( package );
+ if (buffer) size = GetFileVersionInfoW( path, 0, buflen, buffer );
+ else size = GetFileVersionInfoSizeW( path, &handle );
+ msi_revert_fs_redirection( package );
+ return size;
+}
+
+VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *package, const WCHAR *filename )
+{
+ static const WCHAR name[] = {'\\',0};
+ VS_FIXEDFILEINFO *ptr, *ret;
+ DWORD version_size, size;
+ void *version;
+
+ if (!(version_size = msi_get_file_version_info( package, filename, 0, NULL ))) return NULL;
+ if (!(version = msi_alloc( version_size ))) return NULL;
+
+ msi_get_file_version_info( package, filename, version_size, version );
+
+ if (!VerQueryValueW( version, name, (void **)&ptr, &size ))
+ {
+ msi_free( version );
+ return NULL;
+ }
+
+ if (!(ret = msi_alloc( size )))
+ {
+ msi_free( version );
+ return NULL;
+ }
+
+ memcpy( ret, ptr, size );
+ msi_free( version );
+ return ret;
+}
+
+DWORD msi_get_disk_file_size( MSIPACKAGE *package, const WCHAR *filename )
+{
+ DWORD size;
+ HANDLE file;
+ file = msi_create_file( package, filename, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0 );
+ if (file == INVALID_HANDLE_VALUE) return INVALID_FILE_SIZE;
+ size = GetFileSize( file, NULL );
+ CloseHandle( file );
+ return size;
+}
+
+/* Recursively create all directories in the path. */
+BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path )
+{
+ BOOL ret = TRUE;
+ WCHAR *new_path;
+ int len;
+
+ if (!(new_path = msi_alloc( (strlenW( path ) + 1) * sizeof(WCHAR) ))) return FALSE;
+ strcpyW( new_path, path );
+
+ while ((len = strlenW( new_path )) && new_path[len - 1] == '\\')
+ new_path[len - 1] = 0;
+
+ while (!msi_create_directory( package, new_path ))
+ {
+ WCHAR *slash;
+ DWORD last_error = GetLastError();
+ if (last_error == ERROR_ALREADY_EXISTS) break;
+ if (last_error != ERROR_PATH_NOT_FOUND)
+ {
+ ret = FALSE;
+ break;
+ }
+ if (!(slash = strrchrW( new_path, '\\' )))
+ {
+ ret = FALSE;
+ break;
+ }
+ len = slash - new_path;
+ new_path[len] = 0;
+ if (!msi_create_full_path( package, new_path ))
+ {
+ ret = FALSE;
+ break;
+ }
+ new_path[len] = '\\';
+ }
+ msi_free( new_path );
+ return ret;
+}
+
static void msi_file_update_ui( MSIPACKAGE *package, MSIFILE *f, const WCHAR *action )
{
MSIRECORD *uirow;
@@ -85,6 +275,19 @@ static BOOL is_obsoleted_by_patch( MSIPACKAGE *package, MSIFILE *file )
return FALSE;
}
+static BOOL file_hash_matches( MSIPACKAGE *package, MSIFILE *file )
+{
+ UINT r;
+ MSIFILEHASHINFO hash;
+
+ hash.dwFileHashInfoSize = sizeof(hash);
+ r = msi_get_filehash( package, file->TargetPath, &hash );
+ if (r != ERROR_SUCCESS)
+ return FALSE;
+
+ return !memcmp( &hash, &file->hash, sizeof(hash) );
+}
+
static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *file )
{
MSICOMPONENT *comp = file->Component;
@@ -105,14 +308,14 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil
return msifs_skipped;
}
if ((msi_is_global_assembly( comp ) && !comp->assembly->installed) ||
- GetFileAttributesW( file->TargetPath ) == INVALID_FILE_ATTRIBUTES)
+ msi_get_file_attributes( package, file->TargetPath ) == INVALID_FILE_ATTRIBUTES)
{
TRACE("installing %s (missing)\n", debugstr_w(file->File));
return msifs_missing;
}
if (file->Version)
{
- if ((file_version = msi_get_disk_file_version( file->TargetPath )))
+ if ((file_version = msi_get_disk_file_version( package, file->TargetPath )))
{
if (msi_compare_file_versions( file_version, file->Version ) < 0)
{
@@ -133,7 +336,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil
msi_free( file_version );
return state;
}
- else if ((font_version = msi_font_version_from_file( file->TargetPath )))
+ else if ((font_version = msi_get_font_file_version( package, file->TargetPath )))
{
if (msi_compare_font_versions( font_version, file->Version ) < 0)
{
@@ -151,14 +354,14 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil
return state;
}
}
- if ((size = msi_get_disk_file_size( file->TargetPath )) != file->FileSize)
+ if ((size = msi_get_disk_file_size( package, file->TargetPath )) != file->FileSize)
{
TRACE("overwriting %s (old size %u new size %u)\n", debugstr_w(file->File), size, file->FileSize);
return msifs_overwrite;
}
if (file->hash.dwFileHashInfoSize)
{
- if (msi_file_hash_matches( file ))
+ if (file_hash_matches( package, file ))
{
TRACE("keeping %s (hash match)\n", debugstr_w(file->File));
return msifs_hashmatch;
@@ -191,15 +394,15 @@ static void schedule_install_files(MSIPACKAGE *package)
}
}
-static UINT copy_file(MSIFILE *file, LPWSTR source)
+static UINT copy_file( MSIPACKAGE *package, MSIFILE *file, WCHAR *source )
{
BOOL ret;
- ret = CopyFileW(source, file->TargetPath, FALSE);
+ ret = msi_copy_file( package, source, file->TargetPath, FALSE );
if (!ret)
return GetLastError();
- SetFileAttributesW(file->TargetPath, FILE_ATTRIBUTE_NORMAL);
+ msi_set_file_attributes( package, file->TargetPath, FILE_ATTRIBUTE_NORMAL );
return ERROR_SUCCESS;
}
@@ -209,7 +412,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
TRACE("Copying %s to %s\n", debugstr_w(source), debugstr_w(file->TargetPath));
- gle = copy_file(file, source);
+ gle = copy_file( package, file, source );
if (gle == ERROR_SUCCESS)
return gle;
@@ -220,9 +423,9 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
}
else if (gle == ERROR_ACCESS_DENIED)
{
- SetFileAttributesW(file->TargetPath, FILE_ATTRIBUTE_NORMAL);
+ msi_set_file_attributes( package, file->TargetPath, FILE_ATTRIBUTE_NORMAL );
- gle = copy_file(file, source);
+ gle = copy_file( package, file, source );
TRACE("Overwriting existing file: %d\n", gle);
}
if (gle == ERROR_SHARING_VIOLATION || gle == ERROR_USER_MAPPED_FILE)
@@ -243,9 +446,9 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
if (!GetTempFileNameW( pathW, szMsi, 0, tmpfileW )) tmpfileW[0] = 0;
msi_free( pathW );
- if (CopyFileW(source, tmpfileW, FALSE) &&
- MoveFileExW(file->TargetPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) &&
- MoveFileExW(tmpfileW, file->TargetPath, MOVEFILE_DELAY_UNTIL_REBOOT))
+ if (msi_copy_file( package, source, tmpfileW, FALSE ) &&
+ msi_move_file( package, file->TargetPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) &&
+ msi_move_file( package, tmpfileW, file->TargetPath, MOVEFILE_DELAY_UNTIL_REBOOT ))
{
package->need_reboot_at_end = 1;
gle = ERROR_SUCCESS;
@@ -262,7 +465,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
return gle;
}
-static UINT msi_create_directory( MSIPACKAGE *package, const WCHAR *dir )
+static UINT create_directory( MSIPACKAGE *package, const WCHAR *dir )
{
MSIFOLDER *folder;
const WCHAR *install_path;
@@ -273,7 +476,7 @@ static UINT msi_create_directory( MSIPACKAGE *package, const WCHAR *dir )
folder = msi_get_loaded_folder( package, dir );
if (folder->State == FOLDER_STATE_UNINITIALIZED)
{
- msi_create_full_path( install_path );
+ msi_create_full_path( package, install_path );
folder->State = FOLDER_STATE_CREATED;
}
return ERROR_SUCCESS;
@@ -309,7 +512,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR filename, DWORD action,
if (!msi_is_global_assembly( file->Component ))
{
- msi_create_directory( package, file->Component->Directory );
+ create_directory( package, file->Component->Directory );
}
*path = strdupW( file->TargetPath );
*attrs = file->Attributes;
@@ -334,7 +537,7 @@ WCHAR *msi_resolve_file_source( MSIPACKAGE *package, MSIFILE *file )
p = msi_resolve_source_folder( package, file->Component->Directory, NULL );
path = msi_build_directory_name( 2, p, file->ShortName );
- if (file->LongName && GetFileAttributesW( path ) == INVALID_FILE_ATTRIBUTES)
+ if (file->LongName && msi_get_file_attributes( package, path ) == INVALID_FILE_ATTRIBUTES)
{
msi_free( path );
path = msi_build_directory_name( 2, p, file->LongName );
@@ -418,7 +621,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
if (!is_global_assembly)
{
- msi_create_directory(package, file->Component->Directory);
+ create_directory(package, file->Component->Directory);
}
rc = copy_install_file(package, file, source);
if (rc != ERROR_SUCCESS)
@@ -513,10 +716,10 @@ static UINT patch_file( MSIPACKAGE *package, MSIFILEPATCH *patch )
WCHAR *tmpfile = msi_create_temp_file( package->db );
if (!tmpfile) return ERROR_INSTALL_FAILURE;
- if (ApplyPatchToFileW( patch->path, patch->File->TargetPath, tmpfile, 0 ))
+ if (msi_apply_filepatch( package, patch->path, patch->File->TargetPath, tmpfile ))
{
- DeleteFileW( patch->File->TargetPath );
- MoveFileW( tmpfile, patch->File->TargetPath );
+ msi_delete_file( package, patch->File->TargetPath );
+ msi_move_file( package, tmpfile, patch->File->TargetPath, 0 );
}
else
{
@@ -557,7 +760,7 @@ static UINT patch_assembly( MSIPACKAGE *package, MSIASSEMBLY *assembly, MSIFILEP
if ((path = msi_get_assembly_path( package, displayname )))
{
- if (!CopyFileW( path, patch->File->TargetPath, FALSE ))
+ if (!msi_copy_file( package, path, patch->File->TargetPath, FALSE ))
{
ERR("Failed to copy file %s -> %s (%u)\n", debugstr_w(path),
debugstr_w(patch->File->TargetPath), GetLastError() );
@@ -679,12 +882,12 @@ typedef struct
LPWSTR dest;
} FILE_LIST;
-static BOOL msi_move_file(LPCWSTR source, LPCWSTR dest, int options)
+static BOOL move_file( MSIPACKAGE *package, const WCHAR *source, const WCHAR *dest, int options )
{
BOOL ret;
- if (GetFileAttributesW(source) == FILE_ATTRIBUTE_DIRECTORY ||
- GetFileAttributesW(dest) == FILE_ATTRIBUTE_DIRECTORY)
+ if (msi_get_file_attributes( package, source ) == FILE_ATTRIBUTE_DIRECTORY ||
+ msi_get_file_attributes( package, dest ) == FILE_ATTRIBUTE_DIRECTORY)
{
WARN("Source or dest is directory, not moving\n");
return FALSE;
@@ -693,20 +896,20 @@ static BOOL msi_move_file(LPCWSTR source, LPCWSTR dest, int options)
if (options == msidbMoveFileOptionsMove)
{
TRACE("moving %s -> %s\n", debugstr_w(source), debugstr_w(dest));
- ret = MoveFileExW(source, dest, MOVEFILE_REPLACE_EXISTING);
+ ret = msi_move_file( package, source, dest, MOVEFILE_REPLACE_EXISTING );
if (!ret)
{
- WARN("MoveFile failed: %d\n", GetLastError());
+ WARN("msi_move_file failed: %u\n", GetLastError());
return FALSE;
}
}
else
{
TRACE("copying %s -> %s\n", debugstr_w(source), debugstr_w(dest));
- ret = CopyFileW(source, dest, FALSE);
+ ret = msi_copy_file( package, source, dest, FALSE );
if (!ret)
{
- WARN("CopyFile failed: %d\n", GetLastError());
+ WARN("msi_copy_file failed: %u\n", GetLastError());
return FALSE;
}
}
@@ -714,16 +917,17 @@ static BOOL msi_move_file(LPCWSTR source, LPCWSTR dest, int options)
return TRUE;
}
-static LPWSTR wildcard_to_file(LPWSTR wildcard, LPWSTR filename)
+static WCHAR *wildcard_to_file( const WCHAR *wildcard, const WCHAR *filename )
{
- LPWSTR path, ptr;
+ const WCHAR *ptr;
+ WCHAR *path;
DWORD dirlen, pathlen;
ptr = strrchrW(wildcard, '\\');
dirlen = ptr - wildcard + 1;
pathlen = dirlen + lstrlenW(filename) + 1;
- path = msi_alloc(pathlen * sizeof(WCHAR));
+ if (!(path = msi_alloc(pathlen * sizeof(WCHAR)))) return NULL;
lstrcpynW(path, wildcard, dirlen + 1);
lstrcatW(path, filename);
@@ -749,10 +953,10 @@ static void free_list(FILE_LIST *list)
}
}
-static BOOL add_wildcard(FILE_LIST *files, LPWSTR source, LPWSTR dest)
+static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest )
{
FILE_LIST *new, *file;
- LPWSTR ptr, filename;
+ WCHAR *ptr, *filename;
DWORD size;
new = msi_alloc_zero(sizeof(FILE_LIST));
@@ -800,7 +1004,7 @@ static BOOL add_wildcard(FILE_LIST *files, LPWSTR source, LPWSTR dest)
return TRUE;
}
-static BOOL move_files_wildcard(LPWSTR source, LPWSTR dest, int options)
+static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR *dest, int options )
{
WIN32_FIND_DATAW wfd;
HANDLE hfile;
@@ -809,16 +1013,16 @@ static BOOL move_files_wildcard(LPWSTR source, LPWSTR dest, int options)
FILE_LIST files, *file;
DWORD size;
- hfile = FindFirstFileW(source, &wfd);
+ hfile = msi_find_first_file( package, source, &wfd );
if (hfile == INVALID_HANDLE_VALUE) return FALSE;
list_init(&files.entry);
- for (res = TRUE; res; res = FindNextFileW(hfile, &wfd))
+ for (res = TRUE; res; res = msi_find_next_file( package, hfile, &wfd ))
{
if (is_dot_dir(wfd.cFileName)) continue;
- path = wildcard_to_file(source, wfd.cFileName);
+ path = wildcard_to_file( source, wfd.cFileName );
if (!path)
{
res = FALSE;
@@ -854,7 +1058,7 @@ static BOOL move_files_wildcard(LPWSTR source, LPWSTR dest, int options)
{
file = LIST_ENTRY(list_head(&files.entry), FILE_LIST, entry);
- msi_move_file(file->source, file->dest, options);
+ move_file( package, file->source, file->dest, options );
list_remove(&file->entry);
free_file_entry(file);
@@ -910,7 +1114,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
if (!sourcename)
{
- if (GetFileAttributesW(sourcedir) == INVALID_FILE_ATTRIBUTES)
+ if (msi_get_file_attributes( package, sourcedir ) == INVALID_FILE_ATTRIBUTES)
goto done;
source = strdupW(sourcedir);
@@ -969,9 +1173,9 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
if (destname)
lstrcatW(dest, destname);
- if (GetFileAttributesW(destdir) == INVALID_FILE_ATTRIBUTES)
+ if (msi_get_file_attributes( package, destdir ) == INVALID_FILE_ATTRIBUTES)
{
- if (!msi_create_full_path(destdir))
+ if (!msi_create_full_path( package, destdir ))
{
WARN("failed to create directory %u\n", GetLastError());
goto done;
@@ -979,9 +1183,9 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
}
if (!wildcards)
- msi_move_file(source, dest, options);
+ move_file( package, source, dest, options );
else
- move_files_wildcard(source, dest, options);
+ move_files_wildcard( package, source, dest, options );
done:
uirow = MSI_CreateRecord( 9 );
@@ -1065,7 +1269,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const
}
dst = msi_build_directory_name( 2, dst_path, dst_name );
- msi_create_full_path( dst_path );
+ msi_create_full_path( package, dst_path );
msi_free( dst_name );
msi_free( dst_path );
@@ -1115,14 +1319,12 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
}
TRACE("Duplicating file %s to %s\n", debugstr_w(file->TargetPath), debugstr_w(dest));
-
- if (!CopyFileW( file->TargetPath, dest, TRUE ))
+ if (!msi_copy_file( package, file->TargetPath, dest, TRUE ))
{
WARN("Failed to copy file %s -> %s (%u)\n",
debugstr_w(file->TargetPath), debugstr_w(dest), GetLastError());
}
-
- FIXME("We should track these duplicate files as well\n");
+ FIXME("We should track these duplicate files as well\n");
uirow = MSI_CreateRecord( 9 );
MSI_RecordSetStringW( uirow, 1, MSI_RecordGetString( row, 1 ) );
@@ -1198,8 +1400,7 @@ static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param )
}
TRACE("Removing duplicate %s of %s\n", debugstr_w(dest), debugstr_w(file->TargetPath));
-
- if (!DeleteFileW( dest ))
+ if (!msi_delete_file( package, dest ))
{
WARN("Failed to delete duplicate file %s (%u)\n", debugstr_w(dest), GetLastError());
}
@@ -1320,12 +1521,12 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param)
lstrcatW(path, filename);
TRACE("Deleting misc file: %s\n", debugstr_w(path));
- DeleteFileW(path);
+ msi_delete_file( package, path );
}
else
{
TRACE("Removing misc directory: %s\n", debugstr_w(dir));
- RemoveDirectoryW(dir);
+ msi_remove_directory( package, dir );
}
done:
@@ -1400,7 +1601,7 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
if (file->Version)
{
- ver = msi_get_disk_file_version( file->TargetPath );
+ ver = msi_get_disk_file_version( package, file->TargetPath );
if (ver && msi_compare_file_versions( ver, file->Version ) > 0)
{
TRACE("newer version detected, not removing file\n");
@@ -1415,8 +1616,8 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
TRACE("removing %s\n", debugstr_w(file->File) );
- SetFileAttributesW( file->TargetPath, FILE_ATTRIBUTE_NORMAL );
- if (!DeleteFileW( file->TargetPath ))
+ msi_set_file_attributes( package, file->TargetPath, FILE_ATTRIBUTE_NORMAL );
+ if (!msi_delete_file( package, file->TargetPath ))
{
WARN("failed to delete %s (%u)\n", debugstr_w(file->TargetPath), GetLastError());
}
diff --git a/dlls/msi/font.c b/dlls/msi/font.c
index fc050060c0..08dcc14957 100644
--- a/dlls/msi/font.c
+++ b/dlls/msi/font.c
@@ -84,7 +84,7 @@ static const WCHAR regfont2[] =
* Code based off of code located here
* http://www.codeproject.com/gdi/fontnamefromfile.asp
*/
-static WCHAR *load_ttf_name_id( const WCHAR *filename, DWORD id )
+static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWORD id )
{
TT_TABLE_DIRECTORY tblDir;
BOOL bFound = FALSE;
@@ -96,8 +96,10 @@ static WCHAR *load_ttf_name_id( const WCHAR *filename, DWORD id )
LPWSTR ret = NULL;
int i;
- handle = CreateFileW(filename ,GENERIC_READ, 0, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, 0 );
+ if (package)
+ handle = msi_create_file( package, filename, GENERIC_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL );
+ else
+ handle = CreateFileW( filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if (handle == INVALID_HANDLE_VALUE)
{
ERR("Unable to open font file %s\n", debugstr_w(filename));
@@ -175,12 +177,12 @@ end:
return ret;
}
-static WCHAR *font_name_from_file( const WCHAR *filename )
+static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename )
{
static const WCHAR truetypeW[] = {' ','(','T','r','u','e','T','y','p','e',')',0};
WCHAR *name, *ret = NULL;
- if ((name = load_ttf_name_id( filename, NAME_ID_FULL_FONT_NAME )))
+ if ((name = load_ttf_name_id( package, filename, NAME_ID_FULL_FONT_NAME )))
{
if (!name[0])
{
@@ -196,12 +198,12 @@ static WCHAR *font_name_from_file( const WCHAR *filename )
return ret;
}
-WCHAR *msi_font_version_from_file( const WCHAR *filename )
+WCHAR *msi_get_font_file_version( MSIPACKAGE *package, const WCHAR *filename )
{
static const WCHAR fmtW[] = {'%','u','.','%','u','.','0','.','0',0};
WCHAR *version, *p, *q, *ret = NULL;
- if ((version = load_ttf_name_id( filename, NAME_ID_VERSION )))
+ if ((version = load_ttf_name_id( package, filename, NAME_ID_VERSION )))
{
int len, major = 0, minor = 0;
if ((p = strchrW( version, ';' ))) *p = 0;
@@ -258,7 +260,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2);
if (MSI_RecordIsNull(row,2))
- name = font_name_from_file( file->TargetPath );
+ name = font_name_from_file( package, file->TargetPath );
else
name = msi_dup_record_field(row,2);
@@ -341,7 +343,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
RegCreateKeyW( HKEY_LOCAL_MACHINE, regfont2, &hkey2 );
if (MSI_RecordIsNull( row, 2 ))
- name = font_name_from_file( file->TargetPath );
+ name = font_name_from_file( package, file->TargetPath );
else
name = msi_dup_record_field( row, 2 );
diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index 2cdebd2ad3..f4a231195b 100644
--- a/dlls/msi/install.c
+++ b/dlls/msi/install.c
@@ -571,7 +571,7 @@ UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolder
TRACE("%p %s %s\n", package, debugstr_w(szFolder), debugstr_w(szFolderPath));
- attrib = GetFileAttributesW(szFolderPath);
+ attrib = msi_get_file_attributes( package, szFolderPath );
/* native MSI tests writeability by making temporary files at each drive */
if (attrib != INVALID_FILE_ATTRIBUTES &&
(attrib & FILE_ATTRIBUTE_OFFLINE || attrib & FILE_ATTRIBUTE_READONLY))
diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 09aac09418..e334c5b6ea 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -439,12 +439,11 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
attrs = attrs & (FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
if (!attrs) attrs = FILE_ATTRIBUTE_NORMAL;
- handle = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0,
- NULL, CREATE_ALWAYS, attrs, NULL);
+ handle = msi_create_file( data->package, path, GENERIC_READ | GENERIC_WRITE, 0, CREATE_ALWAYS, attrs );
if (handle == INVALID_HANDLE_VALUE)
{
DWORD err = GetLastError();
- DWORD attrs2 = GetFileAttributesW(path);
+ DWORD attrs2 = msi_get_file_attributes( data->package, path );
if (attrs2 == INVALID_FILE_ATTRIBUTES)
{
@@ -454,8 +453,8 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
else if (err == ERROR_ACCESS_DENIED && (attrs2 & FILE_ATTRIBUTE_READONLY))
{
TRACE("removing read-only attribute on %s\n", debugstr_w(path));
- SetFileAttributesW( path, attrs2 & ~FILE_ATTRIBUTE_READONLY );
- handle = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL);
+ msi_set_file_attributes( data->package, path, attrs2 & ~FILE_ATTRIBUTE_READONLY );
+ handle = msi_create_file( data->package, path, GENERIC_READ | GENERIC_WRITE, 0, CREATE_ALWAYS, attrs );
if (handle != INVALID_HANDLE_VALUE) goto done;
err = GetLastError();
@@ -481,8 +480,8 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
handle = CreateFileW(tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL);
if (handle != INVALID_HANDLE_VALUE &&
- MoveFileExW(path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) &&
- MoveFileExW(tmpfileW, path, MOVEFILE_DELAY_UNTIL_REBOOT))
+ msi_move_file( data->package, path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) &&
+ msi_move_file( data->package, tmpfileW, path, MOVEFILE_DELAY_UNTIL_REBOOT ))
{
data->package->need_reboot_at_end = 1;
}
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 39b9354552..3eca3bfb8d 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -3298,7 +3298,7 @@ UINT WINAPI MsiGetFileVersionW( LPCWSTR path, LPWSTR verbuf, LPDWORD verlen,
if (ret == ERROR_RESOURCE_DATA_NOT_FOUND && verlen)
{
int len;
- WCHAR *version = msi_font_version_from_file( path );
+ WCHAR *version = msi_get_font_file_version( NULL, path );
if (!version) return ERROR_FILE_INVALID;
len = strlenW( version );
if (len >= *verlen) ret = ERROR_MORE_DATA;
@@ -4107,14 +4107,17 @@ extern VOID WINAPI MD5Init( MD5_CTX *);
extern VOID WINAPI MD5Update( MD5_CTX *, const unsigned char *, unsigned int );
extern VOID WINAPI MD5Final( MD5_CTX *);
-UINT msi_get_filehash( const WCHAR *path, MSIFILEHASHINFO *hash )
+UINT msi_get_filehash( MSIPACKAGE *package, const WCHAR *path, MSIFILEHASHINFO *hash )
{
HANDLE handle, mapping;
void *p;
DWORD length;
UINT r = ERROR_FUNCTION_FAILED;
- handle = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL );
+ if (package)
+ handle = msi_create_file( package, path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, OPEN_EXISTING, 0 );
+ else
+ handle = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL );
if (handle == INVALID_HANDLE_VALUE)
{
WARN("can't open file %u\n", GetLastError());
@@ -4171,7 +4174,7 @@ UINT WINAPI MsiGetFileHashW( LPCWSTR szFilePath, DWORD dwOptions,
if (pHash->dwFileHashInfoSize < sizeof *pHash)
return ERROR_INVALID_PARAMETER;
- return msi_get_filehash( szFilePath, pHash );
+ return msi_get_filehash( NULL, szFilePath, pHash );
}
/***********************************************************************
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 39219a646f..dbab8e2292 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -389,6 +389,7 @@ typedef struct tagMSIPACKAGE
enum platform platform;
UINT num_langids;
LANGID *langids;
+ void *cookie;
struct list patches;
struct list components;
struct list features;
@@ -937,12 +938,8 @@ extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val) DECLSPEC
extern DWORD msi_version_str_to_dword(LPCWSTR p) DECLSPEC_HIDDEN;
extern void msi_parse_version_string(LPCWSTR, PDWORD, PDWORD) DECLSPEC_HIDDEN;
-extern VS_FIXEDFILEINFO *msi_get_disk_file_version(LPCWSTR) DECLSPEC_HIDDEN;
extern int msi_compare_file_versions(VS_FIXEDFILEINFO *, const WCHAR *) DECLSPEC_HIDDEN;
extern int msi_compare_font_versions(const WCHAR *, const WCHAR *) DECLSPEC_HIDDEN;
-extern DWORD msi_get_disk_file_size(LPCWSTR) DECLSPEC_HIDDEN;
-extern BOOL msi_file_hash_matches(MSIFILE *) DECLSPEC_HIDDEN;
-extern UINT msi_get_filehash(const WCHAR *, MSIFILEHASHINFO *) DECLSPEC_HIDDEN;
extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) DECLSPEC_HIDDEN;
extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) DECLSPEC_HIDDEN;
@@ -1034,7 +1031,6 @@ extern WCHAR *msi_create_temp_file(MSIDATABASE *db) DECLSPEC_HIDDEN;
extern void msi_free_action_script(MSIPACKAGE *package, UINT script) DECLSPEC_HIDDEN;
extern WCHAR *msi_build_icon_path(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
extern WCHAR *msi_build_directory_name(DWORD , ...) DECLSPEC_HIDDEN;
-extern BOOL msi_create_full_path(const WCHAR *path) DECLSPEC_HIDDEN;
extern void msi_reduce_to_long_filename(WCHAR *) DECLSPEC_HIDDEN;
extern WCHAR *msi_create_component_advertise_string(MSIPACKAGE *, MSICOMPONENT *, const WCHAR *) DECLSPEC_HIDDEN;
extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, MSIFEATURE *feature) DECLSPEC_HIDDEN;
@@ -1052,7 +1048,6 @@ extern void msi_destroy_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
extern BOOL msi_is_global_assembly(MSICOMPONENT *) DECLSPEC_HIDDEN;
extern IAssemblyEnum *msi_create_assembly_enum(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
extern WCHAR *msi_get_assembly_path(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
-extern WCHAR *msi_font_version_from_file(const WCHAR *) DECLSPEC_HIDDEN;
extern WCHAR **msi_split_string(const WCHAR *, WCHAR) DECLSPEC_HIDDEN;
extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *) DECLSPEC_HIDDEN;
extern WCHAR *msi_get_error_message(MSIDATABASE *, int) DECLSPEC_HIDDEN;
@@ -1060,6 +1055,30 @@ extern UINT msi_strncpyWtoA(const WCHAR *str, int len, char *buf, DWORD *sz, BOO
extern UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz) DECLSPEC_HIDDEN;
extern WCHAR *msi_get_package_code(MSIDATABASE *db) DECLSPEC_HIDDEN;
+/* wrappers for filesystem functions */
+static inline void msi_disable_fs_redirection( MSIPACKAGE *package )
+{
+ if (is_wow64 && package->platform == PLATFORM_X64) Wow64DisableWow64FsRedirection( &package->cookie );
+}
+static inline void msi_revert_fs_redirection( MSIPACKAGE *package )
+{
+ if (is_wow64 && package->platform == PLATFORM_X64) Wow64RevertWow64FsRedirection( package->cookie );
+}
+extern HANDLE msi_create_file( MSIPACKAGE *, const WCHAR *, DWORD, DWORD, DWORD, DWORD ) DECLSPEC_HIDDEN;
+extern BOOL msi_delete_file( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+extern BOOL msi_remove_directory( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+extern DWORD msi_get_file_attributes( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+extern BOOL msi_set_file_attributes( MSIPACKAGE *, const WCHAR *, DWORD ) DECLSPEC_HIDDEN;
+extern HANDLE msi_find_first_file( MSIPACKAGE *, const WCHAR *, WIN32_FIND_DATAW * ) DECLSPEC_HIDDEN;
+extern BOOL msi_find_next_file( MSIPACKAGE *, HANDLE, WIN32_FIND_DATAW * ) DECLSPEC_HIDDEN;
+extern BOOL msi_move_file( MSIPACKAGE *, const WCHAR *, const WCHAR *, DWORD ) DECLSPEC_HIDDEN;
+extern DWORD msi_get_file_version_info( MSIPACKAGE *, const WCHAR *, DWORD, BYTE * ) DECLSPEC_HIDDEN;
+extern BOOL msi_create_full_path( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+extern DWORD msi_get_disk_file_size( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+extern VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+extern UINT msi_get_filehash( MSIPACKAGE *, const WCHAR *, MSIFILEHASHINFO * ) DECLSPEC_HIDDEN;
+extern WCHAR *msi_get_font_file_version( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
+
/* media */
typedef BOOL (*PMSICABEXTRACTCB)(MSIPACKAGE *, LPCWSTR, DWORD, LPWSTR *, DWORD *, PVOID);
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index b57e89d077..563f55a123 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -1630,6 +1630,13 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
package->log_file = CreateFileW( gszLogFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
+ if (!msi_init_assembly_caches( package ))
+ {
+ ERR("can't initialize assembly caches\n");
+ msiobj_release( &package->hdr );
+ return ERROR_FUNCTION_FAILED;
+ }
+
/* FIXME: when should these messages be sent? */
data_row = MSI_CreateRecord(3);
if (!data_row)
--
2.11.0
1
0
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winex11.drv/desktop.c | 2 ++
dlls/winex11.drv/display.c | 10 ++++++++--
dlls/winex11.drv/x11drv.h | 2 +-
dlls/winex11.drv/x11drv_main.c | 2 +-
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index d478cbdcb3..3cb1ca0f06 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -154,6 +154,7 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
max_width = primary_rect.right - primary_rect.left;
max_height = primary_rect.bottom - primary_rect.top;
xinerama_init( width, height );
+ X11DRV_DisplayDevice_Init( "Xinerama", TRUE );
/* initialize the available resolutions */
dd_modes = X11DRV_Settings_SetHandlers("desktop",
@@ -303,6 +304,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height )
resize_data.old_virtual_rect = get_virtual_screen_rect();
xinerama_init( width, height );
+ X11DRV_DisplayDevice_Init( "Xinerama", TRUE );
resize_data.new_virtual_rect = get_virtual_screen_rect();
if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId())
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index e5639f1c97..29cadb173e 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -372,7 +372,7 @@ static void cleanup_devices(void)
SetupDiDestroyDeviceInfoList(devinfo);
}
-BOOL X11DRV_DisplayDevice_Init(void)
+BOOL X11DRV_DisplayDevice_Init(const char *name, BOOL force)
{
struct x11drv_gpu *gpus = NULL;
struct x11drv_adapter *adapters = NULL;
@@ -389,12 +389,18 @@ BOOL X11DRV_DisplayDevice_Init(void)
TRACE("via %s\n", wine_dbgstr_a(handler.name));
+ if (name && strcmp(handler.name, name))
+ {
+ TRACE("Wrong handler name %s, ignoring\n", name);
+ return FALSE;
+ }
+
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, video_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &video_hkey,
&disposition))
goto fail;
/* Ensure only one thread is initializing the registry and avoid unnecessary reinit */
- if (disposition != REG_CREATED_NEW_KEY)
+ if (!force && disposition != REG_CREATED_NEW_KEY)
{
ret = TRUE;
goto fail;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 68de720408..cf21d60504 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -740,7 +740,7 @@ struct x11drv_display_device_handler
};
extern void X11DRV_DisplayDevice_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN;
-extern BOOL X11DRV_DisplayDevice_Init(void) DECLSPEC_HIDDEN;
+extern BOOL X11DRV_DisplayDevice_Init(const char *name, BOOL force) DECLSPEC_HIDDEN;
/* XIM support */
extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 178f9c1b4e..e0209fd5f5 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -597,7 +597,7 @@ static BOOL process_attach(void)
X11DRV_InitKeyboard( gdi_display );
if (use_xim) use_xim = X11DRV_InitXIM( input_style );
- X11DRV_DisplayDevice_Init();
+ X11DRV_DisplayDevice_Init(NULL, FALSE);
return TRUE;
}
--
2.19.2
1
0
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winex11.drv/display.c | 119 +++++++++++++++++++++++++++++++++++--
1 file changed, 114 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index a5e201e0a9..e5639f1c97 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -39,11 +39,19 @@
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
+/* Wine specific monitor properties */
+DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
+DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
+DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 4);
+DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
+
static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0};
static const WCHAR graphics_driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0};
static const WCHAR symbolic_link_valueW[]= {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e',0};
static const WCHAR gpu_idW[] = {'G','P','U','I','D',0};
+static const WCHAR mointor_id_fmtW[] = {'M','o','n','i','t','o','r','I','D','%','d',0};
+static const WCHAR adapter_name_fmtW[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','%','d',0};
static const WCHAR state_flagsW[] = {'S','t','a','t','e','F','l','a','g','s',0};
static const WCHAR guid_fmtW[] = {
'{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0','2','x','%','0','2','x','-',
@@ -90,6 +98,13 @@ static const WCHAR device_video_fmtW[] = {
static const WCHAR machine_prefixW[] = {
'\\','R','e','g','i','s','t','r','y','\\',
'M','a','c','h','i','n','e','\\',0};
+static const WCHAR monitor_instance_fmtW[] = {
+ 'D','I','S','P','L','A','Y','\\',
+ 'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r','\\',
+ '%','0','4','X','&','%','0','4','X',0};
+static const WCHAR monitor_hardware_idW[] = {
+ 'M','O','N','I','T','O','R','\\',
+ 'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r',0,0};
static struct x11drv_display_device_handler handler;
@@ -185,7 +200,7 @@ fail:
return ret;
}
-static BOOL X11DRV_InitAdapter(HKEY video_hkey, INT video_index, INT gpu_index, INT adapter_index,
+static BOOL X11DRV_InitAdapter(HKEY video_hkey, INT video_index, INT gpu_index, INT adapter_index, INT monitor_count,
const struct x11drv_gpu *gpu, const WCHAR *guid_string,
const WCHAR *gpu_driver, const struct x11drv_adapter *adapter)
{
@@ -195,6 +210,7 @@ static BOOL X11DRV_InitAdapter(HKEY video_hkey, INT video_index, INT gpu_index,
HKEY hkey = NULL;
LSTATUS ls;
BOOL ret = FALSE;
+ INT i;
sprintfW(key_nameW, device_video_fmtW, video_index);
strcpyW(bufferW, machine_prefixW);
@@ -228,6 +244,15 @@ static BOOL X11DRV_InitAdapter(HKEY video_hkey, INT video_index, INT gpu_index,
if (RegSetValueExW(hkey, gpu_idW, 0, REG_SZ, (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR)))
goto fail;
+ /* Write all monitor instances paths under this adapter */
+ for (i = 0; i < monitor_count; i++)
+ {
+ sprintfW(key_nameW, mointor_id_fmtW, i);
+ sprintfW(bufferW, monitor_instance_fmtW, video_index, i);
+ if (RegSetValueExW(hkey, key_nameW, 0, REG_SZ, (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR)))
+ goto fail;
+ }
+
/* Write StateFlags */
if (RegSetValueExW(hkey, state_flagsW, 0, REG_DWORD, (const BYTE *)&adapter->state_flags,
sizeof(adapter->state_flags)))
@@ -241,6 +266,63 @@ fail:
return ret;
}
+static BOOL X11DRV_InitMonitor(HDEVINFO devinfo, const struct x11drv_monitor *monitor, int monitor_index,
+ int video_index)
+{
+ WCHAR bufferW[MAX_PATH];
+ SP_DEVINFO_DATA device_data = {sizeof(SP_DEVINFO_DATA)};
+ HKEY hkey = NULL;
+ BOOL ret = FALSE;
+
+ /* Create GUID_DEVCLASS_MONITOR instance */
+ sprintfW(bufferW, monitor_instance_fmtW, video_index, monitor_index);
+ SetupDiCreateDeviceInfoW(devinfo, bufferW, &GUID_DEVCLASS_MONITOR, monitor->name, NULL, 0, &device_data);
+ if (!SetupDiRegisterDeviceInfo(devinfo, &device_data, 0, NULL, NULL, NULL))
+ goto fail;
+
+ /* Write HaredwareID registry property */
+ if (!SetupDiSetDeviceRegistryPropertyW(devinfo, &device_data, SPDRP_HARDWAREID,
+ (const BYTE *)monitor_hardware_idW, sizeof(monitor_hardware_idW)))
+ goto fail;
+
+ /* Open driver key */
+ hkey = SetupDiOpenDevRegKey(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_ALL_ACCESS);
+ if (hkey == INVALID_HANDLE_VALUE)
+ hkey = SetupDiCreateDevRegKeyW(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
+
+ /* Write DriverDesc value */
+ if (RegSetValueExW(hkey, driver_descW, 0, REG_SZ, (const BYTE *)monitor->name,
+ (strlenW(monitor->name) + 1) * sizeof(WCHAR)))
+ goto fail;
+
+ /* FIXME:
+ * Following properties are Wine specific, see comments in X11DRV_InitAdapter for details */
+ /* StateFlags */
+ if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_STATEFLAGS, DEVPROP_TYPE_UINT32,
+ (const BYTE *)&monitor->state_flags, sizeof(monitor->state_flags), 0))
+ goto fail;
+ /* RcMonitor */
+ if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, DEVPROP_TYPE_BINARY,
+ (const BYTE *)&monitor->rc_monitor, sizeof(monitor->rc_monitor), 0))
+ goto fail;
+ /* RcWork */
+ if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCWORK, DEVPROP_TYPE_BINARY,
+ (const BYTE *)&monitor->rc_work, sizeof(monitor->rc_work), 0))
+ goto fail;
+ /* Adapter name */
+ sprintfW(bufferW, adapter_name_fmtW, video_index + 1);
+ if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, DEVPROP_TYPE_STRING,
+ (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR), 0))
+ goto fail;
+
+ ret = TRUE;
+fail:
+ RegCloseKey(hkey);
+ if (!ret)
+ ERR("Failed to initialize monitor\n");
+ return ret;
+}
+
static void prepare_devices(void)
{
static const BOOL not_present = FALSE;
@@ -248,8 +330,18 @@ static void prepare_devices(void)
HDEVINFO devinfo;
DWORD i = 0;
+ /* Remove all monitors */
+ devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_MONITOR, NULL, NULL, 0);
+ while (SetupDiEnumDeviceInfo(devinfo, i++, &device_data))
+ {
+ if (!SetupDiRemoveDevice(devinfo, &device_data))
+ ERR("Failed to remove monitor\n");
+ }
+ SetupDiDestroyDeviceInfoList(devinfo);
+
/* Set all GPUs as not present. We can't simply delete them because we need to keep the GUID consistent with
* each initialization run. We clean up non present GPUs at the end of initialization */
+ i = 0;
devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_DISPLAY, NULL, NULL, 0);
while (SetupDiEnumDeviceInfo(devinfo, i++, &device_data))
{
@@ -284,9 +376,10 @@ BOOL X11DRV_DisplayDevice_Init(void)
{
struct x11drv_gpu *gpus = NULL;
struct x11drv_adapter *adapters = NULL;
- INT gpu_count, adapter_count;
- INT gpu, adapter;
- HDEVINFO gpu_devinfo = NULL;
+ struct x11drv_monitor *monitors = NULL;
+ INT gpu_count, adapter_count, monitor_count;
+ INT gpu, adapter, monitor;
+ HDEVINFO gpu_devinfo = NULL, monitor_devinfo = NULL;
HKEY video_hkey = NULL;
INT video_index = 0;
DWORD disposition = 0;
@@ -315,6 +408,7 @@ BOOL X11DRV_DisplayDevice_Init(void)
prepare_devices();
gpu_devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_DISPLAY, NULL);
+ monitor_devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_MONITOR, NULL);
/* Initialize GPUs */
if (!handler.pGetGpus(&gpus, &gpu_count))
@@ -331,10 +425,22 @@ BOOL X11DRV_DisplayDevice_Init(void)
for (adapter = 0; adapter < adapter_count; adapter++)
{
- if (!X11DRV_InitAdapter(video_hkey, video_index, gpu, adapter,
+ if (!handler.pGetMonitors(adapters[adapter].id, &monitors, &monitor_count))
+ goto fail;
+
+ if (!X11DRV_InitAdapter(video_hkey, video_index, gpu, adapter, monitor_count,
&gpus[gpu], guidW, driverW, &adapters[adapter]))
goto fail;
+ /* Initialize monitors */
+ for (monitor = 0; monitor < monitor_count; monitor++)
+ {
+ if (!X11DRV_InitMonitor(monitor_devinfo, &monitors[monitor], monitor, video_index))
+ goto fail;
+ }
+
+ handler.pFreeMonitors(monitors);
+ monitors = NULL;
video_index++;
}
@@ -345,12 +451,15 @@ BOOL X11DRV_DisplayDevice_Init(void)
ret = TRUE;
fail:
cleanup_devices();
+ SetupDiDestroyDeviceInfoList(monitor_devinfo);
SetupDiDestroyDeviceInfoList(gpu_devinfo);
RegCloseKey(video_hkey);
if (gpus)
handler.pFreeGpus(gpus);
if (adapters)
handler.pFreeAdapters(adapters);
+ if (monitors)
+ handler.pFreeMonitors(monitors);
if (!ret)
ERR("Failed to initialize display devices\n");
return ret;
--
2.19.2
1
0
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/user32/tests/monitor.c | 4 +-
dlls/winex11.drv/display.c | 96 ++++++++++++++++++++++++++++++++++++-
2 files changed, 96 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 9a661569ac..c8a6fe0181 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -113,9 +113,9 @@ static void test_enumdisplaydevices_adapter(int index, const DISPLAY_DEVICEA *de
memset(video_value, 0, sizeof(video_value));
size = sizeof(video_value);
ls = RegQueryValueExA(hkey, video_name, NULL, NULL, (unsigned char *)video_value, &size);
- todo_wine ok(!ls, "#%d: failed to get registry value, error: %#x\n", index, ls);
+ ok(!ls, "#%d: failed to get registry value, error: %#x\n", index, ls);
RegCloseKey(hkey);
- ok(!strcmp(video_value, device->DeviceKey), "#%d: wrong DeviceKey: %s\n", index, device->DeviceKey);
+ todo_wine ok(!strcmp(video_value, device->DeviceKey), "#%d: wrong DeviceKey: %s\n", index, device->DeviceKey);
}
}
else
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index 86be731384..a5e201e0a9 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -42,6 +42,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0};
static const WCHAR graphics_driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0};
+static const WCHAR symbolic_link_valueW[]= {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e',0};
+static const WCHAR gpu_idW[] = {'G','P','U','I','D',0};
+static const WCHAR state_flagsW[] = {'S','t','a','t','e','F','l','a','g','s',0};
static const WCHAR guid_fmtW[] = {
'{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0','2','x','%','0','2','x','-',
'%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0};
@@ -74,6 +77,19 @@ static const WCHAR video_keyW[] = {
'H','A','R','D','W','A','R','E','\\',
'D','E','V','I','C','E','M','A','P','\\',
'V','I','D','E','O',0};
+static const WCHAR adapter_key_fmtW[] = {
+ 'S','y','s','t','e','m','\\',
+ 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+ 'C','o','n','t','r','o','l','\\',
+ 'V','i','d','e','o','\\',
+ '%','s','\\',
+ '%','0','4','x',0};
+static const WCHAR device_video_fmtW[] = {
+ '\\','D','e','v','i','c','e','\\',
+ 'V','i','d','e','o','%','d',0};
+static const WCHAR machine_prefixW[] = {
+ '\\','R','e','g','i','s','t','r','y','\\',
+ 'M','a','c','h','i','n','e','\\',0};
static struct x11drv_display_device_handler handler;
@@ -169,6 +185,62 @@ fail:
return ret;
}
+static BOOL X11DRV_InitAdapter(HKEY video_hkey, INT video_index, INT gpu_index, INT adapter_index,
+ const struct x11drv_gpu *gpu, const WCHAR *guid_string,
+ const WCHAR *gpu_driver, const struct x11drv_adapter *adapter)
+{
+ WCHAR adapter_keyW[MAX_PATH];
+ WCHAR key_nameW[MAX_PATH];
+ WCHAR bufferW[MAX_PATH];
+ HKEY hkey = NULL;
+ LSTATUS ls;
+ BOOL ret = FALSE;
+
+ sprintfW(key_nameW, device_video_fmtW, video_index);
+ strcpyW(bufferW, machine_prefixW);
+ sprintfW(adapter_keyW, adapter_key_fmtW, guid_string, adapter_index);
+ strcatW(bufferW, adapter_keyW);
+
+ /* Write value of \Device\Video? (adapter key) in HKLM\HARDWARE\DEVICEMAP\VIDEO\ */
+ if (RegSetValueExW(video_hkey, key_nameW, 0, REG_SZ, (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR)))
+ goto fail;
+
+ /* Create HKLM\System\CurrentControlSet\Control\Video\{GPU GUID}\{Adapter Index} link to GPU driver */
+ ls = RegCreateKeyExW(HKEY_LOCAL_MACHINE, adapter_keyW, 0, NULL, REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK,
+ KEY_ALL_ACCESS, NULL, &hkey, NULL);
+ if (ls == ERROR_ALREADY_EXISTS)
+ RegOpenKeyExW(HKEY_LOCAL_MACHINE, adapter_keyW, REG_OPTION_OPEN_LINK, KEY_ALL_ACCESS, &hkey);
+ if (RegSetValueExW(hkey, symbolic_link_valueW, 0, REG_LINK, (const BYTE *)gpu_driver,
+ strlenW(gpu_driver) * sizeof(WCHAR)))
+ goto fail;
+ RegCloseKey(hkey);
+ hkey = NULL;
+
+ /* FIXME:
+ * Following information are Wine specific, they don't really exist on Windows. They are used so that we can
+ * implement EnumDisplayDevices etc by querying registry only. These information are most likely reported by the
+ * device driver on Windows */
+ RegCreateKeyExW(HKEY_CURRENT_CONFIG, adapter_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hkey, NULL);
+
+ /* Write GPU instance path so that we can find the GPU instance via adapters quickly. Another way is trying to match
+ * them via the GUID in Device Paramters/VideoID, but it would required enumrating all GPU instances */
+ sprintfW(bufferW, gpu_instance_fmtW, gpu->vendor_id, gpu->device_id, gpu->subsys_id, gpu->revision_id, gpu_index);
+ if (RegSetValueExW(hkey, gpu_idW, 0, REG_SZ, (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR)))
+ goto fail;
+
+ /* Write StateFlags */
+ if (RegSetValueExW(hkey, state_flagsW, 0, REG_DWORD, (const BYTE *)&adapter->state_flags,
+ sizeof(adapter->state_flags)))
+ goto fail;
+
+ ret = TRUE;
+fail:
+ RegCloseKey(hkey);
+ if (!ret)
+ ERR("Failed to initialize adapter\n");
+ return ret;
+}
+
static void prepare_devices(void)
{
static const BOOL not_present = FALSE;
@@ -211,10 +283,12 @@ static void cleanup_devices(void)
BOOL X11DRV_DisplayDevice_Init(void)
{
struct x11drv_gpu *gpus = NULL;
- INT gpu_count;
- INT gpu;
+ struct x11drv_adapter *adapters = NULL;
+ INT gpu_count, adapter_count;
+ INT gpu, adapter;
HDEVINFO gpu_devinfo = NULL;
HKEY video_hkey = NULL;
+ INT video_index = 0;
DWORD disposition = 0;
WCHAR guidW[40];
WCHAR driverW[MAX_PATH];
@@ -250,6 +324,22 @@ BOOL X11DRV_DisplayDevice_Init(void)
{
if (!X11DRV_InitGpu(gpu_devinfo, &gpus[gpu], gpu, guidW, driverW))
goto fail;
+
+ /* Initialize adapters */
+ if (!handler.pGetAdapters(gpus[gpu].id, &adapters, &adapter_count))
+ goto fail;
+
+ for (adapter = 0; adapter < adapter_count; adapter++)
+ {
+ if (!X11DRV_InitAdapter(video_hkey, video_index, gpu, adapter,
+ &gpus[gpu], guidW, driverW, &adapters[adapter]))
+ goto fail;
+
+ video_index++;
+ }
+
+ handler.pFreeAdapters(adapters);
+ adapters = NULL;
}
ret = TRUE;
@@ -259,6 +349,8 @@ fail:
RegCloseKey(video_hkey);
if (gpus)
handler.pFreeGpus(gpus);
+ if (adapters)
+ handler.pFreeAdapters(adapters);
if (!ret)
ERR("Failed to initialize display devices\n");
return ret;
--
2.19.2
1
0
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/user32/tests/monitor.c | 4 +-
dlls/winex11.drv/Makefile.in | 2 +-
dlls/winex11.drv/display.c | 228 +++++++++++++++++++++++++++++++++
dlls/winex11.drv/x11drv.h | 1 +
dlls/winex11.drv/x11drv_main.c | 1 +
5 files changed, 233 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index c5e6745322..9a661569ac 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -107,13 +107,13 @@ static void test_enumdisplaydevices_adapter(int index, const DISPLAY_DEVICEA *de
{
sprintf(video_name, "\\Device\\Video%d", index);
ls = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\VIDEO", 0, KEY_READ, &hkey);
- todo_wine ok(!ls, "#%d: failed to open registry, error: %#x\n", index, ls);
+ ok(!ls, "#%d: failed to open registry, error: %#x\n", index, ls);
if (!ls)
{
memset(video_value, 0, sizeof(video_value));
size = sizeof(video_value);
ls = RegQueryValueExA(hkey, video_name, NULL, NULL, (unsigned char *)video_value, &size);
- ok(!ls, "#%d: failed to get registry value, error: %#x\n", index, ls);
+ todo_wine ok(!ls, "#%d: failed to get registry value, error: %#x\n", index, ls);
RegCloseKey(hkey);
ok(!strcmp(video_value, device->DeviceKey), "#%d: wrong DeviceKey: %s\n", index, device->DeviceKey);
}
diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in
index 9ca2fc6efe..72ab1bb77b 100644
--- a/dlls/winex11.drv/Makefile.in
+++ b/dlls/winex11.drv/Makefile.in
@@ -1,5 +1,5 @@
MODULE = winex11.drv
-IMPORTS = uuid user32 gdi32 advapi32
+IMPORTS = uuid user32 gdi32 advapi32 ntoskrnl setupapi
DELAYIMPORTS = comctl32 ole32 shell32 imm32
EXTRAINCL = $(X_CFLAGS)
EXTRALIBS = $(X_LIBS) $(X_EXTRA_LIBS)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index d9a755b3be..86be731384 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -20,11 +20,61 @@
#include "config.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "initguid.h"
+#include "devguid.h"
+#include "devpkey.h"
+#include "setupapi.h"
+#define WIN32_NO_STATUS
+#include "winternl.h"
+#include "ddk/ntddk.h"
#include "wine/debug.h"
+#include "wine/unicode.h"
#include "x11drv.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
+static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0};
+static const WCHAR graphics_driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
+static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0};
+static const WCHAR guid_fmtW[] = {
+ '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0','2','x','%','0','2','x','-',
+ '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0};
+static const WCHAR gpu_instance_fmtW[] = {
+ 'P','C','I','\\',
+ 'V','E','N','_','%','0','4','X','&',
+ 'D','E','V','_','%','0','4','X','&',
+ 'S','U','B','S','Y','S','_','%','0','8','X','&',
+ 'R','E','V','_','%','0','2','X','\\',
+ '%','0','8','X',0};
+static const WCHAR gpu_hardware_id_fmtW[] = {
+ 'P','C','I','\\',
+ 'V','E','N','_','%','0','4','X','&',
+ 'D','E','V','_','%','0','4','X','&',
+ 'S','U','B','S','Y','S','_','0','0','0','0','0','0','0','0','&',
+ 'R','E','V','_','0','0',0};
+static const WCHAR winex11_drvW[] = {
+ 'C',':','\\',
+ 'W','i','n','d','o','w','s','\\',
+ 'S','y','s','t','e','m','3','2','\\',
+ 'w','i','n','e','x','1','1','.','d','r','v',0};
+static const WCHAR nt_classW[] = {
+ '\\','R','e','g','i','s','t','r','y','\\',
+ 'M','a','c','h','i','n','e','\\',
+ 'S','y','s','t','e','m','\\',
+ 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+ 'C','o','n','t','r','o','l','\\',
+ 'C','l','a','s','s','\\',0};
+static const WCHAR video_keyW[] = {
+ 'H','A','R','D','W','A','R','E','\\',
+ 'D','E','V','I','C','E','M','A','P','\\',
+ 'V','I','D','E','O',0};
+
static struct x11drv_display_device_handler handler;
void X11DRV_DisplayDevice_SetHandler(const struct x11drv_display_device_handler *new_handler)
@@ -35,3 +85,181 @@ void X11DRV_DisplayDevice_SetHandler(const struct x11drv_display_device_handler
TRACE("Display device functions are now handled by: %s\n", handler.name);
}
}
+
+/* Initialize a GPU instance and return its GUID string in guid_string and driver value in driver parameter */
+static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT gpu_index, WCHAR *guid_string,
+ WCHAR *driver)
+{
+ static const BOOL present = TRUE;
+ SP_DEVINFO_DATA device_data = {sizeof(device_data)};
+ WCHAR instanceW[MAX_PATH];
+ WCHAR bufferW[MAX_PATH];
+ HKEY hkey = NULL;
+ GUID guid;
+ INT written;
+ DWORD size;
+ BOOL ret = FALSE;
+
+ sprintfW(instanceW, gpu_instance_fmtW, gpu->vendor_id, gpu->device_id, gpu->subsys_id, gpu->revision_id, gpu_index);
+ if (!SetupDiOpenDeviceInfoW(devinfo, instanceW, NULL, 0, &device_data))
+ {
+ SetupDiCreateDeviceInfoW(devinfo, instanceW, &GUID_DEVCLASS_DISPLAY, gpu->name, NULL, 0, &device_data);
+ if (!SetupDiRegisterDeviceInfo(devinfo, &device_data, 0, NULL, NULL, NULL))
+ goto fail;
+ }
+
+ /* Write HaredwareID registry property */
+ written = sprintfW(bufferW, gpu_hardware_id_fmtW, gpu->vendor_id, gpu->device_id);
+ bufferW[written + 1] = 0;
+ if (!SetupDiSetDeviceRegistryPropertyW(devinfo, &device_data, SPDRP_HARDWAREID, (const BYTE *)bufferW,
+ (written + 2) * sizeof(WCHAR)))
+ goto fail;
+
+ /* Write DEVPKEY_Device_IsPresent property */
+ if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &DEVPKEY_Device_IsPresent, DEVPROP_TYPE_BOOLEAN,
+ (const BYTE *)&present, sizeof(present), 0))
+ goto fail;
+
+ /* Open driver key.
+ * This is where HKLM\System\CurrentControlSet\Control\Video\{GPU GUID}\{Adapter Index} links to */
+ hkey = SetupDiOpenDevRegKey(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_ALL_ACCESS);
+ if (hkey == INVALID_HANDLE_VALUE)
+ hkey = SetupDiCreateDevRegKeyW(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
+
+ /* Write GraphicsDriver value */
+ if (RegSetValueExW(hkey, graphics_driverW, 0, REG_SZ, (const BYTE *)winex11_drvW, sizeof(winex11_drvW)))
+ goto fail;
+
+ /* Write DriverDesc value */
+ if (RegSetValueExW(hkey, driver_descW, 0, REG_SZ, (const BYTE *)gpu->name,
+ (strlenW(gpu->name) + 1) * sizeof(WCHAR)))
+ goto fail;
+ RegCloseKey(hkey);
+ hkey = NULL;
+
+ /* Retrieve driver value for adapters */
+ if (!SetupDiGetDeviceRegistryPropertyW(devinfo, &device_data, SPDRP_DRIVER, NULL, (BYTE *)bufferW, sizeof(bufferW),
+ NULL))
+ goto fail;
+ strcpyW(driver, nt_classW);
+ strcatW(driver, bufferW);
+
+ /* Write GUID in VideoID in .../instance/Device Parameters, reuse the GUID if it's existent */
+ hkey = SetupDiOpenDevRegKey(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS);
+ if (hkey == INVALID_HANDLE_VALUE)
+ hkey = SetupDiCreateDevRegKeyW(devinfo, &device_data, DICS_FLAG_GLOBAL, 0, DIREG_DEV, NULL, NULL);
+
+ size = sizeof(bufferW);
+ bufferW[0] = 0;
+ if (RegQueryValueExW(hkey, video_idW, 0, NULL, (BYTE *)bufferW, &size))
+ {
+ ExUuidCreate(&guid);
+ sprintfW(bufferW, guid_fmtW, guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2],
+ guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
+ if (RegSetValueExW(hkey, video_idW, 0, REG_SZ, (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR)))
+ goto fail;
+ }
+ strcpyW(guid_string, bufferW);
+
+ ret = TRUE;
+fail:
+ RegCloseKey(hkey);
+ if (!ret)
+ ERR("Failed to initialize GPU\n");
+ return ret;
+}
+
+static void prepare_devices(void)
+{
+ static const BOOL not_present = FALSE;
+ SP_DEVINFO_DATA device_data = {sizeof(device_data)};
+ HDEVINFO devinfo;
+ DWORD i = 0;
+
+ /* Set all GPUs as not present. We can't simply delete them because we need to keep the GUID consistent with
+ * each initialization run. We clean up non present GPUs at the end of initialization */
+ devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_DISPLAY, NULL, NULL, 0);
+ while (SetupDiEnumDeviceInfo(devinfo, i++, &device_data))
+ {
+ if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &DEVPKEY_Device_IsPresent, DEVPROP_TYPE_BOOLEAN,
+ (const BYTE *)¬_present, sizeof(not_present), 0))
+ ERR("Failed to set GPU present property\n");
+ }
+ SetupDiDestroyDeviceInfoList(devinfo);
+}
+
+static void cleanup_devices(void)
+{
+ SP_DEVINFO_DATA device_data = {sizeof(device_data)};
+ HDEVINFO devinfo;
+ DWORD type;
+ DWORD i = 0;
+ BOOL present;
+
+ devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_DISPLAY, NULL, NULL, 0);
+ while (SetupDiEnumDeviceInfo(devinfo, i++, &device_data))
+ {
+ present = FALSE;
+ SetupDiGetDevicePropertyW(devinfo, &device_data, &DEVPKEY_Device_IsPresent, &type, (BYTE *)&present,
+ sizeof(present), NULL, 0);
+ if (!present && !SetupDiRemoveDevice(devinfo, &device_data))
+ ERR("Failed to remove GPU\n");
+ }
+ SetupDiDestroyDeviceInfoList(devinfo);
+}
+
+BOOL X11DRV_DisplayDevice_Init(void)
+{
+ struct x11drv_gpu *gpus = NULL;
+ INT gpu_count;
+ INT gpu;
+ HDEVINFO gpu_devinfo = NULL;
+ HKEY video_hkey = NULL;
+ DWORD disposition = 0;
+ WCHAR guidW[40];
+ WCHAR driverW[MAX_PATH];
+ BOOL ret = FALSE;
+
+ TRACE("via %s\n", wine_dbgstr_a(handler.name));
+
+ if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, video_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &video_hkey,
+ &disposition))
+ goto fail;
+
+ /* Ensure only one thread is initializing the registry and avoid unnecessary reinit */
+ if (disposition != REG_CREATED_NEW_KEY)
+ {
+ ret = TRUE;
+ goto fail;
+ }
+
+ /* FIXME:
+ * Currently we have no idea how to implement SetupDiGetClassDevsW with DIGCF_PRESENT properly. So we need to clean
+ * up not present devices in case applications use SetupDiGetClassDevsW to enumerate devices. Wrong devices could
+ * exist in registry as a result of prefix copying or having devices unplugged. But then we couldn't simply delete
+ * GPUs because we need to retain the same GUID for the same GPU. */
+ prepare_devices();
+
+ gpu_devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_DISPLAY, NULL);
+
+ /* Initialize GPUs */
+ if (!handler.pGetGpus(&gpus, &gpu_count))
+ goto fail;
+
+ for (gpu = 0; gpu < gpu_count; gpu++)
+ {
+ if (!X11DRV_InitGpu(gpu_devinfo, &gpus[gpu], gpu, guidW, driverW))
+ goto fail;
+ }
+
+ ret = TRUE;
+fail:
+ cleanup_devices();
+ SetupDiDestroyDeviceInfoList(gpu_devinfo);
+ RegCloseKey(video_hkey);
+ if (gpus)
+ handler.pFreeGpus(gpus);
+ if (!ret)
+ ERR("Failed to initialize display devices\n");
+ return ret;
+}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index fc589356b8..68de720408 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -740,6 +740,7 @@ struct x11drv_display_device_handler
};
extern void X11DRV_DisplayDevice_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN;
+extern BOOL X11DRV_DisplayDevice_Init(void) DECLSPEC_HIDDEN;
/* XIM support */
extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index e67a3c05a9..178f9c1b4e 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -597,6 +597,7 @@ static BOOL process_attach(void)
X11DRV_InitKeyboard( gdi_display );
if (use_xim) use_xim = X11DRV_InitXIM( input_style );
+ X11DRV_DisplayDevice_Init();
return TRUE;
}
--
2.19.2
1
0
20 Mar '19
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/winex11.drv/xinerama.c | 137 ++++++++++++++++++++++++++++++++++++
1 file changed, 137 insertions(+)
diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c
index fe899e8744..33808819b5 100644
--- a/dlls/winex11.drv/xinerama.c
+++ b/dlls/winex11.drv/xinerama.c
@@ -30,6 +30,8 @@
#include "wine/library.h"
#include "x11drv.h"
#include "wine/debug.h"
+#include "wine/heap.h"
+#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
@@ -209,8 +211,133 @@ RECT get_primary_monitor_rect(void)
return get_primary()->rcMonitor;
}
+static BOOL xinerama_get_gpus( struct x11drv_gpu **new_gpus, int *count )
+{
+ static const WCHAR wine_gpuW[] = {'W','i','n','e',' ','G','P','U',0};
+ struct x11drv_gpu *gpus;
+
+ /* Xinerama has no support for GPU, faking one */
+ gpus = heap_calloc( 1, sizeof(*gpus) );
+ if (!gpus)
+ return FALSE;
+
+ strcpyW( gpus[0].name, wine_gpuW );
+
+ *new_gpus = gpus;
+ *count = 1;
+
+ return TRUE;
+}
+
+static void xinerama_free_gpus( struct x11drv_gpu *gpus )
+{
+ heap_free( gpus );
+}
+
+static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct x11drv_adapter **new_adapters, int *count )
+{
+ struct x11drv_adapter *adapters = NULL;
+ INT index = 0;
+ INT i, j;
+ BOOL mirrored;
+
+ if (gpu_id)
+ return FALSE;
+
+ /* Being lazy, actual adapter count maybe less */
+ adapters = heap_calloc( nb_monitors, sizeof(*adapters) );
+ if (!adapters)
+ return FALSE;
+
+ for (i = 0; i < nb_monitors; i++)
+ {
+ mirrored = FALSE;
+ for (j = 0; j < i; j++)
+ {
+ if (EqualRect( &monitors[i].rcMonitor, &monitors[j].rcMonitor) && !IsRectEmpty( &monitors[j].rcMonitor ))
+ {
+ mirrored = TRUE;
+ break;
+ }
+ }
+
+ /* Mirrored monitors share the same adapter */
+ if (mirrored)
+ continue;
+
+ /* Use monitor index as id */
+ adapters[index].id = (ULONG_PTR)i;
+
+ /* First adapter is always primary because first monitor is primary */
+ if (!i)
+ adapters[index].state_flags |= DISPLAY_DEVICE_PRIMARY_DEVICE;
+
+ if (!IsRectEmpty( &monitors[i].rcMonitor ))
+ adapters[index].state_flags |= DISPLAY_DEVICE_ATTACHED_TO_DESKTOP;
+
+ index++;
+ }
+
+ *new_adapters = adapters;
+ *count = index;
+ return TRUE;
+}
+
+static void xinerama_free_adapters( struct x11drv_adapter *adapters )
+{
+ heap_free( adapters );
+}
+
+static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct x11drv_monitor **new_monitors, int *count )
+{
+ static const WCHAR generic_nonpnp_monitorW[] = {
+ 'G','e','n','e','r','i','c',' ',
+ 'N','o','n','-','P','n','P',' ','M','o','n','i','t','o','r',0};
+ struct x11drv_monitor *monitor;
+ INT first = (INT)adapter_id;
+ INT monitor_count = 0;
+ INT index = 0;
+ INT i;
+
+ for (i = first; i < nb_monitors; i++)
+ {
+ if (i == first || EqualRect( &monitors[i].rcMonitor, &monitors[first].rcMonitor ))
+ monitor_count++;
+ }
+
+ monitor = heap_calloc( monitor_count, sizeof(*monitor) );
+ if (!monitor)
+ return FALSE;
+
+ for (i = first; i < nb_monitors; i++)
+ {
+ if (i == first || EqualRect( &monitors[i].rcMonitor, &monitors[first].rcMonitor ))
+ {
+ strcpyW( monitor[index].name, generic_nonpnp_monitorW );
+ monitor[index].rc_monitor = monitors[i].rcMonitor;
+ monitor[index].rc_work = monitors[i].rcWork;
+ /* Xinerama only reports monitors already attached */
+ monitor[index].state_flags = DISPLAY_DEVICE_ATTACHED;
+ if (!IsRectEmpty( &monitors[i].rcMonitor ))
+ monitor[index].state_flags |= DISPLAY_DEVICE_ACTIVE;
+
+ index++;
+ }
+ }
+
+ *new_monitors = monitor;
+ *count = monitor_count;
+ return TRUE;
+}
+
+static void xinerama_free_monitors( struct x11drv_monitor *monitors )
+{
+ heap_free( monitors );
+}
+
void xinerama_init( unsigned int width, unsigned int height )
{
+ struct x11drv_display_device_handler handler;
MONITORINFOEXW *primary;
int i;
RECT rect;
@@ -244,6 +371,16 @@ void xinerama_init( unsigned int width, unsigned int height )
(monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? " (primary)" : "" );
}
+ strcpy( handler.name, "Xinerama" );
+ handler.priority = 100;
+ handler.pGetGpus = xinerama_get_gpus;
+ handler.pGetAdapters = xinerama_get_adapters;
+ handler.pGetMonitors = xinerama_get_monitors;
+ handler.pFreeGpus = xinerama_free_gpus;
+ handler.pFreeAdapters = xinerama_free_adapters;
+ handler.pFreeMonitors = xinerama_free_monitors;
+ X11DRV_DisplayDevice_SetHandler( &handler );
+
TRACE( "virtual size: %s primary: %s\n",
wine_dbgstr_rect(&virtual_screen_rect), wine_dbgstr_rect(&primary->rcMonitor) );
}
--
2.19.2
1
0