RFC: KUSER_SHARED_DATA update patch to fix bug 29168

Joey Yandle dragon at dancingdragon.be
Wed Apr 4 13:42:31 CDT 2012


> 
> Writable shared memory is unacceptable, but as long as it's read-only
> from the client there's no problem in principle.
> 

Excellent, thanks Alexandre.

I'm attaching my current shared memory diff.  It uses shm_open + mmap in
wineserver to map the shared memory area read/write, and shm_open +
NtCreateSection + NtMapViewOfSection in wine to map read only.  A thread
is run in wineserver which does a clock_nanosleep to set the times
without drift.

The wineserver code appears to work, and successfully writes to shared
memory.  The wine code fails in NtMapViewOfSection with error C0000018,
which is STATUS_CONFLICTING_ADDRESSES.  Can someone who understands
NtMapViewOfSection look at my code and tell me if I've done something
stupid?  I thought there might be code buried in NtMapViewOfSection
which tries to reserve that code block, but I didn't see it when I looked.

Some notes:

I didn't use CreateFileMapping/MapViewOfFile because that lives in
kernel32.dll, so I pulled the code in and called
NtCreateSection/NtMapViewOfSection directly.

I also had to pull out all of the ntdll code which writes to
USER_SHARED_DATA, and move that to wineserver.

I had to link ntdll and wineserver against -lrt; this should of course
be done more clealy via configure.

Finally, the mmap call in wineserver only succeeds if I pass in a
candidate address; if I pass in NULL, it fails with 'Operation not
permitted'.

cheers,

Joey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shm.diff
Type: text/x-patch
Size: 26751 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120404/fa19a77a/attachment-0001.bin>


More information about the wine-devel mailing list