diff options
author | Tim Angus <tim@ngus.net> | 2007-03-21 23:55:51 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2007-03-21 23:55:51 +0000 |
commit | d899c25c571ed061bba9725cf7b35d492cc6e518 (patch) | |
tree | 25268c9b3e381d00c2885c1fec7a54f46f56d93b /src/win32 | |
parent | cb5b4648d45b3f078a6ae3da45707764ca46e241 (diff) |
* ioq3-r1052 merge
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/win_gamma.c | 8 | ||||
-rw-r--r-- | src/win32/win_shared.c | 19 | ||||
-rw-r--r-- | src/win32/win_wndproc.c | 4 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/win32/win_gamma.c b/src/win32/win_gamma.c index 27cf9318..18322609 100644 --- a/src/win32/win_gamma.c +++ b/src/win32/win_gamma.c @@ -149,11 +149,11 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned table[2][i] = ( ( ( unsigned short ) blue[i] ) << 8 ) | blue[i]; } - // Win2K puts this odd restriction on gamma ramps... + // Win2K and newer put this odd restriction on gamma ramps... vinfo.dwOSVersionInfoSize = sizeof(vinfo); GetVersionEx( &vinfo ); - if ( vinfo.dwMajorVersion == 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) { - Com_DPrintf( "performing W2K gamma clamp.\n" ); + if ( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) { + Com_DPrintf( "performing gamma clamp.\n" ); for ( j = 0 ; j < 3 ; j++ ) { for ( i = 0 ; i < 128 ; i++ ) { if ( table[j][i] > ( (128+i) << 8 ) ) { @@ -165,7 +165,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned } } } else { - Com_DPrintf( "skipping W2K gamma clamp.\n" ); + Com_DPrintf( "skipping gamma clamp.\n" ); } // enforce constantly increasing diff --git a/src/win32/win_shared.c b/src/win32/win_shared.c index 5ed7770c..457a8d51 100644 --- a/src/win32/win_shared.c +++ b/src/win32/win_shared.c @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include <direct.h> #include <io.h> #include <conio.h> +#include <wincrypt.h> /* ================ @@ -82,6 +83,24 @@ void Sys_SnapVector( float *v ) } #endif +qboolean Sys_RandomBytes( byte *string, int len ) +{ + HCRYPTPROV prov; + + if( !CryptAcquireContext( &prov, NULL, NULL, + PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) ) { + + return qfalse; + } + + if( !CryptGenRandom( prov, len, (BYTE *)string ) ) { + CryptReleaseContext( prov, 0 ); + return qfalse; + } + CryptReleaseContext( prov, 0 ); + return qtrue; +} + /* ** diff --git a/src/win32/win_wndproc.c b/src/win32/win_wndproc.c index b22fac91..334d97a4 100644 --- a/src/win32/win_wndproc.c +++ b/src/win32/win_wndproc.c @@ -56,7 +56,7 @@ static void WIN_DisableAltTab( void ) { BOOL old; - SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0 ); + SystemParametersInfo( SPI_SETSCREENSAVERRUNNING, 1, &old, 0 ); } s_alttab_disabled = qtrue; } @@ -73,7 +73,7 @@ static void WIN_EnableAltTab( void ) { BOOL old; - SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, &old, 0 ); + SystemParametersInfo( SPI_SETSCREENSAVERRUNNING, 0, &old, 0 ); } s_alttab_disabled = qfalse; |