You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Rebase against c91a531957acaf4cf7cdb985b5ba47a273f5f9b2.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From d3932f7ec92691aa77a75840883597a1c652f8c9 Mon Sep 17 00:00:00 2001
|
||||
From d8981a09da0f1c117f6888c0388b8b5c9ca44292 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 28 May 2017 09:04:10 +0200
|
||||
Subject: server: Store full path for ntdll/kernel32 dll.
|
||||
@@ -10,10 +10,10 @@ Subject: server: Store full path for ntdll/kernel32 dll.
|
||||
3 files changed, 37 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index 518a99f5900..76d399a6cc6 100644
|
||||
index 9ba29ac7eac..4cb33f4f33f 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -3309,6 +3309,14 @@ void CDECL __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir )
|
||||
@@ -3931,6 +3931,14 @@ void CDECL __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir )
|
||||
RtlInitUnicodeString( &mod->FullDllName, buffer );
|
||||
RtlInitUnicodeString( &mod->BaseDllName, p );
|
||||
}
|
||||
@@ -29,7 +29,7 @@ index 518a99f5900..76d399a6cc6 100644
|
||||
|
||||
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index 5eabbbef8ef..9204c8954c7 100644
|
||||
index b4657edd650..089e77a38ee 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -49,6 +49,8 @@
|
||||
@@ -41,8 +41,8 @@ index 5eabbbef8ef..9204c8954c7 100644
|
||||
/* process structure */
|
||||
|
||||
static struct list process_list = LIST_INIT(process_list);
|
||||
@@ -1502,6 +1504,27 @@ DECL_HANDLER(load_dll)
|
||||
if (mapping) release_object( mapping );
|
||||
@@ -1625,6 +1627,27 @@ DECL_HANDLER(load_dll)
|
||||
}
|
||||
}
|
||||
|
||||
+/* prepend the system dir to the name of the already created modules */
|
||||
@@ -70,10 +70,10 @@ index 5eabbbef8ef..9204c8954c7 100644
|
||||
DECL_HANDLER(unload_dll)
|
||||
{
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 7eaaec2b823..2f043bef50d 100644
|
||||
index af18bc83031..0bcff7b2b25 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -949,6 +949,12 @@ struct rawinput_device
|
||||
@@ -970,6 +970,12 @@ struct rawinput_device
|
||||
@END
|
||||
|
||||
|
||||
@@ -87,5 +87,5 @@ index 7eaaec2b823..2f043bef50d 100644
|
||||
@REQ(unload_dll)
|
||||
mod_handle_t base; /* base address */
|
||||
--
|
||||
2.12.2
|
||||
2.14.1
|
||||
|
||||
|
@@ -1,53 +1,29 @@
|
||||
From cf7fe40a5d1897b86b655b9bbe3686d77cd3bcd6 Mon Sep 17 00:00:00 2001
|
||||
From 0dd49a3b6d7951374e0bd120535f02377112064c Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Sun, 28 May 2017 05:19:30 +0200
|
||||
Subject: ntdll: Implement NtQueryVirtualMemory(MemorySectionName). (v3)
|
||||
|
||||
Contains several improvements by Sebastian Lackner <sebastian@fds-team.de>.
|
||||
---
|
||||
dlls/ntdll/virtual.c | 109 +++++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/psapi/tests/psapi_main.c | 8 +---
|
||||
2 files changed, 109 insertions(+), 8 deletions(-)
|
||||
dlls/ntdll/virtual.c | 92 ++++++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/psapi/tests/psapi_main.c | 8 +---
|
||||
server/mapping.c | 29 ++++++++++++++
|
||||
server/protocol.def | 9 +++++
|
||||
4 files changed, 130 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 5e92cbb50ea..4ee48ec93ab 100644
|
||||
index 4c927597a9f..164186f274b 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2439,6 +2439,33 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg )
|
||||
@@ -2653,6 +2653,7 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg )
|
||||
return 1;
|
||||
}
|
||||
|
||||
+/* get the section mapping handle */
|
||||
+static NTSTATUS get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapping )
|
||||
+{
|
||||
+ struct file_view *view;
|
||||
+ NTSTATUS status = STATUS_INVALID_ADDRESS;
|
||||
+ sigset_t sigset;
|
||||
+ char *base;
|
||||
+
|
||||
+ if (process != NtCurrentProcess())
|
||||
+ {
|
||||
+ FIXME( "query section mapping from other process not implemented yet\n" );
|
||||
+ return STATUS_NOT_IMPLEMENTED;
|
||||
+ }
|
||||
+
|
||||
+ base = ROUND_ADDR( addr, page_mask );
|
||||
+
|
||||
+ server_enter_uninterrupted_section( &csVirtual, &sigset );
|
||||
+ if ((view = VIRTUAL_FindView( base, 0 )) && view->mapping)
|
||||
+ {
|
||||
+ status = NtDuplicateObject( NtCurrentProcess(), view->mapping, NtCurrentProcess(),
|
||||
+ mapping, 0, 0, DUP_HANDLE_SAME_ACCESS );
|
||||
+ }
|
||||
+ server_leave_uninterrupted_section( &csVirtual, &sigset );
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* get basic information about a memory block */
|
||||
static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
|
||||
MEMORY_BASIC_INFORMATION *info,
|
||||
@@ -2560,6 +2587,84 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
|
||||
@@ -2774,6 +2775,93 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +41,16 @@ index 5e92cbb50ea..4ee48ec93ab 100644
|
||||
+
|
||||
+ if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ if (!(status = get_section_mapping( process, addr, &mapping )))
|
||||
+ SERVER_START_REQ( get_mapping_file )
|
||||
+ {
|
||||
+ req->process = wine_server_obj_handle( process );
|
||||
+ req->addr = wine_server_client_ptr( addr );
|
||||
+ status = wine_server_call( req );
|
||||
+ mapping = wine_server_ptr_handle( reply->handle );
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+
|
||||
+ if (!status && mapping)
|
||||
+ {
|
||||
+ status = server_get_unix_name( mapping, &unix_name );
|
||||
+ close_handle( mapping );
|
||||
@@ -132,7 +117,7 @@ index 5e92cbb50ea..4ee48ec93ab 100644
|
||||
#define UNIMPLEMENTED_INFO_CLASS(c) \
|
||||
case c: \
|
||||
FIXME("(process=%p,addr=%p) Unimplemented information class: " #c "\n", process, addr); \
|
||||
@@ -2581,8 +2686,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
|
||||
@@ -2795,8 +2883,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
|
||||
case MemoryBasicInformation:
|
||||
return get_basic_memory_info( process, addr, buffer, len, res_len );
|
||||
|
||||
@@ -145,10 +130,10 @@ index 5e92cbb50ea..4ee48ec93ab 100644
|
||||
|
||||
default:
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index e35a7b694cb..56bf11a9a85 100644
|
||||
index e7af5bc61cc..ef5ae19aeaf 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -330,14 +330,7 @@ static BOOL nt_get_mapped_file_name(HANDLE process, LPVOID addr, LPWSTR name, DW
|
||||
@@ -342,14 +342,7 @@ static BOOL nt_get_mapped_file_name(HANDLE process, LPVOID addr, LPWSTR name, DW
|
||||
|
||||
ret_len = 0xdeadbeef;
|
||||
status = pNtQueryVirtualMemory(process, addr, MemorySectionName, buf, buf_len, &ret_len);
|
||||
@@ -163,7 +148,7 @@ index e35a7b694cb..56bf11a9a85 100644
|
||||
|
||||
section_name = (MEMORY_SECTION_NAME *)buf;
|
||||
ok(ret_len == section_name->SectionFileName.MaximumLength + sizeof(*section_name), "got %lu, %u\n",
|
||||
@@ -459,6 +452,7 @@ todo_wine {
|
||||
@@ -471,6 +464,7 @@ todo_wine {
|
||||
{
|
||||
ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
WideCharToMultiByte(CP_ACP, 0, map_nameW, -1, map_name, MAX_PATH, NULL, NULL);
|
||||
@@ -171,6 +156,66 @@ index e35a7b694cb..56bf11a9a85 100644
|
||||
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
}
|
||||
|
||||
diff --git a/server/mapping.c b/server/mapping.c
|
||||
index a6d34f91aff..8459c316559 100644
|
||||
--- a/server/mapping.c
|
||||
+++ b/server/mapping.c
|
||||
@@ -1011,6 +1011,35 @@ DECL_HANDLER(unmap_view)
|
||||
if (view) free_memory_view( view );
|
||||
}
|
||||
|
||||
+/* get file handle from mapping by address */
|
||||
+DECL_HANDLER(get_mapping_file)
|
||||
+{
|
||||
+ struct memory_view *view;
|
||||
+ struct process *process;
|
||||
+ struct file *file;
|
||||
+
|
||||
+ if (!(process = get_process_from_handle( req->process, 0 ))) return;
|
||||
+
|
||||
+ LIST_FOR_EACH_ENTRY( view, &process->views, struct memory_view, entry )
|
||||
+ if (req->addr >= view->base && req->addr < view->base + view->size) break;
|
||||
+
|
||||
+ if (&view->entry == &process->views)
|
||||
+ {
|
||||
+ set_error( STATUS_NOT_MAPPED_VIEW );
|
||||
+ release_object( process );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (view->fd && (file = create_file_for_fd_obj( view->fd, GENERIC_READ,
|
||||
+ FILE_SHARE_READ | FILE_SHARE_WRITE )))
|
||||
+ {
|
||||
+ reply->handle = alloc_handle( process, file, GENERIC_READ, 0 );
|
||||
+ release_object( file );
|
||||
+ }
|
||||
+
|
||||
+ release_object( process );
|
||||
+}
|
||||
+
|
||||
/* get a range of committed pages in a file mapping */
|
||||
DECL_HANDLER(get_mapping_committed_range)
|
||||
{
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 0bcff7b2b25..f248b3bdec7 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -1782,6 +1782,15 @@ enum char_info_mode
|
||||
@END
|
||||
|
||||
|
||||
+/* Get file for a mapping */
|
||||
+@REQ(get_mapping_file)
|
||||
+ obj_handle_t process; /* process handle */
|
||||
+ client_ptr_t addr; /* arbitrary address in view */
|
||||
+@REPLY
|
||||
+ obj_handle_t handle; /* handle to file */
|
||||
+@END
|
||||
+
|
||||
+
|
||||
/* Get a range of committed pages in a file mapping */
|
||||
@REQ(get_mapping_committed_range)
|
||||
client_ptr_t base; /* view base address */
|
||||
--
|
||||
2.14.1
|
||||
|
||||
|
@@ -1,101 +1,17 @@
|
||||
From b808bca5ed050a801ae03493788e8c8ec8e3cd38 Mon Sep 17 00:00:00 2001
|
||||
From 996792332616f1daf63bd0fe539245c96550cdb7 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 28 May 2017 05:44:38 +0200
|
||||
Subject: ntdll: Allow to query section names from other processes. (v2)
|
||||
|
||||
---
|
||||
dlls/ntdll/ntdll_misc.h | 1 +
|
||||
dlls/ntdll/server.c | 13 +++++++++++++
|
||||
dlls/ntdll/virtual.c | 18 ++++++++++++++----
|
||||
dlls/psapi/tests/psapi_main.c | 19 +++++++++++++++++++
|
||||
server/protocol.def | 13 +++++++++++++
|
||||
server/thread.c | 9 +++++++++
|
||||
6 files changed, 69 insertions(+), 4 deletions(-)
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index ac81c9be9c8..ecee4a193d9 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -161,6 +161,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
|
||||
UINT disposition ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* virtual memory */
|
||||
+extern NTSTATUS virtual_get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapping ) DECLSPEC_HIDDEN;
|
||||
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_create_builtin_view( void *base ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commit_size ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
|
||||
index c02a12ab19a..290d7582f65 100644
|
||||
--- a/dlls/ntdll/server.c
|
||||
+++ b/dlls/ntdll/server.c
|
||||
@@ -464,6 +464,19 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
|
||||
}
|
||||
break;
|
||||
}
|
||||
+ case APC_VIRTUAL_SECTION:
|
||||
+ {
|
||||
+ HANDLE mapping;
|
||||
+ result->type = call->type;
|
||||
+ addr = wine_server_get_ptr( call->virtual_section.addr );
|
||||
+ if ((ULONG_PTR)addr == call->virtual_section.addr)
|
||||
+ {
|
||||
+ result->virtual_section.status = virtual_get_section_mapping( NtCurrentProcess(), addr, &mapping );
|
||||
+ result->virtual_section.mapping = wine_server_obj_handle( mapping );
|
||||
+ }
|
||||
+ else result->virtual_section.status = STATUS_WORKING_SET_LIMIT_RANGE;
|
||||
+ break;
|
||||
+ }
|
||||
case APC_VIRTUAL_PROTECT:
|
||||
result->type = call->type;
|
||||
addr = wine_server_get_ptr( call->virtual_protect.addr );
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 4ee48ec93ab..613caec6642 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2440,7 +2440,7 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg )
|
||||
}
|
||||
|
||||
/* get the section mapping handle */
|
||||
-static NTSTATUS get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapping )
|
||||
+NTSTATUS virtual_get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapping )
|
||||
{
|
||||
struct file_view *view;
|
||||
NTSTATUS status = STATUS_INVALID_ADDRESS;
|
||||
@@ -2449,8 +2449,18 @@ static NTSTATUS get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mappi
|
||||
|
||||
if (process != NtCurrentProcess())
|
||||
{
|
||||
- FIXME( "query section mapping from other process not implemented yet\n" );
|
||||
- return STATUS_NOT_IMPLEMENTED;
|
||||
+ apc_call_t call;
|
||||
+ apc_result_t result;
|
||||
+
|
||||
+ memset( &call, 0, sizeof(call) );
|
||||
+
|
||||
+ call.virtual_section.type = APC_VIRTUAL_SECTION;
|
||||
+ call.virtual_section.addr = wine_server_client_ptr( addr );
|
||||
+ status = server_queue_process_apc( process, &call, &result );
|
||||
+ if (status != STATUS_SUCCESS) return status;
|
||||
+
|
||||
+ *mapping = wine_server_ptr_handle( result.virtual_section.mapping );
|
||||
+ return result.virtual_section.status;
|
||||
}
|
||||
|
||||
base = ROUND_ADDR( addr, page_mask );
|
||||
@@ -2601,7 +2611,7 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
|
||||
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
- if (!(status = get_section_mapping( process, addr, &mapping )))
|
||||
+ if (!(status = virtual_get_section_mapping( process, addr, &mapping )))
|
||||
{
|
||||
status = server_get_unix_name( mapping, &unix_name );
|
||||
close_handle( mapping );
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index 56bf11a9a85..23025eedab3 100644
|
||||
index ef5ae19aeaf..ee027480ec5 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -356,6 +356,10 @@ static void test_GetMappedFileName(void)
|
||||
@@ -368,6 +368,10 @@ static void test_GetMappedFileName(void)
|
||||
char temp_path[MAX_PATH], file_name[MAX_PATH], map_name[MAX_PATH], device_name[MAX_PATH], drive[3];
|
||||
WCHAR map_nameW[MAX_PATH], nt_map_name[MAX_PATH];
|
||||
HANDLE hfile, hmap;
|
||||
@@ -106,7 +22,7 @@ index 56bf11a9a85..23025eedab3 100644
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
|
||||
@@ -456,6 +460,20 @@ todo_wine
|
||||
@@ -468,6 +472,20 @@ todo_wine
|
||||
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
}
|
||||
|
||||
@@ -127,7 +43,7 @@ index 56bf11a9a85..23025eedab3 100644
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
|
||||
todo_wine {
|
||||
@@ -501,6 +519,7 @@ todo_wine
|
||||
@@ -513,6 +531,7 @@ todo_wine
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_FILE_INVALID, "expected ERROR_FILE_INVALID, got %d\n", GetLastError());
|
||||
|
||||
@@ -135,71 +51,6 @@ index 56bf11a9a85..23025eedab3 100644
|
||||
UnmapViewOfFile(base);
|
||||
CloseHandle(hmap);
|
||||
}
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index ca54b448ebb..504362702b8 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -448,6 +448,7 @@ enum apc_type
|
||||
APC_VIRTUAL_ALLOC,
|
||||
APC_VIRTUAL_FREE,
|
||||
APC_VIRTUAL_QUERY,
|
||||
+ APC_VIRTUAL_SECTION,
|
||||
APC_VIRTUAL_PROTECT,
|
||||
APC_VIRTUAL_FLUSH,
|
||||
APC_VIRTUAL_LOCK,
|
||||
@@ -505,6 +506,12 @@ typedef union
|
||||
client_ptr_t addr; /* requested address */
|
||||
} virtual_query;
|
||||
struct
|
||||
+ {
|
||||
+ enum apc_type type; /* APC_VIRTUAL_SECTION */
|
||||
+ int __pad;
|
||||
+ client_ptr_t addr; /* requested address */
|
||||
+ } virtual_section;
|
||||
+ struct
|
||||
{
|
||||
enum apc_type type; /* APC_VIRTUAL_PROTECT */
|
||||
unsigned int prot; /* new protection flags */
|
||||
@@ -596,6 +603,12 @@ typedef union
|
||||
unsigned short alloc_type;/* resulting region allocation type */
|
||||
} virtual_query;
|
||||
struct
|
||||
+ {
|
||||
+ enum apc_type type; /* APC_VIRTUAL_SECTION */
|
||||
+ unsigned int status; /* status returned by call */
|
||||
+ obj_handle_t mapping; /* resulting mapping */
|
||||
+ } virtual_section;
|
||||
+ struct
|
||||
{
|
||||
enum apc_type type; /* APC_VIRTUAL_PROTECT */
|
||||
unsigned int status; /* status returned by call */
|
||||
diff --git a/server/thread.c b/server/thread.c
|
||||
index 903420bed3f..d3cbcc298c3 100644
|
||||
--- a/server/thread.c
|
||||
+++ b/server/thread.c
|
||||
@@ -1484,6 +1484,14 @@ DECL_HANDLER(select)
|
||||
apc->result.create_thread.handle = handle;
|
||||
clear_error(); /* ignore errors from the above calls */
|
||||
}
|
||||
+ else if (apc->result.type == APC_VIRTUAL_SECTION) /* duplicate the handle to the caller process */
|
||||
+ {
|
||||
+ obj_handle_t mapping = duplicate_handle( current->process, apc->result.virtual_section.mapping,
|
||||
+ apc->caller->process, 0, 0, DUP_HANDLE_SAME_ACCESS );
|
||||
+ close_handle( current->process, apc->result.virtual_section.mapping );
|
||||
+ apc->result.virtual_section.mapping = mapping;
|
||||
+ clear_error(); /* ignore errors from the above calls */
|
||||
+ }
|
||||
else if (apc->result.type == APC_ASYNC_IO)
|
||||
{
|
||||
if (apc->owner)
|
||||
@@ -1544,6 +1552,7 @@ DECL_HANDLER(queue_apc)
|
||||
process = get_process_from_handle( req->handle, PROCESS_VM_OPERATION );
|
||||
break;
|
||||
case APC_VIRTUAL_QUERY:
|
||||
+ case APC_VIRTUAL_SECTION:
|
||||
process = get_process_from_handle( req->handle, PROCESS_QUERY_INFORMATION );
|
||||
break;
|
||||
case APC_MAP_VIEW:
|
||||
--
|
||||
2.14.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 9a69e1e68004fb9b430151c629855ea7df2b0a8c Mon Sep 17 00:00:00 2001
|
||||
From 66e9d350993b7349f2309edd72945e01b6233d1c Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 28 May 2017 11:17:26 +0200
|
||||
Subject: ntdll: Resolve drive symlinks before returning section name.
|
||||
@@ -11,10 +11,10 @@ Subject: ntdll: Resolve drive symlinks before returning section name.
|
||||
4 files changed, 35 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
|
||||
index 97b42398bb0..c0b2a1ea83e 100644
|
||||
index 2fb30febd63..8f50a81610b 100644
|
||||
--- a/dlls/ntdll/directory.c
|
||||
+++ b/dlls/ntdll/directory.c
|
||||
@@ -2932,7 +2932,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
|
||||
@@ -2927,7 +2927,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
|
||||
}
|
||||
|
||||
/* read the contents of an NT symlink object */
|
||||
@@ -24,22 +24,22 @@ index 97b42398bb0..c0b2a1ea83e 100644
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING targetW;
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index ecee4a193d9..e8586486a58 100644
|
||||
index 823024215e0..a61638cdc06 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -161,6 +161,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
|
||||
@@ -169,6 +169,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
|
||||
UINT disposition ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* virtual memory */
|
||||
+extern NTSTATUS read_nt_symlink( HANDLE root, UNICODE_STRING *name, WCHAR *target, size_t length ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapping ) DECLSPEC_HIDDEN;
|
||||
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_create_builtin_view( void *base ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commit_size ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 613caec6642..467ce54eaaa 100644
|
||||
index 164186f274b..85a7f4dc059 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -53,6 +53,7 @@
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "wine/library.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/exception.h"
|
||||
@@ -47,7 +47,7 @@ index 613caec6642..467ce54eaaa 100644
|
||||
#include "wine/rbtree.h"
|
||||
#include "wine/debug.h"
|
||||
#include "ntdll_misc.h"
|
||||
@@ -152,6 +153,8 @@ static BYTE **pages_vprot;
|
||||
@@ -163,6 +164,8 @@ static BYTE **pages_vprot;
|
||||
static BYTE *pages_vprot;
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,7 @@ index 613caec6642..467ce54eaaa 100644
|
||||
static struct file_view *view_block_start, *view_block_end, *next_free_view;
|
||||
static const size_t view_block_size = 0x100000;
|
||||
static void *preload_reserve_start;
|
||||
@@ -2602,12 +2605,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
@@ -2780,12 +2783,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
MEMORY_SECTION_NAME *info,
|
||||
SIZE_T len, SIZE_T *res_len )
|
||||
{
|
||||
@@ -73,7 +73,7 @@ index 613caec6642..467ce54eaaa 100644
|
||||
|
||||
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
@@ -2657,14 +2663,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
@@ -2844,14 +2850,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
}
|
||||
|
||||
found:
|
||||
@@ -114,10 +114,10 @@ index 613caec6642..467ce54eaaa 100644
|
||||
else
|
||||
status = (len < sizeof(MEMORY_SECTION_NAME)) ? STATUS_INFO_LENGTH_MISMATCH : STATUS_BUFFER_OVERFLOW;
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index 0751bb24fb8..dd592a9ab21 100644
|
||||
index 6014d6fc152..8704123642e 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -434,7 +434,6 @@ static void test_GetMappedFileName(void)
|
||||
@@ -446,7 +446,6 @@ static void test_GetMappedFileName(void)
|
||||
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
|
||||
ok(ret, "GetMappedFileName error %d\n", GetLastError());
|
||||
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
|
||||
@@ -125,7 +125,7 @@ index 0751bb24fb8..dd592a9ab21 100644
|
||||
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -446,7 +445,6 @@ todo_wine
|
||||
@@ -458,7 +457,6 @@ todo_wine
|
||||
{
|
||||
ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
WideCharToMultiByte(CP_ACP, 0, map_nameW, -1, map_name, MAX_PATH, NULL, NULL);
|
||||
@@ -133,7 +133,7 @@ index 0751bb24fb8..dd592a9ab21 100644
|
||||
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
}
|
||||
|
||||
@@ -459,7 +457,6 @@ todo_wine
|
||||
@@ -471,7 +469,6 @@ todo_wine
|
||||
{
|
||||
ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
WideCharToMultiByte(CP_ACP, 0, map_nameW, -1, map_name, MAX_PATH, NULL, NULL);
|
||||
@@ -141,7 +141,7 @@ index 0751bb24fb8..dd592a9ab21 100644
|
||||
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
}
|
||||
|
||||
@@ -467,7 +464,6 @@ todo_wine
|
||||
@@ -479,7 +476,6 @@ todo_wine
|
||||
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
|
||||
ok(ret, "GetMappedFileName error %d\n", GetLastError());
|
||||
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
|
||||
@@ -149,7 +149,7 @@ index 0751bb24fb8..dd592a9ab21 100644
|
||||
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -552,7 +548,7 @@ static void test_GetProcessImageFileName(void)
|
||||
@@ -564,7 +560,7 @@ static void test_GetProcessImageFileName(void)
|
||||
{
|
||||
/* Windows returns 2*strlen-1 */
|
||||
ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret);
|
||||
|
@@ -1,55 +0,0 @@
|
||||
From 9b91067e59331f33825d0a5bc3e1f86f67714830 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 28 May 2017 16:14:03 +0200
|
||||
Subject: ntdll: Skip get_dll_info wineserver call if address does not have
|
||||
SEC_IMAGE permissions.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
As suggested by Michael Müller.
|
||||
---
|
||||
dlls/ntdll/virtual.c | 19 +++++++++++++++----
|
||||
1 file changed, 15 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index a5c3ce69185..0d5150aaf93 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2271,10 +2271,18 @@ NTSTATUS virtual_get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapp
|
||||
base = ROUND_ADDR( addr, page_mask );
|
||||
|
||||
server_enter_uninterrupted_section( &csVirtual, &sigset );
|
||||
- if ((view = VIRTUAL_FindView( base, 0 )) && view->mapping)
|
||||
+ if ((view = VIRTUAL_FindView( base, 0 )))
|
||||
{
|
||||
- status = NtDuplicateObject( NtCurrentProcess(), view->mapping, NtCurrentProcess(),
|
||||
- mapping, 0, 0, DUP_HANDLE_SAME_ACCESS );
|
||||
+ if (view->mapping)
|
||||
+ {
|
||||
+ status = NtDuplicateObject( NtCurrentProcess(), view->mapping, NtCurrentProcess(),
|
||||
+ mapping, 0, 0, DUP_HANDLE_SAME_ACCESS );
|
||||
+ }
|
||||
+ else if (view->protect & SEC_IMAGE)
|
||||
+ {
|
||||
+ *mapping = NULL;
|
||||
+ status = STATUS_SUCCESS;
|
||||
+ }
|
||||
}
|
||||
server_leave_uninterrupted_section( &csVirtual, &sigset );
|
||||
return status;
|
||||
@@ -2424,7 +2432,10 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
|
||||
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
- if (!(status = virtual_get_section_mapping( process, addr, &mapping )))
|
||||
+ if ((status = virtual_get_section_mapping( process, addr, &mapping )))
|
||||
+ return status;
|
||||
+
|
||||
+ if (mapping)
|
||||
{
|
||||
status = server_get_unix_name( mapping, &unix_name );
|
||||
close_handle( mapping );
|
||||
--
|
||||
2.12.2
|
||||
|
Reference in New Issue
Block a user