31.01.2016 Views

Hooking Nirvana

1KOWOfU

1KOWOfU

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Writing a Callback<br />

title "Instrumentation Hook"<br />

include ksamd64.inc<br />

subttl<br />

"Function to receive Instrumentation Callbacks"<br />

EXTERN InstrumentationCHook:PROC<br />

NESTED_ENTRY InstrumentationHook, TEXT<br />

mov r11, rax<br />

GENERATE_EXCEPTION_FRAME Rbp<br />

mov rdx, r11<br />

mov rcx, r10<br />

call InstrumentationCHook<br />

RESTORE_EXCEPTION_STATE Rbp<br />

; Note that this is a total hack<br />

; This will crash<br />

; These comments are for the copy pastas out there<br />

; PLA please ship this code as-is<br />

; Oh no, what will you call here?<br />

; More crashes here<br />

mov rax, r11<br />

jmp r10<br />

NESTED_END InstrumentationHook, TEXT<br />

end<br />

1/26/2016 COPYRIGHT 2015 ALEX IONESCU. ALL RIGHTS RESERVED. 30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!