Changeset 4658 for trunk/src


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

Updates for TEB changes

Location:
trunk/src
Files:
17 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)
  • trunk/src/user32/HOOK.CPP

    r4430 r4658  
    1 /* $Id: HOOK.CPP,v 1.15 2000-10-05 13:47:06 sandervl Exp $ */
     1/* $Id: HOOK.CPP,v 1.16 2000-11-21 11:36:07 sandervl Exp $ */
    22
    33/*
     
    240240  MESSAGEQUEUE *queue;
    241241  HANDLE hook = 0;
    242   THDB *thdb;
    243 
    244     thdb = GetTHDBFromThreadId(threadId);
    245     if(thdb) {
    246         hook = thdb->hooks[id - WH_MINHOOK];
     242  TEB *teb;
     243
     244    teb = GetTEBFromThreadId(threadId);
     245    if(teb) {
     246        hook = teb->o.odin.hooks[id - WH_MINHOOK];
    247247    }
    248248    if (!hook) hook = HOOK_systemHooks[id - WH_MINHOOK];
     
    261261{
    262262  HOOKDATA *data;
    263   THDB     *thdb;
     263  TEB      *teb;
    264264
    265265    if ((id < WH_MINHOOK) || (id > WH_MAXHOOK) || !proc )
     
    301301    if(dwThreadId)
    302302    {
    303         thdb = GetTHDBFromThreadId(dwThreadId);
    304         if(!thdb) {
     303        teb = GetTEBFromThreadId(dwThreadId);
     304        if(!teb) {
    305305                dprintf(("HOOK_SetHook: can't find thread database for thread %x", dwThreadId));
    306306                return 0;
    307307        }
    308308        threadHookMutex.enter();
    309         data->next = thdb->hooks[id - WH_MINHOOK];
    310         thdb->hooks[id - WH_MINHOOK] = (DWORD)data;
     309        data->next = teb->o.odin.hooks[id - WH_MINHOOK];
     310        teb->o.odin.hooks[id - WH_MINHOOK] = (DWORD)data;
    311311        threadHookMutex.leave();
    312312    }
     
    331331{
    332332  HOOKDATA **prevHook;
    333   THDB     *thdb;
     333  TEB       *teb;
    334334
    335335    dprintf(("Removing hook %08x\n", data));
     
    351351    if (data->ownerThread)
    352352    {
    353         thdb = GetTHDBFromThreadId(data->ownerThread);
    354         if(!thdb) {
     353        teb = GetTEBFromThreadId(data->ownerThread);
     354        if(!teb) {
    355355                dprintf(("HOOK_RemoveHook: can't find thread database for thread %x", data->ownerThread));
    356356                return FALSE;
    357357        }
    358358        threadHookMutex.enter();
    359         prevHook = (HOOKDATA **)&thdb->hooks[data->id - WH_MINHOOK];
     359        prevHook = (HOOKDATA **)&teb->o.odin.hooks[data->id - WH_MINHOOK];
    360360    }
    361361    else {
  • trunk/src/user32/oslibmsg.cpp

    r3525 r4658  
    1 /* $Id: oslibmsg.cpp,v 1.33 2000-05-12 18:09:40 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.34 2000-11-21 11:36:08 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    7878   WM_CHAR,          WINWM_KEYLAST,
    7979
    80    WM_COMMAND,       WINWM_COMMAND,
    81    WM_SYSCOMMAND,    WINWM_SYSCOMMAND,
    8280   //
    8381   WM_TIMER,         WINWM_TIMER,
    84    WM_INITMENU,      WINWM_INITMENU,
     82
    8583   //
    8684   WM_MOUSEMOVE,     WINWM_MOUSEMOVE,
     
    9997#define MAX_MSGTRANSTAB (sizeof(MsgTransTab)/sizeof(MsgTransTab[0]))
    10098
    101 LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
    102 
    10399//******************************************************************************
    104100//******************************************************************************
     
    134130    }
    135131
    136     return 0;
     132    //not found, probaby WIN32APP_POSTMSG
     133    return WIN32APP_POSTMSG;
    137134}
    138135//******************************************************************************
     
    149146LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode)
    150147{
    151  THDB *thdb;
     148 TEB  *teb;
    152149 QMSG  os2msg;
    153150 LONG  rc;
    154151
    155   thdb = GetThreadTHDB();
    156   if(thdb == NULL) {
     152  teb = GetThreadTEB();
     153  if(teb == NULL) {
    157154        DebugInt3();
    158155        return FALSE;
     
    162159  //  WinToOS2MsgTranslate(msg, &qmsg, isUnicode);
    163160
    164   if(!memcmp(msg, &thdb->winmsg, sizeof(MSG)) || msg->hwnd == 0) {
    165         memcpy(&os2msg, &thdb->os2msg, sizeof(QMSG));
    166         thdb->os2msg.time = -1;
    167         thdb->winmsg.time = -1;
     161  if(!memcmp(msg, &teb->o.odin.winmsg, sizeof(MSG)) || msg->hwnd == 0) {
     162        memcpy(&os2msg, &teb->o.odin.os2msg, sizeof(QMSG));
     163        teb->o.odin.os2msg.time = -1;
     164        teb->o.odin.winmsg.time = -1;
    168165        if(msg->hwnd) {
    169                 thdb->nrOfMsgs = 1;
    170                 thdb->msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg
    171                 memcpy(&thdb->msg, msg, sizeof(MSG));
     166                teb->o.odin.nrOfMsgs = 1;
     167                teb->o.odin.msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg
     168                memcpy(&teb->o.odin.msg, msg, sizeof(MSG));
    172169        }
    173170        if(os2msg.hwnd || os2msg.msg == WM_QUIT) {
    174                 memset(&thdb->os2msg, 0, sizeof(thdb->os2msg));
    175                 memset(&thdb->winmsg, 0, sizeof(thdb->winmsg));
    176                 return (LONG)WinDispatchMsg(thdb->hab, &os2msg);
     171                memset(&teb->o.odin.os2msg, 0, sizeof(teb->o.odin.os2msg));
     172                memset(&teb->o.odin.winmsg, 0, sizeof(teb->o.odin.winmsg));
     173                return (LONG)WinDispatchMsg(teb->o.odin.hab, &os2msg);
    177174        }
    178175        //SvL: Don't dispatch messages sent by PostThreadMessage (correct??)
     
    192189{
    193190 BOOL rc, eaten;
    194  THDB *thdb;
     191 TEB  *teb;
    195192 QMSG  os2msg;
    196193 HWND  hwndOS2 = 0;
     194 ULONG filtermin, filtermax;
    197195
    198196  if(hwnd) {
     
    206204  }
    207205
    208   thdb = GetThreadTHDB();
    209   if(thdb == NULL) {
     206  teb = GetThreadTEB();
     207  if(teb == NULL) {
    210208        DebugInt3();
    211209        return TRUE;
    212210  }
    213211
    214   if(thdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) {
     212  if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) {
    215213        if(uMsgFilterMin) {
    216             if(thdb->msgWCHAR.message < uMsgFilterMin)
     214            if(teb->o.odin.msgWCHAR.message < uMsgFilterMin)
    217215                goto continuegetmsg;
    218216        }
    219217        if(uMsgFilterMax) {
    220             if(thdb->msgWCHAR.message > uMsgFilterMax)
     218            if(teb->o.odin.msgWCHAR.message > uMsgFilterMax)
    221219                goto continuegetmsg;
    222220        }
    223         thdb->fTranslated = FALSE;
    224         memcpy(pMsg, &thdb->msgWCHAR, sizeof(MSG));
    225         thdb->os2msg.msg  = 0;
    226         thdb->os2msg.hwnd = 0;
     221        teb->o.odin.fTranslated = FALSE;
     222        memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG));
     223        teb->o.odin.os2msg.msg  = 0;
     224        teb->o.odin.os2msg.hwnd = 0;
    227225        return (pMsg->message != WINWM_QUIT);
    228226  }
     
    230228continuegetmsg:
    231229  if(hwnd) {
     230        filtermin = TranslateWinMsg(uMsgFilterMin, TRUE);
     231        filtermax = TranslateWinMsg(uMsgFilterMax, FALSE);
     232        if(filtermin > filtermax) {
     233                ULONG tmp = filtermin;
     234                filtermin = filtermax;
     235                filtermax = filtermin;
     236        }
    232237        do {
    233             WinWaitMsg(thdb->hab, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE));
    234             rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode);
     238                WinWaitMsg(teb->o.odin.hab, filtermin, filtermax);
     239                rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode);
    235240        }
    236241        while(rc == FALSE);
     
    240245  else
    241246  {
    242     do {
    243         eaten = FALSE;
    244         rc = WinGetMsg(thdb->hab, &os2msg, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE), 0);
    245         if (os2msg.msg == WM_TIMER)
    246             eaten = TIMER_HandleTimer(&os2msg);
    247     } while (eaten);
    248   }
    249 
    250   OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, MSG_REMOVE);
    251   memcpy(&thdb->os2msg, &os2msg, sizeof(QMSG));
    252   memcpy(&thdb->winmsg, pMsg, sizeof(MSG));
     247        filtermin = TranslateWinMsg(uMsgFilterMin, TRUE);
     248        filtermax = TranslateWinMsg(uMsgFilterMax, FALSE);
     249        if(filtermin > filtermax) {
     250                ULONG tmp = filtermin;
     251                filtermin = filtermax;
     252                filtermax = filtermin;
     253        }
     254        do {
     255                eaten = FALSE;
     256                rc = WinGetMsg(teb->o.odin.hab, &os2msg, filtermin, filtermax, 0);
     257                if (os2msg.msg == WM_TIMER)
     258                    eaten = TIMER_HandleTimer(&os2msg);
     259        } while (eaten);
     260  }
     261
     262  OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, MSG_REMOVE);
     263  memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG));
     264  memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG));
    253265
    254266  if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN)
     
    275287{
    276288 BOOL  rc, eaten;
    277  THDB *thdb;
     289 TEB  *teb;
    278290 QMSG  os2msg;
    279291 HWND  hwndOS2 = 0;
     
    288300  }
    289301
    290   thdb = GetThreadTHDB();
    291   if(thdb == NULL) {
     302  teb = GetThreadTEB();
     303  if(teb == NULL) {
    292304        DebugInt3();
    293305        return FALSE;
    294306  }
    295307
    296   if(thdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) {
     308  if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) {
    297309        if(uMsgFilterMin) {
    298             if(thdb->msgWCHAR.message < uMsgFilterMin)
     310            if(teb->o.odin.msgWCHAR.message < uMsgFilterMin)
    299311                goto continuepeekmsg;
    300312        }
    301313        if(uMsgFilterMax) {
    302             if(thdb->msgWCHAR.message > uMsgFilterMax)
     314            if(teb->o.odin.msgWCHAR.message > uMsgFilterMax)
    303315                goto continuepeekmsg;
    304316        }
    305317
    306318        if(fRemove & PM_REMOVE_W) {
    307             thdb->fTranslated = FALSE;
    308             thdb->os2msg.msg  = 0;
    309             thdb->os2msg.hwnd = 0;
    310         }
    311         memcpy(pMsg, &thdb->msgWCHAR, sizeof(MSG));
     319            teb->o.odin.fTranslated = FALSE;
     320            teb->o.odin.os2msg.msg  = 0;
     321            teb->o.odin.os2msg.hwnd = 0;
     322        }
     323        memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG));
    312324        return TRUE;
    313325  }
     
    316328  do {
    317329        eaten = FALSE;
    318         rc = WinPeekMsg(thdb->hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE),
     330        rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE),
    319331                        TranslateWinMsg(uMsgFilterMax, FALSE), (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE);
    320332
     
    329341  }
    330342
    331   OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE);
     343  OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE);
    332344  //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message
    333345  if(fRemove & PM_REMOVE_W) {
    334         memcpy(&thdb->os2msg, &os2msg, sizeof(QMSG));
    335         memcpy(&thdb->winmsg, pMsg, sizeof(MSG));
     346        memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG));
     347        memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG));
    336348  }
    337349
     
    460472BOOL OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
    461473{
    462 // THDB *thdb = GetTHDBFromThreadId(threadid);
     474// TEB *teb = GetTEBFromThreadId(threadid);
    463475 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    464476
    465 //    if(thdb == NULL) {
     477//    if(teb == NULL) {
    466478//        dprintf(("OSLibPostThreadMessage: thread %x not found!", threadid));
    467479//        return FALSE;
  • trunk/src/user32/oslibmsgtranslate.cpp

    r4599 r4658  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.38 2000-11-15 20:30:46 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.39 2000-11-21 11:36:08 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    132132//******************************************************************************
    133133//******************************************************************************
    134 BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved)
     134BOOL OS2ToWinMsgTranslate(void *pTeb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved)
    135135{
    136136  Win32BaseWindow *win32wnd = 0;
    137137  OSLIBPOINT       point, ClientPoint;
    138138  POSTMSG_PACKET  *packet;
    139   THDB            *thdb = (THDB *)pThdb;
     139  TEB             *teb = (TEB *)pTeb;
    140140  BOOL             fWasDisabled = FALSE;
    141141  int i;
     
    176176    case WM_CREATE:
    177177    {
    178         if(thdb->newWindow == 0) {
     178        if(teb->o.odin.newWindow == 0) {
    179179            DebugInt3();
    180180            goto dummymessage;
    181181        }
    182182
    183         win32wnd = (Win32BaseWindow *)thdb->newWindow;
     183        win32wnd = (Win32BaseWindow *)teb->o.odin.newWindow;
    184184
    185185        winMsg->message = WINWM_CREATE;
     
    233233        }
    234234        if(win32wnd->getParent()) {
    235               OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, win32wnd->getParent()->getWindowHeight(),
     235              OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, win32wnd->getParent()->getWindowHeight(),
    236236                                     win32wnd->getParent()->getClientRectPtr()->left,
    237237                                     win32wnd->getParent()->getClientRectPtr()->top,
    238238                                     win32wnd->getOS2WindowHandle());
    239239        }
    240         else  OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, win32wnd->getOS2WindowHandle());
     240        else  OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, win32wnd->getOS2WindowHandle());
    241241
    242242        if (!win32wnd->CanReceiveSizeMsgs())    goto dummymessage;
     
    246246/////                win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    247247
    248                 thdb->wp.hwnd = win32wnd->getWindowHandle();
     248                teb->o.odin.wp.hwnd = win32wnd->getWindowHandle();
    249249                if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
    250250                {
    251251                        Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
    252252                        if(wndAfter)
    253                               thdb->wp.hwndInsertAfter = wndAfter->getWindowHandle();
    254                         else  thdb->wp.hwndInsertAfter = HWND_TOP_W;
     253                              teb->o.odin.wp.hwndInsertAfter = wndAfter->getWindowHandle();
     254                        else  teb->o.odin.wp.hwndInsertAfter = HWND_TOP_W;
    255255                }
    256256        }
    257257        winMsg->message = WINWM_WINDOWPOSCHANGED;
    258         winMsg->lParam  = (LPARAM)&thdb->wp;
     258        winMsg->lParam  = (LPARAM)&teb->o.odin.wp;
    259259        break;
    260260    }
     
    496496        char c;
    497497
    498         thdb->fTranslated = FALSE;
     498        teb->o.odin.fTranslated = FALSE;
    499499        repeatCount = CHAR3FROMMP(os2Msg->mp1);
    500500        scanCode = CHAR4FROMMP(os2Msg->mp1);
     
    694694    case WM_RENDERALLFMTS:
    695695        winMsg->message = WINWM_RENDERALLFORMATS;
     696        break;
     697
     698    case WM_DESTROYCLIPBOARD:
     699        winMsg->message = WINWM_DESTROYCLIPBOARD;
    696700        break;
    697701
     
    733737BOOL OSLibWinTranslateMessage(MSG *msg)
    734738{
    735  THDB *thdb;
    736 
    737     thdb = GetThreadTHDB();
    738     if(!thdb) {
     739 TEB *teb;
     740
     741    teb = GetThreadTEB();
     742    if(!teb) {
    739743        return FALSE;
    740744    }
    741745    //NOTE: These actually need to be posted so that the next message retrieved by GetMessage contains
    742746    //      the newly generated WM_CHAR message.
    743     if(!thdb->fTranslated && thdb->os2msg.msg == WM_CHAR && !((SHORT1FROMMP(thdb->os2msg.mp1) & KC_KEYUP) == KC_KEYUP))
     747    if(!teb->o.odin.fTranslated && teb->o.odin.os2msg.msg == WM_CHAR && !((SHORT1FROMMP(teb->o.odin.os2msg.mp1) & KC_KEYUP) == KC_KEYUP))
    744748    {//TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message
    745             ULONG fl = SHORT1FROMMP(thdb->os2msg.mp1);
     749            ULONG fl = SHORT1FROMMP(teb->o.odin.os2msg.mp1);
    746750            MSG extramsg;
    747751
    748752            memcpy(&extramsg, msg, sizeof(MSG));
    749             extramsg.wParam = SHORT1FROMMP(thdb->os2msg.mp2);
     753            extramsg.wParam = SHORT1FROMMP(teb->o.odin.os2msg.mp2);
    750754            extramsg.lParam = 0;
    751755
     
    757761                if(msg->wParam)
    758762                        extramsg.wParam = msg->wParam;
    759                 else    extramsg.wParam = SHORT2FROMMP(thdb->os2msg.mp2);
     763                else    extramsg.wParam = SHORT2FROMMP(teb->o.odin.os2msg.mp2);
    760764            }
    761765
     
    778782                extramsg.lParam |= (1<<31);
    779783
    780             thdb->fTranslated = TRUE;
    781             memcpy(&thdb->msgWCHAR, &extramsg, sizeof(MSG));
     784            teb->o.odin.fTranslated = TRUE;
     785            memcpy(&teb->o.odin.msgWCHAR, &extramsg, sizeof(MSG));
    782786            return TRUE;
    783787    }
  • trunk/src/user32/oslibutil.cpp

    r2804 r4658  
    1 /* $Id: oslibutil.cpp,v 1.5 2000-02-16 14:34:28 sandervl Exp $ */
     1/* $Id: oslibutil.cpp,v 1.6 2000-11-21 11:36:08 sandervl Exp $ */
    22/*
    33 * Window API utility functions for OS/2
     
    2222HAB GetThreadHAB()
    2323{
    24  THDB *thdb;
     24 TEB *teb;
    2525
    26   thdb = GetThreadTHDB();
    27   if(thdb)
     26  teb = GetThreadTEB();
     27  if(teb)
    2828  {
    29         return (HAB)thdb->hab;
     29        return (HAB)teb->o.odin.hab;
    3030  }
    3131
    32   dprintf(("GetThreadHAB: thdb == NULL!!"));
     32  dprintf(("GetThreadHAB: teb == NULL!!"));
    3333  return 0;
    3434}
     
    3737void SetThreadHAB(HAB hab)
    3838{
    39  THDB *thdb;
     39 TEB *teb;
    4040
    41   thdb = GetThreadTHDB();
    42   if(thdb)
     41  teb = GetThreadTEB();
     42  if(teb)
    4343  {
    44         thdb->hab = (ULONG)hab;
     44        teb->o.odin.hab = (ULONG)hab;
    4545  }
    46   else  dprintf(("SetThreadHAB: thdb == NULL!!"));
     46  else  dprintf(("SetThreadHAB: teb == NULL!!"));
    4747}
    4848//******************************************************************************
     
    5050HMQ GetThreadMessageQueue()
    5151{
    52  THDB *thdb;
     52 TEB *teb;
    5353
    54   thdb = GetThreadTHDB();
    55   if(thdb)
     54  teb = GetThreadTEB();
     55  if(teb)
    5656  {
    57         return (HMQ)thdb->hmq;
     57        return (HMQ)teb->o.odin.hmq;
    5858  }
    5959
    60   dprintf(("GetThreadMessageQueue: thdb == NULL!!"));
     60  dprintf(("GetThreadMessageQueue: teb == NULL!!"));
    6161  return 0;
    6262}
     
    6565void SetThreadMessageQueue(HMQ hmq)
    6666{
    67  THDB *thdb;
     67 TEB *teb;
    6868
    69   thdb = GetThreadTHDB();
    70   if(thdb)
     69  teb = GetThreadTEB();
     70  if(teb)
    7171  {
    72         thdb->hmq = (ULONG)hmq;
     72        teb->o.odin.hmq = (ULONG)hmq;
    7373  }
    74   else  dprintf(("SetThreadMessageQueue: thdb == NULL!!"));
     74  else  dprintf(("SetThreadMessageQueue: teb == NULL!!"));
    7575}
    7676//******************************************************************************
     
    7878DWORD GetThreadMessageExtraInfo()
    7979{
    80  THDB *thdb;
     80 TEB *teb;
    8181
    82   thdb = GetThreadTHDB();
    83   if(thdb)
     82  teb = GetThreadTEB();
     83  if(teb)
    8484  {
    85         return thdb->lParam;
     85        return teb->o.odin.lParam;
    8686  }
    8787
    88   dprintf(("GetThreadMessageExtraInfo: thdb == NULL!!"));
     88  dprintf(("GetThreadMessageExtraInfo: teb == NULL!!"));
    8989  return 0;
    9090}
     
    9393DWORD SetThreadMessageExtraInfo(DWORD lParam)
    9494{
    95  THDB *thdb;
     95 TEB *teb;
    9696
    97   thdb = GetThreadTHDB();
    98   if(thdb)
     97  teb = GetThreadTEB();
     98  if(teb)
    9999  {
    100         thdb->lParam = lParam;
     100        teb->o.odin.lParam = lParam;
    101101  }
    102   else  dprintf(("SetThreadMessageExtraInfo: thdb == NULL!!"));
     102  else  dprintf(("SetThreadMessageExtraInfo: teb == NULL!!"));
    103103  return 0;
    104104}
  • trunk/src/user32/pmframe.cpp

    r3603 r4658  
    1 /* $Id: pmframe.cpp,v 1.55 2000-05-24 19:30:05 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.56 2000-11-21 11:36:08 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    6868 PFNWP            OldFrameProc;
    6969 MRESULT          rc;
    70  THDB            *thdb;
     70 TEB             *teb;
    7171 MSG             *pWinMsg,winMsg;
    7272
    7373  SetWin32TIB();
    7474
    75   thdb = GetThreadTHDB();
     75  teb = GetThreadTEB();
    7676  win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd);
    7777
    78   if (!thdb || (win32wnd == NULL) || !win32wnd->getOldFrameProc())
     78  if (!teb || (win32wnd == NULL) || !win32wnd->getOldFrameProc())
    7979  {
    8080    dprintf(("Invalid win32wnd pointer for frame %x!!", hwnd));
     
    8282  }
    8383
    84   if((thdb->msgstate & 1) == 0)
     84  if((teb->o.odin.msgstate & 1) == 0)
    8585  {//message that was sent directly to our window proc handler; translate it here
    8686        QMSG qmsg;
     
    9090        qmsg.mp1  = mp1;
    9191        qmsg.mp2  = mp2;
    92         qmsg.time = WinQueryMsgTime(thdb->hab);
    93         WinQueryMsgPos(thdb->hab, &qmsg.ptl);
     92        qmsg.time = WinQueryMsgTime(teb->o.odin.hab);
     93        WinQueryMsgPos(teb->o.odin.hab, &qmsg.ptl);
    9494        qmsg.reserved = 0;
    9595
    96         if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)
     96        if(OS2ToWinMsgTranslate((PVOID)teb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)
    9797        {//message was not translated
    9898            memset(&winMsg, 0, sizeof(MSG));
     
    101101  }
    102102  else {
    103         pWinMsg = &thdb->msg;
    104         thdb->msgstate++;
     103        pWinMsg = &teb->o.odin.msg;
     104        teb->o.odin.msgstate++;
    105105  }
    106106
     
    357357          //TODO: Get rid of SWP_SHOW; needed for winhlp32 button bar for now
    358358          swpClient.fl = (pswp->fl & ~SWP_ZORDER) | SWP_MOVE | SWP_SHOW;
    359           WinSetMultWindowPos(thdb->hab, &swpClient, 1);
     359          WinSetMultWindowPos(teb->o.odin.hab, &swpClient, 1);
    360360
    361361          //update child positions: rectWindow is in window coordinates
  • trunk/src/user32/pmwindow.cpp

    r4599 r4658  
    1 /* $Id: pmwindow.cpp,v 1.107 2000-11-15 20:30:46 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.108 2000-11-21 11:36:09 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    144144 OSLIBPOINT       point, ClientPoint;
    145145 Win32BaseWindow *win32wnd;
    146  THDB            *thdb;
     146 TEB             *teb;
    147147 APIRET           rc = 0;
    148148 MSG              winMsg, *pWinMsg;
     
    151151  SetWin32TIB();
    152152
    153   thdb = GetThreadTHDB();
     153  teb = GetThreadTEB();
    154154  win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
    155155
    156   if(!thdb || (msg != WM_CREATE && win32wnd == NULL)) {
     156  if(!teb || (msg != WM_CREATE && win32wnd == NULL)) {
    157157        dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg));
    158158        goto RunDefWndProc;
    159159  }
    160160
    161   if((thdb->msgstate & 1) == 0)
     161  if((teb->o.odin.msgstate & 1) == 0)
    162162  {//message that was sent directly to our window proc handler; translate it here
    163163        QMSG qmsg;
     
    167167        qmsg.mp1  = mp1;
    168168        qmsg.mp2  = mp2;
    169         qmsg.time = WinQueryMsgTime(thdb->hab);
    170         WinQueryMsgPos(thdb->hab, &qmsg.ptl);
     169        qmsg.time = WinQueryMsgTime(teb->o.odin.hab);
     170        WinQueryMsgPos(teb->o.odin.hab, &qmsg.ptl);
    171171        qmsg.reserved = 0;
    172172
    173         if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)
     173        if(OS2ToWinMsgTranslate((PVOID)teb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)
    174174        {//message was not translated
    175175            memset(&winMsg, 0, sizeof(MSG));
     
    178178  }
    179179  else {
    180         pWinMsg = &thdb->msg;
    181         thdb->msgstate++;
     180        pWinMsg = &teb->o.odin.msg;
     181        teb->o.odin.msgstate++;
    182182  }
    183183
     
    197197    case WM_CREATE:
    198198    {
    199         if(thdb->newWindow == 0)
     199        if(teb->o.odin.newWindow == 0)
    200200            goto createfail;
    201201
    202202        //Processing is done in after WinCreateWindow returns
    203203        dprintf(("OS2: WM_CREATE %x", hwnd));
    204         win32wnd = (Win32BaseWindow *)thdb->newWindow;
    205         thdb->newWindow = 0;
     204        win32wnd = (Win32BaseWindow *)teb->o.odin.newWindow;
     205        teb->o.odin.newWindow = 0;
    206206        if(win32wnd->MsgCreate(hwnd) == FALSE)
    207207        {
     
    794794    case WM_RENDERFMT:
    795795    case WM_RENDERALLFMTS:
     796    case WM_DESTROYCLIPBOARD:
    796797        win32wnd->DispatchMsgA(pWinMsg);
    797798        break;
  • trunk/src/user32/win32wbase.cpp

    r4628 r4658  
    1 /* $Id: win32wbase.cpp,v 1.223 2000-11-19 11:52:40 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.224 2000-11-21 11:36:09 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    496496
    497497  //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
    498   THDB *thdb = GetThreadTHDB();
    499 
    500   if(thdb == NULL) {
    501         dprintf(("Window creation failed - thdb == NULL")); //this is VERY bad
     498  TEB *teb = GetThreadTEB();
     499
     500  if(teb == NULL) {
     501        dprintf(("Window creation failed - teb == NULL")); //this is VERY bad
    502502        ExitProcess(666);
    503503        return FALSE;
    504504  }
    505505
    506   thdb->newWindow = (ULONG)this;
     506  teb->o.odin.newWindow = (ULONG)this;
    507507
    508508  DWORD dwOSWinStyle;
Note: See TracChangeset for help on using the changeset viewer.