mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added patch to implement MemorySectionName class in NtQueryVirtualMemory.
This commit is contained in:
parent
a12dca03ce
commit
06886567bc
@ -0,0 +1,275 @@
|
||||
From d2052ba205d0e1eb31f1806233000b3b9c0df3c3 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Wed, 1 Feb 2017 19:22:56 +0800
|
||||
Subject: ntdll: Implement NtQueryVirtualMemory(MemorySectionName). (v2)
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/info.c | 35 ++++++++++
|
||||
dlls/ntdll/virtual.c | 156 ++++++++++++++++++++++++++++++++++--------
|
||||
dlls/psapi/tests/psapi_main.c | 8 +--
|
||||
3 files changed, 164 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
|
||||
index 6652409eaca..9b8f3079125 100644
|
||||
--- a/dlls/ntdll/tests/info.c
|
||||
+++ b/dlls/ntdll/tests/info.c
|
||||
@@ -1748,6 +1748,8 @@ static void test_queryvirtualmemory(void)
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
char stackbuf[42];
|
||||
HMODULE module;
|
||||
+ char *buffer_name[sizeof(MEMORY_SECTION_NAME) + MAX_PATH * sizeof(WCHAR)];
|
||||
+ MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
|
||||
|
||||
module = GetModuleHandleA( "ntdll.dll" );
|
||||
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
|
||||
@@ -1821,6 +1823,39 @@ static void test_queryvirtualmemory(void)
|
||||
"mbi.Protect is 0x%x\n", mbi.Protect);
|
||||
}
|
||||
else skip( "bss is outside of module\n" ); /* this can happen on Mac OS */
|
||||
+
|
||||
+ trace("Check section name of NTDLL.DLL with invalid size\n");
|
||||
+ module = GetModuleHandleA( "ntdll.dll" );
|
||||
+ memset(msn, 0, sizeof(*msn));
|
||||
+ readcount = 0;
|
||||
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(*msn), &readcount);
|
||||
+ ok( status == STATUS_BUFFER_OVERFLOW, "Expected STATUS_BUFFER_OVERFLOW, got %08x\n", status);
|
||||
+ ok( readcount > 0, "Expected readcount to be > 0\n");
|
||||
+
|
||||
+ trace("Check section name of NTDLL.DLL with invalid size\n");
|
||||
+ module = GetModuleHandleA( "ntdll.dll" );
|
||||
+ memset(msn, 0, sizeof(*msn));
|
||||
+ readcount = 0;
|
||||
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(*msn) - 1, &readcount);
|
||||
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
||||
+ ok( readcount > 0, "Expected readcount to be > 0\n");
|
||||
+
|
||||
+ trace("Check section name of NTDLL.DLL\n");
|
||||
+ module = GetModuleHandleA( "ntdll.dll" );
|
||||
+ memset(msn, 0x55, sizeof(*msn));
|
||||
+ memset(buffer_name, 0x77, sizeof(buffer_name));
|
||||
+ readcount = 0;
|
||||
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(buffer_name), &readcount);
|
||||
+ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
||||
+ ok( readcount > 0, "Expected readcount to be > 0\n");
|
||||
+ trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
|
||||
+
|
||||
+ trace("Check section name of non mapped memory\n");
|
||||
+ memset(msn, 0, sizeof(*msn));
|
||||
+ readcount = 0;
|
||||
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), &buffer_name, MemorySectionName, msn, sizeof(buffer_name), &readcount);
|
||||
+ ok( status == STATUS_INVALID_ADDRESS, "Expected STATUS_INVALID_ADDRESS, got %08x\n", status);
|
||||
+ ok( readcount == 0 || broken(readcount != 0) /* wow64 */, "Expected readcount to be 0\n");
|
||||
}
|
||||
|
||||
static void test_affinity(void)
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 105d90984a0..e0fec1ae3ac 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2332,41 +2332,17 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg )
|
||||
return 1;
|
||||
}
|
||||
|
||||
-#define UNIMPLEMENTED_INFO_CLASS(c) \
|
||||
- case c: \
|
||||
- FIXME("(process=%p,addr=%p) Unimplemented information class: " #c "\n", process, addr); \
|
||||
- return STATUS_INVALID_INFO_CLASS
|
||||
-
|
||||
-/***********************************************************************
|
||||
- * NtQueryVirtualMemory (NTDLL.@)
|
||||
- * ZwQueryVirtualMemory (NTDLL.@)
|
||||
- */
|
||||
-NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
|
||||
- MEMORY_INFORMATION_CLASS info_class, PVOID buffer,
|
||||
- SIZE_T len, SIZE_T *res_len )
|
||||
+/* get basic information about a memory block */
|
||||
+static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
|
||||
+ MEMORY_BASIC_INFORMATION *info,
|
||||
+ SIZE_T len, SIZE_T *res_len )
|
||||
{
|
||||
struct file_view *view;
|
||||
char *base, *alloc_base = 0;
|
||||
struct list *ptr;
|
||||
SIZE_T size = 0;
|
||||
- MEMORY_BASIC_INFORMATION *info = buffer;
|
||||
sigset_t sigset;
|
||||
|
||||
- if (info_class != MemoryBasicInformation)
|
||||
- {
|
||||
- switch(info_class)
|
||||
- {
|
||||
- UNIMPLEMENTED_INFO_CLASS(MemoryWorkingSetList);
|
||||
- UNIMPLEMENTED_INFO_CLASS(MemorySectionName);
|
||||
- UNIMPLEMENTED_INFO_CLASS(MemoryBasicVlmInformation);
|
||||
-
|
||||
- default:
|
||||
- FIXME("(%p,%p,info_class=%d,%p,%ld,%p) Unknown information class\n",
|
||||
- process, addr, info_class, buffer, len, res_len);
|
||||
- return STATUS_INVALID_INFO_CLASS;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if (process != NtCurrentProcess())
|
||||
{
|
||||
NTSTATUS status;
|
||||
@@ -2481,6 +2457,130 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+/* get file name for mapped section */
|
||||
+static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
|
||||
+ MEMORY_SECTION_NAME *info,
|
||||
+ SIZE_T len, SIZE_T *res_len )
|
||||
+{
|
||||
+ NTSTATUS status;
|
||||
+ char *base;
|
||||
+ struct file_view *view;
|
||||
+ sigset_t sigset;
|
||||
+
|
||||
+ if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ if (process != NtCurrentProcess())
|
||||
+ {
|
||||
+ FIXME("(%p,%p,%p,%ld,%p): semi-stub\n", process, addr, info, len, res_len);
|
||||
+ goto query_dll_name;
|
||||
+ }
|
||||
+
|
||||
+ status = STATUS_INVALID_ADDRESS;
|
||||
+
|
||||
+ base = ROUND_ADDR( addr, page_mask );
|
||||
+
|
||||
+ server_enter_uninterrupted_section( &csVirtual, &sigset );
|
||||
+ if ((view = VIRTUAL_FindView( base, 0 )))
|
||||
+ {
|
||||
+ if (view->mapping)
|
||||
+ {
|
||||
+ ANSI_STRING unix_filename;
|
||||
+ UNICODE_STRING nt_name;
|
||||
+
|
||||
+ status = server_get_unix_name( view->mapping, &unix_filename );
|
||||
+ if (status)
|
||||
+ {
|
||||
+ status = STATUS_FILE_INVALID;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ status = wine_unix_to_nt_file_name( &unix_filename, &nt_name );
|
||||
+ RtlFreeAnsiString( &unix_filename );
|
||||
+ if (status == STATUS_SUCCESS)
|
||||
+ {
|
||||
+ *res_len = sizeof(MEMORY_SECTION_NAME) + nt_name.MaximumLength;
|
||||
+ if (len >= *res_len)
|
||||
+ {
|
||||
+ info->SectionFileName.Length = nt_name.Length;
|
||||
+ info->SectionFileName.MaximumLength = nt_name.MaximumLength;
|
||||
+ info->SectionFileName.Buffer = (WCHAR *)(info + 1);
|
||||
+ memcpy(info->SectionFileName.Buffer, nt_name.Buffer, nt_name.MaximumLength);
|
||||
+ }
|
||||
+ else
|
||||
+ status = (len < sizeof(MEMORY_SECTION_NAME)) ? STATUS_INFO_LENGTH_MISMATCH : STATUS_BUFFER_OVERFLOW;
|
||||
+
|
||||
+ RtlFreeUnicodeString( &nt_name );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ server_leave_uninterrupted_section( &csVirtual, &sigset );
|
||||
+ if (status != STATUS_INVALID_ADDRESS) return status;
|
||||
+
|
||||
+query_dll_name:
|
||||
+ /* FIXME: this will return a DOS path. Windows returns an NT path. */
|
||||
+ SERVER_START_REQ(get_dll_info)
|
||||
+ {
|
||||
+ req->handle = wine_server_obj_handle( process );
|
||||
+ req->base_address = (ULONG_PTR)addr;
|
||||
+ wine_server_set_reply( req, info + 1,
|
||||
+ len > sizeof(MEMORY_SECTION_NAME) ? len - sizeof(MEMORY_SECTION_NAME) : 0 );
|
||||
+ status = wine_server_call( req );
|
||||
+
|
||||
+ if (status != STATUS_DLL_NOT_FOUND)
|
||||
+ {
|
||||
+ *res_len = sizeof(MEMORY_SECTION_NAME) + reply->filename_len + sizeof(WCHAR);
|
||||
+ if (status == STATUS_SUCCESS && len >= *res_len)
|
||||
+ {
|
||||
+ info->SectionFileName.Length = reply->filename_len;
|
||||
+ info->SectionFileName.MaximumLength = reply->filename_len + sizeof(WCHAR);
|
||||
+ info->SectionFileName.Buffer = (WCHAR *)(info + 1);
|
||||
+ *(WCHAR *)((char *)(info + 1) + reply->filename_len) = 0;
|
||||
+ }
|
||||
+ else if (status == STATUS_BUFFER_TOO_SMALL)
|
||||
+ status = (len < sizeof(MEMORY_SECTION_NAME)) ? STATUS_INFO_LENGTH_MISMATCH : STATUS_BUFFER_OVERFLOW;
|
||||
+ }
|
||||
+ else
|
||||
+ status = STATUS_INVALID_ADDRESS;
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+#define UNIMPLEMENTED_INFO_CLASS(c) \
|
||||
+ case c: \
|
||||
+ FIXME("(process=%p,addr=%p) Unimplemented information class: " #c "\n", process, addr); \
|
||||
+ return STATUS_INVALID_INFO_CLASS
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * NtQueryVirtualMemory (NTDLL.@)
|
||||
+ * ZwQueryVirtualMemory (NTDLL.@)
|
||||
+ */
|
||||
+NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
|
||||
+ MEMORY_INFORMATION_CLASS info_class,
|
||||
+ PVOID buffer, SIZE_T len, SIZE_T *res_len )
|
||||
+{
|
||||
+ TRACE("(%p, %p, info_class=%d, %p, %ld, %p)\n",
|
||||
+ process, addr, info_class, buffer, len, res_len);
|
||||
+
|
||||
+ switch(info_class)
|
||||
+ {
|
||||
+ case MemoryBasicInformation:
|
||||
+ return get_basic_memory_info( process, addr, buffer, len, res_len );
|
||||
+
|
||||
+ case MemorySectionName:
|
||||
+ return get_section_name( process, addr, buffer, len, res_len );
|
||||
+
|
||||
+ UNIMPLEMENTED_INFO_CLASS(MemoryWorkingSetList);
|
||||
+ UNIMPLEMENTED_INFO_CLASS(MemoryBasicVlmInformation);
|
||||
+
|
||||
+ default:
|
||||
+ FIXME("(%p,%p,info_class=%d,%p,%ld,%p) Unknown information class\n",
|
||||
+ process, addr, info_class, buffer, len, res_len);
|
||||
+ return STATUS_INVALID_INFO_CLASS;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
/***********************************************************************
|
||||
* NtLockVirtualMemory (NTDLL.@)
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index 7bc26fe8de9..ebb4e453e61 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -332,14 +332,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);
|
||||
-todo_wine
|
||||
ok(!status, "NtQueryVirtualMemory error %x\n", status);
|
||||
- /* FIXME: remove once Wine is fixed */
|
||||
- if (status)
|
||||
- {
|
||||
- HeapFree(GetProcessHeap(), 0, buf);
|
||||
- return FALSE;
|
||||
- }
|
||||
|
||||
section_name = (MEMORY_SECTION_NAME *)buf;
|
||||
ok(ret_len == section_name->SectionFileName.MaximumLength + sizeof(*section_name), "got %lu, %u\n",
|
||||
@@ -461,6 +454,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);
|
||||
+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);
|
||||
}
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
@ -0,0 +1,215 @@
|
||||
From 2cd035059cfc7c77ca63c3e46fc85dde1a2a7ccc Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Wed, 16 Mar 2016 20:23:28 +0800
|
||||
Subject: kernel32: Implement K32GetMappedFileName. (v2)
|
||||
|
||||
---
|
||||
dlls/kernel32/virtual.c | 67 +++++++++++++++++++++++++++++++++++--------
|
||||
dlls/psapi/tests/psapi_main.c | 21 +++-----------
|
||||
2 files changed, 59 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c
|
||||
index 5733a42bbf5..efdddfafc97 100644
|
||||
--- a/dlls/kernel32/virtual.c
|
||||
+++ b/dlls/kernel32/virtual.c
|
||||
@@ -840,29 +840,72 @@ BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max )
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
- * K32GetMappedFileNameA (KERNEL32.@)
|
||||
+ * K32GetMappedFileNameW (KERNEL32.@)
|
||||
*/
|
||||
-DWORD WINAPI K32GetMappedFileNameA(HANDLE process, LPVOID lpv, LPSTR file_name, DWORD size)
|
||||
+DWORD WINAPI K32GetMappedFileNameW(HANDLE process, LPVOID addr, LPWSTR file_name, DWORD size)
|
||||
{
|
||||
- FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
|
||||
+ MEMORY_SECTION_NAME *name;
|
||||
+ SIZE_T buf_len;
|
||||
+ NTSTATUS status;
|
||||
+
|
||||
+ TRACE_(file)("(%p, %p, %p, %d)\n", process, addr, file_name, size);
|
||||
+
|
||||
+ if (!file_name || !size)
|
||||
+ {
|
||||
+ SetLastError(ERROR_INVALID_PARAMETER);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ buf_len = sizeof(*name) + size * sizeof(WCHAR);
|
||||
+ name = HeapAlloc(GetProcessHeap(), 0, buf_len);
|
||||
+ if (!name)
|
||||
+ {
|
||||
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ status = NtQueryVirtualMemory(process, addr, MemorySectionName, name, buf_len, &buf_len);
|
||||
+ if (status)
|
||||
+ {
|
||||
+ HeapFree(GetProcessHeap(), 0, name);
|
||||
+ SetLastError(RtlNtStatusToDosError(status));
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- if (file_name && size)
|
||||
- file_name[0] = '\0';
|
||||
+ memcpy(file_name, name->SectionFileName.Buffer, name->SectionFileName.MaximumLength);
|
||||
+ buf_len = name->SectionFileName.Length;
|
||||
|
||||
- return 0;
|
||||
+ HeapFree(GetProcessHeap(), 0, name);
|
||||
+
|
||||
+ return buf_len;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
- * K32GetMappedFileNameW (KERNEL32.@)
|
||||
+ * K32GetMappedFileNameA (KERNEL32.@)
|
||||
*/
|
||||
-DWORD WINAPI K32GetMappedFileNameW(HANDLE process, LPVOID lpv, LPWSTR file_name, DWORD size)
|
||||
+DWORD WINAPI K32GetMappedFileNameA(HANDLE process, LPVOID addr, LPSTR file_name, DWORD size)
|
||||
{
|
||||
- FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
|
||||
+ WCHAR file_nameW[MAX_PATH];
|
||||
+ DWORD ret;
|
||||
|
||||
- if (file_name && size)
|
||||
- file_name[0] = '\0';
|
||||
+ TRACE_(file)("(%p, %p, %p, %d)\n", process, addr, file_name, size);
|
||||
|
||||
- return 0;
|
||||
+ if (!file_name || !size)
|
||||
+ {
|
||||
+ SetLastError(ERROR_INVALID_PARAMETER);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ ret = K32GetMappedFileNameW(process, addr, file_nameW, MAX_PATH);
|
||||
+ if (ret)
|
||||
+ {
|
||||
+ ret = FILE_name_WtoA(file_nameW, -1, file_name, size);
|
||||
+ if (ret > 1)
|
||||
+ ret--; /* don't account for terminating NUL */
|
||||
+ else
|
||||
+ file_name[0] = 0;
|
||||
+ }
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
||||
index ebb4e453e61..375bffb9c4a 100644
|
||||
--- a/dlls/psapi/tests/psapi_main.c
|
||||
+++ b/dlls/psapi/tests/psapi_main.c
|
||||
@@ -362,18 +362,15 @@ static void test_GetMappedFileName(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(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));
|
||||
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));
|
||||
-todo_wine
|
||||
ok( ret || broken(GetLastError() == ERROR_UNEXP_NET_ERR), /* win2k */
|
||||
"GetMappedFileNameA failed with error %u\n", GetLastError() );
|
||||
if (ret)
|
||||
@@ -382,7 +379,6 @@ todo_wine
|
||||
todo_wine
|
||||
ok(szMapPath[0] == '\\', "szMapPath=\"%s\"\n", szMapPath);
|
||||
szMapBaseName = strrchr(szMapPath, '\\'); /* That's close enough for us */
|
||||
- todo_wine
|
||||
ok(szMapBaseName && *szMapBaseName, "szMapPath=\"%s\"\n", szMapPath);
|
||||
if (szMapBaseName)
|
||||
{
|
||||
@@ -420,36 +416,31 @@ todo_wine
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(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));
|
||||
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);
|
||||
-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));
|
||||
-todo_wine {
|
||||
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);
|
||||
ret = pGetMappedFileNameW(GetCurrentProcess(), 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");
|
||||
-}
|
||||
+
|
||||
if (nt_get_mapped_file_name(GetCurrentProcess(), 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);
|
||||
@@ -460,16 +451,14 @@ todo_wine
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(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");
|
||||
+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);
|
||||
ret = pGetMappedFileNameA(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);
|
||||
@@ -481,7 +470,6 @@ todo_wine
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(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);
|
||||
@@ -500,7 +488,6 @@ todo_wine
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetMappedFileNameA(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());
|
||||
|
||||
UnmapViewOfFile(base);
|
||||
@@ -549,7 +536,7 @@ static void test_GetProcessImageFileName(void)
|
||||
if(ret && ret1)
|
||||
{
|
||||
/* Windows returns 2*strlen-1 */
|
||||
- todo_wine ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret);
|
||||
+ ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret);
|
||||
todo_wine ok(!strcmp(szImgPath, szMapPath), "szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath);
|
||||
}
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
1
patches/ntdll-NtQueryVirtualMemory/definition
Normal file
1
patches/ntdll-NtQueryVirtualMemory/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [23999] Implement MemorySectionName class in NtQueryVirtualMemory
|
@ -242,6 +242,7 @@ patch_enable_all ()
|
||||
enable_ntdll_NtAllocateUuids="$1"
|
||||
enable_ntdll_NtQueryEaFile="$1"
|
||||
enable_ntdll_NtQuerySection="$1"
|
||||
enable_ntdll_NtQueryVirtualMemory="$1"
|
||||
enable_ntdll_NtSetInformationToken="$1"
|
||||
enable_ntdll_NtSetLdtEntries="$1"
|
||||
enable_ntdll_Pipe_SpecialCharacters="$1"
|
||||
@ -939,6 +940,9 @@ patch_enable ()
|
||||
ntdll-NtQuerySection)
|
||||
enable_ntdll_NtQuerySection="$2"
|
||||
;;
|
||||
ntdll-NtQueryVirtualMemory)
|
||||
enable_ntdll_NtQueryVirtualMemory="$2"
|
||||
;;
|
||||
ntdll-NtSetInformationToken)
|
||||
enable_ntdll_NtSetInformationToken="$2"
|
||||
;;
|
||||
@ -5545,6 +5549,23 @@ if test "$enable_ntdll_NtQuerySection" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-NtQueryVirtualMemory
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#23999] Implement MemorySectionName class in NtQueryVirtualMemory
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/virtual.c, dlls/ntdll/tests/info.c, dlls/ntdll/virtual.c, dlls/psapi/tests/psapi_main.c
|
||||
# |
|
||||
if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then
|
||||
patch_apply ntdll-NtQueryVirtualMemory/0001-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch
|
||||
patch_apply ntdll-NtQueryVirtualMemory/0002-kernel32-Implement-K32GetMappedFileName.-v2.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Implement NtQueryVirtualMemory(MemorySectionName).", 2 },';
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: Implement K32GetMappedFileName.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-NtSetInformationToken
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
Loading…
Reference in New Issue
Block a user