BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating/Upgrading users application

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Deployment
View previous topic :: View next topic  
Author Message
Rick Anderson
Guest





PostPosted: Sat Mar 04, 2006 11:03 am    Post subject: Updating/Upgrading users application Reply with quote



I maintain a Delphi 7 application installed at an organization at an Air
Force base. They were using SMS to push changes to the users. The changes
were new versions of the exe, new help/readme files, etc. Now, the Comm
Goons for the base have decided to take over the SMS tasking and have
prohibited my customer from using SMS. They will handle everything, but on
their schedule and not my customers.

Here was my idea. I would create a "push" table in the Oracle DB with a
variety of attributes (version number, files, file locations, etc). When
the user logged in, the program would check the "push" table to see if they
are running the latest version. If not I would like to terminate the
application, spawn a new application that would read the "push" table and
update the user's PC appropriately. Once the update is finished I would
restart the main application.

My questions are 1) is the a good idea?, 2) How can I spawn the updater
program while shutting down the main application, 3) any better solutions??

Thanks
Rick Anderson
Back to top
Bill Todd
Guest





PostPosted: Sat Mar 04, 2006 4:03 pm    Post subject: Re: Updating/Upgrading users application Reply with quote



Rick Anderson wrote:

Quote:
I maintain a Delphi 7 application installed at an organization at an
Air Force base. They were using SMS to push changes to the users.
The changes were new versions of the exe, new help/readme files, etc.
Now, the Comm Goons for the base have decided to take over the SMS
tasking and have prohibited my customer from using SMS. They will
handle everything, but on their schedule and not my customers.

Here was my idea. I would create a "push" table in the Oracle DB
with a variety of attributes (version number, files, file locations,
etc). When the user logged in, the program would check the "push"
table to see if they are running the latest version. If not I would
like to terminate the application, spawn a new application that would
read the "push" table and update the user's PC appropriately. Once
the update is finished I would restart the main application.

My questions are 1) is the a good idea?, 2) How can I spawn the
updater program while shutting down the main application, 3) any
better solutions??

Thanks
Rick Anderson

What you propose should work. You should be able to use the following
function to launch either program.

function fileExec(const aCmdLine: String; aHide, aWait: Boolean):
Boolean;
var
StartupInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
begin
{setup the startup information for the application }
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
with StartupInfo do
begin
cb:= SizeOf(TStartupInfo);
dwFlags:= STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
if aHide then wShowWindow:= SW_HIDE
else wShowWindow:= SW_SHOWNORMAL;
end;

Result := CreateProcess(nil,PChar(aCmdLine), nil, nil, False,
NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo,
ProcessInfo);
if aWait then
if Result then
begin
WaitForInputIdle(ProcessInfo.hProcess, INFINITE);
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
end;
end;

--
Bill Todd (TeamB)
Back to top
Rick Anderson
Guest





PostPosted: Sat Mar 04, 2006 7:03 pm    Post subject: Re: Updating/Upgrading users application Reply with quote



"Bill Todd" <no (AT) no (DOT) com> wrote in message
news:4409af99 (AT) newsgroups (DOT) borland.com...
Quote:
Rick Anderson wrote:

I maintain a Delphi 7 application installed at an organization at an
Air Force base. They were using SMS to push changes to the users.
The changes were new versions of the exe, new help/readme files, etc.
Now, the Comm Goons for the base have decided to take over the SMS
tasking and have prohibited my customer from using SMS. They will
handle everything, but on their schedule and not my customers.

Here was my idea. I would create a "push" table in the Oracle DB
with a variety of attributes (version number, files, file locations,
etc). When the user logged in, the program would check the "push"
table to see if they are running the latest version. If not I would
like to terminate the application, spawn a new application that would
read the "push" table and update the user's PC appropriately. Once
the update is finished I would restart the main application.

My questions are 1) is the a good idea?, 2) How can I spawn the
updater program while shutting down the main application, 3) any
better solutions??

Thanks
Rick Anderson

What you propose should work. You should be able to use the following
function to launch either program.

function fileExec(const aCmdLine: String; aHide, aWait: Boolean):
Boolean;
var
StartupInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
begin
{setup the startup information for the application }
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
with StartupInfo do
begin
cb:= SizeOf(TStartupInfo);
dwFlags:= STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
if aHide then wShowWindow:= SW_HIDE
else wShowWindow:= SW_SHOWNORMAL;
end;

Result := CreateProcess(nil,PChar(aCmdLine), nil, nil, False,
NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo,
ProcessInfo);
if aWait then
if Result then
begin
WaitForInputIdle(ProcessInfo.hProcess, INFINITE);
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
end;
end;

--
Bill Todd (TeamB)

Please excuse me if I am a little slow in understanding this and maybe its a
basic assumption I made that is messing things up. Here is how I think the
process should work:
1) User starts MyApp.exe (main program)
2) Just after the login (we need a connection to Oracle), MyApp determines
that it is an older version and must be replaced along with any other
support files.
3) MyApp informs user of requirement to update, starts MyPush.exe (using
fileExec with NoWait) and passing in whatever parameters are necessary.
4) MyApp exits.
5) MyPush copies the new version of MyApp.exe file over the existing version
of MyApp.exe file on the users machine and whatever other files are
necessary.
6) MyPush starts MyApp.exe (new version now)
7) MyPush exits.
All done
My assumption in this is that MyApp.exe cannot be running in order to
overwrite the file. If this is not the case then the first MyApp process
would still be the older version of the codebase even if the underlying exe
file was replaced. We would have to stop the intial MyApp process and
restart it after the file copying is complete.

Is my assumption (and we all know what happens when one assumes things)
correct?

Thanks very much
Rick Anderson
Back to top
Bill Todd
Guest





PostPosted: Sat Mar 04, 2006 7:03 pm    Post subject: Re: Updating/Upgrading users application Reply with quote

Rick Anderson wrote:

Quote:
Is my assumption (and we all know what happens when one assumes
things) correct?

Yes.

--
Bill Todd (TeamB)
Back to top
Rick Anderson
Guest





PostPosted: Sun Mar 05, 2006 6:03 am    Post subject: Re: Updating/Upgrading users application Reply with quote

Ok, since the MyApp (see previous postings) process needs to be not running
when we overwrite the executable file with the new version, could I do the
following?
When MyPush exe starts it tests to see if the MyApp processes is still
running and if it is it waits to do the copy of the files. Once it no
longer detects the MyApp process it can copy the files it needs to do the
updates and then restart the MyApp exe and kill itself.

Thanks,
Rick Anderson

"Bill Todd" <no (AT) no (DOT) com> wrote in message
news:4409ddde$1 (AT) newsgroups (DOT) borland.com...
Quote:
Rick Anderson wrote:

Is my assumption (and we all know what happens when one assumes
things) correct?

Yes.

--
Bill Todd (TeamB)
Back to top
Bill Todd
Guest





PostPosted: Sun Mar 05, 2006 3:03 pm    Post subject: Re: Updating/Upgrading users application Reply with quote

Rick Anderson wrote:

Quote:
Ok, since the MyApp (see previous postings) process needs to be not
running when we overwrite the executable file with the new version,
could I do the following?

Yes. Another alternative is just add a call to Sleep in the push
program so it waits a couple of seconds before it starts to copy files.

--
Bill Todd (TeamB)
Back to top
Stu
Guest





PostPosted: Sun Mar 12, 2006 10:03 pm    Post subject: Re: Updating/Upgrading users application Reply with quote

Bill Todd wrote:
Quote:
Rick Anderson wrote:


Also might want to consider:
1. copy new version to a temporary name, ".exe.new"
2. confirm copy by filesize, a checksum, etc
3. once confirmed, rename original file to ".exe.old"
4. rename new file, e.g. remove ".new"
5. method for removing ".old" files at some point

-- Stuart
Back to top
Doug Stephens
Guest





PostPosted: Fri Apr 21, 2006 9:03 pm    Post subject: Re: Updating/Upgrading users application Reply with quote

Stu wrote:

Quote:
Bill Todd wrote:
Rick Anderson wrote:


Also might want to consider:
1. copy new version to a temporary name, ".exe.new"
2. confirm copy by filesize, a checksum, etc
3. once confirmed, rename original file to ".exe.old"
4. rename new file, e.g. remove ".new"
5. method for removing ".old" files at some point

-- Stuart

This seems to work for me, even if users are running the exe I can
rename it and/or delete it (under XP).
I just made a similar post, sorry for the duplication.
- Doug
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Deployment All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.