ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Compile problems of capture_if_details_dlg_win32.c on MSVC20

From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Mon, 29 Jun 2009 10:34:17 +0100
Ulf Lamping wrote:
Kovarththanan Rajaratnam schrieb:
  
I've seen the same problem on a MSVC2005 installation.

Any ideas what changed in the last few weeks/months and what to do?
      
This problem has existed for a while. See:

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3439

    
Thanks for pointing me to that report.

I've made the required changes by hand and checked in a fix in SVN 28879

I don't think this will fix the situation for MSVC2008EE (don't have 
such a system at hand), as this is probably related to the Windows SDK 
installed and not directly the MSVC version used.

However, the current fix is "better than nothing" ...


  
I've been building up to a rant on this over the last few weeks, here goes.

I still build using MSVC 2005, and IMHO we've gone down a really bad road with all these conditionals based on the compiler version.

It really doesn't matter too much which compiler we are using, it's the SDK used that's important and even then it's actually to do with defines passed to the compiler that conditionally include parts of the Windows headers.  Originally MS defined these as _WINNT32_WINNT and WINVER.  These have now been replaced with NTDDI_VERSION.

What these defines do is specify which version of the Windows API you are targeting, e.g. Win2K = 0x0500, or in the newer version NTDDI_WIN2KSP4, and they limit the API specified in the windows headers to that of the targeted version.

The SDK provides a script "SetEnv.CMD" for command line compilation use that takes parameters such as /Debug or /Release, /x86 or /x64 and /xp or /vista to set up 4 environment vars; Lib, Include, CPU and APPVER.

These are then used by the nmake include file <win32.mak> to produce the compiler definitions referred to above, along with all the other compiler flags set accordingly.

Of course there are odd corner cases (such as the Open file dialog) where runtime checks are needed to determine how to call the Win32 API.

I think we should look at our win32 build infrastructure and try to use the SDK helper where available and then pass the correct defines into the compiler.

-- 
Regards,

Graham Bloice