From e11f8ee794c73bec1b640fc83b32252dd00b5044 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 23 Sep 2014 12:38:16 +0000 Subject: [PATCH] Bodge around the failing Coverity build in winshare.c. The winegcc hack I use for my Coverity builds is currently using a version of wincrypt.h that's missing a couple of constants I use. Ensure they're defined by hand, but (just in case I defined them _wrong_) also provide a command-line define so I can do that only in the case of Coverity builds. [originally from svn r10234] --- Buildscr.cv | 2 +- windows/winshare.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Buildscr.cv b/Buildscr.cv index 877865f3..0b4d1cbe 100644 --- a/Buildscr.cv +++ b/Buildscr.cv @@ -25,7 +25,7 @@ enddelegate # Windows scanner for download). delegate covscan32wine in putty do tar xzvf cov-int.tar.gz - in putty/windows do cov-build --dir ../cov-int make -f Makefile.cyg CC=winegcc RC=wrc + in putty/windows do cov-build --dir ../cov-int make -f Makefile.cyg CC=winegcc RC=wrc XFLAGS=-DCOVERITY in putty do tar czvf cov-int.tar.gz cov-int return putty/cov-int.tar.gz enddelegate diff --git a/windows/winshare.c b/windows/winshare.c index 89c1cc32..a63325cb 100644 --- a/windows/winshare.c +++ b/windows/winshare.c @@ -16,6 +16,22 @@ #include "winsecur.h" +#ifdef COVERITY +/* + * The hack I use to build for Coverity scanning, using winegcc and + * Makefile.cyg, didn't provide some defines in wincrypt.h last time I + * looked. Therefore, define them myself here, but enclosed in #ifdef + * COVERITY to ensure I don't make up random nonsense values for any + * real build. + */ +#ifndef CRYPTPROTECTMEMORY_BLOCK_SIZE +#define CRYPTPROTECTMEMORY_BLOCK_SIZE 16 +#endif +#ifndef CRYPTPROTECTMEMORY_CROSS_PROCESS +#define CRYPTPROTECTMEMORY_CROSS_PROCESS 1 +#endif +#endif + #define CONNSHARE_PIPE_PREFIX "\\\\.\\pipe\\putty-connshare" #define CONNSHARE_MUTEX_PREFIX "Local\\putty-connshare-mutex"