[NTDEV][WINXP] Cute code in AllocateAdapterChannel

Windows XP, Whistler build 2462.

Don’t ya just love it when somebody gets “cute” in critical code and costs
you hours so they could get a giggle? I do hope this is purely coincidence,
but here is what happened to me on the way to the forum while debugging my
infamous zero length transfer problem.

To do zero length transfers, I sense a zero buffer length and instead of
calling DmaOperations->GetScatterGatherList, I call
DmaOperations->AllocateAdapterChannel, passing it valid parameters with
NumberOfMapRegisters set to 0. In the callback I then used MapRegisterBase
to sense if the transfer length is zero. But things kept going bump in the
night. So, off I trek into the debugger to take a trip through the call back
function.

When what to my wondering eyes I beheld … not a value of 0 … noooo not
even a 1, which I could understand, but “deadf00d”. that’s right … pass
AllopcateAdapterChannel a 0 NumberOfMapRegisters, and you get “deadf00d”.

Ha Ha Ha … said I. I do hope that is simply the coincidental result of a
bug, or that I missed something in setting up to call
AllocateAdapterChannel. I really really do, because if it’s a genuine “cute”
code giggle I think we need to ban the son-of-a-bitch, and break all of
his/her/its fingers. (and that’s when I’m thinking NICE thoughts)

There. That’s off my chest. I needed that.

By the way … side by side, Windows 2000 does not return “deadf00d”, it
returns 0.

Gary


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com