I have to call VM32VBWRAP.dll from c#. It is a library for manage pvcs from code. I am able for calling all methods which don't have any ref parameter. But I can't call methods with ref parameters.
I always get this error:
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt." at System.StubHelpers.MngdNativeArrayMarshaler.ConvertContentsToManaged(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) at LibraryPanello.SourceControl.Pvcs.PvcsGetLockInfoVB(Int32 archiveType, String pathAndFileNameServer, String pathAndFileNameLocal, String usernameInPVCS, Byte[]& version, Byte[]& versionNew, Byte[]& usernameOutPVCS, Int16 info, Byte flag)
My declaration is:
[DllImport("VM32VBWRAP.dll", CharSet = CharSet.Ansi, SetLastError = true,
EntryPoint = "_wPvcsGetLockInfoVB@36")]
static extern int PvcsGetLockInfoVB(
int archiveType, string pathAndFileNameServer,
string pathAndFileNameLocal, string usernameInPVCS,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 64)] ref byte[] version,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 64)] ref byte[] versionNew,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 64)] ref byte[] usernameOutPVCS,
short info, byte flag );
Any idea????