Ignore:
Timestamp:
Jun 20, 1999, 12:55:37 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

File:
1 edited

Legend:

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

    r125 r126  
    1 /* $Id: wprocess.cpp,v 1.10 1999-06-19 17:58:33 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.11 1999-06-20 10:55:36 sandervl Exp $ */
    22
    33/*
     
    2828#include "cio.h"
    2929#include "versionos2.h"    /*PLF Wed  98-03-18 02:36:51*/
    30 
    31 #include <winprocess.h>
    32 #include <thread.h>
     30#include <wprocess.h>
    3331
    3432BOOL      fExeStarted = FALSE;
     
    4341// Set up the TIB selector and memory for the current thread
    4442//******************************************************************************
    45 void InitializeTIB(BOOL fMainThread)
     43TEB *InitializeTIB(BOOL fMainThread)
    4644{
    4745#ifdef WIN32_TIBSEL
     
    5654        dprintf(("InitializeTIB: local thread memory alloc failed!!"));
    5755        DebugInt3();
    58         return;
     56        return NULL;
    5957   }
    6058   if(OS2AllocSel(PAGE_SIZE, &tibsel) == FALSE)
     
    6260        dprintf(("InitializeTIB: selector alloc failed!!"));
    6361        DebugInt3();
    64         return;
     62        return NULL;
    6563   }
    6664   winteb = (TEB *)OS2SelToFlat(tibsel);
     
    6967        dprintf(("InitializeTIB: DosSelToFlat failed!!"));
    7068        DebugInt3();
    71         return;
     69        return NULL;
    7270   }
    7371   memset(winteb, 0, PAGE_SIZE);
    7472   thdb       = (THDB *)(winteb+1);
    75    TIBFlatPtr = (DWORD)winteb;
     73   TIBFlatPtr = (DWORD *)winteb;
    7674
    7775   winteb->except      = (PVOID)-1;               /* 00 Head of exception handling chain */
     
    105103        ProcessTIBSel = tibsel;
    106104   }
    107    SetFS(tibsel);
    108    dprintf(("InitializeTIB set up TEB with selector %x", tibsel));
    109    return;
     105   dprintf(("InitializeTIB setup TEB with selector %x", tibsel));
     106   return winteb;
     107#else
     108   return 0;
    110109#endif
    111110}
     
    133132        OS2FreeSel(thdb->teb_sel);
    134133   }
    135    else DebugInt3();
    136 
     134   else dprintf(("Already destroyed TIB"));
     135
     136   TIBFlatPtr = NULL;
    137137   return;
     138#endif
     139}
     140/******************************************************************************/
     141/******************************************************************************/
     142void WIN32API RestoreOS2TIB()
     143{
     144#ifdef WIN32_TIBSEL
     145 SHORT  orgtibsel;
     146 TEB   *winteb;
     147 THDB  *thdb;
     148
     149   winteb = (TEB *)TIBFlatPtr;
     150   if(winteb) {
     151        thdb = (THDB *)(winteb+1);
     152        orgtibsel = thdb->OrgTIBSel;
     153
     154        //Restore our original FS selector
     155        SetFS(orgtibsel);
     156   }
     157#endif
     158}
     159/******************************************************************************/
     160/******************************************************************************/
     161void WIN32API SetWin32TIB()
     162{
     163#ifdef WIN32_TIBSEL
     164 SHORT  win32tibsel;
     165 TEB   *winteb;
     166 THDB  *thdb;
     167
     168   winteb = (TEB *)TIBFlatPtr;
     169   if(winteb) {
     170        thdb = (THDB *)(winteb+1);
     171        win32tibsel = thdb->teb_sel;
     172
     173        //Restore our win32 FS selector
     174        SetFS(win32tibsel);
     175   }
     176   else DebugInt3();
    138177#endif
    139178}
     
    175214                    HINSTANCE hinstance)
    176215{
    177 #ifdef WIN32_TIBSEL
    178   SetFS(ProcessTIBSel);
    179 #endif
     216  SetWin32TIB();
    180217
    181218  if(getenv("WIN32_IOPL2")) {
     
    217254//******************************************************************************
    218255VOID WIN32API RegisterDll(LONG Win32TableId, LONG NameTableId,
    219                   LONG VersionResId, LONG Pe2lxVersion,
    220               HINSTANCE hinstance)
     256                          LONG VersionResId, LONG Pe2lxVersion,
     257                          HINSTANCE hinstance)
    221258{
    222259 WIN32DLLENTRY  pfnDllEntry;
     
    237274  /* @@@PH 1998/03/17 console devices initialization */
    238275  iConsoleDevicesRegister();
     276
     277  SetWin32TIB();
     278  dprintf(("RegisterDll: FS = %x", GetFS()));
    239279}
    240280//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.