Solved

Executable to update iself

Posted on 2007-03-28
12
268 Views
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?
0
Comment
Question by:ioannisa
  • 5
  • 4
12 Comments
 
LVL 28

Accepted Solution

by:
ciuly earned 125 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
0
 
LVL 28

Expert Comment

by:ciuly
ID: 18814369
may I know the reason for a C grade?
0
 
LVL 6

Author Comment

by:ioannisa
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 :)
0
 
LVL 28

Expert Comment

by:ciuly
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.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 6

Author Comment

by:ioannisa
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.

Thanx
0
 
LVL 6

Author Comment

by:ioannisa
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.
0
 
LVL 28

Expert Comment

by:ciuly
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.

cheers
0
 
LVL 28

Expert Comment

by:ciuly
ID: 18862690
Thanks. Will do.
0
 
LVL 6

Author Comment

by:ioannisa
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!

:)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
passing a variable to eclipse to debug 2 63
Notepad++ Remote File Management 3 68
Unable to start eclipse ? 17 87
The line on IDE 4 39
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now