]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/dllmain.c
1 #include "internal/cryptlib_int.h"
3 #if defined(_WIN32) || defined(__CYGWIN__)
5 /* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */
8 * this has side-effect of _WIN32 getting defined, which otherwise is
9 * mutually exclusive with __CYGWIN__...
14 * All we really need to do is remove the 'error' state when a thread
18 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
);
19 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
22 case DLL_PROCESS_ATTACH
:
23 OPENSSL_cpuid_setup();
24 # if defined(_WIN32_WINNT)
26 IMAGE_DOS_HEADER
*dos_header
= (IMAGE_DOS_HEADER
*) hinstDLL
;
27 IMAGE_NT_HEADERS
*nt_headers
;
29 if (dos_header
->e_magic
== IMAGE_DOS_SIGNATURE
) {
30 nt_headers
= (IMAGE_NT_HEADERS
*) ((char *)dos_header
31 + dos_header
->e_lfanew
);
32 if (nt_headers
->Signature
== IMAGE_NT_SIGNATURE
&&
34 (HINSTANCE
) (nt_headers
->OptionalHeader
.ImageBase
))
35 OPENSSL_NONPIC_relocated
= 1;
40 case DLL_THREAD_ATTACH
:
42 case DLL_THREAD_DETACH
:
43 OPENSSL_thread_stop();
45 case DLL_PROCESS_DETACH
: