Hi list,
I have a Windows program that tries to find out how much memory it has at its disposal using "GlobalMemoryStatus". The machine has 4GB of physical memory and about 100MB of swap. GlobalMemoryStatus returns 2GB of physical memory and 0 available swap.
It seems the problem is at dlls/kernel/heap.c, around lines 1150. First we make sure we never report more than 2GB of total or available memory, and then we make sure that we never report more than 2GB combined available physical+swap memory (which effectively zeros the available swap if there is more than 2GB of available memory). The comment next to this is: /* work around for broken photoshop 4 installer */
While I understand the need for the workaround, this significantly reduces the usefulness of the whole function. My question: Can we make these two rounding conditional on the application not wishing to work with more than 2GB? I.e. - can we let applications that were linked with LARGEADDRESSAWARE see the true state of the machine?
If so, is there a way for me, when at the heap.c code, to know whether that flag was set on loading the current process?
Shachar
"Shachar Shemesh" wine-devel@shemesh.biz wrote:
If so, is there a way for me, when at the heap.c code, to know whether that flag was set on loading the current process?
(copied from dlls/ntdll/loader.c):
PEB *peb = NtCurrentTeb()->Peb; IMAGE_NT_HEADERS *nt = RtlImageNtHeader( peb->ImageBaseAddress );
if (nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) { return full_address_range_of_the_application; } else return 2Gb_of_adderess_space;
or even better reimplement GlobalMemoryStatus via VirtualQuery and leave all system dependent code to ntdll.NtQueryVirtualMemory.