dummzeuch 1505 Posted April 21, 2019 When Microsoft introduced Windows 10 they said it would be the last version of Windows ever. They lied of course, because since then we have multiple versions of an operating system called “Windows 10”. Even worse, starting with Windows 8 they made their WinAPI function GetVersionEx lie about the Windows version https://blog.dummzeuch.de/2019/04/21/getting-the-windows-version/ Share this post Link to post
Ian Branch 127 Posted April 21, 2019 Hi Thomas, I have had a look at the OSDN page. Where/how does one actually download the dzLib? I don't recognise any download type prompt. Regards & TIA, Ian Share this post Link to post
dummzeuch 1505 Posted April 21, 2019 19 minutes ago, Ian Branch said: Where/how does one actually download the dzLib? There is no download, instead you use subversion with the following URL: http://svn.osdn.net/svnroot/dzlib-tools/dzlib/trunk/ Alternatively you can use svn with the following URL for getting dzlib+buildtools, which includes all externals that may be used in any of the test programs or referenced in some of the units: http://svn.osdn.net/svnroot/dzlib-tools/dzlib+tools/ 1 Share this post Link to post
FredS 138 Posted April 21, 2019 3 hours ago, dummzeuch said: they made their WinAPI function GetVersionEx lie OK but.. it reports compatibility which may be important to know.. Of course TOSVersion has always reported the correct version, blatantly ignoring any attempt by M$ to lie 🙂 Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 7 hours ago, FredS said: Of course TOSVersion has always reported the correct version, blatantly ignoring any attempt by M$ to lie 🙂 Are you sure about that? I looked at the code and found nothing special. It simply calls GetVersionEx. I think this works only because the new compilers add the right manifest entries. Remove them and try it again. Also, it does not distinguish between the various versions of Windows 10. Share this post Link to post
Guest Posted April 22, 2019 (edited) Read the file version from kernel32.dll and you will get the real version number of the os Edited April 22, 2019 by Guest Share this post Link to post
Daniel 417 Posted April 22, 2019 Exactly. And this is what he describes in his blog. 1 Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 51 minutes ago, Schokohase said: Read the file version from kernel32.dll and you will get the real version number of the os It still does not get you "Windows 10 version XXX". It also does not get you Windows 8.1 but returns version 6.3. These version numbers have to be interpreted first to get what Winver shows to the user. Share this post Link to post
Angus Robertson 574 Posted April 22, 2019 Use RtlGetVersion instead of GetVersionExW which always gives the true operating system. function RtlGetVersion (var lpVersionInformation: TOSVERSIONINFOEXW): DWORD; stdcall; // Windows 2000 and later function RtlGetVersion; external 'ntdll.dll' name 'RtlGetVersion'; OsInfo: TOSVERSIONINFOEXW; RtlGetVersion (OsInfo) Unfortunately Microsoft has not provided any APIs to read the multiple different versions of Windows 10 or Windows Server 2016, so you need to read that from the registry: HCM\Software\Microsoft\Windows NT\CurrentVersion\ReleaseId which will return 1607, 1809 or something similar. \ProductName gives Windows 10 Enterprise or similar, although you work that out from APIs. Angus 1 Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 (edited) Apparently nobody can be bothered to actually read the blog post before commenting... Edit: Reading the info from the registry was new to me. Thanks. edit2: That's where Winver gets the information from. If I change ReleaseId to 1810, Winver displays that value too. I would have expected Microsoft to make changes to those keys impossible. Edited April 22, 2019 by dummzeuch Share this post Link to post
Angus Robertson 574 Posted April 22, 2019 Quite correct, no reason to waste time following the links in this thread, but no-one suggested the proper way to get the Windows version, so I did., Or perhaps the thread title is wrong. Angus Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 42 minutes ago, Angus Robertson said: Quite correct, no reason to waste time following the links in this thread. The category is "Tips / Blogs / Tutorials / Videos". But hey, who am I to interpret that ... Share this post Link to post
Angus Robertson 574 Posted April 22, 2019 Yes, I see the word video in very small letters buried in a line at the top of the screen, but I read these groups backwards from Unread Content, and you never mentioned you were posting a link to a video in the root post. That would have be sufficient for me to skip this thread, even less time to watch beginners how to program videos . My apologies for wasting your time by posting something useful for other developers. Angus 1 Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 1 hour ago, Angus Robertson said: Yes, I see the word video in very small letters buried in a line at the top of the screen, but I read these groups backwards from Unread Content, and you never mentioned you were posting a link to a video in the root post. That would have be sufficient for me to skip this thread, even less time to watch beginners how to program videos . My apologies for wasting your time by posting something useful for other developers. This was not about a video but about a blog post. But feel free to continue not reading anything I post. It's completely voluntary. I agree that most videos on programming are a waste of time. It's still my opinion that somebody who comments on a blog post should at least have read it. If you had, you would have noticed that I already mentioned RtlGetVersion and discarded it because it does not give me the information I wanted. Just in case you are interested nonetheless: I have just written another blog post crediting your hint. If you don't want to be credited with something that you apparently deem to be too trivial for your attention please let me know. 2 Share this post Link to post
FredS 138 Posted April 22, 2019 8 hours ago, dummzeuch said: Are you sure about that? Yes, one of the first things I did back in XE7. However Writeln(TOSVersion.ToString); returns: Windows 10 (Version 10.0, Build 0, 64-bit Edition) Because in in TOSVersion.Create: if not GetNetWkstaMajorMinor(MajorNum, MinorNum) then GetProductVersion(kernelbase, MajorNum, MinorNum, BuildNum); The call to GetNetWkstaMajorMinor doesn't return a Build, if it failed GetProductVersion would have returned the correct Build. Share this post Link to post
David Heffernan 2345 Posted April 22, 2019 1 hour ago, dummzeuch said: This was not about a video but about a blog post. But feel free to continue not reading anything I post. It's completely voluntary. I agree that most videos on programming are a waste of time. It's still my opinion that somebody who comments on a blog post should at least have read it. If you had, you would have noticed that I already mentioned RtlGetVersion and discarded it because it does not give me the information I wanted. Just in case you are interested nonetheless: I have just written another blog post crediting your hint. If you don't want to be credited with something that you apparently deem to be too trivial for your attention please let me know. I think that the point Angus was making was that he read the text, and did not follow the link. The text seemed to be the first two paragraphs of the blog post, but without mentioning that there was more to be found by following the link. I have to say that I read the post two or three times wondering what it was that you were trying to tell us. Since the text you did include was only part of the story, it would in my view, have been better not to have included any text and just referred us to the offsite link to your blog post. That's at least three people that were confused by the post. Listen to our feedback or not. It's completely voluntary. 😉 Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 (edited) 1 hour ago, FredS said: Yes, one of the first things I did back in XE7. However Writeln(TOSVersion.ToString); returns: Windows 10 (Version 10.0, Build 0, 64-bit Edition) Because in in TOSVersion.Create: if not GetNetWkstaMajorMinor(MajorNum, MinorNum) then GetProductVersion(kernelbase, MajorNum, MinorNum, BuildNum); The call to GetNetWkstaMajorMinor doesn't return a Build, if it failed GetProductVersion would have returned the correct Build. I stand corrected. Somehow I missed the additional calls to GetNativeSystemInfo and GetProductVersion. Yes, at least in Delphi 10.3 (I haven't checked previous versions), TOsVersion detects Windows 8.1 and 10 correctly. Edited April 22, 2019 by dummzeuch Share this post Link to post
dummzeuch 1505 Posted April 22, 2019 1 hour ago, David Heffernan said: I think that the point Angus was making was that he read the text, and did not follow the link. The text seemed to be the first two paragraphs of the blog post, but without mentioning that there was more to be found by following the link. I have to say that I read the post two or three times wondering what it was that you were trying to tell us. Since the text you did include was only part of the story, it would in my view, have been better not to have included any text and just referred us to the offsite link to your blog post. That's at least three people that were confused by the post. Listen to our feedback or not. It's completely voluntary. 😉 Thanks for explaining that. Somehow I thought that adding a link after these few lines would be make it clear that there is more to the post, especially since the category is about blog posts. Apparently it's not. Share this post Link to post
FredS 138 Posted April 22, 2019 25 minutes ago, dummzeuch said: Delphi 10.3 RSP-11530 was fixed for Rio, which means it should also show the correct Build. Share this post Link to post
Sherlock 663 Posted April 23, 2019 14 hours ago, dummzeuch said: Somehow I thought that adding a link after these few lines would be make it clear that there is more to the post, especially since the category is about blog posts. How about turning those few lines into an abstract? Something short and juicy like "In this blog post I'll discuss the possibilities to get the real Windows version". That should be enough to either get the attention of the interested, or inform the uninterested of the contents so they can move on. BTT: Very useful, thank you! Share this post Link to post