占位符将始终具有Attribut`Archive`

时间:2019-04-29 13:01:00

标签: attributes file-attributes projfs

我在投影文件系统中为文件提供了不同的属性。 我在枚举回调以及占位符中都这样做:

        // GetDirectoryEnumerationCallback()
        PRJ_FILE_BASIC_INFO fileBasicInfo = { 0 };
        auto file = &holder->files[holder->index];
        fileBasicInfo.IsDirectory = file->IsDirectory;
        fileBasicInfo.FileSize = file->IsDirectory ? 0 : file->FileSize;
        fileBasicInfo.ChangeTime = file->ChangeTime;
        fileBasicInfo.CreationTime = file->CreationTime;
        fileBasicInfo.FileAttributes = file->FileAttributes;
        fileBasicInfo.LastAccessTime = file->LastAccessTime;
        fileBasicInfo.LastWriteTime = file->LastWriteTime;
        holder->index++;
        wprintf(L"Enumerator    (0x%08x)\n", fileBasicInfo.FileAttributes);
        //FILE_ATTRIBUTE_ARCHIVE
        if (holder->searchExpression.empty() || PrjFileNameMatch(file->Name, holder->searchExpression.c_str())) {
            hr = PrjFillDirEntryBuffer(file->Name,
                &fileBasicInfo,
                dirEntryBufferHandle);
            break;
        }

PRJ_PLACEHOLDER_INFO placeholderInfo = {};

    placeholderInfo.FileBasicInfo.IsDirectory = file.IsDirectory;
    placeholderInfo.FileBasicInfo.FileSize = file.IsDirectory ? 0 : file.FileSize;
    placeholderInfo.FileBasicInfo.ChangeTime = file.ChangeTime;
    placeholderInfo.FileBasicInfo.CreationTime = file.CreationTime;
    placeholderInfo.FileBasicInfo.FileAttributes = file.FileAttributes;
    placeholderInfo.FileBasicInfo.LastAccessTime = file.LastAccessTime;
    placeholderInfo.FileBasicInfo.LastWriteTime = file.LastWriteTime;

    wprintf(L"SendAttribute (0x%08x)\n", placeholderInfo.FileBasicInfo.FileAttributes);

    for (size_t i = 0; i < sizeof(file.Hash); i++)
        placeholderInfo.VersionInfo.ContentID[i] = wctob(file.Hash[i]);

    hr = PrjWritePlaceholderInfo(this->context,
        path.c_str(),
        &placeholderInfo,
        sizeof(placeholderInfo));

我使用以下属性0x00001000FILE_ATTRIBUTE_OFFLINE)和0x00000080FILE_ATTRIBUTE_NORMAL)。但是,当我使用Get-ItemPropertyattrib.exe时,它返回0x00000020FILE_ATTRIBUTE_ARCHIVE)或如果我尚未打开文件0x400020({{1} }。

从文档中看起来很简单。但是我无法正常工作。

0 个答案:

没有答案