MKANET Posted September 6, 2012 Posted September 6, 2012 Microsoft Sysinternals Process Explorer can list all threads in a Windows process. It can also terminate any specific thread in a process. I can't seem to find a Windows command line utility that does this. The closest I could find is a command line utility to list threads of a process.I was hoping someone might have done something like this in Autoit already. From what I can tell, this would require a VERY experienced AutoIt expert who knows how to use Windows API commands such as TerminateThread comfortably. Usage:Processthread.exe -L notepad.exeResult:TID: 33772 notepad.exe+0x3570TID: 37532 WINMM.dll!timeEndPeriod+0xe8Usage:Processthread.exe -T 33772Result:TID: 33772 notepad.exe+0x3570 **TERMINATED**
BrewManNH Posted September 6, 2012 Posted September 6, 2012 You can look here for information about a function that can terminate threads, but I'd look at the warning about half way down the page. Why are you looking to kill a program's threads instead of the program itself? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
MKANET Posted September 6, 2012 Author Posted September 6, 2012 I had a feeling I would get an answer like that. Yes, I already looked there obviously, that's why I mentioned the TerminateThread function in my first post. Im hoping this thread will catch the attention of someone with the expertise to do this; and, wouldn't mind helping out. Anyway, I've got a Vista64 device driver for an irreplaceable legacy product R5000HD mod that has a bug in it. The bug causes a specific process thread keep banging away at a resource that doesn't exist; which wastes significant CPU cycles. The developer for the device driver is nowhere to be found; which is the correct way to address the issue. I can successfully provide a "band-aid" for this issue by manually killing the thread via Process Explorer. There is no other way good way for me to address this issue; or I would have gone another route. I would like automate this, instead of manually doing it every time in Process Explorer.
JohnOne Posted September 6, 2012 Posted September 6, 2012 I doubt anyone without access to the target process' code could comfortably use that function on it. Anyway, to use that function first you will need a handle to the thread you want to terminate. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MKANET Posted September 6, 2012 Author Posted September 6, 2012 Hmm.. Ive seen C and C# code that can do this. I was hoping that AutoIt has the same access to the WinAPI as C based languages in respect to this.
JohnOne Posted September 6, 2012 Posted September 6, 2012 I'm not suggesting AutoIt3 cannot accomplish the task. I'm saying it is that dodgy a function according to even MSDN that without a full knowledge of what a thread is doing it is extremely dangerous to the stability of the app and maybe even system critical processes to use. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MKANET Posted September 6, 2012 Author Posted September 6, 2012 Yes. I saw the same warning on MSDN. There are rare circumstances where this can be very useful and effective though. As mentioned earlier, I don't have any issues successfully doing this manually via Process Explorer's GUI; and, I dont have full knowledge of what the thread is doing. But, I do know that the band-aid solution actually works pretty well (no more weird Utilization caused by that thread... and system is perfectly stable for several days/weeks of uptime). Im just looking for a way to automate this via command line.
JohnOne Posted September 6, 2012 Posted September 6, 2012 Oh, I thought you were looking for an AutoIt solution. Commandline is a different kettle of fish. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MKANET Posted September 6, 2012 Author Posted September 6, 2012 Autoit console app like the example above...
tonycst Posted February 9, 2016 Posted February 9, 2016 I also want to terminate a specific thread ran by a process. What do i do ? Tha stupid program keeps popping up messages i dont want to see.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now