Fixes in ChemFinder Version Scheme

Jim Dill  26-27 Mar 02


Former version of this document


The version scheme in ChemFinder is messy and spread out, and displays the wrong information to the user.  A bug to this effect is filed (CSBR-27634).  We'll take a couple of screenfuls here to design a new scheme, and then implement it in 7.0.3.


Raw Data

Version information comes from three places:

1. iolib\releasedefs.h -- build-specific data for all ChemFinder apps.  The actual values listed here are not the same as the current ones (which show 7.0.3).

#define current value
ChemFinderVersBuild   456
ChemFinderVersion 7.0.2 d456
ChemFinderVersDate  CTime(2002, 3, 25, 0, 0, 0)
ChemFinderVersMajor 7
ChemFinderVersMinor 0
ChemFinderVersBug 2
ChemOfficeRegCodeVersion k70(common/register.h)

The first three items are generated automatically by build machinery (see SourceSafe $/Winbuild /winbuild7a /chemfinder70 /vb /IncrementChemFinderBuildNumbers.vbp).  Each build increments the numeric parts, inserts today's date, saves and commits a new version of releasedefs.h.

To "flip the beta switch" just before release, remove the "d<buildnumber>" from the ChemFinderVersion string.

2. src\<appdir>\appdefs.h -- app-specific data describing the exe or dll.  

#define

value

comments
AppIntlname "ChemFinder"  simple name used to identify Registry location
AppProductName   "ChemFinder Pro/Ultra"  product name plus level if any
AppDescription   "ChemFinder Pro/Ultra"  any string, for version resource
AppFilename   "cfw.exe"  exe or dll name, for version resource

These are the values currently defined in the various appdefs.h files:

src dir AppIntlname AppProductName  AppDescription  AppFilename  
\cfw ChemFinder ChemFinder Pro/Ultra (1) ChemFinder Pro/Ultra (1) cfw.exe
\como CFWord ChemFinder for Word ChemFinder for Word cfword.exe
\comoshell ComoShell ChemFinder for Word Shell ChemFinder for Word Shell Integration DLL comoshell.dll
\cfxl CFXLLib ChemDraw for Excel ChemDraw for Excel Library DLL cfxllib.dll
\csmol CSMol CSMol Control CSMol ActiveX Control Module csmol.ocx
\molserver MolServer MolServer MolServer Structure Engine DLL (2) molserver.dll (2)
  1. Or ChemFinder Net, depending on #define
  2. Different for molserver.exe

3. Registry -- specifies program level.  This reveals a hidden feature of ChemFinder: we don't really have Pro vs. Ultra versions.  There is only one version, which uses a Registry setting to decide what to call itself.  The way we deal with the Registry is described below.


User-Visible Data

This information is presented to the user through two vehicles:

iolib\iolib.rc VERSIONINFO resource -- MS-prescribed data displayed in the Explorer File Properties dialog (Version tab).  Only predefined strings may be included; to include a date or other computed info in this resource, it is necessary to modify the build machinery.

value name string value sample
CompanyName literal CambridgeSoft Corp.
FileDescription AppDescription + ChemFinderVersion ChemFinder Pro/Ultra 7.0.2 d456
FileVersion ChemFinderVersion  7.0.2 d456
InternalName AppIntlname ChemFinder
LegalCopyright literal © 1996-2002, CambridgeSoft Corp.
LegalTrademarks AppProductName + literal ChemFinder Pro/Ultraź is a registered trademark...
OriginalFilename   AppFilename cfw.exe
ProductName AppProductName ChemFinder Pro/Ultra
ProductVersion ChemFinderVersion  7.0.2 d456

CVersion object (iolib\version.h, common\appinfo.h)-- object created at runtime in each app, providing a full API to the version info.  Grey lines are methods in 7.0.2 as of yesterday, to be ripped out tomorrow.

