Problem with NtReadVirtualMemory and wine server connection
kumbayo84 at arcor.de
Tue Sep 26 13:13:36 CDT 2006
throught a problem in winedbg i found out that NtReadVirtualMemory has a
problem, when reading into a invalid local buffer.
it uses wine_server_set_reply( req, buffer, size ); to read the data supplied
by the server directly into application memory of unknown state.
when the read call hits bad(non present/readonly ) memory it returns EFAULT
and the client dies with
"wine client error:<process id>: read: Bad address"
i see 3 ways to deal with this problem
1. allocate a temporary buffer in NtReadVirtualMemory, read server answer to
this buffer, and then inside a try / catch block copy to application memory
2. change server protocol so it is not as sensitive when read returns EFAULT
(i do not really like this idea)
3. just fix the bug in winedbg and wait until a real world app needs this
behavior. (of course i will send a patch for windbg even if one of the other
ways is choosen)
PS: attached a testcase for NtReadVirtualMemory(testcase itself not tested on
windows, but tests were)
the test should probably also live in its own file, but i didn't want to
create a almost empty file
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3768 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060926/ebcee86e/ntdll_test.bin
More information about the wine-devel