Caching Application Block

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

Hi all,

I have the following:

Dim oCM As CacheManager = CacheManager.GetCacheManager
Dim sConfigKey As String =
"Kensington.Middleware.RulesEngine.EngineOverrides." &
presentationType
Dim strEngineOverrides As String
If oCM("EngineOverrides" & presentationType) Is Nothing Then
Dim oXML As New XmlDocument
Dim oConfigUtil As New ConfigUtility
Dim sConfigLocation As String =
oConfigUtil.GetResourceFromConfig(System.AppDomain.CurrentDomain.BaseDirectory,
sConfigKey, True)
oXML.Load(sConfigLocation)
strEngineOverrides = oXML.OuterXml
Dim iCacheExpiry() As ICacheItemExpiration = {New
FileDependency(sConfigLocation)}
oCM.Add(sConfigKey, strEngineOverrides) ', iCacheExpiry,
CacheItemPriority.Low, New CacheItemRemovedCallback(AddressOf
Me.OnCacheExpiry))
Else
strEngineOverrides = oCM("EngineOverrides" &
presentationType)
End If

Return strEngineOverrides


My project references the following projects in my solution:
Microsoft.ApplicationBlocks.Data
Microsoft.ApplicationBlocks.Cache
Microsoft.ApplicationBlocks.ExceptionManagement
Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces
Microsoft.ApplicationBlocks.MemoryMappedFile

On the add method, I get the following:

System.Exception: Encryption failed.Unable to find an entry point
named FormatMessage in DLL kernel32.dll

Which emanates from here in the WIN32DPAPI.vb in the cache assembly:

Dim isValue As Integer = FormatMessage(dwFlag,
ptrlpSource, _
errorCode, 0, lpMsgBuf, messageSize, prtArguments)

Any help would be much appreciated...

TIA

Matthew
 
I have inspected kernel32.dll with dumpbin and it exports two flavours
of
formatmessage viz FormatMessageA, and FormatMessageW, but not
FormatMessage as defined in the error message. Have I perhaps got an
old version of kernel32.dll?

The method declaration looks like this:
Private Declare Function FormatMessage Lib "kernel32.dll" ( _
ByVal dwFlag As Integer, ByRef lpSource As IntPtr, _
ByVal dwMessageId As Integer, ByVal dwLanguageId As
Integer, _
ByRef lpBuffer As String, ByVal nSize As Integer, _
ByVal Arguments As IntPtr) As Integer

I guess I'll try renaming the method, but this is the Out-the-box
version of the application block....

Thanks
Matthew
 
Back
Top