我正在尝试创建一个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开始抛出同样的异常。
下面是我拥有的代码
#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引擎不喜欢使用非默认页面大小,但是我已经在互联网上搜索过了,似乎没有办法改变引擎页面大小。是什么导致了这个错误?
https://stackoverflow.com/questions/38312774
复制相似问题