Hi, I renamed the main function of tshark.c as Tb_Main() Like the code in this link: https://github.com/AkibHossainOmi/wireshark/blob/master/tshark.c
specific code section :
int
main(int argc, char* argv[])
{
// For debug purpose
// argc = 4;
// argv[1] = "-Tjson";
// argv[2] = "-r";
// argv[3] = "/home/omi/packet.pcap";
char* result = Tb_Main(argc, argv);
free(result);
return exit_status;
}
I change it to,
int
main(int argc, char* argv[])
{
// For debug purpose
argc = 4;
argv[1] = "-Tjson";
argv[2] = "-r";
argv[3] = "D:\\Windows\\files\\packet.pcap";
while (1)
{
char* result = Tb_Main(argc, argv);
free(result);
printf("Ok\n");
}
return exit_status;
}
Now It is giving the exception,
Exception thrown: read access violation.
**arg** was 0xFFFFFFFFFFFFFFFF.
Having the exception in different line each time when I am running and debugging it.
Note: This is running in the first time successfully in most cases and getting exception. This tshark source is supposed to return a json string of a pcap file data by the function Tb_Main().