Source code of Windows XP (NT5)
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.

55 lines
1.7 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: dllentry.c
  7. //
  8. // Contents: Dll Entry point code. Calls the appropriate run-time
  9. // init/term code and then defers to LibMain for further
  10. // processing.
  11. //
  12. // Classes: <none>
  13. //
  14. // Functions: DllEntryPoint - Called by loader
  15. //
  16. // History: 10-May-92 BryanT Created
  17. // 22-Jul-92 BryanT Switch to calling _cexit/_mtdeletelocks
  18. // on cleanup.
  19. // 06-Oct-92 BryanT Call RegisterWithCommnot on entry
  20. // and DeRegisterWithCommnot on exit.
  21. // This should fix the heap dump code.
  22. // 27-Dec-93 AlexT Post 543 builds don't need special code.
  23. //
  24. //--------------------------------------------------------------------
  25. #define USE_CRTDLL
  26. #include <windows.h>
  27. BOOL WINAPI _CRT_INIT (HANDLE hDll, DWORD dwReason, LPVOID lpReserved);
  28. BOOL DllEntryPoint (HANDLE hDll, DWORD dwReason, LPVOID lpReserved);
  29. BOOL __cdecl LibMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved);
  30. BOOL DllEntryPoint (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
  31. {
  32. BOOL fRc = FALSE;
  33. switch (dwReason)
  34. {
  35. case DLL_PROCESS_ATTACH:
  36. _CRT_INIT(hDll, dwReason, lpReserved);
  37. case DLL_THREAD_ATTACH:
  38. case DLL_THREAD_DETACH:
  39. fRc = LibMain (hDll, dwReason, lpReserved);
  40. break;
  41. case DLL_PROCESS_DETACH:
  42. fRc = LibMain (hDll, dwReason, lpReserved);
  43. _CRT_INIT(hDll, dwReason, lpReserved);
  44. }
  45. return(fRc);
  46. }