Skip to content

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

License

Notifications You must be signed in to change notification settings

v-gabriel/win-sys-job-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages