Commit 12bf7f1d authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

GetFileInformationByHandle() fails for pipe handles according to

MSDN, and also for serial handles (FILE_TYPE_CHAR in general ?).
parent 9005a21f
...@@ -557,16 +557,30 @@ DWORD WINAPI GetFileInformationByHandle( HANDLE hFile, ...@@ -557,16 +557,30 @@ DWORD WINAPI GetFileInformationByHandle( HANDLE hFile,
req->handle = hFile; req->handle = hFile;
if ((ret = !SERVER_CALL_ERR())) if ((ret = !SERVER_CALL_ERR()))
{ {
RtlSecondsSince1970ToTime( req->write_time, &info->ftCreationTime ); /* FIXME: which file types are supported ?
RtlSecondsSince1970ToTime( req->write_time, &info->ftLastWriteTime ); * Serial ports (FILE_TYPE_CHAR) are not,
RtlSecondsSince1970ToTime( req->access_time, &info->ftLastAccessTime ); * and MSDN also says that pipes are not supported.
info->dwFileAttributes = req->attr; * FILE_TYPE_REMOTE seems to be supported according to
info->dwVolumeSerialNumber = req->serial; * MSDN q234741.txt */
info->nFileSizeHigh = req->size_high; if ((req->type == FILE_TYPE_DISK)
info->nFileSizeLow = req->size_low; || (req->type == FILE_TYPE_REMOTE))
info->nNumberOfLinks = req->links; {
info->nFileIndexHigh = req->index_high; RtlSecondsSince1970ToTime( req->write_time, &info->ftCreationTime );
info->nFileIndexLow = req->index_low; RtlSecondsSince1970ToTime( req->write_time, &info->ftLastWriteTime );
RtlSecondsSince1970ToTime( req->access_time, &info->ftLastAccessTime );
info->dwFileAttributes = req->attr;
info->dwVolumeSerialNumber = req->serial;
info->nFileSizeHigh = req->size_high;
info->nFileSizeLow = req->size_low;
info->nNumberOfLinks = req->links;
info->nFileIndexHigh = req->index_high;
info->nFileIndexLow = req->index_low;
}
else
{
SetLastError(ERROR_NOT_SUPPORTED);
ret = 0;
}
} }
} }
SERVER_END_REQ; SERVER_END_REQ;
...@@ -621,7 +635,7 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name ) ...@@ -621,7 +635,7 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name )
DWORD WINAPI GetFileSize( HANDLE hFile, LPDWORD filesizehigh ) DWORD WINAPI GetFileSize( HANDLE hFile, LPDWORD filesizehigh )
{ {
BY_HANDLE_FILE_INFORMATION info; BY_HANDLE_FILE_INFORMATION info;
if (!GetFileInformationByHandle( hFile, &info )) return 0; if (!GetFileInformationByHandle( hFile, &info )) return -1;
if (filesizehigh) *filesizehigh = info.nFileSizeHigh; if (filesizehigh) *filesizehigh = info.nFileSizeHigh;
return info.nFileSizeLow; return info.nFileSizeLow;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment