e-License: e-Handling of software licenses and updates

PCID

The very first time, before any communication takes place between local PC and web server, all communicating programs examine if a PCID exists in local computer for the web server(s) registered with program_name(s). If not, communicating programs request a PCID for each registered web server. PCID is then being used on every communication.

PCID save position:
HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas\iUpdate\[host]\PCID=string

The program path to be used for registration (for the current version it is the service executable) can be found in
HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas\iUpdate\Location

There are 2 polling periods used by the service. The first is for when the server is checked for newer versions, has default value of 24 hours, and can be changed from HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas\iUpdate\Polling period.
The second is for when the service will check if BITS jobs are completed, has default value of 5 minutes, and can be changed from
HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas\iUpdate\BITS Polling period
Both values must be string representations of the values in milliseconds, and they are checked during the start of the service.

Query url:
http[s]://host_name[:port]/myweb/iupdate.php?f=getpcid

Server returns:
PCID=program name
or
error description (multiple lines).

iUpdate service

iUpdate add program_name current_version file.ini
or
iUpdate update program new_version
or
iUpdate remove program
Examples:
iUpdate add ishop 2.6.5.1 f1.ini
iUpdate add taxspooler 3.2.1.0 f2.ini
iUpdate update taxspooler 3.2.1.1
iUpdate remove taxspooler

file.ini should be in windows-1253 (GR ELOT928) encoding and contains:
[Ftp]
Host=host name[:port] 
SSL=[0/1]
SN=serial_number
LocalPath=absolute_path_where_the_application_is_installed (this gives value to variable %PROG)

When iUpdate add is run a check for PCID is run immediately.

Data is logged into CSIDL_COMMON_APPDATA\INCA Hellas\iUpdate.xml, i.e. C:\Documents and Settings\All Users\Application Data\INCA Hellas\iUpdate.xml

Service examines if a newer EXE version is available, by querying the web server with [program_name] [current_version] and PCID.

If yes, adds installation exe in named BITS job If job does not already exists), e.g. ishopinst.exe in ishop job. If job creation fails, schedule job creation for every next hour, plus beginning of Windows.

If not, service examines if update files exists for current version, by querying the server with [program name] and [current version]. If yes, create a new named BITS job (if not exist).

In the first case, when BITS job finishes, calls BITS/COMPLETE. If it fails, schedule completion for every next hour, plus beginning of Windows. If completion is done, update current version for program in question.

Logbook for every action in CSIDL_COMMON_APPDATA\INCA Hellas\iUpdate\YYYYMMDD.log (hh:mm:ss.ms message) Some messages are logged in Event log, under Application key.

Querying server for newer version

http[s]://host_name[:port]/myweb/iupdate.php?f=qrymaxver&prog[]=program_name&version[]=current_version_number&serial[]=serial_no&pcid=PCID
Variables prog[] and serial[] can be repeated multiple times.

Optional variable:
&v=1

Server returns:
PCID=PC Id
PROG[i]=program name
OK[i]=max.version number
LICENSE[i]=License string
URL[i][j]=url of file(s) to download
FILE[i][j]=local name of file(s) to download
DEST[i][j]=destination directory(-ies) 
 %TEMP, %PROG, %WIN32=windows\system32, absolute path
DATE[i][j]=dates of files on server
or
error description (multiple lines).

Will download as http[s]:host_name[:port]/ftp/program_name/max_version/name_of_inst_exe
i is enumerated as 0,1,2,_
If license string is empty, do not download anything, just inform user a newer version is available by displaying page
http[s]//host_name[:port]/myweb/iupdate.php?f=newveravail&prog=program_name

Updates are located at Update location, version part.

Subdirectory with name @win32 has a special meaning:
.win32 corresponds to %WIN32 value of DEST[i].

Other subdirectories may also have a special meaning, referring to a user local full pathname if a file named @rename.txt exists in Version location/version or Update location/version part, which contains entries with pairs of subdir_name and absolute path of destination directory, separated with a = sign.

Version part may be the complete version number or part of the version number, i.e. may be 5.6.12.1 or 5.6.12 or 5.6.
In the preceding examples request for 5.6.12.1 will match subdirectory 5.6.12.1 and request for 5.6.1 will match subdirectory 5.6.

Non-subdirectory contents and any other not defined, are prefixed by %TEMP> or %PROG, for Version location/version or Update location/version files, respectively.

Example of @rename.txt file located in Update location/version part:
User1=c:\documents and settings\user1\My documents
User2=d:\myfolder1

Service checks for newer version or updates once a day, and if available, informs user when (and if) user logs in, for everyone user that logs in.

Programs to be executed on user PC

Programs to be executed when new files arrive at user PC are defined by file @install.txt which resides in main Version location or Update location.
File contains lines of programs to be executed, i.e.:
%TEMP\ishop.exe

Subdirectories Structure on download server

Version location

Version 1 Subdir 1 Subdir 2 Subdir 3 _ @win32 @rename.txt Version 2 Version 3 _ @install.txt


Update location

Version 1 Subdir 1 Subdir 2 Subdir 3 _ @win32 @rename.txt Version 2 Version 3 _ @serial 1 @serial 2 @serial 3 @install.txt

