Removed some direct accesses to the 16-bit task structure.

This commit is contained in:
Alexandre Julliard 2001-01-15 20:09:09 +00:00
parent ea6a10def8
commit 7d5bc5c3f9
28 changed files with 34 additions and 121 deletions

View file

@ -18,7 +18,6 @@
#include "wine/exception.h"
#include "debugger.h"
#include "expr.h"
#include "task.h"
extern FILE * yyin;

View file

@ -10,7 +10,6 @@
#include <string.h>
#include "winbase.h"
#include "wine/winbase16.h"
#include "task.h"
#include "debugger.h"
#include "expr.h"

View file

@ -85,7 +85,6 @@
#include "wine/winsock16.h"
#include "winnt.h"
#include "heap.h"
#include "task.h"
#include "wine/port.h"
#include "debugtools.h"

View file

@ -94,7 +94,6 @@
#include "wine/winsock16.h"
#include "winnt.h"
#include "heap.h"
#include "task.h"
#include "wine/port.h"
#include "services.h"
#include "server.h"

View file

@ -40,7 +40,6 @@
#include "file.h"
#include "heap.h"
#include "msdos.h"
#include "task.h"
#include "wincon.h"
#include "debugtools.h"
@ -1746,50 +1745,7 @@ LONG WINAPI _hwrite( HFILE handle, LPCSTR buffer, LONG count )
*/
UINT16 WINAPI SetHandleCount16( UINT16 count )
{
HGLOBAL16 hPDB = GetCurrentPDB16();
PDB16 *pdb = (PDB16 *)GlobalLock16( hPDB );
BYTE *files = MapSL( pdb->fileHandlesPtr );
TRACE("(%d)\n", count );
if (count < 20) count = 20; /* No point in going below 20 */
else if (count > 254) count = 254;
if (count == 20)
{
if (pdb->nbFiles > 20)
{
memcpy( pdb->fileHandles, files, 20 );
GlobalFree16( pdb->hFileHandles );
pdb->fileHandlesPtr = (SEGPTR)MAKELONG( 0x18,
GlobalHandleToSel16( hPDB ) );
pdb->hFileHandles = 0;
pdb->nbFiles = 20;
}
}
else /* More than 20, need a new file handles table */
{
BYTE *newfiles;
HGLOBAL16 newhandle = GlobalAlloc16( GMEM_MOVEABLE, count );
if (!newhandle)
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return pdb->nbFiles;
}
newfiles = (BYTE *)GlobalLock16( newhandle );
if (count > pdb->nbFiles)
{
memcpy( newfiles, files, pdb->nbFiles );
memset( newfiles + pdb->nbFiles, 0xff, count - pdb->nbFiles );
}
else memcpy( newfiles, files, count );
if (pdb->nbFiles > 20) GlobalFree16( pdb->hFileHandles );
pdb->fileHandlesPtr = K32WOWGlobalLock16( newhandle );
pdb->hFileHandles = newhandle;
pdb->nbFiles = count;
}
return pdb->nbFiles;
return SetHandleCount( count );
}

View file

@ -13,7 +13,6 @@
#include "stackframe.h"
#include "selectors.h"
#include "builtin16.h"
#include "task.h"
#include "syslevel.h"
#include "debugtools.h"
#include "callback.h"

View file

@ -95,7 +95,6 @@ typedef struct tagMESSAGEQUEUE
DWORD magic; /* magic number should be QUEUE_MAGIC */
DWORD lockCount; /* reference counter */
WORD wWinVersion; /* Expected Windows version */
WORD msgCount; /* Number of waiting messages */
QMSG* firstMsg; /* First message in linked list */

View file

@ -153,10 +153,4 @@ extern void TASK_Reschedule(void);
extern void TASK_InstallTHHook( THHOOK *pNewThook );
extern void TASK_CallTaskSignalProc( UINT16 uCode, HANDLE16 hTaskOrModule );
extern HQUEUE16 WINAPI SetThreadQueue16( DWORD thread, HQUEUE16 hQueue );
extern HQUEUE16 WINAPI GetThreadQueue16( DWORD thread );
extern VOID WINAPI SetFastQueue16( DWORD thread, HANDLE hQueue );
extern HANDLE WINAPI GetFastQueue16( void );
#endif /* __WINE_TASK_H */

