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");

Reply via email to