From: Eric Pouech epouech@codeweavers.com
Wine-Bugs: https://bugs.winehq.org/show_bug.cgi?id=55658
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/winemac.drv/image.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/dlls/winemac.drv/image.c b/dlls/winemac.drv/image.c index 857684db9c2..24a6cfe768d 100644 --- a/dlls/winemac.drv/image.c +++ b/dlls/winemac.drv/image.c @@ -249,27 +249,46 @@ cleanup: */ CFArrayRef create_app_icon_images(void) { - struct app_icon_result icons; - struct app_icon_params params = { .result = (UINT_PTR)&icons }; + struct app_icon_result* icons; + struct app_icon_params params; CFMutableArrayRef images = NULL; int i; + ULONG_PTR zero_bits = 0; + SIZE_T size;
TRACE("()\n"); +#ifdef _WIN64 + if (NtCurrentTeb()->WowTebOffset) + { + SYSTEM_BASIC_INFORMATION info; + + NtQuerySystemInformation(SystemEmulationBasicInformation, &info, sizeof(info), NULL); + zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; + } +#endif + size = sizeof(*icons); + if (NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&icons, zero_bits, &size, + MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)) + { + WARN("Failed to allocated user memory\n"); + return NULL; + }
+ params.result = (ULONG_PTR)icons; macdrv_client_func(client_func_app_icon, ¶ms, sizeof(params));
- if (!icons.count) return NULL; + if (!icons->count) goto cleanup;
- images = CFArrayCreateMutable(NULL, icons.count, &kCFTypeArrayCallBacks); + images = CFArrayCreateMutable(NULL, icons->count, &kCFTypeArrayCallBacks); if (!images) { WARN("failed to create images array\n"); - return NULL; + goto cleanup; }
- for (i = 0; i < icons.count; i++) + for (i = 0; i < icons->count; i++) { - struct app_icon_entry *icon = &icons.entries[i]; + struct app_icon_entry *icon = &icons->entries[i]; CGImageRef cgimage = NULL;
if (icon->png) @@ -306,6 +325,9 @@ CFArrayRef create_app_icon_images(void) CFRelease(images); images = NULL; } +cleanup: + size = 0; + NtFreeVirtualMemory(GetCurrentProcess(), (void **)&icons, &size, MEM_RELEASE);
return images; }