Module: wine Branch: master Commit: 82f29bff475b31175919762d27b30f8f4fceef67 URL: https://source.winehq.org/git/wine.git/?a=commit;h=82f29bff475b31175919762d2...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Sep 17 13:44:50 2021 +0200
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
---
dlls/gdi32/dib.c | 8 ++------ dlls/gdi32/gdiobj.c | 2 ++ dlls/gdi32/ntgdi_private.h | 1 + 3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index db517b89745..c5f6a41cb77 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -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 );
diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 917d1c91f01..2a245b4596f 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -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(); diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h index 8e122dec6a0..afdbad24f4a 100644 --- a/dlls/gdi32/ntgdi_private.h +++ b/dlls/gdi32/ntgdi_private.h @@ -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 */