Results 1 to 3 of 3

Thread: QSharedMemory in processes from different accounts

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default

    Hello!
    I'd like to use QSharedMemory for changing data between processes.
    In first process - something about:
    Qt Code:
    1. QSharedMemory m_Pool;
    2. m_Pool.setKey("POOL");
    3. if (!m_Pool.create(128))
    4. {
    5. //some error message
    6. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. m_Pool.lock();
    2. char *pBuffer = static_cast<char*>(m_Pool.data());
    3. strcpy(pBuffer, "some data");
    4. m_Pool.unlock();
    To copy to clipboard, switch view to plain text mode 

    In second process:
    Qt Code:
    1. char *p_buffer = NULL;
    2. QSharedMemory smPool("POOL");
    3. if(!smPool.attach(QSharedMemory::ReadOnly)){
    4. // some error message
    5. }
    6. smPool.lock();
    7. char *pBuffer = static_cast<char*>(smPool.data());
    8. p_buffer = strdup(static_cast<char *>(pBuffer));
    9. smPool.unlock();
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by wysota; 19th March 2009 at 09:51.

Similar Threads

  1. Replies: 1
    Last Post: 6th March 2007, 15:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.