From 497b61f4c3ae3c055e80c203864a536e29e8eb8f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 29 Sep 2015 19:24:20 +0000 Subject: [PATCH] CodeSnip version 4.13.1 --- Docs/ChangeLogs/ChangeLog-v4.txt | 8 +- Docs/LICENSE | 2 +- Docs/License.html | 4 +- Src/3rdParty/PJSysInfo.pas | 329 +++++++++++++++-------- Src/Help/HTML/license.htm | 4 +- Src/Install/Assets/LICENSE | 2 +- Src/Install/Assets/License.rtf | Bin 1216 -> 1183 bytes Src/Res/HTML/dlg-about-program-tplt.html | 4 +- Src/Res/Misc/CodeSnip.manifest | 33 ++- Src/UFontHelper.pas | 96 +++---- Src/VCodeSnip.vi | 4 +- Src/VCodeSnipPortable.vi | 4 +- 12 files changed, 298 insertions(+), 192 deletions(-) diff --git a/Docs/ChangeLogs/ChangeLog-v4.txt b/Docs/ChangeLogs/ChangeLog-v4.txt index 58f1cf514..083178470 100644 --- a/Docs/ChangeLogs/ChangeLog-v4.txt +++ b/Docs/ChangeLogs/ChangeLog-v4.txt @@ -3,7 +3,7 @@ ; v. 2.0. If a copy of the MPL was not distributed with this file, You can ; obtain one at http://mozilla.org/MPL/2.0/ ; -; Copyright (C) 2012-2014, Peter Johnson (www.delphidabbler.com). +; Copyright (C) 2012-2015, Peter Johnson (www.delphidabbler.com). ; ; $Rev$ ; $Date$ @@ -11,6 +11,12 @@ ; Change Log for CodeSnip Release 4 ; ------------------------------------------------------------------------------ +Release v4.13.1 of 29 September 2015 ++ Improved operating system detection to detect Windows 10. ++ Modified program's manifest to declare it compatible with Windows 8 to 10. ++ Code that determines which system font to use no longer depends on OS version but simply on font availability. ++ Updated copyright date in program license as displayed in help, about box, installer and documentation. + Release v4.13.0 of 5 September 2015 + Added support for test compilation with, and detection of, Delphi 10 Seattle compiler. + Made some minor changes to method used to build required type library to remove dependency on the MS MIDL compiler, greatly simplifying build process. diff --git a/Docs/LICENSE b/Docs/LICENSE index 19eded749..b2fa408bf 100644 --- a/Docs/LICENSE +++ b/Docs/LICENSE @@ -5,4 +5,4 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -All files are copyright (C) 2012-2014, Peter Johnson (www.delphidabbler.com). +All files are copyright (C) 2012-2015, Peter Johnson (www.delphidabbler.com). diff --git a/Docs/License.html b/Docs/License.html index cccfb75b0..e51502e85 100644 --- a/Docs/License.html +++ b/Docs/License.html @@ -5,7 +5,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at http://mozilla.org/MPL/2.0/ * - * Copyright (C) 2012-2014, Peter Johnson (www.delphidabbler.com). + * Copyright (C) 2012-2015, Peter Johnson (www.delphidabbler.com). * * $Rev$ * $Date$ @@ -228,7 +228,7 @@

Executable Program

