mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Fix Win98 problem.
Call GlobalMemoryStatusEx via LoadLibrary and GetProcAddress.
This commit is contained in:
parent
be067c60dd
commit
5f55dc8e08
@ -38,6 +38,8 @@ static DISPLAY_FORMAT display_format_array [ ] = {
|
||||
D3DFMT_UNKNOWN, 0, FALSE,
|
||||
};
|
||||
|
||||
typedef BOOL (WINAPI *GlobalMemoryStatusExType) (LPMEMORYSTATUSEX lpBuffer);
|
||||
|
||||
static int d3d_format_to_bits_per_pixel (D3DFORMAT d3d_format) {
|
||||
int format_index;
|
||||
int bits_per_pixel;
|
||||
@ -442,14 +444,28 @@ static int get_display_information (DisplaySearchParameters &display_search_para
|
||||
}
|
||||
|
||||
// memory
|
||||
MEMORYSTATUSEX memory_status;
|
||||
bool memory_state;
|
||||
HMODULE kernel32_dll;
|
||||
|
||||
memory_state = false;
|
||||
kernel32_dll = LoadLibrary ("kernel32.dll");
|
||||
if (kernel32_dll) {
|
||||
GlobalMemoryStatusExType GlobalMemoryStatusExFunction;
|
||||
|
||||
memory_status.dwLength = sizeof (MEMORYSTATUSEX);
|
||||
if (GlobalMemoryStatusEx (&memory_status)) {
|
||||
physical_memory = memory_status.ullTotalPhys;
|
||||
available_physical_memory = memory_status.ullAvailPhys;
|
||||
GlobalMemoryStatusExFunction = (GlobalMemoryStatusExType) GetProcAddress (kernel32_dll, "GlobalMemoryStatusEx");
|
||||
if (GlobalMemoryStatusExFunction) {
|
||||
MEMORYSTATUSEX memory_status;
|
||||
|
||||
memory_status.dwLength = sizeof (MEMORYSTATUSEX);
|
||||
if (GlobalMemoryStatusExFunction (&memory_status)) {
|
||||
physical_memory = memory_status.ullTotalPhys;
|
||||
available_physical_memory = memory_status.ullAvailPhys;
|
||||
memory_state = true;
|
||||
}
|
||||
}
|
||||
FreeLibrary (kernel32_dll);
|
||||
}
|
||||
else {
|
||||
if (memory_state == false) {
|
||||
MEMORYSTATUS memory_status;
|
||||
|
||||
memory_status.dwLength = sizeof (MEMORYSTATUS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user