OpenFileMapping problem (Object does not exist)

I

iduniq

Hi,
Good day! I have a problem opening a shared mem, the error code
of which is 2 (Object does not exist). This is my setup, a Windows
service calls a process A, process A creates successfully shared mem.
Then I have another app which runs on DOS prompt which tries to open
the shared mem but encounters error 2. The OS is Windows Server 2003
for Small Business Server (ServicePack 1). Since process A calls
another process (process B), i tested using OpenFilemapping (same open
code with DOS app) in process B and it successfully opened the shared
mem. Any ides?

TIA,
Roy

// Shared mem creation (NotQuiteNullDacl clss came from codeguru.com)
int maxlen = 256;
SECURITY_ATTRIBUTES MutexAttributes;
NotQuiteNullDacl Dacl;

bool bDaclOk = Dacl.Create();
ZeroMemory( &MutexAttributes, sizeof(MutexAttributes) );
MutexAttributes.nLength = sizeof( MutexAttributes );
MutexAttributes.bInheritHandle = FALSE;
SECURITY_DESCRIPTOR SD;
BOOL bInitOk = InitializeSecurityDescriptor( &SD,
SECURITY_DESCRIPTOR_REVISION );
BOOL bSetOk = SetSecurityDescriptorDacl( &SD,
TRUE,
Dacl.GetPDACL(),
FALSE );
MutexAttributes.lpSecurityDescriptor = &SD;
hmmf=CreateFileMapping((HANDLE) 0xFFFFFFFF,
&MutexAttributes,PAGE_READWRITE,0,maxlen,"MYSVCNAME");

// Open shared mem
HANDLE hdltest = OpenFileMapping(FILE_MAP_READ, TRUE,"MYSVCNAME");
 
I

Ian Collins

iduniq said:
Hi,
Good day! I have a problem opening a shared mem, the error code
of which is 2 (Object does not exist). This is my setup, a Windows
service calls a process A, process A creates successfully shared mem.

Looks like you would be better off asking on a windows programming group.
 
L

Lew Pitcher

Looks like you would be better off asking on a windows programming group.

And/or one that discusses C++ (or whatever language the OP posted).
While it /may/ be C, there's just enough strangeness to make it not-C,
primarily around the use of functions as members of (uninitialized)
structures.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top