Avoid Windows 8 Getversion deprecated errors.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 25 Feb 2014 12:11:22 +0000 (12:11 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 25 Feb 2014 13:40:33 +0000 (13:40 +0000)
Windows 8 SDKs complain that GetVersion() is deprecated.

We only use GetVersion like this:

(GetVersion() < 0x80000000)

which checks if the Windows version is NT based. Use a macro check_winnt()
which uses GetVersion() on older SDK versions and true otherwise.

apps/apps.c
crypto/bio/bss_log.c
crypto/cryptlib.c
crypto/rand/rand_win.c
e_os.h

index c5a3bb27e476b4ca8b23760c2cf93e52ed954cba..b99996e944cd7e4c69f33677506c46157a9baac5 100644 (file)
@@ -3133,7 +3133,7 @@ double app_tminterval(int stop,int usertime)
 
        if (proc==NULL)
                {
-               if (GetVersion() < 0x80000000)
+               if (check_winnt())
                        proc = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,
                                                GetCurrentProcessId());
                if (proc==NULL) proc = (HANDLE)-1;
index b7dce5c1a27b18ad49a38eca6d5160ffe6a8b93b..2227b2b52d475509af4401d24870884cab5268ac 100644 (file)
@@ -245,7 +245,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str)
 
 static void xopenlog(BIO* bp, char* name, int level)
 {
-       if (GetVersion() < 0x80000000)
+       if (check_winnt())
                bp->ptr = RegisterEventSourceA(NULL,name);
        else
                bp->ptr = NULL;
index 049a7bba9195624c84e4eef2a2a90ee93de951a4..897b5b5bc22a551e6ad21d82a3b21b39a885e9ec 100644 (file)
@@ -357,7 +357,7 @@ void OPENSSL_showfatal (const char *fmta,...)
 
 #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
     /* this -------------v--- guards NT-specific calls */
-    if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0)
+    if (check_winnt() && OPENSSL_isservice() > 0)
     {  HANDLE h = RegisterEventSource(0,_T("OPENSSL"));
        const TCHAR *pmsg=buf;
        ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0);
index 07ab4eb8dfea5c219aaf88bc05656a7b7b9e3341..73f261f122b2d2a99d8ab35bda243c96c6194d93 100644 (file)
@@ -752,7 +752,7 @@ static void readscreen(void)
   int          y;              /* y-coordinate of screen lines to grab */
   int          n = 16;         /* number of screen lines to grab at a time */
 
-  if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0)
+  if (check_winnt() && OPENSSL_isservice()>0)
     return;
 
   /* Create a screen DC and a memory DC compatible to screen DC */
diff --git a/e_os.h b/e_os.h
index f737ae854747f8ee26d44a6cba00d50dca3cad58..c5ed54f3b2992bca2b52b1d845ab99a251512db0 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -373,6 +373,13 @@ static unsigned int _strlen31(const char *str)
 #    define DEFAULT_HOME  "C:"
 #  endif
 
+/* Avoid Windows 8 SDK GetVersion deprecated problems */
+#if defined(_MSC_VER) && _MSC_VER>=1800
+#  define check_winnt() (1)
+#else
+#  define check_winnt() (GetVersion() < 0x80000000)
+#endif 
+
 #else /* The non-microsoft world */
 
 #  ifdef OPENSSL_SYS_VMS