Ignore:
Timestamp:
Jul 7, 1999, 10:11:58 AM (26 years ago)
Author:
sandervl
Message:

Major changes in PE2LX/KERNEL32 for TLS support. DLL VERSION INCREASED TO 3 AS THIS CHANGE MAKES IT INCOMPATIBLE WITH APPS CONVERTED WITH PREVIOUS VERSION OF PE2LX (OR WIN32K)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/thread.cpp

    r126 r281  
    1 /* $Id: thread.cpp,v 1.6 1999-06-20 10:55:36 sandervl Exp $ */
     1/* $Id: thread.cpp,v 1.7 1999-07-07 08:11:10 sandervl Exp $ */
    22
    33/*
     
    1414#include "thread.h"
    1515#include "except.h"
    16 #include "misc.h"
     16#include <misc.h>
    1717#include <wprocess.h>
     18#include <windll.h>
     19#include <winexe.h>
    1820
    1921static DWORD OPEN32API Win32ThreadProc(LPVOID lpData);
     
    4648DWORD WIN32API GetCurrentThreadId()
    4749{
    48   dprintf(("GetCurrentThreadId\n"));
    49 
     50////  dprintf(("GetCurrentThreadId\n"));
    5051  return(O32_GetCurrentThreadId());
    5152}
     
    121122           exitcode));
    122123
    123 #ifdef WIN32_TIBSEL
     124  Win32Dll::detachThreadFromAllDlls();  //send DLL_THREAD_DETACH message to all dlls
     125  Win32Dll::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls
     126  WinExe->tlsDetachThread();                    //destroy TLS structure of main exe
    124127  DestroyTIB();
    125 #endif
    126128  O32_ExitThread(exitcode);
    127129}
     
    153155 WIN32THREADPROC  winthread = me->pCallback;
    154156 LPVOID           userdata  = me->lpUserData;
     157 DWORD            rc;
    155158
    156159  delete me;    //only called once
     
    158161  dprintf(("Win32ThreadProc %d\n", GetCurrentThreadId()));
    159162
    160 #ifdef WIN32_TIBSEL
    161163  TEB *winteb = (TEB *)InitializeTIB();
    162164  if(winteb == NULL) {
     
    170172  thdb->entry_point = (void *)winthread;
    171173  thdb->entry_arg   = (void *)userdata;
     174
    172175  SetWin32TIB();
    173 #else
    174   ReplaceExceptionHandler();
    175 #endif
    176   return(winthread(userdata));
     176  WinExe->tlsAttachThread();              //setup TLS structure of main exe
     177  Win32Dll::tlsAttachThreadToAllDlls(); //setup TLS structures of all dlls
     178  Win32Dll::attachThreadToAllDlls();      //send DLL_THREAD_ATTACH message to all dlls
     179
     180  rc = winthread(userdata);
     181
     182  Win32Dll::detachThreadFromAllDlls();  //send DLL_THREAD_DETACH message to all dlls
     183  Win32Dll::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls
     184  WinExe->tlsDetachThread();              //destroy TLS structure of main exe
     185  DestroyTIB();
     186  return rc;
    177187}
    178188//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.