我只是在 WinRT 中处理一些文件管理 api。我在../Packages/myApp/LocalState/中成功创建了文件夹,但是当我尝试在该文件夹中创建新文件(CreateFile2)时,我得到了这个
error 4252: ERROR_NOT_SUPPORTED_IN_APPCONTAINER
This functionality is not supported in the context of an app container.
代码:
localFolder = L"C:\\Users\\Tomas\\AppData\\Local\\Packages\\myApp\\LocalState\\my";
CreateDirectory(localFolder.c_str(),NULL);
localFolder += L"\\MyFile.txt";
CREATEFILE2_EXTENDED_PARAMETERS pCreateExParams;
pCreateExParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
pCreateExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
pCreateExParams.lpSecurityAttributes = NULL;
pCreateExParams.hTemplateFile = NULL;
HANDLE myfile = CreateFile2(localFolder.c_str(), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, OPEN_ALWAYS, &pCreateExParams);
int error = GetLastError();
我做错了什么?我应该在清单中设置一些选项吗?感谢您的帮助