I am using GetQueuedCompletionStatusEx() and ReadDirectoryChangesW() to try to receive notifications of changes to multiple filesystem hierarchies.
I noticed that I would receive completion packets with error 0x10C when there would be a lot of changes at once. This error code wasn’t anywhere in the header files I’d included and wasn’t in the documentation ( http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465(v=vs.85).aspx ). A little digging later, I find out that it’s STATUS_NOTIFY_ENUM_DIR defined in ntstatus.h. Neither STATUS_NOTIFY_ENUM_DIR is mentioned in the documentation nor is the necessity of including ntstatus.h. MSDN indicates that it should have been ERROR_NOTIFY_ENUM_DIR. So I am wondering, is this a bug in the documentation or perhaps I am doing something wrong?
ERROR_NOTIFY_ENUM_DIRis defined in winerror.h:However, 1022 is 0x3FE. 0x10C is 268 instead, which is not an error code that
ReadDirectoryChangesW()is supposed to return. So ifReadDirectoryChangesW()is directly returningSTATUS_NOTIFY_ENUM_DIRinstead of translating it intoERROR_NOTIFY_ENUM_DIR, then that very well could be a bug inside ofReadDirectoryChangesW()itself, unless it is a typo in winerror.h instead.STATUS_NOTIFY_ENUM_DIRis used by some lower-level systems, likeNT_TRANSACT_NOTIFY_CHANGEandNtNotifyChangeDirectoryFile(), to indicate that the notification data is larger than the output buffer can hold. That is whatERROR_NOTIFY_ENUM_DIRmeans inReadDirectoryChangesW(), as stated in its own documentation.Some return values of other functions, like the
WaitFor...()family of functions, and OverlappedIO/IOCP functions, map directly toSTATUS_...codes internally, but are not documented as such because that is a private implementation detail. For example, if you look in winbase.h, there are a couple of dozen common return codes, likeWAIT_OBJECT_0,WAIT_IO_COMPLETION,STILL_ACTIVE, and variousEXCEPTION_..., that map directly toSTATUS_...values.That does not appear to be the case in this situation, though. According to MSDN,
STATUS_NOTIFY_ENUM_DIRis indeed supposed to map toERROR_NOTIFY_ENUM_DIR, so this would appear to be a bug: