1

this works in Delphi 2009 but in TurboDelphi/BDS2006 I get an error:

[Pascal Error] xxx.pas(117): E2033 Types of actual and formal var parameters must be identical

 ...
  var
     osVerInfo : TOSVersionInfoExW;
     i : Integer;
     begin
        FillChar(osVerInfo, SizeOf(osVerInfo), 0);
        osVerInfo.dwOSVersionInfoSize:=SizeOf(TOSVersionInfoExW) ;
        if GetVersionExW(osVerInfo) then
...
Johan
  • 74,508
  • 24
  • 191
  • 319
Remus Rigo
  • 1,454
  • 8
  • 34
  • 60
  • 2
    One word of advice: Always write `SizeOf(osVerInfo)` rather than `SizeOf(TOSVersionInfoExW)` because that insulates you from hard to fathom errors when you happen to change the type of `osVerInfo` at some future point. – David Heffernan May 10 '11 at 08:04

1 Answers1

3

Seems buggy, but in D2007 (and thus I guess also in D2006) GetVersionExW requires TOSVersionInfoEx as parameter. In D2009 this equals TOSVersionInfoExW, but below D2009 this is equal to TOSVersionInfoExA. You should go well by declaring osVerInfo as TOSVersionInfoEx. This should compile with both versions.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130