#include <tchar.h>
#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
-static int IsService(void)
+int OPENSSL_isservice(void)
{ HWINSTA h;
DWORD len;
WCHAR *name;
#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
/* this -------------v--- guards NT-specific calls */
- if (GetVersion() < 0x80000000 && IsService())
+ if (GetVersion() < 0x80000000 && OPENSSL_isservice())
{ HANDLE h = RegisterEventSource(0,_T("OPENSSL"));
const TCHAR *pmsg=buf;
ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0);
vfprintf (stderr,fmta,ap);
va_end (ap);
}
+int OPENSSL_isservice (void) { return 0; }
#endif
void OpenSSLDie(const char *file,int line,const char *assertion)
void OPENSSL_showfatal(const char *,...);
void *OPENSSL_stderr(void);
extern int OPENSSL_NONPIC_relocated;
+int OPENSSL_isservice(void);
#ifdef __cplusplus
}
void RAND_screen(void) /* function available for backward compatibility */
{
RAND_poll();
- readscreen();
+ if (GetVersion() >= 0x80000000 || !OPENSSL_isservice())
+ readscreen();
}
# define NO_DIRENT
# ifdef WINDOWS
+# ifndef _WIN32_WINNT
+ /*
+ * Defining _WIN32_WINNT here in e_os.h implies certain "discipline."
+ * Most notably we ought to check for availability of each specific
+ * routine with GetProcAddress() and/or quard NT-specific calls with
+ * GetVersion() < 0x80000000. One can argue that in latter "or" case
+ * we ought to /DELAYLOAD some .DLLs in order to protect ourselves
+ * against run-time link errors. This doesn't seem to be necessary,
+ * because it turned out that already Windows 95, first non-NT Win32
+ * implementation, is equipped with at least NT 3.51 stubs, dummy
+ * routines with same name, but which do nothing. Meaning that it's
+ * apparently appropriate to guard generic NT calls with GetVersion
+ * alone, while NT 4.0 and above calls ought to be additionally
+ * checked upon with GetProcAddress.
+ */
+# define _WIN32_WINNT 0x0400
+# endif
# include <windows.h>
# include <stddef.h>
# include <errno.h>
# C compiler stuff
$cc='cl';
-$cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0333 -DL_ENDIAN -DDSO_WIN32';
+$cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
$lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
$mlflags='';