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:
parent
9695f7245b
commit
12232b03d2
@ -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));
|
||||
|
@ -38,7 +38,7 @@
|
||||
#undef _WINDOWS_
|
||||
|
||||
// set version; needed for EnumDisplayDevices
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#define _WIN32_WINNT 0x0501
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user