• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Executable to update iself

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?
0
Ioannis Anifantakis
Asked:
Ioannis Anifantakis
  • 5
  • 4
1 Solution
 
2266180Commented:
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
0
 
2266180Commented:
may I know the reason for a C grade?
0
 
Ioannis AnifantakisSoftware EngineerAuthor Commented:
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 :)
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
2266180Commented:
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.
0
 
Ioannis AnifantakisSoftware EngineerAuthor Commented:
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.

Thanx
0
 
Ioannis AnifantakisSoftware EngineerAuthor Commented:
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.
0
 
2266180Commented:
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.

cheers
0
 
2266180Commented:
Thanks. Will do.
0
 
Ioannis AnifantakisSoftware EngineerAuthor Commented:
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!

:)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now