method returns used by sample
ProgramName AppIntlname cfwapp, testsuite, oamenu ChemFinder
ProgramLevel Net, Pro   Pro
DisplayLevel Net, Pro, Ultra, Author   Ultra
ProgramVersion ChemFinderVersion  testsuite, reg_cfw 7.0.2 d456
AppAndLevel ProgramName + DisplayLevel   ChemFinder Ultra
ProductName AppAndLevel + ProgramVersion splash, cfaboutbox ChemFinder Ultra 7.0.2 d456
int OfficeVersion ChemOfficeRegCodeVersion reg_cfw k70
int MajorNumber ChemFinderVersMajor cfwconfig, oamenu 7
int MinorNumber ChemFinderVersMinor   0
int BugNumber ChemFinderVersBug   2
int BuildNumber ChemFinderVersBuild   456
ProgramDate ChemFinderVersDate as string Format("%x") cfaboutbox, reg_cfw March 20, 2002
VerAndDate ProgramVersion + ProgramDate cfaboutbox, splash 7.0.2 d456 (March 20, 2002)
bool IsDemoVer true if #def DEMO everywhere  
UserName (data from Registry) cfaboutbox jdd
CompanyName (data from Registry) cfaboutbox CambridgeSoft
long SerialNumber (data from Registry) cfaboutbox 1
long Checksum (data from Registry) cfaboutbox  
ChangeLevelString   cfwapp  
ProgNameForRegistration ProgramName + ProgramLevel + MajorNumber + MinorNumber reg_cfw ChemFinder Pro 7.0
GetRegistrySetting   cfwapp, globals, ms\ app_utils  
WriteRegistrySetting   globals  
GetRegistryKeyAndProfileName key: "CambridgeSoft", profile: ProgramName + MajorNumber + MinorNumber + ProgramLevel cfwapp, ms\ molsvrdll, cxsearchinfo ChemFinder \7.0\Pro
WindowsRegistrationKeyName Software\ <key>\ <profile>\ reg reg_cfw, ms\ cxsearchinfo Software \CambridgeSoft \ChemFinder\7.0 \Pro\reg
obsolete methods      
SplashVer AppIntlname + ProgramLevel + ChemFinderVersion splash, cfaboutbox ChemFinder Ultra 7.0.2d456
App      
Level      
OfficeVersion      
GetLevelString      
ToolbarStateKeyName "Control Bars-60"    
ToolbarKeyName "Tools-60"    
OneLineDescription   testsuite  
GetLevelOverrideString      
AboutTitle      
ChangeLevel      
string ProgramLevel_Real      
string ProgramLevel_Pretty      

Registry 

Our Registry scheme works as follows.  

  1. The installer creates keys under Software\CambridgeSoft in either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER, depending on the user's choice at install time.  
  2. When ChemFinder starts, it constructs a CVersion object, which looks for a key called EXPDATE in this location:
HKEY_CURRENT_USER\ try here first
Software\ hard-coded
CambridgeSoft\ from WindowsRegistrationKeyName()
ChemFinder\ ProgramName()
7.0\ MajorNumber().MinorNumber()
Pro\ ProgramLevel()
reg hard-coded
  1. If the key is not found, look in HKLM instead.
  2. If we're doing this from a different component (say, ChemFinder for Word), first try looking under level Ultra, then if not found, try Pro.
  3. From the identified key, load the CS registration info: username, company, serial number, regcode checksum.
  4. For all other program settings, use HKCU (via CWinApp::SetRegistryKey).
  5. Look for a key called "Level" under both HKCU and HKLM.  If found, this overrides the program level with a string to be displayed instead.  That is, there is only one cfw.exe; by default this is considered ChemFinder Pro, but can be overridden by this string to say Ultra (or ECatalog, or whatever).
  6. Check to see whether user is correctly registered.  Do this by making a checksum involving username, company, serial number, and the results of ProgNameForRegistration().  Compare that against the stored checksum; if no match, user is presented with the registration dialog.

Commit 3/28/02

Implementation of the above plan was committed 3/28, with the following changes:

.\cfw\appdefs.h  standardized; prog name includes level
.\cfw\cfw.rc  updated menu text, removed "Pro"
.\cfw\cfwapp.cpp  ensure correct m_pszAppName
.\iolib\iolib.rc2  correct data for resource; ver => 7.0.3
.\iolib\releasedefs.h simplified, corrected version string
.\iolib\version.cpp  revamped
.\iolib\version.h  revamped
.\cfxl\appdefs.h  standardized
.\como\appdefs.h    "
.\comoshell\appdefs.h   "
.\csmol\appdefs.h    "
.\molserver\appdefs.h   "
.\cfw\splash.cpp  changed calls to CVersion
.\cfw\oamenu.cpp    "
.\cfw\testsuite.cpp    "
.\iolib\cfaboutbox.cpp   "
.\iolib\reg_cfw.cpp    "
Unrelated to version scheme
.\dblib\dynset.cpp  add dbSeeChanges for SQL Server
.\mstlib\hitlist.cpp add Subset method for later use
.\mstlib\hitlist.h  add Subset method for later use
.\utillib\strings.cpp add SetSize to StrMatrix for later use
.\utillib\strings.h  add SetSize to StrMatrix for later use

Testing

  1. Bring up File Properties on cfw.exe from Windows Explorer.  Make sure all the info is correct.  (This would apply to other apps too --- cfword, cd excel, molserver, csmol, comoshell --- except they are not being built for this release.)
  2. Drop cfw.exe on top of the installed 7.0.1 version, then start it up.  Make sure it does not prompt for registration info, and that all the prefs and settings are the same as they were for 7.0.1.
  3. Check splash screen and about box.

[ ChemFinder home ]