DDabLib Old Code (SVN)
Library of Delphi components and units by DelphiDabbler.
Brought to you by:
delphidabbler
File | Date | Author | Commit |
---|---|---|---|
Acknowledgements.md | 2021-09-12 | delphidabbler | [r2062] sysinfo: |
ChangeLog.txt | 2021-10-05 | delphidabbler | [r2077] sysinfo: |
Documentation.URL | 2015-09-10 | delphidabbler | [r1985] sysinfo: |
MPL-2.0.txt | 2012-10-23 | delphidabbler | [r1008] sysinfo: |
PreSVNHistory.txt | 2012-10-24 | delphidabbler | [r1011] sysinfo: |
ReadMe.htm | 2021-09-12 | delphidabbler | [r2063] sysinfo: |
SysInfo-SF-ReadMe.txt | 2013-11-03 | delphidabbler | [r1456] projects: |
Using RtlGetVersion.txt | 2015-09-09 | delphidabbler | [r1979] sysinfo: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- * This Source Code Form is subject to the terms of the Mozilla Public License, * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at http://mozilla.org/MPL/2.0/ * * Copyright (C) 2005-2021, Peter Johnson (@delphidabbler). * * $Rev$ * $Date$ * * Read-me file for System Information Unit. --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title> DelphiDabbler System Information Unit ReadMe </title> <style type="text/css"> body { margin: 1em; padding: 0; font-family: Verdana, Arial, sans-serif; font-size: 11pt; line-height: 150%; } h1 { margin: 0 0 1em 0; padding: 0.5em; border: 1px silver solid; background-color: #eee; font-size: 180%; font-weight: bold; text-align: center; } h1 .subtitle { font-style: italic; margin-top: 0.5em; color: #336; } h2 { margin: 1em 0 0 0; padding: 0; padding-bottom: 6px; border-bottom: 1px silver solid; font-size: 140%; font-weight: bold; } h3 { margin: 0.5em 0 0 0; padding: 0; font-size: 120%; font-weight: bold; } p { margin: 0.5em 0 0 0; padding: 0; } ul, ol { margin: 0.5em 0 0 3em; padding: 0; } ul { list-style-type: square; } ul.spaced li, ol.spaced li { margin-top: 0.5em; } ul.spaced li, ol.spaced li { margin-top: 0.5em; } ul.unspaced li, ol.unspaced li { margin-top: 0; } ul.unspaced li.first, ol.unspaced li.first { margin-top: 0.5em; } code { font-family: "Courier New", Courier, monospace; } a:link { color: #336; text-decoration: underline; } a:visited { color: #669; text-decoration: underline; } a:active { color: #336; text-decoration: underline; } a:hover { text-decoration: underline; } .gototop { margin: 1em 0 0 0; padding: 0.3em 0 0 0; text-align: center; position: relative; float: right; font-weight: bold; } .pullout { border-left: 8px silver solid; background-color: #eee; margin: 0.5em 0 0 0; padding: 0.25em 0.5em; font-style: italic; } .indent { margin-left: 3em; } .highlight { color: #336; font-style: italic; font-weight: bold; } .endnotes { margin: 1.5em 0 0 0; padding: 1em 0 0 0; border-top: 1px silver solid; } .comments { font-style: italic; } .copyright, .copyright a:link, .copyright a:visited, .copyright a:active { margin: 1em 0 0 0; color: gray; font-size: 8pt; text-align: right; } </style> </head> <body> <h1> <div>System Information Unit</div> <div class="subtitle">ReadMe</div> </h1> <h2 id="contents"> Contents </h2> <ul> <li><a href="#description">Description</a></li> <li><a href="#installation">Installation</a></li> <li><a href="#docs">Documentation</a></li> <li><a href="#demo">Demo Projects</a></li> <li><a href="#update">Update History</a></li> <li><a href="#acknowledgements">Acknowledgements</a></li> <li><a href="#license">License</a></li> <li><a href="#bugs">Bugs and Feature Requests</a></li> <li><a href="#author">About the Author</a></li> </ul> <p class="pullout highlight"> This document applies to <em>System Information Unit</em> v5.4.0 and later. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="description"> Description </h2> <p> This unit contains a group of static classes and some global variables that provide information about the user's computer system and operating system. Some useful constants and type definitions are also included. The static classes are: </p> <ul> <li> <var>TPJComputerInfo</var> – provides information about the host computer and current user. </li> <li> <var>TPJSystemFolders</var> – gets the full path to certain system folders. </li> <li> <var>TPJOSInfo</var> – supplies information about the operating system information including the platform, product name, product ID code, version and service packs. </li> </ul> <p> In addition, the unit extends and enhances the information provided by the <code>SysUtils</code> unit's <var>Win32xxx</var> variables (such as <var>Win32Platform</var>) by defining further <var>Win32xxx</var> variables that store the extended operating system information available on later NT platform OSs. </p> <h3> Effect of changes to the Windows API </h3> <p> With the release of Windows 8.1 Microsoft made a controversial decision to deprecate the <var>GetVersion***</var> API functions. These have always been used by the <em>System Information Unit</em> to get OS information. A new method of checking operating system version was recommended using the <var>VerifyVersionInfo</var> API. Unbelievably, this API itself became deprecated in Windows 10, but no viable alternative was introduced. In fact the Windows 10 SDK still uses the newly deprecated API! </p> <p> If the old <var>GetVersion***</var> approach is used Windows 8.1 represents itself as Windows 8 unless the host program has a <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dn481241.aspx" >special manifest</a>. Using the <var>VerifyVersionInfo</var> API gets round that problem and Windows 8.1 reports itself as the correct version. </p> <p> For this reason release 5 of the System Information Unit was revised to use the <var>VerifyVersionInfo</var> API for Windows 8.1 and later while retaining the <var>GetVersion***</var> API for Windows 8 and earlier. </p> <p> With Windows 10, the now deprecated <var>VerifyVersionInfo</var> API only reports Windows 10 correctly if the host program is <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dn481241.aspx" >manifested</a> correctly. If there is no suitable manifest then Windows 10 reports itself as Windows 8, regardless of the API used. Believe it or not, this behaviour is as designed by Microsoft. </p> <p> Unfortunately, the decision made in release 5.0 of the <var>PJSysInfo</var> unit to apply the <var>VerifyVersionInfo</var> only to Windows 8.1 and later results in un-manifested applications running on Windows 10 reporting Windows 7 instead of Windows 8 as documented by Microsoft. To fix this problem the <var>VerifyVersionInfo</var> API is now also used when running on Windows 8. </p> <p> Apart from being more cumbersome and slower, the <var>VerifyVersionInfo</var> API approach differs from the old approach in an important respect. When a program is run in compatibility mode the old <var>GetVersion***</var> API functions would be fooled (or"spoofed") by Windows into reporting the version of the operating system emulated by the compatibility mode (more or less!). This is the way the unit has always behaved in the past. The new approach used for Windows 8.1 introduced in v5.0 of this unit always returns information about the true operating system regardless of any active compatibility mode. As noted above, when adding support for Windows 10, in version 5.1, the use of <var>VerifyVersionInfo</var> was extended to Windows 8, meaning that now Windows 8, 8.1 and 10 cannot be spoofed. This is a change to the behaviour of v5.0 for Windows 8, meaning some code that depended on being able to spoof Windows 8 may no longer work. </p> <p> To make things easier for Windows 2000 and later users (i.e. just about everyone) a bunch of interrogation functions that can't be spoofed have been added to <var>TPJOSInfo</var>. You can also find out if OS spoofing is enabled for the host operating system by examining the <var>CanSpoof</var> method of <var>TPJOSInfo</var>. </p> <p> In summary, we have several inconsistencies in <var>TPJOSInfo</var> all because of some incomprehensible decisions made by Microsoft. They are: </p> <ul> <li> OSs up to and including Windows 7 SP 1 the reported operating system can be "spoofed" by setting the host program's compatibility mode. The exception is that the <var>TPJOSInfo.IsReallyWindowsXXXOrGreater</var> methods for Windows 2000 and later will detect the actual operating system. </li> <li> For Windows 8 and 8.1 the reported operating system cannot be spoofed using compatibility modes, and neither does the presence of a suitable manifest file affect the returned values. This also applies to the relevant <var>TPJOSInfo.IsReallyWindowsXXXOrGreater</var> methods. </li> <li> For Windows 10 the reported operating system cannot be spoofed regardless of whether a suitable manifest is compiled into resources. However, in absence of a such a manifest the version will be reported as Windows 8 instead of Windows 10. This also affects <var>TPJOSInfo.IsReallyWindows10OrGreater</var>, meaning it's not so well named any more! </li> </ul> <p> After exploring and testing a lot of options this really is the best solution I can find. <strong>Thanks a bundle Microsoft!</strong> </p> <p> To add insult to injury when Microsoft released the Windows 10 "November Update" (TH2) – a.k.a "Version 1511" they bumped the OS's build number but didn't update the service pack version information. Therefore existing code didn't report the update other than via the build number. I didn't want to break the existing <var>TPJOSInfo.ServicePack</var> method by pretending that TH2 was really a service pack, so I added a new <var>ServicePackEx</var> method to report any offical services packs and any significant updates that don't declare themselves as service packs. Ho hum! </p> <p> Sorry that this is all so complicated - but it's complicated!! </p> <h3> Debug Mode </h3> <p> To enable the new Windows 8 and later OS information detection code to be debugged on Windows Vista and Windows 7, developers can temporarily define the <code>DEBUG_NEW_API</code> symbol. This causes the same method used for Windows 8 and later detection to used for Windows Vista and Windows 7. </p> <p> To help with debugging developers can also define the <code>DEBUG</code> symbol. Range checking is forced on when <code>DEBUG</code> is defined. </p> <h3> Deleted Code </h3> <p> Version 2 and earlier of the unit provided the <em>TPJSysInfo</em> component and various <var>SIGetxxx</var> functions. As of v3.0 these were deprecated and finally removed at v4.0. </p> <h3> Compatibility </h3> <p> This unit is designed for compilation with the 32 bit and 64 bit Windows Delphi compilers. It has been tested with Delphi XE and XE4 only. An attempt has been made to retain compatibility back to Delphi 4, but this has not been tested. </p> <p> Compilation on old Delphi versions that do not support setting registry access flags via <var>TRegistry</var> is not recommended since parts of the code may not work correctly on 64 bit Windows. <strong>Use of Delphi 6 or later is strongly recommended.</strong> </p> <p> The unit not compatible with .NET. </p> <p> The unit should operate correctly on the following platforms: </p> <ul> <li> Windows 95 to Me </li> <li> All 32 bit NT platform operating systems. </li> <li> Windows 64 bit, either as part of a 32 bit or 64 bit process. </li> </ul> <p> Operation on a 64 bit OS was last tested with Windows 10. Other OSs have not been tested. </p> <p> The code is not suitable for non-Windows operating systems since it depends on the Windows API. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="installation"> Installation </h2> <p> The <em>System Information Unit</em> and demo programs are supplied in a zip file. Before installing you need to extract all the files, preserving the directory structure. The following files will be extracted: </p> <ul> <li> <code><strong>PJSysInfo.pas</strong></code> – Source code of the static classes, global variables, constants and type definitions. </li> <li> <code>ReadMe.htm</code> – This read-me file. </li> <li> <code>ChangeLog.txt</code> – The unit's change log. </li> <li> <code>MPL-2.0.txt</code> – Mozilla Public Licence v2.0. </li> <li> <code>Documentation.URL</code> – Short-cut to online documentation. </li> </ul> <p> In addition to the above files you will find the source code of two demo projects and their read-me file in the <code>Demos</code> directory. </p> <p> There are three possible ways to use the unit. </p> <ol class="spaced"> <li> The simplest way is to add <code>PJSysInfo.pas</code> to your projects as you need it. </li> <li> To make the unit easier to re-use you can either copy it to a folder on your Delphi search path, or add the folder where you extracted the unit to the search path. You then simply use the unit as required without needing to add it to your project. </li> <li> For maximum portability you can add the unit to a Delphi package. </li> </ol> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="docs"> Documentation </h2> <p> The <em>System Information Unit</em> is fully <a href="https://github.com/delphidabbler/ddab-lib-docs/blob/master/Docs/SystemInformationUnit.md" >documented online</a>. </p> <p> There is no help file. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="demo"> Demo Projects </h2> <p> Two demo projects are included in the download in the <code>Demos\VCL</code> and the <code>Demos\FMX</code> directories. The former compiles to a VCL application using Delphi XE (and possibly even Delphi 4) or later while the latter uses the FireMonkey 2 framework and requires Delphi XE3 as a minimum. Both projects can be compiled to either Windows 32 bit or 64 bit targets. </p> <p> Each project contains a tab set where each tab displays the information from one of the classes or the global variables. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="update"> Update History </h2> <p> A complete change log is provided in a text file that is included in the download. </p> <h2 id="acknowledgements"> Acknowledgements </h2> <p> Information from numerous websites has been used while developing this code. Several individuals have also suggested solutions or contributed code. </p> <p> Full details are provided in the file <a href="https://sourceforge.net/p/ddablib/code/HEAD/tree/trunk/projects/sysinfo/Docs/Acknowledgements.md" ><code>Acknowledgements.md</code></a> in the <code>projects\sysinfo\Docs</code> subdirectory of the System Information Unit's Subversion repository trunk. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="license"> License </h2> <p> The <em>System Information Unit</em> is released under the terms of the <a href="http://www.mozilla.org/MPL/2.0/" >Mozilla Public License, v2.0</a>. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="bugs"> Bugs and Feature Requests </h2> <p> Bugs can be reported or new features requested via the <a href="https://sourceforge.net/p/ddablib/tickets/" >Issue Tracker</a>. </p> <p> First review any open tickets to check if a similar report has been made. If so please add any information you can as a comment rather than creating a new ticket. If there's no similar report you should create a new ticket using the <em>Create Ticket</em> button. </p> <p> Fill out the resulting form providing as much information as possible. Because the ticketing system is used for all DelphiDabbler Code Library projects you need to identify this project by entering <code>sysinfo</code> in the <em>Project</em> edit box. To report a bug choose <code>Defect</code> from the <em>Type</em> edit box or select <code>Enhancement</code> if you are suggesting a new feature. </p> <p class="gototop"> » <a href="#contents">Contents</a> </p> <h2 id="author"> About the Author </h2> <p> I'm Peter Johnson (@delphidabbler) – a hobbyist programmer living in Ceredigion in West Wales, UK, writing write mainly in Delphi. </p> <div class="endnotes"> <div class="comments"> Please use the Issue Tracker noted above to report bugs and request new features. </div> <div class="copyright"> This document is copyright © 2005-2020, P D Johnson (<a href="http://gravatar.com/delphidabbler" >http://gravatar.com/delphidabbler</a>). </div> </div> </body> </html>