/*********************************************************************** * _hread (KERNEL.349) */ LONG WINAPI WIN16_hread( HFILE16 hFile, SEGPTR buffer, LONG count ) { LONG maxlen; TRACE("%d %08x %d\n", hFile, (DWORD)buffer, count ); /* Some programs pass a count larger than the allocated buffer */ maxlen = GetSelectorLimit16( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1; if (count > maxlen) count = maxlen; return _lread((HFILE)DosFileHandleToWin32Handle(hFile), MapSL(buffer), count ); }
/*********************************************************************** * BITMAP_DeleteObject */ static BOOL BITMAP_DeleteObject( HGDIOBJ handle, void *obj ) { BITMAPOBJ * bmp = obj; if (bmp->funcs && bmp->funcs->pDeleteBitmap) bmp->funcs->pDeleteBitmap( handle ); HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits ); if (bmp->dib) { DIBSECTION *dib = bmp->dib; if (dib->dsBm.bmBits) { if (dib->dshSection) { SYSTEM_INFO SystemInfo; GetSystemInfo( &SystemInfo ); UnmapViewOfFile( (char *)dib->dsBm.bmBits - (dib->dsOffset % SystemInfo.dwAllocationGranularity) ); } else if (!dib->dsOffset) VirtualFree(dib->dsBm.bmBits, 0L, MEM_RELEASE ); } HeapFree(GetProcessHeap(), 0, dib); bmp->dib = NULL; if (bmp->segptr_bits) { /* free its selector array */ WORD sel = SELECTOROF(bmp->segptr_bits); WORD count = (GetSelectorLimit16(sel) / 0x10000) + 1; int i; for (i = 0; i < count; i++) FreeSelector16(sel + (i << __AHSHIFT)); } HeapFree(GetProcessHeap(), 0, bmp->color_table); } return GDI_FreeObject( handle, obj ); }