Ignore:
Timestamp:
Oct 11, 2000, 9:22:29 AM (25 years ago)
Author:
sandervl
Message:

TLS callback fixes

File:
1 edited

Legend:

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

    r4459 r4481  
    1 /* $Id: wintls.cpp,v 1.14 2000-10-08 20:05:05 sandervl Exp $ */
     1/* $Id: wintls.cpp,v 1.15 2000-10-11 07:22:29 sandervl Exp $ */
    22/*
    33 * Win32 TLS API functions
     
    8787   *tlsIndexAddr = tlsIndex;
    8888
    89    if(tlsCallBackAddr && (ULONG)*tlsCallBackAddr != 0) {
     89   if(tlsCallBackAddr && (ULONG)*tlsCallBackAddr != 0)
     90   {
    9091        pCallback = tlsCallBackAddr;
    9192        while(*pCallback) {
     
    9596
    9697            dprintf(("tlsAttachThread: finished calling TLS Callback %x", *pCallback));
    97             *pCallback++;
     98            pCallback++;
    9899        }
    99100   }
     
    113114   dprintf(("Win32ImageBase::tlsDetachThread for module %x, thread id %x", hinstance, GetCurrentThreadId()));
    114115
    115    if(tlsCallBackAddr && (ULONG)*tlsCallBackAddr != 0) {
     116   if(tlsCallBackAddr && (ULONG)*tlsCallBackAddr != 0)
     117   {
    116118        pCallback = tlsCallBackAddr;
    117119        while(*pCallback) {
     
    121123
    122124            dprintf(("tlsDetachThread: finished calling TLS Callback %x", *pCallback));
    123             *pCallback++;
     125            pCallback++;
    124126        }
    125127   }
     
    135137//******************************************************************************
    136138//******************************************************************************
    137 
    138 //******************************************************************************
    139 //******************************************************************************
    140139DWORD WIN32API TlsAlloc()
    141140{
    142141 DWORD index = -1;
    143 
    144 #if 1
    145142 THDB *thdb;
    146143 PDB  *pdb;
     
    171168  LeaveCriticalSection(&pdb->crit_section);
    172169  thdb->tls_array[index] = 0;
    173 #else
    174   index = O32_TlsAlloc();
    175 #endif
     170
    176171  dprintf(("KERNEL32: TlsAlloc returned %d", index));
    177172  return index;
     
    181176BOOL WIN32API TlsFree(DWORD index)
    182177{
    183   dprintf(("KERNEL32: TlsFree %d", index));
    184 #if 1
    185178 THDB  *thdb;
    186179 PDB   *pdb;
     
    188181 DWORD  mask;
    189182
     183  dprintf(("KERNEL32: TlsFree %d", index));
    190184  if(index >= TLS_MINIMUM_AVAILABLE)
    191185  {
     
    200194  tlsidx = 0;
    201195  if(index > 32) {
    202   tlsidx++;
     196     tlsidx++;
    203197  }
    204198  mask = (1 << index);
     
    213207  SetLastError(ERROR_INVALID_PARAMETER); //TODO: correct error? (does NT even change the last error?)
    214208  return FALSE;
    215 #else
    216   return(O32_TlsFree(index));
    217 #endif
    218209}
    219210//******************************************************************************
     
    222213{
    223214 LPVOID rc;
     215 THDB  *thdb;
    224216
    225217  if(index >= TLS_MINIMUM_AVAILABLE)
     
    230222  SetLastError(ERROR_SUCCESS);
    231223
    232 #if 1
    233  THDB  *thdb;
    234 
    235224  thdb = GetThreadTHDB();
    236225  rc = thdb->tls_array[index];
    237 #else
    238   rc = O32_TlsGetValue(index);
    239 #endif
     226
    240227  dprintf2(("KERNEL32: TlsGetValue %d returned %X\n", index, rc));
    241228  return(rc);
     
    245232BOOL WIN32API TlsSetValue(DWORD index, LPVOID val)
    246233{
     234 THDB *thdb;
     235
    247236  dprintf2(("KERNEL32: TlsSetValue %d %x", index, val));
    248237  if(index >= TLS_MINIMUM_AVAILABLE)
     
    252241  }
    253242  SetLastError(ERROR_SUCCESS);
    254 #if 1
    255   THDB *thdb;
    256243
    257244  thdb = GetThreadTHDB();
    258245  thdb->tls_array[index] = val;
    259246  return TRUE;
    260 #else
    261   return(O32_TlsSetValue(index, val));
    262 #endif
    263 }
    264 //******************************************************************************
    265 //******************************************************************************
     247}
     248//******************************************************************************
     249//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.