View file

@ -168,6 +168,7 @@ SEGPTR WINAPI GetDOSEnvironment16(void);
HMODULE16 WINAPI GetExePtr(HANDLE16);
WORD WINAPI GetExeVersion16(void);
WORD WINAPI GetExpWinVer16(HMODULE16);
HANDLE WINAPI GetFastQueue16(void);
DWORD WINAPI GetHeapSpaces16(HMODULE16);
INT16 WINAPI GetInstanceData16(HINSTANCE16,WORD,INT16);
BOOL16 WINAPI GetModuleName16(HINSTANCE16,LPSTR,INT16);
@ -178,6 +179,7 @@ DWORD WINAPI GetSelectorLimit16(WORD);
FARPROC16 WINAPI GetSetKernelDOSProc16(FARPROC16 DosProc);
HINSTANCE16 WINAPI GetTaskDS16(void);
HQUEUE16 WINAPI GetTaskQueue16(HTASK16);
HQUEUE16 WINAPI GetThreadQueue16(DWORD);
DWORD WINAPI GetWinFlags16(void);
DWORD WINAPI GlobalDOSAlloc16(DWORD);
WORD WINAPI GlobalDOSFree16(WORD);
@ -206,10 +208,12 @@ VOID WINAPI WIN32_OldYield16(void);
VOID WINAPI PostEvent16(HTASK16);
WORD WINAPI PrestoChangoSelector16(WORD,WORD);
WORD WINAPI SelectorAccessRights16(WORD,WORD,WORD);
void WINAPI SetFastQueue16(DWORD,HANDLE);
VOID WINAPI SetPriority16(HTASK16,INT16);
FARPROC16 WINAPI SetResourceHandler16(HINSTANCE16,LPCSTR,FARPROC16);
WORD WINAPI SetSelectorLimit16(WORD,DWORD);
HQUEUE16 WINAPI SetTaskQueue16(HTASK16,HQUEUE16);
HQUEUE16 WINAPI SetThreadQueue16(DWORD,HQUEUE16);
VOID WINAPI SwitchStackTo16(WORD,WORD,WORD);
BOOL16 WINAPI WaitEvent16(HTASK16);
VOID WINAPI WriteOutProfiles16(void);

View file

@ -426,6 +426,7 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
{
HFILE hf;
HFILE16 hFile16;
HGLOBAL16 sel;
/* Handle self-loading modules */
SELFLOADHEADER *selfloadheader;
HMODULE16 mod = GetModuleHandle16("KERNEL");
@ -439,7 +440,9 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
selfloadheader->EntryAddrProc = GetProcAddress16(mod,"EntryAddrProc");
selfloadheader->MyAlloc = GetProcAddress16(mod,"MyAlloc");
selfloadheader->SetOwner = GetProcAddress16(mod,"FarSetOwner");
pModule->self_loading_sel = SEL(GLOBAL_Alloc(GMEM_ZEROINIT, 0xFF00, pModule->self, WINE_LDT_FLAGS_DATA));
sel = GlobalAlloc16( GMEM_ZEROINIT, 0xFF00 );
pModule->self_loading_sel = SEL(sel);
FarSetOwner16( sel, pModule->self );
oldstack = NtCurrentTeb()->cur_stack;
NtCurrentTeb()->cur_stack = MAKESEGPTR(pModule->self_loading_sel,
0xff00 - sizeof(STACK16FRAME) );
@ -614,7 +617,7 @@ static VOID NE_GetDLLInitParams( NE_MODULE *pModule,
*
* Call the DLL initialization code
*/
static BOOL NE_InitDLL( TDB* pTask, NE_MODULE *pModule )
static BOOL NE_InitDLL( NE_MODULE *pModule )
{
SEGTABLEENTRY *pSegTable;
WORD hInst, ds, heap;
@ -668,7 +671,6 @@ static BOOL NE_InitDLL( TDB* pTask, NE_MODULE *pModule )
*/
void NE_InitializeDLLs( HMODULE16 hModule )
{
TDB* pTask = (TDB*)GlobalLock16(GetCurrentTask());
NE_MODULE *pModule;
HMODULE16 *pDLL;
@ -685,7 +687,7 @@ void NE_InitializeDLLs( HMODULE16 hModule )
}
GlobalFree16( to_init );
}
NE_InitDLL( pTask, pModule );
NE_InitDLL( pModule );
}

View file

@ -21,7 +21,6 @@
#include "winerror.h"
#include "module.h"
#include "heap.h"
#include "task.h"
#include "stackframe.h"
#include "debugtools.h"

View file

@ -19,7 +19,6 @@
#include "heap.h"
#include "callback.h"
#include "cursoricon.h"
#include "task.h"
#include "module.h"
#include "file.h"
#include "debugtools.h"

View file

@ -17,7 +17,6 @@
#include <stdlib.h>
#include <string.h>
#include "wine/winbase16.h"
#include "task.h"
#include "heap.h"
#include "instance.h"
#include "local.h"

View file

@ -7,7 +7,6 @@
#include "miscemu.h"
/* #define DEBUG_INT */
#include "debugtools.h"
#include "task.h"
#include "callback.h"
/**********************************************************************

View file

@ -13,7 +13,6 @@
#include "dosexe.h"
#include "miscemu.h"
#include "module.h"
#include "task.h"
/* #define DEBUG_INT */
#include "debugtools.h"
#include "cdrom.h"

View file

@ -19,7 +19,6 @@
#include "module.h"
#include "file.h"
#include "heap.h"
#include "task.h"
#include "thread.h"
#include "winerror.h"
#include "server.h"
@ -899,7 +898,6 @@ BOOL WINAPI TerminateProcess( HANDLE handle, DWORD exit_code )
*/
DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
{
TDB *pTask;
DWORD x, y;
TRACE_(win32)("(%ld, %d)\n", dwProcessID, offset );
@ -913,19 +911,16 @@ DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
switch ( offset )
{
case GPD_APP_COMPAT_FLAGS:
pTask = (TDB *)GlobalLock16( GetCurrentTask() );
return pTask? pTask->compat_flags : 0;
return GetAppCompatFlags16(0);
case GPD_LOAD_DONE_EVENT:
return current_process.load_done_evt;
case GPD_HINSTANCE16:
pTask = (TDB *)GlobalLock16( GetCurrentTask() );
return pTask? pTask->hInstance : 0;
return GetTaskDS16();
case GPD_WINDOWS_VERSION:
pTask = (TDB *)GlobalLock16( GetCurrentTask() );
return pTask? pTask->version : 0;
return GetExeVersion16();
case GPD_THDB:
return (DWORD)NtCurrentTeb() - 0x10 /* FIXME */;

View file

@ -9,10 +9,9 @@
#include <unistd.h>
#include <stdlib.h>
#include "winnls.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/exception.h"
#include "heap.h"
#include "task.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win32);

View file

@ -32,7 +32,6 @@
#include "wine/winbase16.h"
#include "heap.h"
#include "message.h"
#include "task.h"
#include "queue.h"
#include "user.h"
#include "clipboard.h"

View file

@ -42,7 +42,6 @@
#include "cursoricon.h"
#include "module.h"
#include "debugtools.h"
#include "task.h"
#include "user.h"
#include "input.h"
#include "message.h"
@ -623,7 +622,8 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
CURSORICONINFO *info;
/* Make it owned by the module */
if (hInstance) FarSetOwner16( hObj, GetExePtr(hInstance) );
if (hInstance) hInstance = GetExePtr(hInstance);
FarSetOwner16( hObj, hInstance );
info = (CURSORICONINFO *)GlobalLock16( hObj );
info->ptHotSpot.x = hotspot.x;
@ -678,11 +678,8 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
INT width, INT height,
UINT cFlag )
{
TDB* pTask = (TDB*)GlobalLock16( GetCurrentTask() );
if( pTask )
return CURSORICON_CreateFromResource( pTask->hInstance, 0, bits, cbSize, bIcon, dwVersion,
return CURSORICON_CreateFromResource( 0, 0, bits, cbSize, bIcon, dwVersion,
width, height, cFlag );
return 0;
}
/**********************************************************************
@ -810,7 +807,7 @@ static HGLOBAL16 CURSORICON_Copy( HINSTANCE16 hInstance, HGLOBAL16 handle )
HGLOBAL16 hNew;
if (!(ptrOld = (char *)GlobalLock16( handle ))) return 0;
if (!(hInstance = GetExePtr( hInstance ))) return 0;
if (hInstance && !(hInstance = GetExePtr( hInstance ))) return 0;
size = GlobalSize16( handle );
hNew = GlobalAlloc16( GMEM_MOVEABLE, size );
FarSetOwner16( hNew, hInstance );
@ -869,8 +866,7 @@ HGLOBAL CURSORICON_ExtCopy(HGLOBAL Handle, UINT nType,
*/
if(pIconCache == NULL)
{
TDB* pTask = (TDB *) GlobalLock16 (GetCurrentTask ());
hNew = CURSORICON_Copy(pTask->hInstance, Handle);
hNew = CURSORICON_Copy(0, Handle);
if(nFlags & LR_COPYFROMRESOURCE)
{
TRACE_(icon)("LR_COPYFROMRESOURCE: Failed to load from cache\n");
@ -959,11 +955,7 @@ HGLOBAL CURSORICON_ExtCopy(HGLOBAL Handle, UINT nType,
FreeResource(hMem);
}
}
else
{
TDB* pTask = (TDB *) GlobalLock16 (GetCurrentTask ());
hNew = CURSORICON_Copy(pTask->hInstance, Handle);
}
else hNew = CURSORICON_Copy(0, Handle);
return hNew;
}
@ -977,14 +969,12 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL bSemiTransparent)
{
HCURSOR16 hRet = 0;
CURSORICONINFO *pIcon = NULL;
HTASK16 hTask = GetCurrentTask();
TDB* pTask = (TDB *)GlobalLock16(hTask);
if(hIcon && pTask)
if(hIcon)
if (!(pIcon = (CURSORICONINFO*)GlobalLock16( hIcon ))) return FALSE;
if (pIcon->bPlanes * pIcon->bBitsPerPixel == 1)
{
hRet = CURSORICON_Copy( pTask->hInstance, hIcon );
hRet = CURSORICON_Copy( 0, hIcon );
pIcon = GlobalLock16(hRet);
@ -1052,10 +1042,10 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL bSemiTransparent)
pxbPtr += 4;
}
hRet = CreateCursorIconIndirect16( pTask->hInstance , &cI, pAndBits, pXorBits);
hRet = CreateCursorIconIndirect16( 0 , &cI, pAndBits, pXorBits);
if( !hRet ) /* fall back on default drag cursor */
hRet = CURSORICON_Copy( pTask->hInstance ,
hRet = CURSORICON_Copy( 0 ,
CURSORICON_Load(0,MAKEINTRESOURCEW(OCR_DRAGOBJECT),
GetSystemMetrics(SM_CXCURSOR),
GetSystemMetrics(SM_CYCURSOR), 1, TRUE, 0) );
@ -1201,7 +1191,7 @@ HGLOBAL16 WINAPI CreateCursorIconIndirect16( HINSTANCE16 hInstance,
if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
return 0;
if (hInstance) FarSetOwner16( handle, hInstance );
FarSetOwner16( handle, hInstance );
ptr = (char *)GlobalLock16( handle );
memcpy( ptr, info, sizeof(*info) );
memcpy( ptr + sizeof(CURSORICONINFO), lpANDbits, sizeAnd );
@ -1226,10 +1216,8 @@ HICON16 WINAPI CopyIcon16( HINSTANCE16 hInstance, HICON16 hIcon )
*/
HICON WINAPI CopyIcon( HICON hIcon )
{
HTASK16 hTask = GetCurrentTask ();
TDB* pTask = (TDB *) GlobalLock16 (hTask);
TRACE_(icon)("%04x\n", hIcon );
return CURSORICON_Copy( pTask->hInstance, hIcon );
return CURSORICON_Copy( 0, hIcon );
}

View file

@ -15,7 +15,6 @@
#include "hook.h"
#include "message.h"
#include "queue.h"
#include "task.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win);

View file

@ -24,7 +24,6 @@
#include "hook.h"
#include "win.h"
#include "queue.h"
#include "task.h"
#include "user.h"
#include "heap.h"
#include "struct32.h"

View file

@ -32,7 +32,6 @@
#include "queue.h"
#include "debugtools.h"
#include "winerror.h"
#include "task.h"
DECLARE_DEBUG_CHANNEL(event);
DECLARE_DEBUG_CHANNEL(key);

View file

@ -22,7 +22,6 @@
#include "dde.h"
#include "queue.h"
#include "winproc.h"
#include "task.h"
#include "thread.h"
#include "options.h"
#include "controls.h"

View file

@ -12,7 +12,6 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "queue.h"
#include "task.h"
#include "win.h"
#include "hook.h"
#include "heap.h"
@ -368,7 +367,6 @@ void QUEUE_DumpQueue( HQUEUE16 hQueue )
"lastMsg: %8p smPending: %10p\n"
"msgCount: %8.4x smProcessing: %10p\n"
"lockCount: %7.4x\n"
"wWinVer: %9.4x\n"
"paints: %10.4x\n"
"timers: %10.4x\n"
"wakeBits: %8.4x\n"
@ -376,8 +374,7 @@ void QUEUE_DumpQueue( HQUEUE16 hQueue )
"hCurHook: %8.4x\n",
pq->next, pq->teb, pq->firstMsg, pq->smWaiting, pq->lastMsg,
pq->smPending, pq->msgCount, pq->smProcessing,
(unsigned)pq->lockCount, pq->wWinVersion,
pq->wPaintCount, pq->wTimerCount,
(unsigned)pq->lockCount, pq->wPaintCount, pq->wTimerCount,
pq->wakeBits, pq->wakeMask, pq->hCurHook);
QUEUE_Unlock( pq );
@ -440,7 +437,6 @@ static HQUEUE16 QUEUE_CreateMsgQueue( BOOL16 bCreatePerQData )
HQUEUE16 hQueue;
HANDLE handle;
MESSAGEQUEUE * msgQueue;
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
TRACE_(msg)("(): Creating message queue...\n");
@ -470,7 +466,6 @@ static HQUEUE16 QUEUE_CreateMsgQueue( BOOL16 bCreatePerQData )
msgQueue->self = hQueue;
msgQueue->wakeBits = msgQueue->changeBits = 0;
msgQueue->wWinVersion = pTask ? pTask->version : 0;
InitializeCriticalSection( &msgQueue->cSection );
MakeCriticalSectionGlobal( &msgQueue->cSection );

View file

@ -9,7 +9,6 @@
#include "wine/winuser16.h"
#include "winuser.h"
#include "queue.h"
#include "task.h"
#include "winproc.h"
#include "services.h"
#include "message.h"

View file

@ -137,8 +137,10 @@ static void USER_QueueCleanup( HQUEUE16 hQueue )
/**********************************************************************
* USER_AppExit
*/
static void USER_AppExit( HINSTANCE16 hInstance )
static void USER_AppExit(void)
{
HINSTANCE16 hInstance = MapHModuleLS(0);
/* FIXME: maybe destroy menus (Windows only complains about them
* but does nothing);
*/
@ -179,8 +181,6 @@ void WINAPI FinalUserInit16( void )
WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
DWORD dwFlags, HMODULE16 hModule )
{
HINSTANCE16 hInst;
/* FIXME: Proper reaction to most signals still missing. */
switch ( uCode )
@ -218,8 +218,7 @@ WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
break;
case USIG_PROCESS_DESTROY:
hInst = ((TDB *)GlobalLock16( GetCurrentTask() ))->hInstance;
USER_AppExit( hInst );
USER_AppExit();
break;
default:

View file

@ -21,7 +21,6 @@
#include "message.h"
#include "queue.h"
#include "winpos.h"
#include "task.h"
#include "thread.h"
#include "winerror.h"
#include "stackframe.h"

View file

@ -20,7 +20,6 @@
#include "message.h"
#include "queue.h"
#include "options.h"
#include "task.h"
#include "winpos.h"
#include "dce.h"
#include "nonclient.h"