Only access 16-bit stack if really necessary.

This commit is contained in:
Alexandre Julliard 2005-09-07 09:26:39 +00:00
parent 13fc2f88d6
commit c3d87e7c69
1 changed files with 2 additions and 1 deletions

View File

@ -1618,7 +1618,6 @@ static void EDIT_LockBuffer(EDITSTATE *es)
{ {
STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved);
HINSTANCE16 hInstance = GetWindowLongPtrW( es->hwndSelf, GWLP_HINSTANCE ); HINSTANCE16 hInstance = GetWindowLongPtrW( es->hwndSelf, GWLP_HINSTANCE );
HANDLE16 oldDS = stack16->ds;
if (!es->text) { if (!es->text) {
CHAR *textA = NULL; CHAR *textA = NULL;
@ -1635,6 +1634,7 @@ static void EDIT_LockBuffer(EDITSTATE *es)
} }
else if(es->hloc16) else if(es->hloc16)
{ {
HANDLE16 oldDS = stack16->ds;
TRACE("Synchronizing with 16-bit ANSI buffer\n"); TRACE("Synchronizing with 16-bit ANSI buffer\n");
stack16->ds = hInstance; stack16->ds = hInstance;
textA = MapSL(LocalLock16(es->hloc16)); textA = MapSL(LocalLock16(es->hloc16));
@ -1677,6 +1677,7 @@ static void EDIT_LockBuffer(EDITSTATE *es)
MultiByteToWideChar(CP_ACP, 0, textA, countA, es->text, es->buffer_size + 1); MultiByteToWideChar(CP_ACP, 0, textA, countA, es->text, es->buffer_size + 1);
if(_16bit) if(_16bit)
{ {
HANDLE16 oldDS = stack16->ds;
stack16->ds = hInstance; stack16->ds = hInstance;
LocalUnlock16(es->hloc16); LocalUnlock16(es->hloc16);
stack16->ds = oldDS; stack16->ds = oldDS;