Antonio,
Did you receive my email I send you this morning?
Thanks.
#pragma BEGINDUMP
#include <stdio.h>
#include <Windows.h>
#include <WinINet.h>
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbapifs.h>
#include <hbvm.h>
#include <hbstack.h>
static int mystrcmp( char *val1, char *val2 )
{
int nret = 0 ;
for ( ; *val1 ; val1++, val2++ ) {
if ( ! *val2 || *val1 != *val2 ) {
nret = 1 ;
break ;
}
}
if ( ! nret && *val2 )
nret = 1 ;
return nret ;
}
HB_FUNC( DELFILECACHE )
{
BOOL bResult = FALSE ;
BOOL bDone = FALSE ;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry = NULL ;
DWORD dwTrySize, dwEntrySize = 4096 ; // start buffer size
HANDLE hCacheDir = NULL ;
DWORD dwError = ERROR_INSUFFICIENT_BUFFER ;
BOOL bSuccess ;
PHB_ITEM iFiles, iElem ;
int nfile, npos ;
char buffile[FILENAME_MAX] ;
iFiles = hb_itemParam( 1 ) ;
nfile = hb_parinfa( 1, 0 ) ;
do {
switch ( dwError ) {
// need a bigger buffer
case ERROR_INSUFFICIENT_BUFFER :
if ( lpCacheEntry != NULL )
free( (LPBYTE)lpCacheEntry ) ;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) malloc( dwEntrySize ) ;
lpCacheEntry->dwStructSize = dwEntrySize ;
dwTrySize = dwEntrySize ;
if ( hCacheDir == NULL )
bSuccess = (hCacheDir = FindFirstUrlCacheEntry( NULL, lpCacheEntry, &dwTrySize )) != NULL ;
else
bSuccess = FindNextUrlCacheEntry(hCacheDir, lpCacheEntry, &dwTrySize ) ;
if ( bSuccess )
dwError = ERROR_SUCCESS ;
else {
dwError = GetLastError() ;
dwEntrySize = dwTrySize ; // use new size returned
}
break ;
// we are done
case ERROR_NO_MORE_ITEMS :
bDone = TRUE ;
bResult = TRUE ;
break ;
// we have got an entry
case ERROR_SUCCESS:
// don't delete cookie entry
if ( !( lpCacheEntry->CacheEntryType & COOKIE_CACHE_ENTRY ) ) {
for ( npos = 1 ; npos <= nfile ; npos++ ) {
iElem = hb_itemArrayGet( iFiles, npos ) ;
hb_itemCopyC( iElem, buffile, 0 ) ;
buffile[hb_itemSize( iElem )] = '\0' ;
if ( ! mystrcmp( (char *)(lpCacheEntry->lpszSourceUrlName), buffile ) ) {
DeleteUrlCacheEntry( lpCacheEntry->lpszSourceUrlName ) ;
break ;
}
}
}
// get ready for next entry
dwTrySize = dwEntrySize;
if ( FindNextUrlCacheEntry(hCacheDir, lpCacheEntry, &dwTrySize ) )
dwError = ERROR_SUCCESS ;
else {
dwError = GetLastError() ;
dwEntrySize = dwTrySize ; // use new size returned
}
break;
// unknown error
default:
bDone = TRUE ;
break ;
}
if ( bDone ) {
free( (LPBYTE)lpCacheEntry ) ;
if ( hCacheDir )
FindCloseUrlCache( hCacheDir ) ;
}
} while ( !bDone ) ;
hb_retnl( bResult ) ;
}
#pragma ENDDUMP
Error: Unresolved external 'FindFirstUrlCacheEntryA' referenced from M:\SOFTWARE\JUDAHARB\PRG\OBJ\JUDA.OBJ
Error: Unresolved external 'DeleteUrlCacheEntry' referenced from M:\SOFTWARE\JUDAHARB\PRG\OBJ\JUDA.OBJ
Error: Unresolved external 'FindNextUrlCacheEntryA' referenced from M:\SOFTWARE\JUDAHARB\PRG\OBJ\JUDA.OBJ
Error: Unresolved external 'FindCloseUrlCache' referenced from M:\SOFTWARE\JUDAHARB\PRG\OBJ\JUDA.OBJ
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 29 guests