From a23989370d2e2d50b7c99e58d12218ac5b370d0d Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Wed, 10 Oct 2001 22:13:26 +0000 Subject: [PATCH] Fixed the returned size in VfatGetFile...Information(). svn path=/trunk/; revision=2284 --- reactos/drivers/fs/vfat/dir.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reactos/drivers/fs/vfat/dir.c b/reactos/drivers/fs/vfat/dir.c index bfe6b5b8158..91cd912e0e1 100644 --- a/reactos/drivers/fs/vfat/dir.c +++ b/reactos/drivers/fs/vfat/dir.c @@ -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 * PROJECT: ReactOS kernel * FILE: services/fs/vfat/dir.c @@ -99,11 +101,11 @@ VfatGetFileNameInformation (PVFATFCB pFcb, { ULONG Length; 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; pInfo->FileNameLength = Length; 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, sizeof (WCHAR) * (pInfo->FileNameLength)); return STATUS_SUCCESS; @@ -118,11 +120,11 @@ VfatGetFileDirectoryInformation (PVFATFCB pFcb, unsigned long long AllocSize; ULONG Length; 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; pInfo->FileNameLength = Length; 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, sizeof (WCHAR) * (pInfo->FileNameLength)); // pInfo->FileIndex=; @@ -153,11 +155,11 @@ VfatGetFileFullDirectoryInformation (PVFATFCB pFcb, unsigned long long AllocSize; ULONG Length; 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; pInfo->FileNameLength = Length; 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, sizeof (WCHAR) * (pInfo->FileNameLength)); // pInfo->FileIndex=; @@ -189,11 +191,11 @@ VfatGetFileBothInformation (PVFATFCB pFcb, unsigned long long AllocSize; ULONG Length; 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; pInfo->FileNameLength = Length; 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, sizeof (WCHAR) * (pInfo->FileNameLength)); // pInfo->FileIndex=;