View Issue Details

IDProjectCategoryView StatusLast Update
0000420Far Manager_Commonpublic2007-12-25 03:15
Reporteralexmitin Assigned Tovskirdin  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version1.80 alpha 1 
Summary0000420: INVALID_HANDLE_VALUE used in FindClose() in ScanTree::GetNextName()
DescriptionFile: scantree.cpp
Line: 106
Context:
int ScanTree::GetNextName(FAR_FIND_DATA_EX *fdata,string &strFullName)
{
...
  {
    if (Data[FindHandleCount].FindHandle==0)
      Done=((Data[FindHandleCount].FindHandle=apiFindFirstFile(strFindPath,fdata))==INVALID_HANDLE_VALUE);
    else
      Done=!apiFindNextFile(Data[FindHandleCount].FindHandle,fdata);

    if (Flags.Check(FSCANTREE_FILESFIRST))
    {
      if (Data[FindHandleCount].Flags.Check(FSCANTREE_SECONDPASS))
      {
        if (!Done && (fdata->dwFileAttributes & FA_DIREC)==0)
          continue;
      }
      else
      {
        if (!Done && (fdata->dwFileAttributes & FA_DIREC))
          continue;
        if (Done)
        {
=[bug]==> FindClose(Data[FindHandleCount].FindHandle);
          Data[FindHandleCount].FindHandle=0;
          Data[FindHandleCount].Flags.Set(FSCANTREE_SECONDPASS);
          continue;
        }
      }
    } /* if */
...
}

Call stack
===========
*1 Far.exe!ScanTree::GetNextName(FAR_FIND_DATA_EX * fdata=0x0012f89c, UnicodeString & strFullName={...})
 2 Far.exe!PluginManager::LoadPlugins()
 3 Far.exe!ControlObject::Init()
 4 Far.exe!MainProcess(const wchar_t * lpwszEditName=0x009f4fe0, const wchar_t * lpwszViewName=0x009f5078, const wchar_t * lpwszDestName1=0x009f5110, const wchar_t * lpwszDestName2=0x009f51a8, int StartLine=0xffffffff, int StartChar=0xffffffff, int RegOpt=0x00000000)
 5 Far.exe!wmain(int Argc=0x00000001, wchar_t * * Argv=0x009f5580)
 6 Far.exe!__tmainCRTStartup()
 7 Far.exe!wmainCRTStartup()
 8 kernel32.dll!_BaseProcessStart@4()


Analysis
==========
The problem occurs when apiFindFirstFile() function returns INVALID_HANDLE_VALUE (no files found).

strFullName="c:\Projects\FAR\trunk\unicode_far\Debug.vc\Plugins\*.*"
Data[FindHandleCount].FindHandle=INVALID_HANDLE_VALUE;
Done=true;

FindClose is called with INVALID_HANDLE_VALUE.

Steps to reproduce:
===================
1) Put a breakpoint on the following line in the function ScanTree::GetNextName:

    if (Data[FindHandleCount].FindHandle==0)

2) Make sure you don't have a "Plugins" folder.
3) Start FAR under debugger.
4) Step through the code.
Additional InformationFAR 1.80.0.383
TagsNo tags attached.
Build384

Activities

vskirdin

2007-12-06 03:44

administrator   bugnote:0000963

после 384

Issue History

Date Modified Username Field Change
2007-12-06 02:41 alexmitin New Issue
2007-12-06 03:44 vskirdin Status new => assigned
2007-12-06 03:44 vskirdin Assigned To => vskirdin
2007-12-06 03:44 vskirdin Note Added: 0000963
2007-12-06 03:44 vskirdin Status assigned => feedback
2007-12-24 06:46 samlyukov Status feedback => resolved
2007-12-24 06:46 samlyukov Resolution open => fixed
2007-12-25 03:15 vskirdin Build => 384
2007-12-25 03:15 vskirdin Status resolved => closed
2007-12-25 03:15 vskirdin Fixed in Version => 1.80 alpha 1