I thought it would be easy to use this api, just like the findfirst\findnextfile, but I can't seem to get anywhere. Here's the code I got but it doesn't seem to work. I get error code of '7a' (btw, anybody know what this error code means?) if I call get last error after call to FindNextUrlCacheEntry.

EnumerateCache proc IndexPath:DWORD

LOCAL Buffer

invoke lstrcpy,ADDR Buffer,IndexPath
invoke lstrcat,ADDR Buffer,ADDR szSlashFile
;full path of index.dat file + \*.*

invoke FindFirstUrlCacheEntry,ADDR Buffer,ADDR CacheBuffer,ADDR cb
;cb is dword=4096
;CacheBuffer=dup 4096(0)

jz @f
mov hCache,eax

invoke FindNextUrlCacheEntry,hCache,ADDR CacheBuffer,ADDR cb
jz @f
or eax,00h
jz @f
jmp @GetNextUrl

invoke FindCloseUrlCache,hCache


EnumerateCache endp

Any help or working asm code snippet appreciated.

best regards,

Posted on 2001-12-01 22:59:46 by czDrillard
I'm guessing you need to increase the buffer?

win32.hlp -> index -> "error" ->
numerical listing -> 7Ah = 122 decimal (122L) ->
Posted on 2001-12-01 23:14:44 by grv575
Hi grv575, your quite right in saying 'ERROR_INSUFFICIENT_BUFFER' I didn't even know there was error code listings in winhelp. thanks.

This raises a bigger question how do I increase buffer size. I got some C code that is used for this but need somebody to translate for me:

lpCacheEntry=(LPINTERNET_CACHE_ENTRY_INFO)new char; lpCacheEntry->dwStructSize=dwEntrySize

What does this mean in asm?

best regards,

Posted on 2001-12-02 02:41:26 by czDrillard


This is a perfectly normal error to receive, you just need to check for it after the first call, then resize your buffer to the value that was returned in the lpdwFirstCacheEntryInfoBufferSize parameter, and call it again.

This raises a bigger question how do I increase buffer size.

If you use VirtualAlloc() to create the buffer in the first place then you could use VirtualReAlloc() to increaase it.


This is creating a char (byte) array of length dwEntrySize. lpCacheEntry is a pointer to the first byte (char) in that array. LPINTERNET_CACHE_ENTRY_INFO is just TYPEDEFing (casting) the pointer, C is a very type-safe language.


Obviously the buffer that was created above is going to hold a INTERNET_CACHE_ENTRY_INFO struct, this code is setting the dwStructSize member of that struct to dwEntrySize.
Posted on 2001-12-02 04:08:17 by sluggy
Thanks sluggy,

You answered all my questions and most helpful, only one thing. How do I access members of this structure. for example I want to list names of urls. in 'c' it looks like:


I tried different things but cant seem to get it right in MASM. any help appreciated.

best regards,

Posted on 2001-12-02 18:37:04 by czDrillard


There is another cool little technique for this (and it was shown to me by someone on this board). Use the 'assume' keyword, like this:

mov esi, ptrMemBlock ;ptrMemBlock is the pointer to your buffer
lea eax, <url string name> ;get start address of your url string
mov [esi].lpszSourceUrlName, eax ;store the strings address in the struct
assume esi : nothing

When you use the 'assume' keyword, MASM knows that you are using that register as a pointer to a structure, and allows you to use the dot notation, when it compiles it works out all the offsets for you. Forgetting to re-assign the assume when you have finished using that register as a pointer doesn't cause any specific harm, it just may introduce bugs if you re-use it as a pointer further on in the proc.

Glad to be of help :)
Posted on 2001-12-02 21:46:24 by sluggy
Thanks again everyone for help and comments :),

best regards,

Posted on 2001-12-03 01:34:22 by czDrillard