I want to use some of the functions defined in wininet.dll and wininet.inc such as 'FindNextUrlCacheEntry' and 'DeleteUrlCacheEntry'. I search MSDN and find these functions are supported by Windows CE. Windows 98, which I got, is not mentioned. Does that mean none of these work on 98? then why are they defined?

best regards,

czDrillard
Posted on 2001-11-25 12:37:53 by czDrillard
The Microsoft documentation is vast and varied, and not always totally accurate. According to my documentation, those functions are available with a minimum OS of W95 or WinNT4, so you are covered. If you do another serch through msdn, you should find that there is more than one article on using these functions, you just happened to find an old one ;)
Posted on 2001-11-25 15:06:31 by sluggy
Thanks sluggy,

I did a search with 'Dogpile' and come up with better info than is on MSDN. Here is the link if anyone is interested: http://activex.adsp.or.jp/english/specs/inetsdk.htm

best regards,

czDrillard
Posted on 2001-11-25 21:16:28 by czDrillard
I found this code on the net:


char buffer[4096];
DWORD cb = 4096;

INTERNET_CACHE_ENTRY_INFO *p = (INTERNET_CACHE_ENTRY_INFO *)buffer;
HANDLE h = FindFirstUrlCacheEntry(NULL, p, &cb);



Does anyone know how to translate this in asm ?
Posted on 2001-11-26 06:46:30 by Unregistered
Try the following



.data?
buffer db 4096 dup ?
handle dd ?

.data
cb dd 4096

.text
invoke FindFirstUrlCacheEntry, NULL, addr buffer, addr cb
mov [handle], eax
Posted on 2001-11-26 07:17:50 by f0dder
Thank you f0dder !!!

I've allready tried this but some strange error occured "Impossible to create an existing file !" (translated from french).
I think it's because I didn't rely the function "FindFirstUrlCacheEntry" on the structure INTERNET_CACHE_ENTRY_INFO <>.

So i tried this :


.386
.MODEL FLAT,STDCALL
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
include HandleErr.inc
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
include \masm32\include\wininet.inc
includelib \masm32\lib\wininet.lib


.const

.data
ffirst db 'FindFirstUrlCacheEntry',0
WININET db 'Wininet.dll',0
bkl db '\',0
BufSize dd 4096


.data?

hWininet dd ?
buffer db 4096 dup (?)
ICEI INTERNET_CACHE_ENTRY_INFO <?>
ffirstNew dd ?
lpMsgBuf dd ?
LastErr dd ?

.code
start:


call GetLastError
mov LastErr,eax



invoke FindFirstUrlCacheEntry,NULL, addr ICEI, addr BufSize
call GetLastError
.IF EAX != dword ptr
invoke HandleError, addr ffirst
.ENDIF

invoke MessageBox,0,addr ICEI.lpszSourceUrlName,0,MB_OK
invoke ExitProcess,0

end start




but the error was even worse !

I really wonder what means :
INTERNET_CACHE_ENTRY_INFO *p = (INTERNET_CACHE_ENTRY_INFO *)buffer;

Any ideas ?
Posted on 2001-11-26 09:38:47 by Axial
Pretty easy :).



INTERNET_CACHE_ENTRY_INFO *p

That's a pointer to an INTERNET_CACHE_ENTRY_INFO struct.
Ie, a dword.



= (INTERNET_CACHE_ENTRY_INFO *)buffer;

makes the pointer point to the buffer. Since the buffer is declared
as a different type, and C does typechecking, you have a typecast
(the stuff inside the parenthesis).
Posted on 2001-11-26 10:01:41 by f0dder

lea eax, ; EAX is the pointer to ICEI struct
lea eax, ; eax becomes a pointer to buffer
invoke FindFirstUrlCacheEntry,NULL, eax , addr BufSize

;Same Error !!!

Did I miss something ??? :confused:
Posted on 2001-11-26 10:29:18 by Axial


lea eax, ; EAX is the pointer to ICEI struct
lea eax, ; eax becomes a pointer to buffer
invoke FindFirstUrlCacheEntry,NULL, eax , addr BufSize


Why do you load the pointer to your INTERNET_CACHE_ENTRY_INFO structure, and then immeditely load the pointer to another (undetermined) buffer, then call the function with the address of the second buffer?

And what is the return value in eax after calling the function? Could it be that you buffer is simply not large enough?
Posted on 2001-11-26 21:39:43 by sluggy
Axial,

Here is what structure looks like it will be filled in by calls to 'FindFirstUrlCacheEntry' and 'FindNextUrlCacheEntry' I reprinted this from page I put link to in earlier post, there are complete definitions.

typedef struct _CACHE_ENTRY_INFO {
DWORD dwVersion;
LPSTR lpszSourceUrlName;
LPTSTR% lpszLocalFileName;
DWORD CacheEntryType;
DWORD dwUseCount;
DWORD dwHitRate;
DWORD dwSizeLow;
DWORD dwSizeHigh;
FILETIME LastModifiedTime;
FILETIME ExpiryTime;
FILETIME LastAccessTime;
LPBYTE lpHeaderInfo;
DWORD dwHeaderInfoSize;
LPTSTR% lpszFileExtension;
DWORD dwReserved;
} CACHE_ENTRY_INFO, *LPCACHE_ENTRY_INFO;

hope this is helpful,

czDrillard
Posted on 2001-11-26 22:13:11 by czDrillard
Shouldn't the last parameter be the size of the buffer rather than a pointer to a dword containing the size of the buffer?

I would try this:


.data?
buffer BYTE 4096 dup ?
handle DWORD ?

.data
cb DWORD 4096

.text
invoke FindFirstUrlCacheEntry, NULL, addr buffer, cb
mov [handle], eax


Or just this:


.data?
buffer BYTE 4096 dup ?
handle DWORD ?

.text
invoke FindFirstUrlCacheEntry, NULL, addr buffer, sizeof buffer
mov [handle], eax
Posted on 2001-11-27 02:02:43 by huh