Hello, I am writing an anti-rootkit tool that has the functionality of force unload on suspect drivers, how to do a force unload driver by kernel?
Just do BSOD. Force unloads everything.
The feature you are planning is BSOD generator by design. There is no way to safely unload driver if it not support unloading itself, otherwise just call it driver unload function and pray for no BSOD.