Bump supported Windows to Win7 (drop Vista) and update a deprecated API

This commit is contained in:
dmiller 2021-07-29 21:09:44 +00:00
parent 042ddd33b4
commit 1820469f5a
2 changed files with 7 additions and 10 deletions

View file

@ -14,8 +14,9 @@
#ifdef _WIN32
/* XXX */
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
# include <wincrypt.h>
# define _WIN32_WINNT _WIN32_WINNT_WIN7
# include <bcrypt.h>
# pragma comment(lib, "bcrypt.lib")
# define inline __inline
#else
# include <sys/types.h>
@ -69,12 +70,8 @@ rand_open(void)
rand_t *r;
u_char seed[256];
#ifdef _WIN32
HCRYPTPROV hcrypt = 0;
CryptAcquireContext(&hcrypt, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
CryptGenRandom(hcrypt, sizeof(seed), seed);
CryptReleaseContext(hcrypt, 0);
if (STATUS_SUCCESS != BCryptGenRandom(NULL, seed, sizeof(seed), BCRYPT_USE_SYSTEM_PREFERRED_RNG))
return NULL;
#else
struct timeval *tv = (struct timeval *)seed;
int fd;

View file

@ -72,9 +72,9 @@ are in <sdkddkver.h>.
http://msdn.microsoft.com/en-us/library/aa383745.aspx
http://blogs.msdn.com/oldnewthing/archive/2007/04/11/2079137.aspx */
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WIN6
#define _WIN32_WINNT _WIN32_WINNT_WIN7
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN6
#define NTDDI_VERSION NTDDI_WIN7
//This disables the warning 4800 http://msdn.microsoft.com/en-us/library/b6801kcy(v=vs.71).aspx
#pragma warning(disable : 4800)