added new PriorityNotificationQueue, TimedNotificationQueue; added File::isDevice()

This commit is contained in:
Guenter Obiltschnig
2009-04-14 10:38:52 +00:00
parent 98eb0eb532
commit 095401e8e4
36 changed files with 1718 additions and 141 deletions

View File

@@ -1,7 +1,7 @@
//
// File_WIN32.cpp
//
// $Id: //poco/1.3/Foundation/src/File_WIN32.cpp#8 $
// $Id: //poco/Main/Foundation/src/File_WIN32.cpp#24 $
//
// Library: Foundation
// Package: Filesystem
@@ -165,12 +165,7 @@ bool FileImpl::canExecuteImpl() const
bool FileImpl::isFileImpl() const
{
poco_assert (!_path.empty());
DWORD attr = GetFileAttributes(_path.c_str());
if (attr == 0xFFFFFFFF)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_DIRECTORY) == 0;
return !isDirectoryImpl() && !isDeviceImpl();
}
@@ -191,6 +186,20 @@ bool FileImpl::isLinkImpl() const
}
bool FileImpl::isDeviceImpl() const
{
poco_assert (!_path.empty());
FileHandle fh(_path, GENERIC_READ, 0, OPEN_EXISTING);
DWORD type = GetFileType(fh.get());
if (type == FILE_TYPE_CHAR)
return true;
else if (type == FILE_TYPE_UNKNOWN && GetLastError() != NO_ERROR)
handleLastErrorImpl(_path);
return false;
}
bool FileImpl::isHiddenImpl() const
{
poco_assert (!_path.empty());
@@ -234,7 +243,7 @@ void FileImpl::setLastModifiedImpl(const Timestamp& ts)
FILETIME ft;
ft.dwLowDateTime = low;
ft.dwHighDateTime = high;
FileHandle fh(_path, FILE_ALL_ACCESS, FILE_SHARE_WRITE, OPEN_EXISTING);
FileHandle fh(_path, FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
if (SetFileTime(fh.get(), 0, &ft, &ft) == 0)
handleLastErrorImpl(_path);
}
@@ -258,7 +267,7 @@ void FileImpl::setSizeImpl(FileSizeImpl size)
{
poco_assert (!_path.empty());
FileHandle fh(_path, GENERIC_WRITE, FILE_SHARE_WRITE, OPEN_EXISTING);
FileHandle fh(_path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
LARGE_INTEGER li;
li.QuadPart = size;
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == -1)