wine/files dos_fs.c smb.c smb.h

Rein Klazes rklazes at xs4all.nl
Fri Jul 19 08:38:10 CDT 2002


On Thu, 18 Jul 2002 22:17:19 -0500, you wrote:


> 
> Log message:
> 	Mike McCormack <mikem at codeweavers.com>
> 	First go at reading directories on public SMB shares.
> 
> Patch: http://cvs.winehq.com/patch.py?id=1027048639509081130455346

This breaks Forte Agent, looping endlessly around a FindNextFileA().
It is caused by the SetLastError(ERROR_NO_MORE_FILES) that is lost in
the final HeapUnlock call. A quick fix is attached.

	files/	: dos_fs.c
	Repair SetLastError in FindNextFileA.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/files/dos_fs.c	Fri Jul 19 14:15:26 2002
+++ mywine/files/dos_fs.c	Fri Jul 19 15:26:17 2002
@@ -1802,6 +1802,7 @@
 {
     FIND_FIRST_INFO *info;
     BOOL ret = FALSE;
+    DWORD gle = ERROR_NO_MORE_FILES;
 
     if ((handle == INVALID_HANDLE_VALUE) ||
        !(info = (FIND_FIRST_INFO *)GlobalLock( handle )))
@@ -1816,25 +1817,24 @@
         {
             SMB_CloseDir( info->u.smb_dir );
             HeapFree( GetProcessHeap(), 0, info->path );
-            SetLastError( ERROR_NO_MORE_FILES );
         }
         goto done;
     }
     else if (!info->path || !info->u.dos_dir)
     {
-        SetLastError( ERROR_NO_MORE_FILES );
+        goto done;
     }
     else if (!DOSFS_FindNextEx( info, data ))
     {
         DOSFS_CloseDir( info->u.dos_dir ); info->u.dos_dir = NULL;
         HeapFree( GetProcessHeap(), 0, info->path );
         info->path = info->long_mask = NULL;
-        SetLastError( ERROR_NO_MORE_FILES );
     }
     else
         ret = TRUE;
 done:
     GlobalUnlock( handle );
+    if( !ret ) SetLastError( gle );
     return ret;
 }
 


More information about the wine-devel mailing list