diff --git a/src/treectl.c b/src/treectl.c index 2f3418d2..74566b57 100644 --- a/src/treectl.c +++ b/src/treectl.c @@ -1555,188 +1555,228 @@ TCWP_DrawItem( HWND hwndLB, HWND hWnd) { - INT x, y, dy; - INT nLevel; - HDC hdc; - UINT len; - RECT rc; - BOOL bHasFocus, bDrawSelected; - PDNODE pNode, pNTemp; - DWORD rgbText; - DWORD rgbBackground; - HBRUSH hBrush, hOld; - INT iBitmap; - DWORD view; - - - // +1 added since IsNetPath->GetTreePath->GetTreePathIndirect - // is recursive and adds extra '\' at end then strips it off - TCHAR szPath[MAXPATHLEN+1]; - - SIZE size; - - if (lpLBItem->itemID == (DWORD)-1) { - return; - } - - hdc = lpLBItem->hDC; - pNode = (PDNODE)lpLBItem->itemData; + INT x, y, dy; + INT nLevel; + HDC hdc; + UINT len; + RECT rc; + BOOL bHasFocus, bDrawSelected; + PDNODE pNode, pNTemp; + DWORD rgbText; + DWORD rgbBackground; + HBRUSH hBrush, hOld; + INT iBitmap; + DWORD view; + + + // +1 added since IsNetPath->GetTreePath->GetTreePathIndirect + // is recursive and adds extra '\' at end then strips it off + TCHAR szPath[MAXPATHLEN+1]; + + SIZE size; + + if (lpLBItem->itemID == (DWORD)-1) + { + return; + } - PreserveBitmapInRTL(hdc); + hdc = lpLBItem->hDC; + pNode = (PDNODE)lpLBItem->itemData; - /* - * Save the real extent. - */ - size.cx = GetRealExtent(pNode, NULL, szPath, &len); - size.cx += dyBorder; + PreserveBitmapInRTL(hdc); - rc = lpLBItem->rcItem; - rc.left = pNode->nLevels * dxText * 2; - rc.right = rc.left + dxFolder + size.cx + 4 * dyBorderx2; + /* + * Save the real extent. + */ + size.cx = GetRealExtent(pNode, NULL, szPath, &len); + size.cx += dyBorder; - if (lpLBItem->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)) - { - // draw the branches of the tree first + rc = lpLBItem->rcItem; + rc.left = pNode->nLevels * dxText * 2; + rc.right = rc.left + dxFolder + size.cx + 4 * dyBorderx2; - nLevel = pNode->nLevels; + if (lpLBItem->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)) + { + // draw the branches of the tree first - x = (nLevel * dxText * 2) - dxText + dyBorderx2; - dy = lpLBItem->rcItem.bottom - lpLBItem->rcItem.top; - y = lpLBItem->rcItem.top + (dy/2); + nLevel = pNode->nLevels; - if (hBrush = CreateSolidBrush(GetSysColor(COLOR_GRAYTEXT))) - { - hOld = SelectObject(hdc, hBrush); + x = (nLevel * dxText * 2) - dxText + dyBorderx2; + dy = lpLBItem->rcItem.bottom - lpLBItem->rcItem.top; + y = lpLBItem->rcItem.top + (dy/2); - if (pNode->pParent) + if (hBrush = CreateSolidBrush(GetSysColor(COLOR_GRAYTEXT))) { - /* Draw the horizontal line over to the (possible) folder. */ - PatBlt(hdc, x, y, dyText, dyBorder, PATCOPY); + hOld = SelectObject(hdc, hBrush); - /* Draw the top part of the vertical line. */ - PatBlt(hdc, x, lpLBItem->rcItem.top, dyBorder, dy/2, PATCOPY); + if (pNode->pParent) + { + /* Draw the horizontal line over to the (possible) folder. */ + PatBlt(hdc, x, y, dyText, dyBorder, PATCOPY); - /* If not the end of a node, draw the bottom part... */ - if (!(pNode->wFlags & TF_LASTLEVELENTRY)) - PatBlt(hdc, x, y+dyBorder, dyBorder, dy/2, PATCOPY); + /* Draw the top part of the vertical line. */ + PatBlt(hdc, x, lpLBItem->rcItem.top, dyBorder, dy/2, PATCOPY); - /* Draw the verticals on the left connecting other nodes. */ - pNTemp = pNode->pParent; - while (pNTemp) - { - nLevel--; - if (!(pNTemp->wFlags & TF_LASTLEVELENTRY)) - PatBlt(hdc, (nLevel * dxText * 2) - dxText + dyBorderx2, - lpLBItem->rcItem.top, dyBorder,dy, PATCOPY); + /* If not the end of a node, draw the bottom part... */ + if (!(pNode->wFlags & TF_LASTLEVELENTRY)) + { + PatBlt(hdc, x, y+dyBorder, dyBorder, dy/2, PATCOPY); + } - pNTemp = pNTemp->pParent; - } + /* Draw the verticals on the left connecting other nodes. */ + pNTemp = pNode->pParent; + while (pNTemp) + { + nLevel--; + if (!(pNTemp->wFlags & TF_LASTLEVELENTRY)) + PatBlt(hdc, (nLevel * dxText * 2) - dxText + dyBorderx2, + lpLBItem->rcItem.top, dyBorder,dy, PATCOPY); + + pNTemp = pNTemp->pParent; + } + } } if (hOld) - SelectObject(hdc, hOld); + SelectObject(hdc, hOld); DeleteObject(hBrush); - } + } - bDrawSelected = (lpLBItem->itemState & ODS_SELECTED); - bHasFocus = (GetFocus() == lpLBItem->hwndItem); + bDrawSelected = (lpLBItem->itemState & ODS_SELECTED); + bHasFocus = (GetFocus() == lpLBItem->hwndItem); - // draw text with the proper background or rect + // draw text with the proper background or rect - if (bHasFocus && bDrawSelected) - { - rgbText = SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); - rgbBackground = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); - } - else - { - // - // Set Text color of Compressed items to BLUE and Encrypted items - // to GREEN. - // - if (pNode->dwAttribs & ATTR_COMPRESSED) - { - rgbText = SetTextColor(hdc, RGB(0, 0, 255)); - } - else if (pNode->dwAttribs & ATTR_ENCRYPTED) - { - rgbText = SetTextColor(hdc, RGB(0, 192, 0)); - } - else - { - rgbText = SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); - } - rgbBackground = SetBkColor(hdc, GetSysColor(COLOR_WINDOW)); - } + if (bHasFocus && bDrawSelected) + { + rgbText = SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); + rgbBackground = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); + } + else + { + // + // Set Text color of Compressed items to BLUE and Encrypted items + // to GREEN. + // + if (pNode->dwAttribs & ATTR_COMPRESSED) + { + rgbText = SetTextColor(hdc, RGB(0, 0, 255)); + } + else if (pNode->dwAttribs & ATTR_ENCRYPTED) + { + rgbText = SetTextColor(hdc, RGB(0, 192, 0)); + } + else + { + rgbText = SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); + } + rgbBackground = SetBkColor(hdc, GetSysColor(COLOR_WINDOW)); + } - ExtTextOut(hdc, x + dxText + dxFolder + 2 * dyBorderx2, - y-(dyText/2), ETO_OPAQUE, &rc, - szPath, len, NULL); + ExtTextOut(hdc, x + dxText + dxFolder + 2 * dyBorderx2, + y-(dyText/2), ETO_OPAQUE, &rc, + szPath, len, NULL); - // draw the bitmaps as needed + // draw the bitmaps as needed - // HACK: Don't draw the bitmap when moving + // HACK: Don't draw the bitmap when moving - if (fShowSourceBitmaps || (hwndDragging != hwndLB) || !bDrawSelected) - { - // Blt the proper folder bitmap + if (fShowSourceBitmaps || (hwndDragging != hwndLB) || !bDrawSelected) + { + // Blt the proper folder bitmap - view = GetWindowLongPtr(GetParent(hWnd), GWL_VIEW); + view = GetWindowLongPtr(GetParent(hWnd), GWL_VIEW); - if (IsNetPath(pNode)) { + if (IsNetPath(pNode)) + { + if (bDrawSelected) + { + iBitmap = BM_IND_OPENDFS; + } + else + { + iBitmap = BM_IND_CLOSEDFS; + } + } + else if (!(view & VIEW_PLUSES) || !(pNode->wFlags & TF_HASCHILDREN)) + { + if (bDrawSelected) + { + if (pNode->dwAttribs & (ATTR_SYMBOLIC | ATTR_JUNCTION)) + { + iBitmap = BM_IND_OPENREPARSE; + } + else + { + iBitmap = BM_IND_OPEN; + } + } + else + { + if (pNode->dwAttribs & (ATTR_SYMBOLIC | ATTR_JUNCTION)) + { + iBitmap = BM_IND_CLOSEREPARSE; + } + else + { + iBitmap = BM_IND_CLOSE; + } + } + } + else + { + if (pNode->wFlags & TF_EXPANDED) + { if (bDrawSelected) - iBitmap = BM_IND_OPENDFS; + { + iBitmap = BM_IND_OPENMINUS; + } else - iBitmap = BM_IND_CLOSEDFS; - - } else if (!(view & VIEW_PLUSES) || !(pNode->wFlags & TF_HASCHILDREN)) { - if (bDrawSelected) { - if (pNode->dwAttribs & ATTR_REPARSE_POINT) - iBitmap = BM_IND_OPENREPARSE; - else - iBitmap = BM_IND_OPEN; - } else { - if (pNode->dwAttribs & ATTR_REPARSE_POINT) - iBitmap = BM_IND_CLOSEREPARSE; - else - iBitmap = BM_IND_CLOSE; - } - } else { - if (pNode->wFlags & TF_EXPANDED) { - if (bDrawSelected) - iBitmap = BM_IND_OPENMINUS; - else - iBitmap = BM_IND_CLOSEMINUS; - } else { - if (bDrawSelected) - iBitmap = BM_IND_OPENPLUS; - else - iBitmap = BM_IND_CLOSEPLUS; + { + iBitmap = BM_IND_CLOSEMINUS; } } - BitBlt(hdc, x + dxText + dyBorder, y-(dyFolder/2), dxFolder, dyFolder, - hdcMem, iBitmap * dxFolder, (bHasFocus && bDrawSelected) ? dyFolder : 0, SRCCOPY); - } + else + { + if (bDrawSelected) + { + iBitmap = BM_IND_OPENPLUS; + } + else + { + iBitmap = BM_IND_CLOSEPLUS; + } + } + } + BitBlt(hdc, x + dxText + dyBorder, y-(dyFolder/2), dxFolder, dyFolder, + hdcMem, iBitmap * dxFolder, (bHasFocus && bDrawSelected) ? dyFolder : 0, SRCCOPY); + } - // restore text stuff and draw rect as required + // restore text stuff and draw rect as required - if (bDrawSelected) { - if (bHasFocus) { - SetTextColor(hdc, rgbText); - SetBkColor(hdc, rgbBackground); - } else { - HBRUSH hbr; - if (hbr = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT))) { - FrameRect(hdc, &rc, hbr); - DeleteObject(hbr); - } - } - } - } + if (bDrawSelected) + { + if (bHasFocus) + { + SetTextColor(hdc, rgbText); + SetBkColor(hdc, rgbBackground); + } + else + { + HBRUSH hbr; + if (hbr = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT))) + { + FrameRect(hdc, &rc, hbr); + DeleteObject(hbr); + } + } + } - if (lpLBItem->itemAction == ODA_FOCUS) - DrawFocusRect(hdc, &rc); + if (lpLBItem->itemAction == ODA_FOCUS) + { + DrawFocusRect(hdc, &rc); + } } #ifdef TBCUSTSHOWSHARE @@ -2232,7 +2272,7 @@ TreeControlWndProc( (LPARAM)szPath); StripBackslash(szPath); } - + CharUpperBuff(szPath, 1); // make sure SetWindowLongPtr(hwndParent, GWL_TYPE, szPath[0] - TEXT('A')); diff --git a/src/wfdirrd.c b/src/wfdirrd.c index e4474eb1..94851cf9 100644 --- a/src/wfdirrd.c +++ b/src/wfdirrd.c @@ -648,414 +648,458 @@ CreateDTABlockWorker( HWND hwnd, HWND hwndDir) { - register LPWSTR pName; - PDOCBUCKET pDoc, pProgram; + register LPWSTR pName; + PDOCBUCKET pDoc, pProgram; - LFNDTA lfndta; + LFNDTA lfndta; - LPXDTALINK lpLinkLast; - LPXDTAHEAD lpHead; + LPXDTALINK lpLinkLast; + LPXDTAHEAD lpHead; - LPXDTA lpxdta; + LPXDTA lpxdta; - INT iBitmap; - DRIVE drive; + INT iBitmap; + DRIVE drive; - LPWSTR lpTemp; - HWND hwndTree; + LPWSTR lpTemp; + HWND hwndTree; - BOOL bCasePreserved; - BOOL bAbort; + BOOL bCasePreserved; + BOOL bAbort; - WCHAR szPath[MAXPATHLEN]; - WCHAR szLinkDest[MAXPATHLEN]; + WCHAR szPath[MAXPATHLEN]; + WCHAR szLinkDest[MAXPATHLEN]; - DWORD dwAttribs; - LPXDTALINK lpStart; + DWORD dwAttribs; + LPXDTALINK lpStart; - INT iError = 0; + INT iError = 0; - lpStart = MemNew(); + lpStart = MemNew(); - if (!lpStart) { - goto CDBMemoryErr; - } + if (!lpStart) + { + goto CDBMemoryErr; + } - // - // Checking abort and reading current dir must be atomic, - // since a directory change causes an abort. - // - EnterCriticalSection(&CriticalSectionDirRead); + // + // Checking abort and reading current dir must be atomic, + // since a directory change causes an abort. + // + EnterCriticalSection(&CriticalSectionDirRead); - GetMDIWindowText(hwnd, szPath, COUNTOF(szPath)); - SetWindowLongPtr(hwndDir, GWL_HDTAABORT, EDIRABORT_NULL); + GetMDIWindowText(hwnd, szPath, COUNTOF(szPath)); + SetWindowLongPtr(hwndDir, GWL_HDTAABORT, EDIRABORT_NULL); - LeaveCriticalSection(&CriticalSectionDirRead); + LeaveCriticalSection(&CriticalSectionDirRead); - dwAttribs = GetWindowLongPtr(hwnd, GWL_ATTRIBS); + dwAttribs = GetWindowLongPtr(hwnd, GWL_ATTRIBS); - // - // get the drive index assuming path is - // fully qualified... - // - drive = DRIVEID(szPath); - bCasePreserved = IsCasePreservedDrive(drive); - - lpHead = MemLinkToHead(lpStart); - lpLinkLast = lpStart; + // + // get the drive index assuming path is + // fully qualified... + // + drive = DRIVEID(szPath); + bCasePreserved = IsCasePreservedDrive(drive); - RestartOverFindFirst: - if (!WFFindFirst(&lfndta, szPath, dwAttribs & ATTR_ALL)) { - - // - // Try again! But first, see if the directory was invalid! - // - if (ERROR_PATH_NOT_FOUND == lfndta.err) { - - iError = IDS_BADPATHMSG; - goto InvalidDirectory; - } + lpHead = MemLinkToHead(lpStart); + lpLinkLast = lpStart; - if (!IsTheDiskReallyThere(hwndDir, szPath, FUNC_EXPAND, FALSE)) { - if (IsRemoteDrive(drive)) - iError = IDS_DRIVENOTAVAILABLE; - goto CDBDiskGone; - } +RestartOverFindFirst: + if (!WFFindFirst(&lfndta, szPath, dwAttribs & ATTR_ALL)) + { + // + // Try again! But first, see if the directory was invalid! + // + if (ERROR_PATH_NOT_FOUND == lfndta.err) + { + iError = IDS_BADPATHMSG; + goto InvalidDirectory; + } - // - // break out of this loop if we were returned something - // other than PATHNOTFOUND - // - if (!WFFindFirst(&lfndta, szPath, dwAttribs & ATTR_ALL)) { + if (!IsTheDiskReallyThere(hwndDir, szPath, FUNC_EXPAND, FALSE)) + { + if (IsRemoteDrive(drive)) + iError = IDS_DRIVENOTAVAILABLE; + goto CDBDiskGone; + } - switch (lfndta.err) { - case ERROR_PATH_NOT_FOUND: + // + // break out of this loop if we were returned something + // other than PATHNOTFOUND + // + if (!WFFindFirst(&lfndta, szPath, dwAttribs & ATTR_ALL)) + { + switch (lfndta.err) + { + case ERROR_PATH_NOT_FOUND: InvalidDirectory: - // - // LATER: fix this so that it comes up only - // when not switching x: from \\x\x to \\y\y - // - // If the path is not found, but the disk is there, then go to - // the root and try again; if already at the root, then exit - // - if (!(lpTemp=StrRChr(szPath, NULL, CHAR_BACKSLASH)) || - (lpTemp - szPath <= 2)) { - - goto CDBDiskGone; - } - - if (hwndTree=HasTreeWindow(hwnd)) { - - // Check if it is a Reparse Point - lpTemp[0] = '\0'; - DWORD attr = GetFileAttributes(szPath); - lpTemp[0] = CHAR_BACKSLASH; - if (attr & ATTR_REPARSE_POINT) { - // For dead Reparse Points just tell that the directory could not be read - break; - } else { - // - // If we changed dirs, and there is a tree window, set the - // dir to the root and collapse it - // Note that lpTemp-szPath>2, szPath[3] is not in the file spec - // - szPath[3] = CHAR_NULL; - SendMessage(hwndTree, TC_SETDIRECTORY, 0, (LPARAM)szPath); - SendMessage(hwndTree, TC_COLLAPSELEVEL, 0, 0L); -Fail: - MemDelete(lpStart); - return NULL; - } + // + // LATER: fix this so that it comes up only + // when not switching x: from \\x\x to \\y\y + // + // If the path is not found, but the disk is there, then go to + // the root and try again; if already at the root, then exit + // + if (!(lpTemp=StrRChr(szPath, NULL, CHAR_BACKSLASH)) || + (lpTemp - szPath <= 2)) + { + goto CDBDiskGone; + } + + if (hwndTree=HasTreeWindow(hwnd)) + { + // Check if it is a Reparse Point + lpTemp[0] = '\0'; + DWORD attr = GetFileAttributes(szPath); + lpTemp[0] = CHAR_BACKSLASH; + if (attr & ATTR_REPARSE_POINT) + { + // For dead Reparse Points just tell that the directory could not be read + break; + } + else + { + // + // If we changed dirs, and there is a tree window, set the + // dir to the root and collapse it + // Note that lpTemp-szPath>2, szPath[3] is not in the file spec + // + szPath[3] = CHAR_NULL; + SendMessage(hwndTree, TC_SETDIRECTORY, 0, (LPARAM)szPath); + SendMessage(hwndTree, TC_COLLAPSELEVEL, 0, 0L); + Fail: + MemDelete(lpStart); + return NULL; + } + } + + lstrcpy(szPath+3, lpTemp+1); + + SendMessage(hwndDir, + FS_CHANGEDISPLAY, + CD_PATH | CD_ALLOWABORT, + (LPARAM)szPath); + + goto Fail; + + case ERROR_FILE_NOT_FOUND: + case ERROR_NO_MORE_FILES: + + break; + + case ERROR_ACCESS_DENIED: + { + DWORD tag = DecodeReparsePoint(szPath, NULL, szLinkDest, COUNTOF(szLinkDest)); + if (tag != IO_REPARSE_TAG_RESERVED_ZERO) + { + lstrcpy(szPath, szLinkDest); + AppendToPath(szPath, szStarDotStar); + goto RestartOverFindFirst; + } + else + { + iError = IDS_NOACCESSDIR; + } } + break; - lstrcpy(szPath+3, lpTemp+1); + default: + { + WCHAR szText[MAXMESSAGELEN]; + WCHAR szTitle[MAXTITLELEN]; - SendMessage(hwndDir, - FS_CHANGEDISPLAY, - CD_PATH | CD_ALLOWABORT, - (LPARAM)szPath); + iError = IDS_COPYERROR + FUNC_EXPAND; - goto Fail; + LoadString(hAppInstance, + IDS_COPYERROR+FUNC_EXPAND, + szTitle, + COUNTOF(szTitle)); - case ERROR_FILE_NOT_FOUND: - case ERROR_NO_MORE_FILES: + FormatError(TRUE, szText, COUNTOF(szText), lfndta.err); + MessageBox(hwndDir, + szText, + szTitle, + MB_OK|MB_ICONEXCLAMATION|MB_APPLMODAL); + } break; + } + } + } + + // + // Find length of directory and trailing backslash. + // + if (!(lpTemp=StrRChr(szPath, NULL, CHAR_BACKSLASH))) + { + goto CDBDiskGone; + } + + // + // Always show .. if this is not the root directory. + // + if ((lpTemp - szPath > 3) && (dwAttribs & ATTR_DIR)) + { + // + // Add a DTA to the list. + // + lpHead->dwEntries++; + + lpxdta = MemAdd(&lpLinkLast, 0, 0); + + if (!lpxdta) + { + goto CDBMemoryErr; + } + + // + // Fill the new DTA with a fudged ".." entry. + // + lpxdta->dwAttrs = ATTR_DIR | ATTR_PARENT; + lpxdta->byBitmap = BM_IND_DIRUP; + lpxdta->pDocB = NULL; + + + MemGetFileName(lpxdta)[0] = CHAR_NULL; + MemGetAlternateFileName(lpxdta)[0] = CHAR_NULL; + + // + // Date time size name not set since they are ignored + // + } + + if (lfndta.err) + { + goto CDBDiskGone; + } + + while (TRUE) + { + pName = lfndta.fd.cFileName; + + // + // be safe, zero unused DOS dta bits + // + lfndta.fd.dwFileAttributes &= (ATTR_USED | ATTR_JUNCTION | ATTR_SYMBOLIC); + + // + // filter unwanted stuff here based on current view settings + // + pDoc = NULL; + pProgram = NULL; + if (!(lfndta.fd.dwFileAttributes & ATTR_DIR)) + { + pProgram = IsProgramFile(pName); + pDoc = IsDocument(pName); - case ERROR_ACCESS_DENIED: - { - DWORD tag = DecodeReparsePoint(szPath, NULL, szLinkDest, COUNTOF(szLinkDest)); - if (tag != IO_REPARSE_TAG_RESERVED_ZERO) + // + // filter programs and documents + // + if (!(dwAttribs & ATTR_PROGRAMS) && pProgram) + goto CDBCont; + if (!(dwAttribs & ATTR_DOCS) && pDoc) + goto CDBCont; + if (!(dwAttribs & ATTR_OTHER) && !(pProgram || pDoc)) + goto CDBCont; + } + else if (lfndta.fd.dwFileAttributes & ATTR_JUNCTION) + { + if (!(dwAttribs & ATTR_JUNCTION)) + goto CDBCont; + } + + // + // figure out the bitmap type here + // + if (lfndta.fd.dwFileAttributes & ATTR_DIR) + { + // + // ignore "." and ".." directories + // + if (ISDOTDIR(pName)) + { + goto CDBCont; + } + + // NOTE: Reparse points are directories + + if (IsNetDir(szPath,pName)) { - lstrcpy(szPath, szLinkDest); - AppendToPath(szPath, szStarDotStar); - goto RestartOverFindFirst; + iBitmap = BM_IND_CLOSEDFS; } else { - iError = IDS_NOACCESSDIR; + if (lfndta.fd.dwFileAttributes & (ATTR_SYMBOLIC | ATTR_JUNCTION)) + { + iBitmap = BM_IND_CLOSEREPARSE; + } + else + { + iBitmap = BM_IND_CLOSE; + } } - } - break; - - default: + } + else if (lfndta.fd.dwFileAttributes & (ATTR_HIDDEN | ATTR_SYSTEM)) + { + iBitmap = BM_IND_RO; + } + else if (pProgram) + { + iBitmap = BM_IND_APP; + } + else if (pDoc) + { + iBitmap = BM_IND_DOC; + } + else + { + if (lfndta.fd.dwFileAttributes & (ATTR_SYMBOLIC | ATTR_JUNCTION)) { - WCHAR szText[MAXMESSAGELEN]; - WCHAR szTitle[MAXTITLELEN]; - - iError = IDS_COPYERROR + FUNC_EXPAND; - - LoadString(hAppInstance, - IDS_COPYERROR+FUNC_EXPAND, - szTitle, - COUNTOF(szTitle)); - - FormatError(TRUE, szText, COUNTOF(szText), lfndta.err); - - MessageBox(hwndDir, - szText, - szTitle, - MB_OK|MB_ICONEXCLAMATION|MB_APPLMODAL); + iBitmap = BM_IND_FILREPARSE; } - break; - } - } - } - - // - // Find length of directory and trailing backslash. - // - if (!(lpTemp=StrRChr(szPath, NULL, CHAR_BACKSLASH))) - goto CDBDiskGone; - - // - // Always show .. if this is not the root directory. - // - if ((lpTemp - szPath > 3) && (dwAttribs & ATTR_DIR)) { - - // - // Add a DTA to the list. - // - lpHead->dwEntries++; - - lpxdta = MemAdd(&lpLinkLast, 0, 0); - - if (!lpxdta) - goto CDBMemoryErr; - - // - // Fill the new DTA with a fudged ".." entry. - // - lpxdta->dwAttrs = ATTR_DIR | ATTR_PARENT; - lpxdta->byBitmap = BM_IND_DIRUP; - lpxdta->pDocB = NULL; - - - MemGetFileName(lpxdta)[0] = CHAR_NULL; - MemGetAlternateFileName(lpxdta)[0] = CHAR_NULL; - - // - // Date time size name not set since they are ignored - // - } - - if (lfndta.err) - goto CDBDiskGone; - - while (TRUE) { - - pName = lfndta.fd.cFileName; - - // - // be safe, zero unused DOS dta bits - // - lfndta.fd.dwFileAttributes &= (ATTR_USED | ATTR_JUNCTION | ATTR_SYMBOLIC); - - // - // filter unwanted stuff here based on current view settings - // - pDoc = NULL; - pProgram = NULL; - if (!(lfndta.fd.dwFileAttributes & ATTR_DIR)) { - - pProgram = IsProgramFile(pName); - pDoc = IsDocument(pName); - - // - // filter programs and documents - // - if (!(dwAttribs & ATTR_PROGRAMS) && pProgram) - goto CDBCont; - if (!(dwAttribs & ATTR_DOCS) && pDoc) - goto CDBCont; - if (!(dwAttribs & ATTR_OTHER) && !(pProgram || pDoc)) - goto CDBCont; - } - else if (lfndta.fd.dwFileAttributes & ATTR_JUNCTION) { - if (!(dwAttribs & ATTR_JUNCTION)) - goto CDBCont; - } - - // - // figure out the bitmap type here - // - if (lfndta.fd.dwFileAttributes & ATTR_DIR) { - - // - // ignore "." and ".." directories - // - if (ISDOTDIR(pName)) { - goto CDBCont; - } - - // NOTE: Reparse points are directories - - if (IsNetDir(szPath,pName)) - iBitmap = BM_IND_CLOSEDFS; - else - { - if (lfndta.fd.dwFileAttributes & ATTR_REPARSE_POINT) - iBitmap = BM_IND_CLOSEREPARSE; else - iBitmap = BM_IND_CLOSE; - } - } else if (lfndta.fd.dwFileAttributes & (ATTR_HIDDEN | ATTR_SYSTEM)) { - iBitmap = BM_IND_RO; - } else if (pProgram) { - iBitmap = BM_IND_APP; - } else if (pDoc) { - iBitmap = BM_IND_DOC; - } else { - if (lfndta.fd.dwFileAttributes & ATTR_REPARSE_POINT) - iBitmap = BM_IND_FILREPARSE; - else - iBitmap = BM_IND_FIL; - } + { + iBitmap = BM_IND_FIL; + } + } - lpxdta = MemAdd(&lpLinkLast, - lstrlen(pName), - lstrlen(lfndta.fd.cAlternateFileName)); + lpxdta = MemAdd(&lpLinkLast, + lstrlen(pName), + lstrlen(lfndta.fd.cAlternateFileName)); - if (!lpxdta) - goto CDBMemoryErr; + if (!lpxdta) + { + goto CDBMemoryErr; + } - lpHead->dwEntries++; + lpHead->dwEntries++; - lpxdta->dwAttrs = lfndta.fd.dwFileAttributes; - lpxdta->ftLastWriteTime = lfndta.fd.ftLastWriteTime; + lpxdta->dwAttrs = lfndta.fd.dwFileAttributes; + lpxdta->ftLastWriteTime = lfndta.fd.ftLastWriteTime; - // - // files > 2^63 will come out negative, so tough. - // (WIN32_FIND_DATA.nFileSizeHigh is not signed, but - // LARGE_INTEGER is) - // - lpxdta->qFileSize.LowPart = lfndta.fd.nFileSizeLow; - lpxdta->qFileSize.HighPart = lfndta.fd.nFileSizeHigh; + // + // files > 2^63 will come out negative, so tough. + // (WIN32_FIND_DATA.nFileSizeHigh is not signed, but + // LARGE_INTEGER is) + // + lpxdta->qFileSize.LowPart = lfndta.fd.nFileSizeLow; + lpxdta->qFileSize.HighPart = lfndta.fd.nFileSizeHigh; - lpxdta->byBitmap = iBitmap; - lpxdta->pDocB = pDoc; // even if program, use extension list for icon to display + lpxdta->byBitmap = iBitmap; + lpxdta->pDocB = pDoc; // even if program, use extension list for icon to display - if (IsLFN(pName)) { - lpxdta->dwAttrs |= ATTR_LFN; - } + if (IsLFN(pName)) + { + lpxdta->dwAttrs |= ATTR_LFN; + } - if (!bCasePreserved) - lpxdta->dwAttrs |= ATTR_LOWERCASE; + if (!bCasePreserved) + { + lpxdta->dwAttrs |= ATTR_LOWERCASE; + } - lstrcpy(MemGetFileName(lpxdta), pName); - lstrcpy(MemGetAlternateFileName(lpxdta), lfndta.fd.cAlternateFileName); + lstrcpy(MemGetFileName(lpxdta), pName); + lstrcpy(MemGetAlternateFileName(lpxdta), lfndta.fd.cAlternateFileName); - lpHead->dwTotalCount++; - (lpHead->qTotalSize).QuadPart = (lpxdta->qFileSize).QuadPart + - (lpHead->qTotalSize).QuadPart; + lpHead->dwTotalCount++; + (lpHead->qTotalSize).QuadPart = (lpxdta->qFileSize).QuadPart + + (lpHead->qTotalSize).QuadPart; CDBCont: - if (bDirReadRebuildDocString) { + if (bDirReadRebuildDocString) + { Abort: - WFFindClose(&lfndta); - MemDelete(lpStart); - - return NULL; - } + WFFindClose(&lfndta); + MemDelete(lpStart); + return NULL; + } - if (bDirReadAbort) { - EnterCriticalSection(&CriticalSectionDirRead); + if (bDirReadAbort) + { + EnterCriticalSection(&CriticalSectionDirRead); - bAbort = ((GetWindowLongPtr(hwndDir, - GWL_HDTAABORT) & (EDIRABORT_WINDOWCLOSE| - EDIRABORT_READREQUEST)) || - GetWindowLongPtr(hwndDir, GWL_HDTA)); + bAbort = ((GetWindowLongPtr(hwndDir, + GWL_HDTAABORT) & (EDIRABORT_WINDOWCLOSE| + EDIRABORT_READREQUEST)) || + GetWindowLongPtr(hwndDir, GWL_HDTA)); - LeaveCriticalSection(&CriticalSectionDirRead); + LeaveCriticalSection(&CriticalSectionDirRead); - if (bAbort) - goto Abort; - } + if (bAbort) + { + goto Abort; + } + } - if (!WFFindNext(&lfndta)) { - break; - } - } + if (!WFFindNext(&lfndta)) + { + break; + } + } - WFFindClose(&lfndta); + WFFindClose(&lfndta); CDBDiskGone: - // - // If no error, but no entries then no files - // - if (!iError && !lpHead->dwEntries) - iError = IDS_NOFILES; + // + // If no error, but no entries then no files + // + if (!iError && !lpHead->dwEntries) + { + iError = IDS_NOFILES; + } - goto Done; + goto Done; CDBMemoryErr: - WFFindClose(&lfndta); + WFFindClose(&lfndta); - MyMessageBox(hwndFrame, - IDS_OOMTITLE, - IDS_OOMREADINGDIRMSG, - MB_OK | MB_ICONEXCLAMATION); + MyMessageBox(hwndFrame, + IDS_OOMTITLE, + IDS_OOMREADINGDIRMSG, + MB_OK | MB_ICONEXCLAMATION); - // - // !! BUGBUG !! - // - // What should the error code be? - // - iError = 0; + // + // !! BUGBUG !! + // + // What should the error code be? + // + iError = 0; Done: - if (iError) { - MemDelete(lpStart); - lpStart = NULL; - } - - SetLBFont(hwndDir, - GetDlgItem(hwndDir, IDCW_LISTBOX), - hFont, - GetWindowLongPtr(hwnd, GWL_VIEW), - lpStart); - - R_Space(drive); - U_Space(drive); - - if (SendMessage(hwndDir, - FS_DIRREADDONE, - (WPARAM)iError, - (LPARAM)lpStart) != (LRESULT)lpStart) { - - MemDelete(lpStart); - lpStart = NULL; - } - - return lpStart; + if (iError) + { + MemDelete(lpStart); + lpStart = NULL; + } + + SetLBFont(hwndDir, + GetDlgItem(hwndDir, IDCW_LISTBOX), + hFont, + GetWindowLongPtr(hwnd, GWL_VIEW), + lpStart); + + R_Space(drive); + U_Space(drive); + + if (SendMessage(hwndDir, + FS_DIRREADDONE, + (WPARAM)iError, + (LPARAM)lpStart) != (LRESULT)lpStart) + { + MemDelete(lpStart); + lpStart = NULL; + } + + return lpStart; } diff --git a/src/wfsearch.c b/src/wfsearch.c index a96b0d65..73d619e9 100644 --- a/src/wfsearch.c +++ b/src/wfsearch.c @@ -139,279 +139,308 @@ SearchList( INT iFileCount, BOOL bRoot) { - INT iRetVal; - SIZE size; - BOOL bFound; - LPWSTR pszNewPath; - LPWSTR pszNextFile; - LFNDTA lfndta; - LPXDTA lpxdta; - - HDC hdc; - HANDLE hOld; - DWORD dwTimeNow; - - BOOL bLowercase; - WCHAR szTemp[MAXPATHLEN]; + INT iRetVal; + SIZE size; + BOOL bFound; + LPWSTR pszNewPath; + LPWSTR pszNextFile; + LFNDTA lfndta; + LPXDTA lpxdta; - BOOL bLFN; - DWORD dwAttrs; - INT iBitmap; + HDC hdc; + HANDLE hOld; + DWORD dwTimeNow; - // - // hack: setup ATTR_LOWERCASE if a letter'd (NON-unc) drive - // LATER: do GetVolumeInfo for UNC too! - // + BOOL bLowercase; + WCHAR szTemp[MAXPATHLEN]; - bLowercase = (wTextAttribs & TA_LOWERCASEALL) || - ((wTextAttribs & TA_LOWERCASE) && !SearchInfo.bCasePreserved); + BOOL bLFN; + DWORD dwAttrs; + INT iBitmap; - dwTimeNow = GetTickCount(); + // + // hack: setup ATTR_LOWERCASE if a letter'd (NON-unc) drive + // LATER: do GetVolumeInfo for UNC too! + // - if (dwTimeNow > dwLastUpdateTime+1000) { - dwLastUpdateTime = dwTimeNow; + bLowercase = (wTextAttribs & TA_LOWERCASEALL) || + ((wTextAttribs & TA_LOWERCASE) && !SearchInfo.bCasePreserved); - SearchInfo.iDirsRead = iDirsRead; - SearchInfo.iFileCount = iFileCount; + dwTimeNow = GetTickCount(); - PostMessage(hwndFrame, FS_SEARCHUPDATE, iDirsRead, iFileCount); - } + if (dwTimeNow > dwLastUpdateTime+1000) + { + dwLastUpdateTime = dwTimeNow; - iDirsRead++; + SearchInfo.iDirsRead = iDirsRead; + SearchInfo.iFileCount = iFileCount; - if (!*plpStart) { - - *plpStart = MemNew(); - - if (!*plpStart) { -MemoryError: - SearchInfo.dwError = ERROR_NOT_ENOUGH_MEMORY; - SearchInfo.eStatus = SEARCH_ERROR; - return iFileCount; - } - - // - // Never shows altname - // - MemLinkToHead(*plpStart)->dwAlternateFileNameExtent = 0; - - SetWindowLongPtr(GetParent(hwndLB), GWL_HDTA, (LPARAM)*plpStart); - SearchInfo.lpStart = *plpStart; - } - - // - // allocate the buffer for this level - // - pszNewPath = (LPWSTR)LocalAlloc(LPTR, ByteCountOf(lstrlen(szPath) + MAXFILENAMELEN + 2)); - - if (!pszNewPath) { - goto MemoryError; - } - - lstrcpy(pszNewPath, szPath); - AddBackslash(pszNewPath); - - pszNextFile = pszNewPath + lstrlen(pszNewPath); - lstrcpy(pszNextFile, szFileSpec); - - bFound = WFFindFirst(&lfndta, pszNewPath, ATTR_ALL); - - hdc = GetDC(hwndLB); - hOld = SelectObject(hdc, hFont); - - // - // Ignore file not found errors AND access denied errors - // AND PATH_NOT_FOUND when not in the root - // - - if (!bFound && ERROR_FILE_NOT_FOUND != lfndta.err && - (bRoot || - ERROR_ACCESS_DENIED != lfndta.err && - ERROR_PATH_NOT_FOUND != lfndta.err && - ERROR_INVALID_NAME != lfndta.err)) { - - SearchInfo.eStatus = SEARCH_ERROR; - SearchInfo.dwError = lfndta.err; - bRecurse = FALSE; - - goto SearchCleanup; - } - - while (bFound) { - - // - // allow escape to exit - // - if (SearchInfo.bCancel) { - - bRecurse = FALSE; - break; - } - - // default ftSince is 0 and so normally this will be true - bFound = CompareFileTime(&SearchInfo.ftSince, &lfndta.fd.ftLastWriteTime) < 0; - - // if we otherwise match, but shouldn't include directories in the output, skip - if (bFound && !bIncludeSubdirs && (lfndta.fd.dwFileAttributes & ATTR_DIR) != 0) - { - bFound = FALSE; - } - - // - // Make sure this matches date (if specified) and is not a "." or ".." directory - // - if (bFound && !ISDOTDIR(lfndta.fd.cFileName)) { - - lstrcpy(pszNextFile, lfndta.fd.cFileName); - - // Warning: was OemToChar(pszNewPath, szMessage); - // but taken out since no translation necessary. - // Here on out _was_ using szMessage - // (Multithreaded=> szMessage usage BAD) - - bLFN = IsLFN(lfndta.fd.cFileName); - - if (bLowercase) { - lstrcpy(szTemp, pszNewPath); - CharLower(szTemp); - - GetTextExtentPoint32(hdc, szTemp, lstrlen(szTemp), &size); - } else { - GetTextExtentPoint32(hdc, pszNewPath, lstrlen(pszNewPath), &size); - } + PostMessage(hwndFrame, FS_SEARCHUPDATE, iDirsRead, iFileCount); + } - maxExt = max(size.cx,maxExt); + iDirsRead++; - lpxdta = MemAdd(plpStart, lstrlen(pszNewPath), 0); + if (!*plpStart) + { + *plpStart = MemNew(); - if (!lpxdta) { - - bRecurse = FALSE; // simulate an abort + if (!*plpStart) + { +MemoryError: SearchInfo.dwError = ERROR_NOT_ENOUGH_MEMORY; SearchInfo.eStatus = SEARCH_ERROR; - + return iFileCount; + } + + // + // Never shows altname + // + MemLinkToHead(*plpStart)->dwAlternateFileNameExtent = 0; + + SetWindowLongPtr(GetParent(hwndLB), GWL_HDTA, (LPARAM)*plpStart); + SearchInfo.lpStart = *plpStart; + } + + // + // allocate the buffer for this level + // + pszNewPath = (LPWSTR)LocalAlloc(LPTR, ByteCountOf(lstrlen(szPath) + MAXFILENAMELEN + 2)); + + if (!pszNewPath) + { + goto MemoryError; + } + + lstrcpy(pszNewPath, szPath); + AddBackslash(pszNewPath); + + pszNextFile = pszNewPath + lstrlen(pszNewPath); + lstrcpy(pszNextFile, szFileSpec); + + bFound = WFFindFirst(&lfndta, pszNewPath, ATTR_ALL); + + hdc = GetDC(hwndLB); + hOld = SelectObject(hdc, hFont); + + // + // Ignore file not found errors AND access denied errors + // AND PATH_NOT_FOUND when not in the root + // + + if (!bFound && ERROR_FILE_NOT_FOUND != lfndta.err && + (bRoot || + ERROR_ACCESS_DENIED != lfndta.err && + ERROR_PATH_NOT_FOUND != lfndta.err && + ERROR_INVALID_NAME != lfndta.err)) + { + SearchInfo.eStatus = SEARCH_ERROR; + SearchInfo.dwError = lfndta.err; + bRecurse = FALSE; + + goto SearchCleanup; + } + + while (bFound) + { + + // + // allow escape to exit + // + if (SearchInfo.bCancel) + { + bRecurse = FALSE; break; - } + } + + // default ftSince is 0 and so normally this will be true + bFound = CompareFileTime(&SearchInfo.ftSince, &lfndta.fd.ftLastWriteTime) < 0; + + // if we otherwise match, but shouldn't include directories in the output, skip + if (bFound && !bIncludeSubdirs && (lfndta.fd.dwFileAttributes & ATTR_DIR) != 0) + { + bFound = FALSE; + } - dwAttrs = lpxdta->dwAttrs = lfndta.fd.dwFileAttributes; - lpxdta->ftLastWriteTime = lfndta.fd.ftLastWriteTime; - lpxdta->qFileSize.LowPart = lfndta.fd.nFileSizeLow; - lpxdta->qFileSize.HighPart = lfndta.fd.nFileSizeHigh; + // + // Make sure this matches date (if specified) and is not a "." or ".." directory + // + if (bFound && !ISDOTDIR(lfndta.fd.cFileName)) + { + lstrcpy(pszNextFile, lfndta.fd.cFileName); - lstrcpy(MemGetFileName(lpxdta), pszNewPath); - MemGetAlternateFileName(lpxdta)[0] = CHAR_NULL; + // Warning: was OemToChar(pszNewPath, szMessage); + // but taken out since no translation necessary. + // Here on out _was_ using szMessage + // (Multithreaded=> szMessage usage BAD) - if (bLFN) - lpxdta->dwAttrs |= ATTR_LFN; + bLFN = IsLFN(lfndta.fd.cFileName); - if (!SearchInfo.bCasePreserved) - lpxdta->dwAttrs |= ATTR_LOWERCASE; + if (bLowercase) + { + lstrcpy(szTemp, pszNewPath); + CharLower(szTemp); - if (dwAttrs & ATTR_DIR) { - if (dwAttrs & ATTR_REPARSE_POINT) - iBitmap = BM_IND_CLOSEREPARSE; + GetTextExtentPoint32(hdc, szTemp, lstrlen(szTemp), &size); + } else - iBitmap = BM_IND_CLOSE; - } - else if (dwAttrs & (ATTR_HIDDEN | ATTR_SYSTEM)) - iBitmap = BM_IND_RO; - else if (IsProgramFile(lfndta.fd.cFileName)) - iBitmap = BM_IND_APP; - else if (IsDocument(lfndta.fd.cFileName)) - iBitmap = BM_IND_DOC; - else - iBitmap = BM_IND_FIL; - - lpxdta->byBitmap = iBitmap; - lpxdta->pDocB = NULL; + { + GetTextExtentPoint32(hdc, pszNewPath, lstrlen(pszNewPath), &size); + } - SendMessage(hwndFrame, - FS_SEARCHLINEINSERT, - (WPARAM)&iFileCount, - (LPARAM)lpxdta); + maxExt = max(size.cx,maxExt); - } + lpxdta = MemAdd(plpStart, lstrlen(pszNewPath), 0); - // - // Search for more files in the current directory - // - bFound = WFFindNext(&lfndta); - } + if (!lpxdta) + { + bRecurse = FALSE; // simulate an abort + SearchInfo.dwError = ERROR_NOT_ENOUGH_MEMORY; + SearchInfo.eStatus = SEARCH_ERROR; -SearchCleanup: + break; + } - WFFindClose(&lfndta); + dwAttrs = lpxdta->dwAttrs = lfndta.fd.dwFileAttributes; + lpxdta->ftLastWriteTime = lfndta.fd.ftLastWriteTime; + lpxdta->qFileSize.LowPart = lfndta.fd.nFileSizeLow; + lpxdta->qFileSize.HighPart = lfndta.fd.nFileSizeHigh; - if (hOld) - SelectObject(hdc, hOld); - ReleaseDC(hwndLB, hdc); + lstrcpy(MemGetFileName(lpxdta), pszNewPath); + MemGetAlternateFileName(lpxdta)[0] = CHAR_NULL; - if (!bRecurse) - goto SearchEnd; + if (bLFN) + { + lpxdta->dwAttrs |= ATTR_LFN; + } - // - // Now see if there are any subdirectories here - // - lstrcpy(pszNextFile, szStarDotStar); + if (!SearchInfo.bCasePreserved) + { + lpxdta->dwAttrs |= ATTR_LOWERCASE; + } - bFound = WFFindFirst(&lfndta, pszNewPath, ATTR_DIR | ATTR_HS); + if (dwAttrs & ATTR_DIR) + { + if (dwAttrs & (ATTR_SYMBOLIC | ATTR_JUNCTION)) + { + iBitmap = BM_IND_CLOSEREPARSE; + } + else + { + iBitmap = BM_IND_CLOSE; + } + } + else if (dwAttrs & (ATTR_HIDDEN | ATTR_SYSTEM)) + { + iBitmap = BM_IND_RO; + } + else if (IsProgramFile(lfndta.fd.cFileName)) + { + iBitmap = BM_IND_APP; + } + else if (IsDocument(lfndta.fd.cFileName)) + { + iBitmap = BM_IND_DOC; + } + else + { + iBitmap = BM_IND_FIL; + } - while (bFound) { + lpxdta->byBitmap = iBitmap; + lpxdta->pDocB = NULL; - // - // allow escape to exit - // - if (SearchInfo.bCancel) { + SendMessage(hwndFrame, + FS_SEARCHLINEINSERT, + (WPARAM)&iFileCount, + (LPARAM)lpxdta); - bRecurse = FALSE; - break; - } + } - // - // Make sure this is not a "." or ".." directory. - // - if (!ISDOTDIR(lfndta.fd.cFileName) && - (lfndta.fd.dwFileAttributes & ATTR_DIR)) { + // + // Search for more files in the current directory + // + bFound = WFFindNext(&lfndta); + } - // - // Yes, search and add files in this directory - // - lstrcpy(pszNextFile, lfndta.fd.cFileName); +SearchCleanup: - // - // Add all files in this subdirectory. - // - iRetVal = SearchList(hwndLB, - pszNewPath, - szFileSpec, - bRecurse, - bIncludeSubdirs, - plpStart, - iFileCount, - FALSE); - - iFileCount = iRetVal; - - if (SEARCH_ERROR == SearchInfo.eStatus) { + WFFindClose(&lfndta); + + if (hOld) + { + SelectObject(hdc, hOld); + } + ReleaseDC(hwndLB, hdc); + + if (!bRecurse) + { + goto SearchEnd; + } + + // + // Now see if there are any subdirectories here + // + lstrcpy(pszNextFile, szStarDotStar); + + bFound = WFFindFirst(&lfndta, pszNewPath, ATTR_DIR | ATTR_HS); + + while (bFound) + { + // + // allow escape to exit + // + if (SearchInfo.bCancel) + { + bRecurse = FALSE; break; - } + } + + // + // Make sure this is not a "." or ".." directory. + // + if (!ISDOTDIR(lfndta.fd.cFileName) && + (lfndta.fd.dwFileAttributes & ATTR_DIR)) + { + // + // Yes, search and add files in this directory + // + lstrcpy(pszNextFile, lfndta.fd.cFileName); - } - bFound = WFFindNext(&lfndta); - } + // + // Add all files in this subdirectory. + // + iRetVal = SearchList(hwndLB, + pszNewPath, + szFileSpec, + bRecurse, + bIncludeSubdirs, + plpStart, + iFileCount, + FALSE); + + iFileCount = iRetVal; + + if (SEARCH_ERROR == SearchInfo.eStatus) + { + break; + } - WFFindClose(&lfndta); + } + bFound = WFFindNext(&lfndta); + } + + WFFindClose(&lfndta); SearchEnd: - // - // Save the number of files in the xdtahead structure. - // - MemLinkToHead(SearchInfo.lpStart)->dwEntries = iFileCount; + // + // Save the number of files in the xdtahead structure. + // + MemLinkToHead(SearchInfo.lpStart)->dwEntries = iFileCount; - LocalFree((HANDLE)pszNewPath); - return iFileCount; + LocalFree((HANDLE)pszNewPath); + return iFileCount; }