|
Home > Archive > Programming with dBASE > November 2005 > Updating an application
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Updating an application
|
|
| David Kleinman 2005-11-03, 8:24 pm |
| I thought I saw a recent thread asking about updating a runtime application (.exe) from within the application, but I can't seem to find it. This would involve overwriting the existing .exe while it was in use. Due to sharing violations, this is not pos
sible. Therefore to accomplish this, a batch file could be put into the Startup folder to execute when the computer is restarted and copy the .exe from a temporary update file name to the appliaction file name.
How do I determine the location of the Startup folder for the various
Windows versions? Is there a better way to do this and copy the update .exe to replace the application?
David Kleinman
---------------------------------
I just found the original thread, but no one replied... Does anyone have any comment?
-------------------------------------------------
Original message from Paul Van House:
I'm using FTP to download and install the most recent DEO object
versions of a new almost-ready-to-beta application and it works well.
But, what happens when I need to update the EXE file (I store some
default tables and images in the EXE so if I add fields or indexes the
EXE will need to be updated)
Is there a more elegant way other than downloading the updated exe to a separate folder, generating a batch file that will copy the exe to the proper folder, call the batch file and quit the app?
--------------------------------------------------
| |
| Charlie Lutz 2005-11-03, 8:24 pm |
| In article <PFH9iyC4FHA.540@news-server>, tech-remove-
@bedfordprecision.com says...
> I thought I saw a recent thread asking about updating a runtime application (.exe) from within the application, but I can't seem to find it. This would involve overwriting the existing .exe while it was in use. Due to sharing violations, this is not p
ossible. Therefore to accomplish this, a batch file could be put into the Startup folder to execute when the computer is restarted and copy the .exe from a temporary update file name to the appliaction file name.
>
> How do I determine the location of the Startup folder for the various
> Windows versions? Is there a better way to do this and copy the update .exe to replace the application?
>
Partial answer maybe, check out home() and _dbwinhome in the OLH. They
will give you some of the paths you are looking for.
Charlie
--
____________________
________
Charlie Lutz
#1000441
| |
| John Jay 2005-11-03, 8:24 pm |
| > I thought I saw a recent thread asking about updating a runtime
application (.exe) from within the application, but I can't seem to find it.
This would involve overwriting the existing .exe while it was in use. Due
to sharing violations, this is not possible.
David,
I cannot help you with trying to acomplish the update your way, but why
not consider another approach? DEO. Look in OLH under Dynamic External
Objects, NOT DEO, DEO shows how to do it in the project explorer, but not
the theroy behind it. The idea is to build one small startup.exe that calls
all other parts of the application. I run a network and except for my
machine (the beta app) I store only the startup.exe on every workstation.
The rest of the application resides in 1 directory on my server. When I am
sure a new .wfm , prg. ,.rpt works properly I copy it from my beta machine
to the server, and every machine on the network gets the updated version
without a reboot or share violation. OLH explains it better than I. I heeded
Ken Mayer's advice never to put tabes or images inside my exe.
John Jay
Best Marine
| |
| David Kleinman 2005-11-04, 3:23 am |
| Here's my situation. I'm distributing an appliaction containing sensitive encrypted data. I provide weekly updates to the data that may be downloaded from my FTP site. Occasionaly I need to change the program, add function or reports, etc. This can ea
sily be doone with DEO or downloading and copying the new program to the proper folder. However, some of my customers are computer "challenged" and cannot handle download and copy with any consistancy or confidence. I therefore created a one-click pushb
utton to download and install the update - except for the program which cannot be copyed onto itself while in use. The problem with DEO is that it provides a soft spot for data encryption and security. Given the program name of a routine within the appl
ication, any dBASE programmer can provide a compiled program to essentially hijack the program flow and perform any operation on the data by simply copying a program to the folder with the correct name. It is therfore essential that the .exe be replaced.
I found that the use of:
new file().copy(filname1, filename2)
can be used but it gives a "file in use" error and will not work. On the otherhand, the dBASE Run command can be used with the DOS Copy command to copy the new .exe and overwrite the old .exe while it is in use. I then immediately close the program afte
r telling the user to restart it.
David.
John Jay Wrote:
> application (.exe) from within the application, but I can't seem to find it.
> This would involve overwriting the existing .exe while it was in use. Due
> to sharing violations, this is not possible.
>
> David,
> I cannot help you with trying to acomplish the update your way, but why
> not consider another approach? DEO. Look in OLH under Dynamic External
> Objects, NOT DEO, DEO shows how to do it in the project explorer, but not
> the theroy behind it. The idea is to build one small startup.exe that calls
> all other parts of the application. I run a network and except for my
> machine (the beta app) I store only the startup.exe on every workstation.
> The rest of the application resides in 1 directory on my server. When I am
> sure a new .wfm , prg. ,.rpt works properly I copy it from my beta machine
> to the server, and every machine on the network gets the updated version
> without a reboot or share violation. OLH explains it better than I. I heeded
> Ken Mayer's advice never to put tabes or images inside my exe.
> John Jay
> Best Marine
>
>
| |
| Bernd Hohenester 2005-11-04, 3:23 am |
| Hello David,
> I found that the use of:
>
> new file().copy(filname1, filename2)
>
> can be used but it gives a "file in use" error and will not work. On the otherhand, the dBASE Run command can be used with the DOS Copy command to copy the new .exe and overwrite the old .exe while it is in use. I then immediately close the program af
ter telling the user to restart it.
I solve the update with a DOS-batchfile, which is generated in the
application. Here are some steps from my routine:
private cPath // because we "macro" it later
if NOT "RUNTIME" $ upper( version(1) )
cPath = set("DIRECTORY") + "\Update" // when in IDE
else
cPath = _dbwinhome + "Update" // when running as .EXE
endif
// save current directory setting
cOldPath = set("DIRECTORY")
// does directory exist?
lDirExists = true
try
cd (cPath)
catch(exception e)
lDirExists = false
endtry
// restore directory setting
cd (cOldPath)
// in case the directory doesn't exist
if not lDirExists
try
md &cPath.
catch( Exception e )
endtry
endif
cPath += iif(cPath.right(1) <> "\", "\", "") // add backslash
// next step is to download your updated .EXE-file
// now the new .EXE exists on the local drive in the directory
<application-path>\Update
// generate DOS-batchfile
cBatFile = funique("t???????.bat")
i = new file()
i.create(cBatFile)
i.puts("echo off")
// i always provide an installlshield programm and now start it
i.puts(cPath + "<application.exe>")
// otherwise you may copy the new .exe from
<application-path>\update to <application-path>
i.puts("copy " + cPath + "<application.exe> " + _dbwinhome
+ "<application.exe>")
// after update start the new application.exe
i.puts(_app.exeName)
i.puts("del " + cBatFile)
i.close()
// now start the batchfile
try
oShell = new oleautoclient("WScript.Shell")
oShell.Run(cBatFile, 0, false)
catch (exception e)
run(false, cBatFile)
endtry
// last step close the application
quit
cu
Bernd
| |
| John Jay 2005-11-04, 11:23 am |
|
David ,
> I'm distributing an appliaction containing sensitive encrypted data.
By data do you mean encryped table(s)?
>The problem with DEO is that it provides a soft spot for data encryption
and >security. Given the program name of a routine within the application,
any dBASE >programmer can provide a compiled program to essentially hijack
the program flow >and perform any operation on the data by simply copying a
program to the folder >with the correct name.
What am I missing here?
I thought if you had encryped tables and your app opened the tables
internally without
requiring external password entry they could not be opened. Then no matter
what program someone replaced they would not have table access because they
did not have a password.
Please explain for me and anyone else who thought that this was true.
Thanks
John Jay
Best Marine
| |
| David Kleinman 2005-11-04, 8:23 pm |
| Suppose you have a main program MyPrg that calls several other forms (MyMainForm, MySubForm, etc...). The session password for the encrypted tables in contained in the MyMainForm.wfm. The password unlocks the encryption for all other form, functions, pr
ocedures, etc. Using DEO, I substitute MySubForm compiled in the application with MySubForm.wfo. I have now exposed the name of one of my subroutines. Now anyone can come along and write a new function, name it MySubForm.wfo, copy it to the appliaction
folder, and generate a list and print all data in the encrypted table. OOPS.
David
John Jay Wrote:
>
> David ,
> By data do you mean encryped table(s)?
>
> and >security. Given the program name of a routine within the application,
> any dBASE >programmer can provide a compiled program to essentially hijack
> the program flow >and perform any operation on the data by simply copying a
> program to the folder >with the correct name.
>
> What am I missing here?
> I thought if you had encryped tables and your app opened the tables
> internally without
> requiring external password entry they could not be opened. Then no matter
> what program someone replaced they would not have table access because they
> did not have a password.
> Please explain for me and anyone else who thought that this was true.
> Thanks
> John Jay
> Best Marine
>
>
| |
| John Jay 2005-11-04, 8:23 pm |
|
David ,
I see your point thanks.
But on 9-26 there is a post about this.
It is the old Spy versus counter spy.
John Jay
Best Marine
i was told by the dbase technical people that someone once got a
> trick to get out compiled code from .exe and posted it on the news
> group but i cant seem to find this information. please if you have
> details of this information i will be very grateful if you can share
> it even at a price
I've check the old newsgroup and here's what I found. Try this site:
http://www.stephencameron.com/frame_work.htm
| |
| John Jay 2005-11-11, 1:23 pm |
|
David ,
> Suppose you have a main program MyPrg that calls several other forms
(MyMainForm, MySubForm, etc...).
Had a thought, but it is untested.
2 .exe files MyPrg1.exe MyPrg2.exe
When you do a update always name it MyUpdate.exe and it goes into your dir
where you store all your .exe files.
code of MyPrg1.exe
if file(MyUpdate.exe)
! rename MyPrg2.exe old.exe
! rename MyUpdate.exe MyPrg2.exe
endif
do Myprg2.exe
* eof()
Everything is safe in MyPrg2.exe
To update all that is required is to restart MyPrg1.exe
I realise that it would be impossible to use this with a network where there
would be only 1 copy on the server that all clients would access but
deploying to all client
computers seems a good security work around.
All this would be in MyPrg2.exe
The session password for the encrypted tables in contained in the
MyMainForm.wfm. The password unlocks the encryption for all other form,
functions, procedures, etc. Using DEO, I substitute MySubForm compiled in
the application with MySubForm.wfo. I have now exposed the name of one of
my subroutines. Now anyone can come along and write a new function, name it
MySubForm.wfo, copy it to the appliaction folder, and generate a list and
print all data in the encrypted table.
NO OOPS ???
Just a thought
John Jay
Best Marine
|
|
|
|
|