Rebase against 80205232d3ece73d4cc6c7589cea893583aae0b1.

This commit is contained in:
Zebediah Figura
2018-07-07 01:01:40 +02:00
parent 8ed2ef6f5c
commit 738fd3fd35
5 changed files with 69 additions and 68 deletions

View File

@@ -1,17 +1,18 @@
From 996792332616f1daf63bd0fe539245c96550cdb7 Mon Sep 17 00:00:00 2001
From 25d22ac6fe6c84742dedf45a6b9115b4ba1bbf6c 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)
Subject: [PATCH] ntdll: Allow to query section names from other processes.
(v2)
---
dlls/psapi/tests/psapi_main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index ef5ae19aeaf..ee027480ec5 100644
index b9d8576..af69646 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -368,6 +368,10 @@ static void test_GetMappedFileName(void)
@@ -399,6 +399,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;
@@ -21,13 +22,12 @@ index ef5ae19aeaf..ee027480ec5 100644
+ GetCurrentProcess(), &current_process, 0, 0, DUPLICATE_SAME_ACCESS );
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
@@ -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);
ret = GetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
@@ -500,6 +504,20 @@ todo_wine
}
+ SetLastError(0xdeadbeef);
+ ret = pGetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
SetLastError(0xdeadbeef);
+ ret = GetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
+todo_wine {
+ ok(ret, "GetMappedFileNameW error %d\n", GetLastError());
+ ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -40,10 +40,11 @@ index ef5ae19aeaf..ee027480ec5 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);
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
+ SetLastError(0xdeadbeef);
ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
todo_wine {
@@ -513,6 +531,7 @@ todo_wine
ok(ret, "GetMappedFileName error %d\n", GetLastError());
@@ -544,6 +562,7 @@ todo_wine
todo_wine
ok(GetLastError() == ERROR_FILE_INVALID, "expected ERROR_FILE_INVALID, got %d\n", GetLastError());
@@ -52,5 +53,5 @@ index ef5ae19aeaf..ee027480ec5 100644
CloseHandle(hmap);
}
--
2.14.1
2.7.4

View File

