🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5101

Re: How to unmap file ?

#5101
From: Andrue Cope [TeamB]
Date: Thu, 06 Oct 2005 11:23
31 lines
2247 bytes
Juris wrote:

> When program loads into memory - windows maps(memory mapping) this
> file. After that there is no chance to apdate this file.
> 
> How can I unmap this file ?

You can't without unloading the application. The point of memory
mapping an executable is to allow it to be loaded on demand rather than
wasting RAM holding executable code that is never called. The point of
locking it is to prevent the executable code changing while it is
running.

Fundamentally you are trying to do something that is inadvisable -
modify a running executable. There are some techniques and situations
where this is a viable and neccessary activity but those are pretty
rare.

I suspect you are writing an installer or installation support tool. In
that case the only thing you can do is write a program to unload the
target application, apply the update, then relaunch the target
application.

I believe that Windows supports the concept of 'copying at bootstrap
time' for those executables that can't be shutdown and restarted
without a reboot.

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <434508b6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!ecngs!feeder2.ecngs.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeeder.wxs.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4344fc1d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,dbb65edaa3343676
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: How to unmap file ?
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4344fc1d$1@newsgroups.borland.com>
Date: Thu, 6 Oct 2005 12:23:41 +0100
User-Agent: XanaNews/1.17.6.5
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <434508b6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1128597686 217.207.223.34 (6 Oct 2005 04:21:26 -0700)
Lines: 31
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!ecngs!feeder2.ecngs.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!newsfeeder.wxs.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail