The NT Insider May-June 2016
; The commandments of x64 assembly: ; ; 1. Thou Shalt Not Write Inline Assembly ; 2. Thou Shalt Generate Unwind Data ; 3. Thou Shalt Comment Each Line of Assembly ; include macamd64.inc ; ; External C function to read an article ; ; NTSTATUS ; TheNTInsiderReadSingleArticle( ; PCHAR ArticleDescription, ; ULONG_PTR PageNumber, ; ); ; EXTERN TheNTInsiderReadSingleArticle:PROC .DATA PeterPontificates BYTE "COMPUTER SCIENCE EDUCATION? (YUP, STILL SUCKS)", 0 NewWaysToConnect BYTE "INTRODUCTION TO SIMPLE PERIPHERAL BUS DEVICES AND DRIVERS", 0 TipsForUsingIoTargets BYTE "A FEW RULES TO MAKE YOUR USE OF I/O TARGETS SIMPLE", 0 TodayInDriverSigning BYTE "COLOR ME CONFUSED (STILL. AGAIN.)", 0 AnalystsPerspective BYTE "MY DRIVER PASSES DRIVER VERIFIER! (OR DOES IT…)", 0 ByeByeCoInstallers BYTE "SURPRISE? NEW VERSIONS OF WDF NO LONGER SUPPORTED DOWNLEVEL", 0 .CODE NESTED_ENTRY TheNTInsiderReadEntireIssue, _TEXT save_reg rcx, 8h ; Home RCX save_reg rdx, 10h ; Home RDX save_reg r8, 18h ; Home R8 save_reg r9, 20h ; Home R9 alloc_stack 20h ; Make home space for TheNTInsiderReadSingleArticle END_PROLOGUE ; We are done manipulating the stack, so emit the ; appropriate unwind stuff lea rcx, [PeterPontificates] ; We're about to read the first article mov rdx, 4 ; Put page number in RDX. I realize this comment ; isn't useful, but I'm supposed to comment every ; line... call TheNTInsiderReadSingleArticle ; Read the article! test eax, eax ; Returns an NTSTATUS, so check SF js Exit ; If it's set there's an error and we need to leave lea rcx, [NewWaysToConnect] ; Time for the second article! mov rdx, 6 ; Do what I did last time call TheNTInsiderReadSingleArticle ; Read the next article! test eax, eax ; Testin'... js Exit ; And jumpin'... A publication of OSR Open Systems Resources, Inc. Resources, Systems Open OSR of A publication lea rcx, [TipsForUsingIoTargts] ; Let's read another article! mov rdx, 8 ; TODO: Learn to write a MASM loop..
[Show full text]