【发布时间】:2017-05-05 08:55:02
【问题描述】:
我使用 SetFileAttributesW 设置自定义文件属性,例如0x200008,并且SetFileAttributesW返回非零表示没有错误。但 GetFileAttributesW 检索文件属性忽略设置属性。
int main()
{
uint32_t magic = 0x200008;
DWORD attribute = GetFileAttributesW(L"test");
cout << attribute << endl;
if ((attribute & magic) == magic)
cout << "has magic" << endl;
else
{
attribute |= magic;
cout << attribute << endl;
}
cout << SetFileAttributesW(L"test", attribute) << " " << GetLastError();
cin.get();
return 0;
}
以及每次运行的输出
32
2097192
1 0
谁能帮帮我?
最好的。
【问题讨论】:
标签: c++ windows file-attributes