kmd wrote:up!
still nobody has any ideas?
Probably there is no 100% functional and compatible way to do what you want. This KTHREAD flag is not exported or mentioned in any API's that gathering info about thread by user mode request.
Available options:
1. Force thread to alertable state: inject + any API that forces thread into alertable state
2. Read kernel memory through
NtSystemDebugControl, or PhysicalMemory section (only for anything lower than 3790 SP1): locate ethread object ->
NtQuerySystemInformation(info class handles), read structure, locate pointer to flags, read it. Difficult to develop and not scalable.
3. Use
KdSystemDebugControl (it is NtSystemDebugControl functionality built for WinDBG for using in Vista+). This method has a critical count of disadvantages due to amount of requirements. You need system set in debug mode, debug privilege, kd driver handle, IOCTL code.
4. Investigate call stack of the specified thread you want to analyze for specific calls, or analyze thread start address for
TppWorkerThread for example (Vista+, unexported afair). Play with windbg !process command.
5. Write a small driver to extract this flag. Thread structure however is opaque and subject of constant changes between Windows version.
6. Revise what you want to do and how you want to do this. Probably this is the best option.