Re: 0x80000002 - {EXCEPTION} Alignment Fault A datatype misalignment was detected in a

Recasting a PTR and pass it to a function defeats the purpose of
UNALIGNED_XXX where the compiler is enlightened to add fix-up. I had had a
lot of these fun while porting a well known graphics driver to Itanic 10
years ago. If it gets too confusing at somepoint, just use memcpy.

Calvin

That can be somewhat dangerous advice if indiscriminately applied. If, for example, you start using memcpy to/from device mapped memory, bad things will happen. Yes, people really do try and do this, and the result isn?t very pretty.

  • S (Msft)

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Calvin Guan (news)
Sent: Friday, September 21, 2012 8:22 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] 0x80000002 - {EXCEPTION} Alignment Fault A datatype misalignment was detected in a

Recasting a PTR and pass it to a function defeats the purpose of UNALIGNED_XXX where the compiler is enlightened to add fix-up. I had had a lot of these fun while porting a well known graphics driver to Itanic 10 years ago. If it gets too confusing at somepoint, just use memcpy.

Calvin
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer