From e6f389e83773cf632bbd292b4d524fa983551090 Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Tue, 2 Mar 2010 15:17:08 +0000 Subject: [PATCH] 2010-03-02 16:15 UTC+0100 Maurilio Longo (maurilio.longo@libero.it) * src/common/hbffind.c * hb_fsFindNextLow() to work reliably in my environment needs OBJ_TILE memory. I've found no documentation about this issue, maybe it's caused by old LAN Manager code when searching for files on network shares. --- harbour/ChangeLog | 8 ++++++++ harbour/src/common/hbffind.c | 36 +++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0f181136c9..8212c30d54 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ + +2010-03-02 16:15 UTC+0100 Maurilio Longo (maurilio.longo@libero.it) + * src/common/hbffind.c + * hb_fsFindNextLow() to work reliably in my environment needs + OBJ_TILE memory. I've found no documentation about this + issue, maybe it's caused by old LAN Manager code when searching + for files on network shares. + 2010-03-02 15:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gtwin/gtwin.c + Implemented HB_GTI_CLOSABLE support for GTWIN. diff --git a/harbour/src/common/hbffind.c b/harbour/src/common/hbffind.c index d43c44e061..cd4a477cde 100644 --- a/harbour/src/common/hbffind.c +++ b/harbour/src/common/hbffind.c @@ -475,6 +475,7 @@ static HB_BOOL hb_fsFindNextLow( PHB_FFIND ffind ) { PHB_FFIND_INFO info = ( PHB_FFIND_INFO ) ffind->info; + APIRET rc = NO_ERROR; /* TODO: HB_FA_LABEL handling */ @@ -485,19 +486,27 @@ static HB_BOOL hb_fsFindNextLow( PHB_FFIND ffind ) /* tzset(); */ info->hFindFile = HDIR_CREATE; - info->entry = (PFILEFINDBUF3) hb_xgrab( 4 * 1024 ); - info->findCount = 256; + info->findCount = 128; + rc = DosAllocMem( (PPVOID) &info->entry, 4 * 1024, OBJ_TILE | PAG_COMMIT | PAG_WRITE ); - bFound = DosFindFirst( ( PCSZ ) ffind->pszFileMask, - &info->hFindFile, - ( ULONG ) hb_fsAttrToRaw( ffind->attrmask ), - info->entry, - 4 * 1024, - &info->findCount, - FIL_STANDARD ) == NO_ERROR && info->findCount > 0; + if( rc == NO_ERROR ) + { + bFound = DosFindFirst( ( PCSZ ) ffind->pszFileMask, + &info->hFindFile, + ( ULONG ) hb_fsAttrToRaw( ffind->attrmask ), + info->entry, + 4 * 1024, + &info->findCount, + FIL_STANDARD ) == NO_ERROR && info->findCount > 0; - if( bFound ) - info->next = info->entry; + if( bFound ) + info->next = info->entry; + } + else + { + info->entry = NULL; + bFound = HB_FALSE; + } } else { @@ -505,7 +514,7 @@ static HB_BOOL hb_fsFindNextLow( PHB_FFIND ffind ) bFound = HB_TRUE; else { - info->findCount = 256; + info->findCount = 128; bFound = DosFindNext( info->hFindFile, info->entry, @@ -892,7 +901,8 @@ void hb_fsFindClose( PHB_FFIND ffind ) { DosFindClose( info->hFindFile ); - hb_xfree( info->entry ); + if( info->entry ) + DosFreeMem( info->entry ); } #elif defined( HB_OS_WIN )