Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CreateFileMapping() returns Access Denied running under Win2003 Se

452 views
Skip to first unread message

Vee@discussions.microsoft.com Mark Vee

unread,
Nov 30, 2007, 11:39:00 AM11/30/07
to
'm trying to create a Memory Map shared memory segment that is named
"\local\MemorySegmentName". If I run the code using RDP (but not on the
console), I can successfully create the memory segment. If I run it from the
Console on Win2003 Server, it fails with an "Access Denied" error.

The machine this is running on is the domain controller and the Windows
account I am using to run the code is in the Admin group of that domain.
Since security attributes parameter is NULL and the memory segment name is
local, this should work according to all the documentation I have read. I did
try to set the security attributes on the memory segment and open it up to
all authenticated uses, but that didn't work either.

I suspect I am being limited by some security policy because I am running on
the console. Any ideas how I can allow a console login the ability to create
shared memory regions will be appreciated.

Mark

This is a code snippet:

LPCTSTR MappingName =_T("Local\\AuthDllSharedMem");
HANDLE hMapObject = CreateFileMapping
(
INVALID_HANDLE_VALUE, // use paging file
NULL, // default security attributes
PAGE_READWRITE, // read/write access
0, // size: high 32-bits
SHMEMSIZE, // size: low 32-bits
MappingName ); // name of map object

Jeffrey Walton

unread,
Nov 30, 2007, 12:29:27 PM11/30/07
to
Hi Mark,

Have you verified your priviledges on the machine (including GP
restrictions?). I believe gpresult.exe from the command line will do
the trick (you also need RSOP enabled). After verifying local
permissions, I would look at the permissions on Shared Object.

> Since security attributes parameter is NULL and the memory segment name is
> local, this should work according to all the documentation I have read.

:)

Jeff

On Nov 30, 11:39 am, Mark Vee <Mark V...@discussions.microsoft.com>
wrote:

Tim Roberts

unread,
Dec 1, 2007, 7:16:18 PM12/1/07
to
Mark Vee <Mark V...@discussions.microsoft.com> wrote:
>
>'m trying to create a Memory Map shared memory segment that is named
>"\local\MemorySegmentName". If I run the code using RDP (but not on the
>console), I can successfully create the memory segment. If I run it from the
>Console on Win2003 Server, it fails with an "Access Denied" error.
>...

Ah! This is a tricky one.

>This is a code snippet:
>
>LPCTSTR MappingName =_T("Local\\AuthDllSharedMem");

Note that this is subtly different from your text description above in one
very critical way: this is a relative path, not an absolute path, as you
described. I suspect that's the difference. Console sessions, by default,
are rooted in the Global space to begin with, so you're actually creating
\Global\Local\AuthDllSharedMem.

I suspect if you change that to
LPCTSTR MappingName = _T("\\Local\\AuthDllSharedMem");
it will work as you expect.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Alexander Grigoriev

unread,
Dec 1, 2007, 8:48:38 PM12/1/07
to
The SDK doesn't mention any leading backslashes in the mapping name. It
mentions Local\ and Global\ prefixes.

"Tim Roberts" <ti...@probo.com> wrote in message
news:n6u3l39hopkr82c9h...@4ax.com...

Tim Roberts

unread,
Dec 4, 2007, 12:25:29 AM12/4/07
to
"Alexander Grigoriev" <al...@earthlink.net> wrote:
>
>The SDK doesn't mention any leading backslashes in the mapping name. It
>mentions Local\ and Global\ prefixes.

You're right. I convinced myself that I had read an MSDN article to the
contrary, but I must have been imagining it.

Mark Vee

unread,
Dec 10, 2007, 2:28:00 PM12/10/07
to
Thanks to all for trying to identify my issue. I worked with one of our IT
guys and no Group policies exit that might prevent the code from working
correctly. It still is isolated to just running on the Console of the Win2003
server. Very strange. I guess I'm going to burn one of our MSDN support calls
in order to find out what magic revolves around console sessions.
0 new messages