don't copy LARGE_INTEGER structs to FILETIME structs with memcpy, it works but it's confusing as they're different structures that happen to be identical.

svn path=/trunk/; revision=10792
This commit is contained in:
Thomas Bluemel 2004-09-06 15:56:25 +00:00
parent b1d9a8f8ff
commit a961785e1d
2 changed files with 57 additions and 42 deletions

View file

@ -1,4 +1,4 @@
/* $Id: file.c,v 1.56 2004/07/24 01:27:54 navaraf Exp $
/* $Id: file.c,v 1.57 2004/09/06 15:56:25 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -623,9 +623,15 @@ GetFileInformationByHandle(HANDLE hFile,
}
lpFileInformation->dwFileAttributes = (DWORD)FileBasic.FileAttributes;
memcpy(&lpFileInformation->ftCreationTime,&FileBasic.CreationTime,sizeof(LARGE_INTEGER));
memcpy(&lpFileInformation->ftLastAccessTime,&FileBasic.LastAccessTime,sizeof(LARGE_INTEGER));
memcpy(&lpFileInformation->ftLastWriteTime, &FileBasic.LastWriteTime,sizeof(LARGE_INTEGER));
lpFileInformation->ftCreationTime.dwHighDateTime = FileBasic.CreationTime.u.HighPart;
lpFileInformation->ftCreationTime.dwLowDateTime = FileBasic.CreationTime.u.LowPart;
lpFileInformation->ftLastAccessTime.dwHighDateTime = FileBasic.LastAccessTime.u.HighPart;
lpFileInformation->ftLastAccessTime.dwLowDateTime = FileBasic.LastAccessTime.u.LowPart;
lpFileInformation->ftLastWriteTime.dwHighDateTime = FileBasic.LastWriteTime.u.HighPart;
lpFileInformation->ftLastWriteTime.dwLowDateTime = FileBasic.LastWriteTime.u.LowPart;
errCode = NtQueryInformationFile(hFile,
&IoStatusBlock,

View file

@ -1,4 +1,4 @@
/* $Id: find.c,v 1.45 2004/08/28 22:07:51 navaraf Exp $
/* $Id: find.c,v 1.46 2004/09/06 15:56:25 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -350,15 +350,16 @@ FindFirstFileA (
/* copy data into WIN32_FIND_DATA structure */
lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes;
memcpy (&lpFindFileData->ftCreationTime,
&IData->pFileInfo->CreationTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastAccessTime,
&IData->pFileInfo->LastAccessTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastWriteTime,
&IData->pFileInfo->LastWriteTime,
sizeof(FILETIME));
lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart;
lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart;
lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart;
lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart;
lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart;
lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart;
lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart;
lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart;
@ -437,15 +438,16 @@ FindNextFileA (
/* copy data into WIN32_FIND_DATA structure */
lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes;
memcpy (&lpFindFileData->ftCreationTime,
&IData->pFileInfo->CreationTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastAccessTime,
&IData->pFileInfo->LastAccessTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastWriteTime,
&IData->pFileInfo->LastWriteTime,
sizeof(FILETIME));
lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart;
lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart;
lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart;
lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart;
lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart;
lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart;
lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart;
lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart;
@ -541,17 +543,19 @@ FindFirstFileW (
/* copy data into WIN32_FIND_DATA structure */
lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes;
memcpy (&lpFindFileData->ftCreationTime,
&IData->pFileInfo->CreationTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastAccessTime,
&IData->pFileInfo->LastAccessTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastWriteTime,
&IData->pFileInfo->LastWriteTime,
sizeof(FILETIME));
lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart;
lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart;
lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart;
lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart;
lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart;
lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart;
lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart;
lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart;
memcpy (lpFindFileData->cFileName,
IData->pFileInfo->FileName,
IData->pFileInfo->FileNameLength);
@ -592,18 +596,23 @@ FindNextFileW (
/* copy data into WIN32_FIND_DATA structure */
lpFindFileData->dwFileAttributes = IData->pFileInfo->FileAttributes;
memcpy (&lpFindFileData->ftCreationTime,
&IData->pFileInfo->CreationTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastAccessTime,
&IData->pFileInfo->LastAccessTime,
sizeof(FILETIME));
memcpy (&lpFindFileData->ftLastWriteTime,
&IData->pFileInfo->LastWriteTime,
sizeof(FILETIME));
lpFindFileData->ftCreationTime.dwHighDateTime = IData->pFileInfo->CreationTime.u.HighPart;
lpFindFileData->ftCreationTime.dwLowDateTime = IData->pFileInfo->CreationTime.u.LowPart;
lpFindFileData->ftLastAccessTime.dwHighDateTime = IData->pFileInfo->LastAccessTime.u.HighPart;
lpFindFileData->ftLastAccessTime.dwLowDateTime = IData->pFileInfo->LastAccessTime.u.LowPart;
lpFindFileData->ftLastWriteTime.dwHighDateTime = IData->pFileInfo->LastWriteTime.u.HighPart;
lpFindFileData->ftLastWriteTime.dwLowDateTime = IData->pFileInfo->LastWriteTime.u.LowPart;
lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart;
lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart;
memcpy (lpFindFileData->cFileName,
lpFindFileData->nFileSizeHigh = IData->pFileInfo->EndOfFile.u.HighPart;
lpFindFileData->nFileSizeLow = IData->pFileInfo->EndOfFile.u.LowPart;
memcpy (lpFindFileData->cFileName,
IData->pFileInfo->FileName,
IData->pFileInfo->FileNameLength);
lpFindFileData->cFileName[IData->pFileInfo->FileNameLength / sizeof(WCHAR)] = 0;