Commit 011605ed authored by Alexandre Julliard's avatar Alexandre Julliard

Use the WOWHandle functions to convert between task handle and thread

id. Stop exporting TASK_GetPtr and THREAD_IdToTEB from kernel.
parent 43701b94
...@@ -1076,6 +1076,4 @@ init MAIN_KernelInit ...@@ -1076,6 +1076,4 @@ init MAIN_KernelInit
@ cdecl LOCAL_Unlock(long long) LOCAL_Unlock @ cdecl LOCAL_Unlock(long long) LOCAL_Unlock
@ stdcall NE_DefResourceHandler(long long long) NE_DefResourceHandler @ stdcall NE_DefResourceHandler(long long long) NE_DefResourceHandler
@ cdecl SELECTOR_AllocBlock(ptr long long) SELECTOR_AllocBlock @ 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 @ cdecl VIRTUAL_SetFaultHandler(ptr ptr ptr) VIRTUAL_SetFaultHandler
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "wownt32.h" #include "wownt32.h"
#include "winternl.h" #include "winternl.h"
#include "file.h" #include "file.h"
#include "task.h"
#include "miscemu.h" #include "miscemu.h"
#include "stackframe.h" #include "stackframe.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -214,10 +215,12 @@ HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type ) ...@@ -214,10 +215,12 @@ HANDLE WINAPI K32WOWHandle32( WORD handle, WOW_HANDLE_TYPE type )
case WOW_TYPE_HPALETTE: case WOW_TYPE_HPALETTE:
case WOW_TYPE_HPEN: case WOW_TYPE_HPEN:
case WOW_TYPE_HACCEL: case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND: case WOW_TYPE_FULLHWND:
return (HANDLE)(ULONG_PTR)handle; return (HANDLE)(ULONG_PTR)handle;
case WOW_TYPE_HTASK:
return (HANDLE)TASK_GetPtr(handle)->teb->tid;
default: default:
ERR( "handle 0x%04x of unknown type %d\n", handle, type ); ERR( "handle 0x%04x of unknown type %d\n", handle, type );
return (HANDLE)(ULONG_PTR)handle; return (HANDLE)(ULONG_PTR)handle;
...@@ -247,10 +250,12 @@ WORD WINAPI K32WOWHandle16( HANDLE handle, WOW_HANDLE_TYPE type ) ...@@ -247,10 +250,12 @@ WORD WINAPI K32WOWHandle16( HANDLE handle, WOW_HANDLE_TYPE type )
case WOW_TYPE_HPALETTE: case WOW_TYPE_HPALETTE:
case WOW_TYPE_HPEN: case WOW_TYPE_HPEN:
case WOW_TYPE_HACCEL: case WOW_TYPE_HACCEL:
case WOW_TYPE_HTASK:
case WOW_TYPE_FULLHWND: case WOW_TYPE_FULLHWND:
return LOWORD(handle); return LOWORD(handle);
case WOW_TYPE_HTASK:
return THREAD_IdToTEB((DWORD)handle)->htask16;
default: default:
ERR( "handle 0x%08x of unknown type %d\n", handle, type ); ERR( "handle 0x%08x of unknown type %d\n", handle, type );
return LOWORD(handle); return LOWORD(handle);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "hook.h" #include "hook.h"
#include "message.h" #include "message.h"
#include "spy.h" #include "spy.h"
#include "task.h"
#include "thread.h" #include "thread.h"
#include "win.h" #include "win.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -118,13 +117,13 @@ BOOL16 WINAPI PostAppMessage16( HTASK16 hTask, UINT16 msg, WPARAM16 wparam, LPAR ...@@ -118,13 +117,13 @@ BOOL16 WINAPI PostAppMessage16( HTASK16 hTask, UINT16 msg, WPARAM16 wparam, LPAR
{ {
WPARAM wparam32; WPARAM wparam32;
UINT msg32; UINT msg32;
TDB *pTask = TASK_GetPtr( hTask ); DWORD tid = HTASK_32( hTask );
if (!pTask) return FALSE; if (!tid) return FALSE;
switch (WINPROC_MapMsg16To32W( 0, msg, wparam, &msg32, &wparam32, &lparam )) switch (WINPROC_MapMsg16To32W( 0, msg, wparam, &msg32, &wparam32, &lparam ))
{ {
case 0: case 0:
return PostThreadMessageW( (DWORD)pTask->teb->tid, msg32, wparam32, lparam ); return PostThreadMessageW( tid, msg32, wparam32, lparam );
case 1: case 1:
ERR( "16-bit message %x contains pointer, cannot post\n", msg ); ERR( "16-bit message %x contains pointer, cannot post\n", msg );
return FALSE; return FALSE;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "wownt32.h" #include "wownt32.h"
#include "user.h" #include "user.h"
#include "win.h" #include "win.h"
#include "task.h"
#include "stackframe.h" #include "stackframe.h"
/* handle --> handle16 conversions */ /* handle --> handle16 conversions */
...@@ -1033,12 +1032,12 @@ INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox, ...@@ -1033,12 +1032,12 @@ INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam ) BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
{ {
struct wnd_enum_info info; 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.proc = func;
info.param = lParam; info.param = lParam;
return EnumThreadWindows( (DWORD)tdb->teb->tid, wnd_enum_callback, (LPARAM)&info ); return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
} }
......
...@@ -473,7 +473,7 @@ static BOOL MZ_InitTask(void) ...@@ -473,7 +473,7 @@ static BOOL MZ_InitTask(void)
static void MZ_Launch(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 ); BYTE *psp_start = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
LPSTR cmdline = GetCommandLineA(); LPSTR cmdline = GetCommandLineA();
DWORD rv; DWORD rv;
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "winproc.h" #include "winproc.h"
#include "user.h" #include "user.h"
#include "thread.h" #include "thread.h"
#include "task.h"
#include "controls.h" #include "controls.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "winproc.h" #include "winproc.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "spy.h" #include "spy.h"
#include "task.h"
#include "thread.h" #include "thread.h"
#include "dde.h" #include "dde.h"
...@@ -1337,15 +1336,10 @@ INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pms ...@@ -1337,15 +1336,10 @@ INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pms
*plparam = (LPARAM)MapSL(*plparam); *plparam = (LPARAM)MapSL(*plparam);
return 0; return 0;
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
if (*plparam) /* We need this when SetActiveWindow sends a Sendmessage16() to
{ /* We need this when SetActiveWindow sends a Sendmessage16() to * a 32bit window. Might be superflous with 32bit interprocess
a 32bit window. Might be superflous with 32bit interprocess * message queues. */
message queues. if (*plparam) *plparam = HTASK_32( *plparam );
*/
HTASK16 htask = (HTASK16) *plparam;
DWORD idThread = (DWORD)TASK_GetPtr(htask)->teb->tid;
*plparam = (LPARAM) idThread;
}
return 0; return 0;
case WM_NEXTMENU: case WM_NEXTMENU:
{ {
...@@ -2126,7 +2120,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32, ...@@ -2126,7 +2120,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32,
return 0; return 0;
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
if (*plparam) *plparam = (LPARAM)THREAD_IdToTEB((DWORD) *plparam)->htask16; if (*plparam) *plparam = HTASK_16( (HANDLE)*plparam );
return 0; return 0;
case WM_NEXTMENU: case WM_NEXTMENU:
{ {
......
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