Results 1 to 3 of 3

Thread: QSharedMemory in processes from different accounts

  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 10:51.

  2. #2
    Join Date
    Jul 2007
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSharedMemory in processes from different accounts

    Nobody knows... I guess such a restriction really exists. It's a pity.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSharedMemory in processes from different accounts

    Maybe you need to configure how the shared memory works on your system. Qt uses native shared memory mechanisms, so you probably have to look for a solution on some WinXP related sites.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 6th March 2007, 16: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.