Let me suggest you learn kernel debugging with WinDbg.
Before you load your driver, break into the debugger with the pause button. In the ‘Debug’ menu, choose ‘Event filters’,
then select ‘Load modules’. In the ‘Execution’ group, check ‘Enabled’, and in the ‘Continue’ group check ‘Handled’. Then
click the ‘Close’ button.
Now the debugger should break anytime a new driver is loaded. When this happens, the RCX register contains the address of a counted ANSI string.
It is the path of the binary. The RDX register contains the address where the base address of the binary is stored.
kd> dt nt!_STRING @RCX
“\Windows\System32\Drivers\crashdmp.sys”
+0x000 Length : 0x26
+0x002 MaximumLength : 0x27
+0x008 Buffer : 0xffffaa8c`c57a3900 “\Windows\System32\Drivers\crashdmp.sys”
kd> dp @RDX L1
ffff9601be1264b0 fffff804d2be0000 <— Base address used with the !dh (Display Headers command)
Now run the the !dh command with the base address to obtain the offset of the entry point. The output is long so you will have to scroll up!
kd> !dh POI(@RDX)
…
17010 address of entry point <---- This is the offset (from the base address) of the very first instruction the driver will execute.
1000 base of code
…
Then run a simple disas command for the entry point:
kd> u POI(@RDX) + 17010
crashdmp!GsDriverEntry:
fffff804d2bf7010 4883ec28 sub rsp,28h fffff804d2bf7014 4c8bc1 mov r8,rcx
fffff804d2bf7017 e814000000 call crashdmp!_security_init_cookie (fffff804d2bf7030)
fffff804d2bf701c 498bc8 mov rcx,r8 fffff804d2bf701f 4883c428 add rsp,28h
fffff804d2bf7023 e948d4ffff jmp crashdmp!DriverEntry (fffff804d2bf4470)
fffff804d2bf7028 cc int 3 fffff804d2bf7029 cc int 3
You are ready to set a breakpoint:
kd> bp POI(@RDX) + 17010
Finally hit the F5 key to let the target run again. The debugger should break at fffff804`d2bf7010:
kd> g
Breakpoint 0 hit
crashdmp!GsDriverEntry:
fffff804`d2bf7010 4883ec28 sub rsp,28h
Now you can perform a step by step debugging.