Commit 71d68bba authored by Alexandre Julliard's avatar Alexandre Julliard

Use the HEAP_WINE_SEGPTR flag to specify allocations on the segptr heap.

Added a hack in MapLS to recognize such allocations and use the heap selector in this case.
parent e8e7d1ec
......@@ -156,7 +156,7 @@ static UTINFO *UTAlloc( HMODULE hModule, HMODULE16 hModule16,
if ( !UTGlue16_Segptr ) return NULL;
}
ut = HeapAlloc( SegptrHeap, HEAP_ZERO_MEMORY, sizeof(UTINFO) );
ut = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY|HEAP_WINE_SEGPTR, sizeof(UTINFO) );
if ( !ut ) return NULL;
ut->hModule = hModule;
......@@ -196,7 +196,7 @@ static void UTFree( UTINFO *ut )
break;
}
HeapFree( SegptrHeap, 0, ut );
HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, ut );
}
/****************************************************************************
......
......@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = msvfw32
ALTNAMES = msvideo
IMPORTS = ntdll
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
......
......@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = oleaut32
ALTNAMES = ole2disp typelib
IMPORTS = ntdll
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
......
......@@ -98,7 +98,7 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font)
&physDev->lf, 0, 0);
if( physDev->FontInfo &&
HeapSize( SegptrHeap, 0, physDev->FontInfo ) < nSize )
HeapSize( GetProcessHeap(), HEAP_WINE_SEGPTR, physDev->FontInfo ) < nSize )
{
SEGPTR_FREE( physDev->FontInfo );
physDev->FontInfo = NULL;
......
......@@ -123,7 +123,7 @@ void THUNK_Free( FARPROC thunk )
|| t->magic != CALLTO16_THUNK_MAGIC )
return;
if (HEAP_IsInsideHeap( GetProcessHeap(), 0, t ))
if (HeapValidate( GetProcessHeap(), 0, t ))
{
THUNK **prev = &firstThunk;
while (*prev && (*prev != t)) prev = &(*prev)->next;
......
......@@ -15,29 +15,23 @@
#include "wine/windef16.h" /* for SEGPTR */
extern HANDLE SystemHeap;
extern HANDLE SegptrHeap;
extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
extern BOOL HEAP_CreateSystemHeap(void);
/* SEGPTR helper macros */
#define SEGPTR_ALLOC(size) \
(HeapAlloc( SegptrHeap, 0, (size) ))
(HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, (size) ))
#define SEGPTR_NEW(type) \
((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
((type *)HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, sizeof(type) ))
#define SEGPTR_STRDUP(str) \
(HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
(HIWORD(str) ? HEAP_strdupA( GetProcessHeap(), HEAP_WINE_SEGPTR, (str) ) : (LPSTR)(str))
#define SEGPTR_STRDUP_WtoA(str) \
(HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
/* define an inline function, a macro won't do */
static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr);
}
#define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
(HIWORD(str) ? HEAP_strdupWtoA( GetProcessHeap(), HEAP_WINE_SEGPTR, (str) ) : (LPSTR)(str))
#define SEGPTR_FREE(ptr) \
(HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
(HIWORD(ptr) ? HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, (ptr) ) : 0)
#define SEGPTR_GET(ptr) MapLS(ptr)
/* strdup macros */
......
......@@ -1883,7 +1883,7 @@ typedef struct tagSYSLEVEL
void WINAPI DisposeLZ32Handle(HANDLE);
HANDLE WINAPI DosFileHandleToWin32Handle(HFILE);
VOID WINAPI GetpWin16Lock(SYSLEVEL**);
DWORD WINAPI MapLS(LPVOID);
DWORD WINAPI MapLS(LPCVOID);
LPVOID WINAPI MapSL(DWORD);
VOID WINAPI ReleaseThunkLock(DWORD*);
VOID WINAPI RestoreThunkLock(DWORD);
......
......@@ -552,33 +552,6 @@ void WINAPI UnMapSLFixArray( SEGPTR sptr[], INT length, CONTEXT86 *context )
}
/***********************************************************************
* MapLS (KERNEL32.522)
*
* Maps linear pointer to segmented.
*/
SEGPTR WINAPI MapLS( LPVOID ptr )
{
if (!HIWORD(ptr))
return (SEGPTR)ptr;
else
{
WORD sel = SELECTOR_AllocBlock( ptr, 0x10000, WINE_LDT_FLAGS_DATA );
return PTR_SEG_OFF_TO_SEGPTR( sel, 0 );
}
}
/***********************************************************************
* UnMapLS (KERNEL32.700)
*
* Free mapped selector.
*/
void WINAPI UnMapLS( SEGPTR sptr )
{
if (SELECTOROF(sptr)) FreeSelector16( SELECTOROF(sptr) );
}
/***********************************************************************
* GetThreadSelectorEntry (KERNEL32)
*/
BOOL WINAPI GetThreadSelectorEntry( HANDLE hthread, DWORD sel, LPLDT_ENTRY ldtent)
......
......@@ -217,9 +217,6 @@ static BOOL process_init( char *argv[] )
/* Copy the parent environment */
if (!ENV_BuildEnvironment()) return FALSE;
/* Create the SEGPTR heap */
if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;
/* Initialize the critical sections */
InitializeCriticalSection( &current_process.crit_section );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment