diff --git a/Build.html b/Build.html index fc6947166..5dde59363 100644 --- a/Build.html +++ b/Build.html @@ -6,7 +6,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2009-2023, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2009-2024, Peter Johnson (gravatar.com/delphidabbler). * * Instructions for building CodeSnip from source. --> @@ -284,11 +284,19 @@

- This program is used to create CodeSnip's release file. - You can get a Windows command line version at + This program is used to create CodeSnip's release file. The InfoZip + version of zip is required. You can get a Windows command line version at http://stahlforce.com/dev/index.php?tool=zipunzip. + >http://stahlforce.com/dev/index.php?tool=zipunzip. +

+ +

+ Warning: The above link is http only. If you or + your browser object to the insecure link you can download an identical version + from delphidabbler.com, using the https protocol. See https://delphidabbler.com/extras/info-zip.

@@ -513,12 +521,14 @@

| +-- exe - receives executable code and compiled help file | | | +-- release - receives release files + | | + | +-- ~tmp~ - store for temp files ceated in release process | ...

If the _build/bin folder already existed, it will have been emptied. - In addition, Make will have created a .cfg file from + In addition, Make will have created a .cfg file from a template in the Src folder. This .cfg file is needed for DCC32 to run correctly. The file will be ignored by Git.

@@ -580,7 +590,7 @@

You have several options:

- +

- Each of these options is described below. All except the last assume that + Each of these options is described below. All except options 5 and 6 assume that Make config has been run.

@@ -648,7 +658,7 @@

> Make -DPORTABLE codesnip

- Again the executable is placed in the _build/exe folder, but this time + Again the executable is placed in the _build\exe folder, but this time it is named CodeSnip-p.exe

@@ -665,12 +675,17 @@

The compiled help file will be written to the _build\exe folder.

+ +

+ The same help file is used for the standard and portable editions. +

+

Build the Setup Program

- The setup program requires that the CodeSnip excutable and the + The setup program requires that the CodeSnip executable and the compiled help file are already present in the _build\exe directory.

@@ -690,7 +705,7 @@

The setup program is named CodeSnip-Setup-x.x.x.exe, where x.x.x is the version number extracted from CodeSnip's version - information. It is placed in the _build/exe directory. + information. It is placed in the _build\exe directory.

@@ -715,7 +730,7 @@

Make can create zip files containing all the files that are included in a release. - Zip files are written to the _build/release directory. + Zip files are written to the _build\release directory.

@@ -723,9 +738,13 @@

- The release file for the standard edition of CodeSnip includes the - setup file along with ReadMe.txt from the Docs - directory. Both files must exist. + The release zip file for the standard edition requires that the setup files is already + present in the _build\exe directory. +

+ +

+ The release file includes the setup file along with ReadMe.txt + that is automatically generated from Docs\ReadMe-standard.txt.

@@ -752,9 +771,16 @@

- The release file for the portable edition includes the portable executable - file, CodeSnip-p.exe, the help file CodeSnip.chm and - several files from the Docs directory. All must be present. + The release zip file for the portable edition cannot be created until the + CodeSnip excutable and the compiled help file are already present in the + _build\exe directory. +

+ +

+ The release file includes the portable executable file, CodeSnip-p.exe, + the help file CodeSnip.chm, Docs\License.html and + ReadMe.txt that is automatically generated from + Docs\ReadMe-portable.txt.

@@ -844,6 +870,31 @@

zip file names can be used here too.

+

+ There is also a quicker way to build a release, but you must provide a version number to use it. First navigate up + to the repository root. Then run +

+ +
> Deploy 9.9.9
+ +

+ where 9.9.9 is the release version number. +

+ +

+ This command will build both the standard and portable executables, the help file, the standard edition setup file + and finally create the release zip files for both editions, with the release version number incorporated in the file names. +

+ +

+ Using Deploy 9.9.9 is the equivalent of doing: +

+ +
> cd Src
+> Make -DVERSION=9.9.9
+> Make -DPORTABLE -DVERSION=9.9.9
+> cd ..
+

Clean Up

diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aeb246be..456f8baa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,21 @@ Releases are listed in reverse version number order. > Note that _CodeSnip_ v4 was developed in parallel with v3 for a while. As a consequence some v3 releases have later release dates than early v4 releases. +## Release v4.24.0 of 23 October 2024 + +* Compilers with which a snippet has not been tested are now omitted from snippet information that is copied to the clipboard and included in print outs [issue #143]. +* Reversed order of compilers in the snippets editor's _Compile Results_ tab so that later compilers are display first. This change was accidentally left out of release v4.22.0 when similar changes were made in other parts of the UI [issue #135]. +* Release version number is now displayed in the program title bar [issue #122]. +* Fixed incorrect copyright date displayed in About Box [issue #129]. +* Fixed bug when checking for correct preamble bytes (BOMs) in UTF-8 and UTF-16 format text files [issue #139]. +* Portable and Standard edition now use the same program names. Portable edition was previously declaring itself as _DelphiDabbler CodeSnip-p_ instead of _DelphiDabbler CodeSnip_ [issue #130]. +* Updated operating system detection code [issues #126 and #144]. +* Added `Deploy.bat` script to create and package both the CodeSnip standard and portable releases [issue #128]. +* Documentation changes: + * CodeSnip standard and portable releases now each have their own release read-me files instead of both releases being shipped with the same read-me [issue #127]. Updated `Build.html` and `README.md` re this change. + * Updated and corrected REML documentation and REML help topic. Those documents and others that discuss REML were also changed to link to authoritative REML definitions in the `delphidabbler/reml` repository. [issues #131, #133 & #134]. + * Updated `Build.html` with alternative, more secure, download link for `zip.exe` program that is required to package releases [issue #137]. + ## Release v4.23.0 of 02 April 2024 * Removed marketing names (e.g. "Athens" or "Rio") from Delphi compiler names to save space when the compiler names are displayed in the UI [issue #125]. diff --git a/Deploy.bat b/Deploy.bat new file mode 100644 index 000000000..23d95a425 --- /dev/null +++ b/Deploy.bat @@ -0,0 +1,99 @@ +:: 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 https://mozilla.org/MPL/2.0/ +:: +:: Copyright (C) 2024, Peter Johnson (gravatar.com/delphidabbler). +:: +:: Deploy script for CodeSnip. +:: +:: This script compiles release versions of the standard and portable editions +:: of CodeSnip and places them into two different zip files ready for release. +:: +:: This script uses Embarcadero Make. Various other programs are required to +:: run Make. See Src/Makefile for details. +:: +:: To use the script: +:: 1) Set the environment variables required for Make to succeed. See +:: Src/Makefile for details +:: 2) Change directory to that where this script is located. +:: 3) Run the script. +:: +:: Usage: +:: Deploy +:: where +:: is the version number of the release, e.g. 0.5.3-beta or 1.2.0. + +@echo off + +setlocal + +:: Check for required parameter +if "%1"=="" goto paramerror + +:: Store parameter +set Version=%1 + +:: Store common make parameters +set CommonParams=-DVERSION=%Version% + +:: Store standard edition make parameters +set StandardParams=%CommonParams% + +:: Store portable edition make parameters +set PortableParams=-DPORTABLE %CommonParams% + +:: Set command line +set MakeCmd=Make +set StandardMakeCmd=%MakeCmd% %StandardParams% +set PortableMakeCmd=%MakeCmd% %PortableParams% + +echo ---------------------------------------------- +echo Deploying CodeSnip Standard And Portable Builds +echo ----------------------------------------------- +echo. +echo Standard edition Make command: %StandardMakeCmd% +echo Portable edition Make command: %PortableMakeCmd% + +cd Src + +echo. +echo. +echo. +echo ========================= +echo Building Standard edition +echo ========================= +echo. +echo. +%StandardMakeCmd% + +echo. +echo. +echo. +echo ========================= +echo Building Portable edition +echo ========================= +echo. +echo. +%PortableMakeCmd% + +echo. +echo. +echo. +echo ==================== +echo Deployment completed +echo ==================== + +goto end + +:: Error messages + +:paramerror +echo. +echo ***ERROR: Please specify a version number as a parameter +echo. +goto end + +:: End +:end + +endlocal diff --git a/Docs/Design/FileFormats/user-db.html b/Docs/Design/FileFormats/user-db.html index bc761983e..d8d7773f0 100644 --- a/Docs/Design/FileFormats/user-db.html +++ b/Docs/Design/FileFormats/user-db.html @@ -322,15 +322,15 @@

  • version 6.0 to 6.10: Content is formatted text - encoded in REML markup. REML v4 is supported. + encoded in REML markup. REML v4 is supported.
  • version 6.11 & 6.12: Content is formatted text - encoded in REML markup. REML v5 is supported. + encoded in REML markup. REML v5 is supported.
  • version 6.13 & later: Content is formatted text - encoded in REML markup. REML v6 is supported. + encoded in REML markup. REML v6 is supported.
  • @@ -460,26 +460,26 @@

    version 2 and later: Additional information about a snippet. Content is formatted text encoded in - REML markup. + REML markup.
    • - version 2: supports REML v1. + version 2: supports REML v1.
    • - version 3: supports REML v2. + version 3: supports REML v2.
    • - version 4: supports REML v3. + version 4: supports REML v3.
    • - versions 5 & 6.10: supports REML v4. + versions 5 & 6.10: supports REML v4.
    • - version 6.11 & 6.12: supports REML v5. + version 6.11 & 6.12: supports REML v5.
    • - version 6.13 & later: supports REML v6. + version 6.13 & later: supports REML v6.
    @@ -788,7 +788,7 @@

    Supported Delphi compilers from Delphi 2 to Delphi 2007 plus Free Pascal.

    - REML not supported. + REML not supported.

    Data files were ANSI text using code page 1252. The XML file was in UTF-8 format with no BOM and no XML encoding attribute. @@ -833,8 +833,8 @@

    - The version of REML supported by the - codesnip-data/routines/routine/extra tag was v1. + The version of REML supported by the + codesnip-data/routines/routine/extra tag was v1.

    @@ -862,8 +862,8 @@

    - The version of REML supported by the - codesnip-data/routines/routine/extra tag was updated to v2. + The version of REML supported by the + codesnip-data/routines/routine/extra tag was updated to v2.

    @@ -875,8 +875,8 @@

    Introduced with CodeSnip v3.0.1.

    - The version of REML supported by the - codesnip-data/routines/routine/extra tag was updated to v3. + The version of REML supported by the + codesnip-data/routines/routine/extra tag was updated to v3.

    @@ -937,8 +937,8 @@

    New "class" and "unit" snippet kinds supported.

    - The version of REML supported by the - codesnip-data/routines/routine/extra tag was updated to v4. + The version of REML supported by the + codesnip-data/routines/routine/extra tag was updated to v4.

    @@ -950,7 +950,7 @@

    Introduced with CodeSnip v4.0 beta 1.

    - A snippet's description is now stored as formatted text using REML v4 markup. Previously the description was plain text. + A snippet's description is now stored as formatted text using REML v4 markup. Previously the description was plain text.

    The following tags were introduced: @@ -1028,7 +1028,7 @@

    Version 6.11 - 16 December 2022

    - Updated with CodeSnip v4.21.0 to add support for REML v5, which is backwards compatible with REML v4. + Updated with CodeSnip v4.21.0 to add support for REML v5, which is backwards compatible with REML v4.
    Version 6.12 - 7 November 2023 @@ -1040,7 +1040,7 @@

    Version 6.13 - 2 April 2024

    - Updated with CodeSnip v4.23.0 to add support for REML v6, which is backwards compatible with REML v4. + Updated with CodeSnip v4.23.0 to add support for REML v6, which is backwards compatible with REML v4.
    @@ -1073,7 +1073,7 @@

    - into valid REML code that simulates the parsed content of the codesnip-data/routines/routine/extra tag. + into valid REML code that simulates the parsed content of the codesnip-data/routines/routine/extra tag.

    @@ -1090,7 +1090,7 @@

    • Convert the plain text snippet description read from - codesnip-data/routines/routine/description into the REML + codesnip-data/routines/routine/description into the REML equivalent of a single paragraph containing the description.
    • @@ -1100,7 +1100,7 @@

    - Readers of v2 and later files may parse REML from any file version as if it were REML v6, since all versions of REML up to v6 are compatible. + Readers of v2 and later files may parse REML from any file version as if it were REML v6, since all versions of REML up to v6 are compatible.

    diff --git a/Docs/Design/reml.html b/Docs/Design/reml.html index b945f4332..fb8b0ce15 100644 --- a/Docs/Design/reml.html +++ b/Docs/Design/reml.html @@ -19,7 +19,7 @@ - + @@ -219,454 +116,56 @@ </p> </div> - <nav id="contents"> - <ul> - <li> - <a href="#intro">Introduction</a> - </li> - <li> - <a href="#tags">Tags</a> - </li> - <li> - <a href="#entities">Character Entities</a> - </li> - <li> - <a href="#changes">Change Log</a> - </li> - </ul> - </nav> - </header> -<section id="intro"> - - <h1> - Introduction - </h1> - - <p> - REML is a little markup language that can be used to style text. It is used in Code Snippets collection meta data for certain properties of a snippet. - </p> - <p> - The REML language is a SGML language similar to a greatly simplified XHTML. The are a small number of tags and character entities that can be used. - </p> - <aside> - <strong>Note:</strong> The language described here is REML v6. v4 is still in regular use in CodeSnip up to v4.20.x. Earlier versions are obsolete. - </aside> - -</section> +<main> -<section id="tags"> +<section id="intro"> <h1> - Tags + About REML </h1> <p> - There are two types of tags: block level and in-line. - </p> - - <p> - If an unrecognised tag is encountered an REML code the interpreter <em>should</em> report an error. However, providing start and end tags are matched, the interpreter <em>may</em> choose to simply ignore the tags. - </p> - - <h2> - Block Level Tags - </h2> - - <p> - Block level tags separate the enclosed text into paragraphs of some description. The supported tags are: - </p> - <ul class="half-spaced"> - <li> - <code class="value"><p>...</p></code> – Renders the enclosed markup as a simple paragraph. - </li> - <li> - <code class="value"><heading>...</heading></code> – Renders the enclosed markup as a heading. - </li> - <li> - <code class="value"><ol>...</ol></code> – Renders the enclosed markup as an ordered list. - </li> - <li> - <code class="value"><ul>...</ul></code> – Renders the enclosed markup as an unordered list. - </li> - <li> - <code class="value"><li>...</li></code> – Renders the enclosed markup as a list item. - </li> - </ul> - <p> - The following rules apply to the use of block level tags: - </p> - <ul class="unspaced"> - <li> - <span class="very-strong">Must</span> be matched, e.g. <code class="value"><p></code> <span class="very-strong">must</span> have a matching <code class="value"></p></code>. - </li> - <li> - <code class="value"><p>...</p></code> and <code class="value"><heading>...</heading></code> blocks <span class="very-strong">must not</span> contain other block level tags. - </li> - <li> - <code class="value"><ol>...</ol></code> and <code class="value"><ul>...</ul></code> blocks <span class="very-strong">must only</span> contain one or more <code class="value"><li>...</li></code> blocks. - </li> - <li> - <code class="value"><li>...</li></code> blocks <span class="very-strong">must</span> only be used within <code class="value"><ol>...</ol></code> and <code class="value"><ul>...</ul></code> blocks. <em>May</em> contain <code class="value"><p>...</p></code> and <code class="value"><heading>...</heading></code> blocks, but it is permitted to include text and inline tags directly without enclosing them one of the permitted blocks. Nested lists are permitted by including further <code class="value"><ul>...</ul></code> and <code class="value"><ol>...</ol></code> blocks. - </li> - <li> - All text <em>should</em> be embedded within <code class="value"><p>...</p></code>, <code class="value"><heading>...</heading></code> or <code class="value"><li>...</li></code> block level tags, e.g. <code class="value"><heading>heading</heading><p>text</p></code> or simply <code class="value"><p>text</p></code>. - </li> - <li> - White space between blocks <span class="very-strong">must</span> be ignored. - </li> - </ul> - <p> - Here is a valid example: - </p> - <pre class="sample"><heading>Hello</heading> -<p>Hello World</p> -<ol> - <li>one</li> - <li><p>two</p></li> - <ul> - <li>two A</li> - <li>two B</li> - <ul> - <li>three</li> -</ol></pre> - <p> - Strictly speaking, the following example is invalid code – all occurrences of <code class="value">wrong</code> are in error because they are not contained within block tags. - </p> - <pre class="sample">wrong <heading>blah</heading> wrong <p>blah</p> wrong</pre> - <p> - However interpreting code <em>may</em> interpret this permissively. If this is done the text outside blocks <em>should</em> be interpreted as if it was enclosed in <code class="value"><p></code> and <code class="value"></p></code> tags. Therefore the above code would be interpreted as: + REML is a little markup language that can be used to style text. It is a SGML language similar to HTML, albeit much smaller. A small number of tags and character entities are supported. </p> - <pre class="sample"><p>wrong </p><heading>blah</heading><p>wrong </p><p>blah</p><p>wrong</p></pre> - <aside> - <strong>Note:</strong> Code Snippets Database collections <em>may</em> contain such non-conforming REML. Therefore interpreters of REML that need to accept such collections <span class="very-strong">must</span> be able to handle text without enclosing block tags. - </aside> - <h2> - Inline Tags - </h2> - - <p> - In-line tags format the text enclosed between the start and end tags. - </p> <p> - Here are the available in-line tags: + See the <a href="https://htmlpreview.github.io/?https://raw.githubusercontent.com/delphidabbler/reml/main/docs/reml-v6.html">REML v6 language definition</a> for full details. </p> - <ul class="half-spaced"> - <li> - <code class="value"><strong>...</strong></code> – Renders the enclosed markup with strong emphasis. - </li> - <li> - <code class="value"><em>...</em></code> – Emphasises the enclosed markup. - </li> - <li> - <code class="value"><var>...</var></code> – Used to indicate the enclosed markup is a variable. - </li> - <li> - <code class="value"><warning>...</warning></code> – Used for warning text. - </li> - <li> - <code class="value"><mono>...</mono></code> – Renders markup in a mono-spaced font. - </li> - <li> - <code class="value"><a href="url">...</a></code> – Creates a hyper-link. The <code class="value">href</code> attribute <span class="very-strong">must</span> specify the required URL, which <span class="very-strong">must</span> use one of the <code class="value">http</code>, <code class="value">https</code> or <code class="value">file</code> protocols; others are not permitted. If you use the <code class="value">file</code> protocol it <span class="very-strong">must</span> reference a valid local or network file. - </li> - </ul> - <p> - The following rules apply to the use of in-line tags: - </p> - <ul class="unspaced"> - <li> - In-line tags <span class="very-strong">must</span> be embedded inside a valid block level tag. E.g. <code class="value"><p>one<strong>two</strong>three</p></code>. - </li> - <li> - Tags <span class="very-strong">must</span> match. E.g. <code class="value"><em></code> must be matched with <code class="value"></em></code>. - </li> - <li> - Tags may be nested, providing the tags are balanced. E.g. <code class="value"><em>blah <var>blah</var></em></code> is valid but <code class="value"><em>blah <var>blah</em></var></code> is not. - </li> - </ul> - <p> - Examples: - </p> - <pre class="sample"><p>Make stuff <strong>stand out</strong>.</p> -<p><em>Emphasised <warning>warning!</warning></em></p> -<p>Refer to a function <var>parameter</var>.</p> -<p>Use the: <mono>Windows</mono> unit.</p> -<p>See this <a href="https://example.com">example</a>.</p></pre> </section> -<section id="entities"> +<section id="reml-in-codesnip"> <h1> - Character Entities + REML in CodeSnip </h1> <p> - Some symbolic character entities are supported in REML. Many symbols, but not all, have analogues in the list of supported character entities in XHTML or HTML 5. Some entities have alternate symbols. Here is the complete list. + Code snippets include REML to format snippets' description and extra fields. CodeSnip interprets and renders the REML when displaying snippets in its UI and when printing them. </p> - <table> - <thead> - <tr> - <th>Character Entity</th> - <th>Actual Character</th> - </tr> - </thead> - <tbody> - <tr> - <td><code>&amp;</code></td> - <td>&</td> - </tr> - <tr> - <td><code>&quot;</code></td> - <td>"</td> - </tr> - <tr> - <td><code>&gt;</code></td> - <td>></td> - </tr> - <tr> - <td><code>&lt;</code></td> - <td><</td> - </tr> - <tr> - <td><code>&copy;</code></td> - <td>©</td> - </tr> - <tr> - <td><code>&times;</code></td> - <td>×</td> - </tr> - <tr> - <td><code>&divide;</code> or <code>&div;</code></td> - <td>÷</td> - </tr> - <tr> - <td><code>&plusmn;</code></td> - <td>±</td> - </tr> - <tr> - <td><code>&ne;</code> or <code>&neq;</code></td> - <td>≠</td> - </tr> - <tr> - <td><code>&sum;</code></td> - <td>∑</td> - </tr> - <tr> - <td><code>&infin;</code></td> - <td>∞</td> - </tr> - <tr> - <td><code>&pound;</code></td> - <td>£</td> - </tr> - <tr> - <td><code>&curren;</code></td> - <td>¤</td> - </tr> - <tr> - <td><code>&yen;</code></td> - <td>¥</td> - </tr> - <tr> - <td><code>&euro;</code></td> - <td>€</td> - </tr> - <tr> - <td><code>&cent;</code></td> - <td>¢</td> - </tr> - <tr> - <td><code>&dagger;</code></td> - <td>†</td> - </tr> - <tr> - <td><code>&ddagger;</code> or <code>&Dagger;</code></td> - <td>‡</td> - </tr> - <tr> - <td><code>&hellip;</code></td> - <td>…</td> - </tr> - <tr> - <td><code>&para;</code></td> - <td>¶</td> - </tr> - <tr> - <td><code>&sect;</code></td> - <td>§</td> - </tr> - <tr> - <td><code>&reg;</code></td> - <td>®</td> - </tr> - <tr> - <td><code>&frac14;</code></td> - <td>¼</td> - </tr> - <tr> - <td><code>&frac12;</code> or <code>&half;</code></td> - <td>½</td> - </tr> - <tr> - <td><code>&frac34;</code></td> - <td>¾</td> - </tr> - <tr> - <td><code>&micro;</code></td> - <td>µ</td> - </tr> - <tr> - <td><code>&deg;</code></td> - <td>°</td> - </tr> - <tr> - <td><code>&cent;</code></td> - <td>¢</td> - </tr> - <tr> - <td><code>&laquo;</code></td> - <td>«</td> - </tr> - <tr> - <td><code>&raquo;</code></td> - <td>»</td> - </tr> - <tr> - <td><code>&iquest;</code></td> - <td>¿</td> - </tr> - <tr> - <td><code>&apos;</code></td> - <td>'</td> - </tr> - </tbody> - </table> - - <aside> - <strong>Note:</strong> the '<' and '&' characters are special within the markup and cannot be used literally, even when you are just entering plain text. You <span class="very-strong">must</span> use the <code class="value">&lt;</code> character entity in place of <code class="value"><</code> and <code class="value">&amp;</code> instead of <code class="value">&</code>. For example to write <code class="value">x<y</code> in REML use <code class="value">x&lt;y</code> and to write <code class="value">you & me</code> use <code class="value">you &amp; me</code>. - </aside> - <p> - To express other special symbols for which there is no symbolic character entity, numeric character entities can be used. For example to display the 'Ω' character (Unicode <em>Greek capital letter Omega</em>) use <code class="value">&#937;</code>. + CodeSnip currently supports REML v6. Earlier versions of CodeSnip supported different versions of REML: </p> - - <aside> - <strong>Note:</strong> Numeric entities should be used with caution because the characters they represent may vary across different text encodings, whereas symbolic entities are safe across encodings. - </aside> - -</section> - - -<section id="changes"> - - <h1>Change Log</h1> - - <p> - This section notes the changes in the various versions of REML. - </p> - - <p> - <strong>v1 of 2008-12-31</strong> - </p> - - <p> - Introduced in CodeSnip v2.2.5 - </p> - - <ul> - <li> - Supported tags: <code class="value"><strong></code> and <code class="value"><a></code>. - </li> - <li> - Supported entities: <code class="value">&gt;</code>, <code class="value">&lt;</code>, <code class="value">&quot;</code> and <code class="value">&amp;</code>. - </li> - <li> - Supported protocols for use in <code class="value"><a></code> tags: <code class="value">http</code>. - </li> - </ul> - - <p> - <strong>v2 of 2009-06-29</strong> - </p> - - <p> - Introduced in CodeSnip v3.0 - </p> - - <ul> - <li> - Added tags: <code class="value"><em></code>, <code class="value"><var></code>, <code class="value"><warning></code>, <code class="value"><mono></code>, <code class="value"><p></code> and <code class="value"><heading></code>. - </li> - <li> - Added entity: <code class="value">&copy;</code>. - </li> - </ul> - - <p> - <strong>v3 of 2009-07-06</strong> - </p> - - <p> - Introduced in CodeSnip v3.0.1 - </p> - - <ul> - <li> - Added protocol for use in <code class="value"><a></code> tags: <code class="value">file</code>. - </li> - </ul> - - <p> - <strong>v4 of 2011-12-31</strong> - </p> - - <p> - Introduced in CodeSnip v4.0 alpha 1 (preview) - </p> - - <ul> - <li> - Added protocol for use in <code class="value"><a></code> tags: <code class="value">https</code>. - </li> - </ul> - - <p> - <strong>v5 of 2022-12-16</strong> - </p> - - <p> - Introduced in CodeSnip v4.21.0 - </p> - + <ul> - <li> - Added support for lists with the <code class="value"><ol></code>, <code class="value"><ul></code> & <code class="value"><li></code> block tags. - </li> - <li> - Added entities: <code class="value">&times;</code>, <code class="value">&divide;</code>, <code class="value">&div;</code> <code class="value">&plusmn;</code>, <code class="value">&ne;</code>, <code class="value">&neq;</code>, <code class="value">&sum;</code>, <code class="value">&infin;</code>, <code class="value">&pound;</code>, <code class="value">&curren;</code>, <code class="value">&yen;</code>, <code class="value">&euro;</code>, <code class="value">&cent;</code>, <code class="value">&dagger;</code>, <code class="value">&ddagger;</code>, <code class="value">&Dagger;</code>, <code class="value">&hellip;</code>, <code class="value">&para;</code>, <code class="value">&sect;</code>, <code class="value">&reg;</code>, <code class="value">&frac14;</code>, <code class="value">frac12</code>, <code class="value">&half;</code>, <code class="value">&frac34;</code>, <code class="value">&micro;</code>, <code class="value">&deg;</code>, <code class="value">&laquo;</code>, <code class="value">&raquo;</code> & <code class="value">&iquest;</code>. - </li> + <li>REML v1 was first supported by CodeSnip v2.2.5</li> + <li>REML v2 was first supported by CodeSnip v3.0</li> + <li>REML v3 was first supported by CodeSnip v3.0.1</li> + <li>REML v4 was first supported by CodeSnip v4.0 alpha 1 (preview)</li> + <li>REML v5 was first supported by CodeSnip v4.21.0</li> + <li>REML v6 was first supported by CodeSnip v4.23.0</li> </ul> <p> - <strong>v6 of 2024-04-02</strong> + All CodeSnip versions are backward compatible with earlier versions of REML. </p> - <p> - Introduced in CodeSnip v4.23.0 - </p> +</section> - <ul> - <li> - Added entity: <code class="value">&apos;</code>. - </li> - </ul> - - </section> +</main> </body> diff --git a/Docs/ReadMe-portable.txt b/Docs/ReadMe-portable.txt new file mode 100644 index 000000000..e0883fa5c --- /dev/null +++ b/Docs/ReadMe-portable.txt @@ -0,0 +1,257 @@ +================================================================================ + +DELPHIDABBLER CODESNIP v4 PORTABLE EDITION README + +================================================================================ + + +What is CodeSnip? +================================================================================ + +DelphiDabbler CodeSnip 4 is a code snippets repository targetted at the Pascal / +Delphi programming languages. It can download and display code snippets from the +online DelphiDabbler Code Snippets database as well as maintain a database of +user-defined snippets. + +It displays details of each snippet in the database and can test-compile them +with each installed Win32 version of Delphi from Delphi 2 to Delphi 12.x and +Free Pascal. + +Compilable Pascal units can be created that contain selected snippets. + + +CodeSnip Editions +================================================================================ + +This document relates to the PORTABLE edition of CodeSnip. This edition can be +run from any writeable removable storage medium (e.g. a USB memory stick) or +from any folder on the computer's hard disk. It makes no changes to the host +computer. + +There is also a standard edition of the program. This edition is installed on +the user's computer using an installer. It records its presence in the registry +and stores data in the system's application and user data directories. You can +get the standard edition from the same place you downloaded the this edition. + +You can run both the standard and portable editions together on the same +computer and even run them at the same time. However, each edition maintains its +own settings and keeps its own copies of the snippets databases. To share user +defined snippets you must export them from one edition and import into the +other. CodeSnip provides no mechanism for keeping them synchronised. + + +Installation +================================================================================ + +CodeSnip requires Windows 2000 or later. It also requires MS Internet Explorer 6 +or later, although IE 8, 9 or 10 are strongly recommended. Note that recent +releases have only been tested on Windows 11. + +The portable edition of CodeSnip 4 is distributed in a zip file that contains +the program executable, the help file and various documentation files. + +Install the program using the following steps: + +1) Mount any storage medium on which you want to install CodeSnip. + +2) Create a folder on the storage medium or on your computer's internal disk in + which to copy the required files. + +3) Copy the files CodeSnip-p.exe (the executable program) and CodeSnip.chm + (the help file) into the folder you created. + + CodeSnip does not need the other files included in the zip file in order to + run, but you may find them useful. Copy them if you wish. + +Run the program by double clicking it. When it first runs it will create two +sub-directories within the folder where you installed the program. These will +be named AppData and UserData. Do not remove these directories or alter any of +the contents because CodeSnip uses them to store configuration data along with +your code snippets. + +No files are written outside the folder where you copied the files and the +registry is not modified. + +** WARNING: When updating an existing portable installation with a new version +of CodeSnip it is important that you do not change or delete the AppData and +UserData folders. If you do this you risk loosing your settings and/or database. + + +Uninstallation +================================================================================ + +Simply delete the folder where you installed the portable edition of CodeSnip +along with all its contents. + +Be aware that any snippets you have created will be lost. If you want to keep +them for use in another CodeSnip installation, either export them or back up the +user database before deleting the folder. See the help file for details of how +to do this. + + +Downloading & Updating the Code Snippets Database +================================================================================ + +The online DelphiDabbler Code Snippets database is not installed with the +program. + +CodeSnip's start-up screen shows details of any installed databases. If there is +no copy of the online database then a link is displayed that enables the +database to be installed. This link opens the "Install or Update DelphiDabbler +Snippets Database" wizard dialogue box. The dialogue box explains how to +download and install the database. + +You can download or update the database later by opening the same dialogue box +using the "Database | Install or Update DelphiDabbler Snippets Database" menu +option. + + +Configuring CodeSnip to Work With Your Compilers +================================================================================ + +A feature of CodeSnip is its ability to test compile snippets with any installed +Windows 32 version of Delphi (from Delphi 2 to Delphi.x) and FreePascal, +providing some simple rules are followed. + +When CodeSnip is first installed it knows nothing about the available compilers +and so test compilations cannot be performed. If any supported Delphi compiler +is detected when the program is first run you will be given the option of +registering it. This does not work for Free Pascal. + +You can also tell CodeSnip about the available compilers by using the "Tools | +Configure Compilers" menu option. The resulting dialogue can automatically +detect all installed versions of supported Delphi compilers at the click of a +button. Free Pascal, where installed, must be set up manually. The Welcome page +displays a list of compilers it has been configured to work with. + +Compilers that do not use English as their output language will need further +configuration. See the help file for information (look up "configure compilers +dialogue" in the help file index). + +Each user can configure compilers differently. + +Delphi XE2 and later may need to be configured to search for required units in +the correct namespaces. This is explained in the Add/Edit Snippet Dialogue Box +help topic and in the FAQ at +https://github.com/delphidabbler/codesnip-faq/blob/master/UsingCodeSnip.md#faq-7 + +Any type of snippet other than "freeform" can be test compiled. + + +Updating the Program +================================================================================ + +Updates are published on GitHub. See +https://github.com/delphidabbler/codesnip/releases + +News of new updates is published on the CodeSnip Blog: +https://codesnip-app.blogspot.com/. + + +Known Installation and Upgrading Issues +================================================================================ + ++ If you have updated to CodeSnip v4.2.0 or later from any earlier v4 release, + and then run the earlier version of the program again, its saved main window + state, size, position and layout will have been lost and the program will + display in its default size. + ++ If you have updated to CodeSnip v4.3.0 or later from v4.2.x or earlier any -NS + command line options you have specified on the "Switches" (aka "Command Line") + tab of the Configure Compilers dialogue box for Delphi XE2 or later will be + removed and equivalent entries will have been made on the "Namespaces" tab. + ++ CodeSnip v4.16.0 and later cannot be registered. Any previous registration + information may be lost. + + +License & Disclaimer +================================================================================ + +CodeSnip is made available under the terms of the Mozilla Public License v2.0. +The license is explained in full in the file License.html that is installed with +CodeSnip. A summary of the license can be viewed from the "Help | License" menu +option. + +CodeSnip is supplied on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either +express or implied. See License.html for details. + +The source code of any snippet managed by CodeSnip, whether from the +DelphiDabbler Code Snippets Database or the user database, is used WITHOUT +WARRANTY OF ANY KIND, either express or implied. The code is used entirely at +the user's own risk. + +The snippets from the DelphiDabbler Code Snippets Database are open source. See +the "About The Database" tab of the About dialogue box for details of the +applicable license. (You can display the About box from the "Help" menu.) + +The user is responsible to ensure that any code snippets managed by CodeSnip are +used in accordance with any applicable license. + + +Source Code +================================================================================ + +CodeSnip's source code is freely available. For details of how to obtain the +source see the FAQ at +https://github.com/delphidabbler/codesnip-faq/blob/master/SourceCode.md#faq-1 + +The portable edition of CodeSnip shares the same source code base with the +standard edition. + +The original source code of v4 is released under the Mozilla Public license +v2.0 (see https://www.mozilla.org/MPL/) and other open source licenses. See the +file "License.html" in the "Docs" directory of the repository for full licensing +information. + + +Bugs & Feature Requests +================================================================================ + +Please do report any bugs you find. Suggestions for new features are also +welcomed. + +Both bug reports and feature requests are made using the GitHub issue tracker +(GitHub account required). For details about using the issue tracker see +https://github.com/delphidabbler/codesnip/blob/master/CONTRIBUTING.md#issues. + + +FAQs +================================================================================ + +There are Frequently Asked Questions pages for CodeSnip on the web, at +https://github.com/delphidabbler/codesnip-faq/blob/master/README.md + + +Privacy +================================================================================ + +From v4.16.0 CodeSnip neither stores nor transmits any personally identifiable +data. + +Do note though that CodeSnip can display web pages via your default web browser, +but only in response to user input. No guarantee is made about any personal data +collected by such web pages. + + +Thanks +================================================================================ + +Thanks to: + ++ David Mustard and Bill Miller for providing information that enabled me to add + Delphi 2007 and Delphi 2009 support, respectively, to the program. + ++ geoffsmith82 and an anonymous contributor for information about getting + CodeSnip to work with Delphi XE2. + ++ The authors of the third party source code and images used by the program. See + the program's about box or License.html for details. + ++ Various contributors to the DelphiDabbler Code Snippets database. Names of + contributors are listed in the program's About Box (use the "Help | About" + menu option then select the "About the Database" tab). The list will be empty + if the Code Snippets Database has not been installed. + + +================================================================================ diff --git a/Docs/ReadMe.txt b/Docs/ReadMe-standard.txt similarity index 64% rename from Docs/ReadMe.txt rename to Docs/ReadMe-standard.txt index b7806db53..5f5ea703f 100644 --- a/Docs/ReadMe.txt +++ b/Docs/ReadMe-standard.txt @@ -1,6 +1,6 @@ ================================================================================ -DELPHIDABBLER CODESNIP v4 README +DELPHIDABBLER CODESNIP v4 STANDARD EDITION README ================================================================================ @@ -14,30 +14,26 @@ online DelphiDabbler Code Snippets database as well as maintain a database of user-defined snippets. It displays details of each snippet in the database and can test-compile them -with each installed Win32 version of Delphi from Delphi 2 to Delphi 12 Athens -and Free Pascal. +with each installed Win32 version of Delphi from Delphi 2 to Delphi 12.x and +Free Pascal. Compilable Pascal units can be created that contain selected snippets. -Features new to CodeSnip 4 are listed in the "What's New In CodeSnip 4" topic -in the program's help file. - CodeSnip Editions ================================================================================ -There are two different editions of CodeSnip 4 available: - -+ The standard edition, which is installed on the user's computer using an - installer and which records its presence in the registry and stores data in - the system's application and user data directories. +This document relates to the STANDARD edition of CodeSnip. This edition is +installed on the user's computer using a standard Windows installer and which +records its presence in the registry and stores data in the system's application +and user data directories. -+ The portable edition that can be run from any writeable removable storage - medium (e.g. a USB memory stick) and that makes no changes to the host - computer. This edition has no installer and is simply copied onto the required - medium. +There is also a portable edition of the program. This edition can be run from +any writeable removable storage medium (e.g. a USB memory stick) or from any +folder on the computer's hard disk. It makes no changes to the host computer. +This edition has no installer and is simply copied to the required location. -You can run both the standard and portable editions together on the same +You can run both the portable and standard editions together on the same computer and even run them at the same time. However, each edition maintains its own settings and keeps its own copies of the snippets databases. To share user defined snippets you must export them from one edition and import into the @@ -48,18 +44,14 @@ Installation ================================================================================ CodeSnip requires Windows 2000 or later. It also requires MS Internet Explorer 6 -or later, although IE 8, 9 or 10 are strongly recommended. But note that recent -releases have only been tested on Windows 10/11. +or later, although IE 8, 9 or 10 are strongly recommended. Note that recent +releases have only been tested on Windows 11. -Installing the Standard Edition -------------------------------- - -You will need administrator privileges to run the setup program for the standard -edition. If you are using a non-admin user account on Windows 2000 or XP you -should run setup as administrator. By default Windows Vista to Windows 11 will -require an admin password if running as a standard user and setup will attempt -to elevate the process. If UAC prompts are disabled you must run setup as -administrator. +You will need administrator privileges to run the setup program. If you are +using a non-admin user account on Windows 2000 or XP you should run setup as +administrator. By default Windows Vista to Windows 11 will require admin +privileges and setup will attempt to elevate the process if required. If UAC +prompts are disabled you must run setup as administrator. CodeSnip v4 will install alongside any v3 or earlier release that may already be installed. If you want to replace the earlier version simply uninstall it in the @@ -106,53 +98,15 @@ If you are updating to CodeSnip 4 from version 3 or earlier, CodeSnip will give you the option of bringing forward your old settings and / or user defined database. This happens the first time v4 is run for each user. -Installing the Portable Edition -------------------------------- - -The portable edition of CodeSnip 4 is distributed in a zip file that contains -the program executable, the help file and various documentation files. - -Install the program using the following steps: - -1) Mount any storage medium on which you want to install CodeSnip. - -2) Create a folder on the storage medium or on your computer's internal disk in - which to copy the required files. - -3) Copy the files CodeSnip-p.exe (the executable program) and CodeSnip.chm - (the help file) into the folder you created. - - CodeSnip does not need the other files included in the zip file in order to - run, but you may find them useful. Copy them if you wish. - -Run the program by double clicking it. When it first runs it will create two -sub-directories within the folder where you installed the program. These will -be named AppData and UserData. Do not remove these directories or alter any of -the contents. CodeSnip uses them to store configuration data along with your -code snippets. - -No files are written outside the folder where you copied the files and the -registry is not modified. - -** WARNING: When updating an existing portable installation with a new version -of CodeSnip it is important that you do not change or delete the AppData and -UserData folders. If you do this you risk loosing your settings and/or database. - Uninstallation ================================================================================ -Uninstalling the Standard Edition ---------------------------------- - -CodeSnip can be uninstalled via "Installed Apps" (a.k.a. "Apps and Features", -a.k.a. "Programs and Features", a.k.a. "Add / Remove Programs") accessed from the -Windows Control Panel or by choosing "Uninstall DelphiDabbler CodeSnip" from the -program's start menu group. +CodeSnip can be uninstalled using your version of Windows' application +uninstaller, run from Control Panel. Alternatively you can choose "Uninstall +DelphiDabbler CodeSnip" from the program's start menu group. -Administrator privileges will be required to uninstall CodeSnip. Windows Vista -to Windows 11 with UAC prompts enabled will prompt for an admin password if -necessary. +Administrator privileges will be required to uninstall CodeSnip. The uninstall program will delete any local copy of the online Code Snippets database but will leave any user defined database, configuration data and @@ -161,16 +115,6 @@ delete the %AppData%\DelphiDabbler\CodeSnip.4 directory and all its contents for each user who ran CodeSnip. If any user has moved the user database directory those directories also need to be deleted. -Uninstalling the Portable Edition ---------------------------------- - -Simply delete the folder where you installed CodeSnip, with all its contents. - -Be aware that any snippets you have created will be lost. If you want to keep -them for use in another CodeSnip installation either export them or back up the -user database before deleting the folder. See the help file for details of how -to do this. - Downloading & Updating the Code Snippets Database ================================================================================ @@ -179,22 +123,19 @@ The online DelphiDabbler Code Snippets database is not installed with the program. CodeSnip's start-up screen shows details of any installed databases. If there is -no copy of the online database a link is displayed that enables the database to -be installed. This link opens the "Install or Update DelphiDabbler Snippets -Database" wizard style dialogue box. The dialogue box explains how to download -and install the database. +no copy of the online database then a link is displayed that enables the +database to be installed. This link opens the "Install or Update DelphiDabbler +Snippets Database" wizard dialogue box. The dialogue box explains how to +download and install the database. You can download or update the database later by opening the same dialogue box using the "Database | Install or Update DelphiDabbler Snippets Database" menu option. -Standard Edition Only ---------------------- - -When installing the standard edition, the setup program will detect if an older -database installation is present and will give the option to carry it forward. -When setup completes it checks for the presence of the database and puts up a -message if it is not present. +During installation the setup program will detect if an older database version +is present and will give the option to carry it forward. When setup completes it +checks for the presence of the database and puts up a message if it is not +present. Database updates will apply to all users of the computer the next time they start CodeSnip. @@ -204,7 +145,7 @@ Configuring CodeSnip to Work With Your Compilers ================================================================================ A feature of CodeSnip is its ability to test compile snippets with any installed -Windows 32 version of Delphi (from Delphi 2 to Delphi 12 Athens) and FreePascal, +Windows 32 version of Delphi (from Delphi 2 to Delphi.x) and FreePascal, providing some simple rules are followed. When CodeSnip is first installed it knows nothing about the available compilers @@ -235,7 +176,7 @@ Any type of snippet other than "freeform" can be test compiled. Updating the Program ================================================================================ -Updates are published on GitHub. See +Updates are published on GitHub. See https://github.com/delphidabbler/codesnip/releases News of new updates is published on the CodeSnip Blog: @@ -288,7 +229,7 @@ DelphiDabbler Code Snippets Database or the user database, is used WITHOUT WARRANTY OF ANY KIND, either express or implied. The code is used entirely at the user's own risk. -The snippets from the DelphiDabbler Code Snippets Database is open source. See +The snippets from the DelphiDabbler Code Snippets Database are open source. See the "About The Database" tab of the About dialogue box for details of the applicable license. (You can display the About box from the "Help" menu.) @@ -303,7 +244,8 @@ CodeSnip's source code is freely available. For details of how to obtain the source see the FAQ at https://github.com/delphidabbler/codesnip-faq/blob/master/SourceCode.md#faq-1 -The standard and portable editions of CodeSnip share the same source code. +The standard edition of CodeSnip shares the same source code base with the +portable edition. The original source code of v4 is released under the Mozilla Public license v2.0 (see https://www.mozilla.org/MPL/) and other open source licenses. See the @@ -311,36 +253,15 @@ file "License.html" in the "Docs" directory of the repository for full licensing information. -Bugs +Bugs & Feature Requests ================================================================================ -Please do report any bugs you find. - -Bugs are recorded in tracker software. View the reported and fixed bugs via -https://github.com/delphidabbler/codesnip/issues (GitHub account required). - -You can also access the bug tracker from CodeSnip by using the "Tools | Report -Bug Online" menu option then following the link that appears in the resulting -dialogue box. - -If you wish to report a bug, please check the current reports on the bug -tracker. If your bug hasn't already been reported or fixed please add a report -using the "Add new" link on Tracker. +Please do report any bugs you find. Suggestions for new features are also +welcomed. -Please ensure that you have installed the latest version of CodeSnip and checked -if the bug is still present before reporting it. - - -Feedback -================================================================================ - -If you want to suggest new features please use the feature request tracker -accessed from https://github.com/delphidabbler/codesnip/issues (GitHub account -required). Please check whether anyone else has requested something similar and -add a comment to their request if so. - -Always check the latest version of CodeSnip before requesting a feature just in -case it has already been implemented! +Both bug reports and feature requests are made using the GitHub issue tracker +(GitHub account required). For details about using the issue tracker see +https://github.com/delphidabbler/codesnip/blob/master/CONTRIBUTING.md#issues. FAQs @@ -353,15 +274,12 @@ https://github.com/delphidabbler/codesnip-faq/blob/master/README.md Privacy ================================================================================ -As of v4.16.0 CodeSnip no longer stores or transmits any personally identifiable +From v4.16.0 CodeSnip neither stores nor transmits any personally identifiable data. -Because of this change the privacy statement that used to be provided with the -program has been removed. - -Do note though that CodeSnip can display web pages via your default web -browser, but only in response to user input. No guarantee is made about any -personal data collected by such web pages. +Do note though that CodeSnip can display web pages via your default web browser, +but only in response to user input. No guarantee is made about any personal data +collected by such web pages. Thanks diff --git a/README.md b/README.md index 8672ddf64..3787b2439 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ CodeSnip can import code from the DelphiDabbler [Code Snippets Database](https:/ The standard edition of CodeSnip is installed and removed using a Windows installer. Administrator privileges are required for installation. -The portable edition has no installer. Simply follow the instructions in the [read me file](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe.txt) that is included in the download. +The portable edition has no installer. Simply follow the instructions in the [read me file](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe-portable.txt) that is included in the download. The program _should_ run on Windows 2000, with Internet Explorer 6 or later, although XP and IE 8 and later are recommended. _But_ note that recent releases of CodeSnip have only been tested on Windows 10 & 11. @@ -33,14 +33,14 @@ The program _should_ run on Windows 2000, with Internet Explorer 6 or later, alt The following support is available to CodeSnip users: * A comprehensive help file. -* A [read-me file](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe.txt) that discusses installation, configuration, updating and known issues. [^1] +* A read-me file that discusses installation, configuration, updating and known issues. There are different versions of this file for each edition of CodeSnip: one for the [standard edition](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe-standard.txt) and another for the [portable edition](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe-portable.txt). [^1] * The [Using CodeSnip FAQ](https://github.com/delphidabbler/codesnip-faq/blob/master/UsingCodeSnip.md). * The [CodeSnip Blog](https://codesnip-app.blogspot.co.uk/). * CodeSnip's own [Web Page](https://delphidabbler.com/software/codesnip). There's also plenty of info available on how to compile CodeSnip from source - see below. -> [^1]: The linked read-me file is the most recent version. It can change from release to release. +> [^1]: The linked read-me file is the most recent version. It can change from release to release. ## Source Code diff --git a/Src/3rdParty/PJSysInfo.pas b/Src/3rdParty/PJSysInfo.pas index efd2c4de6..342fd7750 100644 --- a/Src/3rdParty/PJSysInfo.pas +++ b/Src/3rdParty/PJSysInfo.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2001-2023, Peter Johnson (https://gravatar.com/delphidabbler). + * Copyright (C) 2001-2024, Peter Johnson (https://gravatar.com/delphidabbler). * * This unit contains various static classes, constants, type definitions and * global variables for use in providing information about the host computer and @@ -21,8 +21,12 @@ * 3: When run on operating systems up to and including Windows 8 running the * host program in compatibility mode causes some variables and TPJOSInfo * methods to be "spoofed" into returning information about the emulated - * OS. When run on Windows 8.1 and later details of the actual host - * operating system are always returned and the emulated OS is ignored. + * OS. When run on Windows 8.1 details of the actual host operating system + * are always returned and the emulated OS is ignored. + * + * 4: On Windows 10 and later the correct operating system will only be + * reported if the application declares the operating systems it supports + * in its manifest. * * ACKNOWLEDGEMENTS * @@ -55,6 +59,7 @@ {$UNDEF RTLNAMESPACES} // No support for RTL namespaces in unit names {$UNDEF HASUNIT64} // UInt64 type not defined {$UNDEF INLINEMETHODS} // No support for inline methods +{$UNDEF HASTBYTES} // TBytes not defined // Undefine facilities not available in earlier compilers // Note: Delphi 1 to 3 is not included since the code will not compile on these @@ -76,6 +81,9 @@ {$IF CompilerVersion >= 24.0} // Delphi XE3 and later {$LEGACYIFEND ON} // NOTE: this must come before all $IFEND directives {$IFEND} + {$IF CompilerVersion >= 18.5} // Delphi 2007 Win32 and later + {$DEFINE HASTBYTES} + {$IFEND} {$IF CompilerVersion >= 23.0} // Delphi XE2 and later {$DEFINE RTLNAMESPACES} {$IFEND} @@ -111,6 +119,11 @@ interface System.SysUtils, System.Classes, Winapi.Windows; {$ENDIF} +{$IFNDEF HASTBYTES} +// Compiler doesn't have TBytes: define it +type + TBytes = array of Byte; +{$ENDIF} type // Windows types not defined in all supported Delphi VCLs @@ -230,107 +243,190 @@ interface // These Windows-defined constants are required for use with the // GetProductInfo API call used with Windows Vista and later + // NOTE: PRODUCT_xxx constants marked with an asterisk comment have no + // associated description hard wired into this unit. // ** Thanks to Laurent Pierre for providing these definitions originally. // ** Subsequent additions were obtained from https://tinyurl.com/3rhhbs2z - PRODUCT_BUSINESS = $00000006; - PRODUCT_BUSINESS_N = $00000010; - PRODUCT_CLUSTER_SERVER = $00000012; - PRODUCT_CLUSTER_SERVER_V = $00000040; - PRODUCT_CORE = $00000065; - PRODUCT_CORE_COUNTRYSPECIFIC = $00000063; - PRODUCT_CORE_N = $00000062; - PRODUCT_CORE_SINGLELANGUAGE = $00000064; - PRODUCT_DATACENTER_EVALUATION_SERVER = $00000050; - PRODUCT_DATACENTER_A_SERVER_CORE = $00000091; - PRODUCT_STANDARD_A_SERVER_CORE = $00000092; - PRODUCT_DATACENTER_SERVER = $00000008; - PRODUCT_DATACENTER_SERVER_CORE = $0000000C; - PRODUCT_DATACENTER_SERVER_CORE_V = $00000027; - PRODUCT_DATACENTER_SERVER_V = $00000025; - PRODUCT_EDUCATION = $00000079; - PRODUCT_EDUCATION_N = $0000007A; - PRODUCT_ENTERPRISE = $00000004; - PRODUCT_ENTERPRISE_E = $00000046; - PRODUCT_ENTERPRISE_EVALUATION = $00000048; - PRODUCT_ENTERPRISE_N = $0000001B; - PRODUCT_ENTERPRISE_N_EVALUATION = $00000054; - PRODUCT_ENTERPRISE_S = $0000007D; - PRODUCT_ENTERPRISE_S_EVALUATION = $00000081; - PRODUCT_ENTERPRISE_S_N = $0000007E; - PRODUCT_ENTERPRISE_S_N_EVALUATION = $00000082; - PRODUCT_ENTERPRISE_SERVER = $0000000A; - PRODUCT_ENTERPRISE_SERVER_CORE = $0000000E; - PRODUCT_ENTERPRISE_SERVER_CORE_V = $00000029; - PRODUCT_ENTERPRISE_SERVER_IA64 = $0000000F; - PRODUCT_ENTERPRISE_SERVER_V = $00000026; - PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = $0000003C; - PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = $0000003E; - PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = $0000003B; - PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = $0000003D; - PRODUCT_HOME_BASIC = $00000002; - PRODUCT_HOME_BASIC_E = $00000043; - PRODUCT_HOME_BASIC_N = $00000005; - PRODUCT_HOME_PREMIUM = $00000003; - PRODUCT_HOME_PREMIUM_E = $00000044; - PRODUCT_HOME_PREMIUM_N = $0000001A; - PRODUCT_HOME_PREMIUM_SERVER = $00000022; - PRODUCT_HOME_SERVER = $00000013; - PRODUCT_HYPERV = $0000002A; - PRODUCT_IOTENTERPRISE = $000000BC; - PRODUCT_IOTENTERPRISE_S = $000000BF; - PRODUCT_IOTUAP = $0000007B; - PRODUCT_IOTUAPCOMMERCIAL = $00000083; - PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = $0000001E; - PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = $00000020; - PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = $0000001F; - PRODUCT_MOBILE_CORE = $00000068; - PRODUCT_MOBILE_ENTERPRISE = $00000085; - PRODUCT_MULTIPOINT_PREMIUM_SERVER = $0000004D; - PRODUCT_MULTIPOINT_STANDARD_SERVER = $0000004C; - PRODUCT_PRO_WORKSTATION = $000000A1; - PRODUCT_PRO_WORKSTATION_N = $000000A2; - PRODUCT_PROFESSIONAL = $00000030; - PRODUCT_PROFESSIONAL_E = $00000045; - PRODUCT_PROFESSIONAL_N = $00000031; - PRODUCT_PROFESSIONAL_WMC = $00000067; - PRODUCT_SB_SOLUTION_SERVER = $00000032; - PRODUCT_SB_SOLUTION_SERVER_EM = $00000036; - PRODUCT_SERVER_FOR_SB_SOLUTIONS = $00000033; - PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = $00000037; - PRODUCT_SERVER_FOR_SMALLBUSINESS = $00000018; - PRODUCT_SERVER_FOR_SMALLBUSINESS_V = $00000023; - PRODUCT_SERVER_FOUNDATION = $00000021; - PRODUCT_SMALLBUSINESS_SERVER = $00000009; - PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = $00000019; - PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = $0000003F; - PRODUCT_SOLUTION_EMBEDDEDSERVER = $00000038; - PRODUCT_STANDARD_EVALUATION_SERVER = $0000004F; - PRODUCT_STANDARD_SERVER = $00000007; - PRODUCT_STANDARD_SERVER_CORE = $0000000D; - PRODUCT_STANDARD_SERVER_CORE_V = $00000028; - PRODUCT_STANDARD_SERVER_V = $00000024; - PRODUCT_STANDARD_SERVER_SOLUTIONS = $00000034; - PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = $00000035; - PRODUCT_STARTER = $0000000B; - PRODUCT_STARTER_E = $00000042; - PRODUCT_STARTER_N = $0000002F; - PRODUCT_STORAGE_ENTERPRISE_SERVER = $00000017; - PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = $0000002E; - PRODUCT_STORAGE_EXPRESS_SERVER = $00000014; - PRODUCT_STORAGE_EXPRESS_SERVER_CORE = $0000002B; - PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER = $00000060; - PRODUCT_STORAGE_STANDARD_SERVER = $00000015; - PRODUCT_STORAGE_STANDARD_SERVER_CORE = $0000002C; - PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER = $0000005F; - PRODUCT_STORAGE_WORKGROUP_SERVER = $00000016; - PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = $0000002D; - PRODUCT_ULTIMATE = $00000001; - PRODUCT_ULTIMATE_E = $00000047; - PRODUCT_ULTIMATE_N = $0000001C; - PRODUCT_UNDEFINED = $00000000; - PRODUCT_WEB_SERVER = $00000011; - PRODUCT_WEB_SERVER_CORE = $0000001D; - PRODUCT_UNLICENSED = $ABCDABCD; + // ** and the Windows 11 24H2 SDK + PRODUCT_UNDEFINED = $00000000; + PRODUCT_ULTIMATE = $00000001; + PRODUCT_HOME_BASIC = $00000002; + PRODUCT_HOME_PREMIUM = $00000003; + PRODUCT_ENTERPRISE = $00000004; + PRODUCT_HOME_BASIC_N = $00000005; + PRODUCT_BUSINESS = $00000006; + PRODUCT_STANDARD_SERVER = $00000007; + PRODUCT_DATACENTER_SERVER = $00000008; + PRODUCT_SMALLBUSINESS_SERVER = $00000009; + PRODUCT_ENTERPRISE_SERVER = $0000000A; + PRODUCT_STARTER = $0000000B; + PRODUCT_DATACENTER_SERVER_CORE = $0000000C; + PRODUCT_STANDARD_SERVER_CORE = $0000000D; + PRODUCT_ENTERPRISE_SERVER_CORE = $0000000E; + PRODUCT_ENTERPRISE_SERVER_IA64 = $0000000F; + PRODUCT_BUSINESS_N = $00000010; + PRODUCT_WEB_SERVER = $00000011; + PRODUCT_CLUSTER_SERVER = $00000012; + PRODUCT_HOME_SERVER = $00000013; + PRODUCT_STORAGE_EXPRESS_SERVER = $00000014; + PRODUCT_STORAGE_STANDARD_SERVER = $00000015; + PRODUCT_STORAGE_WORKGROUP_SERVER = $00000016; + PRODUCT_STORAGE_ENTERPRISE_SERVER = $00000017; + PRODUCT_SERVER_FOR_SMALLBUSINESS = $00000018; + PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = $00000019; + PRODUCT_HOME_PREMIUM_N = $0000001A; + PRODUCT_ENTERPRISE_N = $0000001B; + PRODUCT_ULTIMATE_N = $0000001C; + PRODUCT_WEB_SERVER_CORE = $0000001D; + PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = $0000001E; + PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = $0000001F; + PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = $00000020; + PRODUCT_SERVER_FOUNDATION = $00000021; + PRODUCT_HOME_PREMIUM_SERVER = $00000022; + PRODUCT_SERVER_FOR_SMALLBUSINESS_V = $00000023; + PRODUCT_STANDARD_SERVER_V = $00000024; + PRODUCT_DATACENTER_SERVER_V = $00000025; + PRODUCT_ENTERPRISE_SERVER_V = $00000026; + PRODUCT_DATACENTER_SERVER_CORE_V = $00000027; + PRODUCT_STANDARD_SERVER_CORE_V = $00000028; + PRODUCT_ENTERPRISE_SERVER_CORE_V = $00000029; + PRODUCT_HYPERV = $0000002A; + PRODUCT_STORAGE_EXPRESS_SERVER_CORE = $0000002B; + PRODUCT_STORAGE_STANDARD_SERVER_CORE = $0000002C; + PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = $0000002D; + PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = $0000002E; + PRODUCT_STARTER_N = $0000002F; + PRODUCT_PROFESSIONAL = $00000030; + PRODUCT_PROFESSIONAL_N = $00000031; + PRODUCT_SB_SOLUTION_SERVER = $00000032; + PRODUCT_SERVER_FOR_SB_SOLUTIONS = $00000033; + PRODUCT_STANDARD_SERVER_SOLUTIONS = $00000034; + PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = $00000035; + PRODUCT_SB_SOLUTION_SERVER_EM = $00000036; + PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = $00000037; + PRODUCT_SOLUTION_EMBEDDEDSERVER = $00000038; + PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE = $00000039; // * + PRODUCT_PROFESSIONAL_EMBEDDED = $0000003A; // * + PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = $0000003B; + PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = $0000003C; + PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = $0000003D; + PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = $0000003E; + PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = $0000003F; + PRODUCT_CLUSTER_SERVER_V = $00000040; + PRODUCT_EMBEDDED = $00000041; // * + PRODUCT_STARTER_E = $00000042; + PRODUCT_HOME_BASIC_E = $00000043; + PRODUCT_HOME_PREMIUM_E = $00000044; + PRODUCT_PROFESSIONAL_E = $00000045; + PRODUCT_ENTERPRISE_E = $00000046; + PRODUCT_ULTIMATE_E = $00000047; + PRODUCT_ENTERPRISE_EVALUATION = $00000048; + PRODUCT_MULTIPOINT_STANDARD_SERVER = $0000004C; + PRODUCT_MULTIPOINT_PREMIUM_SERVER = $0000004D; + PRODUCT_STANDARD_EVALUATION_SERVER = $0000004F; + PRODUCT_DATACENTER_EVALUATION_SERVER = $00000050; + PRODUCT_ENTERPRISE_N_EVALUATION = $00000054; + PRODUCT_EMBEDDED_AUTOMOTIVE = $00000055; // * + PRODUCT_EMBEDDED_INDUSTRY_A = $00000056; // * + PRODUCT_THINPC = $00000057; // * + PRODUCT_EMBEDDED_A = $00000058; // * + PRODUCT_EMBEDDED_INDUSTRY = $00000059; // * + PRODUCT_EMBEDDED_E = $0000005A; // * + PRODUCT_EMBEDDED_INDUSTRY_E = $0000005B; // * + PRODUCT_EMBEDDED_INDUSTRY_A_E = $0000005C; // * + PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER = $0000005F; + PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER = $00000060; + PRODUCT_CORE_ARM = $00000061; + PRODUCT_CORE_N = $00000062; + PRODUCT_CORE_COUNTRYSPECIFIC = $00000063; + PRODUCT_CORE_SINGLELANGUAGE = $00000064; + PRODUCT_CORE = $00000065; + PRODUCT_PROFESSIONAL_WMC = $00000067; + PRODUCT_MOBILE_CORE = $00000068; + PRODUCT_EMBEDDED_INDUSTRY_EVAL = $00000069; // * + PRODUCT_EMBEDDED_INDUSTRY_E_EVAL = $0000006A; // * + PRODUCT_EMBEDDED_EVAL = $0000006B; // * + PRODUCT_EMBEDDED_E_EVAL = $0000006C; // * + PRODUCT_NANO_SERVER = $0000006D; // * + PRODUCT_CLOUD_STORAGE_SERVER = $0000006E; // * + PRODUCT_CORE_CONNECTED = $0000006F; // * + PRODUCT_PROFESSIONAL_STUDENT = $00000070; // * + PRODUCT_CORE_CONNECTED_N = $00000071; // * + PRODUCT_PROFESSIONAL_STUDENT_N = $00000072; // * + PRODUCT_CORE_CONNECTED_SINGLELANGUAGE = $00000073; // * + PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC = $00000074; // * + PRODUCT_CONNECTED_CAR = $00000075; // * + PRODUCT_INDUSTRY_HANDHELD = $00000076; // * + PRODUCT_PPI_PRO = $00000077; // * + PRODUCT_ARM64_SERVER = $00000078; // * + PRODUCT_EDUCATION = $00000079; + PRODUCT_EDUCATION_N = $0000007A; + PRODUCT_IOTUAP = $0000007B; + PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER = $0000007C; // * + PRODUCT_ENTERPRISE_S = $0000007D; + PRODUCT_ENTERPRISE_S_N = $0000007E; + PRODUCT_PROFESSIONAL_S = $0000007F; // * + PRODUCT_PROFESSIONAL_S_N = $00000080; // * + PRODUCT_ENTERPRISE_S_EVALUATION = $00000081; + PRODUCT_ENTERPRISE_S_N_EVALUATION = $00000082; + PRODUCT_IOTUAPCOMMERCIAL = $00000083; + PRODUCT_MOBILE_ENTERPRISE = $00000085; + PRODUCT_HOLOGRAPHIC = $00000087; // * + PRODUCT_HOLOGRAPHIC_BUSINESS = $00000088; // * + PRODUCT_PRO_SINGLE_LANGUAGE = $0000008A; // * + PRODUCT_PRO_CHINA = $0000008B; // * + PRODUCT_ENTERPRISE_SUBSCRIPTION = $0000008C; // * + PRODUCT_ENTERPRISE_SUBSCRIPTION_N = $0000008D; // * + PRODUCT_DATACENTER_NANO_SERVER = $0000008F; + PRODUCT_STANDARD_NANO_SERVER = $00000090; + PRODUCT_DATACENTER_A_SERVER_CORE = $00000091; + PRODUCT_STANDARD_A_SERVER_CORE = $00000092; + PRODUCT_DATACENTER_WS_SERVER_CORE = $00000093; + PRODUCT_STANDARD_WS_SERVER_CORE = $00000094; + PRODUCT_UTILITY_VM = $00000095; // * + PRODUCT_DATACENTER_EVALUATION_SERVER_CORE = $0000009F; // * + PRODUCT_STANDARD_EVALUATION_SERVER_CORE = $000000A0; // * + PRODUCT_PRO_WORKSTATION = $000000A1; + PRODUCT_PRO_WORKSTATION_N = $000000A2; + PRODUCT_PRO_FOR_EDUCATION = $000000A4; + PRODUCT_PRO_FOR_EDUCATION_N = $000000A5; // * + PRODUCT_AZURE_SERVER_CORE = $000000A8; // * + PRODUCT_AZURE_NANO_SERVER = $000000A9; // * + PRODUCT_ENTERPRISEG = $000000AB; // * + PRODUCT_ENTERPRISEGN = $000000AC; // * + PRODUCT_SERVERRDSH = $000000AF; + PRODUCT_CLOUD = $000000B2; // * + PRODUCT_CLOUDN = $000000B3; // * + PRODUCT_HUBOS = $000000B4; // * + PRODUCT_ONECOREUPDATEOS = $000000B6; // * + PRODUCT_CLOUDE = $000000B7; // * + PRODUCT_IOTOS = $000000B9; // * + PRODUCT_CLOUDEN = $000000BA; // * + PRODUCT_IOTEDGEOS = $000000BB; // * + PRODUCT_IOTENTERPRISE = $000000BC; + PRODUCT_LITE = $000000BD; // * + PRODUCT_IOTENTERPRISE_S = $000000BF; + PRODUCT_XBOX_SYSTEMOS = $000000C0; // * + PRODUCT_XBOX_GAMEOS = $000000C2; // * + PRODUCT_XBOX_ERAOS = $000000C3; // * + PRODUCT_XBOX_DURANGOHOSTOS = $000000C4; // * + PRODUCT_XBOX_SCARLETTHOSTOS = $000000C5; // * + PRODUCT_XBOX_KEYSTONE = $000000C6; // * + PRODUCT_AZURE_SERVER_CLOUDHOST = $000000C7; // * + PRODUCT_AZURE_SERVER_CLOUDMOS = $000000C8; // * + PRODUCT_CLOUDEDITIONN = $000000CA; // * + PRODUCT_CLOUDEDITION = $000000CB; // * + PRODUCT_VALIDATION = $000000CC; // * + PRODUCT_IOTENTERPRISESK = $000000CD; // * + PRODUCT_IOTENTERPRISEK = $000000CE; // * + PRODUCT_IOTENTERPRISESEVAL = $000000CF; // * + PRODUCT_AZURE_SERVER_AGENTBRIDGE = $000000D0; // * + PRODUCT_AZURE_SERVER_NANOHOST = $000000D1; // * + PRODUCT_WNC = $000000D2; // * + PRODUCT_AZURESTACKHCI_SERVER_CORE = $00000196; // * + PRODUCT_DATACENTER_SERVER_AZURE_EDITION = $00000197; + PRODUCT_DATACENTER_SERVER_CORE_AZURE_EDITION = $00000198; // * + PRODUCT_UNLICENSED = $ABCDABCD; // These constants are required for use with GetSystemMetrics to detect // certain editions. GetSystemMetrics returns non-zero when passed these flags @@ -450,6 +546,17 @@ interface bmSafeModeNetwork // Booted in safe node with networking ); +type + // Various Windows 10 & 11 release versions + TPJWin10PlusVersion = ( + win10plusNA, + win10plusUnknown, + win10v1507, win10v1511, win10v1607, win10v1703, win10v1709, win10v1803, + win10v1809, win10v1903, win10v1909, win10v2004, win10v20H2, win10v21H1, + win10v21H2, win10v22H2, + win11v21H2, win11v22H2, win11v23H2, win11v24H2 + ); + type /// <summary>Class of exception raised by code in this unit.</summary> EPJSysInfo = class(Exception); @@ -469,10 +576,13 @@ TPJOSInfo = class(TObject) /// <returns>True if suite is installed, False if not installed or not an /// NT platform OS.</returns> class function CheckSuite(const Suite: Integer): Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} - /// <summary>Gets product edition from registry.</summary> - /// <remarks>Needed to get edition for NT4 pre SP6.</remarks> - class function EditionFromReg: string; + /// <summary>Gets product edition from registry for NT4 pre SP6.</remarks> + class function NTEditionFromReg: string; + + /// <summary>Gets edition ID from registry.</summary> + class function EditionIDFromReg: string; /// <summary>Checks registry to see if NT4 Service Pack 6a is installed. /// </summary> @@ -494,6 +604,18 @@ TPJOSInfo = class(TObject) class function IsReallyWindowsVersionOrGreater(MajorVersion, MinorVersion, ServicePackMajor: Word): Boolean; + /// <summary>Checks if the operating system is Windows 10 or later, with a + /// version identifier the same or later than the given version identifier. + /// </summary> + /// <remarks> + /// <para>WARNING: Windows 11 versions are always considered to be later + /// Windows 10 versions, even if the Windows 10 version was released after + /// the Windows 11 version.</para> + /// <para><c>AVersion</c> must not be one of <c>win10plusNA</c> or + /// <c>win10plusUnknown</c>.</para> + class function IsWindows10PlusVersionOrLater( + const AVersion: TPJWin10PlusVersion): Boolean; + public /// <summary>Checks if the OS can be "spoofed" by specifying a @@ -530,17 +652,21 @@ TPJOSInfo = class(TObject) /// <summary>Checks if Windows Media Center is installed.</summary> class function IsMediaCenter: Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// <summary>Checks if the program is running on a tablet PC OS.</summary> class function IsTabletPC: Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// <summary>Checks if the program is running under Windows Terminal Server /// as a client session.</summary> class function IsRemoteSession: Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// <summary>Checks of the host operating system has pen extensions /// installed.</summary> class function HasPenExtensions: Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// <summary>Returns the host OS platform identifier.</summary> class function Platform: TPJOSPlatform; @@ -601,6 +727,9 @@ TPJOSInfo = class(TObject) /// <summary>Returns the Windows product ID of the host OS.</summary> class function ProductID: string; + /// <summary>Returns the digital product ID of the host OS.</summary> + class function DigitalProductID: TBytes; + /// <summary>Organisation to which Windows is registered, if any.</summary> class function RegisteredOrganisation: string; @@ -736,6 +865,46 @@ TPJOSInfo = class(TObject) class function IsReallyWindows10OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} + /// <summary>Returns an identifier representing a Windows 10 or 11 + /// version.</summary> + /// <remarks>If the OS is earlier than Windows 10 then <c>win10plusNA</c> + /// is returned. If the OS is Windows 10 or later but is a dev, beta etc. + /// build whose version can't be detected then <c>win10plusUnknown</c> is + /// returned.</remarks> + class function Windows10PlusVersion: TPJWin10PlusVersion; + + /// <summary>Returns the version name of a the current operating system, if + /// it is Windows 10 or later.</summary> + /// <remarks> + /// <para>NOTE: some Windows 10 and 11 versions have the same string. + /// </para> + /// <para>If the OS is earlier than Windows 10 then an empty string is + /// returned. If the OS is Windows 10 or later but is a dev, beta etc. + /// build whose version can't be detected then 'Unknown' is returned. + /// </para> + /// </remarks> + class function Windows10PlusVersionName: string; + + /// <summary>Checks if the operating system is Windows 10 or later, with a + /// version identifier the same or later than <c>AVersion</c>. + /// </summary> + /// <remarks><c>AVersion</c> must be a valid Windows 10 version + /// identifier, with a name that begins with <c>win10v</c>.</remarks> + /// <exception><c>EPJSysInfo</c> raised if <c>AVersion</c> is not a valid + /// Windows 10 version identifier.</exception> + class function IsWindows10VersionOrLater( + const AVersion: TPJWin10PlusVersion): Boolean; + + /// <summary>Checks if the operating system is Windows 11 or later, with a + /// version identifier the same or later than <c>AVersion</c>. + /// </summary> + /// <remarks><c>AVersion</c> must be a valid Windows 11 version + /// identifier, with a name that begins with <c>win11v</c>.</remarks> + /// <exception><c>EPJSysInfo</c> raised if <c>AVersion</c> is not a valid + /// Windows 11 version identifier.</exception> + class function IsWindows11VersionOrLater( + const AVersion: TPJWin10PlusVersion): Boolean; + /// <summary>Checks if the OS is a server version.</summary> /// <remarks> /// <para>For Windows 2000 and later the result always relates to the @@ -754,6 +923,12 @@ TPJOSInfo = class(TObject) /// that this value could be spoofed.</para> /// </remarks> class function RevisionNumber: Integer; + + /// <summary>Returns the repository branch from which the OS release was] + /// built.</summary> + /// <remarks>Returns the empty string if no build branch information is + /// available.</remarks> + class function BuildBranch: string; end; type @@ -806,6 +981,7 @@ TPJComputerInfo = class(TObject) /// <summary>Checks if a network is present on host computer.</summary> class function IsNetworkPresent: Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// <summary>Returns the OS mode used when host computer was last booted. /// </summary> @@ -980,6 +1156,7 @@ implementation sUnknownProduct = 'Unrecognised operating system product'; sBadRegType = 'Unsupported registry type'; sBadRegIntType = 'Integer value expected in registry'; + sBadRegBinType = 'Binary value expected in registry'; sBadProcHandle = 'Bad process handle'; @@ -990,13 +1167,14 @@ implementation UInt64 = Int64; {$ENDIF} - const // Map of product codes per GetProductInfo API to product names + // Names are not available for all PRODUCT_xxx values. // ** Laurent Pierre supplied original code on which this map is based // It has been modified and extended using MSDN documentation at - // https://msdn.microsoft.com/en-us/library/ms724358 - cProductMap: array[1..99] of record + // https://msdn.microsoft.com/en-us/library/ms724358 and + // https://tinyurl.com/5684558v (learn.microsoft.com) + cProductMap: array[1..107] of record Id: Cardinal; // product ID Name: string; // product name end = ( @@ -1196,6 +1374,22 @@ implementation Name: 'Web Server (full installation)';), (Id: PRODUCT_WEB_SERVER_CORE; Name: 'Web Server (core installation)';), + (Id: PRODUCT_CORE_ARM; + Name: 'Windows RT';), + (Id: PRODUCT_DATACENTER_NANO_SERVER; + Name: 'Windows Server Datacenter Edition (Nano Server installation)';), + (Id: PRODUCT_STANDARD_NANO_SERVER; + Name: 'Windows Server Standard Edition (Nano Server installation)';), + (Id: PRODUCT_DATACENTER_WS_SERVER_CORE; + Name: 'Windows Server Datacenter Edition (Server Core installation)';), + (Id: PRODUCT_STANDARD_WS_SERVER_CORE; + Name: 'Windows Server Standard Edition (Server Core installation)';), + (Id: PRODUCT_PRO_FOR_EDUCATION; + Name: 'Windows 10 Pro Education';), + (Id: PRODUCT_SERVERRDSH; + Name: 'Windows 10 Enterprise for Virtual Desktops';), + (Id: PRODUCT_DATACENTER_SERVER_AZURE_EDITION; + Name: 'Windows Server Datacenter: Azure Edition';), (Id: Cardinal(PRODUCT_UNLICENSED); Name: 'Unlicensed product';) ); @@ -1216,8 +1410,11 @@ TBuildNameMap = record LoRev: Integer; HiRev: Integer; Name: string; + Version: Word; end; + TWin10PlusVersionSet = set of TPJWin10PlusVersion; + const { Known windows build numbers. @@ -1226,11 +1423,12 @@ TBuildNameMap = record https://en.wikipedia.org/wiki/Windows_NT https://en.wikipedia.org/wiki/Windows_10_version_history https://en.wikipedia.org/wiki/Windows_11_version_history + https://blogs.windows.com/windows-insider/tag/windows-insider-program/ https://en.wikipedia.org/wiki/Windows_Server https://en.wikipedia.org/wiki/Windows_Server_2019 https://en.wikipedia.org/wiki/Windows_Server_2016 + https://en.wikipedia.org/wiki/Windows_Server_2022 https://tinyurl.com/y8tfadm2 (MS Windows Server release information) - https://tinyurl.com/usupsz4a (Win 11 Version Numbers & Build Versions) https://docs.microsoft.com/en-us/lifecycle/products/windows-server-2022 https://tinyurl.com/yj5e72jt (MS Win 10 release info) https://tinyurl.com/kd3weeu7 (MS Server release info) @@ -1239,6 +1437,10 @@ TBuildNameMap = record For Vista and Win 7 we have to add service pack number to these values to get actual build number. For Win 8 onwards we just use the build numbers as is. + + References: + [^1] MS community blog post https://tinyurl.com/3c8e3hsc + [^2] https://en.wikipedia.org/wiki/Windows_11_version_history } { @@ -1256,35 +1458,41 @@ TBuildNameMap = record // Windows Vista ------------------------------------------------------------- - WinVistaBaseBuild = 6000; + WinVista_Base_Build = 6000; // Windows 7 ----------------------------------------------------------------- - Win7BaseBuild = 7600; + Win7_Base_Build = 7600; // Windows 8 ----------------------------------------------------------------- - Win8Build = 9200; // Build number used for all Win 8/Svr 2012 - Win8Point1Build = 9600; // Build number used for all Win 8.1/Svr 2012 R2 + Win8_Build = 9200; // Build number used for all Win 8/Svr 2012 + Win8Point1_Build = 9600; // Build number used for all Win 8.1/Svr 2012 R2 // Windows 10 ---------------------------------------------------------------- - // Version 1507 previews - // Preview builds with major/minor version number 6.4 - Win10_6point4Builds: array[0..2] of Integer = (9841, 9860, 9879); - // Preview builds with major/minor version number 10.0 - Win10_1507_Preview_Builds: array[0..10] of Integer = ( - 9926, 10041, 10049, 10061, 10074, 10122, 10130, 10158, 10159, 10162, 10166 - ); + // Version 1507 preview builds + // Preview builds with major/minor version number 6.4 + // Expired by 2015-04-30 [^1]: + // 9841, 9860, 9879 + // Preview builds with major/minor version number 10.0 + // Expired by 2015-10-15 [^1]: + // 9926, 10041, 10049, 10061, 10074, 10122, 10130, 10158, 10159, 10162, + // 10166 - // Version 1511 previews - Win10_1511_Preview_Builds: array[0..4] of Integer = ( - 10525, 10532, 10547, 10565, 10576 - ); + // Version 1511 preview builds + // Expired by 2016-07-30 [^1]: + // 10525, 10532, 10547, 10565, 10576 // Version 1607 previews - Win10_1607_Preview_Builds: array[0..24] of Integer = ( - 11082, 11099, 11102, 14251, 14257, 14271, 14279, 14291, 14295, 14316, - 14328, 14332, 14342, 14352, 14361, 14366, 14367, 14371, 14372, 14376, - 14379, 14383, 14385, 14388, 14390 + Win10_1607_Preview_Builds: array[0..5] of Integer = ( + // Expired 2016-07-30 [^1]: + // 11082, 11099 + // Expired 2016-08-01 [^1]: + // 11102, 14251, 14257, 14267, 14271, 14279, 14291, 14295, 14316, 14328, + // 14332, 14342, 14352, 14361 + // Expired 2016-10-15 [^1]: + // 14366, 14367, 14371, 14372, + 14376, 14379, 14383, 14385, // unknown expiry date [^1] + 14388, 14390 // permanently activated [^1] ); // Version 1703 previews @@ -1349,7 +1557,7 @@ TBuildNameMap = record ); { - End of support information for Windows 10 versions (as of 2022-12-31). + End of support information for Windows 10 versions (as of 2024-10-01). GAC = General Availablity Channel. LTSC = Long Term Support Channel. @@ -1365,53 +1573,65 @@ TBuildNameMap = record 1903 | ended | N/a 1909 | ended | N/a 2004 | ended | N/a - 20H2 | 2023-09-05 | N/a + 20H2 | ended | N/a 21H1 | ended | N/a - 21H2 | 2024-06-11 | 2032-01-13 - 22H2 | 2025-05-13 | N/a + 21H2 | ended | 2032-01-13 + 22H2 | 2025-10-14 | N/a } + // Win 10 release build numbers + Win10_1507_Build = 10240; + Win10_1511_Build = 10586; + Win10_1607_Build = 14393; + Win10_1703_Build = 15063; + Win10_1709_Build = 16299; + Win10_1803_Build = 17134; + Win10_1809_Build = 17763; + Win10_1903_Build = Win10_19XX_Shared_Build; + Win10_1909_Build = 18363; + Win10_2004_Build = 19041; + Win10_20H2_Build = 19042; + Win10_21H1_Build = 19043; // See **REF3** End of service @ rev 2364 + Win10_21H2_Build = 19044; // See **REF4** + Win10_22H2_Build = 19045; // See **REF5** + // Map of Win 10 builds from 1st release (version 1507) to version 20H2 + // Later Win 10 releases have special handling and aren't in the build map // // NOTE: The following versions that are still being maintained per the above // table have HiRev = MaxInt while the unsupported versions have HiRev set to // the final build number. - Win10BuildMap: array[0..10] of TBuildNameMap = ( - (Build: 10240; LoRev: 16484; HiRev: MaxInt; - Name: 'Version 1507'), - (Build: 10586; LoRev: 0; HiRev: 1540; - Name: 'Version 1511: November Update'), - (Build: 14393; LoRev: 0; HiRev: MaxInt; - Name: 'Version 1607: Anniversary Update'), - (Build: 15063; LoRev: 0; HiRev: 2679; - Name: 'Version 1703: Creators Update'), - (Build: 16299; LoRev: 15; HiRev: 2166; - Name: 'Version 1709: Fall Creators Update'), - (Build: 17134; LoRev: 1; HiRev: 2208; - Name: 'Version 1803: April 2018 Update'), - (Build: 17763; LoRev: 1; HiRev: MaxInt; - Name: 'Version 1809: October 2018 Update'), - (Build: Win10_19XX_Shared_Build; LoRev: 116; HiRev: 1256; - Name: 'Version 1903: May 2019 Update'), - (Build: 18363; LoRev: 327; HiRev: 2274; - Name: 'Version 1909: November 2019 Update'), - (Build: 19041; LoRev: 264; HiRev: 1415; - Name: 'Version 2004: May 2020 Update'), - (Build: 19042; LoRev: 572; HiRev: MaxInt; - Name: 'Version 20H2: October 2020 Update') + Win10_BuildMap: array[0..10] of TBuildNameMap = ( + (Build: Win10_1507_Build; LoRev: 16484; HiRev: MaxInt; + Name: 'Version 1507'; Version: Ord(win10v1507)), + (Build: Win10_1511_Build; LoRev: 0; HiRev: 1540; + Name: 'Version 1511: November Update'; Version: Ord(win10v1511)), + (Build: Win10_1607_Build; LoRev: 0; HiRev: MaxInt; + Name: 'Version 1607: Anniversary Update'; Version: Ord(win10v1607)), + (Build: Win10_1703_Build; LoRev: 0; HiRev: 2679; + Name: 'Version 1703: Creators Update'; Version: Ord(win10v1703)), + (Build: Win10_1709_Build; LoRev: 15; HiRev: 2166; + Name: 'Version 1709: Fall Creators Update'; Version: Ord(win10v1709)), + (Build: Win10_1803_Build; LoRev: 1; HiRev: 2208; + Name: 'Version 1803: April 2018 Update'; Version: Ord(win10v1803)), + (Build: Win10_1809_Build; LoRev: 1; HiRev: MaxInt; + Name: 'Version 1809: October 2018 Update'; Version: Ord(win10v1809)), + (Build: Win10_1903_Build; LoRev: 116; HiRev: 1256; + Name: 'Version 1903: May 2019 Update'; Version: Ord(win10v1903)), + (Build: Win10_1909_Build; LoRev: 327; HiRev: 2274; + Name: 'Version 1909: November 2019 Update'; Version: Ord(win10v1909)), + (Build: Win10_2004_Build; LoRev: 264; HiRev: 1415; + Name: 'Version 2004: May 2020 Update'; Version: Ord(win10v2004)), + (Build: Win10_20H2_Build; LoRev: 572; HiRev: 2965; + Name: 'Version 20H2: October 2020 Update'; Version: Ord(win10v20H2)) ); - // Additional information is available for Win 10 builds from version 21H1, - // as follows: - - // Windows 10 version 21H1 - see **REF3** in implementation for details - Win1021H1Build = 19043; // ** End of service 2022-12-13, rev 2364 - - // Windows 10 version 21H2 - see **REF4** in implementation for details - Win1021H2Build = 19044; - - // Windows 10 version 22H2 - see **REF5** in implementation for details - Win1022H2Build = 19045; + // Set of Windows 10 version identifiers + Win10_Versions: TWin10PlusVersionSet = [ + win10v1507, win10v1511, win10v1607, win10v1703, win10v1709, win10v1803, + win10v1809, win10v1903, win10v1909, win10v2004, win10v20H2, win10v21H1, + win10v21H2, win10v22H2 + ]; // Windows 10 slow ring, fast ring and skip-ahead channels were all expired // well before 2022-12-31 and are not detected. (In fact there was never any @@ -1422,74 +1642,125 @@ TBuildNameMap = record // NOTE: All releases of Windows 11 report version 10.0 { - End of support (EOS) information for Windows 11 versions (as of 2022-12-31). + End of support (EOS) information for Windows 11 versions (as of 2024-10-01). Version | Home, Pro | Education, | etc EOS | Enterprise | | etc EOS --------|------------|------------ - 21H2 | 2023-10-10 | 2024-10-08 + 21H2 | ENDED | 2024-10-08 22H2 | 2024-10-08 | 2025-10-14 + 23H2 | 2025-11-11 | 2026-11-10 + 24H2 | 2026-10-13 | 2027-10-12 } // 1st build released branded as Windows 11 // Insider version, Dev channel, v10.0.21996.1 - Win11DevBuild = 21996; + Win11_Dev_Build = 21996; // Windows 11 version 21H2 - see **REF6** in implementation for details - Win11v21H2Build = 22000; + Win11_21H2_Build = 22000; // Windows 11 version 22H2 // // Build 22621 was the original beta build. Same build used for releases and // various other channels. // See **REF1** in implementation - Win11v22H2Build = 22621; - // Build 22632 was added as an alternative Beta channel build as of rev 290. - // See **REF2** in implementation - Win11v22H2BuildAlt = 22622; - - // Windows 11 Dev channel releases (with version string "Dev"). - // For details see https://en.wikipedia.org/wiki/Windows_11_version_history - Win11DevChannelDevBuilds: array[0..25] of Integer = ( - // pre Win 11 release (expired 2021/10/31): - // 22449, 22454, 22458, 22463, - // pre Win 11 release (expired 2022/09/15): - // 22468, - // post Win 11 release, pre Win 11 22H2 beta release (expired 2022/09/15): - // 22471, 22478, 22483, 22489, 22494, 22499, 22504, 22509, 22518, 22523, - // 22526, 22533, 22538, 22543, 22557, 22563, - // post Win 11 22H2 beta release (expired 2022/09/15): - // 25115, 25120, 25126, 25131, 25136, 25140, 25145, 25151, 25158, 25163, - // 25169, 25174, 25179, - // post Win 11 22H2 beta release (expiring 2023/09/15): - 25182, 25188, 25193, 25197, 25201, 25206, 25211, - // post Win 11 22H2 release (expiring 2023/09/15): - 25217, 25227, 25231, 25236, 25247, 25252, 25262, 25267, 25272, 25276, 25281, - 25284, 25290, 25295, 25300, 25309, 23403, 23419, 23424 - ); + Win11_22H2_Build = 22621; - // Preview builds of Windows 11 in the Canary Channel - // For details see https://en.wikipedia.org/wiki/Windows_11_version_history - Win11CanaryPreviewBuilds: array[0..2] of Integer = ( - // expiring 2023/09/15: - 25314, 25324, 25330 - ); + // Windows 11 version 22H3 + // See **REF10** in implementation + Win11_23H2_Build = 22631; - // Windows 11 Dev channel builds with version string "22H2" - // expired 2022/09/15): - // 22567, 22572, 22579 + // Windows 11 version 22H4 + // See **REF11** in implementation + Win11_24H2_Build = 26100; - // Windows 11 Dev & Beta channel builds with version string "22H2" - Win11DevBetaChannels22H2Builds: array[0..1] of Integer = ( - // expired 2022/09/15: 22581, 22593, 22598, + // "Preview Builds of October 2022 component update in Beta Channel" + // See **REF2** in implementation + Win11_Oct22Component_BetaChannel_Build = 22622; + + // "Preview Builds of February 2023 component update in Beta Channel" + // See **REF7** in implementation + Win11_Feb23Component_BetaChannel_Build = 22623; + + // "Preview builds of May 2023 component update in Beta Channel" + // See **REF8** in implementation + Win11_May23Component_BetaChannel_Build = 22624; + + // "Preview builds of future component update in Beta Channel" + // See **REF9** in implementation + Win11_FutureComponent_BetaChannel_Build = 22635; + + // "Preview builds of future component update in Dev Channel" + // See **REF12** in implementation + Win11_FutureComponent_DevChannel_Build = 26120; + + // Windows 11 Dev channel releases with version string "Dev" [^2] + // pre Win 11 release (expired 2021/10/31): + // 22449, 22454, 22458, 22463, + // pre Win 11 release (expired 2022/09/15): + // 22468, + // post Win 11 release, pre Win 11 22H2 beta release (expired 2022/09/15): + // 22471, 22478, 22483, 22489, 22494, 22499, 22504, 22509, 22518, 22523, + // 22526, 22533, 22538, 22543, 22557, 22563, + + // Windows 11 Dev channel releases with version string "22H2" [^2] + // pre Win 11 22H2 beta release (expired 2022/09/15): + // 22567, 22572, 22579 + // post Win 11 22H2 beta release (expired 2022/09/15): + // 25115, 25120, 25126, 25131, 25136, 25140, 25145, 25151, 25158, 25163, + // 25169, 25174, 25179, + // post Win 11 22H2 beta release (expired 2023/09/15): + // 25182, 25188, 25193, 25197, 25201, 25206, 25211, + // post Win 11 22H2 release, ni_release string (expired 2023/09/15): + // 25217, 25227, 25231, 25236, 25247, 25252, 25262, 25267, 25272, 25276, + // 25281, 25284, 25290, 25295, 25300, 25309, + // post Win 11 22H2 release, ni_prerelease string (expired 2023/09/15): + // 23403, 23419, 23424, 23430, 23435, 23440, 23451, 23466, 23471, 23475, + // 23481, 23486, 23493, 23506, 23511, 23516, 23521, + // post Win 11 22H2 release, ni_prerelease string (expired 2024-09-15): + // 23526, 23531, 23536, 23541, 23545, 23550, 23555, 23560, 23565, 23570, + // 23575, 23580, 23585, 23590, 23595, 23601, 23606, 23612, 23615, 23619, + // 23620 + + // Preview builds of Windows 11 in the Canary Channel with version string + // "22H2" [^2] + // expired 2023-09-15: + // 25314, 25324, 25330, 25336, 25346, 25352, 25357, 25370, + + // Preview builds of Windows 11 in the Canary Channel with version string + // "23H2" [^2] + // Expired 2023-09-15: + // 25375, 25381, 25387, 25393, 25905, 25915, 25921, 25926, + // Expired 2024-09-15: + // 25931, 25936, 25941, 25947, 25951, 25967, 25977, 25982, 25987, 25992, + // 25997, 26002, 26010, 26016, 26020, 26040, 26063, 26200, 26212, 26217, + // 26227, 26231, 26236, 26241, 26244, 26252, 26257, 27686. + + // Windows 11 Dev & Beta channel builds with version string "22H2" [^2] + Win11_22H2_DevAndBetaChannel_Builds: array[0..1] of Integer = ( + // Expired 2022/09/15: + // 22581, 22593, 22598 + // Unknown expiry date: 22610, 22616 ); - Win11Feb23ComponentBetaChannelBuild = 22623; - Win11FutureComponentBetaChannelBuild = 22624; + // Windows 11 Preview, Dev & Canary channel builds with version "24H2" [^2] + Win11_24H2_DevAndCanaryChannel_Builds: array[0..1] of Integer = ( + // Expired 2024-09-15: + // 26052, 26058, 26080, 26085, + // Unknown expiry date: + 26090 {Dev revs:1,112; Canary revs: 1}, + 26100 {Dev revs:1,268; Canary revs: 1} + ); + + Win11_24H2_CanaryChannel_Builds: array[0..0] of Integer = ( + // expiring 2025-09-15: + 27695 + ); - Win11FirstBuild = Win11DevBuild; // First build number of Windows 11 + Win11_First_Build = Win11_Dev_Build; // First build number of Windows 11 // Windows server v10.0 version ---------------------------------------------- @@ -1497,9 +1768,14 @@ TBuildNameMap = record // version 10.0. There's always an exception with Windows versioning! // Last build numbers of each "major" release before moving on to the next - Win2016LastBuild = 17134; - Win2019LastBuild = 18363; - WinServerLastBuild = 19042; + Win2016_Last_Build = 17134; + Win2019_Last_Build = 18363; + WinServer_Last_Build = 19042; + + // Set of Windows 10 version identifiers + Win11_Versions: TWin10PlusVersionSet = [ + win11v21H2, win11v22H2, win11v23H2, win11v24H2 + ]; { End of support information for all Windows Server versions. @@ -1531,31 +1807,38 @@ TBuildNameMap = record // Map of Windows server releases that are named straightforwardly WinServerSimpleBuildMap: array[0..12] of TBuildNameMap = ( // Windows Server 2016 - (Build: 10074; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 2'), - (Build: 10514; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 3'), - (Build: 10586; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 4'), - (Build: 14300; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 5'), - (Build: 14393; LoRev: 0; HiRev: MaxInt; Name: 'Version 1607'), - (Build: 16299; LoRev: 0; HiRev: MaxInt; Name: 'Version 1709'), - (Build: Win2016LastBuild; LoRev: 0; HiRev: MaxInt; Name: 'Version 1803'), + (Build: 10074; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 2'; + Version: 0), + (Build: 10514; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 3'; + Version: 0), + (Build: 10586; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 4'; + Version: 0), + (Build: 14300; LoRev: 0; HiRev: MaxInt; Name: 'Technical Preview 5'; + Version: 0), + (Build: 14393; LoRev: 0; HiRev: MaxInt; Name: 'Version 1607'; Version: 0), + (Build: 16299; LoRev: 0; HiRev: MaxInt; Name: 'Version 1709'; Version: 0), + (Build: Win2016_Last_Build; LoRev: 0; HiRev: MaxInt; Name: 'Version 1803'; + Version: 0), // Windows Server 2019 - (Build: 17763; LoRev: 0; HiRev: MaxInt; Name: 'Version 1809'), - (Build: 18362; LoRev: 0; HiRev: MaxInt; Name: 'Version 1903'), - (Build: Win2019LastBuild; LoRev: 0; HiRev: MaxInt; Name: 'Version 1909'), + (Build: 17763; LoRev: 0; HiRev: MaxInt; Name: 'Version 1809'; Version: 0), + (Build: 18362; LoRev: 0; HiRev: MaxInt; Name: 'Version 1903'; Version: 0), + (Build: Win2019_Last_Build; LoRev: 0; HiRev: MaxInt; Name: 'Version 1909'; + Version: 0), // Windows Server (no year number) - (Build: 19041; LoRev: 0; HiRev: MaxInt; Name: 'Version 2004'), - (Build: WinServerLastBuild; LoRev: 0; HiRev: MaxInt; Name: 'Version 20H2'), + (Build: 19041; LoRev: 0; HiRev: MaxInt; Name: 'Version 2004'; Version: 0), + (Build: WinServer_Last_Build; LoRev: 0; HiRev: MaxInt; + Name: 'Version 20H2'; Version: 0), // Windows Server 2022 - (Build: 20348; LoRev: 0; HiRev: MaxInt; Name: 'Version 21H2') + (Build: 20348; LoRev: 0; HiRev: MaxInt; Name: 'Version 21H2'; Version: 0) ); // Windows server releases needing special handling // Server 2016 Technical Preview 1: reports version 6.4 instead of 10.0! - Win2016TP1Build = 9841; + Win2016_TP1_Build = 9841; // Server 2019 Insider Preview builds: require format strings in names - Win2019IPBuilds: array[0..9] of Integer = ( + Win2019_IP_Builds: array[0..9] of Integer = ( 17623, 17627, 17666, 17692, 17709, 17713, 17723, 17733, 17738, 17744 ); @@ -1604,6 +1887,8 @@ TBuildNameMap = record // ** At present this variable is only used for Windows 10. InternalExtraUpdateInfo: string = ''; + InternalWin1011Version: TPJWin10PlusVersion = win10plusNA; + // Flag required when opening registry with specified access flags {$IFDEF REGACCESSFLAGS} const @@ -1722,7 +2007,8 @@ function FindBuildNumberFrom(const BNs: array of Integer; var FoundBN: Integer): // parameters respectively. Otherwise False is returned, FoundBN is set to 0 and // FoundExtra is set to ''. function FindBuildNameAndExtraFrom(const Infos: array of TBuildNameMap; - var FoundBN: Integer; var FoundExtra: string): Boolean; + var FoundBN: Integer; var FoundExtra: string; var FoundVersion: Word): + Boolean; var I: Integer; begin @@ -1736,6 +2022,7 @@ function FindBuildNameAndExtraFrom(const Infos: array of TBuildNameMap; begin FoundBN := Infos[I].Build; FoundExtra := Infos[I].Name; + FoundVersion := Infos[I].Version; Result := True; Break; end; @@ -1972,6 +2259,33 @@ function GetRegistryInt(const RootKey: HKEY; const SubKey, Name: string): end; end; +function GetRegistryBytes(const RootKey: HKEY; const SubKey, Name: string): + TBytes; +var + Reg: TRegistry; // registry access object + ValueInfo: TRegDataInfo; // info about registry value +begin + SetLength(Result, 0); + // Open registry at required root key + Reg := RegCreate; + try + Reg.RootKey := RootKey; + if RegOpenKeyReadOnly(Reg, SubKey) and Reg.ValueExists(Name) then + begin + // Check if registry value is integer + Reg.GetDataInfo(Name, ValueInfo); + if ValueInfo.RegData <> rdBinary then + raise EPJSysInfo.Create(sBadRegBinType); + SetLength(Result, ValueInfo.DataSize); + Reg.ReadBinaryData(Name, Result[0], Length(Result)); + end; + finally + // Close registry + Reg.CloseKey; + Reg.Free; + end; +end; + // Gets string info for given value from Windows current version key in // registry. function GetCurrentVersionRegStr(ValName: string): string; @@ -1997,6 +2311,7 @@ procedure InitPlatformIdEx; GetVersionEx: TGetVersionEx; // pointer to GetVersionEx API function GetProductInfo: TGetProductInfo; // pointer to GetProductInfo API function SI: TSystemInfo; // structure from GetSystemInfo API call + VersionEx: Word; // gets extra version info (Win 10/11) // Get OS's revision number from registry. function GetOSRevisionNumber(const IsNT: Boolean): Integer; @@ -2006,6 +2321,13 @@ procedure InitPlatformIdEx; ); end; + // Append "Moment N" to InternalExtraUpdateInfo + procedure AppendMomentToInternalExtraUpdateInfo(N: Cardinal); + begin + InternalExtraUpdateInfo := InternalExtraUpdateInfo + + ' Moment ' + IntToStr(N); + end; + begin // Load version query functions used externally to this routine VerSetConditionMask := LoadKernelFunc('VerSetConditionMask'); @@ -2054,36 +2376,25 @@ procedure InitPlatformIdEx; case InternalMinorVersion of 0: // Vista - InternalBuildNumber := WinVistaBaseBuild + Win32ServicePackMajor; + InternalBuildNumber := WinVista_Base_Build + Win32ServicePackMajor; 1: // Windows 7 - InternalBuildNumber := Win7BaseBuild + Win32ServicePackMajor; + InternalBuildNumber := Win7_Base_Build + Win32ServicePackMajor; 2: // Windows 8 (no known SPs) if Win32ServicePackMajor = 0 then - InternalBuildNumber := Win8Build; + InternalBuildNumber := Win8_Build; 3: // Windows 8.1 (no known SPs) if Win32ServicePackMajor = 0 then - InternalBuildNumber := Win8Point1Build; + InternalBuildNumber := Win8Point1_Build; 4: if (Win32ProductType = VER_NT_DOMAIN_CONTROLLER) or (Win32ProductType = VER_NT_SERVER) then begin // Windows 2016 Server tech preview 1 - InternalBuildNumber := Win2016TP1Build; + InternalBuildNumber := Win2016_TP1_Build; InternalExtraUpdateInfo := 'Technical Preview 6'; - end - else - begin - if FindBuildNumberFrom( - Win10_6point4Builds, InternalBuildNumber - ) then - // Early Win 10 preview builds report v6.4, not v10.0 - InternalExtraUpdateInfo := Format( - 'Version 1507 Preview v6.4.%d.%d', - [InternalBuildNumber, InternalRevisionNumber] - ) end; end; if Win32ServicePackMajor > 0 then @@ -2107,15 +2418,18 @@ procedure InitPlatformIdEx; and (Win32ProductType <> VER_NT_SERVER) then begin if FindBuildNameAndExtraFrom( - Win10BuildMap, InternalBuildNumber, InternalExtraUpdateInfo + Win10_BuildMap, InternalBuildNumber, InternalExtraUpdateInfo, + VersionEx ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := + TPJWin10PlusVersion(VersionEx); end - else if IsBuildNumber(Win1021H1Build) then + else if IsBuildNumber(Win10_21H1_Build) then begin // **REF3** - InternalBuildNumber := Win1021H1Build; + InternalBuildNumber := Win10_21H1_Build; + InternalWin1011Version := win10v21H1; case InternalRevisionNumber of 985, 1023, 1052, 1055, 1081, 1082, 1083, 1110, 1151, 1165, 1202, 1237, 1266, 1288, 1320, 1348, 1387, 1415, 1466, 1469, 1503, @@ -2140,21 +2454,24 @@ procedure InitPlatformIdEx; ); end; end - else if IsBuildNumber(Win1021H2Build) then + else if IsBuildNumber(Win10_21H2_Build) then begin // **REF4** // From 21H2 Windows 10 moves from a 6 monthly update cycle to a // yearly cycle - InternalBuildNumber := Win1021H2Build; + InternalBuildNumber := Win10_21H2_Build; + InternalWin1011Version := win10v21H2; case InternalRevisionNumber of 1288, 1348, 1387, 1415, 1466, 1469, 1503, 1526, 1566, 1586, 1620, 1645, 1682, 1706, 1708, 1741, 1766, 1767, 1806, 1826, 1865, 1889, 1949, 2006, 2075, 2130, 2132, 2193, 2194, 2251, - 2311, 2364, 2486, 2546, 2604, 2673, 2728, 2788 .. MaxInt: + 2311, 2364, 2486, 2546, 2604, 2673, 2728, 2788, 2846, 2965, + 3086, 3208, 3324, 3448, 3570, 3693, 3803, 3930, 4046, + 4170, 4291, 4412, 4529, 4651, 4780, 4894 .. MaxInt: InternalExtraUpdateInfo := 'Version 21H2'; 1147, 1149, 1151, 1165, 1200, 1202, 1237, 1263, 1266, 1319, - 1320, 1379, 1381, 1499, 1618, 1679, 1737, 1739, 1862, 1947, - 2192, 2545: + 1320, 1379, 1381, 1499, 1618, 1679, 1737, 1739, 1862, + 1947, 2192, 2545: InternalExtraUpdateInfo := Format( 'Version 21H2 [Release Preview Channel v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] @@ -2166,37 +2483,50 @@ procedure InitPlatformIdEx; ); end; end - else if IsBuildNumber(Win1022H2Build) then + else if IsBuildNumber(Win10_22H2_Build) then begin // **REF5** - InternalBuildNumber := Win1022H2Build; + InternalBuildNumber := Win10_22H2_Build; + InternalWin1011Version := win10v22H2; case InternalBuildNumber of 2006, 2130, 2132, 2193, 2194, 2251, 2311, 2364, 2486, 2546, - 2604, 2673, 2728, 2788 .. MaxInt: + 2604, 2673, 2728, 2788, 2846, 2913, 2965, 3031, 3086, 3208, + 3271, 3324, 3393, 3448, 3516, 3570, 3636, 3693, 3758, 3803, + 3930, 3996, 4046, 4123, 4170, 4239, 4291, 4355, 4412, 4474, + 4529, 4598, 4651, 4717, 4780, 4842, 4894, 4957 .. MaxInt: InternalExtraUpdateInfo := 'Version 22H2'; - 1865, 1889, 1949, 2075, 2301, 2670, 2787: + 1865, 1889, 1949, 2075, 2301, 2670, 2787, 2908, 3030, 3154, + 3155, 3269, 3391, 3513, 3754, 3757, 3992, 4116, 4233, 4235, + 4353, 4472: InternalExtraUpdateInfo := Format( 'Version 22H2 [Release Preview Channel v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); + 4593, 4713, 4955: + InternalExtraUpdateInfo := Format( + 'Version 22H2 ' + + '[Beta and Release Preview Channels v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); else InternalExtraUpdateInfo := Format( - 'Version 22H1 [Unknown release v10.0.%d.%d]', + 'Version 22H2 [Unknown release v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); end; end // Win 11 releases are reporting v10.0 // Details taken from: https://tinyurl.com/usupsz4a - else if IsBuildNumber(Win11DevBuild) then + else if IsBuildNumber(Win11_Dev_Build) then begin - InternalBuildNumber := Win11DevBuild; + InternalBuildNumber := Win11_Dev_Build; + InternalWin1011Version := win10plusUnknown; InternalExtraUpdateInfo := Format( 'Dev [Insider v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ) end - else if IsBuildNumber(Win11v21H2Build) then + else if IsBuildNumber(Win11_21H2_Build) then begin // **REF6** // There are several Win 11 releases with this build number @@ -2204,12 +2534,15 @@ procedure InitPlatformIdEx; // number. // *** Amazingly one of them, revision 194, is the 1st public // release of Win 11 -- well hidden eh?! - InternalBuildNumber := Win11v21H2Build; + InternalBuildNumber := Win11_21H2_Build; + InternalWin1011Version := win11v21H2; case InternalRevisionNumber of 194, 258, 282, 348, 376, 434, 438, 469, 493, 527, 556, 593, 613, 652, 675, 708, 739, 740, 778, 795, 832, 856, 918, 978, 1042, 1098, 1100, 1165, 1219, 1281, 1335, 1455, 1516, 1574, 1641, - 1696, 1761 .. MaxInt: + 1696, 1761, 1817, 1880, 1936, 2003, 2057, 2124, 2176, 2245, + 2295, 2360, 2416, 2482, 2538, 2600, 2652, 2713, 2777, + 2836, 2899, 2960, 3019, 3079, 3147, 3197 .. MaxInt: // Public releases of Windows 11 InternalExtraUpdateInfo := 'Version 21H2'; 51, 65, 71: @@ -2228,9 +2561,10 @@ procedure InitPlatformIdEx; + '[Beta & Release Preview Channels v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); - 651, 706, 776, 829, 917, 1041, 1163, 1279, 1515, 1639, 1757: + 651, 706, 776, 829, 917, 1041, 1163, 1279, 1515, 1639, 1757, + 1879, 2001, 2121, 2243, 2359, 2479: InternalExtraUpdateInfo := Format( - 'Version 21H1 Release Preview Channel v10.0.%d.%d]', + 'Version 21H2 Release Preview Channel v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); else @@ -2240,27 +2574,45 @@ procedure InitPlatformIdEx; ); end; end - else if IsBuildNumber(Win11v22H2Build) then + else if IsBuildNumber(Win11_22H2_Build) then begin // **REF1** - InternalBuildNumber := Win11v22H2Build; + InternalBuildNumber := Win11_22H2_Build; + InternalWin1011Version := win11v22H2; case InternalRevisionNumber of 382, 521, 525, 608, 674, 675, 755, 819, 900, 963, 1105, 1194, - 1265, 1344, 1413, 1485, {placeholder->}1538 .. MaxInt: + 1265, 1344, 1413, 1485, 1555, 1635, 1702, 1778, 1848, 1926, + 1928, 1992, 2070, 2134, 2215, 2283, 2361, 2428, 2506, 2715, + 2792, 2861, 3007, 3085, 3155, 3235, 3296, 3374, 3447, 3527, + 3593, 3672, 3737, 3810, 3880, 3958, 4037, 4112, 4169, 4249 + .. MaxInt: + begin InternalExtraUpdateInfo := 'Version 22H2'; + case InternalRevisionNumber of + 675: AppendMomentToInternalExtraUpdateInfo(1); + 1344: AppendMomentToInternalExtraUpdateInfo(2); + 1778: AppendMomentToInternalExtraUpdateInfo(3); + 2361: AppendMomentToInternalExtraUpdateInfo(4); + 3235: AppendMomentToInternalExtraUpdateInfo(5); + end; + end; 1: InternalExtraUpdateInfo := Format( 'Version 22H2 [Beta & Release Preview v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); - 105, 169, 232, 317, 457, 607, 754, 898, 1192, 1343, 1483: + 105, 169, 232, 317, 457, 607, 754, 898, 1192, 1343, 1483, 1631, + 1776, 2066, 2213, 2359, 2500, 2787, 3078, 3227, 3371, 3520, + 3668, 3807, 3951, 4108, 4247: InternalExtraUpdateInfo := Format( 'Version 22H2 [Release Preview v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); 160, 290, 436, 440, 450, 575, 586, 590, 598, 601, 730, 741, 746, 870, 875, 885, 891, 1020, 1028, 1037, 1095, 1180, 1245, 1250, - 1255, 1325, 1391, 1465, 1470, 1537: + 1255, 1325, 1391, 1465, 1470, 1537, 1546, 1616, 1680, 1690, + 1755, 1825, 1830, 1835, 1900, 1906, 1972, 2048, 2050, 2115, + 2129, 2191, 2199, 2262, 2265, 2271, 2338: InternalExtraUpdateInfo := Format( 'Version 22H2 [Beta v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] @@ -2272,57 +2624,130 @@ procedure InitPlatformIdEx; ); end; end - else if IsBuildNumber(Win11v22H2BuildAlt) then + else if IsBuildNumber(Win11_23H2_Build) then begin - // **REF2** - InternalBuildNumber := Win11v22H2BuildAlt; - // Set fallback update info for unknown revisions + // **REF10** + InternalBuildNumber := Win11_23H2_Build; + InternalWin1011Version := win11v23H2; case InternalRevisionNumber of - 290, 436, 440, 450, 575, 586, 590, 598, 601: + 2428, 2506, 2715, 2792, 2861, 3007, 3085, 3155, 3235 {Moment 5}, + 3296, 3374, 3447, 3527, 3593, 3672, 3737, 3810, 3880, 3958, + 4037, 4112, 4169, 4249 .. MaxInt: + InternalExtraUpdateInfo := 'Version 23H2'; + 1825, 1830, 1835, 1900, 1906, 1972: + begin + // revisions 1825..1972 had version string "22H2" + InternalWin1011Version := win11v22H2; InternalExtraUpdateInfo := Format( - 'Version 22H2 [October Component Update v10.0.%d.%d]', + 'Version 22H2 [Beta v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + end; + 2048, 2050, 2115, 2129, 2191, 2199, 2262, 2265, 2271, 2338: + InternalExtraUpdateInfo := Format( + 'Version 23H2 [Beta v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + 2361, 2787, 3078, 3227, 3371, 3520, 3668, 3807, 3951, 4108, + 4247: + InternalExtraUpdateInfo := Format( + 'Version 23H2 [Release Preview v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); else InternalExtraUpdateInfo := Format( - 'Version 22H2 [Unknown release v10.0.%d.%d]', + 'Version 23H2 [Unknown release v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + end; + end + else if IsBuildNumber(Win11_24H2_Build) then + begin + // **REF11** + InternalBuildNumber := Win11_24H2_Build; + InternalWin1011Version := win11v24H2; + case InternalRevisionNumber of + 1742, 1882 .. MaxInt: + InternalExtraUpdateInfo := 'Version 24H2'; + 560, 712, 863, 994, 1000, 1150, 1297, 1301, 1457, 1586, 1591: + InternalExtraUpdateInfo := Format( + 'Version 24H2 [Release Preview v10.0.%d.%d', + [InternalBuildNumber, InternalRevisionNumber] + ); + 1: + InternalExtraUpdateInfo := Format( + 'Version 24H2 [Dev & Canary Channel v10.0.%d.%d', + [InternalBuildNumber, InternalRevisionNumber] + ); + 268: + InternalExtraUpdateInfo := Format( + 'Version 24H2 [Dev Channel v10.0.%d.%d', + [InternalBuildNumber, InternalRevisionNumber] + ); + else + InternalExtraUpdateInfo := Format( + 'Version 24H2 [Unknown release v10.0.%d.%d]', [InternalBuildNumber, InternalRevisionNumber] ); end; end else if FindBuildNumberFrom( - Win11DevChannelDevBuilds, InternalBuildNumber + Win11_24H2_DevAndCanaryChannel_Builds, InternalBuildNumber ) then begin - // Win11 Dev Channel builds with version string "Dev" + // Win11 builds in Canary, Dev & Preview channels with version + // string "24H2" + InternalWin1011Version := win10plusUnknown; InternalExtraUpdateInfo := Format( - 'Dev Channel v10.0.%d.%d (Dev)', + 'Dev or Canary Channel Version 24H2 v10.0.%d.%d', [InternalBuildNumber, InternalRevisionNumber] ); end else if FindBuildNumberFrom( - Win11CanaryPreviewBuilds, InternalBuildNumber + Win11_24H2_CanaryChannel_Builds, InternalBuildNumber ) then begin - // Win11 Canary Channel builds + // Win11 builds in Canary channel with version string "24H2" + InternalWin1011Version := win10plusUnknown; InternalExtraUpdateInfo := Format( - 'Canary Channel v10.0.%d.%d (Dev)', + 'Canary Channel Version 24H2 v10.0.%d.%d', [InternalBuildNumber, InternalRevisionNumber] ); end + else if IsBuildNumber(Win11_Oct22Component_BetaChannel_Build) then + begin + // **REF2** + InternalBuildNumber := Win11_Oct22Component_BetaChannel_Build; + InternalWin1011Version := win10plusUnknown; + case InternalRevisionNumber of + 290, 436, 440, 450, 575, 586, 590, 598, 601: + InternalExtraUpdateInfo := Format( + 'Version 22H2 [October Component Update v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + else + InternalExtraUpdateInfo := Format( + 'Version 22H2 [Unknown release v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + end; + end else if FindBuildNumberFrom( - Win11DevBetaChannels22H2Builds, InternalBuildNumber + Win11_22H2_DevAndBetaChannel_Builds, InternalBuildNumber ) then begin - // Win 11 Dev & Beta channel builds with verison string "22H2" + // Win 11 Dev & Beta channel builds with version string "22H2" + InternalWin1011Version := win10plusUnknown; InternalExtraUpdateInfo := Format( 'Dev & Beta Channels v10.0.%d.%d (22H2)', [InternalBuildNumber, InternalRevisionNumber] ); end - else if IsBuildNumber(Win11Feb23ComponentBetaChannelBuild) then + else if IsBuildNumber(Win11_Feb23Component_BetaChannel_Build) then begin - InternalBuildNumber := Win11Feb23ComponentBetaChannelBuild; + // **REF7** + InternalBuildNumber := Win11_Feb23Component_BetaChannel_Build; + InternalWin1011Version := win10plusUnknown; case InternalRevisionNumber of 730, 741, 746, 870, 875, 885, 891, 1020, 1028, 1037, 1095, 1180, 1245, 1250, 1255, 1325 .. MaxInt: @@ -2337,11 +2762,36 @@ procedure InitPlatformIdEx; ); end; end - else if IsBuildNumber(Win11FutureComponentBetaChannelBuild) then + else if IsBuildNumber(Win11_May23Component_BetaChannel_Build) then begin - InternalBuildNumber := Win11FutureComponentBetaChannelBuild; + // **REF8** + InternalBuildNumber := Win11_May23Component_BetaChannel_Build; + InternalWin1011Version := win10plusUnknown; case InternalRevisionNumber of - 1391, 1465, 1470, 1537 .. MaxInt: + 1391, 1465, 1470, 1537, 1546, 1610, 1616, 1680, 1690, 1755 .. + MaxInt: + InternalExtraUpdateInfo := Format( + 'May 2023 Component Update Beta v10.0.%d.%d', + [InternalBuildNumber, InternalRevisionNumber] + ); + else + InternalExtraUpdateInfo := Format( + 'May 2023 Component Update [Unknown Beta v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + end; + end + else if IsBuildNumber(Win11_FutureComponent_BetaChannel_Build) then + begin + // **REF9** + InternalBuildNumber := Win11_FutureComponent_BetaChannel_Build; + InternalWin1011Version := win10plusUnknown; + case InternalRevisionNumber of + 2419, 2483, 2486, 2552, 2700, 2771, 2776, 2841, 2850, 2915, + 2921, 3061, 3066, 3130, 3139, 3140, 3209, 3212, 3276, 3286, + 3350, 3420, 3430, 3495, 3500, 3566, 3570, 3575, 3640, 3646, + 3720, 3785, 3790, 3858, 3930, 3936, 4000, 4005, 4010, 4076, + 4082, 4145, 4225, 4291 .. MaxInt: InternalExtraUpdateInfo := Format( 'Future Component Update Beta v10.0.%d.%d', [InternalBuildNumber, InternalRevisionNumber] @@ -2353,6 +2803,25 @@ procedure InitPlatformIdEx; ); end; end + else if IsBuildNumber(Win11_FutureComponent_DevChannel_Build) then + begin + // **REF12** + InternalBuildNumber := Win11_FutureComponent_DevChannel_Build; + InternalWin1011Version := win10plusUnknown; + case InternalRevisionNumber of + 461, 470, 670, 751, 770, 961, 1252, 1330, 1340, 1350, 1542, + 1843, 1912 .. MaxInt: + InternalExtraUpdateInfo := Format( + 'Future Component Update Dev Channel v10.0.%d.%d', + [InternalBuildNumber, InternalRevisionNumber] + ); + else + InternalExtraUpdateInfo := Format( + 'Future Component Update [Unknown Beta v10.0.%d.%d]', + [InternalBuildNumber, InternalRevisionNumber] + ); + end; + end // End with some much less likely cases // NOTE: All the following tests MUST come after the last call to // FindBuildNameAndExtraFrom() for non-server OSs because some @@ -2364,14 +2833,14 @@ procedure InitPlatformIdEx; InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v20H2; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_2004_Preview_Builds, '2004', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v2004; end else if IsBuildNumber(Win10_19XX_Shared_Build) then begin @@ -2379,71 +2848,63 @@ procedure InitPlatformIdEx; // preview of Version 1903 or 1909 InternalBuildNumber := Win10_19XX_Shared_Build; if IsInRange(InternalRevisionNumber, 0, 113) then + begin + InternalWin1011Version := win10v1903; InternalExtraUpdateInfo := Format( 'Version 1903 Preview Build %d.%d', [InternalBuildNumber, InternalRevisionNumber] ) + end else if IsInRange(InternalRevisionNumber, 10000, 10024) then + begin + InternalWin1011Version := win10v1909; InternalExtraUpdateInfo := Format( 'Version 1909 Preview Build %d.%d', [InternalBuildNumber, InternalRevisionNumber] ); + end; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_1903_Preview_Builds, '1903', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v1903; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_1809_Preview_Builds, '1809', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v1809; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_1803_Preview_Builds, '1803', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v1803; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_1709_Preview_Builds, '1709', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v1709; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_1703_Preview_Builds, '1703', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v1703; end else if FindWin10PreviewBuildNameAndExtraFrom( Win10_1607_Preview_Builds, '1607', InternalBuildNumber, InternalExtraUpdateInfo ) then begin - // Nothing to do: required internal variables set in function call - end - else if FindWin10PreviewBuildNameAndExtraFrom( - Win10_1511_Preview_Builds, '1511', - InternalBuildNumber, InternalExtraUpdateInfo - ) then - begin - // Nothing to do: required internal variables set in function call - end - else if FindWin10PreviewBuildNameAndExtraFrom( - Win10_1507_Preview_Builds, '1507', - InternalBuildNumber, InternalExtraUpdateInfo - ) then - begin - // Nothing to do: required internal variables set in function call + InternalWin1011Version := win10v1607; end end else // Win32ProductType in [VER_NT_DOMAIN_CONTROLLER, VER_NT_SERVER] @@ -2453,13 +2914,14 @@ procedure InitPlatformIdEx; if FindBuildNameAndExtraFrom( WinServerSimpleBuildMap, InternalBuildNumber, - InternalExtraUpdateInfo + InternalExtraUpdateInfo, + VersionEx // unused ) then begin // Nothing to do: required internal variables set in function call end else if FindBuildNumberFrom( - Win2019IPBuilds, InternalBuildNumber + Win2019_IP_Builds, InternalBuildNumber ) then begin // Windows 2019 Insider preview builds require build number in @@ -2553,6 +3015,13 @@ procedure InitPlatformIdEx; { TPJOSInfo } +class function TPJOSInfo.BuildBranch: string; +begin + Result := GetRegistryString( + HKEY_LOCAL_MACHINE, CurrentVersionRegKeys[IsWinNT], 'BuildBranch' + ); +end; + class function TPJOSInfo.BuildNumber: Integer; begin Result := InternalBuildNumber; @@ -2618,6 +3087,13 @@ class function TPJOSInfo.Description: string; end; end; +class function TPJOSInfo.DigitalProductID: TBytes; +begin + Result := GetRegistryBytes( + HKEY_LOCAL_MACHINE, CurrentVersionRegKeys[IsWinNT], 'DigitalProductId' + ); +end; + class function TPJOSInfo.Edition: string; begin // This method is based on sample C++ code from MSDN @@ -2632,7 +3108,11 @@ class function TPJOSInfo.Edition: string; // For v6.0 and later we ignore the suite mask and use the new // PRODUCT_ flags from the GetProductInfo() function to determine the // edition + // 1st try to find edition name from lookup table Result := EditionFromProductInfo; + if Result = '' then + // no matching entry in lookup: get from registry + Result := EditionIDFromReg; // append 64-bit if 64 bit system if InternalProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 then Result := Result + ' (64-bit)'; @@ -2736,7 +3216,7 @@ class function TPJOSInfo.Edition: string; end else // NT before SP6: we read required info from registry - Result := EditionFromReg; + Result := NTEditionFromReg; end; end; end; @@ -2756,19 +3236,10 @@ class function TPJOSInfo.EditionFromProductInfo: string; end; end; -class function TPJOSInfo.EditionFromReg: string; -var - EditionCode: string; // OS product edition code stored in registry +class function TPJOSInfo.EditionIDFromReg: string; begin - EditionCode := ProductTypeFromReg; - if CompareText(EditionCode, 'WINNT') = 0 then - Result := 'WorkStation' - else if CompareText(EditionCode, 'LANMANNT') = 0 then - Result := 'Server' - else if CompareText(EditionCode, 'SERVERNT') = 0 then - Result := 'Advanced Server'; - Result := Result + Format( - ' %d.%d', [InternalMajorVersion, InternalMinorVersion] + Result := GetRegistryString( + HKEY_LOCAL_MACHINE, CurrentVersionRegKeys[IsWinNT], 'EditionID' ); end; @@ -2991,6 +3462,29 @@ class function TPJOSInfo.IsWin9x: Boolean; Result := Platform = ospWin9x; end; +class function TPJOSInfo.IsWindows10PlusVersionOrLater( + const AVersion: TPJWin10PlusVersion): Boolean; +begin + Assert(not (AVersion in [win10plusNA, win10plusUnknown])); + Result := IsReallyWindows10OrGreater and (Windows10PlusVersion >= AVersion); +end; + +class function TPJOSInfo.IsWindows10VersionOrLater( + const AVersion: TPJWin10PlusVersion): Boolean; +begin + if not (AVersion in Win10_Versions) then + raise EPJSysInfo.Create('Invalid Windows 10 version: can''t compare'); + Result := IsWindows10PlusVersionOrLater(AVersion); +end; + +class function TPJOSInfo.IsWindows11VersionOrLater( + const AVersion: TPJWin10PlusVersion): Boolean; +begin + if not (AVersion in Win11_Versions) then + raise EPJSysInfo.Create('Invalid Windows 11 version: can''t compare'); + Result := IsWindows10PlusVersionOrLater(AVersion); +end; + class function TPJOSInfo.IsWindowsServer: Boolean; var OSVI: TOSVersionInfoEx; @@ -3048,6 +3542,22 @@ class function TPJOSInfo.MinorVersion: Integer; Result := InternalMinorVersion; end; +class function TPJOSInfo.NTEditionFromReg: string; +var + EditionCode: string; // OS product edition code stored in registry +begin + EditionCode := ProductTypeFromReg; + if CompareText(EditionCode, 'WINNT') = 0 then + Result := 'WorkStation' + else if CompareText(EditionCode, 'LANMANNT') = 0 then + Result := 'Server' + else if CompareText(EditionCode, 'SERVERNT') = 0 then + Result := 'Advanced Server'; + Result := Result + Format( + ' %d.%d', [InternalMajorVersion, InternalMinorVersion] + ); +end; + class function TPJOSInfo.Platform: TPJOSPlatform; begin case InternalPlatform of @@ -3059,8 +3569,6 @@ class function TPJOSInfo.Platform: TPJOSPlatform; end; class function TPJOSInfo.Product: TPJOSProduct; -var - DummyBN: Integer; // dummy build number begin Result := osUnknown; case Platform of @@ -3150,8 +3658,10 @@ class function TPJOSInfo.Product: TPJOSProduct; // application is "manifested" for the correct Windows version. // See https://bit.ly/MJSO8Q. Result := osWin10Svr - else if FindBuildNumberFrom(Win10_6point4Builds, DummyBN) then - Result := osWin10; + // Version 6.4 was also used for some early Windows 10 preview + // builds, but they have all expired so detection has been + // removed. + // See https://tinyurl.com/3c8e3hsc else // Higher minor version: must be an unknown later OS Result := osWinLater @@ -3169,7 +3679,7 @@ class function TPJOSInfo.Product: TPJOSProduct; 0: if not IsServer then begin - if TestBuildNumber(VER_LESS, Win11FirstBuild) then + if TestBuildNumber(VER_LESS, Win11_First_Build) then Result := osWin10 else // ** As of 2021-10-05 Win 11 is reporting version 10.0! @@ -3177,11 +3687,17 @@ class function TPJOSInfo.Product: TPJOSProduct; end else begin - if TestBuildNumber(VER_LESS_EQUAL, Win2016LastBuild) then + if TestBuildNumber( + VER_LESS_EQUAL, Win2016_Last_Build + ) then Result := osWin10Svr - else if TestBuildNumber(VER_LESS_EQUAL, Win2019LastBuild) then + else if TestBuildNumber( + VER_LESS_EQUAL, Win2019_Last_Build + ) then Result := osWinSvr2019 - else if TestBuildNumber(VER_LESS_EQUAL, WinServerLastBuild) then + else if TestBuildNumber( + VER_LESS_EQUAL, WinServer_Last_Build + ) then Result := osWinServer else Result := osWinSvr2022; @@ -3323,6 +3839,29 @@ class function TPJOSInfo.ServicePackMinor: Integer; Result := Win32ServicePackMinor; end; +class function TPJOSInfo.Windows10PlusVersion: TPJWin10PlusVersion; +begin + Result := InternalWin1011Version; +end; + +class function TPJOSInfo.Windows10PlusVersionName: string; +const + cVersions: array[TPJWin10PlusVersion] of string = ( + // Not windows 10+ + '', + // Windows 10+ with unknown version string + 'Unknown', + // Windows 10 + '1507', '1511', '1607', '1703', '1709', + '1803', '1809', '1903', '1909', '2004', + '20H2', '21H1', '21H2', '22H2', + // Windows 11 + '21H2', '22H2', '23H2', '24H2' + ); +begin + Result := cVersions[Windows10PlusVersion]; +end; + { TPJComputerInfo } class function TPJComputerInfo.BiosVendor: string; @@ -3508,18 +4047,17 @@ class function TPJComputerInfo.MACAddress: string; if NetBiosSucceeded(Netbios(@Ncb)) then begin // we have a MAC address: return it - with Adapter.Adapt do - Result := Format( - '%.2x-%.2x-%.2x-%.2x-%.2x-%.2x', - [ - Ord(adapter_address[0]), - Ord(adapter_address[1]), - Ord(adapter_address[2]), - Ord(adapter_address[3]), - Ord(adapter_address[4]), - Ord(adapter_address[5]) - ] - ); + Result := Format( + '%.2x-%.2x-%.2x-%.2x-%.2x-%.2x', + [ + Ord(Adapter.Adapt.adapter_address[0]), + Ord(Adapter.Adapt.adapter_address[1]), + Ord(Adapter.Adapt.adapter_address[2]), + Ord(Adapter.Adapt.adapter_address[3]), + Ord(Adapter.Adapt.adapter_address[4]), + Ord(Adapter.Adapt.adapter_address[5]) + ] + ); Exit; end; end; diff --git a/Src/Help/HTML/reml.htm b/Src/Help/HTML/reml.htm index f66afea9d..0783817a5 100644 --- a/Src/Help/HTML/reml.htm +++ b/Src/Help/HTML/reml.htm @@ -15,20 +15,6 @@ About REML - About the REML markup language

    - REML is CodeSnip's own little markup language that can - be used to style the text of a snippet's description and / or extra - information. The latest version is v6, which is backwards compatible with - all other versions. + REML is a little markup language that can be used to style text. It is a SGML language similar to HTML, albeit much smaller. A small number of tags and character entities are supported.

    -

    - Language Details -

    - The REML language is a SGML language similar to a greatly - simplified XHTML. The are a small number of tags you can use. Firstly - there are two block-level tags that render text in paragraphs, while the - other tags format text inline or embed hyplerlinks. + CodeSnip currently supports REML v6. See the REML v6 language definition for full details.

    -

    - Block level tags -

    -
    -
    <p>...</p>
    -
    - Renders the enclosed markup as a simple paragraph. -
    -
    <heading>...</heading>
    -
    - Renders the enclosed markup as a heading. -
    -
    <ol>...</ol>
    -
    - Renders the enclosed HTML as an ordered list. Must contain - <li>...</li> blocks and nothing - else. -
    -
    <ul>...</ul>
    -
    - Renders the enclosed HTML as an unordered list. Must contain - <li>...</li> blocks and nothing - else. -
    -
    <l1>...</li>
    -
    - Renders the enclosed HTML as a list item. May only be used within - <ol>...</ol> and - <ul>...</ul> blocks. -
    -

    - The following rules apply to the use of block level tags: -

    -
      -
    1. - Must be matched, e.g. - <p> must have a matching - </p>. -
    2. -
    3. - <p>...</p> and - <heading>...</heading> blocks - must not contain other block level tags. -
    4. -
    5. - <ol>...</ol> and - <ul>...</ul> blocks must only - contain one or more - <li>...</li> blocks. -
    6. -
    7. - <li>...</li> blocks may contain - <p>...</p> and - <heading>...</heading> blocks, - but it is permitted to include text and inline tags directly without - enclosing them one of the permitted blocks. Nested lists are permitted - by including further <ul>...</ul> - and <ol>...</ol> blocks. -
    8. -
    9. - All text should be embedded within - <p>...</p>, - <heading>...</heading> or - <li>...</li> block level tags, - e.g. <heading>heading</heading><p>text</p> - or simply <p>text</p>. -
    10. -
    11. - White space between blocks must be ignored. -
    12. -
    -

    - Here is a valid example: -

    -
    <heading>Hello</heading>
    -<p>Hello World</p>
    +      The following whimsical example demonstrates every supported REML tag along with a couple of character entities:
    +
    <heading>
    +  Wombat converter
    +</heading>
    +<p>
    + Transforms <strong>wombats</strong> into <em>dongles</em>.
    + <warning><em>W</em>arning:</warning> The <var>Foo</var>
    + variable stores &lt;=<mono>12</mono> accumulated <mono>dongles</mono>.
    +</p>
    +<p>
    + All 3 species of wombat are supported:
    +</p>
     <ol>
    -  <li>one</li>
    -  <li><p>two</p></li>
    -  <ul>
    -    <li>two A</li>
    -    <li>two B</li>
    -  <ul>
    -  <li>three</li>
    -</ol>
    -

    - Srictly speaking, the following example is invalid code – the - highlighted sections are in error, because they are not contained within - block tags. -

    -
    blah<heading>blah</heading>blah<p>blah</p>blah
    -

    - However, CodeSnip is quite permissive and, in many cases, - automatically adds block level tags for text that is not enclosed in block - level tags. The above code is interpreted similar ro: -

    -
    <p>blah </p>
    -<heading>blah</heading>
    -<p>blah </p>
    -<p>blah</p>
    -<p>blah</p>
    -

    - Inline tags -

    -

    - Here are the available inline tags: -

    -
    -
    <strong>...</strong>
    -
    - Renders the enclosed markup with strong emphasis.
    - Example: <p>Make stuff - <strong>stand out</strong>.</p> -
    -
    <em>...</em>
    -
    - Emphasises the enclosed markup.
    - Example: <p>Draw - <em>attention</em> to something.</p> -
    -
    <var>...</var>
    -
    - Used to indicate the enclosed markup is a variable.
    - Example: <p>Refer to a function - <var>parameter</var>.</p> -
    -
    <warning>...</warning>
    -
    - Used for warning text.
    - Example: - <p><warning>Warning:</warning> - Don't do it!</p> -
    -
    <mono>...</mono>
    -
    - Renders markup in a mono-spaced font.
    - Example: <p>Use the: - <mono>Windows</mono> unit.</p> -
    -
    <a href="url">...</a>
    -
    - Creates a hyperlink. The href attribute must - specify the required URL, which must use one of the http:, - https: or file: protocols; others are not permitted. - If you use the file: protocol it must reference a valid local - or network file. Be aware that if you export a snippet - containing a hyperlink that uses the file: protocol it will - only work on the recipient's system if the specified file exists in the - same location.
    - Example: <p><a - href="https://example.com">Visit - example.com</a></p>.. -
    -
    -

    - Character Entities -

    -

    - The "<" and "&" characters are special within - the markup and must not be used directly, even when you are just entering - plain text. You must use the &lt; character - entity in place of "<" and - &amp; instead of "&". -

    -

    - A few other character entities are supported for convenience. Here is the - complete list: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Character EntityActual Character
    &amp;&
    &quot;"
    &gt;>
    &lt;<
    &copy;©
    &times;×
    &divide; or &div;÷
    &plusmn;±
    &ne; or &neq;
    &sum;
    &infin;
    &pound;£
    &curren;¤
    &yen;¥
    &euro;
    &cent;¢
    &dagger;
    &ddagger; or &Dagger;
    &hellip;
    &para;
    &sect;§
    &reg;®
    &frac14;¼
    &frac12; or &half;½
    &frac34;¾
    &micro;µ
    &deg;°
    &laquo;«
    &raquo;»
    &iquest;¿
    -

    - By way of an example, if you want to display x ≠ y, use: -

    -

    - x &ne; y + <li> + <p> + <a href="https://en.wikipedia.org/wiki/Common_wombat">Common + wombat</a>. The following sub-species are supported: + </p> + <ul> + <li> + Bass Strait wombat + </li> + <li> + Hirsute wombat + </li> + <li> + Tasmanian wombat + </li> + </ul> + </li> + <li> + Northen hairy-nosed wombat + </li> + <li> + Southern hairy-nosed wombat + </li> +</ol> +<p> + Copyright &copy; wombaterama, 2024. +</p>

    - No other symbolic character entities are supported. - However, numeric character entities can be used to insert other characters - by specifying its code. For example &#64; is - equivalent to "@". + All this silliness renders something like this:

    - Numeric entities should be used with caution. Using a code that is - specific to an ANSI character set may cause unexpected results because - CodeSnip uses Unicode internally and the specified character code - may not represent the same character in ANSI and Unicode. +

    diff --git a/Src/Help/Images/REMLExample.png b/Src/Help/Images/REMLExample.png new file mode 100644 index 000000000..6e7a49f5b Binary files /dev/null and b/Src/Help/Images/REMLExample.png differ diff --git a/Src/Install/CodeSnip.iss b/Src/Install/CodeSnip.iss index 47a85f471..229db969a 100644 --- a/Src/Install/CodeSnip.iss +++ b/Src/Install/CodeSnip.iss @@ -2,7 +2,7 @@ ; v. 2.0. If a copy of the MPL was not distributed with this file, You can ; obtain one at https://mozilla.org/MPL/2.0/ ; -; Copyright (C) 2006-2022, Peter Johnson (gravatar.com/delphidabbler). +; Copyright (C) 2006-2024, Peter Johnson (gravatar.com/delphidabbler). ; ; Install file generation script for use with Inno Setup. @@ -29,6 +29,7 @@ #define SrcDocsPath SourcePath + "..\..\Docs\" #define SrcAssetsPath SourcePath + "\Assets\" #define SrcExePath SourcePath + "..\..\_build\exe\" +#define TmpPath SourcePath + "..\..\_build\release\~tmp~\" #define ProgDataSubDir AppName + ".4" #define ExeProg SrcExePath + ExeFile #define AppVersion DeleteToVerStart(GetFileProductVersion(ExeProg)) @@ -89,7 +90,7 @@ Name: {commonappdata}\{#AppPublisher}\{#ProgDataSubDir}\Database; permissions: e Source: {#SrcExePath}{#ExeFile}; DestDir: {app} Source: {#SrcExePath}{#HelpFile}; DestDir: {app}; Flags: ignoreversion Source: {#SrcDocsPath}{#LicenseTextFile}; DestDir: {app}; Flags: ignoreversion -Source: {#SrcDocsPath}{#ReadMeFile}; DestDir: {app}; Flags: ignoreversion +Source: {#TmpPath}{#ReadMeFile}; DestDir: {app}; Flags: ignoreversion Source: {#SrcAssetsPath}UpdatingPreview.rtf; Flags: dontcopy [Icons] diff --git a/Src/Makefile b/Src/Makefile index 17b443abf..b8b69e3b5 100644 --- a/Src/Makefile +++ b/Src/Makefile @@ -2,7 +2,7 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/ # -# Copyright (C) 2009-2022, Peter Johnson (gravatar.com/delphidabbler). +# Copyright (C) 2009-2024, Peter Johnson (gravatar.com/delphidabbler). # # Makefile for the CodeSnip project. @@ -12,12 +12,15 @@ BUILD_ROOT = _build BIN_ROOT = $(BUILD_ROOT)\bin EXE_ROOT = $(BUILD_ROOT)\exe RELEASE_ROOT = $(BUILD_ROOT)\release +RELEASE_TMP_ROOT = $(RELEASE_ROOT)\~tmp~ DOCS_ROOT = Docs SRC_ROOT = Src # Defines macros giving directories relative to location of the Makefile BIN_REL = ..\$(BIN_ROOT) EXE_REL = ..\$(EXE_ROOT) +DOCS_REL = ..\$(DOCS_ROOT) +RELEASE_TMP_REL = ..\$(RELEASE_TMP_ROOT) # Check for required environment variables @@ -115,6 +118,7 @@ config: @mkdir $(BIN_ROOT) @if not exist $(EXE_ROOT) mkdir $(EXE_ROOT) @if not exist $(RELEASE_ROOT) mkdir $(RELEASE_ROOT) + @if not exist $(RELEASE_TMP_ROOT) mkdir $(RELEASE_TMP_ROOT) @cd $(SRC_ROOT) # Builds CodeSnip pascal files and links program @@ -160,8 +164,10 @@ typelib: # Builds setup program setup: !ifndef PORTABLE - @del $(EXE_REL)\CodeSnip-Setup-* + copy $(DOCS_REL)\ReadMe-standard.txt $(RELEASE_TMP_REL)\ReadMe.txt + del $(EXE_REL)\CodeSnip-Setup-* @$(ISCC) Install\CodeSnip.iss + del $(RELEASE_TMP_REL)\ReadMe.txt !else @echo **** Portable build - no setup file created **** !endif @@ -195,12 +201,16 @@ release: @cd .. -@if exist $(OUTFILE) del $(OUTFILE) !ifndef PORTABLE - @$(ZIP) -j -9 $(OUTFILE) $(EXE_ROOT)\CodeSnip-Setup-*.exe $(DOCS_ROOT)\ReadMe.txt + copy $(DOCS_ROOT)\ReadMe-standard.txt $(RELEASE_TMP_ROOT)\ReadMe.txt + @$(ZIP) -j -9 $(OUTFILE) $(EXE_ROOT)\CodeSnip-Setup-*.exe $(RELEASE_TMP_ROOT)\ReadMe.txt + del $(RELEASE_TMP_ROOT)\ReadMe.txt !else + copy $(DOCS_ROOT)\ReadMe-portable.txt $(RELEASE_TMP_ROOT)\ReadMe.txt @$(ZIP) -j -9 $(OUTFILE) $(EXE_ROOT)\CodeSnip-p.exe @$(ZIP) -j -9 $(OUTFILE) $(EXE_ROOT)\CodeSnip.chm - @$(ZIP) -j -9 $(OUTFILE) $(DOCS_ROOT)\ReadMe.txt + @$(ZIP) -j -9 $(OUTFILE) $(RELEASE_TMP_ROOT)\ReadMe.txt @$(ZIP) -j -9 $(OUTFILE) $(DOCS_ROOT)\License.html + del $(RELEASE_TMP_ROOT)\ReadMe.txt !endif @cd $(SRC_ROOT) diff --git a/Src/Res/HTML/dlg-about-program-tplt.html b/Src/Res/HTML/dlg-about-program-tplt.html index 63a3a2cd4..be93a30c3 100644 --- a/Src/Res/HTML/dlg-about-program-tplt.html +++ b/Src/Res/HTML/dlg-about-program-tplt.html @@ -9,7 +9,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2005-2023, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2005-2024, Peter Johnson (gravatar.com/delphidabbler). * * Template for content displayed in program tab of about dialog box. --> @@ -47,7 +47,7 @@

    - DelphiDabbler CodeSnip is copyright © 2005-2023 by CodeSnip is copyright © 2005-2024 by Peter D Johnson. diff --git a/Src/UAppInfo.pas b/Src/UAppInfo.pas index eacc0d65d..7bc91fd6e 100644 --- a/Src/UAppInfo.pas +++ b/Src/UAppInfo.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2005-2021, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2005-2024, Peter Johnson (gravatar.com/delphidabbler). * * Class that provides information about the application. } @@ -36,13 +36,7 @@ TAppInfo = class(TNoConstructObject) const ProgramName = 'CodeSnip-p'; {$ENDIF} {Name of program} - {$IFNDEF PORTABLE} - const ProgramCaption = 'CodeSnip 4'; - {$ELSE} - const ProgramCaption = 'CodeSnip 4 (Portable Edition)'; - {$ENDIF} - {Name of program displayed in main window and task bar caption} - const FullProgramName = CompanyName + ' ' + ProgramName; + const FullProgramName = CompanyName + ' CodeSnip'; {Full name of program, including company name} const ProgramID = 'codesnip'; {Machine readable identifier of program} @@ -107,6 +101,10 @@ TAppInfo = class(TNoConstructObject) {Gets version number of program's executable file. @return Version number as dotted quad. } + class function ProgramCaption: string; + {Gets the program caption to be displayed in main window, + @return Required caption, + } end; @@ -214,6 +212,19 @@ class function TAppInfo.HelpFileName: string; Result := AppExeDir + '\CodeSnip.chm'; end; +class function TAppInfo.ProgramCaption: string; +var + ProductVer: TVersionNumber; +begin + ProductVer := TVersionInfo.ProductVerNum; + Result := Format( + 'CodeSnip v%d.%d.%d', [ProductVer.V1, ProductVer.V2, ProductVer.V3] + ); + {$IFDEF PORTABLE} + Result := Result + ' (Portable Edition)' + {$ENDIF} +end; + class function TAppInfo.ProgramFileVersion: string; {Gets version number of program's executable file. @return Version number as dotted quad. diff --git a/Src/UCompileResultsLBMgr.pas b/Src/UCompileResultsLBMgr.pas index 6d8fd29bd..c94b7fcab 100644 --- a/Src/UCompileResultsLBMgr.pas +++ b/Src/UCompileResultsLBMgr.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2009-2021, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2009-2024, Peter Johnson (gravatar.com/delphidabbler). * * Defines classes that manages display and interaction with a list box that * displays compiler results. @@ -600,13 +600,18 @@ procedure TCompileResultsLBMgr.PopulateListBox; 'unknown'. } var - Compiler: ICompiler; // each supported compiler + Compiler: ICompiler; + CompilerId: TCompilerID; begin - for Compiler in fCompilers do + // Populate list box in reverse order of compiler ID + for CompilerId := High(TCompilerID) downto Low(TCompilerID) do + begin + Compiler := fCompilers[CompilerId]; fLB.Items.AddObject( Compiler.GetName, TCompilerInfo.Create(Compiler.GetID, crQuery) ); + end; end; procedure TCompileResultsLBMgr.SetCompileResult(const Index: Integer; diff --git a/Src/UIOUtils.pas b/Src/UIOUtils.pas index 88beb3afa..8c6ab2154 100644 --- a/Src/UIOUtils.pas +++ b/Src/UIOUtils.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2009-2021, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2009-2024, Peter Johnson (gravatar.com/delphidabbler). * * Provides a container for assisting with common file operations. } @@ -206,6 +206,8 @@ class function TFileIO.CheckBOM(const Stream: TStream; Assert(Assigned(Stream), 'TFileIO.CheckBOM: Stream is nil'); Assert(Assigned(Encoding), 'TFileIO.CheckBOM: Encoding is nil'); Preamble := Encoding.GetPreamble; + if Length(Preamble) = 0 then + Exit(False); if Stream.Size < Length(Preamble) then Exit(False); OldPos := Stream.Position; diff --git a/Src/URTFSnippetDoc.pas b/Src/URTFSnippetDoc.pas index b4f41d63a..4bb6399c1 100644 --- a/Src/URTFSnippetDoc.pas +++ b/Src/URTFSnippetDoc.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2008-2023, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2008-2024, Peter Johnson (gravatar.com/delphidabbler). * * Implements a class that renders a document that describes a snippet as rich * text. @@ -93,10 +93,14 @@ TRTFSnippetDoc = class(TSnippetDoc) /// to document. procedure RenderTitledList(const Title: string; List: IStringList); override; - ///

    Adds given compiler info, preceeded by given heading, to - /// document. + /// Output given compiler test info, preceded by given heading. + /// procedure RenderCompilerInfo(const Heading: string; const Info: TCompileDocInfoArray); override; + /// Output message stating that there is no compiler test info, + /// preceded by given heading. + procedure RenderNoCompilerInfo(const Heading, NoCompileTests: string); + override; /// Interprets and adds given extra information to document. /// /// Active text formatting is observed and styled to suit @@ -341,7 +345,8 @@ procedure TRTFSnippetDoc.RenderCompilerInfo(const Heading: string; TabStop: SmallInt; // tab stop where compile result displayed begin // Calculate tab stop where compile results are displayed - TabStop := (MaxCompilerNameLenInTwips div IndentDelta) * IndentDelta + IndentDelta; + TabStop := (MaxCompilerNameLenInTwips div IndentDelta) * IndentDelta + + 2 * IndentDelta; // Display heading fBuilder.SetFontStyle([fsBold]); fBuilder.SetParaSpacing( @@ -423,6 +428,23 @@ procedure TRTFSnippetDoc.RenderHeading(const Heading: string; fBuilder.EndPara; end; +procedure TRTFSnippetDoc.RenderNoCompilerInfo(const Heading, + NoCompileTests: string); +begin + // Display heading + fBuilder.SetFontStyle([fsBold]); + fBuilder.SetParaSpacing( + TRTFParaSpacing.Create(ParaSpacing, ParaSpacing / 3) + ); + fBuilder.AddText(Heading); + fBuilder.ResetCharStyle; + fBuilder.EndPara; + fBuilder.ClearParaFormatting; + fBuilder.SetFontSize(ParaFontSize); + fBuilder.AddText(NoCompileTests); + fBuilder.EndPara; +end; + procedure TRTFSnippetDoc.RenderSourceCode(const SourceCode: string); var Renderer: IHiliteRenderer; // renders highlighted source as RTF diff --git a/Src/USnippetDoc.pas b/Src/USnippetDoc.pas index 17fbe309b..e11245322 100644 --- a/Src/USnippetDoc.pas +++ b/Src/USnippetDoc.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2008-2023, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2008-2024, Peter Johnson (gravatar.com/delphidabbler). * * Implements an abstract base class that renders a text document that describes * a snippet. Should be overridden by classes that generate actual documents in @@ -39,7 +39,7 @@ TCompileDocInfo = record type /// Array of textual compiler result information. - TCompileDocInfoArray = array of TCompileDocInfo; + TCompileDocInfoArray = TArray; type /// Abstract base class for classes that render documents that @@ -76,10 +76,14 @@ TSnippetDoc = class(TObject) /// title. procedure RenderTitledList(const Title: string; List: IStringList); virtual; abstract; - /// Output given compiler info, preceeded by given heading. + /// Output given compiler test info, preceded by given heading. /// procedure RenderCompilerInfo(const Heading: string; const Info: TCompileDocInfoArray); virtual; abstract; + /// Output message stating that there is no compiler test info, + /// preceded by given heading. + procedure RenderNoCompilerInfo(const Heading, NoCompileTests: string); + virtual; abstract; /// Output given extra information to document. /// Active text must be interpreted in a manner that makes sense /// for document format. @@ -109,6 +113,7 @@ implementation uses // Delphi SysUtils, + Generics.Collections, // Project Compilers.UCompilers, DB.UMain, @@ -136,17 +141,24 @@ function TSnippetDoc.CompilerInfo(const Snippet: TSnippet): var Compilers: ICompilers; // provided info about compilers Compiler: ICompiler; // each supported compiler - InfoIdx: Integer; // index into output array + ResList: TList; begin Compilers := TCompilersFactory.CreateAndLoadCompilers; SetLength(Result, Compilers.Count); - InfoIdx := 0; - for Compiler in Compilers do - begin - Result[InfoIdx] := TCompileDocInfo.Create( - Compiler.GetName, Snippet.Compatibility[Compiler.GetID] - ); - Inc(InfoIdx); + ResList := TList.Create; + try + for Compiler in Compilers do + begin + if Snippet.Compatibility[Compiler.GetID] <> crQuery then + ResList.Add( + TCompileDocInfo.Create( + Compiler.GetName, Snippet.Compatibility[Compiler.GetID] + ) + ); + end; + Result := ResList.ToArray; + finally + ResList.Free; end; end; @@ -158,7 +170,10 @@ function TSnippetDoc.Generate(const Snippet: TSnippet): TEncodedData; sUnitListTitle = 'Required units:'; sDependListTitle = 'Required snippets:'; sXRefListTitle = 'See also:'; - sCompilers = 'Supported compilers:'; + sCompilers = 'Compiler test results:'; + sNoCompilerTests = 'No compiler tests were carried out.'; +var + CompileResults: TCompileDocInfoArray; begin Assert(Assigned(Snippet), ClassName + '.Create: Snippet is nil'); // generate document @@ -176,7 +191,13 @@ function TSnippetDoc.Generate(const Snippet: TSnippet): TEncodedData; RenderTitledList(sDependListTitle, SnippetsToStrings(Snippet.Depends)); RenderTitledList(sXRefListTitle, SnippetsToStrings(Snippet.XRef)); if Snippet.Kind <> skFreeform then - RenderCompilerInfo(sCompilers, CompilerInfo(Snippet)); + begin + CompileResults := CompilerInfo(Snippet); + if Length(CompileResults) > 0 then + RenderCompilerInfo(sCompilers, CompilerInfo(Snippet)) + else + RenderNoCompilerInfo(sCompilers, sNoCompilerTests); + end; if Snippet.Extra.HasContent then RenderExtra(Snippet.Extra); if not Snippet.UserDefined then diff --git a/Src/UTextSnippetDoc.pas b/Src/UTextSnippetDoc.pas index 5b80fd32b..923637950 100644 --- a/Src/UTextSnippetDoc.pas +++ b/Src/UTextSnippetDoc.pas @@ -3,7 +3,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at https://mozilla.org/MPL/2.0/ * - * Copyright (C) 2009-2023, Peter Johnson (gravatar.com/delphidabbler). + * Copyright (C) 2009-2024, Peter Johnson (gravatar.com/delphidabbler). * * Implements a class that renders a document that describes a snippet as plain * text. @@ -63,10 +63,14 @@ TTextSnippetDoc = class(TSnippetDoc) /// to document. procedure RenderTitledList(const Title: string; List: IStringList); override; - /// Adds given compiler info, preceeded by given heading, to + /// Adds given compiler info, preceded by given heading, to /// document. procedure RenderCompilerInfo(const Heading: string; const Info: TCompileDocInfoArray); override; + /// Output message stating that there is no compiler test info, + /// preceded by given heading. + procedure RenderNoCompilerInfo(const Heading, NoCompileTests: string); + override; /// Interprets and adds given extra information to document. /// /// Active text is converted to word-wrapped plain text @@ -166,6 +170,15 @@ procedure TTextSnippetDoc.RenderHeading(const Heading: string; fWriter.WriteLine(Heading); end; +procedure TTextSnippetDoc.RenderNoCompilerInfo(const Heading, + NoCompileTests: string); +begin + // Write out compilers with results + fWriter.WriteLine; + fWriter.WriteLine(Heading); + fWriter.WriteLine(NoCompileTests); +end; + procedure TTextSnippetDoc.RenderSourceCode(const SourceCode: string); begin fWriter.WriteLine; diff --git a/Src/VersionInfo.vi-inc b/Src/VersionInfo.vi-inc index c9ae9dae3..70615f76f 100644 --- a/Src/VersionInfo.vi-inc +++ b/Src/VersionInfo.vi-inc @@ -1,8 +1,8 @@ # CodeSnip Version Information Macros for Including in .vi files # Version & build numbers -version=4.23.0 -build=271 +version=4.24.0 +build=272 # String file information copyright=Copyright © P.D.Johnson, 2005-.