Rebase against 18ae539c914a9b5a89f63d8cf9c2a21273eccc6c.

This commit is contained in:
Zebediah Figura
2020-07-09 23:17:40 -05:00
parent f6954e6e77
commit 046f6604b7
17 changed files with 189 additions and 426 deletions

View File

@@ -1,4 +1,4 @@
From 30bc9bbd5b1b413c7a574d5e9574f79a03b48d16 Mon Sep 17 00:00:00 2001
From c1b6bc02ee2534dc2b51d8184fb0ca6717c33cf3 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 28 May 2017 05:19:30 +0200
Subject: [PATCH] ntdll: Implement NtQueryVirtualMemory(MemorySectionName).
@@ -8,42 +8,42 @@ Contains several improvements by Sebastian Lackner <sebastian@fds-team.de>.
---
dlls/ntdll/unix/file.c | 2 +-
dlls/ntdll/unix/unix_private.h | 1 +
dlls/ntdll/unix/virtual.c | 91 +++++++++++++++++++++++++++++++++-
dlls/ntdll/unix/virtual.c | 96 +++++++++++++++++++++++++++++++++-
dlls/psapi/tests/psapi_main.c | 8 +--
server/mapping.c | 29 +++++++++++
server/mapping.c | 29 ++++++++++
server/protocol.def | 9 ++++
6 files changed, 131 insertions(+), 9 deletions(-)
6 files changed, 136 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 551d0450584..49e807a5f24 100644
index 6b0dbaa7b3d..2ac7fcaae35 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1767,7 +1767,7 @@ static NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
}
-static NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name )
+NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name )
-static NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name )
+NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name )
{
data_size_t size = 1024;
NTSTATUS ret;
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index e14da3ff7ec..b9a96424b4c 100644
index 711a0bed2b7..466c59da75a 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -173,6 +173,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
@@ -170,6 +170,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
apc_result_t *result ) DECLSPEC_HIDDEN;
extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
+extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
+extern NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name ) DECLSPEC_HIDDEN;
extern void server_init_process(void) DECLSPEC_HIDDEN;
extern size_t server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;
extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index c49c60166c2..086943bdae8 100644
index cd1bd162a2a..570a8a3bf49 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -4011,6 +4011,93 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr,
@@ -4013,6 +4013,98 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr,
return STATUS_SUCCESS;
}
@@ -53,7 +53,8 @@ index c49c60166c2..086943bdae8 100644
+ SIZE_T len, SIZE_T *res_len )
+{
+ UNICODE_STRING nt_name;
+ ANSI_STRING unix_name;
+ WCHAR *nt_nameW;
+ char *unix_name;
+ data_size_t size = 1024;
+ WCHAR *name = NULL;
+ NTSTATUS status;
@@ -76,10 +77,14 @@ index c49c60166c2..086943bdae8 100644
+ NtClose( mapping );
+ if (!status)
+ {
+ status = wine_unix_to_nt_file_name( &unix_name, &nt_name );
+ RtlFreeAnsiString( &unix_name );
+ status = unix_to_nt_file_name( unix_name, &nt_nameW );
+ RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+ }
+ if (!status)
+ {
+ RtlInitUnicodeString( &nt_name, nt_nameW );
+ goto found;
+ }
+ if (!status) goto found;
+ if (status == STATUS_OBJECT_TYPE_MISMATCH) status = STATUS_FILE_INVALID;
+ return status;
+ }
@@ -137,7 +142,7 @@ index c49c60166c2..086943bdae8 100644
#define UNIMPLEMENTED_INFO_CLASS(c) \
case c: \
FIXME("(process=%p,addr=%p) Unimplemented information class: " #c "\n", process, addr); \
@@ -4035,8 +4122,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
@@ -4037,8 +4129,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
case MemoryWorkingSetExInformation:
return get_working_set_ex( process, addr, buffer, len, res_len );
@@ -177,10 +182,10 @@ index da7524dd60a..bfe14231a9b 100644
}
diff --git a/server/mapping.c b/server/mapping.c
index 07c51c246d6..7f19a7572df 100644
index db0debe0af5..6e74f5b770f 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -1095,6 +1095,35 @@ DECL_HANDLER(unmap_view)
@@ -1099,6 +1099,35 @@ DECL_HANDLER(unmap_view)
if (view) free_memory_view( view );
}
@@ -217,10 +222,10 @@ index 07c51c246d6..7f19a7572df 100644
DECL_HANDLER(get_mapping_committed_range)
{
diff --git a/server/protocol.def b/server/protocol.def
index 6416306c0a1..bdc1eeeb5c3 100644
index bd6841d8000..345e0966c14 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1853,6 +1853,15 @@ enum char_info_mode
@@ -1756,6 +1756,15 @@ enum char_info_mode
@END

View File

@@ -1,4 +1,4 @@
From 01031e9eb282bffce2449891e68eb9efeded1ee9 Mon Sep 17 00:00:00 2001
From bb973ee8d79d0a1117c437afe8d62f34b9d9d3c8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 11:17:26 +0200
Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name.
@@ -11,10 +11,10 @@ Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name.
4 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 551d0450584..65ddf0df4a2 100644
index 2ac7fcaae35..d39c98b2e49 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3425,7 +3425,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
@@ -3418,7 +3418,7 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nam
}
/* read the contents of an NT symlink object */
@@ -24,7 +24,7 @@ index 551d0450584..65ddf0df4a2 100644
OBJECT_ATTRIBUTES attr;
UNICODE_STRING targetW;
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index e14da3ff7ec..5410248e8a7 100644
index 466c59da75a..884dff1e1b1 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -103,6 +103,7 @@ extern void CDECL get_initial_directory( UNICODE_STRING *dir ) DECLSPEC_HIDDEN;
@@ -36,7 +36,7 @@ index e14da3ff7ec..5410248e8a7 100644
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 1515963b9c7..5cee0da5d24 100644
index 570a8a3bf49..c040adfaf23 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -188,6 +188,8 @@ static BYTE **pages_vprot;
@@ -48,14 +48,15 @@ index 1515963b9c7..5cee0da5d24 100644
static struct file_view *view_block_start, *view_block_end, *next_free_view;
#ifdef _WIN64
static const size_t view_block_size = 0x200000;
@@ -4016,12 +4018,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
@@ -4018,13 +4020,16 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
MEMORY_SECTION_NAME *info,
SIZE_T len, SIZE_T *res_len )
{
+ static const WCHAR dosprefixW[] = {'\\','?','?','\\'};
+ WCHAR symlinkW[MAX_DIR_ENTRY_LEN] = {0};
UNICODE_STRING nt_name;
ANSI_STRING unix_name;
WCHAR *nt_nameW;
char *unix_name;
data_size_t size = 1024;
- WCHAR *name = NULL;
+ WCHAR *ptr, *name = NULL;
@@ -65,7 +66,7 @@ index 1515963b9c7..5cee0da5d24 100644
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
@@ -4080,14 +4085,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
@@ -4087,14 +4092,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
}
found: