Unlock EXE-file

Unlock EXE-file

Postby Marc Vanzegbroeck » Tue Jun 23, 2015 8:37 am

Hi,

Is there a way that the EXE-file is not locked while it is open on a network.
I want to put a new version of a a program on the server, without that everyone have to close the program.
They will have the new version after restarting the program.

I thought that I have read it somewhere on the forum, but I can't find it anymore...
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Unlock EXE-file

Postby MarcoBoschi » Tue Jun 23, 2015 8:57 am

Mark,
I launch this program in order to have a copy for every user.
for example user 001 does not launch myapp.exe but myapp001.exe

Code: Select all  Expand view

#include "fivewin.ch"

FUNCTION MAIN( cUtente, cExec )
LOCAL cFile1, cFile2, cFileBlk, cDts1, cDts2
LOCAL lEsegui := .T.

IF PCOUNT() = 0
   MsgAlert( "Use wg.exe User application",  "missing parameters" )
   RETURN NIL
ENDIF
DEFAULT cExec := "winrap"

cFile1   := cExec + ".exe"
cFile2   := cExec + cUtente + ".exe"
cFileBlk := cExec + cUtente + ".blk"

IF !FILE( cFileBlk )
   IF FIle( cFile1 )
      cdts1 := DTOS(FDATE(cFile1)) + FTIME(cFile1) + STR(FSIZE(cFile1),10)
      cdts2 := DTOS(FDATE(cFile2)) + FTIME(cFile2) + STR(FSIZE(cFile2),10)

      IF cdts1 <> cdts2
         lEsegui := copyfile( cFile1, cFile2 )
      ENDIF

      IF lEsegui
         Winexec( cFile2  + " " + cUtente )
      ELSE
         MsgAlert( "Exe not updated" , cExec )
      ENDIF
   ELSE
      MsgAlert( "Program " + cExec + " does not exist", "cannot continue")
   ENDIF
ELSE
   MsgWait( "Delete file  " + cFileBlk , "Blocked" , 3 )
ENDIF

RETURN NIL
 
User avatar
MarcoBoschi
 
Posts: 1016
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Unlock EXE-file

Postby driessen » Tue Jun 23, 2015 9:36 am

I do it somewhat different.

I always have a local folder to which I copy a small EXE-file. This EXE-files checks the main EXE-file on the server with my local main EXE-file. If the local main EXE-file does not exist or if it is different from the one on the server (size, date and time by using the CDATIME function), I copy the one on the server to the local folder. Then the local main EXE-file is started.

The local main EXE-file start by doing the same thing to the small EXE-file.

So everything is always up to date. I also have to install one update on a network. The local PC's will always be updated automatically.

And here is my CDATIME function :
Code: Select all  Expand view
FUNCTION cDaTime(cPathFile)                                            
                                                                             
   LOCAL aDirectory := DIRECTORY(cPathFile)                                  
                                                                             
RETURN(IF(EMPTY(aDirectory),SPACE(26),DTOS(aDirectory[1,3])+aDirectory[1,4]+STR(aDirectory[1,2],10,0)))
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Unlock EXE-file

Postby TimStone » Tue Jun 23, 2015 6:02 pm

We shared this in a thread a couple of years ago ... so more data lies there.

On my system, I post updates to my secured website in a compressed format.

On each company's server, there is a program running 24/7. It is unseen and runs with no display. It does data file backups every night about midnight, uploads data my customers want sent to 3rd party vendors, and every 3 hours it checks my server to see if a new version has been posted. If so, it downloads the update file, unpacks it, and puts various .exe and data files where they belong.

Client ( workstation ) .exe file are placed in a subfolder on the server. On each workstation, the program shortcut actually points to a special program that first checks the workstation .exe against the one on the server. If there is a newer one there, it moves it over to the workstation. After the check, and move if needed, it then starts the main program. If it moves across an updated version, it first shows a popup that says the program has been updated.

In this way, any bug fixes can be distributed throughout the day automatically, and it keeps my clients very happy. I've used this method now for several years and never have a problem.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2904
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Unlock EXE-file

Postby Marc Vanzegbroeck » Wed Jun 24, 2015 6:41 pm

Marco, Michel, Tim,

Thank you for the info.

I just notice that I don't need to unlock the EXE anymore since I use SQL!!! : :shock: :shock: :shock:
Before, when I still use DBF-files I tried to replace the file on the server while it is in use, and I allways received an error that it whas in use.
Now I just tested it again on a program that use MarioDB, and I can delete the file and replace it with a new version without that anyone have to close the program!!! :D :D :D :D :D
So I could do it all the time after I changed to SQL, but did't test it anymore....
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Unlock EXE-file

Postby Otto » Wed Jun 24, 2015 8:23 pm

This sounds to me dangerous.
You can expect that on todays PCs the whole exe is loaded into memory.
So there should not be any problem with entry points.

But lets wait what Antonio and Rao say.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6032
Joined: Fri Oct 07, 2005 7:07 pm

Re: Unlock EXE-file

Postby nageswaragunupudi » Fri Jun 26, 2015 7:56 am

My personal implementations too were similar to Mr Tim's and Mr Michel's logically.
I can understand why their systems have been working for years without any problem.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10254
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Unlock EXE-file

Postby Marc Vanzegbroeck » Fri Jun 26, 2015 10:12 am

nageswaragunupudi wrote:My personal implementations too were similar to Mr Tim's and Mr Michel's logically.
I can understand why their systems have been working for years without any problem.


Until now I always closed the programs remotely. Than I installed a new version on the server.
I wast just wandering that I can install a new version without that all the users have to close the program and found out that with ADO-SQL I can replase the file.
Ofcource, I have to close the programs if the structure of the database has been change since the previous version..

What can be the problem that I replace the program after the PC has loaded it into the memory?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 26 guests

cron