Dirk Niggemann dirk.niggemann@gmail.com writes:
@@ -326,12 +350,33 @@ BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle ) WORD ds = GlobalHandleToSel16( handle ); char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); LOCALHEAPINFO *pInfo = get_local_heap( ds );
- if (!pInfo) return FALSE;
- WORD table, lhandle;
- pLocalEntry->hHandle = pInfo->first + LOCAL_ARENA_HEADER_SIZE;
- pLocalEntry->wAddress = pLocalEntry->hHandle;
- pLocalEntry->wFlags = LF_FIXED;
- pLocalEntry->wcLock = 0;
- if (!pInfo) return FALSE;
- table = pInfo->htable;
- pLocalEntry->wAddress = pInfo->first + LOCAL_ARENA_HEADER_SIZE;
- lhandle = pLocalEntry->wAddress;
- pLocalEntry->wFlags = LF_FIXED;
- pLocalEntry->wcLock = 0;
- /* Find the address in the moveable entry tables */
- while (table)
- {
WORD count = *(WORD *)(ptr + table);
LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY*)(ptr+table+sizeof(WORD));
for (; count > 0; count--, pEntry++)
if (pEntry->addr == lhandle + MOVEABLE_PREFIX)
{
lhandle = (HLOCAL16)((char *)pEntry - ptr);
table = 0;
pLocalEntry->wAddress = pEntry->addr;
pLocalEntry->wFlags = pEntry->flags;
pLocalEntry->wcLock = pEntry->lock;
TRACE("moveable handle %04x\n", lhandle);
break;
}
if ( table ) table = *(WORD *)pEntry;
- }
IIRC the first block is always fixed, you shouldn't need that here.