Re: DeviceIoControl failed in WOW64 on 64bit XP Pro

From: Thomas F. Divine [DDK MVP] (tdivine_at_NOpcausaSPAM.com)
Date: 11/18/04


Date: Thu, 18 Nov 2004 13:55:37 -0500


"hyfeng" <canttellyou@newsgroup.nospam> wrote in message
news:ehYKsqZzEHA.908@TK2MSFTNGP11.phx.gbl...
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in
> news:ecwkyATzEHA.1196
> @TK2MSFTNGP15.phx.gbl:
>
>> Alignment can be an issue. Align all IOCTL buffers on 8 bytes.
>>
>
> Well, I understand alignment very likely is the issue and that is probably
> what I will do to get around the problem.
>
> However, WOW64 is supposed to provide thunking properly so that 32-bit
> applications do not need to change and that is why I think this is a
> problem from WOW64 and I need confirmation form Microsoft. Also, please
> keep in mind that there is no pointer-precision data in the buffer passed
> into DeviceIoControl(). All data in the buffer are fixed-precision type.
>
I understand that you are not passing any pointers... However, the data
passed two and from a driver intrinsically uses pointers in the IRP that,
depending on the I/O method, may be mapped for you.

HOWEVER, it has been my experience that some 64-bit components check for
64-bit alignment of IRP buffers before they check anything else. For
example, a call to read a 32-bit value may fail because the 32-bit value is
not aligned on a 64-bit boundary.

I think that this is a bug - or at least isn't documented sufficiently
anywhere that I looked.

Good luck,

Thomas F. Divine, Windows DDK MVP
http://www.rawether.net



Relevant Pages

  • Re: Alignment of disk-I/O from userland.
    ... SL>>>alignment of data buffers used to access disk devices directly. ... SL>Working around hardware requirements from the block layer gets messy. ... SL>communicate this property upwards from the driver? ...
    (freebsd-arch)
  • Re: [BUG] slab debug vs. L1 alignement
    ... >> With slab debugging on, ... > beeing passed aligned buffers, if somebody don't agree, please speak ... SCSI device does not currently have any alignment restrictions. ... Specifying that DMA buffers must be cache-line aligned would ...
    (Linux-Kernel)
  • Re: [BUG] slab debug vs. L1 alignement
    ... > SCSI device does not currently have any alignment restrictions. ... This must then be handled by the driver. ... Specifying that DMA buffers must be cache-line aligned would ...
    (Linux-Kernel)
  • Re: Alignment of disk-I/O from userland.
    ... >>alignment of data buffers used to access disk devices directly. ... Working around hardware requirements from the block layer gets messy. ... You obviously don't want to manually align buffers that are distined ... People expect their hardware to Just Work, regardless of how cheap ...
    (freebsd-arch)
  • Re: Delphi apps more secure?
    ... There is no way to avoind pointers for low level stuff. ... If you take a look at any delphi API wrapper code, ... pointers to raw buffers and complex structures are all over the place. ...
    (borland.public.delphi.non-technical)