winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
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
List overview
wine-commits
March 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
785 discussions
Start a n
N
ew thread
Roderick Colenbrander : winevulkan: Implement vkDestroyInstance.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 539a757728bb5a2294c3f9abfc97bfdc6ef8b0aa URL:
https://source.winehq.org/git/wine.git/?a=commit;h=539a757728bb5a2294c3f9ab…
Author: Roderick Colenbrander <thunderbird2k(a)gmail.com> Date: Thu Mar 1 16:37:05 2018 +0100 winevulkan: Implement vkDestroyInstance. Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com> Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winevulkan/make_vulkan | 17 ++++++++++++++++- dlls/winevulkan/vulkan.c | 10 ++++++++++ dlls/winevulkan/vulkan_thunks.c | 5 ----- dlls/winevulkan/vulkan_thunks.h | 3 +++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index c22619a..6c6cf2e 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -89,7 +89,7 @@ FUNCTION_OVERRIDES = { "vkGetInstanceProcAddr": {"dispatch" : False, "driver" : True, "thunk" : False}, # Instance functions - "vkDestroyInstance" : {"dispatch" : True, "driver" : True, "thunk" : True }, + "vkDestroyInstance" : {"dispatch" : True, "driver" : True, "thunk" : False }, } @@ -1032,6 +1032,21 @@ class VkGenerator(object): f.write("/* For use by vk_icdGetInstanceProcAddr / vkGetInstanceProcAddr */\n") f.write("void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN;\n\n") + # 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(): + continue + + if vk_func.is_global_func(): + continue + + if vk_func.needs_thunk(): + continue + + f.write("{0};\n".format(vk_func.prototype("WINAPI", prefix="wine_", postfix="DECLSPEC_HIDDEN"))) + f.write("\n") + f.write("#endif /* __WINE_VULKAN_THUNKS_H */\n") def generate_vulkan_h(self, f): diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 9d2cdd2..85836bd 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -108,6 +108,16 @@ err: return res; } +void WINAPI wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *allocator) +{ + TRACE("%p, %p\n", instance, allocator); + + if (allocator) + FIXME("Support allocation allocators\n"); + + wine_vk_instance_free(instance); +} + static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_name, uint32_t *count, VkExtensionProperties *properties) { diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 57d4f35..c1c0b07 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -16,11 +16,6 @@ static VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, cons return VK_ERROR_OUT_OF_HOST_MEMORY; } -static void WINAPI wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) -{ - FIXME("stub: %p, %p\n", instance, pAllocator); -} - static VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) { FIXME("stub: %p, %p, %p, %p\n", physicalDevice, pLayerName, pPropertyCount, pProperties); diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index dbfd83c..969bf12 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -6,4 +6,7 @@ /* For use by vk_icdGetInstanceProcAddr / vkGetInstanceProcAddr */ void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN; +/* Functions for which we have custom implementations outside of the thunks. */ +void WINAPI wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) DECLSPEC_HIDDEN; + #endif /* __WINE_VULKAN_THUNKS_H */
1
0
0
0
Roderick Colenbrander : winevulkan: Add instance funcs stubs.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 586a18995ff114e2f7a5c19205e46b0174dfb680 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=586a18995ff114e2f7a5c192…
Author: Roderick Colenbrander <thunderbird2k(a)gmail.com> Date: Thu Mar 1 16:37:04 2018 +0100 winevulkan: Add instance funcs stubs. Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com> Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winevulkan/Makefile.in | 3 +- dlls/winevulkan/make_vulkan | 194 ++++++++++++++++++++++++++++++++++++++- dlls/winevulkan/vulkan.c | 13 +-- dlls/winevulkan/vulkan_private.h | 12 +++ dlls/winevulkan/vulkan_thunks.c | 106 +++++++++++++++++++++ dlls/winevulkan/vulkan_thunks.h | 9 ++ 6 files changed, 322 insertions(+), 15 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=586a18995ff114e2f7a5…
1
0
0
0
Roderick Colenbrander : winevulkan/winex11: Implement vkCreateInstance.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 75b68a8585f3f3de23d56d35b9e0b08d952014d3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=75b68a8585f3f3de23d56d35…
Author: Roderick Colenbrander <thunderbird2k(a)gmail.com> Date: Thu Mar 1 16:37:03 2018 +0100 winevulkan/winex11: Implement vkCreateInstance. Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com> Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 74 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 9 +++++ dlls/winevulkan/vulkan.c | 49 ++++++++++++++++++++++++-- dlls/winevulkan/vulkan_private.h | 45 ++++++++++++++++++++++++ dlls/winex11.drv/vulkan.c | 67 +++++++++++++++++++++++++++++++++--- include/config.h.in | 3 ++ 6 files changed, 240 insertions(+), 7 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=75b68a8585f3f3de23d5…
1
0
0
0
Piotr Caban : msvcrt: Fix misleading indentation in gets.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: a44794af67ace4bca152480bb2be3d141c36b39c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a44794af67ace4bca152480b…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Mar 1 15:30:57 2018 +0100 msvcrt: Fix misleading indentation in gets. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 6d0c1ae..7022e48 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -4714,9 +4714,11 @@ char * CDECL MSVCRT_gets(char *buf) MSVCRT__lock_file(MSVCRT_stdin); for(cc = MSVCRT__fgetc_nolock(MSVCRT_stdin); cc != MSVCRT_EOF && cc != '\n'; - cc = MSVCRT__fgetc_nolock(MSVCRT_stdin)) - if(cc != '\r') *buf++ = (char)cc; - + cc = MSVCRT__fgetc_nolock(MSVCRT_stdin)) + { + if(cc != '\r') + *buf++ = (char)cc; + } *buf = '\0'; TRACE("got '%s'\n", buf_start);
1
0
0
0
Michael Stefaniuc : maintainers: Add a DirectMusic section.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 5ed6fd9ade3f630e68eed077b7ca86dcd48a64b8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ed6fd9ade3f630e68eed077…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Thu Mar 1 19:00:03 2018 +0100 maintainers: Add a DirectMusic section. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index d957e31..20b5678 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -90,6 +90,11 @@ DirectInput P: Andrew Eikum <aeikum(a)codeweavers.com> F: dlls/dinput/ +DirectMusic +M: Michael Stefaniuc <mstefani(a)winehq.org> +F: dlls/dm*/ +F: dlls/dswave/ + DirectPlay M: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> F: dlls/dplayx/
1
0
0
0
Andrew Eikum : maintainers: Remove myself from a dmusic DLL.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 7600847da01b50c9c51de854eba29e790f4e286d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7600847da01b50c9c51de854…
Author: Andrew Eikum <aeikum(a)codeweavers.com> Date: Thu Mar 1 07:57:23 2018 -0600 maintainers: Remove myself from a dmusic DLL. Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6845a7a..d957e31 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -38,7 +38,6 @@ F: programs/winedbg/be_arm* Audio I/O M: Andrew Eikum <aeikum(a)codeweavers.com> F: dlls/dsound/ -F: dlls/dswave/ F: dlls/mmdevapi/ F: dlls/winealsa.drv/ F: dlls/winecoreaudio.drv/
1
0
0
0
Alexandre Julliard : kernel32: Implement the LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE flag.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: e55101715cee244ef1857d9a975f87a9d6e3fac0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e55101715cee244ef1857d9a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 1 17:21:32 2018 +0100 kernel32: Implement the LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE flag. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/module.c | 50 +++++++++++++++++++++++++++++++++++++------- dlls/kernel32/tests/loader.c | 9 ++++++-- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index d232d7d..6f123ca 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -58,6 +58,15 @@ static struct list dll_dir_list = LIST_INIT( dll_dir_list ); /* extra dirs from static WCHAR *dll_directory; /* extra path for SetDllDirectoryW */ static DWORD default_search_flags; /* default flags set by SetDefaultDllDirectories */ +/* to keep track of LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE file handles */ +struct exclusive_datafile +{ + struct list entry; + HMODULE module; + HANDLE file; +}; +static struct list exclusive_datafile_list = LIST_INIT( exclusive_datafile_list ); + static CRITICAL_SECTION dlldir_section; static CRITICAL_SECTION_DEBUG critsect_debug = { @@ -1127,11 +1136,10 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE *hmod, DWORD flags ) HANDLE mapping; HMODULE module = 0; DWORD protect = PAGE_READONLY; - DWORD sharing = FILE_SHARE_READ; + DWORD sharing = FILE_SHARE_READ | FILE_SHARE_DELETE; *hmod = 0; - if (!(flags & LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE)) sharing |= FILE_SHARE_WRITE; if (flags & LOAD_LIBRARY_AS_IMAGE_RESOURCE) protect |= SEC_IMAGE; if (SearchPathW( NULL, name, dotDLL, sizeof(filenameW) / sizeof(filenameW[0]), @@ -1153,6 +1161,17 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE *hmod, DWORD flags ) /* make sure it's a valid PE file */ if (!RtlImageNtHeader( module )) goto failed; *hmod = (HMODULE)((char *)module + 1); /* set bit 0 for data file module */ + + if (flags & LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE) + { + struct exclusive_datafile *file = HeapAlloc( GetProcessHeap(), 0, sizeof(*file) ); + if (!file) goto failed; + file->module = *hmod; + file->file = hFile; + list_add_head( &exclusive_datafile_list, &file->entry ); + TRACE( "delaying close %p for module %p\n", file->file, file->module ); + return TRUE; + } } else *hmod = (HMODULE)((char *)module + 2); /* set bit 1 for image resource module */ @@ -1206,12 +1225,12 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags ) LdrUnlockLoaderLock( 0, magic ); goto done; } + if (load_library_as_datafile( libname->Buffer, &hModule, flags )) + { + LdrUnlockLoaderLock( 0, magic ); + goto done; + } LdrUnlockLoaderLock( 0, magic ); - - /* The method in load_library_as_datafile allows searching for the - * 'native' libraries only - */ - if (load_library_as_datafile( libname->Buffer, &hModule, flags )) goto done; flags |= DONT_RESOLVE_DLL_REFERENCES; /* Just in case */ /* Fallback to normal behaviour */ } @@ -1346,6 +1365,23 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary(HINSTANCE hLibModule) if ((ULONG_PTR)hLibModule & 3) /* this is a datafile module */ { + if ((ULONG_PTR)hLibModule & 1) + { + struct exclusive_datafile *file; + ULONG_PTR magic; + + LdrLockLoaderLock( 0, NULL, &magic ); + LIST_FOR_EACH_ENTRY( file, &exclusive_datafile_list, struct exclusive_datafile, entry ) + { + if (file->module != hLibModule) continue; + TRACE( "closing %p for module %p\n", file->file, file->module ); + CloseHandle( file->file ); + list_remove( &file->entry ); + HeapFree( GetProcessHeap(), 0, file ); + break; + } + LdrUnlockLoaderLock( 0, magic ); + } return UnmapViewOfFile( (void *)((ULONG_PTR)hLibModule & ~3) ); } diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 4d1b3e2..c9ca02c 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -877,8 +877,13 @@ static void test_Loader(void) SetLastError(0xdeadbeef); h = CreateFileA( dll_name, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); - todo_wine ok( h == INVALID_HANDLE_VALUE, "open succeeded\n" ); - todo_wine ok( GetLastError() == ERROR_SHARING_VIOLATION, "wrong error %u\n", GetLastError() ); + ok( h == INVALID_HANDLE_VALUE, "open succeeded\n" ); + ok( GetLastError() == ERROR_SHARING_VIOLATION, "wrong error %u\n", GetLastError() ); + CloseHandle( h ); + + SetLastError(0xdeadbeef); + h = CreateFileA( dll_name, GENERIC_READ | DELETE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); + ok( h != INVALID_HANDLE_VALUE, "open failed err %u\n", GetLastError() ); CloseHandle( h ); SetLastError(0xdeadbeef);
1
0
0
0
Alexandre Julliard : kernel32: Implement the LOAD_LIBRARY_AS_IMAGE_RESOURCE flag.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: e1d8c176efdd04fb2a0f99426e1ad9962589b9ec URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e1d8c176efdd04fb2a0f9942…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 1 17:18:03 2018 +0100 kernel32: Implement the LOAD_LIBRARY_AS_IMAGE_RESOURCE flag. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/module.c | 37 +++++++++++++++++++++---------------- dlls/kernel32/tests/loader.c | 26 ++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index a5346db..d232d7d 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -1125,12 +1125,14 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE *hmod, DWORD flags ) WCHAR filenameW[MAX_PATH]; HANDLE hFile = INVALID_HANDLE_VALUE; HANDLE mapping; - HMODULE module; + HMODULE module = 0; + DWORD protect = PAGE_READONLY; DWORD sharing = FILE_SHARE_READ; *hmod = 0; if (!(flags & LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE)) sharing |= FILE_SHARE_WRITE; + if (flags & LOAD_LIBRARY_AS_IMAGE_RESOURCE) protect |= SEC_IMAGE; if (SearchPathW( NULL, name, dotDLL, sizeof(filenameW) / sizeof(filenameW[0]), filenameW, NULL )) @@ -1139,22 +1141,28 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE *hmod, DWORD flags ) } if (hFile == INVALID_HANDLE_VALUE) return FALSE; - mapping = CreateFileMappingW( hFile, NULL, PAGE_READONLY, 0, 0, NULL ); - CloseHandle( hFile ); - if (!mapping) return FALSE; + mapping = CreateFileMappingW( hFile, NULL, protect, 0, 0, NULL ); + if (!mapping) goto failed; module = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 ); CloseHandle( mapping ); - if (!module) return FALSE; + if (!module) goto failed; - /* make sure it's a valid PE file */ - if (!RtlImageNtHeader(module)) + if (!(flags & LOAD_LIBRARY_AS_IMAGE_RESOURCE)) { - UnmapViewOfFile( module ); - return FALSE; + /* make sure it's a valid PE file */ + if (!RtlImageNtHeader( module )) goto failed; + *hmod = (HMODULE)((char *)module + 1); /* set bit 0 for data file module */ } - *hmod = (HMODULE)((char *)module + 1); /* set low bit of handle to indicate datafile module */ + else *hmod = (HMODULE)((char *)module + 2); /* set bit 1 for image resource module */ + + CloseHandle( hFile ); return TRUE; + +failed: + if (module) UnmapViewOfFile( module ); + CloseHandle( hFile ); + return FALSE; } @@ -1174,7 +1182,6 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags ) LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); const DWORD unsupported_flags = (LOAD_IGNORE_CODE_AUTHZ_LEVEL | - LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_REQUIRE_SIGNED_TARGET); if (!(flags & load_library_search_flags)) flags |= default_search_flags; @@ -1188,7 +1195,7 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags ) load_path = MODULE_get_dll_load_path( flags & LOAD_WITH_ALTERED_SEARCH_PATH ? libname->Buffer : NULL, -1 ); if (!load_path) return 0; - if (flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE)) + if (flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE)) { ULONG_PTR magic; @@ -1337,11 +1344,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary(HINSTANCE hLibModule) return FALSE; } - if ((ULONG_PTR)hLibModule & 1) + if ((ULONG_PTR)hLibModule & 3) /* this is a datafile module */ { - /* this is a LOAD_LIBRARY_AS_DATAFILE module */ - char *ptr = (char *)hLibModule - 1; - return UnmapViewOfFile( ptr ); + return UnmapViewOfFile( (void *)((ULONG_PTR)hLibModule & ~3) ); } if ((nts = LdrUnloadDll( hLibModule )) == STATUS_SUCCESS) retv = TRUE; diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 0a65bcd..4d1b3e2 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -849,7 +849,7 @@ static void test_Loader(void) SetLastError(0xdeadbeef); hlib_as_data_file = LoadLibraryExA(dll_name, 0, LOAD_LIBRARY_AS_DATAFILE); ok(hlib_as_data_file != 0, "LoadLibraryEx error %u\n", GetLastError()); - ok((ULONG_PTR)hlib_as_data_file & 1, "hlib_as_data_file is even\n"); + ok(((ULONG_PTR)hlib_as_data_file & 3) == 1, "hlib_as_data_file got %p\n", hlib_as_data_file); hlib = GetModuleHandleA(dll_name); ok(!hlib, "GetModuleHandle should fail\n"); @@ -865,7 +865,7 @@ static void test_Loader(void) SetLastError(0xdeadbeef); hlib_as_data_file = LoadLibraryExA(dll_name, 0, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE); - if (!((ULONG_PTR)hlib_as_data_file & 1) || /* winxp */ + if (!((ULONG_PTR)hlib_as_data_file & 3) || /* winxp */ (!hlib_as_data_file && GetLastError() == ERROR_INVALID_PARAMETER)) /* w2k3 */ { win_skip( "LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE not supported\n" ); @@ -886,6 +886,28 @@ static void test_Loader(void) ok(ret, "FreeLibrary error %d\n", GetLastError()); } + SetLastError(0xdeadbeef); + hlib_as_data_file = LoadLibraryExA(dll_name, 0, LOAD_LIBRARY_AS_IMAGE_RESOURCE); + if (!((ULONG_PTR)hlib_as_data_file & 3) || /* winxp */ + (!hlib_as_data_file && GetLastError() == ERROR_INVALID_PARAMETER)) /* w2k3 */ + { + win_skip( "LOAD_LIBRARY_AS_IMAGE_RESOURCE not supported\n" ); + FreeLibrary(hlib_as_data_file); + } + else + { + ok(hlib_as_data_file != 0, "LoadLibraryEx error %u\n", GetLastError()); + ok(((ULONG_PTR)hlib_as_data_file & 3) == 2, "hlib_as_data_file got %p\n", + hlib_as_data_file); + + hlib = GetModuleHandleA(dll_name); + ok(!hlib, "GetModuleHandle should fail\n"); + + SetLastError(0xdeadbeef); + ret = FreeLibrary(hlib_as_data_file); + ok(ret, "FreeLibrary error %d\n", GetLastError()); + } + query_image_section( i, dll_name, &nt_header, NULL ); } else
1
0
0
0
Alexandre Julliard : ntoskrnl.exe: More general implementation of the CRn and DRn registers.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 9f103a9e78e4e337026828f15cf835a5ac222bf9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9f103a9e78e4e337026828f1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 1 17:11:34 2018 +0100 ntoskrnl.exe: More general implementation of the CRn and DRn registers. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/instr.c | 138 ++++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 78 deletions(-) diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c index 2822aac..fdbe8bd 100644 --- a/dlls/ntoskrnl.exe/instr.c +++ b/dlls/ntoskrnl.exe/instr.c @@ -271,6 +271,7 @@ static void *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, */ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) { + static const char *reg_names[8] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" }; int prefix, segprefix, prefixlen, len, long_op, long_addr; BYTE *instr; @@ -335,97 +336,78 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context ) case 0x0f: /* extended instruction */ switch(instr[1]) { - case 0x22: /* mov eax, crX */ - switch (instr[2]) + case 0x20: /* mov crX, Rd */ { - case 0xc0: - TRACE("mov eax,cr0 at 0x%08x, EAX=0x%08x\n", context->Eip,context->Eax ); - context->Eip += prefixlen+3; + int reg = (instr[2] >> 3) & 7; + DWORD *data = get_reg_address( context, instr[2] ); + TRACE( "mov cr%u,%s at 0x%08x\n", reg, reg_names[instr[2] & 7], context->Eip ); + switch (reg) + { + case 0: *data = 0x10; break; /* FIXME: set more bits ? */ + case 2: *data = 0; break; + case 3: *data = 0; break; + case 4: *data = 0; break; + default: return ExceptionContinueSearch; + } + context->Eip += prefixlen + 3; return ExceptionContinueExecution; - case 0xe0: - TRACE("mov eax,cr4 at 0x%08x, EAX=0x%08x\n", context->Eip,context->Eax ); - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - default: - break; /*fallthrough to bad instruction handling */ } - ERR("Unsupported EAX -> CR register, eip+2 is %02x\n", instr[2]); - break; /*fallthrough to bad instruction handling */ - case 0x20: /* mov crX, eax */ - switch (instr[2]) + case 0x21: /* mov drX, Rd */ { - case 0xe0: /* mov cr4, eax */ - /* CR4 register . See linux/arch/i386/mm/init.c, X86_CR4_ defs - * bit 0: VME Virtual Mode Exception ? - * bit 1: PVI Protected mode Virtual Interrupt - * bit 2: TSD Timestamp disable - * bit 3: DE Debugging extensions - * bit 4: PSE Page size extensions - * bit 5: PAE Physical address extension - * bit 6: MCE Machine check enable - * bit 7: PGE Enable global pages - * bit 8: PCE Enable performance counters at IPL3 - */ - TRACE("mov cr4,eax at 0x%08x\n",context->Eip); - context->Eax = 0; - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xc0: /* mov cr0, eax */ - TRACE("mov cr0,eax at 0x%08x\n",context->Eip); - context->Eax = 0x10; /* FIXME: set more bits ? */ - context->Eip += prefixlen+3; + int reg = (instr[2] >> 3) & 7; + DWORD *data = get_reg_address( context, instr[2] ); + TRACE( "mov dr%u,%s at 0x%08x\n", reg, reg_names[instr[2] & 7], context->Eip ); + switch (reg) + { + case 0: *data = context->Dr0; break; + case 1: *data = context->Dr1; break; + case 2: *data = context->Dr2; break; + case 3: *data = context->Dr3; break; + case 6: *data = context->Dr6; break; + case 7: *data = 0x400; break; + default: return ExceptionContinueSearch; + } + context->Eip += prefixlen + 3; return ExceptionContinueExecution; - default: /* fallthrough to illegal instruction */ - break; } - /* fallthrough to illegal instruction */ - break; - case 0x21: /* mov drX, eax */ - switch (instr[2]) + case 0x22: /* mov Rd, crX */ { - case 0xc8: /* mov dr1, eax */ - TRACE("mov dr1,eax at 0x%08x\n",context->Eip); - context->Eax = context->Dr1; - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xf8: /* mov dr7, eax */ - TRACE("mov dr7,eax at 0x%08x\n",context->Eip); - context->Eax = 0x400; - context->Eip += prefixlen+3; + int reg = (instr[2] >> 3) & 7; + DWORD *data = get_reg_address( context, instr[2] ); + TRACE( "mov %s,cr%u at 0x%08x, %s=%08x\n", reg_names[instr[2] & 7], + reg, context->Eip, reg_names[instr[2] & 7], *data ); + switch (reg) + { + case 0: break; + case 2: break; + case 3: break; + case 4: break; + default: return ExceptionContinueSearch; + } + context->Eip += prefixlen + 3; return ExceptionContinueExecution; } - ERR("Unsupported DR register -> EAX, eip+2 is %02x\n", instr[2]); - /* fallthrough to illegal instruction */ - break; - case 0x23: /* mov eax drX */ - switch (instr[2]) + case 0x23: /* mov Rd, drX */ { - case 0xc0: /* mov eax, dr0 */ - context->Dr0 = context->Eax; - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xc8: /* mov eax, dr1 */ - context->Dr1 = context->Eax; - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xd0: /* mov eax, dr2 */ - context->Dr2 = context->Eax; - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xd8: /* mov eax, dr3 */ - context->Dr3 = context->Eax; - context->Eip += prefixlen+3; - return ExceptionContinueExecution; - case 0xf8: /* mov eax, dr7 */ - context->Dr7 = context->Eax; - context->Eip += prefixlen+3; + int reg = (instr[2] >> 3) & 7; + DWORD *data = get_reg_address( context, instr[2] ); + TRACE( "mov %s,dr%u at 0x%08x %s=%08x\n", reg_names[instr[2] & 7], + reg, context->Eip, reg_names[instr[2] & 7], *data ); + switch (reg) + { + case 0: context->Dr0 = *data; break; + case 1: context->Dr1 = *data; break; + case 2: context->Dr2 = *data; break; + case 3: context->Dr3 = *data; break; + case 6: context->Dr6 = *data; break; + case 7: context->Dr7 = *data; break; + default: return ExceptionContinueSearch; + } + context->Eip += prefixlen + 3; return ExceptionContinueExecution; } - ERR("Unsupported EAX -> DR register, eip+2 is %02x\n", instr[2]); - /* fallthrough to illegal instruction */ - break; } - break; /* Unable to emulate it */ + break; case 0x8a: /* mov Eb, Gb */ case 0x8b: /* mov Ev, Gv */
1
0
0
0
Alexandre Julliard : ntoskrnl.exe: Add a helper function for accessing registers.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 0cbb5d0a146ebb2a80712cab7e2c1530edad9a6d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0cbb5d0a146ebb2a80712cab…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 1 17:11:12 2018 +0100 ntoskrnl.exe: Add a helper function for accessing registers. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/instr.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c index 48f16f2..2822aac 100644 --- a/dlls/ntoskrnl.exe/instr.c +++ b/dlls/ntoskrnl.exe/instr.c @@ -117,12 +117,29 @@ static void store_reg_byte( CONTEXT *context, BYTE regmodrm, const BYTE *addr ) } } +static DWORD *get_reg_address( CONTEXT *context, BYTE rm ) +{ + switch (rm & 7) + { + case 0: return &context->Eax; + case 1: return &context->Ecx; + case 2: return &context->Edx; + case 3: return &context->Ebx; + case 4: return &context->Esp; + case 5: return &context->Ebp; + case 6: return &context->Esi; + case 7: return &context->Edi; + } + return NULL; +} + + /*********************************************************************** * INSTR_GetOperandAddr * * Return the address of an instruction operand (from the mod/rm byte). */ -static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, +static void *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, int long_addr, int segprefix, int *len ) { int mod, rm, base = 0, index = 0, ss = 0, off; @@ -135,20 +152,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, rm = mod & 7; mod >>= 6; - if (mod == 3) - { - switch(rm) - { - case 0: return (BYTE *)&context->Eax; - case 1: return (BYTE *)&context->Ecx; - case 2: return (BYTE *)&context->Edx; - case 3: return (BYTE *)&context->Ebx; - case 4: return (BYTE *)&context->Esp; - case 5: return (BYTE *)&context->Ebp; - case 6: return (BYTE *)&context->Esi; - case 7: return (BYTE *)&context->Edi; - } - } + if (mod == 3) return get_reg_address( context, rm ); if (long_addr) { @@ -254,7 +258,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT *context, BYTE *instr, base &= 0xffff; } /* FIXME: we assume that all segments have a base of 0 */ - return (BYTE *)(base + (index << ss)); + return (void *)(base + (index << ss)); #undef GET_VAL }
1
0
0
0
← Newer
1
...
74
75
76
77
78
79
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Results per page:
10
25
50
100
200