@@ -1,4 +1,4 @@
From a1c5805b5cb85cca744257e8f34dbd88accb025c Mon Sep 17 00:00:00 2001
From b9e418cc3e9cf7808285b2000db6f8163a48eb47 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 16 Mar 2016 20:23:28 +0800
Subject: [PATCH] kernel32: Implement K32GetMappedFileName. (v2)
@@ -98,24 +98,24 @@ index c7a15cd..f2a2c71 100644
/***********************************************************************
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index 065764b..d36c123 100644
index af69646..e92b55b 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -462,27 +462,22 @@ static void test_GetMappedFileName(void)
@@ -407,27 +407,22 @@ static void test_GetMappedFileName(void)
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
ret = GetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(hpSR, hMod, szMapPath, sizeof(szMapPath));
ret = GetMappedFileNameA(hpSR, hMod, szMapPath, sizeof(szMapPath));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError());
SetLastError( 0xdeadbeef );
ret = pGetMappedFileNameA(hpQI, hMod, szMapPath, sizeof(szMapPath));
ret = GetMappedFileNameA(hpQI, hMod, szMapPath, sizeof(szMapPath));
-todo_wine
ok( ret || broken(GetLastError() == ERROR_UNEXP_NET_ERR), /* win2k */
"GetMappedFileNameA failed with error %u\n", GetLastError() );
@@ -129,28 +129,28 @@ index 065764b..d36c123 100644
ok(szMapBaseName && *szMapBaseName, "szMapPath=\"%s\"\n", szMapPath);
if (szMapBaseName)
{
@@ -520,29 +515,25 @@ todo_wine
@@ -465,29 +460,25 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, 0);
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, 0);
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"wrong error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, 0, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base, 0, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, 1);
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, 1);
-todo_wine
ok(ret == 1, "GetMappedFileName error %d\n", GetLastError());
ok(!map_name[0] || broken(map_name[0] == device_name[0]) /* before win2k */, "expected 0, got %c\n", map_name[0]);
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
-todo_wine {
ok(ret, "GetMappedFileName error %d\n", GetLastError());
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -159,11 +159,11 @@ index 065764b..d36c123 100644
-}
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameW(GetCurrentProcess(), base, map_nameW, ARRAY_SIZE(map_nameW));
@@ -560,10 +551,9 @@ todo_wine
ret = GetMappedFileNameW(GetCurrentProcess(), base, map_nameW, ARRAY_SIZE(map_nameW));
@@ -505,10 +496,9 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
ret = GetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0]));
-todo_wine {
ok(ret, "GetMappedFileNameW error %d\n", GetLastError());
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -172,10 +172,10 @@ index 065764b..d36c123 100644
if (nt_get_mapped_file_name(current_process, base, nt_map_name, sizeof(nt_map_name)/sizeof(nt_map_name[0])))
{
ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name);
@@ -574,16 +564,14 @@ todo_wine
@@ -519,16 +509,14 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
-todo_wine {
ok(ret, "GetMappedFileName error %d\n", GetLastError());
ok(ret > strlen(device_name), "map_name should be longer than device_name\n");
@@ -184,29 +184,29 @@ index 065764b..d36c123 100644
-}
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x4000, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x4000, map_name, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_UNEXP_NET_ERR, "expected ERROR_UNEXP_NET_ERR, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
@@ -595,7 +583,6 @@ todo_wine
@@ -540,7 +528,6 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(0, base, map_name, sizeof(map_name));
ret = GetMappedFileNameA(0, base, map_name, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
UnmapViewOfFile(base);
@@ -614,7 +601,6 @@ todo_wine
@@ -559,7 +546,6 @@ todo_wine
SetLastError(0xdeadbeef);
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
ok(!ret, "GetMappedFileName should fail\n");
-todo_wine
ok(GetLastError() == ERROR_FILE_INVALID, "expected ERROR_FILE_INVALID, got %d\n", GetLastError());
CloseHandle(current_process);
@@ -664,7 +650,7 @@ static void test_GetProcessImageFileName(void)
@@ -606,7 +592,7 @@ static void test_GetProcessImageFileName(void)
if(ret && ret1)
{
/* Windows returns 2*strlen-1 */
@@ -216,5 +216,5 @@ index 065764b..d36c123 100644
}
--
1.9.1
2.7.4

View File

@@ -1,4 +1,4 @@
From e850c163a62a5932bff154e8fafd0547c55065eb Mon Sep 17 00:00:00 2001
From e4d3e4ff13314d3b0161ade6f1cae2b7aa5c2f61 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, 35 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index b6e89bb19a..53409014ee 100644
index 664fa7b..902517a 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2929,7 +2929,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
@@ -2928,7 +2928,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
}
/* read the contents of an NT symlink object */
@@ -24,10 +24,10 @@ index b6e89bb19a..53409014ee 100644
OBJECT_ATTRIBUTES attr;
UNICODE_STRING targetW;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index f9c6031778..6e1ca3d72f 100644
index 165f083..d5d91dd 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -169,6 +169,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
@@ -165,6 +165,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
UINT disposition ) DECLSPEC_HIDDEN;
/* virtual memory */
@@ -36,7 +36,7 @@ index f9c6031778..6e1ca3d72f 100644
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG protect,
pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 9912b1a20c..0fd91b4624 100644
index 1cb6428..a7bff45 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -56,6 +56,7 @@
@@ -56,7 +56,7 @@ index 9912b1a20c..0fd91b4624 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;
@@ -2969,12 +2972,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
@@ -2907,12 +2910,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 9912b1a20c..0fd91b4624 100644
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
@@ -3033,14 +3039,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
@@ -2971,14 +2977,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
}
found:
@@ -114,18 +114,18 @@ index 9912b1a20c..0fd91b4624 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 b3e6b3aa28..d917cd561f 100644
index e92b55b..6eb7e23 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -450,7 +450,6 @@ static void test_GetMappedFileName(void)
ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name));
@@ -477,7 +477,6 @@ static void test_GetMappedFileName(void)
ret = GetMappedFileNameA(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");
-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);
SetLastError(0xdeadbeef);
@@ -462,7 +461,6 @@ todo_wine
@@ -490,7 +489,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 b3e6b3aa28..d917cd561f 100644
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
}
@@ -475,7 +473,6 @@ todo_wine
@@ -503,7 +501,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,15 +141,15 @@ index b3e6b3aa28..d917cd561f 100644
ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name);
}
@@ -483,7 +480,6 @@ todo_wine
ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name));
@@ -511,7 +508,6 @@ todo_wine
ret = GetMappedFileNameA(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");
-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);
SetLastError(0xdeadbeef);
@@ -568,7 +564,7 @@ static void test_GetProcessImageFileName(void)
@@ -593,7 +589,7 @@ static void test_GetProcessImageFileName(void)
{
/* Windows returns 2*strlen-1 */
ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret);
@@ -159,5 +159,5 @@ index b3e6b3aa28..d917cd561f 100644
SetLastError(0xdeadbeef);
--
2.16.1
2.7.4