Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Executable to update iself

Posted on 2007-03-28
Medium Priority
Last Modified: 2013-11-23
I have created a "Loader" utility that with some certain parameters checks whether the target exe file has the same checksum (using MD5 algorithm), and if different downloads the updated version of the target.exe which exists on a read-only directory, executes the file downloaded and terminates itself (the loader.exe).  That way I don't need to install evey update on any program in the company I work since the user infact does not execute the target.exe but the loader that first downloads updated target and then executes the target ;)

Question:  How can I update the loader.exe itself?  I mean I cannot directly download the file since its already in use.  How can I download a program from within the SAME program and update it?  How can loader.exe update itself?????

Any solutions?
Question by:Ioannis Anifantakis
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 28

Accepted Solution

2266180 earned 500 total points
ID: 18811435
the simplest way (I think):
- loader runs
- loader downloads an updater.exe and the new loader.exe (under a different name or location)
- loader starts updater and terminates
- updater tries to delete old loader.exe at a 500 ms interval until it succeeds
- then updater copies the new loader.exe into the place of the old one
- updater deletes the new loader.exe which was downlaoded into another location or name and then starts loader.exe
- loader.exe, on startup, checks wheter updater.exe is present and if so, tries to delete it at a 500 ms interval until succeeds
LVL 28

Expert Comment

ID: 18814369
may I know the reason for a C grade?

Author Comment

by:Ioannis Anifantakis
ID: 18814817
Saying C Grade u mean the points? They seem much?
They are much for this solution, but from the beggining I didn't believe any suggestion much different would occur.  I just gave it a "go" incase there is a way to patch a file that already runs... but I don't believe myself anything like that is possible... so I accepted this as solution since its what 99% of the people would do and waste no more time on something more sophisticated that after all would end up to the same result :)

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 28

Expert Comment

ID: 18814847
points and grade have different meaning.
points caracterize the question: difficulty, urgency, etc
grade caracterizes the experts response: good or bad. a C grade means a bad answer. which we both agree is not the case here.

when you accept a solution, you have a link named Grading Tips which points to  http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/help.jsp#hi73

you should have read that before accepting since you obviosly mistakaned the grade meaning. not a big issue since it happens to new members :) if after reading the tips you feel that ineed I deserved more or maybe just want to reopen teh question for further discussion, then please do post in community support asking that.

Author Comment

by:Ioannis Anifantakis
ID: 18857232
ok, now I understand what you mean by talking about grades.
Yes, I gave it C (Average) because it is the common sence.

As I said I posted this one to check if there is any possiblity to "patch" a file that already executes.  But as I also know there is no such a service.  I just wanted to make sure.

So C grade goes because its the answer that anyone would think, including me, but its still an accepted answer.


Author Comment

by:Ioannis Anifantakis
ID: 18857314
I am sorry if I missunderstand teh grades and points,

But what i saw was
A. Perfect
B. Good
C. Average

So I didn't infact rate this as a bad accepted answer.  On the contrary, I said its an average answer containing a good suggestion.  I would ofcourse rate it [A] if a self-patch solution existed as a windows service to auto-activate the patch procedure on program close-up maybe or so...  As I know its 2x the points which is not 4x as the [A] would do and if I knew that my rating effects the points given I would go for at least [B], but anyway...

I am sorry if I dissapointed, I really did not mean to.
LVL 28

Expert Comment

ID: 18857876
I was just thinking about something else when I saw an explanation for you in this case. so let me try to explain this:

I'll go from here: "So C grade goes because its the answer that anyone would think, including me, but its still an accepted answer."

I will post the following question:
"Is there a way for a person to drink up all by himself an ocean, to the last drop of water?"

someone comes and answers: "no. that is impossible"

that is, and I quote: "the answer that anyone would think". So this goes a C grade, right? well, wrong. The answer is perfect.
let me explain you why.

A C grade means, that there are at least 2 other, different answers that can be given a B and respectivly an A grade. It is logical right? Any question can have an A gradable answer. So, if my question can have an A gradable answer and I am giving it a C grade, it means that somewhere, it is certain that an A answer exists. Can you find it? No. because actually there isn't one. So my choice of C grade is wrong.

Read the grading tips again. Don't try to interpret the meaning of the grades yourself. The tips are there so that you don't interpret it as you want and live by the general rules.
So, if I gave the perfect answer, even if that answer is the most common sense, the grade must be an A. because the **ANSWER** is perfect. you can't get any better than that.
the grade shows how good/bad the answer was and nothing more. If there is no better answer, you cannot give a grade lower than A. this would mean suicide for the expert.
Look at it from my point of view: I want to anser a question. I want to receive an A grade. just like in school. If I were to apply your logic, I will never answer your question because there is no way for me to receive an A. does that makes sence to you? In school, the teacher askes: how much is 2+2. The kid answers 4. The teacher gives him a C because everybody knows that? It's not really my fault that you asked a quesiton to which you knew the answer because it is a generally known answer.

the right way to go with such a problem where you know the answer and just want to make sure that is the best answer:
- post your question
- somebody answers giving the answer you thought yourself is the best
- wait some time. like 1-2-3 weeks.
- if no better answer is given, it means there is no better answer OR the expert that has a better answer did not read your question but you cannot know that, so your only solution is to grade the best answer with an A.

this is the logical way to do. (and of course, if you have unexplained parts from the question, or things that are not clear, you should ask, so the exprets can clearify them for you)

If you still didn't understand how to grade, I'll leave the moderators to explain, because this is their line of expertise, not mine.

LVL 28

Expert Comment

ID: 18862690
Thanks. Will do.

Author Comment

by:Ioannis Anifantakis
ID: 18863555
omg, lol... I didn't expect this matter to go that far....

Anyway, I'm sorry if I offended anyone, but grade went to C cause it was an [average] answer.  Thats the way I saw it... I'm sorry thogh, plz don't get frenzy...  I was my perspective of seeing things.

Thanx alot though for all the time you spent both the expert and the admin.

And sorry again if I offended you!


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question