如何过滤 FindFirstUrlCacheEntry()?
我已经研究了 MSDN 上的文档,但是它对我不起作用,我想知道我做错了什么?
我的代码如下,我正在尝试过滤我的 IE 缓存,例如仅获取 cookie:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wininet.h>
int main(void) {
DWORD dwEntrySize;
DWORD dw;
LPCTSTR filter = "cookie:";
INTERNET_CACHE_ENTRY_INFO * entry;
DWORD MAX_CACHE_ENTRY_INFO_SIZE = 4096;
HANDLE hCacheDir;
int nCount=0;
BOOL ok = FALSE;
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
entry = malloc(dwEntrySize);
entry->dwStructSize = dwEntrySize;
printf("Reading IE cache\n");
hCacheDir = FindFirstUrlCacheEntry(filter, entry, &dwEntrySize);
if ( hCacheDir ) {
printf("%ws\n", entry->lpszLocalFileName);
nCount++;
do {
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
entry = malloc(dwEntrySize);
entry->dwStructSize = dwEntrySize;
ok = FindNextUrlCacheEntry(hCacheDir, entry, &dwEntrySize);
if (ok && entry->lpszLocalFileName != NULL) {
printf("%ws\n", entry->lpszLocalFileName);
nCount++;
}
} while ( ok );
printf("**** end cache, total count: %d\n", nCount);
}
else {
dw = GetLastError();
printf("error code: %d\n", dw);
}
free(entry);
FindCloseUrlCache(hCacheDir);
return 0;
}
I have studied the documentation on MSDN, but it doesn't work for me, I am wondering what I'm doing wrong?
My code is as follows, I am trying to filter my IE cache, for example, to get only the cookies:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wininet.h>
int main(void) {
DWORD dwEntrySize;
DWORD dw;
LPCTSTR filter = "cookie:";
INTERNET_CACHE_ENTRY_INFO * entry;
DWORD MAX_CACHE_ENTRY_INFO_SIZE = 4096;
HANDLE hCacheDir;
int nCount=0;
BOOL ok = FALSE;
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
entry = malloc(dwEntrySize);
entry->dwStructSize = dwEntrySize;
printf("Reading IE cache\n");
hCacheDir = FindFirstUrlCacheEntry(filter, entry, &dwEntrySize);
if ( hCacheDir ) {
printf("%ws\n", entry->lpszLocalFileName);
nCount++;
do {
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
entry = malloc(dwEntrySize);
entry->dwStructSize = dwEntrySize;
ok = FindNextUrlCacheEntry(hCacheDir, entry, &dwEntrySize);
if (ok && entry->lpszLocalFileName != NULL) {
printf("%ws\n", entry->lpszLocalFileName);
nCount++;
}
} while ( ok );
printf("**** end cache, total count: %d\n", nCount);
}
else {
dw = GetLastError();
printf("error code: %d\n", dw);
}
free(entry);
FindCloseUrlCache(hCacheDir);
return 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论