[structlayout(layoutkind.sequential,charset=charset.auto)]
publicstructinternet_cache_entry_info
...{
publicintdwstructsize;
publicintptrlpszsourceurlname;
publicintptrlpszlocalfilename;
publicintcacheentrytype;
publicintdwusecount;
publicintdwhitrate;
publicintdwsizelow;
publicintdwsizehigh;
publicfiletimelastmodifiedtime;
publicfiletimeexpiretime;
publicfiletimelastaccesstime;
publicfiletimelastsynctime;
publicintptrlpheaderinfo;
publicintdwheaderinfosize;
publicintptrlpszfileextension;
publicintdwexemptdelta;
}
[dllimport("wininet.dll",setlasterror=true,charset=charset.auto)]
publicstaticexternintptrfindfirsturlcacheentry([marshalas(unmanagedtype.lptstr)]stringurlsearchpattern,intptrlpfirstcacheentryinfo,refintlpdwfirstcacheentryinfobuffersize);
[dllimport("wininet.dll",setlasterror=true,charset=charset.auto)]
publicstaticexternboolgeturlcacheentryinfo([marshalas(unmanagedtype.lptstr)]stringlpszurlname,intptrlpcacheentryinfo,refintlpdwcacheentryinfobuffersize);
publicstaticstringgetcatchfilename(stringurl)
...{
intnneeded=0,nbufsize;
intptrbuf;
findfirsturlcacheentry(null,intptr.zero,refnneeded);
nbufsize=nneeded;buf=marshal.allochglobal(nbufsize);
geturlcacheentryinfo(url,buf,refnneeded);
internet_cache_entry_infocacheitem;
geturlcacheentryinfo(url,buf,refnneeded);
cacheitem=(internet_cache_entry_info)marshal.ptrtostructure(buf,typeof(internet_cache_entry_info));
stringres=marshal.ptrtostringauto(cacheitem.lpszlocalfilename);
return(res);
}
publicstructinternet_cache_entry_info
...{
publicintdwstructsize;
publicintptrlpszsourceurlname;
publicintptrlpszlocalfilename;
publicintcacheentrytype;
publicintdwusecount;
publicintdwhitrate;
publicintdwsizelow;
publicintdwsizehigh;
publicfiletimelastmodifiedtime;
publicfiletimeexpiretime;
publicfiletimelastaccesstime;
publicfiletimelastsynctime;
publicintptrlpheaderinfo;
publicintdwheaderinfosize;
publicintptrlpszfileextension;
publicintdwexemptdelta;
}
[dllimport("wininet.dll",setlasterror=true,charset=charset.auto)]
publicstaticexternintptrfindfirsturlcacheentry([marshalas(unmanagedtype.lptstr)]stringurlsearchpattern,intptrlpfirstcacheentryinfo,refintlpdwfirstcacheentryinfobuffersize);
[dllimport("wininet.dll",setlasterror=true,charset=charset.auto)]
publicstaticexternboolgeturlcacheentryinfo([marshalas(unmanagedtype.lptstr)]stringlpszurlname,intptrlpcacheentryinfo,refintlpdwcacheentryinfobuffersize);
publicstaticstringgetcatchfilename(stringurl)
...{
intnneeded=0,nbufsize;
intptrbuf;
findfirsturlcacheentry(null,intptr.zero,refnneeded);
nbufsize=nneeded;buf=marshal.allochglobal(nbufsize);
geturlcacheentryinfo(url,buf,refnneeded);
internet_cache_entry_infocacheitem;
geturlcacheentryinfo(url,buf,refnneeded);
cacheitem=(internet_cache_entry_info)marshal.ptrtostructure(buf,typeof(internet_cache_entry_info));
stringres=marshal.ptrtostringauto(cacheitem.lpszlocalfilename);
return(res);
}