mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -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,
|
D3DFMT_UNKNOWN, 0, FALSE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *GlobalMemoryStatusExType) (LPMEMORYSTATUSEX lpBuffer);
|
||||||
|
|
||||||
static int d3d_format_to_bits_per_pixel (D3DFORMAT d3d_format) {
|
static int d3d_format_to_bits_per_pixel (D3DFORMAT d3d_format) {
|
||||||
int format_index;
|
int format_index;
|
||||||
int bits_per_pixel;
|
int bits_per_pixel;
|
||||||
@ -442,14 +444,28 @@ static int get_display_information (DisplaySearchParameters &display_search_para
|
|||||||
}
|
}
|
||||||
|
|
||||||
// memory
|
// memory
|
||||||
|
bool memory_state;
|
||||||
|
HMODULE kernel32_dll;
|
||||||
|
|
||||||
|
memory_state = false;
|
||||||
|
kernel32_dll = LoadLibrary ("kernel32.dll");
|
||||||
|
if (kernel32_dll) {
|
||||||
|
GlobalMemoryStatusExType GlobalMemoryStatusExFunction;
|
||||||
|
|
||||||
|
GlobalMemoryStatusExFunction = (GlobalMemoryStatusExType) GetProcAddress (kernel32_dll, "GlobalMemoryStatusEx");
|
||||||
|
if (GlobalMemoryStatusExFunction) {
|
||||||
MEMORYSTATUSEX memory_status;
|
MEMORYSTATUSEX memory_status;
|
||||||
|
|
||||||
memory_status.dwLength = sizeof (MEMORYSTATUSEX);
|
memory_status.dwLength = sizeof (MEMORYSTATUSEX);
|
||||||
if (GlobalMemoryStatusEx (&memory_status)) {
|
if (GlobalMemoryStatusExFunction (&memory_status)) {
|
||||||
physical_memory = memory_status.ullTotalPhys;
|
physical_memory = memory_status.ullTotalPhys;
|
||||||
available_physical_memory = memory_status.ullAvailPhys;
|
available_physical_memory = memory_status.ullAvailPhys;
|
||||||
|
memory_state = true;
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
FreeLibrary (kernel32_dll);
|
||||||
|
}
|
||||||
|
if (memory_state == false) {
|
||||||
MEMORYSTATUS memory_status;
|
MEMORYSTATUS memory_status;
|
||||||
|
|
||||||
memory_status.dwLength = sizeof (MEMORYSTATUS);
|
memory_status.dwLength = sizeof (MEMORYSTATUS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user