Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

  1. /***
  2. *dllmain.c - Dummy DllMain for user DLLs that have no notification handler
  3. *
  4. * Copyright (c) 1993-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This object goes into LIBC.LIB and LIBCMT.LIB and MSVCRT.LIB for use
  8. * when linking a DLL with one of the three models of C run-time library.
  9. * If the user does not provide a DllMain notification routine, this
  10. * dummy handler will be linked in. It always returns TRUE (success).
  11. *
  12. *Revision History:
  13. * 04-14-93 SKS Initial version
  14. * 02-22-95 JCF Spliced _WIN32 & Mac versions.
  15. * 04-06-95 SKS In LIBC.LIB and MSVCRT.LIB models, turn off thread
  16. * attach and detach notifications to the current DLL.
  17. * 05-17-99 PML Remove all Macintosh support.
  18. *
  19. ******************************************************************************/
  20. #include <oscalls.h>
  21. #define _DECL_DLLMAIN /* include prototype of _pRawDllMain */
  22. #include <process.h>
  23. /***
  24. *DllMain - dummy version DLLs linked with all 3 C Run-Time Library models
  25. *
  26. *Purpose:
  27. * The routine DllMain is always called by _DllMainCrtStartup. If
  28. * the user does not provide a routine named DllMain, this one will
  29. * get linked in so that _DllMainCRTStartup has something to call.
  30. *
  31. * For the LIBC.LIB and MSVCRT.LIB models, the CRTL does not need
  32. * per-thread notifications so if the user is ignoring them (default
  33. * DllMain and _pRawDllMain == NULL), just turn them off. (WIN32-only)
  34. *
  35. *Entry:
  36. *
  37. *Exit:
  38. *
  39. *Exceptions:
  40. *
  41. ******************************************************************************/
  42. BOOL WINAPI DllMain(
  43. HANDLE hDllHandle,
  44. DWORD dwReason,
  45. LPVOID lpreserved
  46. )
  47. {
  48. #if !defined(_MT) || defined(CRTDLL)
  49. if ( dwReason == DLL_PROCESS_ATTACH && ! _pRawDllMain )
  50. DisableThreadLibraryCalls(hDllHandle);
  51. #endif
  52. return TRUE ;
  53. }