Nmap Development mailing list archives

Re: Visual Studios Compile question


From: Kris Katterjohn <katterjohn () gmail com>
Date: Fri, 23 Mar 2007 17:29:23 -0500

kx wrote:
I agree. #define _CRT_SECURE_NO_DEPRECATE 1 is definitely the way to
go, and when I removed those other two lines, I had no other warnings.
But  #define _CRT_SECURE_NO_WARNINGS 1 is creating a new warning.

I just installed VS 2005 Express fresh today and SP1 for VS 2005 and I
have the Microsoft Platform SDK for Windows Server 2003 R2 (new XP
laptop).

I just hate using a pragma to turn off all deprecation warnings, and
while _CRT_SECURE_NO_WARNINGS is the new way to turn off the warnings:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101187


... it seems broke.

I am wondering if you had the warnings because it wasn't SP1?

If anyone has VS Express with SP1, it would be helpful to know if you
get the CRT warnings by removing the pragma and
_CRT_SECURE_NO_WARNINGS 1

Cheers,
 kx


Yeah, if anybody can test the different #defines and the #pragma, that'd
be awesome.  With different VS versions, too.

I really don't care which one(s) work, as long as all the unwanted
warnings go away :) I'd be happy to revert the change if we get
something that works all around.

Like I said, I unfortunately can't test anything out right now. I don't
remember if I had SP1 or not (probably no).

Below is an IM between me and Fyodor talking about it before I committed
it.  It might give you a little info about what we saw and tried; maybe
it'll give you an idea:



(19:48:03) [me]: Hey, it's Kris. I made a patch to add a couple lines to
nbase_winconfig.h. It adds an additional #define and a #pragma to
disable warnings about function deprecation (stupid MS). There's a
#define allready in there that's supposed to work, the #define I'm
putting in is supposed to work, and the #pragma is. Unfortunately, the
#define that's in there and the one I'm adding doesn't seem to work for
me. The #pragma does though. I'm sure the #define's work for other
versions or something (maybe not the Express VC++?). Is it cool to apply
to nbase?
(19:48:53) [fyodor]: are these deprecated functions like strcpy(), or
other things?
(19:49:10) [me]: Yeah, the stuff like that where they're trying to get
you to use strcpy_s() instead.
(19:49:39) [fyodor]: do they complain about strncpy() ?
(19:49:55) [fyodor]: and what are the pragma and define names?
(19:50:03) [me]: I'm not sure about that one, there are a ton of
warning. I'm pretty sure snprintf() is mentioned too.
(19:50:08) [me]: h/o, I'll get them
(19:50:37) [me]: #define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable: 4996)
(19:51:37) [fyodor]: thanks, googling
(19:52:29) [fyodor]: what I'm looking for is a
(19:52:33) [fyodor]: list of functions affected
(19:52:47) [fyodor]: it complained about snprintf , with the 'n' ?
(19:52:59) [me]: I'm pretty sure. I can run and go check if you want
(19:53:07) [fyodor]:
http://msdn2.microsoft.com/en-us/library/wd3wzwts(VS.80).aspx
(19:53:30) [fyodor]: yeah, it looks like you are right.  If it was just
(19:53:41) [fyodor]: strcpy(), maybe we could just change
(19:53:52) [fyodor]: those to Strncpy, but since it is a huge list of
functions
(19:54:05) [fyodor]: , which in fact include strncpy, then
(19:54:17) [fyodor]: I agree with you that we should just add the
pragma.  Stupid MS!
(19:55:14) [me]: yeah, there are really tons of warnings when I build
Nmap. I'd say a third of the output is probably warnings.
(19:55:31) [fyodor]: Cool, well if you check in the pragma/define
change, that sounds great.



Thanks,
Kris Katterjohn

Attachment: signature.asc
Description: OpenPGP digital signature


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: