ValentijnNK / miranda

Automatically exported from code.google.com/p/miranda
0 stars 0 forks source link

windows version detection macros #1000

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I read a recent commit (r12694) modifying include/win2k.h, and spotted some 
suspicious code in there, having just read 
http://blogs.msdn.com/b/oldnewthing/archive/2004/02/13/72476.aspx ("Bad version 
number checks"). I don't think any of these cause actual problems, but I'm 
mentioning it nonetheless.

#define IsWinVerNT4Plus()  (WinVerMajor()>=5 || WinVerMinor()>0 || IsWinVerNT())
#define IsWinVerMEPlus()   (WinVerMajor()>=5 || WinVerMinor()>10)
these are faulty, because of the OR operators. For example, the first one will 
also match windows 3.1.

#define IsWinVer98Plus()   (LOWORD(GetVersion())!=4)
disregarding the way the version is checked, shouldn't this be a >= or such?

For example, this one gets it right:
#define IsWinVer7Plus()     (WinVerMajor()>6 || (WinVerMajor()==6 && 
WinVerMinor()>=1))

Original issue reported on code.google.com by theultramage on 19 Sep 2010 at 10:27

GoogleCodeExporter commented 9 years ago

Original comment by alex.zif...@gmail.com on 19 Sep 2010 at 11:47