Extra user functions

iUpdate service checks for newer versions once a day.
User functions exist 1) to run again immediately, 2) to run continuously every 10 minutes, for the next hour.

iUpdateLogin

This program runs on startup when any user logs in, and monitors the directory CSIDL_COMMON_APPDATA\Inca Hellas\iUpdate Files, for files new*.xml or cmp*.xml which are created by the INCA iUpdate service. The new*.xml files are created when a new version exists which the user must be informed of, but cannot download without purchasing. The cmp*.xml files are created when a BITS download has completed and there are files ready for installation.

So, when the program detects any file of these kind, notifies the user by a balloon notification. If there are new versions, clicking on the balloon notification shows browser windows with information about purchasing them. Right-clicking on the icon in the tray, a popup menu is displayed that lets the user to:
  1. Force the iUpdate service to check for new version or updates immediately.
  2. Force the iUpdate service to check for new version or updates every 10 minutes for the next hour.
  3. Show the browser window for a program, if there is one. If the browser window is already open, it brings it into focus.
  4. Install an update which has been downloaded.
  5. Force re-downloading of an update.
The program checks by default every 5 minutes (or the value of the key HKEY_LOCAL_MACHINE\Software\INCA Hellas\iUpdateLogin\PollingPeriod) for the creation of the files. The user is notified for each program a maximum of 3 times (or the value of the key HKEY_LOCAL_MACHINE\Software\INCA Hellas\iUpdateLogin\Notifications), and the time between each notification is 1 hour (or the value of the key HKEY_LOCAL_MACHINE\Software\INCA Hellas\iUpdateLogin\TimeBetweenNotifications). The values in the registry are string representations of the respective numbers.
Durations are expressed in milliseconds.

The balloon notification stays on for 15 seconds (or the value of the key HKEY_LOCAL_MACHINE\Software\INCA Hellas\iUpdateLogin\BalloonTime).

Imessage (win32 prog)

Syntax:
Imessage program_name [ _u userid ] [ -m message ] [ - s subject ] [ -437 | -utf8 ] [ -f filename1] [ -f filname2] [ -f _]

Command puts a message to be sent in queue by copying file(s) in directory CSIDL_COMMON_APPDATA\imessage\send_id\
A special file named .imessage.new is put in dir., that contains
Progname=
Userid=
Subject=
Message=
Default character set is 928.
If userid is not specified, it defaults to logged in user.
While being created, file is named .imessage.tmp and when creation has finished, renamed as .imessage.new
If filename is a full path name, only the base filename part will be saved. If multiple files are given with different full pathnames but same base filename, base filenames will be renamed by appending 2,3,4,_ in base part of filename, while extensions will be kept.
Once the message is successfully sent, it is marked as .imessage.sent

Imessagesnd service

It checks every some minutes to see if pending messages exists on local machine. Then it sends messages.
For every message being send a PCID must exists for the specified progname, or the message waits for ever.
Default checking interval is 5 minutes, or specified by:
HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas\iUpdate\SendInterval = (string)milliseconds

Imessagerd u-service

Runs at user login. The first time at all, service checks for a PCID and creates one, if not exists, as described above.
Once an PCID has been created, service checks on the internet for pending question, by sending PCID, every one quarter.
Question time is 15 minutes by default, or set by HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas\iUpdate\QryInterval=dword (minutes).
If a message arrives it is immediately displayed to user.
An arriving message has always a unique identifier which is sent back, when user answers the message.

Service center operations

Send message to PCID, program name, version, etc.

Includes in ishop_db.php

$WWWLicense=1
In order to allow for licenses maintenance

Technical info

Data is downloaded into CSIDL_COMMON_APPDATA\INCA Hellas\iUpdate Downloads\...\ as BIT_tmp
When BITS finishes, files are renamed by service as 0.tmp, 1.tmp, 2.tmp, etc.

All registry keys

Base key: HKEY_LOCAL_MACHINE\SOFTWARE\INCA Hellas
Subkey Name Type Default value Comments
iUpdate BITS Polling Period SZ 300000 milliseconds = 5 minutes Milliseconds to query the BITS service
iUpdate Location SZ C:\Program Files\INCA Hellas\INCA iUpdate\ Path of iupdate.exe executable
iUpdate Polling Period SZ 86400000 milliseconds = 24 hours Polling period for iUpdate server(s)
iUpdate SendIterval SZ 300000 ms = 5 minutes Message send interval
iUpdate QryInterval DWORD 900000 ms = 15 min Time between checking for newer messages
iUpdateLogin BaloonTime 15000 ms = 15 seconds How much time the baloon remains open
iUpdateLogin Notifications 3 How many times the user will be informed for a new version available, for a specifc program
iUpdateLogin PollingPeriod SZ 300000 ms = 5 minutes How frequently to check for new updates, arrived localy
iUpdateLogin SendInterval SZ 5000 ms = 5 seconds Local message check time to send
iUpdateLogin TimeBetweenNotifications 3600000 ms = 1 hour Time between notifications to user for new update arrivals