Hi,
i've a "C" dll which has 5 input parameters and 4 output parameters
i.e.
WARRANTS_API int ValidateUserCer tificate(char *UserIP, char *PrimaryOCSP, char *SecondaryOCSP, char *PrimaryRegistr y, char *SecondaryRegis try,
char *CertHash, char *CertData, char *EDIPI, char *ErrMsg);
last 4 are the output parameters and
i) CertHash should be at least 72 bytes in size.
ii) CertData should be 4000 bytes in size
iii) EDIPI must be 1024 bytes or bigger
iv) ErrMsg should be at least 4000 bytes in size.
now i've written the C# CODE AS FOLLOWS
[DllImport(@"war rants.dll", EntryPoint = "ValidateUserCe rtificate",
ExactSpelling = true,CharSet = CharSet.Ansi, CallingConventi on = CallingConventi on.Cdecl)]
public static extern int ValidateUserCer tificate(String S1, String S2, String S3, String S4, String S5,
[MarshalAs(Unman agedType.LPTStr )] String S6, [MarshalAs(Unman agedType.LPTStr )] String S7,
[MarshalAs(Unman agedType.LPTStr )] String S8, [MarshalAs(Unman agedType.LPTStr )] String S9);
-----------------------------------------
i've C# like this:
byte[] byteHash = new byte[75];
byte[] byteData = new byte[4000];
byte[] byteMsg = new byte[2048];
byte[] byteDId = new byte[1024];
string CertHash;
string CertData;
string ErrMsg;
string DodId;
System.Text.ASC IIEncoding enc = new System.Text.ASC IIEncoding();
CertHash = enc.GetString(b yteHash);
CertData = enc.GetString(b yteData);
ErrMsg = enc.GetString(b yteMsg);
DodId = enc.GetString(b yteDId);
int HostValue = ValidCertificat e.ValidateUserC ertificate(str1 , str2, str3, str4, str5 , CertHash, CertData, DodId, ErrMsg);
When i call this it gives me error saying
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
please help
how do i solve it
i've a "C" dll which has 5 input parameters and 4 output parameters
i.e.
WARRANTS_API int ValidateUserCer tificate(char *UserIP, char *PrimaryOCSP, char *SecondaryOCSP, char *PrimaryRegistr y, char *SecondaryRegis try,
char *CertHash, char *CertData, char *EDIPI, char *ErrMsg);
last 4 are the output parameters and
i) CertHash should be at least 72 bytes in size.
ii) CertData should be 4000 bytes in size
iii) EDIPI must be 1024 bytes or bigger
iv) ErrMsg should be at least 4000 bytes in size.
now i've written the C# CODE AS FOLLOWS
[DllImport(@"war rants.dll", EntryPoint = "ValidateUserCe rtificate",
ExactSpelling = true,CharSet = CharSet.Ansi, CallingConventi on = CallingConventi on.Cdecl)]
public static extern int ValidateUserCer tificate(String S1, String S2, String S3, String S4, String S5,
[MarshalAs(Unman agedType.LPTStr )] String S6, [MarshalAs(Unman agedType.LPTStr )] String S7,
[MarshalAs(Unman agedType.LPTStr )] String S8, [MarshalAs(Unman agedType.LPTStr )] String S9);
-----------------------------------------
i've C# like this:
byte[] byteHash = new byte[75];
byte[] byteData = new byte[4000];
byte[] byteMsg = new byte[2048];
byte[] byteDId = new byte[1024];
string CertHash;
string CertData;
string ErrMsg;
string DodId;
System.Text.ASC IIEncoding enc = new System.Text.ASC IIEncoding();
CertHash = enc.GetString(b yteHash);
CertData = enc.GetString(b yteData);
ErrMsg = enc.GetString(b yteMsg);
DodId = enc.GetString(b yteDId);
int HostValue = ValidCertificat e.ValidateUserC ertificate(str1 , str2, str3, str4, str5 , CertHash, CertData, DodId, ErrMsg);
When i call this it gives me error saying
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
please help
how do i solve it