1
0
forked from 0ad/0ad

win_internal: winnt version=0x0501 for HeapSetInformation (to enable LFH)

win.cpp: enable low-fragmentation heap (if available)

This was SVN commit r1888.
This commit is contained in:
janwas 2005-02-02 03:26:38 +00:00
parent 9695f7245b
commit 12232b03d2
2 changed files with 18 additions and 1 deletions

View File

@ -355,6 +355,23 @@ static void at_exit(void)
// be very careful to avoid non-stateless libc functions!
static inline void pre_libc_init()
{
#if WINVER >= 0x0501
// enable low-fragmentation heap
HMODULE hKernel32Dll = LoadLibrary("kernel32.dll");
if(hKernel32Dll)
{
BOOL (WINAPI* pHeapSetInformation)(HANDLE, HEAP_INFORMATION_CLASS, void*, size_t);
*(void**)&pHeapSetInformation = GetProcAddress(hKernel32Dll, "HeapSetInformation");
if(pHeapSetInformation)
{
ULONG flags = 2; // enable LFH
HeapSetInformation(GetProcessHeap(), HeapCompatibilityInformation, &flags, sizeof(flags));
}
FreeLibrary(hKernel32Dll);
}
#endif // #if WINVER >= 0x0501
cs_init();
GetSystemDirectory(win_sys_dir, sizeof(win_sys_dir));

View File

@ -38,7 +38,7 @@
#undef _WINDOWS_
// set version; needed for EnumDisplayDevices
#define _WIN32_WINNT 0x0500
#define _WIN32_WINNT 0x0501