Skip to content

Latest commit

 

History

History
89 lines (51 loc) · 2.11 KB

README.md

File metadata and controls

89 lines (51 loc) · 2.11 KB

Windows thread management

Win forms app that imports the windows kernel32.dll for GUI process thread management.

Note
App is setup to run with admin privileges. Use with caution.


Info

Thread management

Dll imports:

[DllImport("kernel32.dll")]
static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId);
[DllImport("kernel32.dll")]
static extern uint SuspendThread(IntPtr hThread);
[DllImport("kernel32.dll")]
static extern int ResumeThread(IntPtr hThread);
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool CloseHandle(IntPtr handle);
  • Suspend: kernel32.dll handle for opening and suspening selected threads
  • Resume: kernel32.dll handle for opening and resuming selected threads

Counter thread

Separate counter thread which can be used for suspend/ resume testing.

Counts to 100.

Rollback thread

Standalone rollback service which triggers a resume operation on suspended threads.

Triggers every 10 seconds.


Demo

Getting app process, stopping and resuming mock thread execution.

//TODO

Blocking system threads, waiting for rollback thread to resume.

//TODO

Closing main window, waiting for thread cleanup.

//TODO


Tech

IDEs: Visual Studio 2022

Frameworks: ASP.NET Core

My Skills


References

Other:


Appendix


Authors