Checking if 2 areas in memory are the same in VBA - Bad Calling convention

154 Views Asked by At

I'd like to compare the memory at 2 addresses for equality. I've seen people use this:

Private Declare Function RtlCompareMemory Lib "ntdll" ( _
    ByRef Source1 As Any, _
    ByRef Source2 As Any, _
    ByVal Length As Long _
) As Long

However when I tried it gives a Bad Dll Calling convention error, which often means this function uses something other than stdcall. However these forum posts 1,2 suggest people have been using the API for VB6 applications successfully.

Has something changed in the calling convention used in some ntdll functions since that post in 2005 and can anyone suggest a workaround? I'm looking for something widely available across many VBA distributions.

0

There are 0 best solutions below