FileFindNext() crashes the EA with an access violation

 

Hey there, 

this code crashes the EA with the message: Access violation write to 0x00000020 in '(...)EA.ex4'. WTF?

string filename=NULL;
string search="*";
long handle=FileFindFirst(search,filename,FILE_COMMON);

while (handle!=INVALID_HANDLE)
      {
      handle=FileFindNext(handle,filename);
      }
FileFindClose(handle);   

When FileFindNext() is executed 3rd time, the debugger stops. It happens with every search mask. I cannot trace the problem. 

Of course I reported this to the service desk, but my last answer there is 3 months ago. Senseless in most cases. Maybe someone had the same problem and has an idea. 

Thanks in advance

Doerk 

 
My fault. FileFindNext() returns bool.