Made SELECTOR_ReallocBlock preserve the current selector access rights
(problem reported by Andreas Mohr).
This commit is contained in:
parent
06bcab8a50
commit
284c9b923a
|
@ -13,9 +13,7 @@
|
|||
extern WORD SELECTOR_AllocBlock( const void *base, DWORD size,
|
||||
enum seg_type type, BOOL is32bit,
|
||||
BOOL readonly );
|
||||
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
|
||||
enum seg_type type, BOOL is32bit,
|
||||
BOOL readonly );
|
||||
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
|
||||
extern void SELECTOR_MoveBlock( WORD sel, const void *new_base );
|
||||
extern void SELECTOR_FreeBlock( WORD sel, WORD count );
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
|||
* change the selector if we are shrinking the block.
|
||||
* FIXME: shouldn't we keep selectors until the block is deleted?
|
||||
*/
|
||||
SELECTOR_ReallocBlock( sel, 0, 1, SEGMENT_DATA, 0, 0 );
|
||||
SELECTOR_ReallocBlock( sel, 0, 1 );
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
|
|||
|
||||
/* Reallocate the selector(s) */
|
||||
|
||||
sel = SELECTOR_ReallocBlock( sel, ptr, size, SEGMENT_DATA, 0, 0 );
|
||||
sel = SELECTOR_ReallocBlock( sel, ptr, size );
|
||||
if (!sel)
|
||||
{
|
||||
HeapFree( SystemHeap, 0, ptr );
|
||||
|
|
|
@ -198,14 +198,15 @@ void SELECTOR_FreeBlock( WORD sel, WORD count )
|
|||
*
|
||||
* Change the size of a block of selectors.
|
||||
*/
|
||||
WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
|
||||
enum seg_type type, BOOL is32bit, BOOL readonly)
|
||||
WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size )
|
||||
{
|
||||
ldt_entry entry;
|
||||
WORD i, oldcount, newcount;
|
||||
|
||||
if (!size) size = 1;
|
||||
oldcount = (GET_SEL_LIMIT(sel) >> 16) + 1;
|
||||
newcount = (size + 0xffff) >> 16;
|
||||
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
|
||||
|
||||
if (oldcount < newcount) /* We need to add selectors */
|
||||
{
|
||||
|
@ -231,7 +232,8 @@ WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
|
|||
SELECTOR_FreeBlock( ENTRY_TO_SELECTOR(SELECTOR_TO_ENTRY(sel)+newcount),
|
||||
oldcount - newcount );
|
||||
}
|
||||
if (sel) SELECTOR_SetEntries( sel, base, size, type, is32bit, readonly );
|
||||
if (sel) SELECTOR_SetEntries( sel, base, size, entry.type,
|
||||
entry.seg_32bit, entry.read_only );
|
||||
return sel;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue