Fixed the returned size in VfatGetFile...Information().

svn path=/trunk/; revision=2284
This commit is contained in:
Hartmut Birr 2001-10-10 22:13:26 +00:00
parent b61f55deae
commit a23989370d

View file

@ -1,4 +1,6 @@
/* /*
* $Id: dir.c,v 1.20 2001/10/10 22:13:26 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: services/fs/vfat/dir.c * FILE: services/fs/vfat/dir.c
@ -99,11 +101,11 @@ VfatGetFileNameInformation (PVFATFCB pFcb,
{ {
ULONG Length; ULONG Length;
Length = vfat_wstrlen (pFcb->ObjectName); Length = vfat_wstrlen (pFcb->ObjectName);
if ((sizeof (FILE_DIRECTORY_INFORMATION) + Length) > BufferLength) if ((sizeof (FILE_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR)) > BufferLength)
return STATUS_BUFFER_OVERFLOW; return STATUS_BUFFER_OVERFLOW;
pInfo->FileNameLength = Length; pInfo->FileNameLength = Length;
pInfo->NextEntryOffset = pInfo->NextEntryOffset =
DWORD_ROUND_UP (sizeof (FILE_DIRECTORY_INFORMATION) + Length); DWORD_ROUND_UP (sizeof (FILE_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR));
memcpy (pInfo->FileName, pFcb->ObjectName, memcpy (pInfo->FileName, pFcb->ObjectName,
sizeof (WCHAR) * (pInfo->FileNameLength)); sizeof (WCHAR) * (pInfo->FileNameLength));
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -118,11 +120,11 @@ VfatGetFileDirectoryInformation (PVFATFCB pFcb,
unsigned long long AllocSize; unsigned long long AllocSize;
ULONG Length; ULONG Length;
Length = vfat_wstrlen (pFcb->ObjectName); Length = vfat_wstrlen (pFcb->ObjectName);
if ((sizeof (FILE_DIRECTORY_INFORMATION) + Length) > BufferLength) if ((sizeof (FILE_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR)) > BufferLength)
return STATUS_BUFFER_OVERFLOW; return STATUS_BUFFER_OVERFLOW;
pInfo->FileNameLength = Length; pInfo->FileNameLength = Length;
pInfo->NextEntryOffset = pInfo->NextEntryOffset =
DWORD_ROUND_UP (sizeof (FILE_DIRECTORY_INFORMATION) + Length); DWORD_ROUND_UP (sizeof (FILE_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR));
memcpy (pInfo->FileName, pFcb->ObjectName, memcpy (pInfo->FileName, pFcb->ObjectName,
sizeof (WCHAR) * (pInfo->FileNameLength)); sizeof (WCHAR) * (pInfo->FileNameLength));
// pInfo->FileIndex=; // pInfo->FileIndex=;
@ -153,11 +155,11 @@ VfatGetFileFullDirectoryInformation (PVFATFCB pFcb,
unsigned long long AllocSize; unsigned long long AllocSize;
ULONG Length; ULONG Length;
Length = vfat_wstrlen (pFcb->ObjectName); Length = vfat_wstrlen (pFcb->ObjectName);
if ((sizeof (FILE_FULL_DIRECTORY_INFORMATION) + Length) > BufferLength) if ((sizeof (FILE_FULL_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR)) > BufferLength)
return STATUS_BUFFER_OVERFLOW; return STATUS_BUFFER_OVERFLOW;
pInfo->FileNameLength = Length; pInfo->FileNameLength = Length;
pInfo->NextEntryOffset = pInfo->NextEntryOffset =
DWORD_ROUND_UP (sizeof (FILE_FULL_DIRECTORY_INFORMATION) + Length); DWORD_ROUND_UP (sizeof (FILE_FULL_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR));
memcpy (pInfo->FileName, pFcb->ObjectName, memcpy (pInfo->FileName, pFcb->ObjectName,
sizeof (WCHAR) * (pInfo->FileNameLength)); sizeof (WCHAR) * (pInfo->FileNameLength));
// pInfo->FileIndex=; // pInfo->FileIndex=;
@ -189,11 +191,11 @@ VfatGetFileBothInformation (PVFATFCB pFcb,
unsigned long long AllocSize; unsigned long long AllocSize;
ULONG Length; ULONG Length;
Length = vfat_wstrlen (pFcb->ObjectName); Length = vfat_wstrlen (pFcb->ObjectName);
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength) if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR)) > BufferLength)
return STATUS_BUFFER_OVERFLOW; return STATUS_BUFFER_OVERFLOW;
pInfo->FileNameLength = Length; pInfo->FileNameLength = Length;
pInfo->NextEntryOffset = pInfo->NextEntryOffset =
DWORD_ROUND_UP (sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length); DWORD_ROUND_UP (sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length * sizeof(WCHAR));
memcpy (pInfo->FileName, pFcb->ObjectName, memcpy (pInfo->FileName, pFcb->ObjectName,
sizeof (WCHAR) * (pInfo->FileNameLength)); sizeof (WCHAR) * (pInfo->FileNameLength));
// pInfo->FileIndex=; // pInfo->FileIndex=;