gdi32: Use NtQuerySystemInformation instead of GetSystemInfo.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-17 13:44:50 +02:00 committed by Alexandre Julliard
parent 57460dbb58
commit 82f29bff47
3 changed files with 5 additions and 6 deletions

View File

@ -1531,12 +1531,10 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con
if (section)
{
SYSTEM_INFO SystemInfo;
DWORD mapOffset;
INT mapSize;
GetSystemInfo( &SystemInfo );
mapOffset = offset - (offset % SystemInfo.dwAllocationGranularity);
mapOffset = offset - (offset % system_info.AllocationGranularity);
mapSize = bmp->dib.dsBmih.biSizeImage + (offset - mapOffset);
mapBits = MapViewOfFile( section, FILE_MAP_ALL_ACCESS, 0, mapOffset, mapSize );
if (mapBits) bmp->dib.dsBm.bmBits = (char *)mapBits + (offset - mapOffset);
@ -1741,10 +1739,8 @@ static BOOL DIB_DeleteObject( HGDIOBJ handle )
if (bmp->dib.dshSection)
{
SYSTEM_INFO SystemInfo;
GetSystemInfo( &SystemInfo );
UnmapViewOfFile( (char *)bmp->dib.dsBm.bmBits -
(bmp->dib.dsOffset % SystemInfo.dwAllocationGranularity) );
(bmp->dib.dsOffset % system_info.AllocationGranularity) );
}
else VirtualFree( bmp->dib.dsBm.bmBits, 0, MEM_RELEASE );

View File

@ -43,6 +43,7 @@ static GDI_HANDLE_ENTRY *next_free;
static GDI_HANDLE_ENTRY *next_unused = gdi_shared.Handles + FIRST_GDI_HANDLE;
static LONG debug_count;
HMODULE gdi32_module = 0;
SYSTEM_BASIC_INFORMATION system_info;
static inline HGDIOBJ entry_to_handle( GDI_HANDLE_ENTRY *entry )
{
@ -702,6 +703,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
gdi32_module = inst;
DisableThreadLibraryCalls( inst );
NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL );
set_gdi_shared();
font_init();
init_stock_objects();

View File

@ -648,5 +648,6 @@ extern void CDECL free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN;
void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN;
extern HMODULE gdi32_module DECLSPEC_HIDDEN;
extern SYSTEM_BASIC_INFORMATION system_info DECLSPEC_HIDDEN;
#endif /* __WINE_NTGDI_PRIVATE_H */