Placeholder will always have Attribut `Archive`

0

I provide files with different Attributes in the projected file system. I do this in the enumeration callback and also for the placeholders:

        // 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;
        }

and

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));

I use following attributes 0x00001000 (FILE_ATTRIBUTE_OFFLINE) and 0x00000080 (FILE_ATTRIBUTE_NORMAL). However when the I use Get-ItemProperty or attrib.exe It returns 0x00000020 (FILE_ATTRIBUTE_ARCHIVE) or if I haven't opend the file yet 0x400020(FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS).

From the documentation it looks pretty simple. But I don't get it to work correct.

attributes
file-attributes
projfs
asked on Stack Overflow Apr 29, 2019 by lokimidgard

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0