1360{
1376 WIN32_FIND_STREAM_DATA wfsdStreamInfo;
1380
1381
1382 ptrStartNode =
NULL;
1384 dwCount = 0;
1385 dwCountFiles = 0;
1386 dwCountDirs = 0;
1387 u64CountBytes = 0;
1388
1389
1391 if (ptrStartNode ==
NULL)
1392 {
1393 WARN(
"Cannot allocate memory for ptrStartNode!\n");
1394 return 1;
1395 }
1397 ptrNextNode = ptrStartNode;
1398
1399
1402 {
1403 do
1404 {
1405 if ((wfdFileInfo.dwFileAttributes & lpFlags->
stAttribs.dwAttribMask) ==
1407 {
1410 {
1411 WARN(
"Cannot allocate memory for ptrNextNode->ptrNext!\n");
1414 return 1;
1415 }
1416
1417
1419 &wfdFileInfo,
1421
1422
1424 {
1425 _tcslwr(ptrNextNode->
ptrNext->stInfo.stFindInfo.cAlternateFileName);
1427 }
1428
1429
1431
1432
1434 {
1435 if (!pFindFirstStreamW)
1436 {
1439 }
1440
1441
1442 if (pFindFirstStreamW && pFindNextStreamW)
1443 {
1444 hStreams = pFindFirstStreamW(wfdFileInfo.cFileName, FindStreamInfoStandard, &wfsdStreamInfo, 0);
1445 }
1446 else
1447 {
1449 ERR(
"FindFirstStreamW not supported!\n");
1450 }
1451
1453 {
1454
1455 ptrCurNode = &ptrNextNode->
ptrNext->stInfo.ptrHead;
1456 while (pFindNextStreamW(hStreams, &wfsdStreamInfo))
1457 {
1459 if (*ptrCurNode ==
NULL)
1460 {
1461 WARN(
"Cannot allocate memory for *ptrCurNode!\n");
1465 return 1;
1466 }
1467
1468 memcpy(&(*ptrCurNode)->stStreamInfo, &wfsdStreamInfo,
1469 sizeof(WIN32_FIND_STREAM_DATA));
1470
1471
1473 {
1474 _tcslwr((*ptrCurNode)->stStreamInfo.cStreamName);
1475 }
1476
1477 ptrCurNode = &(*ptrCurNode)->
ptrNext;
1478 }
1479
1482 }
1483 }
1484
1485
1486 ptrNextNode = ptrNextNode->
ptrNext;
1487 dwCount++;
1488
1489
1491 {
1492
1493 dwCountDirs++;
1494 }
1495 else
1496 {
1497
1498 dwCountFiles++;
1499 u64Temp.
HighPart = wfdFileInfo.nFileSizeHigh;
1500 u64Temp.
LowPart = wfdFileInfo.nFileSizeLow;
1502 }
1503 }
1506 }
1507
1508
1510
1511
1513 if (ptrFileArray ==
NULL)
1514 {
1515 WARN(
"Cannot allocate memory for ptrFileArray!\n");
1517 return 1;
1518 }
1519
1520
1521
1522
1523
1524 ptrNextNode = ptrStartNode;
1525 dwCount = 0;
1527 {
1528 ptrFileArray[dwCount] = &ptrNextNode->
ptrNext->stInfo;
1529 ptrNextNode = ptrNextNode->
ptrNext;
1530 dwCount++;
1531 }
1532
1533
1534 if (lpFlags->
stOrderBy.sCriteriaCount > 0)
1535 QsortFiles(ptrFileArray, 0, dwCount-1, lpFlags);
1536
1537
1538 cPathSep = pszFilePart[-1];
1539 pszFilePart[-1] =
_T(
'\0');
1541
1543 {
1545 dwCountFiles,
1546 dwCountDirs,
1547 u64CountBytes,
1548 lpFlags,
1550 }
1551 pszFilePart[-1] = cPathSep;
1552
1553
1555
1556
1558
1560 return 1;
1561
1562
1566
1567
1568
1569
1570
1571
1573 {
1574
1575 memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) *
sizeof(
TCHAR));
1576 _tcscpy(&szSubPath[pszFilePart - szFullPath],
_T(
"*.*"));
1577
1580 {
1581 do
1582 {
1583
1586 {
1587
1588 memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) *
sizeof(
TCHAR));
1589 _tcscpy(&szSubPath[pszFilePart - szFullPath], wfdFileInfo.cFileName);
1591 pszSubFilePart = &szSubPath[
_tcslen(szSubPath)];
1592 _tcscat(pszSubFilePart, pszFilePart);
1593
1594
1595 if (
DirList(szSubPath, pszSubFilePart, lpFlags) != 0)
1596 {
1598 return 1;
1599 }
1600 }
1602 }
1604 }
1605
1606 return 0;
1607}
static VOID DirNodeCleanup(PDIRFINDLISTNODE ptrStartNode, PDWORD pdwCount)
FORCEINLINE BOOL IsDotDirectory(IN LPCTSTR pszPath)
static VOID QsortFiles(PDIRFINDINFO ptrArray[], int i, int j, LPDIRSWITCHFLAGS lpFlags)
static VOID DirPrintFiles(PDIRFINDINFO ptrFiles[], DWORD dwCount, LPCTSTR szCurPath, LPDIRSWITCHFLAGS lpFlags)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
BOOL WINAPI FindClose(HANDLE hFindFile)
#define memcpy(s1, s2, n)
PDIRFINDSTREAMNODE ptrHead
struct _DIRFINDLISTNODE * ptrNext
struct _DIRFINDSTREAMNODE * ptrNext