- DelphiDabbler CodeSnip is copyright © 2005-2014 by Peter D + DelphiDabbler CodeSnip is copyright © 2005-2015 by Peter D Johnson, http://www.delphidabbler.com. diff --git a/Src/3rdParty/PJSysInfo.pas b/Src/3rdParty/PJSysInfo.pas index 999dc7f77..d9b9002c5 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 http://mozilla.org/MPL/2.0/ * - * Copyright (C) 2001-2014, Peter Johnson (www.delphidabbler.com). + * Copyright (C) 2001-2015, Peter Johnson (@delphidabbler). * * $Rev$ * $Date$ @@ -25,7 +25,13 @@ * 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 emaulated OS is ignored. + * operating system are always returned and the emulated OS is ignored. + * + * 4: ** IMPORTANT ** + * This version of the code was an attempt to get it to detect and report + * Windows 10. Try as I might, I can't get this to work. So this version + * is released as beta code to use at your own risk. If anyone can fix it, + * please let me know. * * ACKNOWLEDGEMENTS * @@ -33,10 +39,12 @@ * * - Guillermo Fazzolari (bug fix in v2.0.1) * - * - Laurent Pierre (PRODUCT_* constants and suggested GetProductInfo API code - * used in v3.0) + * - Laurent Pierre (Many PRODUCT_* constants and suggested GetProductInfo API + * code used in v3.0 and later) * - * - Rich Habedank (bug fix in revision 228) + * - Rich Habedank (bug fix in r228 and testing of bug fixes reported as + * issues #31 (https://code.google.com/p/ddab-lib/issues/detail?id=31) and + * #33 (https://code.google.com/p/ddab-lib/issues/detail?id=33) * * The project also draws on the work of: * @@ -51,8 +59,8 @@ * - Kendall Sullivan for the code on which TPJComputerInfo.IsAdmin is based. * See http://edn.embarcadero.com/article/26752. * - * - norgepaul for the code which TPJComputerInfo.IsUACActive is based. See - * his anser on Stack Overflow at http://tinyurl.com/avlztmg. + * - norgepaul for the code on which TPJComputerInfo.IsUACActive is based. See + * his answer on Stack Overflow at http://tinyurl.com/avlztmg. * * ***** END LICENSE BLOCK ***** } @@ -61,12 +69,15 @@ unit PJSysInfo; +// Define DEBUG whenever debugging. +// *** IMPORTANT: Ensure that DEBUG is NOT defined in production code. +{.$DEFINE DEBUG} + // Define DEBUG_NEW_API if debugging on Windows Vista to Windows 8 in order to // check that the new version API used for Windows 8.1 and later is working. // This will cause the new API to be used for Windows Vista and later instead // of only Windows 8.1 and later. // *** IMPORTANT: Ensure that DEBUG_NEW_API is NOT defined in production code. - {.$DEFINE DEBUG_NEW_API} @@ -118,6 +129,12 @@ {$WARN UNSAFE_CODE OFF} {$ENDIF} +// Switch on range checking when debugging. In production code it's the user's +// choice whether to use range checking or not +{$IFDEF DEBUG} + {$RANGECHECKS ON} +{$ENDIF} + interface @@ -189,7 +206,7 @@ interface // Windows constants possibly not defined in all supported Delphi VCLs - // Conditional consts ued in VerSetConditionMask calls + // Conditional consts used in VerSetConditionMask calls VER_EQUAL = 1; // current value = specified value. VER_GREATER = 2; // current value > specified value. VER_GREATER_EQUAL = 3; // current value >= specified value. @@ -208,17 +225,20 @@ interface VER_PRODUCT_TYPE = $00000080; // Constants from sdkddkver.h - _WIN32_WINNT_NT4 = $0400; // Windows NT 4 - _WIN32_WINNT_WIN2K = $0500; // Windows 2000 - _WIN32_WINNT_WINXP = $0501; // Windows XP - _WIN32_WINNT_WS03 = $0502; // Windows Server 2003 - _WIN32_WINNT_WIN6 = $0600; // Windows Vista - _WIN32_WINNT_VISTA = $0600; // Windows Vista - _WIN32_WINNT_WS08 = $0600; // Windows Server 2008 - _WIN32_WINNT_LONGHORN = $0600; // Windows 7 - _WIN32_WINNT_WIN7 = $0601; // Windows 7 - _WIN32_WINNT_WIN8 = $0602; // Windows 8 - _WIN32_WINNT_WINBLUE = $0603; // Windows 8.1 + _WIN32_WINNT_NT4 = $0400; // Windows NT 4 + _WIN32_WINNT_WIN2K = $0500; // Windows 2000 + _WIN32_WINNT_WINXP = $0501; // Windows XP + _WIN32_WINNT_WS03 = $0502; // Windows Server 2003 + _WIN32_WINNT_WIN6 = $0600; // Windows Vista + _WIN32_WINNT_VISTA = $0600; // Windows Vista + _WIN32_WINNT_WS08 = $0600; // Windows Server 2008 + _WIN32_WINNT_LONGHORN = $0600; // Windows Vista + _WIN32_WINNT_WIN7 = $0601; // Windows 7 + _WIN32_WINNT_WIN8 = $0602; // Windows 8 + _WIN32_WINNT_WINBLUE = $0603; // Windows 8.1 + _WIN32_WINNT_WINTHRESHOLD = $0A00; // Windows 10 + _WIN32_WINNT_WIN10 = $0A00; // Windows 10 + // These Windows-defined constants are required for use with TOSVersionInfoEx // NT Product types @@ -246,7 +266,7 @@ interface // These Windows-defined constants are required for use with the // GetProductInfo API call used with Windows Vista and later - // ** Thanks to Laurent Pierre for providing these defintions. + // ** Thanks to Laurent Pierre for providing these definitions. // ** Additional definitions were obtained from // http://msdn.microsoft.com/en-us/library/ms724358 PRODUCT_BUSINESS = $00000006; @@ -262,6 +282,8 @@ interface 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_N_EVALUATION = $00000054; @@ -288,19 +310,21 @@ interface 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_STANDARD_SERVER = $0000004C; PRODUCT_MULTIPOINT_PREMIUM_SERVER = $0000004D; 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_SB_SOLUTION_SERVER = $00000032; PRODUCT_SMALLBUSINESS_SERVER = $00000009; PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = $00000019; PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = $0000003F; @@ -423,7 +447,10 @@ interface osWin8, // Windows 8 osWinSvr2012, // Windows Server 2012 osWin8Point1, // Windows 8.1 - osWinSvr2012R2 // Windows Server 2012 R2 + osWinSvr2012R2, // Windows Server 2012 R2 + osWin10, // Windows 10 + // TODO: Update following comment to correct name once released + osWin10Svr // Windows 10 Server Technical Preview ); type @@ -570,7 +597,7 @@ TPJOSInfo = class(TObject) /// platform. class function Edition: string; - ///

