Llevo varios intentos de poder hacer un Directory vÃa FTP con el siguiente código pero no encuentro la manera. Necesito que alguien me diga donde puede estar el error. Subir y Bajar archivos y comprobar si están lo hago sin problemas pero con la secuencia de comandos para hacer Directory no hay forma:
Se obtiene el siguiente error: hb_xfree(00E5C368) Pointer Overflow'' ''
HB_FUNC( FTPFINDFIRSTFILE )
{
hb_retnl( ( LONG ) FtpFindFirstFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( WIN32_FIND_DATA * ) hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}
HB_FUNC( INTERNETFINDNEXTFILE )
{
BOOL lSuccess = InternetFindNextFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) ;
hb_retl( lSuccess );
} function FTPDirectory( cMask,cIP,cUser,cPass )
local hFTPDir, aFiles := {}
local oWin32FindData, cBuffer
local i:=0
default cMask := "*.*"
STRUCT oWin32FindData
MEMBER nFileAttributes AS DWORD
MEMBER nCreationTime AS STRING LEN 8
MEMBER nLastReadAccess AS STRING LEN 8
MEMBER nLastWriteAccess AS STRING LEN 8
MEMBER nSizeHight AS DWORD
MEMBER nSizeLow AS DWORD
MEMBER nReserved0 AS DWORD
MEMBER nReserved1 AS DWORD
MEMBER cFileName AS STRING LEN 260
MEMBER cAltName AS STRING LEN 14
ENDSTRUCT
hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
hConnect = INTERNETCONNECT( hInternet, cIP, INTERNET_INVALID_PORT_NUMBER, cUser, cPass, INTERNET_SERVICE_FTP, 0, 0 )
if hConnect != nil
cBuffer = oWin32FindData:cBuffer
hFTPDir =[b] FtpFindFirstFile( hConnect, cMask, @cBuffer, 0, 0 )[/b]
oWin32FindData:cBuffer = cBuffer
if ! empty( oWin32FindData:cFileName )
aadd( aFiles, { oWin32FindData:cFileName,oWin32FindData:nSizeLow } )
while [b]InternetFindNextFile( hFTPDir, @cBuffer )[/b]
[color=#FF0000]oWin32FindData:cBuffer = cBuffer[/color] // ¡¡ Aquà es donde se produce el error !!
aadd( aFiles, { oWin32FindData:cFileName,oWin32FindData:nSizeLow } )
end
endif
InternetCloseHandle( hFTPDir )
endif
for i=1 TO len(aFiles)
msginfo(aFiles[i,1])
next i
return aFilesSe obtiene el siguiente error: hb_xfree(00E5C368) Pointer Overflow'' ''