RE: ReadDirectoryChangesW and buffer alignment

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Stewart,

Thank you for the feedback.

I have talked this issue with some kernel developers. They confirmed that
we must align the structure. There is some documentation in MSDN regarding
alignment. For example:
http://msdn2.microsoft.com/en-us/library/aa984851(VS.71).aspx

The most relevant line from that article is: "Applications should
generally align structure members at addresses that are "natural" for the
data type and the processor involved."

By default, the compiler will align classes and structures correctly.
However, since FILE_NOTIFY_INFORMATION is a variable structure, we assume
you are allocating the byte buffer to contain it, which caused the DWORD
alignment issue.

I agree that the alignment issue is not documented very clear, which may
confuse a lot of developers. We have forwarded this issue to the MSDN
document team, we can hope the doc will be clearer in future.

Regarding the further IO not queued issue, I think we'd better not try to
find the root cause. Because this occurs when the buffer is not DWORD
aligned, it is hard to explain a strange behavior in a failure code path.
From another perspective, when the ReadDirectoryChangesW or other code
"finds" the buffer is not DWORD aligned, it may trigger a different code
path from the normal/correct one. This is not guarantee that this different
code path will still queue the IO request. This is my current
understanding. Hope it helps

Anyway, if you still have any concern or anything unclear, please feel free
to tell me, I will work with you, thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • RE: [Offtopic - Maybe] MSDN Documentation
    ... MSDN-style documentation and integrate the documentation into the MSDN ... Microsoft Managed Newsgroup Support Team ...
    (microsoft.public.dotnet.general)
  • RE: ReadDirectoryChangesW and buffer alignment
    ... could read from the documentation that this should be aligned appropriately ... wasn't cancelling the IO - on x86 alignment errors are not among the first ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Running processes
    ... MSDN says that EnumProcessesis only supported under NT. ... The Process Status API is available in Windows NT 3.1, 4.0, Windows 2000, ... It's been so long since I did anything in support of Win98 I can't recall ... Part of the problem of MSDN documentation is they have been removing ...
    (microsoft.public.vc.mfc)
  • Re: Outlook Express API: IMimeMessage::GetAttachments Help Needed
    ... > We do support that OE API. ... It's doc'd in the MSDN and is eligible for ... Actually, now that I take a look, the documentation is much better than ... Hm, though IMimeMessage doesn't document the BindToObject function, or ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Forgot password option for users (process)
    ... MSDN includes documentation, ... support and help for people who wish to write their own custom ... Bruce Chambers ...
    (microsoft.public.windowsxp.security_admin)