Returns a full descriptuon of the host OS. + /// Returns a full description of the host OS. class function Description: string; /// Returns the Windows product ID of the host OS. @@ -623,81 +650,102 @@ TPJOSInfo = class(TObject) /// Checks whether the OS is Windows XP or greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsXPOrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows XP Service Pack 1 or greater. /// /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsXPSP1OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows XP Service Pack 2 or greater. /// /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsXPSP2OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows XP Service Pack 3 or greater. /// /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsXPSP3OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows Vista or greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsVistaOrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows Vista Service Pack 1 or /// greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsVistaSP1OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows Vista Service Pack 2 or /// greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindowsVistaSP2OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows 7 or greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindows7OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows 7 Service Pack 1 or greater. /// /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindows7SP1OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows 8 or greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindows8OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} /// Checks whether the OS is Windows 8.1 or greater. /// This method always returns information about the true OS, - /// regardless of any compatibility mode in force. + /// regardless of any compatibility mode in force or whether a suitable + /// manifest file is present. class function IsReallyWindows8Point1OrGreater: Boolean; {$IFDEF INLINEMETHODS}inline;{$ENDIF} + /// Checks whether the OS is Windows 10 or greater. + /// This method always returns information about the true OS, + /// regardless of any compatibility mode in force, but DOES require that + /// the correct manifest file is present. + class function IsReallyWindows10OrGreater: Boolean; + {$IFDEF INLINEMETHODS}inline;{$ENDIF} + /// Checks if the OS is a server version. - /// For Windows 2000 and later the result always relates to the + /// + /// For Windows 2000 and later the result always relates to the /// actual OS, regardless of any compatibility mode in force. For versions /// prior to Windows 2000 this method will take note of compatibility modes - /// and returns the same value as TPJOSInfo.IsServer. + /// and returns the same value as TPJOSInfo.IsServer. + /// WARNING: For Windows 10 this method is likely to succeed only if + /// the application is correctly manifested. class function IsWindowsServer: Boolean; end; @@ -712,7 +760,7 @@ TPJComputerInfo = class(TObject) /// Returns name of currently logged on user. class function UserName: string; - /// Returns MAC address of 1st ethernet adapter on host computer. + /// Returns MAC address of 1st Ethernet adapter on host computer. /// or empty string if no such adapter is found. /// /// **WARNING** may be unreliable - see comments in @@ -909,7 +957,7 @@ implementation resourcestring // Error messages - sUnknownPlatform = 'Unrecognized operating system platform'; + sUnknownPlatform = 'Unrecognised operating system platform'; sUnknownProduct = 'Unrecognised operating system product'; sBadRegType = 'Unsupported registry type'; sBadProcHandle = 'Bad process handle'; @@ -928,56 +976,64 @@ implementation // ** Laurent Pierre supplied original code on which this map is based // It has been modified and extended using MSDN documentation at // http://msdn.microsoft.com/en-us/library/ms724358 - cProductMap: array[1..83] of record + cProductMap: array[1..87] of record Id: Cardinal; // product ID Name: string; // product name end = ( (Id: PRODUCT_BUSINESS; Name: 'Business';), (Id: PRODUCT_BUSINESS_N; - Name: 'Business N Edition';), + Name: 'Business N';), (Id: PRODUCT_CLUSTER_SERVER; - Name: 'Cluster Server Edition';), + Name: 'Cluster Server / HPC';), (Id: PRODUCT_CLUSTER_SERVER_V; Name: 'Server Hyper Core V';), (Id: PRODUCT_CORE; - Name: 'Windows 8';), + Name: 'Core / Home';), (Id: PRODUCT_CORE_N; - Name: 'Windows 8N';), + Name: 'Core N or Home N';), (Id: PRODUCT_CORE_COUNTRYSPECIFIC; - Name: 'Windows 8 China';), + Name: 'Core / Home China';), (Id: PRODUCT_CORE_SINGLELANGUAGE; - Name: 'Windows 8 Single Language';), + Name: 'Core / Home Single Language';), + (Id: PRODUCT_MOBILE_CORE; + Name: 'Mobile'), + (Id: PRODUCT_MOBILE_ENTERPRISE; + Name: 'Mobile Enterprise'), + (Id: PRODUCT_EDUCATION; + Name: 'Education'), + (Id: PRODUCT_EDUCATION_N; + Name: 'Education N'), (Id: PRODUCT_DATACENTER_EVALUATION_SERVER; Name: 'Server Datacenter (evaluation installation)';), (Id: PRODUCT_DATACENTER_SERVER; - Name: 'Server Datacenter Edition (full installation)';), + Name: 'Server Datacenter (full installation)';), (Id: PRODUCT_DATACENTER_SERVER_CORE; - Name: 'Server Datacenter Edition (core installation)';), + Name: 'Server Datacenter (core installation)';), (Id: PRODUCT_DATACENTER_SERVER_CORE_V; - Name: 'Server Datacenter Edition without Hyper-V (core installation)';), + Name: 'Server Datacenter without Hyper-V (core installation)';), (Id: PRODUCT_DATACENTER_SERVER_V; - Name: 'Server Datacenter Edition without Hyper-V (full installation)';), + Name: 'Server Datacenter without Hyper-V (full installation)';), (Id: PRODUCT_ENTERPRISE; - Name: 'Enterprise Edition';), + Name: 'Enterprise';), (Id: PRODUCT_ENTERPRISE_E; - Name: 'Enterprise E Edition';), + Name: 'Enterprise E';), (Id: PRODUCT_ENTERPRISE_N_EVALUATION; Name: 'Enterprise N (evaluation installation)';), (Id: PRODUCT_ENTERPRISE_N; - Name: 'Enterprise N Edition';), + Name: 'Enterprise N';), (Id: PRODUCT_ENTERPRISE_EVALUATION; Name: 'Server Enterprise (evaluation installation)';), (Id: PRODUCT_ENTERPRISE_SERVER; - Name: 'Server Enterprise Edition (full installation)';), + Name: 'Server Enterprise (full installation)';), (Id: PRODUCT_ENTERPRISE_SERVER_CORE; - Name: 'Server Enterprise Edition (core installation)';), + Name: 'Server Enterprise (core installation)';), (Id: PRODUCT_ENTERPRISE_SERVER_CORE_V; - Name: 'Server Enterprise Edition without Hyper-V (core installation)';), + Name: 'Server Enterprise without Hyper-V (core installation)';), (Id: PRODUCT_ENTERPRISE_SERVER_IA64; - Name: 'Server Enterprise Edition for Itanium-based Systems';), + Name: 'Server Enterprise for Itanium-based Systems';), (Id: PRODUCT_ENTERPRISE_SERVER_V; - Name: 'Server Enterprise Edition without Hyper-V (full installation)';), + Name: 'Server Enterprise without Hyper-V (full installation)';), (Id: PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT; Name: 'Windows Essential Server Solution Management'), (Id: PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL; @@ -987,39 +1043,39 @@ implementation (Id: PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC; Name: 'Windows Essential Server Solution Additional SVC'), (Id: PRODUCT_HOME_BASIC; - Name: 'Home Basic Edition';), + Name: 'Home Basic';), (Id: PRODUCT_HOME_BASIC_E; - Name: 'Home Basic E Edition';), + Name: 'Home Basic E';), (Id: PRODUCT_HOME_BASIC_N; - Name: 'Home Basic N Edition';), + Name: 'Home Basic N';), (Id: PRODUCT_HOME_PREMIUM; - Name: 'Home Premium Edition';), + Name: 'Home Premium';), (Id: PRODUCT_HOME_PREMIUM_E; - Name: 'Home Premium E Edition';), + Name: 'Home Premium E';), (Id: PRODUCT_HOME_PREMIUM_N; - Name: 'Home Premium N Edition';), + Name: 'Home Premium N';), (Id: PRODUCT_HOME_PREMIUM_SERVER; - Name: 'Windows Home Server 2011';), + Name: 'Home Server';), (Id: PRODUCT_HOME_SERVER; - Name: 'Home Server Edition';), + Name: 'Home Storage Server';), (Id: PRODUCT_HYPERV; - Name: 'Microsoft Hyper-V Server'), + Name: 'Hyper-V Server'), (Id: PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT; - Name: 'Windows Essential Business Server Management Server';), + Name: 'Essential Business Server Management Server';), (Id: PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING; - Name: 'Windows Essential Business Server Messaging Server';), + Name: 'Essential Business Server Messaging Server';), (Id: PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY; - Name: 'Windows Essential Business Server Security Server';), + Name: 'Essential Business Server Security Server';), (Id: PRODUCT_MULTIPOINT_STANDARD_SERVER; - Name: 'Windows MultiPoint Server Standard (full installation)';), + Name: 'MultiPoint Server Standard (full installation)';), (Id: PRODUCT_MULTIPOINT_PREMIUM_SERVER; - Name: 'Windows MultiPoint Server Premium (full installation)';), + Name: 'MultiPoint Server Premium (full installation)';), (Id: PRODUCT_PROFESSIONAL; - Name: 'Professional Edition';), + Name: 'Professional';), (Id: PRODUCT_PROFESSIONAL_E; - Name: 'Professional E Edition';), + Name: 'Professional E';), (Id: PRODUCT_PROFESSIONAL_N; - Name: 'Professional N Edition';), + Name: 'Professional N';), (Id: PRODUCT_PROFESSIONAL_WMC; Name: 'Professional with Media Center';), (Id: PRODUCT_SB_SOLUTION_SERVER_EM; @@ -1029,18 +1085,17 @@ implementation (Id: PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM; Name: 'Server For SB Solutions EM';), (Id: PRODUCT_SERVER_FOR_SMALLBUSINESS; - Name: 'Server for Small Business Edition';), + Name: 'Server for Essential Server Solutions';), (Id: PRODUCT_SERVER_FOR_SMALLBUSINESS_V; - Name: 'Windows Server 2008 without Hyper-V for Windows Essential Server ' - + 'Solutions';), + Name: 'Server 2008 without Hyper-V for Essential Server Solutions';), (Id: PRODUCT_SERVER_FOUNDATION; Name: 'Server Foundation';), (Id: PRODUCT_SB_SOLUTION_SERVER; - Name: 'Windows Small Business Server 2011 Essentials';), + Name: 'Small Business Server Essentials';), (Id: PRODUCT_SMALLBUSINESS_SERVER; Name: 'Small Business Server';), (Id: PRODUCT_SMALLBUSINESS_SERVER_PREMIUM; - Name: 'Small Business Server Premium Edition';), + Name: 'Small Business Server Premium';), (Id: PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE; Name: 'Small Business Server Premium (core installation)';), (Id: PRODUCT_SOLUTION_EMBEDDEDSERVER; @@ -1048,55 +1103,55 @@ implementation (Id: PRODUCT_STANDARD_EVALUATION_SERVER; Name: 'Server Standard (evaluation installation)';), (Id: PRODUCT_STANDARD_SERVER; - Name: 'Server Standard Edition (full installation)';), + Name: 'Server Standard';), (Id: PRODUCT_STANDARD_SERVER_CORE; - Name: 'Server Standard Edition (core installation)';), + Name: 'Server Standard (core installation)';), (Id: PRODUCT_STANDARD_SERVER_CORE_V; - Name: 'Server Standard Edition without Hyper-V (core installation)';), + Name: 'Server Standard without Hyper-V (core installation)';), (Id: PRODUCT_STANDARD_SERVER_V; - Name: 'Server Standard Edition without Hyper-V (full installation)';), + Name: 'Server Standard without Hyper-V (full installation)';), (Id: PRODUCT_STANDARD_SERVER_SOLUTIONS; Name: 'Server Solutions Premium';), (Id: PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE; Name: 'Server Solutions Premium (core installation)';), (Id: PRODUCT_STARTER; - Name: 'Starter Edition';), + Name: 'Starter';), (Id: PRODUCT_STARTER_E; - Name: 'Starter E Edition';), + Name: 'Starter E';), (Id: PRODUCT_STARTER_N; - Name: 'Starter N Edition';), + Name: 'Starter N';), (Id: PRODUCT_STORAGE_ENTERPRISE_SERVER; - Name: 'Storage Server Enterprise Edition';), + Name: 'Storage Server Enterprise';), (Id: PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE; Name: 'Storage Server Enterprise (core installation)';), (Id: PRODUCT_STORAGE_EXPRESS_SERVER; - Name: 'Storage Server Express Edition';), + Name: 'Storage Server Express';), (Id: PRODUCT_STORAGE_EXPRESS_SERVER_CORE; Name: 'Storage Server Express (core installation)';), (Id: PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER; Name: 'Storage Server Standard (evaluation installation)';), (Id: PRODUCT_STORAGE_STANDARD_SERVER; - Name: 'Storage Server Standard Edition';), + Name: 'Storage Server Standard';), (Id: PRODUCT_STORAGE_STANDARD_SERVER_CORE; Name: 'Storage Server Standard (core installation)';), (Id: PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER; Name: 'Storage Server Workgroup (evaluation installation)';), (Id: PRODUCT_STORAGE_WORKGROUP_SERVER; - Name: 'Storage Server Workgroup Edition';), + Name: 'Storage Server Workgroup';), (Id: PRODUCT_STORAGE_WORKGROUP_SERVER_CORE; Name: 'Storage Server Workgroup (core installation)';), (Id: PRODUCT_UNDEFINED; Name: 'An unknown product';), (Id: PRODUCT_ULTIMATE; - Name: 'Ultimate Edition';), + Name: 'Ultimate';), (Id: PRODUCT_ULTIMATE_E; - Name: 'Ultimate E Edition';), + Name: 'Ultimate E';), (Id: PRODUCT_ULTIMATE_N; - Name: 'Ultimate N Edition';), + Name: 'Ultimate N';), (Id: PRODUCT_WEB_SERVER; - Name: 'Web Server Edition';), + Name: 'Web Server (full installation)';), (Id: PRODUCT_WEB_SERVER_CORE; - Name: 'Web Server Edition (core installation)';), + Name: 'Web Server (core installation)';), (Id: Cardinal(PRODUCT_UNLICENSED); Name: 'Unlicensed product';) ); @@ -1137,8 +1192,8 @@ implementation // Internal variables recording version information. // When using the GetVersionEx API function to get version information these // variables have the same value as the similarly named Win32XXX function in - // SysUtils. When the old API funtion aren't being used these value *may* vary - // from the SysUtils versions. + // SysUtils. When the old API function aren't being used these value *may* + // vary from the SysUtils versions. InternalPlatform: Integer = 0; InternalMajorVersion: LongWord = 0; InternalMinorVersion: LongWord = 0; @@ -1201,7 +1256,7 @@ function TestWindowsVersion(wMajorVersion, wMinorVersion, end; // Checks if the OS has the given product type. -// Assumes VerifyVersionInfo API function is available +// Assumes VerifyVersionInfo and VerSetConditionMask API functions are available function IsWindowsProductType(ProductType: Byte): Boolean; var ConditionalMask: UInt64; @@ -1224,25 +1279,26 @@ function UseGetVersionAPI: Boolean; // given major and minor version numbers function TestOSLT(Major, Minor: LongWord): Boolean; begin - Result := Assigned(VerSetConditionMask) and Assigned(VerifyVersionInfo) - and TestWindowsVersion(Major, Minor, 0, 0, VER_LESS); + Result := not Assigned(VerSetConditionMask) + or not Assigned(VerifyVersionInfo) + or TestWindowsVersion(Major, Minor, 0, 0, VER_LESS); end; begin {$IFNDEF DEBUG_NEW_API} - // Production code uses GetVersionEx if OS earlier than Windows 8.1 - Result := TestOSLT(6, 3); + // Production code uses GetVersionEx if OS earlier than Windows 8.0 + Result := TestOSLT(6, 2); {$ELSE} // Debug code uses GetVersionEx if OS earlier than Windows Vista Result := TestOSLT(6, 0); {$ENDIF} end; -// Gets Windows version by probing for possible versions using +// Gets Windows version by probing for possible versions procedure NewGetVersion(out Major, Minor: LongWord; out SPMajor, SPMinor: Word); begin Major := 6; // lowest version to use this code has major version 6 - Minor := High(LongWord); + Minor := High(Word); SPMajor := High(Word); SPMinor := High(Word); while TestWindowsVersion(Major, Minor, SPMajor, SPMinor, VER_GREATER) do @@ -1310,7 +1366,7 @@ function IsWin2000OrEarlier: Boolean; function RegCreate: TRegistry; begin {$IFDEF REGACCESSFLAGS} - //! Fix for issue #14 (http://bit.ly/eWkw9X) suggested by Steffen Schaff. + //! Fix for issue #14 (http://bit.n/eWkw9X) suggested by Steffen Schaff. //! Later modified to allow for fact that Windows 2000 fails if //! KEY_WOW64_64KEY is used. if IsWin2000OrEarlier then @@ -1429,7 +1485,6 @@ procedure InitPlatformIdEx; {$ELSE} VerifyVersionInfo := LoadKernelFunc('VerifyVersionInfoA'); {$ENDIF} - if not UseGetVersionAPI then begin // Not using GetVersion and GetVersionEx functions to get version info @@ -1474,8 +1529,21 @@ procedure InitPlatformIdEx; 3: if Win32ServicePackMajor = 0 then InternalBuildNumber := 9600; // Windows 8.1 (no known SPs) + end; - end + end; + 10: + begin + case InternalMinorVersion of + 0: + begin + // TODO: Revist when server version released to check if same build + // number + if Win32ServicePackMajor = 0 then + InternalBuildNumber := 10240; // Windows 10 (no known SPs) + end; + end; + end; end; // Failed to "guess" at build number: get it from registry if InternalBuildNumber = 0 then @@ -1570,7 +1638,7 @@ class function TPJOSInfo.CheckSuite(const Suite: Integer): Boolean; class function TPJOSInfo.Description: string; - // Adds a non-empty string to end of result, preceeded by space. + // Adds a non-empty string to end of result, preceded by space. procedure AppendToResult(const Str: string); begin if Str <> '' then @@ -1615,7 +1683,8 @@ class function TPJOSInfo.Edition: string; osWinVista, osWinSvr2008, osWin7, osWinSvr2008R2, osWin8, osWinSvr2012, - osWin8Point1, osWinSvr2012R2: + osWin8Point1, osWinSvr2012R2, + osWin10, osWin10Svr: begin // For v6.0 and later we ignore the suite mask and use the new // PRODUCT_ flags from the GetProductInfo() function to determine the @@ -1877,6 +1946,13 @@ class function TPJOSInfo.IsReallyWindows8Point1OrGreater: Boolean; ); end; +class function TPJOSInfo.IsReallyWindows10OrGreater: Boolean; +begin + Result := IsReallyWindowsVersionOrGreater( + HiByte(_WIN32_WINNT_WIN10), LoByte(_WIN32_WINNT_WIN10), 0 + ); +end; + class function TPJOSInfo.IsReallyWindowsVersionOrGreater(MajorVersion, MinorVersion, ServicePackMajor: Word): Boolean; begin @@ -1945,9 +2021,13 @@ class function TPJOSInfo.IsRemoteSession: Boolean; class function TPJOSInfo.IsServer: Boolean; begin - if Win32HaveExInfo then + if InternalPlatform <> VER_PLATFORM_WIN32_NT then + // Not WinNT platform => can't be a server + Result := False + else if Win32HaveExInfo then // Check product type from extended OS info - Result := Win32ProductType <> VER_NT_WORKSTATION + Result := (Win32ProductType = VER_NT_DOMAIN_CONTROLLER) + or (Win32ProductType = VER_NT_SERVER) else // Check product type stored in registry Result := CompareText(ProductTypeFromReg, 'WINNT') <> 0;; @@ -2111,9 +2191,9 @@ class function TPJOSInfo.Product: TPJOSProduct; 3: // NOTE: Version 6.3 may only be reported by Windows if the // application is "manifested" for Windows 8.1. See - // http://bit.ly/MJSO8Q. I'm not clear whether getting the OS - // via VerifyVersionInfo instead of GetVersion or GetVersionEx - // works round this + // http://bit.ly/MJSO8Q. Getting the OS via VerifyVersionInfo + // instead of GetVersion or GetVersionEx should work round this + // for Windows 8.1 (i.e. version 6.3). if not IsServer then Result := osWin8Point1 else @@ -2123,6 +2203,22 @@ class function TPJOSInfo.Product: TPJOSProduct; Result := osWinLater end; end; + 10: + begin + // NOTE: Version 10 and later may only be reported by Windows if the + // application is "manifested" for the correct Windows version. See + // http://bit.ly/MJSO8Q. Previously, getting the OS from + // VerifyVersionInfo instead of GetVersion or GetVersionEx worked + // round this, but MS deprecated this in Windows 10, reverting + // VerifyVersionInfo to work like GetVersion. WHY????!!!! + case InternalMinorVersion of + 0: + if not IsServer then + Result := osWin10 + else + Result := osWin10Svr; + end; + end; else // Higher major version: must be an unknown later OS Result := osWinLater; @@ -2164,6 +2260,9 @@ class function TPJOSInfo.ProductName: string; osWinSvr2012: Result := 'Windows Server 2012'; osWin8Point1: Result := 'Windows 8.1'; osWinSvr2012R2: Result := 'Windows Server 2012 R2'; + osWin10: Result := 'Windows 10'; + // TODO: Update osWin10Svr description once OS is released and named + osWin10Svr: Result := 'Windows Server Technical Preview'; else raise EPJSysInfo.Create(sUnknownProduct); end; diff --git a/Src/Help/HTML/license.htm b/Src/Help/HTML/license.htm index 06382db40..ee41afff2 100644 --- a/Src/Help/HTML/license.htm +++ b/Src/Help/HTML/license.htm @@ -4,7 +4,7 @@ * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at http://mozilla.org/MPL/2.0/ * - * Copyright (C) 2012-2014, Peter Johnson (www.delphidabbler.com). + * Copyright (C) 2012-2015, Peter Johnson (www.delphidabbler.com). * * $Rev$ * $Date$ @@ -30,7 +30,7 @@

