dllmain.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include "internal/e_os.h"
  10. #include "crypto/cryptlib.h"
  11. #if defined(_WIN32) || defined(__CYGWIN__)
  12. # ifdef __CYGWIN__
  13. /* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */
  14. # include <windows.h>
  15. /*
  16. * this has side-effect of _WIN32 getting defined, which otherwise is
  17. * mutually exclusive with __CYGWIN__...
  18. */
  19. # endif
  20. /*
  21. * All we really need to do is remove the 'error' state when a thread
  22. * detaches
  23. */
  24. BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
  25. BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
  26. {
  27. switch (fdwReason) {
  28. case DLL_PROCESS_ATTACH:
  29. OPENSSL_cpuid_setup();
  30. break;
  31. case DLL_THREAD_ATTACH:
  32. break;
  33. case DLL_THREAD_DETACH:
  34. OPENSSL_thread_stop();
  35. break;
  36. case DLL_PROCESS_DETACH:
  37. break;
  38. }
  39. return TRUE;
  40. }
  41. #endif