WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Internet Explorer Cache History Retrieval

 Keywords: IE MSIE

Question:

Has anyone worked with exporting the IE history to a legible format? I was wondering if there were some OLE functions or something else that could help me export it. Basically what I want is to grab the sites along with the time / day visited.

Answer:

You can do it with the wininet api , this script displays the history, but you can retrieve the cookies or whatever, everything is stored in the ICE structure (INTERNET_CACHE_ENTRY_INFO).

;MSIE Cache history retrival
;Guido 04/03

;exclusive(@on)

wininet=dllload(strcat(dirwindows(1),"wininet.dll"))
kernel32=dllload(strcat(dirwindows(1),"kernel32.dll"))

a=GetTickCount()

ERROR_CACHE_FIND_FAIL=0
ERROR_INSUFFICIENT_BUFFER=122

boxopen("History:","")

bsize=binaryalloc(4) ;stores structure size
MAX_SIZE=4096
ICE=binaryalloc(MAX_SIZE) ;structure
SYSTEMTIME=binaryalloc(16) 

ICEadd=intcontrol(42,ICE,0,0,0)
binarypoke4(bsize,0,MAX_SIZE)

;hfile=fileopen("history.txt","write")

;call to get info
hfind=dllcall(wininet,long:"FindFirstUrlCacheEntryA",lpstr:"visited:",lpbinary:ICE,lpbinary:bsize)
binaryeodset(ICE,MAX_SIZE)
  
if hfind<>ERROR_CACHE_FIND_FAIL 
  purl=binarypeek4(ICE,4) ;url pointer
  pft=ICEadd+48 ;LastAccess FILETIME pointer    
    
  url=binarypeekstr(ICE,purl-ICEadd,MAX_SIZE)

  ;last access
  dllcall(kernel32,long:"FileTimeToSystemTime",long:pft,lpbinary:SYSTEMTIME)
  y=binarypeek2(SYSTEMTIME,0)
  m=binarypeek2(SYSTEMTIME,2)
  d=binarypeek2(SYSTEMTIME,6)
  h=binarypeek2(SYSTEMTIME,8)
  mm=binarypeek2(SYSTEMTIME,10)

  date=strcat(y," ",m," ",d," ",h,":",mm)
  boxtext(strcat(url,@crlf,date))

  ;filewrite(hfile,strcat(url,@crlf,date))
    
  while 1
    
    ;call to get info
    binarypoke4(bsize,0,MAX_SIZE)
    if !dllcall(wininet,long:"FindNextUrlCacheEntryA",long:hfind,lpbinary:ICE,lpbinary:bsize) then break
    binaryeodset(ICE,MAX_SIZE)
    purl=binarypeek4(ICE,4)
  
    url=binarypeekstr(ICE,purl-ICEadd,MAX_SIZE)
      
    ;last access
    dllcall(kernel32,long:"FileTimeToSystemTime",long:pft,lpbinary:SYSTEMTIME)
    y=binarypeek2(SYSTEMTIME,0)
    m=binarypeek2(SYSTEMTIME,2)
    d=binarypeek2(SYSTEMTIME,6)
    h=binarypeek2(SYSTEMTIME,8)
    mm=binarypeek2(SYSTEMTIME,10)

    date=strcat(y," ",m," ",d," ",h,":",mm)
    boxtext(strcat(url,@crlf,date))

    ;filewrite(hfile,strcat(url,@crlf,date))

  endwhile
      
endif

message("",GetTickCount()-a)

;fileclose(hfile)

dllfree(wininet)
dllfree(kernel32)
binaryfree(bsize)
binaryfree(ICE)
binaryfree(SYSTEMTIME)

Article ID:   W15987
File Created: 2004:03:30:15:42:06
Last Updated: 2004:03:30:15:42:06