[Bug 20230] New: GetThreadTimes() and the Actual and Pseudo Current Thread Handles
http://bugs.winehq.org/show_bug.cgi?id=20230 Summary: GetThreadTimes() and the Actual and Pseudo Current Thread Handles Product: Wine Version: 1.1.30 Platform: PC URL: http://rh-software.com OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll AssignedTo: wine-bugs(a)winehq.org ReportedBy: ray(a)pobox.co.uk Some time ago I had an issue with SIV being unable to read the thread CPU time usage when using GetThreadTimes(). I tracked down to the following and then did a work-a-round. The "Current Thread" effectively has 2 current thread handles, these are the actual thread handle and the ~0 pseudo handle as returned by GetCurrentThread(). When a call is made to GetThreadTimes() this calls NtQueryInformationThread( ThreadTimes ) which contains the test "if (handle == GetCurrentThread())". As a result of this when GetThreadTimes() is called with the actual thread handle no data is returned. \WINE-1.1.30\dlls\ntdll\thread.c(1011): if (handle == GetCurrentThread()) I suspect the code should be changed to allow both the pseudo and actual thread handles to be used as a minimum, better still would, when possible, be to implement this function for any thread. While searching the source I also noticed: NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, LPCVOID data, ULONG length ) { NTSTATUS status; switch(class) { case ThreadZeroTlsCell: if (handle == GetCurrentThread()) And suspect that code would benefit from a similar fix. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 --- Comment #1 from ray(a)pobox.co.uk 2011-04-16 09:36:37 CDT --- Created an attachment (id=34147) --> (http://bugs.winehq.org/attachment.cgi?id=34147) Patch to fix GetThreadTimes() to work for all threads The patch works by reading from /proc/<pid>/task/<tid>/stat. If this in not possible it will report the fix messages as before. Given that SystemProcessorPerformanceInformation uses /proc/stat I expect this is OK. Do I also need to send the patch to wine patches? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 ray(a)pobox.co.uk changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ray(a)pobox.co.uk -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 --- Comment #2 from ray(a)pobox.co.uk 2011-04-16 09:43:37 CDT --- Created an attachment (id=34148) --> (http://bugs.winehq.org/attachment.cgi?id=34148) Test Version of SIV32X.exe To test the patch run SIV32X.exe and go Menu->Edit->STC Info. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 --- Comment #3 from Austin English <austinenglish(a)gmail.com> 2011-04-17 20:36:40 CDT --- (In reply to comment #1)
Do I also need to send the patch to wine patches?
Yes. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 ray(a)rh-software.com changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34147|0 |1 is obsolete| | --- Comment #4 from ray(a)rh-software.com 2011-04-19 03:51:47 CDT --- Created an attachment (id=34196) --> (http://bugs.winehq.org/attachment.cgi?id=34196) Fix GetThreadTimes for all threads 2nd attempt -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 ray(a)rh-software.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 ray(a)rh-software.com changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #34196|0 |1 is obsolete| | --- Comment #5 from ray(a)rh-software.com 2011-04-19 14:25:50 CDT --- Created an attachment (id=34229) --> (http://bugs.winehq.org/attachment.cgi?id=34229) Fix GetThreadTimes for all threads -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 Ken Sharp <kennybobs(a)o2.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Alias|GetThreadTimes() | -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=20230 --- Comment #6 from Austin English <austinenglish(a)gmail.com> 2013-09-11 19:45:56 CDT --- (In reply to comment #2)
Created attachment 34148 [details] Test Version of SIV32X.exe
To test the patch run SIV32X.exe and go Menu->Edit->STC Info.
I don't see the Menu option anywhere..anyway, that code hasn't changed in years, so still present. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Sebastian Lackner <sebastian(a)fds-team.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian(a)fds-team.de --- Comment #7 from Sebastian Lackner <sebastian(a)fds-team.de> --- I have added the patch to the staging tree: https://github.com/wine-compholio/wine-staging/tree/master/patches/ntdll-Thr... Please note that the implementation in comment #5 has a major flaw, when the filename (second argument in the file) contains spaces. This should be fixed in my updated version. Moreover I decided to always use /proc on Linux, otherwise there is no proper way to get the kernel time for the current thread. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Michael Müller <michael(a)fds-team.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |STAGED CC| |michael(a)fds-team.de Ever confirmed|0 |1 Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/ntdll-ThreadTi | |me -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Anastasius Focht <focht(a)gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |focht(a)gmx.net Summary|GetThreadTimes() and the |SIV (System Information |Actual and Pseudo Current |Viewer) needs |Thread Handles |GetThreadTimes() to return | |correct values for all | |threads Staged patchset|https://github.com/wine-com |https://github.com/wine-sta |pholio/wine-staging/tree/ma |ging/wine-staging/tree/mast |ster/patches/ntdll-ThreadTi |er/patches/ntdll-ThreadTime |me | --- Comment #8 from Anastasius Focht <focht(a)gmx.net> --- Hello folks, updating some fields. NOTE: The referenced Wine-Staging patchset https://github.com/wine-staging/wine-staging/tree/master/patches/ntdll-Threa... mixes different problems. Hence other, unrelated patches from this patchset might be linked from other tickets. $ wine --version wine-3.4 Regards -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 tokktokk <fdsfgs(a)krutt.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs(a)krutt.org -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Anastasius Focht <focht(a)gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|SIV (System Information |Multiple system information |Viewer) needs |tools and debuggers need |GetThreadTimes() to return |GetThreadTimes() to return |correct values for all |correct values for all |threads |threads (SIV System | |Information Viewer, Ollydbg | |1.x/2.x, x64dbg) --- Comment #9 from Anastasius Focht <focht(a)gmx.net> --- Hello folks, Zeb made a new attempt to get patches in: https://www.winehq.org/pipermail/wine-devel/2020-June/167306.html --- quote --- The only applications associated with this patch, and the others in the series, are essentially system process monitors. Accordingly, it's not really providing anything useful over host utilities such as ps(1). This patch helps System Information Viewer, and the other two in the series help Process Hacker. --- quote --- Actually the first patch also helps multiple debuggers. Ollydbg v1.x/2.x and x64dbg have a 'Threads' view which includes display of user/kernel CPU time of all the debuggee threads in real-time which is useful in certain situations. Refining summary to reference these tools as well. Regards -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Zebediah Figura <z.figura12(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12(a)gmail.com Resolution|--- |FIXED Status|STAGED |RESOLVED Fixed by SHA1| |847b93c7400f82225057e8b7193 | |8eb8ccd5d23be --- Comment #10 from Zebediah Figura <z.figura12(a)gmail.com> --- Fixed by <https://source.winehq.org/git/wine.git/commitdiff/847b93c7400f82225057e8b71938eb8ccd5d23be>. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #11 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 5.12. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=20230 Anastasius Focht <focht(a)gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- URL|http://rh-software.com |https://web.archive.org/web | |/20101102153355/http://olly | |dbg.de/odbg200.zip -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (2)
-
wine-bugs@winehq.org -
WineHQ Bugzilla