Changeset 281 for trunk/src/kernel32/windll.cpp
- Timestamp:
- Jul 7, 1999, 10:11:58 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/windll.cpp
r135 r281 1 /* $Id: windll.cpp,v 1. 6 1999-06-20 17:54:53sandervl Exp $ */1 /* $Id: windll.cpp,v 1.7 1999-07-07 08:11:10 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 #include <iostream.h> 23 23 #include <fstream.h> 24 #include "misc.h" 25 #include "nameid.h" 26 #include "win32type.h" 27 #include "pefile.h" 28 #include "windll.h" 24 #include <misc.h> 25 #include <nameid.h> 26 #include <win32type.h> 27 #include <pefile.h> 28 #include <windll.h> 29 #include <wprocess.h> 29 30 #include "cio.h" 30 31 #include "os2util.h" … … 131 132 if(errorState == NO_ERROR && !fUnloaded) 132 133 { 133 if(!fSystemDll) { 134 detachProcess(); 135 } 134 detachProcess(); 136 135 } 137 136 } … … 304 303 BOOL Win32Dll::attachProcess() 305 304 { 306 if(fSystemDll || fSkipEntryCalls || !fNativePEImage) 305 BOOL rc; 306 USHORT sel; 307 308 //Allocate TLS index for this module 309 tlsAlloc(); 310 tlsAttachThread(); //setup TLS (main thread) 311 312 if(fSystemDll || fSkipEntryCalls) { 313 dprintf(("attachProcess not required for dll %s", szModule)); 307 314 return(TRUE); 308 309 if(getenv("WIN32_IOPL2")) { 310 io_init1(); 311 } 312 return dllEntryPoint((ULONG)this, DLL_PROCESS_ATTACH, 0); 315 } 316 317 dprintf(("attachProcess to dll %s", szModule)); 318 319 sel = SetWin32TIB(); 320 rc = dllEntryPoint(hinstance, DLL_PROCESS_ATTACH, 0); 321 SetFS(sel); 322 return rc; 313 323 } 314 324 //****************************************************************************** 315 325 //****************************************************************************** 316 326 BOOL Win32Dll::detachProcess() 327 { 328 BOOL rc; 329 USHORT sel; 330 331 if(fSystemDll || fSkipEntryCalls) { 332 tlsDetachThread(); //destroy TLS (main thread) 333 return(TRUE); 334 } 335 336 dprintf(("detachProcess from dll %s", szModule)); 337 338 fUnloaded = TRUE; 339 sel = SetWin32TIB(); 340 rc = dllEntryPoint(hinstance, DLL_PROCESS_DETACH, 0); 341 SetFS(sel); 342 tlsDetachThread(); //destroy TLS (main thread) 343 return rc; 344 } 345 //****************************************************************************** 346 //****************************************************************************** 347 BOOL Win32Dll::attachThread() 317 348 { 318 349 if(fSystemDll || fSkipEntryCalls) 319 350 return(TRUE); 320 351 321 if(fNativePEImage) 322 return dllEntryPoint((ULONG)this, DLL_PROCESS_DETACH, 0); 323 else return dllEntryPoint((ULONG)this, DLL_PROCESS_ATTACH, 0); //reversed in converted code 324 } 325 //****************************************************************************** 326 //****************************************************************************** 327 BOOL Win32Dll::attachThread() 352 dprintf(("attachThread to dll %s", szModule)); 353 return dllEntryPoint(hinstance, DLL_THREAD_ATTACH, 0); 354 } 355 //****************************************************************************** 356 //****************************************************************************** 357 BOOL Win32Dll::detachThread() 328 358 { 329 359 if(fSystemDll || fSkipEntryCalls) 330 360 return(TRUE); 331 361 332 return dllEntryPoint((ULONG)this, DLL_THREAD_ATTACH, 0); 333 } 334 //****************************************************************************** 335 //****************************************************************************** 336 BOOL Win32Dll::detachThread() 337 { 338 if(fSystemDll || fSkipEntryCalls) 339 return(TRUE); 340 341 return dllEntryPoint((ULONG)this, DLL_THREAD_DETACH, 0); 362 dprintf(("attachThread from dll %s", szModule)); 363 return dllEntryPoint(hinstance, DLL_THREAD_DETACH, 0); 364 } 365 //****************************************************************************** 366 //Send DLL_THREAD_ATTACH message to all dlls for a new thread 367 //****************************************************************************** 368 void Win32Dll::attachThreadToAllDlls() 369 { 370 Win32Dll *dll = Win32Dll::head; 371 372 while(dll) { 373 dll->attachThread(); 374 dll = dll->getNext(); 375 } 376 } 377 //****************************************************************************** 378 //Send DLL_THREAD_DETACH message to all dlls for thread that's about to die 379 //****************************************************************************** 380 void Win32Dll::detachThreadFromAllDlls() 381 { 382 Win32Dll *dll = Win32Dll::head; 383 384 while(dll) { 385 dll->detachThread(); 386 dll = dll->getNext(); 387 } 388 } 389 //****************************************************************************** 390 //Setup TLS structure for all dlls for a new thread 391 //****************************************************************************** 392 void Win32Dll::tlsAttachThreadToAllDlls() 393 { 394 Win32Dll *dll = Win32Dll::head; 395 396 while(dll) { 397 dll->tlsAttachThread(); 398 dll = dll->getNext(); 399 } 400 } 401 //****************************************************************************** 402 //Destroy TLS structure for all dlls for a thread that's about to die 403 //****************************************************************************** 404 void Win32Dll::tlsDetachThreadFromAllDlls() 405 { 406 Win32Dll *dll = Win32Dll::head; 407 408 while(dll) { 409 dll->tlsDetachThread(); 410 dll = dll->getNext(); 411 } 342 412 } 343 413 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.