Changeset 4658 for trunk/src/kernel32


Ignore:
Timestamp:
Nov 21, 2000, 12:36:09 PM (25 years ago)
Author:
sandervl
Message:

Updates for TEB changes

Location:
trunk/src/kernel32
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.DEF

    r4587 r4658  
    1 ; $Id: KERNEL32.DEF,v 1.93 2000-11-13 06:48:54 phaller Exp $
     1; $Id: KERNEL32.DEF,v 1.94 2000-11-21 11:35:07 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    10831083
    10841084   _GetThreadTEB@0                                                @1234
    1085    _GetThreadTHDB@0                                               @1235
    1086    _GetTHDBFromThreadId@4                                         @1255
    1087    _GetTHDBFromThreadHandle@4                                     @1256
     1085   _GetTEBFromThreadId@4                                          @1255
     1086   _GetTEBFromThreadHandle@4                                      @1256
    10881087
    10891088; HEAP Management (heap.cpp, heapstring.cpp)
  • trunk/src/kernel32/hmtoken.cpp

    r2802 r4658  
    1 /* $Id: hmtoken.cpp,v 1.3 2000-02-16 14:24:00 sandervl Exp $ */
     1/* $Id: hmtoken.cpp,v 1.4 2000-11-21 11:35:08 sandervl Exp $ */
    22
    33/*
     
    5252                                          BOOL    OpenAsSelf)
    5353{
    54  THDB *thdb = GetTHDBFromThreadHandle(ThreadHandle);
     54 TEB *teb = GetTEBFromThreadHandle(ThreadHandle);
    5555
    56   if(thdb == 0) {
     56  if(teb == 0) {
    5757        dprintf(("HMDeviceTokenClass::OpenThreadToken: thread handle %x not found", ThreadHandle));
    5858        return ERROR_INVALID_PARAMETER;
    5959  }
    60   pHMHandleData->dwUserData = (DWORD)&thdb->threadinfo;
     60  pHMHandleData->dwUserData = (DWORD)&teb->o.odin.threadinfo;
    6161  pHMHandleData->dwInternalType = HMTYPE_THREADTOKEN;
    6262  return STATUS_SUCCESS;
  • trunk/src/kernel32/lang.cpp

    r4575 r4658  
    1 /* $Id: lang.cpp,v 1.30 2000-11-09 18:18:10 sandervl Exp $ */
     1/* $Id: lang.cpp,v 1.31 2000-11-21 11:35:08 sandervl Exp $ */
    22/*
    33 * Win32 language API functions for OS/2
     
    888888LCID WIN32API GetThreadLocale()
    889889{
    890  THDB *thdb = GetThreadTHDB();
    891 
    892   if(thdb == NULL) {
    893         dprintf(("KERNEL32: ERROR: GetThreadLocale thdb == NULL!"));
     890 TEB *teb = GetThreadTEB();
     891
     892  if(teb == NULL) {
     893        dprintf(("KERNEL32: ERROR: GetThreadLocale teb == NULL!"));
    894894        return FALSE;
    895895  }
    896   dprintf(("KERNEL32: GetThreadLocale returned %x", thdb->lcid));
    897   return(thdb->lcid);
     896  dprintf(("KERNEL32: GetThreadLocale returned %x", teb->o.odin.lcid));
     897  return(teb->o.odin.lcid);
    898898}
    899899//******************************************************************************
     
    901901BOOL WIN32API SetThreadLocale(LCID locale)
    902902{
    903  THDB *thdb = GetThreadTHDB();
     903 TEB *teb = GetThreadTEB();
    904904 
    905   if(thdb == NULL) {
    906         dprintf(("KERNEL32: ERROR SetThreadLocale thdb == NULL!"));
     905  if(teb == NULL) {
     906        dprintf(("KERNEL32: ERROR SetThreadLocale teb == NULL!"));
    907907        return FALSE;
    908908  }
    909909  dprintf(("KERNEL32: SetThreadLocale %x", locale));
    910   thdb->lcid = locale;
     910  teb->o.odin.lcid = locale;
    911911  return(TRUE);
    912912}
  • trunk/src/kernel32/misc.cpp

    r4496 r4658  
    1 /* $Id: misc.cpp,v 1.27 2000-10-18 17:09:33 sandervl Exp $ */
     1/* $Id: misc.cpp,v 1.28 2000-11-21 11:35:08 sandervl Exp $ */
    22
    33/*
     
    289289  if(fLogging && flog && (dwEnableLogging > 0))
    290290  {
    291     THDB *thdb = GetThreadTHDB();
     291    TEB *teb = GetThreadTEB();
    292292
    293293    va_start(argptr, tekst);
    294     if(thdb) {
    295     thdb->logfile = (DWORD)flog;
     294    if(teb) {
     295        teb->o.odin.logfile = (DWORD)flog;
    296296        if(sel == 0x150b && !fIsOS2Image) {
    297         fprintf(flog, "t%d: (FS=150B) ", thdb->threadId);
    298     }
    299     else    fprintf(flog, "t%d: ", thdb->threadId);
     297        fprintf(flog, "t%d: (FS=150B) ", teb->o.odin.threadId);
     298    }
     299    else    fprintf(flog, "t%d: ", teb->o.odin.threadId);
    300300    }
    301301    vfprintf(flog, tekst, argptr);
    302     if(thdb) thdb->logfile = 0;
     302    if(teb) teb->o.odin.logfile = 0;
    303303    va_end(argptr);
    304304
     
    342342  if(fLogging && flog && (dwEnableLogging > 0))
    343343  {
    344     THDB *thdb = GetThreadTHDB();
     344    TEB *teb = GetThreadTEB();
    345345
    346346    va_start(argptr, tekst);
    347     if(thdb) {
    348         thdb->logfile = (DWORD)flog;
     347    if(teb) {
     348        teb->o.odin.logfile = (DWORD)flog;
    349349    }
    350350    vfprintf(flog, tekst, argptr);
    351     if(thdb) thdb->logfile = 0;
     351    if(teb) teb->o.odin.logfile = 0;
    352352    va_end(argptr);
    353353  }
     
    376376  if(fLogging && logfile)
    377377  {
    378     THDB *thdb = GetThreadTHDB();
     378    TEB *teb = GetThreadTEB();
    379379
    380380    va_start(argptr, tekst);
    381     if(thdb) {
    382         thdb->logfile = (DWORD)flog;
     381    if(teb) {
     382        teb->o.odin.logfile = (DWORD)flog;
    383383    }
    384384    vfprintf((FILE *)logfile, tekst, argptr);
    385     if(thdb) thdb->logfile = 0;
     385    if(teb) teb->o.odin.logfile = 0;
    386386    va_end(argptr);
    387387
     
    400400void LogException(int state)
    401401{
    402   THDB *thdb = GetThreadTHDB();
     402  TEB *teb = GetThreadTEB();
    403403  USHORT *lock;
    404404
    405   if(!thdb) return;
    406 
    407   if(thdb->logfile) {
     405  if(!teb) return;
     406
     407  if(teb->o.odin.logfile) {
    408408    if(state == ENTER_EXCEPTION) {
    409409#if (__IBMCPP__ == 300) || (__IBMC__ == 300)
    410         lock = (USHORT *)(thdb->logfile+0x1C);
     410        lock = (USHORT *)(teb->o.odin.logfile+0x1C);
    411411#else
    412412#error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!!
     
    416416    else { //LEAVE_EXCEPTION
    417417#if (__IBMCPP__ == 300) || (__IBMC__ == 300)
    418         lock = (USHORT *)(thdb->logfile+0x1C);
     418        lock = (USHORT *)(teb->o.odin.logfile+0x1C);
    419419#else
    420420#error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!!
     
    431431void CheckLogException()
    432432{
    433   THDB *thdb = GetThreadTHDB();
     433  TEB *teb = GetThreadTEB();
    434434  USHORT *lock;
    435435
    436   if(!thdb) return;
    437 
    438   if(thdb->logfile) {
     436  if(!teb) return;
     437
     438  if(teb->o.odin.logfile) {
    439439    //oops, exception in vfprintf; let's clear the lock count
    440440#if (__IBMCPP__ == 300) || (__IBMC__ == 300)
    441     lock = (USHORT *)(thdb->logfile+0x1C);
     441    lock = (USHORT *)(teb->o.odin.logfile+0x1C);
    442442#else
    443443#error Check the offset of the lock count word in the file stream structure for this compiler revision!!!!!
  • trunk/src/kernel32/oslibexcept.cpp

    r4229 r4658  
    1 /* $Id: oslibexcept.cpp,v 1.4 2000-09-09 08:59:55 sandervl Exp $ */
     1/* $Id: oslibexcept.cpp,v 1.5 2000-11-21 11:35:08 sandervl Exp $ */
    22/*
    33 * Exception handler util. procedures
     
    128128  }
    129129
    130   TEB  *winteb = GetThreadTEB();
    131   THDB *thdb   = (THDB *)(winteb+1);
     130  TEB *winteb = GetThreadTEB();
    132131
    133132  if(pContextRec->ContextFlags & CONTEXT_SEGMENTS) {
     
    136135//   This resets FS to 0x150B - we DON'T want that!!
    137136//      wincontextrec.SegFs   = pContextRec->ctx_SegFs;
    138         wincontextrec.SegFs   = thdb->teb_sel;
     137        wincontextrec.SegFs   = winteb->teb_sel;
    139138        wincontextrec.SegEs   = pContextRec->ctx_SegEs;
    140139        wincontextrec.SegDs   = pContextRec->ctx_SegDs;
     
    153152  // fuck up the Win32 exception handlers. They could end up using the wrong
    154153  // exception chain if they access FS:[0] directly.
    155   DWORD oldsel = SetReturnFS(thdb->teb_sel);
     154  DWORD oldsel = SetReturnFS(winteb->teb_sel);
    156155
    157156  switch(pReportRec->ExceptionNum) {
  • trunk/src/kernel32/process.cpp

    r4496 r4658  
    1 /* $Id: process.cpp,v 1.7 2000-10-18 17:09:33 sandervl Exp $ */
     1/* $Id: process.cpp,v 1.8 2000-11-21 11:35:09 sandervl Exp $ */
    22
    33/*
     
    322322    case GPD_THDB:
    323323        if ( process != PROCESS_Current() ) return 0;
    324         return (DWORD)GetThreadTHDB();
     324        return (DWORD)GetThreadTEB() + 0x30;
    325325
    326326    case GPD_PDB:
  • trunk/src/kernel32/thread.cpp

    r3422 r4658  
    1 /* $Id: thread.cpp,v 1.25 2000-04-18 20:06:38 sandervl Exp $ */
     1/* $Id: thread.cpp,v 1.26 2000-11-21 11:35:09 sandervl Exp $ */
    22
    33/*
     
    4848HANDLE WIN32API GetCurrentThread()
    4949{
    50  THDB *thdb;
     50 TEB *teb;
    5151
    52     thdb = GetThreadTHDB();
    53     if(thdb == 0) {
     52    teb = GetThreadTEB();
     53    if(teb == 0) {
    5454        SetLastError(ERROR_INVALID_HANDLE); //todo
    5555        return 0;
    5656    }
    57     return thdb->hThread;
     57    return teb->o.odin.hThread;
    5858}
    5959//******************************************************************************
     
    6262{
    6363 EXCEPTION_FRAME *exceptFrame;
    64  THDB            *thdb;
     64 TEB             *teb;
    6565
    6666  dprintf(("ExitThread %x (%x)", GetCurrentThread(), exitcode));
    6767
    68   thdb = GetThreadTHDB();
    69   if(thdb != 0) {
    70         exceptFrame = (EXCEPTION_FRAME *)thdb->exceptFrame;
     68  teb = GetThreadTEB();
     69  if(teb != 0) {
     70        exceptFrame = (EXCEPTION_FRAME *)teb->o.odin.exceptFrame;
    7171  }
    7272  else  DebugInt3();
     
    113113  winteb->flags = me->dwFlags;
    114114
    115   THDB *thdb   = (THDB *)(winteb+1);
    116   thdb->entry_point = (void *)winthread;
    117   thdb->entry_arg   = (void *)userdata;
    118   thdb->hThread     = hThread;
     115  winteb->entry_point = (void *)winthread;
     116  winteb->entry_arg   = (void *)userdata;
     117  winteb->o.odin.hThread = hThread;
    119118
    120   thdb->hab = OSLibWinInitialize();
    121   thdb->hmq = OSLibWinQueryMsgQueue(thdb->hab);
    122   dprintf(("Win32ThreadProc: hab %x hmq %x", thdb->hab, thdb->hmq));
     119  winteb->o.odin.hab = OSLibWinInitialize();
     120  winteb->o.odin.hmq = OSLibWinQueryMsgQueue(winteb->o.odin.hab);
     121  dprintf(("Win32ThreadProc: hab %x hmq %x", winteb->o.odin.hab, winteb->o.odin.hmq));
    123122
    124123  //Note: The Win32 exception structure referenced by FS:[0] is the same
    125124  //      in OS/2
    126125  OS2SetExceptionHandler((void *)&exceptFrame);
    127   thdb->exceptFrame = (ULONG)&exceptFrame;
     126  winteb->o.odin.exceptFrame = (ULONG)&exceptFrame;
    128127
    129128  SetWin32TIB();
     
    137136
    138137  HMSetThreadTerminated(GetCurrentThread());
    139   thdb->exceptFrame = 0;
     138  winteb->o.odin.exceptFrame = 0;
    140139  Win32DllBase::detachThreadFromAllDlls();  //send DLL_THREAD_DETACH message to all dlls
    141140  Win32DllBase::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls
  • trunk/src/kernel32/windllbase.cpp

    r4545 r4658  
    1 /* $Id: windllbase.cpp,v 1.21 2000-10-30 16:38:54 sandervl Exp $ */
     1/* $Id: windllbase.cpp,v 1.22 2000-11-21 11:35:09 sandervl Exp $ */
    22
    33/*
     
    387387 WINEXCEPTION_FRAME exceptFrame;
    388388 USHORT sel;
    389  THDB *thdb;
     389 TEB *teb;
    390390 BOOL rc, fSetExceptionHandler;
    391391
     
    395395    fAttachedToProcess = TRUE;
    396396
    397     thdb = GetThreadTHDB();
    398     fSetExceptionHandler = (!thdb || thdb->teb_sel != GetFS());
     397    teb = GetThreadTEB();
     398    fSetExceptionHandler = (!teb || teb->teb_sel != GetFS());
    399399
    400400    //Note: The Win32 exception structure references by FS:[0] is the same
     
    440440    }
    441441    else
    442     if(thdb) {
    443         if(thdb->teb_sel != GetFS()) {
     442    if(teb) {
     443        if(teb->teb_sel != GetFS()) {
    444444            dprintf(("Win32DllBase::attachProcess: FS was changed by dll entrypoint!!!!"));
    445445            DebugInt3();
  • trunk/src/kernel32/wintls.cpp

    r4481 r4658  
    1 /* $Id: wintls.cpp,v 1.15 2000-10-11 07:22:29 sandervl Exp $ */
     1/* $Id: wintls.cpp,v 1.16 2000-11-21 11:35:09 sandervl Exp $ */
    22/*
    33 * Win32 TLS API functions
     
    140140{
    141141 DWORD index = -1;
    142  THDB *thdb;
     142 TEB  *teb;
    143143 PDB  *pdb;
    144144 DWORD mask, tibidx;
    145145 int   i;
    146146
    147   thdb = GetThreadTHDB();
     147  teb  = GetThreadTEB();
    148148  pdb  = PROCESS_Current();
    149149
     
    167167  }
    168168  LeaveCriticalSection(&pdb->crit_section);
    169   thdb->tls_array[index] = 0;
     169  teb->tls_array[index] = 0;
    170170
    171171  dprintf(("KERNEL32: TlsAlloc returned %d", index));
     
    176176BOOL WIN32API TlsFree(DWORD index)
    177177{
    178  THDB  *thdb;
     178 TEB   *teb;
    179179 PDB   *pdb;
    180180 int    tlsidx;
     
    188188  }
    189189
    190   thdb = GetThreadTHDB();
    191   pdb  = PROCESS_Current();
     190  teb = GetThreadTEB();
     191  pdb = PROCESS_Current();
    192192
    193193  EnterCriticalSection(&pdb->crit_section);
     
    200200        LeaveCriticalSection(&pdb->crit_section);
    201201        pdb->tls_bits[tlsidx] &= ~mask;
    202         thdb->tls_array[index] = 0;
     202        teb->tls_array[index] = 0;
    203203        SetLastError(ERROR_SUCCESS);
    204204        return TRUE;
     
    213213{
    214214 LPVOID rc;
    215  THDB  *thdb;
     215 TEB   *teb;
    216216
    217217  if(index >= TLS_MINIMUM_AVAILABLE)
     
    222222  SetLastError(ERROR_SUCCESS);
    223223
    224   thdb = GetThreadTHDB();
    225   rc = thdb->tls_array[index];
     224  teb = GetThreadTEB();
     225  rc = teb->tls_array[index];
    226226
    227227  dprintf2(("KERNEL32: TlsGetValue %d returned %X\n", index, rc));
     
    232232BOOL WIN32API TlsSetValue(DWORD index, LPVOID val)
    233233{
    234  THDB *thdb;
     234 TEB *teb;
    235235
    236236  dprintf2(("KERNEL32: TlsSetValue %d %x", index, val));
     
    242242  SetLastError(ERROR_SUCCESS);
    243243
    244   thdb = GetThreadTHDB();
    245   thdb->tls_array[index] = val;
     244  teb = GetThreadTEB();
     245  teb->tls_array[index] = val;
    246246  return TRUE;
    247247}
  • trunk/src/kernel32/wprocess.cpp

    r4555 r4658  
    1 /* $Id: wprocess.cpp,v 1.107 2000-11-05 13:40:47 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.108 2000-11-21 11:35:09 sandervl Exp $ */
    22
    33/*
     
    7171
    7272//list of thread database structures
    73 static THDB     *threadList = 0;
     73static TEB      *threadList = 0;
    7474static VMutex    threadListMutex;
    7575
     
    100100//******************************************************************************
    101101//******************************************************************************
    102 THDB *WIN32API GetThreadTHDB()
    103 {
    104  TEB  *winteb;
    105  THDB *thdb;
    106 
    107     if(TIBFlatPtr == NULL)
    108         return 0;
    109 
    110     winteb = (TEB *)*TIBFlatPtr;
    111     if(winteb == NULL) {
    112         return NULL;
    113     }
    114     thdb = (THDB *)(winteb+1);
    115 
    116     return thdb;
    117 }
    118 //******************************************************************************
    119 //******************************************************************************
    120 THDB *WIN32API GetTHDBFromThreadId(ULONG threadId)
    121 {
    122  THDB *thdb = threadList;
     102TEB *WIN32API GetTEBFromThreadId(ULONG threadId)
     103{
     104 TEB *teb = threadList;
    123105
    124106    threadListMutex.enter();
    125     while(thdb) {
    126         if(thdb->threadId == threadId) {
     107    while(teb) {
     108        if(teb->o.odin.threadId == threadId) {
    127109            break;
    128110        }
    129         thdb = thdb->next;
     111        teb = teb->o.odin.next;
    130112    }
    131113    threadListMutex.leave();
    132     return thdb;
    133 }
    134 //******************************************************************************
    135 //******************************************************************************
    136 THDB *WIN32API GetTHDBFromThreadHandle(HANDLE hThread)
    137 {
    138  THDB *thdb = threadList;
     114    return teb;
     115}
     116//******************************************************************************
     117//******************************************************************************
     118TEB *WIN32API GetTEBFromThreadHandle(HANDLE hThread)
     119{
     120 TEB *teb = threadList;
    139121
    140122    threadListMutex.enter();
    141     while(thdb) {
    142         if(thdb->hThread == hThread) {
     123    while(teb) {
     124        if(teb->o.odin.hThread == hThread) {
    143125            break;
    144126        }
    145         thdb = thdb->next;
     127        teb = teb->o.odin.next;
    146128    }
    147129    threadListMutex.leave();
    148     return thdb;
     130    return teb;
    149131}
    150132//******************************************************************************
     
    154136{
    155137  TEB   *winteb;
    156   THDB  *thdb;
    157138  ULONG  hThreadMain;
    158139  USHORT tibsel;
     
    170151        hThreadMain = HMCreateThread(NULL, 0, 0, 0, 0, 0, TRUE);
    171152    }
    172     if(OSLibAllocSel(PAGE_SIZE, &tibsel) == FALSE)
     153    if(OSLibAllocSel(sizeof(TEB), &tibsel) == FALSE)
    173154    {
    174155        dprintf(("InitializeTIB: selector alloc failed!!"));
     
    183164        return NULL;
    184165    }
    185     memset(winteb, 0, PAGE_SIZE);
    186     thdb       = (THDB *)(winteb+1);
     166    memset(winteb, 0, sizeof(TEB));
    187167    *TIBFlatPtr = (DWORD)winteb;
    188168
     
    195175    winteb->flags       = TEBF_WIN32;              /* 1c Flags */
    196176    winteb->queue       = 0;                       /* 28 Message queue */
    197     winteb->tls_ptr     = &thdb->tls_array[0];     /* 2c Pointer to TLS array */
     177    winteb->tls_ptr     = &winteb->tls_array[0];   /* 2c Pointer to TLS array */
    198178    winteb->process     = &ProcessPDB;             /* 30 owning process (used by NT3.51 applets)*/
    199179
    200     memcpy(&thdb->teb, winteb, sizeof(TEB));
    201     thdb->process         = &ProcessPDB;
    202     thdb->exit_code       = 0x103; /* STILL_ACTIVE */
    203     thdb->teb_sel         = tibsel;
    204     thdb->OrgTIBSel       = GetFS();
    205     thdb->pWsockData      = NULL;
    206     thdb->threadId        = GetCurrentThreadId();
     180    winteb->process         = &ProcessPDB;
     181    winteb->exit_code       = 0x103; /* STILL_ACTIVE */
     182    winteb->teb_sel         = tibsel;
     183    winteb->o.odin.OrgTIBSel       = GetFS();
     184    winteb->o.odin.pWsockData      = NULL;
     185    winteb->o.odin.threadId        = GetCurrentThreadId();
    207186    if(fMainThread) {
    208         thdb->hThread     = hThreadMain;
    209     }
    210     else thdb->hThread    = GetCurrentThread();
    211     thdb->lcid            = GetUserDefaultLCID();
     187         winteb->o.odin.hThread     = hThreadMain;
     188    }
     189    else winteb->o.odin.hThread    = GetCurrentThread();
     190    winteb->o.odin.lcid            = GetUserDefaultLCID();
    212191
    213192    threadListMutex.enter();
    214     THDB *thdblast        = threadList;
    215     if(!thdblast) {
    216         threadList = thdb;
     193    TEB *teblast        = threadList;
     194    if(!teblast) {
     195        threadList = winteb;
    217196    }
    218197    else {
    219         while(thdblast->next) {
    220             thdblast = thdblast->next;
    221         }
    222         thdblast->next   = thdb;
    223     }
    224     thdb->next            = NULL;
     198        while(teblast->o.odin.next) {
     199            teblast = teblast->o.odin.next;
     200        }
     201        teblast->o.odin.next = winteb;
     202    }
     203    winteb->o.odin.next        = NULL;
    225204    threadListMutex.leave();
    226205
    227206    if(OSLibGetPIB(PIB_TASKTYPE) == TASKTYPE_PM)
    228207    {
    229         thdb->flags      = 0;  //todo gui
    230     }
    231     else thdb->flags      = 0;  //todo textmode
     208         winteb->flags      = 0;  //todo gui
     209    }
     210    else winteb->flags      = 0;  //todo textmode
    232211
    233212    //Initialize thread security objects (TODO: Not complete)
     
    240219    }
    241220    SID_IDENTIFIER_AUTHORITY sidIdAuth = {0};
    242     thdb->threadinfo.dwType = SECTYPE_PROCESS | SECTYPE_INITIALIZED;
    243     RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &thdb->threadinfo.SidUser.User.Sid);
    244     thdb->threadinfo.SidUser.User.Attributes = 0; //?????????
    245 
    246     thdb->threadinfo.pTokenGroups = (TOKEN_GROUPS*)malloc(sizeof(TOKEN_GROUPS));
    247     thdb->threadinfo.pTokenGroups->GroupCount = 1;
    248     RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &thdb->threadinfo.PrimaryGroup.PrimaryGroup);
    249     thdb->threadinfo.pTokenGroups->Groups[0].Sid = thdb->threadinfo.PrimaryGroup.PrimaryGroup;
    250     thdb->threadinfo.pTokenGroups->Groups[0].Attributes = 0; //????
     221    winteb->o.odin.threadinfo.dwType = SECTYPE_PROCESS | SECTYPE_INITIALIZED;
     222    RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &winteb->o.odin.threadinfo.SidUser.User.Sid);
     223    winteb->o.odin.threadinfo.SidUser.User.Attributes = 0; //?????????
     224
     225    winteb->o.odin.threadinfo.pTokenGroups = (TOKEN_GROUPS*)malloc(sizeof(TOKEN_GROUPS));
     226    winteb->o.odin.threadinfo.pTokenGroups->GroupCount = 1;
     227    RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &winteb->o.odin.threadinfo.PrimaryGroup.PrimaryGroup);
     228    winteb->o.odin.threadinfo.pTokenGroups->Groups[0].Sid = winteb->o.odin.threadinfo.PrimaryGroup.PrimaryGroup;
     229    winteb->o.odin.threadinfo.pTokenGroups->Groups[0].Attributes = 0; //????
    251230//        pPrivilegeSet   = NULL;
    252231//        pTokenPrivileges= NULL;
     
    254233//        DefaultDACL     = {0};
    255234//        TokenSource     = {0};
    256     thdb->threadinfo.TokenType = TokenPrimary;
     235    winteb->o.odin.threadinfo.TokenType = TokenPrimary;
    257236
    258237    if(fMainThread)
     
    293272 SHORT  orgtibsel;
    294273 TEB   *winteb;
    295  THDB  *thdb;
    296274
    297275    dprintf(("DestroyTIB: FS     = %x", GetFS()));
     
    300278    winteb = (TEB *)*TIBFlatPtr;
    301279    if(winteb) {
    302         thdb = (THDB *)(winteb+1);
    303         orgtibsel = thdb->OrgTIBSel;
     280        orgtibsel = winteb->o.odin.OrgTIBSel;
     281
     282        dprintf(("DestroyTIB: OSLibFreeSel %x", winteb->teb_sel));
    304283
    305284        threadListMutex.enter();
    306         THDB *curthdb        = threadList;
    307         if(curthdb == thdb) {
    308             threadList = thdb->next;
     285        TEB *curteb        = threadList;
     286        if(curteb == winteb) {
     287            threadList = winteb->o.odin.next;
    309288        }
    310289        else {
    311             while(curthdb->next != thdb) {
    312                 curthdb = curthdb->next;
    313                 if(curthdb == NULL) {
    314                     dprintf(("DestroyTIB: couldn't find thdb %x", thdb));
     290            while(curteb->o.odin.next != winteb) {
     291                curteb = curteb->o.odin.next;
     292                if(curteb == NULL) {
     293                    dprintf(("DestroyTIB: couldn't find teb %x", winteb));
    315294                    DebugInt3();
    316295                    break;
    317296                }
    318297            }
    319             if(curthdb) {
    320                 curthdb->next = thdb->next;
     298            if(curteb) {
     299                curteb->o.odin.next = winteb->o.odin.next;
    321300            }
    322301        }
     
    327306
    328307        //And free our own
    329         OSLibFreeSel(thdb->teb_sel);
     308        OSLibFreeSel(winteb->teb_sel);
    330309
    331310        *TIBFlatPtr = 0;
     
    348327 SHORT  orgtibsel;
    349328 TEB   *winteb;
    350  THDB  *thdb;
    351329
    352330   //If we're running an Odin32 OS/2 application (not converted!), then we
     
    358336    winteb = (TEB *)*TIBFlatPtr;
    359337    if(winteb) {
    360         thdb = (THDB *)(winteb+1);
    361         orgtibsel = thdb->OrgTIBSel;
     338        orgtibsel = winteb->o.odin.OrgTIBSel;
    362339
    363340        //Restore our original FS selector
     
    371348 SHORT  win32tibsel;
    372349 TEB   *winteb;
    373  THDB  *thdb;
    374350
    375351    //If we're running an Odin32 OS/2 application (not converted!), then we
     
    381357    winteb = (TEB *)*TIBFlatPtr;
    382358    if(winteb) {
    383         thdb = (THDB *)(winteb+1);
    384         win32tibsel = thdb->teb_sel;
     359        win32tibsel = winteb->teb_sel;
    385360
    386361        //Restore our win32 FS selector
     
    395370            return GetFS();
    396371        }
    397         thdb = (THDB *)(winteb+1);
    398         win32tibsel = thdb->teb_sel;
     372        win32tibsel = winteb->teb_sel;
    399373
    400374        //Restore our win32 FS selector
     
    15381512                            LPPROCESS_INFORMATION lpProcessInfo )
    15391513{
    1540  THDB *pThreadDB = (THDB*)GetThreadTHDB();
     1514 TEB *pThreadDB = (TEB*)GetThreadTEB();
    15411515 char *cmdline = NULL;
    15421516 BOOL  rc;
     
    15571531      if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL)
    15581532      {
    1559         if(pThreadDB->pidDebuggee != 0)
     1533        if(pThreadDB->o.odin.pidDebuggee != 0)
    15601534        {
    15611535          // TODO: handle this
     
    15641538        else
    15651539        {
    1566           pThreadDB->pidDebuggee = lpProcessInfo->dwProcessId;
    1567           OSLibStartDebugger((ULONG*)&pThreadDB->pidDebuggee);
     1540          pThreadDB->o.odin.pidDebuggee = lpProcessInfo->dwProcessId;
     1541          OSLibStartDebugger((ULONG*)&pThreadDB->o.odin.pidDebuggee);
    15681542        }
    15691543      }
    1570       else pThreadDB->pidDebuggee = 0;
     1544      else pThreadDB->o.odin.pidDebuggee = 0;
    15711545
    15721546      return(TRUE);
     
    16481622      if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL)
    16491623      {
    1650         if(pThreadDB->pidDebuggee != 0)
     1624        if(pThreadDB->o.odin.pidDebuggee != 0)
    16511625        {
    16521626          // TODO: handle this
     
    16551629        else
    16561630        {
    1657           pThreadDB->pidDebuggee = lpProcessInfo->dwProcessId;
    1658           OSLibStartDebugger((ULONG*)&pThreadDB->pidDebuggee);
     1631          pThreadDB->o.odin.pidDebuggee = lpProcessInfo->dwProcessId;
     1632          OSLibStartDebugger((ULONG*)&pThreadDB->o.odin.pidDebuggee);
    16591633        }
    16601634      }
    16611635      else
    1662         pThreadDB->pidDebuggee = 0;
     1636        pThreadDB->o.odin.pidDebuggee = 0;
    16631637    }
    16641638    if(cmdline)
Note: See TracChangeset for help on using the changeset viewer.