首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当尝试打开IE 10/11 WebCache.dat时,ESENT总是抛出EsentPageSizeMismatchException

当尝试打开IE 10/11 WebCache.dat时,ESENT总是抛出EsentPageSizeMismatchException
EN

Stack Overflow用户
提问于 2016-07-12 01:26:34
回答 0查看 674关注 0票数 0

我正在尝试创建一个powershell脚本来读取IE10/11互联网历史记录,它存储在AppData\Local\Microsoft\Windows\WebCache\WebCache.dat.中

我正在使用Managed Esent(https://msdn.microsoft.com/en-us/library/microsoft.isam.esent.interop(v=exchg.10%29.aspx)+- )与.NET中的Win32 Jet api进行交互。

我的问题是我永远不能真正打开数据库,因为当我调用JetAttachDatabase时会抛出EsentPageSizeMismatchException。在研究了这个错误之后,我发现IE WebCache的页面大小是32K。当我试图纠正这个问题时,通过将DatabasePageSize系统参数设置为0x8000,JetInit开始抛出同样的异常。

下面是我拥有的代码

代码语言:javascript
复制
#stop the things locking the database
stop-process -name taskhost
stop-process -name dllhost
#give powershell access to the interop dlls
add-type -path "$PSScriptRoot\ManagedEsent 1.6\Esent.Interop.dll"
$instance = [Microsoft.Isam.Esent.Interop.JET_INSTANCE]::Nil
#set page size
[Microsoft.Isam.Esent.Interop.api]::JetSetSystemParameter(
    $instance,
    [Microsoft.Isam.Esent.Interop.JET_SESID]::Nil,
    [Microsoft.Isam.Esent.Interop.JET_param]::DatabasePageSize,
    0x8000,
    $null
)
[Microsoft.Isam.Esent.Interop.Api]::JetCreateInstance([ref]$instance,"testing")
# init the instance, throws EsentPageSizeMismatchException if the page size is not default
[Microsoft.Isam.Esent.Interop.Api]::JetInit([ref]$instance) 
$sesid = [Microsoft.Isam.Esent.Interop.JET_SESID]::Nil
[Microsoft.Isam.Esent.Interop.Api]::JetBeginSession($instance,[ref]$sesid,$null,$null)
# throws EsentPageSizeMismatchException if page size is default
[Microsoft.Isam.Esent.Interop.api]::JetAttachDatabase(
   $sesid,
   "C:\Users\Administrator\AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat",
   [Microsoft.Isam.Esent.Interop.AttachDatabaseGrbit]::ReadOnly
)
...

看起来ESENT引擎不喜欢使用非默认页面大小,但是我已经在互联网上搜索过了,似乎没有办法改变引擎页面大小。是什么导致了这个错误?

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38312774

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档