--- mstools/samples/filer/enumdrv.c 2018/08/09 18:20:59 1.1 +++ mstools/samples/filer/enumdrv.c 2018/08/09 18:22:14 1.1.1.2 @@ -1,5 +1,10 @@ /**************************************************************************** * +* +* Microsoft Developer Support +* Copyright (c) 1992 Microsoft Corporation +* +* * PROGRAM: Enumdrv.C * * PURPOSE: Determines all drives in the system, both local and remote, @@ -13,6 +18,7 @@ * COMMENTS: * ****************************************************************************/ +#define STRICT #include #include #include "globals.h" @@ -141,7 +147,7 @@ void EnumDrives(LPDINFO *lplpRoot) } EnterCriticalSection(&gHeapCS); - lpDriveStrings = HeapAlloc( ghHeap, dwCount); + lpDriveStrings = HeapAlloc( ghHeap, dwCount + 1); // +1 for trailing NULL LeaveCriticalSection(&gHeapCS); if( lpDriveStrings == NULL){ @@ -150,7 +156,7 @@ void EnumDrives(LPDINFO *lplpRoot) ExitThread((DWORD)-2); } - if(dwCount != GetLogicalDriveStrings( dwCount, lpDriveStrings) ){ + if(dwCount < GetLogicalDriveStrings( dwCount, lpDriveStrings) ){ LeaveCriticalSection(&gDrvCS); ErrorMsg("EnumDrives: Drive String size Changed!"); ExitThread((DWORD)-3);