Hello!
I'd like to use QSharedMemory for changing data between processes.
In first process - something about:
Code:
QSharedMemory m_Pool; m_Pool.setKey("POOL"); if (!m_Pool.create(128)) { //some error message }
Code:
m_Pool.lock(); char *pBuffer = static_cast<char*>(m_Pool.data()); strcpy(pBuffer, "some data"); m_Pool.unlock();
In second process:
Code:
char *p_buffer = NULL; QSharedMemory smPool("POOL"); if(!smPool.attach(QSharedMemory::ReadOnly)){ // some error message } smPool.lock(); char *pBuffer = static_cast<char*>(smPool.data()); p_buffer = strdup(static_cast<char *>(pBuffer)); smPool.unlock();
It works wonderful until we start both processes from one operating system account. But I need to run the first process from 'admin' and the second process from 'user'. So when I do 'smPool.attach' in second process I get QSharedMemory::PermissionDenied.
More detailed: 'QSharedMemoryPrivate::initKey: unable to set key on lock'.
Is there any opportunity to resolve this problem?
Thanks in advance :)
I use WinXP and Win2000.
