Wireshark

  • Riverbed Technology
  • WinPcap
the world's foremost network protocol analyzer
  • Wireshark
    • About
    • Download
    • Blog
  • Get Help
    • Ask a Question
    • FAQs
    • Documentation
    • Mailing Lists
    • Online Tools
    • Wiki
    • Bug Tracker
  • Develop
    • Get Involved
    • Developer's Guide
    • Browse the Code
    • Latest Builds

Wireshark-dev: [Wireshark-dev] Using a dll in a custom dissector

Date Index Thread Index Other Months All Mailing Lists
Date Prev Date Next Thread Prev Thread Next


From: <gogrady@xxxxxxxxx>
Date: Mon, 2 Mar 2009 16:23:52 +0000

hello,

I'm just learning about dll's and have created a custom dissector. I was hoping someone could help clear up using a dll with my dissector. I'm currently using LoadLibrary() and i have just started trying to use the dll. My dll will be using 2 other .lib's. Is it possible to create a variable in the dll and have functions that can be used by the dissector plugin to set it and manipulate it without having direct access to it? I have tried to do so since it is a class that i am trying to manipulate, which you cant do in c. The dll is written in c++. Also, i'm having a bit of trouble using the functions in my dissector. Here is some sample. 

after the #includes:
typedef void  (*CreateProxy)( const BYTE*, int );
typedef char * (*GetMsgName)( void );
GetMsgName			_GetMsgName;
CreateProxy			_CreateProxy;
HINSTANCE			LoadProxy;

void
load_DLL(void)
{

	LoadProxy = LoadLibrary(TEXT("IComProxy.dll"));
	if (LoadProxy != NULL) /** then load functions */
	{	
		_CreateProxy = (CreateProxy)GetProcAddress(LoadProxy, "CreateProxy");
		_GetMsgName = (GetMsgName)GetProcAddress(LoadProxy, "GetMsgName");
	}

}

void
unload_DLL(void)
{
	FreeLibrary(LoadProxy);
}

//in static void dissect_icom
void *target;
char *msg;
target = tvb_memdup(tvb, offset, data_length);
(_CreateProxy)( (const BYTE*)target, data_length); //creates an object in the dll
msg = (_GetMsgName)( void ); //should call a function in the object created in the dll to return a char *

but i get:
packet-foo.c(234) : error C2143: syntax error : missing ')' before 'type'
packet-foo.c(234) : error C2059: syntax error : ')'

Thanks for any help,
Greg



  • Follow-Ups:
    • Re: [Wireshark-dev] Using a dll in a custom dissector
      • From: wsgd
  • Prev by Date: Re: [Wireshark-dev] decoding depth & capture format
  • Next by Date: Re: [Wireshark-dev] decoding depth & capture format
  • Previous by thread: Re: [Wireshark-dev] decoding depth & capture format ==> SOLVED
  • Next by thread: Re: [Wireshark-dev] Using a dll in a custom dissector
  • Index(es):
    • Date
    • Thread

Wireshark and the "fin" logo are registered trademarks of the Wireshark Foundation