473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Replace exe and dll in use

Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv
Nov 17 '05 #1
8 9421

"Viviana Vc" <vc*******@hotmail.com> wrote in message
news:2i************@uni-berlin.de...
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?


In both cases, you can't. Depending on what operating system you're
running you may be able to rename or move the file and copy a new file with
the old file name, but the running programs will continue to use the old
file until the programs are restarted.

--
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-g*******@mvps.org

Nov 17 '05 #2
Hi,

"MoveFileEx" function is to be used for this purpose.
I've been using it to replace system dll by older-versioned dlls that were
working better and that windows didn't want to replace due to higher version
number !
have a look at this msdn article Q140570 too :
http://support.microsoft.com/default...b;en-us;140570

regards,
arno

"Viviana Vc" <vc*******@hotmail.com> a écrit dans le message de news:
2i************@uni-berlin.de...
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv

Nov 17 '05 #3
Hi Viviana,

MoveFileEx MOVEFILE_DELAY_UNTIL_REBOOT

Does this help with question 2?

Best regards,
Slobodan
"Viviana Vc" <vc*******@hotmail.com> wrote in message news:2i************@uni-berlin.de...
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv

Nov 17 '05 #4
On Tue, 08 Jun 2004 13:03:40 +0200, Viviana Vc <vc*******@hotmail.com>
wrote:
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?
Not directly. But you can have an auxiliary program that stops your
main program, replaces it, and restarts it.

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
How about renaming the old DLL, copying in (or renaming) the
replacement, and letting each program start using the new version
whenever it restarted?

If you have a list of programs that you want to coerce, you could
close and restart them.

If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv


-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
Nov 17 '05 #5
Hi Viviana,

MoveFileEx MOVEFILE_DELAY_UNTIL_REBOOT

Does this help with question 2?

Best regards,
Slobodan

PS:
Sorry if this is second time that I post this but I can't see my yesterdays post.

"Viviana Vc" <vc*******@hotmail.com> wrote in message news:2i************@uni-berlin.de...
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv

Nov 17 '05 #6
Yes it does. Thx!
Looks like the following:
MoveFileEx(szDstFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT);
would make the trick of: deleting the old dll and renaming the new dll
as the old one, all of them over a reboot, as those dlls are used by a
lot of application and even by the system so they can be done only over
a reboot.

Viv

On Wed, 9 Jun 2004 13:05:34 +0200, "Slobodan Brcin \(eMVP\)"
<sb****@ptt.yu> wrote :
Hi Viviana,

MoveFileEx MOVEFILE_DELAY_UNTIL_REBOOT

Does this help with question 2?

Best regards,
Slobodan
"Viviana Vc" <vc*******@hotmail.com> wrote in message news:2i************@uni-berlin.de...
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv


Nov 17 '05 #7
On Thu, 10 Jun 2004 14:07:22 -0400, r_z_aret@pen_fact.com wrote :
On Tue, 08 Jun 2004 13:03:40 +0200, Viviana Vc <vc*******@hotmail.com>
wrote:
Hi all,

I have 2 questions:

1) As I know there is no way on Windows to replace a running exe, but
somebody told me that this is doable, and I couldn't find any info on
how could this be done programmatically. Is something like this
possible? And if yes, how?
Not directly. But you can have an auxiliary program that stops your
main program, replaces it, and restarts it.


Yes, already thought about this being the only way out ...

2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?
How about renaming the old DLL, copying in (or renaming) the
replacement, and letting each program start using the new version
whenever it restarted?


Upss, I didn't know that I could rename a dll that is already loaded by
some applications! Because I couldn't replace it I thought that also
renaming will fail. Seems not. And the same if for the running exes.
But in the dll case, as I don't know all the app that have loaded it, so
I can not restart only those, I will need a reboot anyhow, so I could
also use the MoveFileEx right?

If you have a list of programs that you want to coerce, you could
close and restart them.

If it's only over a reboot, how could I do the following: i have in the
same dir dll and dll_new, how could I do in one step: delete dll and
rename dll_new with dll?

Thanks in advance,
Viv


-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com


Nov 17 '05 #8
On Mon, 14 Jun 2004 13:02:01 +0200, Viviana Vc <vc*******@hotmail.com>
wrote:
On Thu, 10 Jun 2004 14:07:22 -0400, r_z_aret@pen_fact.com wrote :
On Tue, 08 Jun 2004 13:03:40 +0200, Viviana Vc <vc*******@hotmail.com>
wrote:
clip
2) My product has a dll that is used by multimple application from the
system. Is there any way in which I could update this dll (without
killing all the exe that have loaded this dll)? Or this is doable only
over a reboot?


How about renaming the old DLL, copying in (or renaming) the
replacement, and letting each program start using the new version
whenever it restarted?


Upss, I didn't know that I could rename a dll that is already loaded by
some applications! Because I couldn't replace it I thought that also
renaming will fail. Seems not. And the same if for the running exes.
But in the dll case, as I don't know all the app that have loaded it, so
I can not restart only those, I will need a reboot anyhow, so I could
also use the MoveFileEx right?


Rename is a special case of Move. I use MoveFile, not MoveFileEx. And
not for anything tricky. So I'm quite sure you're getting better info
about MoveFileEx in another set of responses.

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Craig Keightley | last post by:
Can these lines of sql statements be consolidated into one sql statement (possibly using reg exps??) BEGIN CODE ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Update...
12
by: Barnes | last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form? Here is the scenario: I have a form that cannot accept apostrophes. I want to use the replace() so...
6
by: Danny | last post by:
I need an asp command to strip out from a string all extra punctuation such as apostrophe, comma, period, spaces dashes, etc etc and just leave the letters. Can anybody give me some ideas? ...
9
by: Peter Row | last post by:
Hi, I know this has been asked before, but reading the threads it is still not entirely clear. Deciding which .Replace( ) to use when. Typically if I create a string in a loop I always use a...
4
by: Cor | last post by:
Hi Newsgroup, I have given an answer in this newsgroup about a "Replace". There came an answer on that I did not understand, so I have done some tests. I got the idea that someone said,...
3
by: Goran Djuranovic | last post by:
Hi all, I ran into a problem where my XMLTextReader fails on .Read() when I have "<" character in one of the attribute's values. What I am trying to do is replace illegal characters ("<", "&" ,...
3
by: TOXiC | last post by:
Hi everyone, First I say that I serched and tryed everything but I cannot figure out how I can do it. I want to open a a file (not necessary a txt) and find and replace a string. I can do it...
6
by: JackpipE | last post by:
Here is my replace query and I need to run this on every column in my table. Right now I manually enter the column name (_LANGUAGES_SPOKEN) but this is time consuming and would like to automate...
5
by: V S Rawat | last post by:
I was trying to use back-to-back replace functions to convert a url: str1 = str.replace("%2F","/").replace("%3F","?").replace("%3D","=").replace("%2 6","&"); It didn't replace all 4 types of...
15
by: =?Utf-8?B?TWlrZSAiWU9fQkVFIiBC?= | last post by:
I have a text file that contains about 8 to 10 text sequences that I need to replace. I want to search and replace all 8 to 10 text sequence anytime I run this script Here is what I have so...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.