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.

56 lines
1.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: dllentry.cxx
  7. //
  8. // Contents: DLL entry point code
  9. //
  10. // History: 24-Feb-94 DrewB Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "headers.cxx"
  14. #pragma hdrstop
  15. extern "C"
  16. {
  17. BOOL WINAPI _CRT_INIT (HANDLE hDll, DWORD dwReason, LPVOID lpReserved);
  18. BOOL __cdecl LibMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved);
  19. };
  20. extern "C" BOOL __stdcall DllEntryPoint (HANDLE hDll, DWORD dwReason,
  21. LPVOID lpReserved)
  22. {
  23. BOOL fRc;
  24. if ((dwReason == DLL_PROCESS_ATTACH) || (dwReason == DLL_THREAD_ATTACH))
  25. {
  26. // If this is an attach, initialize the Cruntimes first
  27. if (fRc = _CRT_INIT(hDll, dwReason, lpReserved))
  28. {
  29. fRc = LibMain(hDll, dwReason, lpReserved);
  30. }
  31. }
  32. else
  33. {
  34. // This is a detach so call the Cruntimes second
  35. LibMain(hDll, dwReason, lpReserved);
  36. fRc = _CRT_INIT(hDll, dwReason, lpReserved);
  37. }
  38. return fRc;
  39. }
  40. extern "C" BOOL __stdcall DllMain (HANDLE hDll, DWORD dwReason,
  41. LPVOID lpReserved)
  42. {
  43. // This is not currently used...but must be present to avoid
  44. // an undefined symbol
  45. return FALSE;
  46. }