Article View: borland.public.cppbuilder.nativeapi
Article #102Re: Memory mapped files in a Service
From: Mike Collins
Date: Thu, 26 Jun 2008 15:57
Date: Thu, 26 Jun 2008 15:57
58 lines
3116 bytes
3116 bytes
Colin, From my understanding, if you create a memory mapped file (or mutex or other kernel object) and you do not prefix it with anything, it is assumed to be "Local". Therefore, it is local for the session that it is created in. In vista this is more of a problem becuase all the services run in session 0. therefore if you create a MMF in session 0, with no prefixing, it is local to session 0 and NOT accessible / visiable outside that session. Therefore, to get the system to function as you require, you just prefix it with "Global\\". This should work in all cases, regardless of Vista or XP (the only exception being Windows 2K <). I did not notice anothing in the article that suggested "at times". I have a similar situation and it seems ot work in both Vista and XP. Have you checked which part of your process is not working? Is it the initial CreateFileMapping or the OpenFileMapping? What does GetLastError() return? What does ProcExplorer.exe show up as the file map name? How are you controlling access to your MMF? Mike C "Colin B Maharaj" <noreply@myhost.com> wrote in message news:48637046$1@newsgroups.borland.com... > Hi folks, > I recently had to fix a bug where my memory mapped file > that was running in my service application was not > visible to my foreground application. > > To fix this I had to add Global to the name like this..... > > From: "MMAPFILE" > To: "Global\\MMAPFILE" > > Had to do this to both my service and foreground application. > > Now in some cases it works fine, e.g. in my development environment > it was not necessary for me to make these changes. It seems to > be a namespace issue > > http://blogs.msdn.com/maartenb/archive/2008/05/07/memory-mapped-files-from-xp-to-vista.aspx > > In this article they articulate the problem - but with vista, however it > also applies, "at times", to XP services. The real problem being here is > "at times". > > > Question: (Finally) > How do I know that the operating system will run my service and > create memory mapped files within a separate namespace or not. > > thanks.. >
Technical Details
Message-ID:
<4863ab8c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mailReferences:
<48637046$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ef43529cc999a6b2 X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Mike Collins" <its@TheBottomOfThePost> Newsgroups: borland.public.cppbuilder.nativeapi References: <48637046$1@newsgroups.borland.com> Subject: Re: Memory mapped files in a Service Date: Thu, 26 Jun 2008 15:57:09 -0000 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.3959 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 89.241.70.19 Message-ID: <4863ab8c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1214491532 89.241.70.19 (26 Jun 2008 07:45:32 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail