Use the WOWHandle functions to convert between task handle and thread

id. Stop exporting TASK_GetPtr and THREAD_IdToTEB from kernel.
This commit is contained in:
Alexandre Julliard 2002-10-17 18:26:53 +00:00
parent 43701b945d
commit 011605edf3
7 changed files with 19 additions and 25 deletions

View File

@ -1076,6 +1076,4 @@ init MAIN_KernelInit
@ cdecl LOCAL_Unlock(long long) LOCAL_Unlock
@ stdcall NE_DefResourceHandler(long long long) NE_DefResourceHandler
@ cdecl SELECTOR_AllocBlock(ptr long long) SELECTOR_AllocBlock
@ cdecl TASK_GetPtr(long) TASK_GetPtr
@ cdecl THREAD_IdToTEB(long) THREAD_IdToTEB
@ cdecl VIRTUAL_SetFaultHandler(ptr ptr ptr) VIRTUAL_SetFaultHandler

View File

@ -27,6 +27,7 @@
#include "wownt32.h"
#include "winternl.h"
#include "file.h"
#include "task.h"
#include "miscemu.h"
#include "stackframe.h"
#include "wine/debug.h"
@ -214,10 +215,12 @@ HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type )
case WOW_TYPE_HPALETTE:
case WOW_TYPE_HPEN:
case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND:
return (HANDLE)(ULONG_PTR)handle;
case WOW_TYPE_HTASK:
return (HANDLE)TASK_GetPtr(handle)->teb->tid;
default:
ERR( "handle 0x%04x of unknown type %d\n", handle, type );
return (HANDLE)(ULONG_PTR)handle;
@ -247,10 +250,12 @@ WORD WINAPI K32WOWHandle16( HANDLE handle, WOW_HANDLE_TYPE type )
case WOW_TYPE_HPALETTE:
case WOW_TYPE_HPEN:
case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND:
return LOWORD(handle);
case WOW_TYPE_HTASK:
return THREAD_IdToTEB((DWORD)handle)->htask16;
default:
ERR( "handle 0x%08x of unknown type %d\n", handle, type );
return LOWORD(handle);

View File

@ -24,7 +24,6 @@
#include "hook.h"
#include "message.h"
#include "spy.h"
#include "task.h"
#include "thread.h"
#include "win.h"
#include "wine/debug.h"
@ -118,13 +117,13 @@ BOOL16 WINAPI PostAppMessage16( HTASK16 hTask, UINT16 msg, WPARAM16 wparam, LPAR
{
WPARAM wparam32;
UINT msg32;
TDB *pTask = TASK_GetPtr( hTask );
if (!pTask) return FALSE;
DWORD tid = HTASK_32( hTask );
if (!tid) return FALSE;
switch (WINPROC_MapMsg16To32W( 0, msg, wparam, &msg32, &wparam32, &lparam ))
{
case 0:
return PostThreadMessageW( (DWORD)pTask->teb->tid, msg32, wparam32, lparam );
return PostThreadMessageW( tid, msg32, wparam32, lparam );
case 1:
ERR( "16-bit message %x contains pointer, cannot post\n", msg );
return FALSE;

View File

@ -22,7 +22,6 @@
#include "wownt32.h"
#include "user.h"
#include "win.h"
#include "task.h"
#include "stackframe.h"
/* handle --> handle16 conversions */
@ -1033,12 +1032,12 @@ INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
{
struct wnd_enum_info info;
TDB *tdb = TASK_GetPtr( hTask );
DWORD tid = HTASK_32( hTask );
if (!tdb) return FALSE;
if (!tid) return FALSE;
info.proc = func;
info.param = lParam;
return EnumThreadWindows( (DWORD)tdb->teb->tid, wnd_enum_callback, (LPARAM)&info );
return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
}

View File

@ -473,7 +473,7 @@ static BOOL MZ_InitTask(void)
static void MZ_Launch(void)
{
TDB *pTask = TASK_GetPtr( GetCurrentTask() );
TDB *pTask = GlobalLock16( GetCurrentTask() );
BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
LPSTR cmdline = GetCommandLineA();
DWORD rv;

View File

@ -45,7 +45,6 @@
#include "winproc.h"
#include "user.h"
#include "thread.h"
#include "task.h"
#include "controls.h"
#include "wine/debug.h"

View File

@ -39,7 +39,6 @@
#include "winproc.h"
#include "wine/debug.h"
#include "spy.h"
#include "task.h"
#include "thread.h"
#include "dde.h"
@ -1337,15 +1336,10 @@ INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pms
*plparam = (LPARAM)MapSL(*plparam);
return 0;
case WM_ACTIVATEAPP:
if (*plparam)
{ /* We need this when SetActiveWindow sends a Sendmessage16() to
a 32bit window. Might be superflous with 32bit interprocess
message queues.
*/
HTASK16 htask = (HTASK16) *plparam;
DWORD idThread = (DWORD)TASK_GetPtr(htask)->teb->tid;
*plparam = (LPARAM) idThread;
}
/* We need this when SetActiveWindow sends a Sendmessage16() to
* a 32bit window. Might be superflous with 32bit interprocess
* message queues. */
if (*plparam) *plparam = HTASK_32( *plparam );
return 0;
case WM_NEXTMENU:
{
@ -2126,7 +2120,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32,
return 0;
case WM_ACTIVATEAPP:
if (*plparam) *plparam = (LPARAM)THREAD_IdToTEB((DWORD) *plparam)->htask16;
if (*plparam) *plparam = HTASK_16( (HANDLE)*plparam );
return 0;
case WM_NEXTMENU:
{