Overview
Features
Download
Documentation
Community
Add-Ons & Services

file access permission in Poco::File::setLastModified

Please post support and help requests here.

file access permission in Poco::File::setLastModified

Postby allspace » 05 Feb 2014, 05:59

I think "File_ALL_ACCESS" is too much here. The result is: on Window 7, a normal user cannot call this function on a file he just created. It will result "Access denied".

The workaround here is: run the application in "Administrator" context.


void FileImpl::setLastModifiedImpl(const Timestamp& ts)
{
poco_assert (!_path.empty());

UInt32 low;
UInt32 high;
ts.toFileTimeNP(low, high);
FILETIME ft;
ft.dwLowDateTime = low;
ft.dwHighDateTime = high;
FileHandle fh(_path, _upath, FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
if (SetFileTime(fh.get(), 0, &ft, &ft) == 0)
handleLastErrorImpl(_path);
}
allspace
 
Posts: 1
Joined: 05 Feb 2014, 05:50

Return to Support

Who is online

Users browsing this forum: No registered users and 7 guests