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
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
List overview
wine-commits
July 2022
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 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
1 participants
639 discussions
Start a n
N
ew thread
Gabriel Ivăncescu : mshtml: Set the channel's content type when parsing the header.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 59f1fdaf7fe16a9102adc676851103099a8a2047 URL:
https://gitlab.winehq.org/wine/wine/-/commit/59f1fdaf7fe16a9102adc676851103…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Wed Jul 13 20:07:32 2022 +0300 mshtml: Set the channel's content type when parsing the header. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/mshtml/navigate.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index e6f203535b7..5f736dbf07c 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -708,12 +708,29 @@ HRESULT read_stream(BSCallback *This, IStream *stream, void *buf, DWORD size, DW static void parse_content_type(nsChannelBSC *This, const WCHAR *value) { - const WCHAR *ptr; - size_t len; + const WCHAR *ptr, *beg, *end; + size_t len = wcslen(value); + char *content_type; static const WCHAR charsetW[] = {'c','h','a','r','s','e','t','='}; ptr = wcschr(value, ';'); + + if(!This->nschannel->content_type || !(This->nschannel->load_flags & LOAD_CALL_CONTENT_SNIFFERS)) { + for(end = ptr ? ptr : value + len; end > value; end--) + if(!iswspace(end[-1])) + break; + for(beg = value; beg < end; beg++) + if(!iswspace(*beg)) + break; + + if((content_type = heap_strndupWtoU(beg, end - beg))) { + heap_free(This->nschannel->content_type); + This->nschannel->content_type = content_type; + strlwr(content_type); + } + } + if(!ptr) return; @@ -721,7 +738,6 @@ static void parse_content_type(nsChannelBSC *This, const WCHAR *value) while(*ptr && iswspace(*ptr)) ptr++; - len = lstrlenW(value); if(ptr + ARRAY_SIZE(charsetW) < value+len && !wcsnicmp(ptr, charsetW, ARRAY_SIZE(charsetW))) { size_t charset_len, lena; nsACString charset_str;
1
0
0
0
Jan Sikorski : wined3d: Defer destroying Vulkan compute pipelines.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: a3d5026e42bf2f870f38be767bcd482807d8a03c URL:
https://gitlab.winehq.org/wine/wine/-/commit/a3d5026e42bf2f870f38be767bcd48…
Author: Jan Sikorski <jsikorski(a)codeweavers.com> Date: Tue Jul 12 15:13:43 2022 +0200 wined3d: Defer destroying Vulkan compute pipelines. Vulkan pipelines should be destroyed only after the last command buffer using the pipeline is done executing. Since we do not track which pipelines are encoded into which command buffers, defer destruction until the current command buffer finishes. Signed-off-by: Jan Sikorski <jsikorski(a)codeweavers.com> --- dlls/wined3d/context_vk.c | 31 +++++++++++++++++++++++++++++++ dlls/wined3d/shader_spirv.c | 3 ++- dlls/wined3d/wined3d_private.h | 4 ++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index a9b875a132e..b738e97b6cf 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -964,6 +964,32 @@ static void wined3d_context_vk_reset_completed_queries(struct wined3d_context_vk memset(pool_vk->completed, 0, sizeof(pool_vk->completed)); } +void wined3d_context_vk_destroy_vk_pipeline(struct wined3d_context_vk *context_vk, + VkPipeline vk_pipeline, uint64_t command_buffer_id) +{ + struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); + const struct wined3d_vk_info *vk_info = context_vk->vk_info; + struct wined3d_retired_object_vk *o; + + if (context_vk->completed_command_buffer_id > command_buffer_id) + { + VK_CALL(vkDestroyPipeline(device_vk->vk_device, vk_pipeline, NULL)); + TRACE("Destroyed pipeline 0x%s.\n", wine_dbgstr_longlong(vk_pipeline)); + return; + } + + if (!(o = wined3d_context_vk_get_retired_object_vk(context_vk))) + { + ERR("Leaking pipeline 0x%s.\n", wine_dbgstr_longlong(vk_pipeline)); + return; + } + + o->type = WINED3D_RETIRED_PIPELINE_VK; + o->u.vk_pipeline = vk_pipeline; + o->command_buffer_id = command_buffer_id; +} + + void wined3d_context_vk_destroy_vk_sampler(struct wined3d_context_vk *context_vk, VkSampler vk_sampler, uint64_t command_buffer_id) { @@ -1184,6 +1210,11 @@ static void wined3d_context_vk_cleanup_resources(struct wined3d_context_vk *cont TRACE("Destroyed event 0x%s.\n", wine_dbgstr_longlong(o->u.vk_event)); break; + case WINED3D_RETIRED_PIPELINE_VK: + VK_CALL(vkDestroyPipeline(device_vk->vk_device, o->u.vk_pipeline, NULL)); + TRACE("Destroyed pipeline 0x%s.\n", wine_dbgstr_longlong(o->u.vk_pipeline)); + break; + default: ERR("Unhandled object type %#x.\n", o->type); break; diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index 14665dee0f2..1f89e3d3ef5 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -926,10 +926,11 @@ static void shader_spirv_destroy_compute_vk(struct wined3d_shader *shader) { struct wined3d_device_vk *device_vk = wined3d_device_vk(shader->device); struct shader_spirv_compute_program_vk *program = shader->backend_data; + struct wined3d_context_vk *context_vk = &device_vk->context_vk; struct wined3d_vk_info *vk_info = &device_vk->vk_info; shader_spirv_invalidate_contexts_compute_program(&device_vk->d, program); - VK_CALL(vkDestroyPipeline(device_vk->vk_device, program->vk_pipeline, NULL)); + wined3d_context_vk_destroy_vk_pipeline(context_vk, program->vk_pipeline, context_vk->current_command_buffer.id); VK_CALL(vkDestroyShaderModule(device_vk->vk_device, program->vk_module, NULL)); vkd3d_shader_free_scan_descriptor_info(&program->descriptor_info); shader->backend_data = NULL; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5f058d11ba9..72732df7b4d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2479,6 +2479,7 @@ enum wined3d_retired_object_type_vk WINED3D_RETIRED_SAMPLER_VK, WINED3D_RETIRED_QUERY_POOL_VK, WINED3D_RETIRED_EVENT_VK, + WINED3D_RETIRED_PIPELINE_VK, }; struct wined3d_retired_object_vk @@ -2502,6 +2503,7 @@ struct wined3d_retired_object_vk VkImageView vk_image_view; VkSampler vk_sampler; VkEvent vk_event; + VkPipeline vk_pipeline; struct { struct wined3d_query_pool_vk *pool_vk; @@ -2735,6 +2737,8 @@ void wined3d_context_vk_destroy_vk_sampler(struct wined3d_context_vk *context_vk VkSampler vk_sampler, uint64_t command_buffer_id) DECLSPEC_HIDDEN; void wined3d_context_vk_destroy_vk_event(struct wined3d_context_vk *context_vk, VkEvent vk_event, uint64_t command_buffer_id) DECLSPEC_HIDDEN; +void wined3d_context_vk_destroy_vk_pipeline(struct wined3d_context_vk *context_vk, + VkPipeline vk_pipeline, uint64_t command_buffer_id) DECLSPEC_HIDDEN; void wined3d_context_vk_end_current_render_pass(struct wined3d_context_vk *context_vk) DECLSPEC_HIDDEN; VkCommandBuffer wined3d_context_vk_get_command_buffer(struct wined3d_context_vk *context_vk) DECLSPEC_HIDDEN; struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout(struct wined3d_context_vk *context_vk,
1
0
0
0
Torge Matthies : msvcr120/tests: Add missing newlines to messages.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 6d4cf5b208b5104e114a4e0d069697152e4e8e75 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6d4cf5b208b5104e114a4e0d069697…
Author: Torge Matthies <tmatthies(a)codeweavers.com> Date: Tue Jul 12 22:49:21 2022 +0200 msvcr120/tests: Add missing newlines to messages. Signed-off-by: Torge Matthies <tmatthies(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr120/tests/msvcr120.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 88a32b382ef..ac35076af03 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -1375,7 +1375,7 @@ static void __cdecl chore_proc(_UnrealizedChore *_this) MSVCRT_bool canceling = call_func1( p__StructuredTaskCollection__IsCanceling, chore->chore.task_collection); - ok(!canceling, "Task is already canceling"); + ok(!canceling, "Task is already canceling\n"); } if (!chore->wait_event) @@ -1399,7 +1399,7 @@ static void __cdecl chore_proc(_UnrealizedChore *_this) MSVCRT_bool canceling = call_func1( p__StructuredTaskCollection__IsCanceling, chore->chore.task_collection); - ok(canceling, "Task is not canceling"); + ok(canceling, "Task is not canceling\n"); } }
1
0
0
0
Jinoh Kang : kernelbase: Implement PrefetchVirtualMemory.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: a9c357e5a9430deae04b593cd90893db165a6d12 URL:
https://gitlab.winehq.org/wine/wine/-/commit/a9c357e5a9430deae04b593cd90893…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Nov 26 02:36:39 2021 +0900 kernelbase: Implement PrefetchVirtualMemory. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/kernel32/tests/virtual.c | 1 - dlls/kernelbase/memory.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 1bb432f4ef1..cadb76d5534 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -4231,7 +4231,6 @@ static void test_PrefetchVirtualMemory(void) return; } - todo_wine ok( !pPrefetchVirtualMemory( GetCurrentProcess(), 0, NULL, 0 ), "PrefetchVirtualMemory unexpected success on 0 entries\n" ); diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index e24a6f9aad0..2418c670557 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -415,11 +415,12 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAllocFromApp( void *addr, SIZE_T size, /*********************************************************************** * PrefetchVirtualMemory (kernelbase.@) */ -BOOL WINAPI /* DECLSPEC_HOTPATCH */ PrefetchVirtualMemory( HANDLE process, ULONG_PTR count, - WIN32_MEMORY_RANGE_ENTRY *addresses, ULONG flags ) +BOOL WINAPI DECLSPEC_HOTPATCH PrefetchVirtualMemory( HANDLE process, ULONG_PTR count, + WIN32_MEMORY_RANGE_ENTRY *addresses, ULONG flags ) { - FIXME( "process %p, count %p, addresses %p, flags %#lx stub.\n", process, (void *)count, addresses, flags ); - return TRUE; + return set_ntstatus( NtSetInformationVirtualMemory( process, VmPrefetchInformation, + count, (PMEMORY_RANGE_ENTRY)addresses, + &flags, sizeof(flags) )); }
1
0
0
0
Jinoh Kang : kernel32/tests: Add tests for PrefetchVirtualMemory.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 7d2c03e88d26a18e8d593263c7fdf0e9fd3f6bdf URL:
https://gitlab.winehq.org/wine/wine/-/commit/7d2c03e88d26a18e8d593263c7fdf0…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Nov 26 02:33:50 2021 +0900 kernel32/tests: Add tests for PrefetchVirtualMemory. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/kernel32/tests/virtual.c | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 9b3c8228a3f..1bb432f4ef1 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -37,6 +37,7 @@ static HINSTANCE hkernel32, hkernelbase, hntdll; static SYSTEM_INFO si; +static BOOL is_wow64; static UINT (WINAPI *pGetWriteWatch)(DWORD,LPVOID,SIZE_T,LPVOID*,ULONG_PTR*,ULONG*); static UINT (WINAPI *pResetWriteWatch)(LPVOID,SIZE_T); static NTSTATUS (WINAPI *pNtAreMappedFilesTheSame)(PVOID,PVOID); @@ -50,6 +51,7 @@ static ULONG (WINAPI *pRtlRemoveVectoredExceptionHandler)(PVOID); static BOOL (WINAPI *pGetProcessDEPPolicy)(HANDLE, LPDWORD, PBOOL); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static NTSTATUS (WINAPI *pNtProtectVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG, ULONG *); +static BOOL (WINAPI *pPrefetchVirtualMemory)(HANDLE, ULONG_PTR, PWIN32_MEMORY_RANGE_ENTRY, ULONG); /* ############################### */ @@ -4216,6 +4218,50 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access) CloseHandle(mapping); } +static void test_PrefetchVirtualMemory(void) +{ + WIN32_MEMORY_RANGE_ENTRY entries[2]; + char stackmem[] = "Test stack mem"; + static char testmem[] = "Test memory range data"; + unsigned int page_size = si.dwPageSize; + + if (!pPrefetchVirtualMemory) + { + skip("no PrefetchVirtualMemory in kernelbase\n"); + return; + } + + todo_wine + ok( !pPrefetchVirtualMemory( GetCurrentProcess(), 0, NULL, 0 ), + "PrefetchVirtualMemory unexpected success on 0 entries\n" ); + + entries[0].VirtualAddress = ULongToPtr(PtrToUlong(testmem) & -(ULONG_PTR)page_size); + entries[0].NumberOfBytes = page_size; + ok( pPrefetchVirtualMemory( GetCurrentProcess(), 1, entries, 0 ) || + broken( is_wow64 && GetLastError() == ERROR_INVALID_PARAMETER ) /* win10 1507 */, + "PrefetchVirtualMemory unexpected status on 1 page-aligned entry: %ld\n", GetLastError() ); + + entries[0].VirtualAddress = testmem; + entries[0].NumberOfBytes = sizeof(testmem); + ok( pPrefetchVirtualMemory( GetCurrentProcess(), 1, entries, 0 ) || + broken( is_wow64 && GetLastError() == ERROR_INVALID_PARAMETER ) /* win10 1507 */, + "PrefetchVirtualMemory unexpected status on 1 entry: %ld\n", GetLastError() ); + + entries[0].VirtualAddress = NULL; + entries[0].NumberOfBytes = page_size; + ok( pPrefetchVirtualMemory( GetCurrentProcess(), 1, entries, 0 ) || + broken( is_wow64 && GetLastError() == ERROR_INVALID_PARAMETER ) /* win10 1507 */, + "PrefetchVirtualMemory unexpected status on 1 unmapped entry: %ld\n", GetLastError() ); + + entries[0].VirtualAddress = ULongToPtr(PtrToUlong(testmem) & -(ULONG_PTR)page_size); + entries[0].NumberOfBytes = page_size; + entries[1].VirtualAddress = ULongToPtr(PtrToUlong(stackmem) & -(ULONG_PTR)page_size); + entries[1].NumberOfBytes = page_size; + ok( pPrefetchVirtualMemory( GetCurrentProcess(), 2, entries, 0 ) || + broken( is_wow64 && GetLastError() == ERROR_INVALID_PARAMETER ) /* win10 1507 */, + "PrefetchVirtualMemory unexpected status on 2 page-aligned entries: %ld\n", GetLastError() ); +} + START_TEST(virtual) { int argc; @@ -4270,10 +4316,13 @@ START_TEST(virtual) pRtlAddVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlAddVectoredExceptionHandler" ); pRtlRemoveVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlRemoveVectoredExceptionHandler" ); pNtProtectVirtualMemory = (void *)GetProcAddress( hntdll, "NtProtectVirtualMemory" ); + pPrefetchVirtualMemory = (void *)GetProcAddress( hkernelbase, "PrefetchVirtualMemory" ); GetSystemInfo(&si); trace("system page size %#lx\n", si.dwPageSize); + if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; + test_shared_memory(FALSE); test_shared_memory_ro(FALSE, FILE_MAP_READ|FILE_MAP_WRITE); test_shared_memory_ro(FALSE, FILE_MAP_COPY); @@ -4291,6 +4340,7 @@ START_TEST(virtual) test_IsBadWritePtr(); test_IsBadCodePtr(); test_write_watch(); + test_PrefetchVirtualMemory(); #if defined(__i386__) || defined(__x86_64__) test_stack_commit(); #endif
1
0
0
0
Jinoh Kang : ntdll: Implement NtSetInformationVirtualMemory (intra-process case).
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 9d9075ce5d485a8e450c7781e221a03c7767d3d6 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9d9075ce5d485a8e450c7781e221a0…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Nov 26 13:11:50 2021 +0900 ntdll: Implement NtSetInformationVirtualMemory (intra-process case). Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/ntdll/ntdll.spec | 2 ++ dlls/ntdll/unix/loader.c | 1 + dlls/ntdll/unix/virtual.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/wow64/struct32.h | 6 +++++ dlls/wow64/syscall.h | 1 + dlls/wow64/virtual.c | 46 ++++++++++++++++++++++++++++++++++++ 6 files changed, 115 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 89b05728951..299d2195800 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -388,6 +388,7 @@ @ stdcall -syscall NtSetInformationProcess(long long ptr long) @ stdcall -syscall NtSetInformationThread(long long ptr long) @ stdcall -syscall NtSetInformationToken(long long ptr long) +@ stdcall -syscall NtSetInformationVirtualMemory(long long ptr ptr ptr long) @ stdcall -syscall NtSetIntervalProfile(long long) @ stdcall -syscall NtSetIoCompletion(ptr long long long long) @ stdcall -syscall NtSetLdtEntries(long int64 long int64) @@ -1416,6 +1417,7 @@ @ stdcall -private -syscall ZwSetInformationProcess(long long ptr long) NtSetInformationProcess @ stdcall -private -syscall ZwSetInformationThread(long long ptr long) NtSetInformationThread @ stdcall -private -syscall ZwSetInformationToken(long long ptr long) NtSetInformationToken +@ stdcall -private -syscall ZwSetInformationVirtualMemory(long long ptr ptr ptr long) NtSetInformationVirtualMemory @ stdcall -private -syscall ZwSetIntervalProfile(long long) NtSetIntervalProfile @ stdcall -private -syscall ZwSetIoCompletion(ptr long long long long) NtSetIoCompletion @ stdcall -private -syscall ZwSetLdtEntries(long int64 long int64) NtSetLdtEntries diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 2fd4acc06b9..f58a716d08c 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -310,6 +310,7 @@ static void * const syscalls[] = NtSetInformationProcess, NtSetInformationThread, NtSetInformationToken, + NtSetInformationVirtualMemory, NtSetIntervalProfile, NtSetIoCompletion, NtSetLdtEntries, diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index a93d5b4174a..96a5e095d16 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4931,6 +4931,65 @@ NTSTATUS WINAPI NtAreMappedFilesTheSame(PVOID addr1, PVOID addr2) } +static NTSTATUS prefetch_memory( HANDLE process, ULONG_PTR count, + PMEMORY_RANGE_ENTRY addresses, ULONG flags ) +{ + ULONG_PTR i; + PVOID base; + SIZE_T size; + static unsigned int once; + + if (!once++) + { + FIXME( "(process=%p,flags=%u) NtSetInformationVirtualMemory(VmPrefetchInformation) partial stub\n", + process, flags ); + } + + for (i = 0; i < count; i++) + { + if (!addresses[i].NumberOfBytes) return STATUS_INVALID_PARAMETER_4; + } + + if (process != NtCurrentProcess()) return STATUS_SUCCESS; + + for (i = 0; i < count; i++) + { + base = ROUND_ADDR( addresses[i].VirtualAddress, page_mask ); + size = ROUND_SIZE( addresses[i].VirtualAddress, addresses[i].NumberOfBytes ); + madvise( base, size, MADV_WILLNEED ); + } + + return STATUS_SUCCESS; +} + +/*********************************************************************** + * NtSetInformationVirtualMemory (NTDLL.@) + * ZwSetInformationVirtualMemory (NTDLL.@) + */ +NTSTATUS WINAPI NtSetInformationVirtualMemory( HANDLE process, + VIRTUAL_MEMORY_INFORMATION_CLASS info_class, + ULONG_PTR count, PMEMORY_RANGE_ENTRY addresses, + PVOID ptr, ULONG size ) +{ + TRACE("(%p, info_class=%d, %lu, %p, %p, %u)\n", + process, info_class, count, addresses, ptr, size); + + switch (info_class) + { + case VmPrefetchInformation: + if (!ptr) return STATUS_INVALID_PARAMETER_5; + if (size != sizeof(ULONG)) return STATUS_INVALID_PARAMETER_6; + if (!count) return STATUS_INVALID_PARAMETER_3; + return prefetch_memory( process, count, addresses, *(ULONG *)ptr ); + + default: + FIXME("(%p,info_class=%d,%lu,%p,%p,%u) Unknown information class\n", + process, info_class, count, addresses, ptr, size); + return STATUS_INVALID_PARAMETER_2; + } +} + + /********************************************************************** * NtFlushInstructionCache (NTDLL.@) */ diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index b096c8d587b..91acc26436f 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -650,6 +650,12 @@ typedef struct ULONG Reserved4; } SYSTEM_EXTENDED_THREAD_INFORMATION32; +typedef struct +{ + ULONG VirtualAddress; + ULONG NumberOfBytes; +} MEMORY_RANGE_ENTRY32; + struct __server_iovec32 { ULONG ptr; diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index bd107ce0ef5..65fbca89f4f 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -211,6 +211,7 @@ SYSCALL_ENTRY( NtSetInformationProcess ) \ SYSCALL_ENTRY( NtSetInformationThread ) \ SYSCALL_ENTRY( NtSetInformationToken ) \ + SYSCALL_ENTRY( NtSetInformationVirtualMemory ) \ SYSCALL_ENTRY( NtSetIntervalProfile ) \ SYSCALL_ENTRY( NtSetIoCompletion ) \ SYSCALL_ENTRY( NtSetLdtEntries ) \ diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index c21464857fa..8b69432829d 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -33,6 +33,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(wow); +static MEMORY_RANGE_ENTRY *memory_range_entry_array_32to64( const MEMORY_RANGE_ENTRY32 *addresses32, + ULONG count ) +{ + MEMORY_RANGE_ENTRY *addresses = Wow64AllocateTemp( sizeof(MEMORY_RANGE_ENTRY) * count ); + ULONG i; + + for (i = 0; i < count; i++) + { + addresses[i].VirtualAddress = ULongToPtr( addresses32[i].VirtualAddress ); + addresses[i].NumberOfBytes = addresses32[i].NumberOfBytes; + } + + return addresses; +} + /********************************************************************** * wow64_NtAllocateVirtualMemory */ @@ -470,6 +485,37 @@ NTSTATUS WINAPI wow64_NtResetWriteWatch( UINT *args ) } +/********************************************************************** + * wow64_NtSetInformationVirtualMemory + */ +NTSTATUS WINAPI wow64_NtSetInformationVirtualMemory( UINT *args ) +{ + HANDLE process = get_handle( &args ); + VIRTUAL_MEMORY_INFORMATION_CLASS info_class = get_ulong( &args ); + ULONG count = get_ulong( &args ); + MEMORY_RANGE_ENTRY32 *addresses32 = get_ptr( &args ); + PVOID ptr = get_ptr( &args ); + ULONG len = get_ulong( &args ); + + MEMORY_RANGE_ENTRY *addresses; + + if (!count) return STATUS_INVALID_PARAMETER_3; + addresses = memory_range_entry_array_32to64( addresses32, count ); + + switch (info_class) + { + case VmPrefetchInformation: + break; + default: + FIXME( "(%p,info_class=%u,%lu,%p,%p,%lu): not implemented\n", + process, info_class, count, addresses32, ptr, len ); + return STATUS_INVALID_PARAMETER_2; + } + + return NtSetInformationVirtualMemory( process, info_class, count, addresses, ptr, len ); +} + + /********************************************************************** * wow64_NtSetLdtEntries */
1
0
0
0
Jinoh Kang : ntdll/tests: Add tests for NtSetInformationVirtualMemory.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 442919efc59b04e4f9274f1c56ed41be5d642615 URL:
https://gitlab.winehq.org/wine/wine/-/commit/442919efc59b04e4f9274f1c56ed41…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Nov 26 02:35:11 2021 +0900 ntdll/tests: Add tests for NtSetInformationVirtualMemory. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/ntdll/tests/virtual.c | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 24c87c46d26..e2b6d0d3fb8 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -41,6 +41,9 @@ static NTSTATUS (WINAPI *pNtAllocateVirtualMemoryEx)(HANDLE, PVOID *, SIZE_T *, MEM_EXTENDED_PARAMETER *, ULONG); static NTSTATUS (WINAPI *pNtMapViewOfSectionEx)(HANDLE, HANDLE, PVOID *, const LARGE_INTEGER *, SIZE_T *, ULONG, ULONG, MEM_EXTENDED_PARAMETER *, ULONG); +static NTSTATUS (WINAPI *pNtSetInformationVirtualMemory)(HANDLE, VIRTUAL_MEMORY_INFORMATION_CLASS, + ULONG_PTR, PMEMORY_RANGE_ENTRY, + PVOID, ULONG); static const BOOL is_win64 = sizeof(void*) != sizeof(int); static BOOL is_wow64; @@ -1434,6 +1437,129 @@ static void test_NtFreeVirtualMemory(void) ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status); } +static void test_prefetch(void) +{ + NTSTATUS status; + MEMORY_RANGE_ENTRY entries[2] = {{ 0 }}; + ULONG reservedarg = 0; + char stackmem[] = "Test stack mem"; + static char testmem[] = "Test memory range data"; + + if (!pNtSetInformationVirtualMemory) + { + skip("no NtSetInformationVirtualMemory in ntdll\n"); + return; + } + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), -1, 1, entries, NULL, 32); + ok( status == STATUS_INVALID_PARAMETER_2, + "NtSetInformationVirtualMemory unexpected status on invalid info class (1): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), -1, 0, NULL, NULL, 0); + ok( status == STATUS_INVALID_PARAMETER_2 || (is_wow64 && status == STATUS_INVALID_PARAMETER_3), + "NtSetInformationVirtualMemory unexpected status on invalid info class (2): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), -1, 1, NULL, NULL, 32); + ok( status == STATUS_INVALID_PARAMETER_2 || (is_wow64 && status == STATUS_ACCESS_VIOLATION), + "NtSetInformationVirtualMemory unexpected status on invalid info class (3): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, NULL, 0 ); + ok( status == STATUS_INVALID_PARAMETER_5 || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on NULL info data (1): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, NULL, NULL, 0 ); + ok( status == STATUS_INVALID_PARAMETER_5 || (is_wow64 && status == STATUS_ACCESS_VIOLATION), + "NtSetInformationVirtualMemory unexpected status on NULL info data (2): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 0, NULL, NULL, 0 ); + ok( status == STATUS_INVALID_PARAMETER_5 || (is_wow64 && status == STATUS_INVALID_PARAMETER_3), + "NtSetInformationVirtualMemory unexpected status on NULL info data (3): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) * 2 ); + ok( status == STATUS_INVALID_PARAMETER_6, + "NtSetInformationVirtualMemory unexpected status on extended info data (1): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 0, NULL, &reservedarg, sizeof(reservedarg) * 2 ); + ok( status == STATUS_INVALID_PARAMETER_6 || (is_wow64 && status == STATUS_INVALID_PARAMETER_3), + "NtSetInformationVirtualMemory unexpected status on extended info data (2): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) / 2 ); + ok( status == STATUS_INVALID_PARAMETER_6, + "NtSetInformationVirtualMemory unexpected status on shrunk info data (1): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 0, NULL, &reservedarg, sizeof(reservedarg) / 2 ); + ok( status == STATUS_INVALID_PARAMETER_6 || (is_wow64 && status == STATUS_INVALID_PARAMETER_3), + "NtSetInformationVirtualMemory unexpected status on shrunk info data (2): %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 0, NULL, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_INVALID_PARAMETER_3, + "NtSetInformationVirtualMemory unexpected status on 0 entries: %08lx\n", status); + + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, NULL, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_ACCESS_VIOLATION, + "NtSetInformationVirtualMemory unexpected status on NULL entries: %08lx\n", status); + + entries[0].VirtualAddress = NULL; + entries[0].NumberOfBytes = 0; + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_INVALID_PARAMETER_4 || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on 1 empty entry: %08lx\n", status); + + entries[0].VirtualAddress = NULL; + entries[0].NumberOfBytes = page_size; + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_SUCCESS || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on 1 NULL address entry: %08lx\n", status); + + entries[0].VirtualAddress = (void *)((ULONG_PTR)testmem & -(ULONG_PTR)page_size); + entries[0].NumberOfBytes = page_size; + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_SUCCESS || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on 1 page-aligned entry: %08lx\n", status); + + entries[0].VirtualAddress = testmem; + entries[0].NumberOfBytes = sizeof(testmem); + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_SUCCESS || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on 1 entry: %08lx\n", status); + + entries[0].VirtualAddress = NULL; + entries[0].NumberOfBytes = page_size; + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 1, entries, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_SUCCESS || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on 1 unmapped entry: %08lx\n", status); + + entries[0].VirtualAddress = (void *)((ULONG_PTR)testmem & -(ULONG_PTR)page_size); + entries[0].NumberOfBytes = page_size; + entries[1].VirtualAddress = (void *)((ULONG_PTR)stackmem & -(ULONG_PTR)page_size); + entries[1].NumberOfBytes = page_size; + status = pNtSetInformationVirtualMemory( NtCurrentProcess(), VmPrefetchInformation, + 2, entries, &reservedarg, sizeof(reservedarg) ); + ok( status == STATUS_SUCCESS || + broken( is_wow64 && status == STATUS_INVALID_PARAMETER_6 ) /* win10 1507 */, + "NtSetInformationVirtualMemory unexpected status on 2 page-aligned entries: %08lx\n", status); +} + START_TEST(virtual) { HMODULE mod; @@ -1463,6 +1589,7 @@ START_TEST(virtual) pRtlGetEnabledExtendedFeatures = (void *)GetProcAddress(mod, "RtlGetEnabledExtendedFeatures"); pNtAllocateVirtualMemoryEx = (void *)GetProcAddress(mod, "NtAllocateVirtualMemoryEx"); pNtMapViewOfSectionEx = (void *)GetProcAddress(mod, "NtMapViewOfSectionEx"); + pNtSetInformationVirtualMemory = (void *)GetProcAddress(mod, "NtSetInformationVirtualMemory"); NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL); trace("system page size %#lx\n", sbi.PageSize); @@ -1475,6 +1602,7 @@ START_TEST(virtual) test_RtlCreateUserStack(); test_NtMapViewOfSection(); test_NtMapViewOfSectionEx(); + test_prefetch(); test_user_shared_data(); test_syscalls(); }
1
0
0
0
Jinoh Kang : include: Add definition for NtSetInformationVirtualMemory.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: fa005a6c90505c603c69fc3e3236a17530808864 URL:
https://gitlab.winehq.org/wine/wine/-/commit/fa005a6c90505c603c69fc3e3236a1…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Nov 26 10:40:30 2021 +0900 include: Add definition for NtSetInformationVirtualMemory. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- include/winternl.h | 14 ++++++++++++++ tools/winapi/win32.api | 1 + 2 files changed, 15 insertions(+) diff --git a/include/winternl.h b/include/winternl.h index 85aac653a21..19354dd7ffb 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1993,6 +1993,19 @@ typedef struct _TIMER_BASIC_INFORMATION BOOLEAN TimerState; } TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION; +typedef enum +{ + VmPrefetchInformation, + VmPagePriorityInformation, + VmCfgCallTargetInformation +} VIRTUAL_MEMORY_INFORMATION_CLASS, *PVIRTUAL_MEMORY_INFORMATION_CLASS; + +typedef struct _MEMORY_RANGE_ENTRY +{ + PVOID VirtualAddress; + SIZE_T NumberOfBytes; +} MEMORY_RANGE_ENTRY, *PMEMORY_RANGE_ENTRY; + /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */ typedef enum @@ -4134,6 +4147,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLAS NTSYSAPI NTSTATUS WINAPI NtSetInformationProcess(HANDLE,PROCESS_INFORMATION_CLASS,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG); +NTSYSAPI NTSTATUS WINAPI NtSetInformationVirtualMemory(HANDLE,VIRTUAL_MEMORY_INFORMATION_CLASS,ULONG_PTR,PMEMORY_RANGE_ENTRY,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetIntervalProfile(ULONG,KPROFILE_SOURCE); NTSYSAPI NTSTATUS WINAPI NtSetIoCompletion(HANDLE,ULONG_PTR,ULONG_PTR,NTSTATUS,SIZE_T); NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,LDT_ENTRY,ULONG,LDT_ENTRY); diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api index 5f3dd85cc93..db3c8e7941e 100644 --- a/tools/winapi/win32.api +++ b/tools/winapi/win32.api @@ -3245,6 +3245,7 @@ TOKEN_TYPE UCHAR UINT ULONG +VIRTUAL_MEMORY_INFORMATION_CLASS WCHAR WORD int
1
0
0
0
Jinoh Kang : include: Move WIN32_MEMORY_RANGE_ENTRY from winnt.h to winbase.h.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 67e4807ba5051eacce6ac9a6685e2527e2fd242f URL:
https://gitlab.winehq.org/wine/wine/-/commit/67e4807ba5051eacce6ac9a6685e25…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Fri Nov 26 02:09:29 2021 +0900 include: Move WIN32_MEMORY_RANGE_ENTRY from winnt.h to winbase.h. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- include/winbase.h | 6 ++++++ include/winnt.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/winbase.h b/include/winbase.h index bf191153ddc..0a8409c10e1 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1760,6 +1760,12 @@ typedef struct _WIN32_FIND_STREAM_DATA { WCHAR cStreamName[MAX_PATH + 36]; } WIN32_FIND_STREAM_DATA,*PWIN32_FIND_STREAM_DATA; +typedef struct _WIN32_MEMORY_RANGE_ENTRY +{ + PVOID VirtualAddress; + SIZE_T NumberOfBytes; +} WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY; + WINBASEAPI BOOL WINAPI ActivateActCtx(HANDLE,ULONG_PTR *); WINADVAPI BOOL WINAPI AddAccessAllowedAce(PACL,DWORD,DWORD,PSID); WINADVAPI BOOL WINAPI AddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID); diff --git a/include/winnt.h b/include/winnt.h index 5de6884e7de..76aee026d84 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -788,12 +788,6 @@ typedef struct DECLSPEC_ALIGN(8) MEM_EXTENDED_PARAMETER { } DUMMYUNIONNAME; } MEM_EXTENDED_PARAMETER, *PMEM_EXTENDED_PARAMETER; -typedef struct _WIN32_MEMORY_RANGE_ENTRY -{ - PVOID VirtualAddress; - SIZE_T NumberOfBytes; -} WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY; - #define PAGE_NOACCESS 0x01 #define PAGE_READONLY 0x02 #define PAGE_READWRITE 0x04
1
0
0
0
Jinoh Kang : ntdll: Set r11 on exit from syscall dispatcher on x64.
by Alexandre Julliard
13 Jul '22
13 Jul '22
Module: wine Branch: master Commit: 5514abce7b60751f695e8eca8a4c3d1f87e3bee5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5514abce7b60751f695e8eca8a4c3d…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Mon Jun 20 20:18:53 2022 +0900 ntdll: Set r11 on exit from syscall dispatcher on x64. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/ntdll/tests/exception.c | 15 +++++++++++++++ dlls/ntdll/unix/signal_x86_64.c | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 753a44c769b..11f2e632ba3 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -4949,6 +4949,8 @@ static void test_syscall_clobbered_regs(void) struct regs { UINT64 rcx; + UINT64 r11; + UINT32 eflags; }; static const BYTE code[] = { @@ -4959,6 +4961,8 @@ static void test_syscall_clobbered_regs(void) 0x48, 0x83, 0xe8, 0x08, /* subq $8,%rax */ 0x48, 0x89, 0x20, /* movq %rsp,0(%rax) */ 0x48, 0x89, 0xc4, /* movq %rax,%rsp */ + 0xfd, /* std */ + 0x45, 0x31, 0xdb, /* xorl %r11d,%r11d */ 0x41, 0x50, /* push %r8 */ 0x53, 0x55, 0x57, 0x56, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, /* push %rbx, %rbp, %rdi, %rsi, %r12, %r13, %r14, %r15 */ @@ -4967,6 +4971,11 @@ static void test_syscall_clobbered_regs(void) /* pop %r15, %r14, %r13, %r12, %rsi, %rdi, %rbp, %rbx */ 0x41, 0x58, /* pop %r8 */ 0x49, 0x89, 0x48, 0x00, /* mov %rcx,(%r8) */ + 0x4d, 0x89, 0x58, 0x08, /* mov %r11,0x8(%r8) */ + 0x9c, /* pushfq */ + 0x59, /* pop %rcx */ + 0xfc, /* cld */ + 0x41, 0x89, 0x48, 0x10, /* mov %ecx,0x10(%r8) */ 0x5c, /* pop %rsp */ 0xc3, /* ret */ }; @@ -4985,6 +4994,7 @@ static void test_syscall_clobbered_regs(void) memset(®s, 0, sizeof(regs)); status = func((HANDLE)0xdeadbeef, NULL, ®s, pNtCancelTimer); ok(status == STATUS_INVALID_HANDLE, "Got unexpected status %#lx.\n", status); + ok(regs.r11 == regs.eflags, "Expected r11 (%#I64x) to equal EFLAGS (%#x).\n", regs.r11, regs.eflags); /* After the syscall instruction rcx contains the address of the instruction next after syscall. */ ok((BYTE *)regs.rcx > (BYTE *)pNtCancelTimer && (BYTE *)regs.rcx < (BYTE *)pNtCancelTimer + 0x20, @@ -4994,28 +5004,33 @@ static void test_syscall_clobbered_regs(void) ok(status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#lx.\n", status); ok((BYTE *)regs.rcx > (BYTE *)pNtCancelTimer && (BYTE *)regs.rcx < (BYTE *)pNtCancelTimer + 0x20, "Got unexpected rcx %s, pNtCancelTimer %p.\n", wine_dbgstr_longlong(regs.rcx), pNtCancelTimer); + ok(regs.r11 == regs.eflags, "Expected r11 (%#I64x) to equal EFLAGS (%#x).\n", regs.r11, regs.eflags); context.ContextFlags = CONTEXT_CONTROL; status = func(GetCurrentThread(), &context, ®s, pNtGetContextThread); ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); ok((BYTE *)regs.rcx > (BYTE *)pNtGetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtGetContextThread + 0x20, "Got unexpected rcx %s, pNtGetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtGetContextThread); + ok(regs.r11 == regs.eflags, "Expected r11 (%#I64x) to equal EFLAGS (%#x).\n", regs.r11, regs.eflags); status = func(GetCurrentThread(), &context, ®s, pNtSetContextThread); ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); ok((BYTE *)regs.rcx > (BYTE *)pNtGetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtGetContextThread + 0x20, "Got unexpected rcx %s, pNtGetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtGetContextThread); + ok((regs.r11 | 0x2) == regs.eflags, "Expected r11 (%#I64x) | 0x2 to equal EFLAGS (%#x).\n", regs.r11, regs.eflags); context.ContextFlags = CONTEXT_INTEGER; status = func(GetCurrentThread(), &context, ®s, pNtGetContextThread); ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); ok((BYTE *)regs.rcx > (BYTE *)pNtGetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtGetContextThread + 0x20, "Got unexpected rcx %s, pNtGetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtGetContextThread); + ok(regs.r11 == regs.eflags, "Expected r11 (%#I64x) to equal EFLAGS (%#x).\n", regs.r11, regs.eflags); status = func(GetCurrentThread(), &context, ®s, pNtSetContextThread); ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); ok((BYTE *)regs.rcx > (BYTE *)pNtSetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtSetContextThread + 0x20, "Got unexpected rcx %s, pNtSetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtSetContextThread); + ok(regs.r11 == regs.eflags, "Expected r11 (%#I64x) to equal EFLAGS (%#x).\n", regs.r11, regs.eflags); } #elif defined(__arm__) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index bb7c9ab712e..9b7a19bce72 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -3408,12 +3408,16 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "movq 0x08(%rcx),%rbx\n\t" "testl $0x3,%edx\n\t" /* CONTEXT_CONTROL | CONTEXT_INTEGER */ "jnz 1f\n\t" + "movq 0x80(%rcx),%r11\n\t" /* frame->eflags */ + "pushq %r11\n\t" + "popfq\n\t" "movq 0x88(%rcx),%rsp\n\t" "movq 0x70(%rcx),%rcx\n\t" /* frame->rip */ "jmpq *%rcx\n\t" "1:\tleaq 0x70(%rcx),%rsp\n\t" "testl $0x2,%edx\n\t" /* CONTEXT_INTEGER */ "jnz 1f\n\t" + "movq 0x10(%rsp),%r11\n\t" /* frame->eflags */ "movq (%rsp),%rcx\n\t" /* frame->rip */ "iretq\n" "1:\tmovq 0x00(%rcx),%rax\n\t"
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
64
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
Results per page:
10
25
50
100
200