Replaced GLOBAL_Alloc by GlobalAlloc16 where possible.

This commit is contained in:
Alexandre Julliard 2001-01-15 20:13:43 +00:00
parent a41b2cfdd0
commit 4f2df51f7a
4 changed files with 18 additions and 15 deletions

View File

@ -17,7 +17,6 @@
#include "module.h"
#include "miscemu.h"
#include "stackframe.h"
#include "task.h"
#include "debugtools.h"
#include "toolhelp.h"
@ -85,8 +84,9 @@ static HMODULE16 BUILTIN_DoLoadModule16( const BUILTIN16_DESCRIPTOR *descr )
minsize = pSegTable->minsize ? pSegTable->minsize : 0x10000;
minsize += pModule->heap_size;
if (minsize > 0x10000) minsize = 0x10000;
pSegTable->hSeg = GLOBAL_Alloc( GMEM_FIXED, minsize, hModule, WINE_LDT_FLAGS_DATA );
pSegTable->hSeg = GlobalAlloc16( GMEM_FIXED, minsize );
if (!pSegTable->hSeg) return 0;
FarSetOwner16( pSegTable->hSeg, hModule );
if (pSegTable->minsize) memcpy( GlobalLock16( pSegTable->hSeg ),
descr->data_start, pSegTable->minsize);
if (pModule->heap_size)

View File

@ -19,7 +19,6 @@
#include "file.h"
#include "heap.h"
#include "task.h"
#include "global.h"
#include "snoop.h"
#include "builtin16.h"
#include "stackframe.h"
@ -710,13 +709,13 @@ static HMODULE16 NE_LoadExeHeader( HANDLE hFile, LPCSTR path )
if (ne_header.ne_cbnrestab)
{
pModule->nrname_handle = GLOBAL_Alloc( 0, ne_header.ne_cbnrestab,
hModule, WINE_LDT_FLAGS_DATA );
pModule->nrname_handle = GlobalAlloc16( 0, ne_header.ne_cbnrestab );
if (!pModule->nrname_handle)
{
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
FarSetOwner16( pModule->nrname_handle, hModule );
buffer = GlobalLock16( pModule->nrname_handle );
_llseek( hFile, ne_header.ne_nrestab, SEEK_SET );
if (_lread( hFile, buffer, ne_header.ne_cbnrestab )
@ -733,15 +732,15 @@ static HMODULE16 NE_LoadExeHeader( HANDLE hFile, LPCSTR path )
if (pModule->modref_count)
{
pModule->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT,
(pModule->modref_count+1)*sizeof(HMODULE16),
hModule, WINE_LDT_FLAGS_DATA );
pModule->dlls_to_init = GlobalAlloc16( GMEM_ZEROINIT,
(pModule->modref_count+1)*sizeof(HMODULE16) );
if (!pModule->dlls_to_init)
{
if (pModule->nrname_handle) GlobalFree16( pModule->nrname_handle );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
FarSetOwner16( pModule->dlls_to_init, hModule );
}
else pModule->dlls_to_init = 0;

View File

@ -17,7 +17,6 @@
#include "wine/port.h"
#include "wine/winbase16.h"
#include "wine/library.h"
#include "global.h"
#include "module.h"
#include "callback.h"
#include "debugtools.h"
@ -367,6 +366,7 @@ HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size)
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
HGLOBAL16 ret;
NE_MODULE *pModule = NE_GetPtr( hModule );
if (!pModule || !pModule->res_table || !hRsrc) return 0;
@ -377,7 +377,9 @@ HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size)
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
if (size < (DWORD)pNameInfo->length << sizeShift)
size = (DWORD)pNameInfo->length << sizeShift;
return GLOBAL_Alloc( GMEM_FIXED, size, hModule, WINE_LDT_FLAGS_DATA );
ret = GlobalAlloc16( GMEM_FIXED, size );
if (ret) FarSetOwner16( ret, hModule );
return ret;
}
@ -389,13 +391,15 @@ HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size)
HGLOBAL16 WINAPI DirectResAlloc16( HINSTANCE16 hInstance, WORD wType,
UINT16 wSize )
{
TRACE("(%04x,%04x,%04x)\n",
hInstance, wType, wSize );
HGLOBAL16 ret;
TRACE("(%04x,%04x,%04x)\n", hInstance, wType, wSize );
if (!(hInstance = GetExePtr( hInstance ))) return 0;
if(wType != 0x10) /* 0x10 is the only observed value, passed from
CreateCursorIndirect. */
TRACE("(wType=%x)\n", wType);
return GLOBAL_Alloc(GMEM_MOVEABLE, wSize, hInstance, WINE_LDT_FLAGS_DATA );
ret = GlobalAlloc16( GMEM_MOVEABLE, wSize );
if (ret) FarSetOwner16( ret, hInstance );
return ret;
}

View File

@ -226,10 +226,10 @@ BOOL TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, TEB *teb, LPCSTR cmdline,
/* Allocate the task structure */
hTask = GLOBAL_Alloc( GMEM_FIXED | GMEM_ZEROINIT, sizeof(TDB),
pModule->self, WINE_LDT_FLAGS_DATA );
hTask = GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, sizeof(TDB) );
if (!hTask) return FALSE;
pTask = (TDB *)GlobalLock16( hTask );
FarSetOwner16( hTask, pModule->self );
/* Fill the task structure */