views:

35

answers:

0

I am using pinvoke to call functions from sslscan tool based on openssl; I checked by hit and trial that where exception is occuring is due to memset. It runs fine when i run it natively in VS.but using pinvoke causes this exception in c#.Its System.AccessViolation Exception.

These are the declarations:

struct sslCheckOptions options; memset(&options,0, sizeof(struct sslCheckOptions)); The struct is given :

struct sslCheckOptions
{

 char host[512];
 int port;
 int noFailed;
 int starttls;
 int sslVersion;
 int targets;
 int pout;
 int sslbugs;
 int http;
 int quiet;

 // File Handles...
 FILE *xmlOutput;

 // TCP Connection Variables...
 struct hostent *hostStruct;
 struct sockaddr_in serverAddress;

 // SSL Variables...
 SSL_CTX *ctx;
 struct sslCipher *ciphers;
 char *clientCertsFile;
 char *privateKeyFile;
 char *privateKeyPassword;

 // CA variables...
 char *CAfile;
 char *CApath;
}

It runs fine when i click on exe file from which i am importing functions.Yeah,I am not importing from dll but exe(console). Any ideas??