There are certain new APIs that take must match attributes in as parameters. Must match attributes are different from normal search attributes that are passed in. It consists of two sets of attributes: a search attribute, and another attribute called the must match attribute, which is an additional filter on the attributes retrieved from the media. The basic formula for this is as follows:
(((MustMatchAttr & MediaAttr) ^ MustMatchAttr) & FILE_ATTRIBUTE_MUSTMATCH) == 0
where FILE_ATTRIBUTE_MUSTMATCH = 0x3F.
What this algorithm basically does is to match only those entries whose media attributes have at least one of the bits in the MustMatchAttr set. For example, if the user passes in attributes of 0x1016, 0x16 is the search attribute and 0x10 is the must match attribute. The search operation thus finds all directories and files. However, the must match attribute filters this additionally and so only directories are considered matches and are returned on the API. Notice that attribute bits are matched, not the entire attribute value, that is, an entry with the attribute of 0x14 (hidden directory) will also be matched with a must match attribute of 0x1016. This also means that there is no way to specify finding files/directories without a certain attribute set, you can only match for entries with a certain attribute set.