summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-02-25 12:11:22 +0000
committerDr. Stephen Henson <steve@openssl.org>2014-02-25 13:42:25 +0000
commitcaf55bfacff80c82bbf4737d46771a059f219fa3 (patch)
tree383da32dfc9378497085de4541e5c37dd7279040
parentce3631015ebd7bbc046b71b2a4c906fabc2cb256 (diff)
downloadopenssl-new-caf55bfacff80c82bbf4737d46771a059f219fa3.tar.gz
Avoid Windows 8 Getversion deprecated errors.
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. (cherry picked from commit a4cc3c8041104896d51ae12ef7b678c31808ce52)
-rw-r--r--apps/apps.c2
-rw-r--r--crypto/bio/bss_log.c2
-rw-r--r--crypto/cryptlib.c2
-rw-r--r--crypto/rand/rand_win.c2
-rw-r--r--e_os.h7
5 files changed, 11 insertions, 4 deletions
diff --git a/apps/apps.c b/apps/apps.c
index 1096eee4cf..8a6a9a29a7 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -2841,7 +2841,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;
diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c
index b7dce5c1a2..2227b2b52d 100644
--- a/crypto/bio/bss_log.c
+++ b/crypto/bio/bss_log.c
@@ -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;
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 304c6b7062..0b77d8b7d0 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -889,7 +889,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);
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c
index 5d134e186b..34ffcd23f9 100644
--- a/crypto/rand/rand_win.c
+++ b/crypto/rand/rand_win.c
@@ -750,7 +750,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 79c1392573..6a0aad1de7 100644
--- a/e_os.h
+++ b/e_os.h
@@ -368,6 +368,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