Use API to get IE cache files

Source: Internet
Author: User
Tags filetime
Using System.Runtime.InteropServices; [StructLayout (LayoutKind.Sequential, CharSet=CharSet.Auto)] public struct internet_cache_entry_info ...     
 {public int dwstructsize;     
 public IntPtr lpszsourceurlname;     
 public IntPtr lpszlocalfilename;     
 public int cacheentrytype;     
 public int dwusecount;     
 public int dwhitrate;     
 public int dwsizelow;     
 public int Dwsizehigh;     
 Public FILETIME Lastmodifiedtime;     
 Public FILETIME Expiretime;     
 Public FILETIME LastAccessTime;     
 Public FILETIME LastSyncTime;     
 public IntPtr lpheaderinfo;     
 public int dwheaderinfosize;     
 public IntPtr lpszfileextension;    
 public int Dwexemptdelta; [DllImport ("Wininet.dll", Setlasterror=true, CharSet=CharSet.Auto)] public static extern IntPtr Findfirstur Lcacheentry ([MarshalAs (UNMANAGEDTYPE.LPTSTR)] string urlsearchpattern, IntPtr lpfirstcacheentryinfo, ref int LPDWFI RstcacheentryinFobuffersize); [DllImport ("Wininet.dll", Setlasterror=true, CharSet=CharSet.Auto)] public static extern bool Geturlcacheentryi NFO ([MarshalAs (UNMANAGEDTYPE.LPTSTR)] string lpszurlname, IntPtr lpcacheentryinfo, ref int Lpdwcacheentryin 
 Fobuffersize); public static string Getcatchfilename (string url) ...     
 {int nneeded = 0, nbufsize;   
 IntPtr buf;  
 Findfirsturlcacheentry (null, IntPtr.Zero, ref nneeded);     Nbufsize = nneeded;     
 BUF = Marshal.allochglobal (nbufsize);   
 Geturlcacheentryinfo (Url,buf,ref nneeded); 
 Internet_cache_entry_info CacheItem; 
 Geturlcacheentryinfo (Url,buf,ref nneeded);      
 CacheItem = (internet_cache_entry_info) marshal.ptrtostructure (buf,typeof (internet_cache_entry_info)); 
 String Res=marshal.ptrtostringauto (Cacheitem.lpszlocalfilename); 
 return (RES); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.