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

Date: Tue, 3 Mar 2009 17:00:28 +0000
I was hoping someone would have tried something like this before so they could help me. I'm having a problem with the LoadLibrary line i'm pretty sure. Wireshark will load, but when i go to dissect my packets, it freezes. I'm not sure how to fix this or what exactly is happening. If anyone could help it would be great. 

Greg
---- gogrady@xxxxxxxxx wrote: 

=============
Hi,

In my infinite wisdom msg = (_GetMsgName)( void ); should be msg = (_GetMsgName)( );

But now when i run wireshark, it crashes. Is there a way to tell why it is crashing? I'm not sure what the cause is. 

Thanks,
Greg

---- wsgd <wsgd@xxxxxxx> wrote: 

=============

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

234 is the line where appears the problem.
Look at this line.

Perhaps you can find more help on forums about windows and C/C++.


Olivier

gogrady@xxxxxxxxx a écrit :
> 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
>
>
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>
>
>   


-- 
Wireshark Generic Dissector http://wsgd.free.fr

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe