mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03:00
init: Fix DllMain
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
24
src/init.c
24
src/init.c
@@ -226,19 +226,27 @@ int ssh_finalize(void) {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* Library constructor and destructor */
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
|
||||
DWORD fdwReason,
|
||||
LPVOID lpvReserved)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||
rc = ssh_init();
|
||||
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||
rc = ssh_finalize();
|
||||
}
|
||||
int rc = 0;
|
||||
|
||||
switch(fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
rc = _ssh_init(1);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "DllMain: ssh_init failed!");
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
_ssh_finalize(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
Reference in New Issue
Block a user