kernel32: Store global arena base as a pointer.

This commit is contained in:
Alexandre Julliard 2007-05-30 13:23:30 +02:00
parent 7373ced544
commit 63322dbaa5
2 changed files with 10 additions and 10 deletions

View File

@ -49,7 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(global);
/* Global arena block */ /* Global arena block */
typedef struct typedef struct
{ {
DWORD_PTR base; /* Base address (0 if discarded) */ void *base; /* Base address (0 if discarded) */
DWORD size; /* Size in bytes (0 indicates a free block) */ DWORD size; /* Size in bytes (0 indicates a free block) */
HGLOBAL16 handle; /* Handle for this block */ HGLOBAL16 handle; /* Handle for this block */
HGLOBAL16 hOwner; /* Owner of this block */ HGLOBAL16 hOwner; /* Owner of this block */
@ -134,7 +134,7 @@ void debug_handles(void)
* *
* Create a global heap block for a fixed range of linear memory. * Create a global heap block for a fixed range of linear memory.
*/ */
HGLOBAL16 GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size, HGLOBAL16 GLOBAL_CreateBlock( WORD flags, void *ptr, DWORD size,
HGLOBAL16 hOwner, unsigned char selflags ) HGLOBAL16 hOwner, unsigned char selflags )
{ {
WORD sel, selcount; WORD sel, selcount;
@ -154,7 +154,7 @@ HGLOBAL16 GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size,
/* Fill the arena block */ /* Fill the arena block */
pArena->base = (DWORD_PTR)ptr; pArena->base = ptr;
pArena->size = GetSelectorLimit16(sel) + 1; pArena->size = GetSelectorLimit16(sel) + 1;
pArena->handle = (flags & GMEM_MOVEABLE) ? sel - 1 : sel; pArena->handle = (flags & GMEM_MOVEABLE) ? sel - 1 : sel;
pArena->hOwner = hOwner; pArena->hOwner = hOwner;
@ -195,7 +195,7 @@ BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle )
/*********************************************************************** /***********************************************************************
* GLOBAL_MoveBlock * GLOBAL_MoveBlock
*/ */
BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, const void *ptr, DWORD size ) BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, void *ptr, DWORD size )
{ {
WORD sel; WORD sel;
GLOBALARENA *pArena; GLOBALARENA *pArena;
@ -207,7 +207,7 @@ BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, const void *ptr, DWORD size )
if (pArena->selCount != 1) if (pArena->selCount != 1)
return FALSE; return FALSE;
pArena->base = (DWORD)ptr; pArena->base = ptr;
pArena->size = size; pArena->size = size;
SELECTOR_ReallocBlock( sel, ptr, size ); SELECTOR_ReallocBlock( sel, ptr, size );
return TRUE; return TRUE;
@ -428,7 +428,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
As we may have used HEAP_REALLOC_IN_PLACE_ONLY, areas may overlap*/ As we may have used HEAP_REALLOC_IN_PLACE_ONLY, areas may overlap*/
if (pNewArena != pArena) memmove( pNewArena, pArena, sizeof(GLOBALARENA) ); if (pNewArena != pArena) memmove( pNewArena, pArena, sizeof(GLOBALARENA) );
pNewArena->base = (DWORD)ptr; pNewArena->base = ptr;
pNewArena->size = GetSelectorLimit16(sel) + 1; pNewArena->size = GetSelectorLimit16(sel) + 1;
pNewArena->selCount = selcount; pNewArena->selCount = selcount;
pNewArena->handle = (pNewArena->flags & GA_MOVEABLE) ? sel - 1 : sel; pNewArena->handle = (pNewArena->flags & GA_MOVEABLE) ? sel - 1 : sel;
@ -983,7 +983,7 @@ BOOL16 WINAPI GlobalNext16( GLOBALENTRY *pGlobal, WORD wFlags)
pGlobal->dwNext = i; pGlobal->dwNext = i;
} }
pGlobal->dwAddress = pArena->base; pGlobal->dwAddress = (DWORD_PTR)pArena->base;
pGlobal->dwBlockSize = pArena->size; pGlobal->dwBlockSize = pArena->size;
pGlobal->hBlock = pArena->handle; pGlobal->hBlock = pArena->handle;
pGlobal->wcLock = pArena->lockCount; pGlobal->wcLock = pArena->lockCount;
@ -1022,7 +1022,7 @@ BOOL16 WINAPI GlobalEntryHandle16( GLOBALENTRY *pGlobal, HGLOBAL16 hItem )
{ {
GLOBALARENA *pArena = GET_ARENA_PTR(hItem); GLOBALARENA *pArena = GET_ARENA_PTR(hItem);
pGlobal->dwAddress = pArena->base; pGlobal->dwAddress = (DWORD_PTR)pArena->base;
pGlobal->dwBlockSize = pArena->size; pGlobal->dwBlockSize = pArena->size;
pGlobal->hBlock = pArena->handle; pGlobal->hBlock = pArena->handle;
pGlobal->wcLock = pArena->lockCount; pGlobal->wcLock = pArena->lockCount;

View File

@ -103,10 +103,10 @@ BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule,
WORD wSeg ); WORD wSeg );
/* FIXME: Wine internal functions */ /* FIXME: Wine internal functions */
extern HGLOBAL16 GLOBAL_CreateBlock( UINT16 flags, const void *ptr, DWORD size, extern HGLOBAL16 GLOBAL_CreateBlock( UINT16 flags, void *ptr, DWORD size,
HGLOBAL16 hOwner, unsigned char selflags ); HGLOBAL16 hOwner, unsigned char selflags );
extern BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle ); extern BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle );
extern BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, const void *ptr, DWORD size ); extern BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, void *ptr, DWORD size );
extern HGLOBAL16 GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL16 hOwner, unsigned char selflags ); extern HGLOBAL16 GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL16 hOwner, unsigned char selflags );
/* Local heap */ /* Local heap */