http://bugs.winehq.org/show_bug.cgi?id=8277
Summary: Enhancement: NtQueryInformationThread with ThreadQuerySetWin32StartAddress Product: Wine Version: 0.9.36. Platform: All OS/Version: other Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: wine-misc AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net
Hello,
just before this gets lost on my harddisk i "backup" this information in bugzilla database. Maybe it's useful for someone working on extending NtQueryInformationThread :-)
In the past, i encountered a number of applications/installers which regularly use NtQueryInformationThread info classes to gather thread information. One of these is "thread entry point" information represented by "ThreadQuerySetWin32StartAddress" information class. This is currently not implemented in wine.
--- snip --- fixme:thread:NtQueryInformationThread info class 9 not supported yet --- snip ---
I added a working implementation (fairly straight-forward). Callers can now query the address of thread entry point. This is useful for clients which do not act as debuggers (debuggers get this info for free in DEBUG events), e.g. for callstack/crash info/logging purpose and the like.
I implemented only the "query" case, not the "set". This is on purpose. Windows uses the "set" only once to transfer thread entry address into kernel (BaseProcessStart(up)), Reactos does the same. Wine has different init sequence so this is not needed at all (would have been no use to modify entry point address after thread has started).
While adding some bits of code i noticed wine doesnt handle return data buffer length mismatches in NtQueryInformationThread the way Windows and Reactos do. Wine just copies data up to supplied length, even on length mismatch case. Windows and reactos return STATUS_INFO_LENGTH_MISMATCH if returned information class data size doesnt match the supplied one (length parameter).
One can verify this by call various information classes with wrong length. The optional "returned length" parameter is only filled in success case (not even if info class size mismatch or internal API fails).
Patch for ThreadQuerySetWin32StartAddress information class following in next attachment.
Regards