1368{
1384 WIN32_FIND_STREAM_DATA wfsdStreamInfo;
1388
1389
1390 ptrStartNode =
NULL;
1392 dwCount = 0;
1393 dwCountFiles = 0;
1394 dwCountDirs = 0;
1395 u64CountBytes = 0;
1396
1397
1399 if (ptrStartNode ==
NULL)
1400 {
1401 WARN(
"Cannot allocate memory for ptrStartNode!\n");
1402 return 1;
1403 }
1405 ptrNextNode = ptrStartNode;
1406
1407
1410 {
1411 do
1412 {
1413 if ((wfdFileInfo.dwFileAttributes & lpFlags->
stAttribs.dwAttribMask) ==
1415 {
1418 {
1419 WARN(
"Cannot allocate memory for ptrNextNode->ptrNext!\n");
1422 return 1;
1423 }
1424
1425
1427 &wfdFileInfo,
1429
1430
1432 {
1433 _tcslwr(ptrNextNode->
ptrNext->stInfo.stFindInfo.cAlternateFileName);
1435 }
1436
1437
1439
1440
1442 {
1443 if (!pFindFirstStreamW)
1444 {
1447 }
1448
1449
1450 if (pFindFirstStreamW && pFindNextStreamW)
1451 {
1452 hStreams = pFindFirstStreamW(wfdFileInfo.cFileName, FindStreamInfoStandard, &wfsdStreamInfo, 0);
1453 }
1454 else
1455 {
1457 ERR(
"FindFirstStreamW not supported!\n");
1458 }
1459
1461 {
1462
1463 ptrCurNode = &ptrNextNode->
ptrNext->stInfo.ptrHead;
1464 while (pFindNextStreamW(hStreams, &wfsdStreamInfo))
1465 {
1467 if (*ptrCurNode ==
NULL)
1468 {
1469 WARN(
"Cannot allocate memory for *ptrCurNode!\n");
1473 return 1;
1474 }
1475
1476 memcpy(&(*ptrCurNode)->stStreamInfo, &wfsdStreamInfo,
1477 sizeof(WIN32_FIND_STREAM_DATA));
1478
1479
1481 {
1482 _tcslwr((*ptrCurNode)->stStreamInfo.cStreamName);
1483 }
1484
1485 ptrCurNode = &(*ptrCurNode)->
ptrNext;
1486 }
1487
1490 }
1491 }
1492
1493
1494 ptrNextNode = ptrNextNode->
ptrNext;
1495 dwCount++;
1496
1497
1499 {
1500
1501 dwCountDirs++;
1502 }
1503 else
1504 {
1505
1506 dwCountFiles++;
1507 u64Temp.
HighPart = wfdFileInfo.nFileSizeHigh;
1508 u64Temp.
LowPart = wfdFileInfo.nFileSizeLow;
1510 }
1511 }
1514 }
1515
1516
1518
1519
1521 if (ptrFileArray ==
NULL)
1522 {
1523 WARN(
"Cannot allocate memory for ptrFileArray!\n");
1525 return 1;
1526 }
1527
1528
1529
1530
1531
1532 ptrNextNode = ptrStartNode;
1533 dwCount = 0;
1535 {
1536 ptrFileArray[dwCount] = &ptrNextNode->
ptrNext->stInfo;
1537 ptrNextNode = ptrNextNode->
ptrNext;
1538 dwCount++;
1539 }
1540
1541
1542 if (lpFlags->
stOrderBy.sCriteriaCount > 0)
1543 QsortFiles(ptrFileArray, 0, dwCount-1, lpFlags);
1544
1545
1546 cPathSep = pszFilePart[-1];
1547 pszFilePart[-1] =
_T(
'\0');
1549
1551 {
1553 dwCountFiles,
1554 dwCountDirs,
1555 u64CountBytes,
1556 lpFlags,
1558 }
1559 pszFilePart[-1] = cPathSep;
1560
1561
1563
1564
1566
1568 return 1;
1569
1570
1574
1575
1576
1577
1578
1579
1581 {
1582
1583 memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) *
sizeof(
TCHAR));
1584 _tcscpy(&szSubPath[pszFilePart - szFullPath],
_T(
"*.*"));
1585
1588 {
1589 do
1590 {
1591
1594 {
1595
1596 memcpy(szSubPath, szFullPath, (pszFilePart - szFullPath) *
sizeof(
TCHAR));
1597 _tcscpy(&szSubPath[pszFilePart - szFullPath], wfdFileInfo.cFileName);
1599 pszSubFilePart = &szSubPath[
_tcslen(szSubPath)];
1600 _tcscat(pszSubFilePart, pszFilePart);
1601
1602
1603 if (
DirList(szSubPath, pszSubFilePart, lpFlags) != 0)
1604 {
1606 return 1;
1607 }
1608 }
1610 }
1612 }
1613
1614 return 0;
1615}
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