Null terminator fixes

svn path=/trunk/; revision=8292
This commit is contained in:
Jason Filby 2004-02-21 16:36:02 +00:00
parent 3cb945ba08
commit 63eaa13a61

View file

@ -1,4 +1,4 @@
/* $Id: volume.c,v 1.38 2004/01/23 21:16:03 ekohl Exp $ /* $Id: volume.c,v 1.39 2004/02/21 16:36:02 jfilby Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -21,7 +21,7 @@
#include <k32.h> #include <k32.h>
#define NDEBUG //#define NDEBUG
#include "../include/debug.h" #include "../include/debug.h"
@ -236,8 +236,8 @@ GetDiskFreeSpaceW(
else else
{ {
GetCurrentDirectoryW (MAX_PATH, RootPathName); GetCurrentDirectoryW (MAX_PATH, RootPathName);
RootPathName[3] = 0;
} }
RootPathName[3] = 0;
hFile = InternalOpenDirW(RootPathName, FALSE); hFile = InternalOpenDirW(RootPathName, FALSE);
if (INVALID_HANDLE_VALUE == hFile) if (INVALID_HANDLE_VALUE == hFile)
@ -263,6 +263,7 @@ GetDiskFreeSpaceW(
*lpNumberOfFreeClusters = FileFsSize.AvailableAllocationUnits.u.LowPart; *lpNumberOfFreeClusters = FileFsSize.AvailableAllocationUnits.u.LowPart;
*lpTotalNumberOfClusters = FileFsSize.TotalAllocationUnits.u.LowPart; *lpTotalNumberOfClusters = FileFsSize.TotalAllocationUnits.u.LowPart;
CloseHandle(hFile); CloseHandle(hFile);
return TRUE; return TRUE;
} }
@ -342,8 +343,8 @@ GetDiskFreeSpaceExW(
else else
{ {
GetCurrentDirectoryW (MAX_PATH, RootPathName); GetCurrentDirectoryW (MAX_PATH, RootPathName);
RootPathName[3] = 0;
} }
RootPathName[3] = 0;
hFile = InternalOpenDirW(RootPathName, FALSE); hFile = InternalOpenDirW(RootPathName, FALSE);
if (INVALID_HANDLE_VALUE == hFile) if (INVALID_HANDLE_VALUE == hFile)
@ -379,6 +380,7 @@ GetDiskFreeSpaceExW(
BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart; BytesPerCluster.QuadPart * FileFsSize.AvailableAllocationUnits.QuadPart;
CloseHandle(hFile); CloseHandle(hFile);
return TRUE; return TRUE;
} }
@ -620,12 +622,12 @@ GetVolumeInformationW(
if (!lpRootPathName || !wcscmp(lpRootPathName, L"")) if (!lpRootPathName || !wcscmp(lpRootPathName, L""))
{ {
GetCurrentDirectoryW (MAX_PATH, RootPathName); GetCurrentDirectoryW (MAX_PATH, RootPathName);
RootPathName[3] = 0;
} }
else else
{ {
wcsncpy (RootPathName, lpRootPathName, min(MAX_PATH, wcslen(lpRootPathName) + 1)); wcsncpy (RootPathName, lpRootPathName, 3);
} }
RootPathName[3] = 0;
hFile = InternalOpenDirW(RootPathName, FALSE); hFile = InternalOpenDirW(RootPathName, FALSE);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)