V
VisithraVenkatesan
Guest
Hi All,
When my application is running on x86 the program works fine. When I run it on x64, the Access Violation exception occurs. Exception details mentioned below.
"System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'"
I thought that the problem lies in Marshalling. Do I have to manually Marshal the structure? Need help on this. I would prefer to have the same struct for both x64 and x86.
Example here:
My native method is defined like below.
internal struct CWPSTRUCT
{
internal IntPtr lParam;
internal IntPtr wParam;
internal int message;
internal IntPtr hwnd;
}
Main Code:
int lParam;
CWPSTRUCT cwp = (CWPSTRUCT)Marshal.PtrToStructure(lParam, typeof(CWPSTRUCT));
Regards
Visithra Venkatesan
Continue reading...
When my application is running on x86 the program works fine. When I run it on x64, the Access Violation exception occurs. Exception details mentioned below.
"System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'"
I thought that the problem lies in Marshalling. Do I have to manually Marshal the structure? Need help on this. I would prefer to have the same struct for both x64 and x86.
Example here:
My native method is defined like below.
internal struct CWPSTRUCT
{
internal IntPtr lParam;
internal IntPtr wParam;
internal int message;
internal IntPtr hwnd;
}
Main Code:
int lParam;
CWPSTRUCT cwp = (CWPSTRUCT)Marshal.PtrToStructure(lParam, typeof(CWPSTRUCT));
Regards
Visithra Venkatesan
Continue reading...