diff options
author | Andy Polyakov <appro@openssl.org> | 2010-04-10 14:13:12 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2010-04-10 14:13:12 +0000 |
commit | b32d93840e97e53992276bc630f1b49ccfb85716 (patch) | |
tree | 6891d34485384b8e41d71bac27f9251e79451227 /crypto | |
parent | cb457849fdfb39546deaa702a851d12c924cb943 (diff) |
cryptlib.c: allow application to override OPENSSL_isservice [from HEAD].
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/cryptlib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 9a39d7e171..b4449b86d6 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -749,6 +749,18 @@ int OPENSSL_isservice(void) { HWINSTA h; DWORD len; WCHAR *name; + static union { void *p; int (*f)(void); } _OPENSSL_isservice = { NULL }; + + if (_OPENSSL_isservice.p == NULL) { + HANDLE h = GetModuleHandle(NULL); + if (h != NULL) + _OPENSSL_isservice.p = GetProcAddress(h,"_OPENSSL_isservice"); + if (_OPENSSL_isservice.p == NULL) + _OPENSSL_isservice.p = (void *)-1; + } + + if (_OPENSSL_isservice.p != (void *)-1) + return (*_OPENSSL_isservice.f)(); (void)GetDesktopWindow(); /* return value is ignored */ |