Summary of End User License Agreement

- DelphiDabbler CodeSnip is copyright © 2005-2014 by Peter D + DelphiDabbler CodeSnip is copyright © 2005-2015 by Peter D Johnson, KYjsf+dU$OwAQcCz~)T$X3UsWv1q&RL5w=q~)Y!<`tJzdqf7f2KjjUc`HmVWR&1l zsI3Jm%1J3I&MBz|iEzf0<`~2zry0~v-o{uG2OGJ!h` MC8jvh(9k$0CowPG(7@O@Ce0uwt=Q0F;uST8G{cxuLo-Wz zpqPS!k%57!u91NuSf!DHskws5WI;xS$wrJaj7pRJ7$roMYHNY6$Vn+G&MB#mDb0yV wPBWbB%P2W{3S%u)nI4k@c4fLuikn-QSeV2??f{t%bcB%!$br0EwY*#m0CEjR2mk;8 diff --git a/Src/Res/HTML/dlg-about-program-tplt.html b/Src/Res/HTML/dlg-about-program-tplt.html index 9808d188c..17d3e2ac7 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 http://mozilla.org/MPL/2.0/ * - * Copyright (C) 2005-2014, Peter Johnson (www.delphidabbler.com). + * Copyright (C) 2005-2015, Peter Johnson (www.delphidabbler.com). * * $Rev$ * $Date$ @@ -50,7 +50,7 @@

- DelphiDabbler CodeSnip is copyright © 2005-2014 by Peter D + DelphiDabbler CodeSnip is copyright © 2005-2015 by Peter D Johnson, - + + processorArchitecture="*" + /> - + - + - + + + + + + + - + diff --git a/Src/UFontHelper.pas b/Src/UFontHelper.pas index 331bc93d5..7e8f7e556 100644 --- a/Src/UFontHelper.pas +++ b/Src/UFontHelper.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 http://mozilla.org/MPL/2.0/ * - * Copyright (C) 2006-2014, Peter Johnson (www.delphidabbler.com). + * Copyright (C) 2006-2015, Peter Johnson (www.delphidabbler.com). * * $Rev$ * $Date$ @@ -80,25 +80,21 @@ TFontHelper = class(TNoConstructObject) } strict private const - DefaultFontName = 'Arial'; // Default font name - DefaultFontSize = 8; // Default font size + FallbackFontName = 'Arial'; // Fallback font name + FallbackFontSize = 8; // Fallback font size - DefaultContentFontName = DefaultFontName; // Default content font name - DefaultContentFontSize = DefaultFontSize; // Default content font size + VistaFontName = 'Segoe UI'; // Vista default font name + VistaFontSize = 9; // Vista default font size + VistaContentFontName = 'Calibri'; // Vista content font name + VistaContentFontSize = 10; // Vista content font size - VistaFontName = 'Segoe UI'; // Vista default font name - VistaFontSize = 9; // Vista default font size - VistaContentFontName = 'Calibri'; // Vista content font name - VistaContentFontSize = 10; // Vista content font size + XPFontName = 'Tahoma'; // XP default font name + XPFontSize = FallbackFontSize; // XP default font size + XPContentFontName = 'Verdana'; // XP content font name + XPContentFontSize = FallbackFontSize; // XP content font size - XPFontName = 'Tahoma'; // XP default font name - XPFontSize = DefaultFontSize; // XP default font size - XPContentFontName = 'Verdana'; // XP content font name - XPContentFontSize // XP content font size - = DefaultContentFontSize; - - DefaultMonoFontName = 'Courier New'; // Default mono font name - DefaultMonoFontSize = 8; // Default mono font size + DefaultMonoFontName = 'Courier New'; // Default mono font name + DefaultMonoFontSize = 8; // Default mono font size end; @@ -109,7 +105,7 @@ implementation // Delphi SysUtils, Windows, Forms, // Project - UGraphicUtils, UStrUtils, USystemInfo; + UGraphicUtils, UStrUtils; { TFontHelper } @@ -193,28 +189,25 @@ class procedure TFontHelper.SetContentFont(const Font: TFont); @param Font [in] Font to be set. } begin - // Set default content font, size and style - Font.Name := DefaultContentFontName; - Font.Size := DefaultContentFontSize; - Font.Style := []; - if TOSInfo.IsReallyWindowsVistaOrGreater then + // Try Vista & later content font. If that fails try XP/Win2k font. One of the + // two should always work, but in case fonts have been uninstalled, use a + // fallback font. + if FontExists(VistaContentFontName) then begin - // We have Vista or later - use Calibri if installed - if FontExists(VistaContentFontName) then - begin - Font.Name := VistaContentFontName; - Font.Size := VistaContentFontSize; - end; + Font.Name := VistaContentFontName; + Font.Size := VistaContentFontSize; + end + else if FontExists(XPContentFontName) then + begin + Font.Name := XPContentFontName; + Font.Size := XPContentFontSize; end else begin - // Earlier OS than Vista (i.e. 2000 or XP) - if FontExists(XPContentFontName) then - begin - Font.Name := XPContentFontName; - Font.Size := XPContentFontSize; - end; + Font.Name := FallbackFontName; + Font.Size := FallbackFontSize; end; + Font.Style := []; end; class procedure TFontHelper.SetDefaultBaseFont(const BaseFont: TFont); @@ -233,7 +226,7 @@ class procedure TFontHelper.SetDefaultBaseFont(const BaseFont: TFont); SetDefaultFont(DefaultFont); // font delta is difference between normal default font size and that used // on a specific OS (e.g. Vista uses Segoe UI 9 rather than MS Sans Serif 8) - FontDelta := DefaultFont.Size - DefaultFontSize; + FontDelta := DefaultFont.Size - FallbackFontSize; // change base font name and size as required BaseFont.Name := DefaultFont.Name; BaseFont.Size := BaseFont.Size + FontDelta; @@ -255,28 +248,25 @@ class procedure TFontHelper.SetDefaultFont(const Font: TFont); @param Font [in] Font to be set. } begin - // Set default font, size and style - Font.Name := DefaultFontName; - Font.Size := DefaultFontSize; - Font.Style := []; - if TOSInfo.IsReallyWindowsVistaOrGreater then + // Try Vista & later default font. If that fails try XP/Win2k font. One of the + // two should always work, but in case fonts have been uninstalled, use a + // fallback font. + if FontExists(VistaFontName) then + begin + Font.Name := VistaFontName; + Font.Size := VistaFontSize; + end + else if FontExists(XPFontName) then begin - // Vista or later - if FontExists(VistaFontName) then - begin - Font.Name := VistaFontName; - Font.Size := VistaFontSize; - end; + Font.Name := XPFontName; + Font.Size := XPFontSize; end else begin - // Earlier OS than Vista (i.e. 2000 or XP) - if FontExists(XPFontName) then - begin - Font.Name := XPFontName; - Font.Size := XPFontSize; - end; + Font.Name := FallbackFontName; + Font.Size := FallbackFontSize; end; + Font.Style := []; end; class procedure TFontHelper.SetDefaultFonts(const Fonts: array of TFont); diff --git a/Src/VCodeSnip.vi b/Src/VCodeSnip.vi index 7a21d0ad7..451c82835 100644 --- a/Src/VCodeSnip.vi +++ b/Src/VCodeSnip.vi @@ -11,8 +11,8 @@ [Fixed File Info] -File Version #=4, 13, 0, 251 -Product Version #=4, 13, 0, 0 +File Version #=4, 13, 1, 252 +Product Version #=4, 13, 1, 0 File OS=4 File Type=1 File Sub-Type=0 diff --git a/Src/VCodeSnipPortable.vi b/Src/VCodeSnipPortable.vi index cfe5e2139..f9fc7da6b 100644 --- a/Src/VCodeSnipPortable.vi +++ b/Src/VCodeSnipPortable.vi @@ -11,8 +11,8 @@ [Fixed File Info] -File Version #=4, 13, 0, 251 -Product Version #=4, 13, 0, 0 +File Version #=4, 13, 1, 252 +Product Version #=4, 13, 1, 0 File OS=4 File Type=1 File Sub-Type=0