RE: ReadDirectoryChangesW and buffer alignment
- From: jetan@xxxxxxxxxxxxxxxxxxxx ("Jeffrey Tan[MSFT]")
- Date: Tue, 11 Sep 2007 02:50:32 GMT
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.
.
- Follow-Ups:
- RE: ReadDirectoryChangesW and buffer alignment
- From: Stewart Tootill
- RE: ReadDirectoryChangesW and buffer alignment
- References:
- RE: ReadDirectoryChangesW and buffer alignment
- From: "Jeffrey Tan[MSFT]"
- RE: ReadDirectoryChangesW and buffer alignment
- From: Stewart Tootill
- RE: ReadDirectoryChangesW and buffer alignment
- Prev by Date: Re: Creating process on winlogon desktop from a service
- Next by Date: Re: MapAndLoad problem.
- Previous by thread: RE: ReadDirectoryChangesW and buffer alignment
- Next by thread: RE: ReadDirectoryChangesW and buffer alignment
- Index(es):
Relevant Pages
|