_strlwr(szPath);
lpnrLocal=(LPNETRESOURCE) GlobalAlloc(GPTR,cbBuffer);
do {
+ /* Reset lpnrLocal and cEntries before each call */
memset(lpnrLocal,0,cbBuffer);
+ cEntries = -1;
+
if ((res = WNetEnumResource(hEnum,&cEntries,lpnrLocal,&cbBuffer))==NO_ERROR)
{
for (DWORD i=0;i<cEntries;i++)
}
}
}
- } while (res!=ERROR_NO_MORE_ITEMS);
+ } while (res == NO_ERROR);
GlobalFree((HGLOBAL)lpnrLocal);
WNetCloseEnum(hEnum);
}
sprintf(szPath,"\\\\%s\\",szMachine);
_strlwr(szPath);
do {
+ /* Reset lpnrLocal and cEntries before each call */
memset(lpnrLocal,0,cbBuffer);
- if ((res = WNetEnumResource(hEnum,&cEntries,lpnrLocal,&cbBuffer))==NO_ERROR)
+ cEntries = -1;
+
+ if ((res = WNetEnumResource(hEnum,&cEntries,lpnrLocal,&cbBuffer))==NO_ERROR)
{
for (DWORD i=0;i<cEntries;i++)
{
nextname:;
}
}
- } while (res!=ERROR_NO_MORE_ITEMS);
+ } while (res == NO_ERROR);
GlobalFree((HGLOBAL)lpnrLocal);
WNetCloseEnum(hEnum);
sprintf(szPath,"\\\\%s\\all",szMachine);