Added patch to implement kernel32.GetPhysicallyInstalledSystemMemory.

This commit is contained in:
Sebastian Lackner 2015-10-18 18:31:24 +02:00
parent 9b1ac08c87
commit 922e5a0e06
5 changed files with 144 additions and 1 deletions

View File

@ -34,13 +34,14 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [8]:**
**Bug fixes and features included in the next upcoming release [9]:**
* Add implementation for IDXGIOutput::GetDesc ([Wine Bug #32006](https://bugs.winehq.org/show_bug.cgi?id=32006))
* Add implementation for comctl32.PROPSHEET_InsertPage. ([Wine Bug #25625](https://bugs.winehq.org/show_bug.cgi?id=25625))
* Always use 64-bit registry view on WOW64 setups
* Do not check if object was signaled after user APC in server_select
* Fix the initialization of combined DACLs when the new DACL is empty ([Wine Bug #38423](https://bugs.winehq.org/show_bug.cgi?id=38423))
* Implement kernel32.GetPhysicallyInstalledSystemMemory ([Wine Bug #39395](https://bugs.winehq.org/show_bug.cgi?id=39395))
* Return WN_NOT_CONNECTED from WNetGetUniversalName REMOTE_NAME_INFO_LEVEL stub ([Wine Bug #39452](https://bugs.winehq.org/show_bug.cgi?id=39452))
* Show windows version when collecting system info in winedbg
* Use wrapper functions for syscalls to appease Chromium sandbox (32-bit) ([Wine Bug #39403](https://bugs.winehq.org/show_bug.cgi?id=39403))

1
debian/changelog vendored
View File

@ -13,6 +13,7 @@ wine-staging (1.7.53) UNRELEASED; urgency=low
* Added patch to return WN_NOT_CONNECTED from WNetGetUniversalName
REMOTE_NAME_INFO_LEVEL stub.
* Added patch to always use 64-bit registry view on WOW64 setups.
* Added patch to implement kernel32.GetPhysicallyInstalledSystemMemory.
* Removed patch to mark RegOpenKeyExA, RegCloseKey and RegQueryValueExA as
hotpatchable (accepted upstream).
* Removed patch to mark BitBlt and StretchDIBits as hotpatchable (accepted

View File

@ -0,0 +1,121 @@
From 89d013aba4d57949ab116b892467503d9f2b9be2 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 18 Oct 2015 18:27:59 +0200
Subject: kernel32: Add stub implementation for
GetPhysicallyInstalledSystemMemory.
---
dlls/kernel32/heap.c | 21 +++++++++++++++++++++
dlls/kernel32/kernel32.spec | 2 +-
dlls/kernel32/tests/heap.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c
index cac73ec..f4be666 100644
--- a/dlls/kernel32/heap.c
+++ b/dlls/kernel32/heap.c
@@ -1449,6 +1449,27 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer )
lpBuffer->dwTotalVirtual, lpBuffer->dwAvailVirtual );
}
+/***********************************************************************
+ * GetPhysicallyInstalledSystemMemory (KERNEL32.@)
+ */
+BOOL WINAPI GetPhysicallyInstalledSystemMemory( ULONGLONG *total_memory )
+{
+ MEMORYSTATUSEX memstatus;
+
+ FIXME("stub: %p\n", total_memory);
+
+ if (!total_memory)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ memstatus.dwLength = sizeof(memstatus);
+ GlobalMemoryStatusEx(&memstatus);
+ *total_memory = memstatus.ullTotalPhys / 1024;
+ return TRUE;
+}
+
BOOL WINAPI GetSystemFileCacheSize(PSIZE_T mincache, PSIZE_T maxcache, PDWORD flags)
{
FIXME("stub: %p %p %p\n", mincache, maxcache, flags);
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index dfc305b..d7eab83 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -759,7 +759,7 @@
@ stdcall GetOEMCP()
@ stdcall GetOverlappedResult(long ptr ptr long)
@ stdcall GetUserPreferredUILanguages(long ptr ptr ptr)
-# @ stub GetPhysicallyInstalledSystemMemory
+@ stdcall GetPhysicallyInstalledSystemMemory(ptr)
@ stdcall GetPriorityClass(long)
@ stdcall GetPrivateProfileIntA(str str long str)
@ stdcall GetPrivateProfileIntW(wstr wstr long wstr)
diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c
index d8768da..b656dc2 100644
--- a/dlls/kernel32/tests/heap.c
+++ b/dlls/kernel32/tests/heap.c
@@ -39,6 +39,7 @@
#define HEAP_VALIDATE_PARAMS 0x40000000
static BOOL (WINAPI *pHeapQueryInformation)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
+static BOOL (WINAPI *pGetPhysicallyInstalledSystemMemory)(ULONGLONG *);
static ULONG (WINAPI *pRtlGetNtGlobalFlags)(void);
struct heap_layout
@@ -1145,6 +1146,38 @@ static void test_child_heap( const char *arg )
test_heap_checks( expect_heap );
}
+static void test_GetPhysicallyInstalledSystemMemory(void)
+{
+ HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
+ MEMORYSTATUSEX memstatus;
+ ULONGLONG total_memory;
+ BOOL ret;
+
+ pGetPhysicallyInstalledSystemMemory = (void *)GetProcAddress(kernel32, "GetPhysicallyInstalledSystemMemory");
+ if (!pGetPhysicallyInstalledSystemMemory)
+ {
+ win_skip("GetPhysicallyInstalledSystemMemory is not available\n");
+ return;
+ }
+
+ SetLastError(0xdeadbeef);
+ ret = pGetPhysicallyInstalledSystemMemory(NULL);
+ ok(!ret, "GetPhysicallyInstalledSystemMemory should fail\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+ total_memory = 0;
+ ret = pGetPhysicallyInstalledSystemMemory(&total_memory);
+ ok(ret, "GetPhysicallyInstalledSystemMemory unexpectedly failed\n");
+ ok(total_memory != 0, "expected total_memory != 0\n");
+
+ memstatus.dwLength = sizeof(memstatus);
+ ret = GlobalMemoryStatusEx(&memstatus);
+ ok(ret, "GlobalMemoryStatusEx unexpectedly failed\n");
+ ok(total_memory >= memstatus.ullTotalPhys / 1024,
+ "expected total_memory >= memstatus.ullTotalPhys / 1024\n");
+}
+
START_TEST(heap)
{
int argc;
@@ -1172,7 +1205,9 @@ START_TEST(heap)
test_sized_HeapReAlloc(1, (1 << 20));
test_sized_HeapReAlloc((1 << 20), (2 << 20));
test_sized_HeapReAlloc((1 << 20), 1);
+
test_HeapQueryInformation();
+ test_GetPhysicallyInstalledSystemMemory();
if (pRtlGetNtGlobalFlags)
{
--
2.6.1

View File

@ -0,0 +1 @@
Fixes: [39395] Implement kernel32.GetPhysicallyInstalledSystemMemory

View File

@ -155,6 +155,7 @@ patch_enable_all ()
enable_kernel32_Cwd_Startup_Info="$1"
enable_kernel32_GetFinalPathNameByHandle="$1"
enable_kernel32_GetLogicalProcessorInformationEx="$1"
enable_kernel32_GetPhysicallyInstalledSystemMemory="$1"
enable_kernel32_LocaleNameToLCID="$1"
enable_kernel32_Named_Pipe="$1"
enable_kernel32_NeedCurrentDirectoryForExePath="$1"
@ -560,6 +561,9 @@ patch_enable ()
kernel32-GetLogicalProcessorInformationEx)
enable_kernel32_GetLogicalProcessorInformationEx="$2"
;;
kernel32-GetPhysicallyInstalledSystemMemory)
enable_kernel32_GetPhysicallyInstalledSystemMemory="$2"
;;
kernel32-LocaleNameToLCID)
enable_kernel32_LocaleNameToLCID="$2"
;;
@ -3443,6 +3447,21 @@ if test "$enable_kernel32_GetLogicalProcessorInformationEx" -eq 1; then
) >> "$patchlist"
fi
# Patchset kernel32-GetPhysicallyInstalledSystemMemory
# |
# | This patchset fixes the following Wine bugs:
# | * [#39395] Implement kernel32.GetPhysicallyInstalledSystemMemory
# |
# | Modified files:
# | * dlls/kernel32/heap.c, dlls/kernel32/kernel32.spec, dlls/kernel32/tests/heap.c
# |
if test "$enable_kernel32_GetPhysicallyInstalledSystemMemory" -eq 1; then
patch_apply kernel32-GetPhysicallyInstalledSystemMemory/0001-kernel32-Add-stub-implementation-for-GetPhysicallyIn.patch
(
echo '+ { "Sebastian Lackner", "kernel32: Add stub implementation for GetPhysicallyInstalledSystemMemory.", 1 },';
) >> "$patchlist"
fi
# Patchset kernel32-LocaleNameToLCID
# |
# | This patchset fixes the following Wine bugs: