NO

Author Topic: CreateFileMapping for IPC on Win7 trouble please help  (Read 5507 times)

Seltsamuel

  • Guest
CreateFileMapping for IPC on Win7 trouble please help
« on: April 02, 2011, 11:32:17 PM »
Hi,

im running against a wall at the moment seems microsoft wrecked IPC Communication in Vista/Win7 and the Documentation for a workaround is a search for a needle inside a haystack.

Let me describe my problem.
My application is startable multiple times but the first instance is special and creates a GLOBAL Shared Memoryblock for Communication and data sharing EVEN BETWEEN DIFFERENT LOGGED IN User Sessions and that is a important thing for me.

All Windows Versions until VISTA have no problem with this but especially Win7 lets me run against a wall. When the Account that starts the Program is a pure Administrator all is fine and can access the shared memory but when you take a normal user account even when runasadmin is checked! it CANNOT access the shared memory. i even put a manifest with <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> into the resource section of my programm but it does not help....

Does anyone here know what to do to share data between different logged in user on a single PC on Win7 ??
it would be fine for me to use only "Local" shared memory inside a single session BUT then i must assure the Programm cannot run at the same time from a different user ... and the exact same problems that i have with shared memory in global space apply to global mutexes..... i dont know what microsoft had in mind with this sh...

any help is appreciated.. thanks

Greetings

Seltsamuel


CommonTater

  • Guest
Re: CreateFileMapping for IPC on Win7 trouble please help
« Reply #1 on: April 03, 2011, 02:43:37 AM »
Is this what you need? ...  http://www.jimmah.com/vista/content.aspx?id=6

You might also try "HighestAvailable" in your manifest.
« Last Edit: April 03, 2011, 02:45:58 AM by CommonTater »

Seltsamuel

  • Guest
Re: CreateFileMapping for IPC on Win7 trouble please help
« Reply #2 on: April 04, 2011, 01:59:48 AM »
Hi,

thanks for your answer..
but the link wont help with my problem.

Isnt "requireAdministrator" not already the highest?
I researched much the last Days and have to say that Microsoft made me a really bad Week with this.. there are MANY with this problem .. actually all programs that use some type of "Run only 1 instance per PC" used to use something in Global namespace .. and now this requires "SeCreateGlobalPrivilege" that you wont get on a normal user account even when "runasadmin".

I read about "private namespace" but at the moment have no clue how to create one and if its available between different loginsessions...
and best is dont know if its compatible with older windows versions.. Did Microsoft really forgot to give a possibility to Applications on userlevel to communicate to each other between sessions?? The Global thing would work when i first install a "Service" that creates the Global share and sets security on a way that the applicatrions can access it but i dont want to install a service on a users machine only to run my application and that is not needed when not...

At the moment im really clueless.. i will try if its possible to use a Global Mutex (i read this should work) so im able to not allow startup on other sessions and limit the application to 1 session (where the processes can communicate with local shared memory and find each other)... all this is really a big unnecessary mess.. why did Microsoft not make an application\ namespace or something like this would have solved all problems ..

Seems i really need a clever head to help me out of this ..

Thanks

Seltsamuel

rweidner

  • Guest
Re: CreateFileMapping for IPC on Win7 trouble please help
« Reply #3 on: April 04, 2011, 02:59:17 PM »
I once had a "run only once" problem that I needed to solve on a WinCE machine using Java.  My solution was to use TCP/IP.  In that case, if an application couldn't bind to a specific local port I made the assumption that an instance of the application was already running.  The rational was that even if there was some other reason the new instance couldn't bind to the port, the "run only once" feature was important enough to not let the application run.

I might consider TCP/IP for your problem as well.  It seems like a very controlled way to share data.  Perhaps more application overhead than you would like to consider but, once solved, your solution will probably never get stripped away again.

Good Luck.

CommonTater

  • Guest
Re: CreateFileMapping for IPC on Win7 trouble please help
« Reply #4 on: April 04, 2011, 03:13:09 PM »
I'm sorry that wasn't what you wanted.  It sounds like a real problem.  

I am far from expert on interprocess communications.  I have used the CreateMutex() and associated functions to ask one copy of a program to wait for another.  I know this can be done on win7.  I've also used the WM_COPYDATA message to communicate between copies of a program.  There is also a GobalAlloc function for creating variables in global memory...  but aside from suggesting you have a look at these things, I can't say they will solve your problem.

Perhaps I should defer to the others and see if we can both learn something...