Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2007

Tip: Looking for answers? Try searching our database.

how to monitor exe and dll interactions?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 26 Oct 2007 10:29 GMT
Hello everyone,

Are there any tool or other methods which could be used to monitor which
class/method exe is accessing a DLL?

Now I met with an issue that when I provide the DLL I developed to a 3rd
parth application, it will crash sometimes and I suspect the 3rd party
application is invoking some class/method which I do not implement the DLL. I
have the full source codes of the DLL, but has no source codes of the exe so
I am wondering whether there are some methods to monitor the interactions --
e.g. I can monitor which class/method the exe is invoking and at the same
time my DLL has not implemented.

I am using Visual Studio 2005 to develop native (unmanaged) C++ DLL, and I
expose the interface of the DLL to exe through COM interface.

thanks in advance,
George
David Lowndes - 26 Oct 2007 11:40 GMT
>Are there any tool or other methods which could be used to monitor which
>class/method exe is accessing a DLL?

A debugger.

The SysInternals Process Explorer tool can tell you which processes
have a DLL loaded.

>Now I met with an issue that when I provide the DLL I developed to a 3rd
>parth application, it will crash sometimes

What sort of crash?

>I am wondering whether there are some methods to monitor the interactions --
>e.g. I can monitor which class/method the exe is invoking and at the same
>time my DLL has not implemented.
>I am using Visual Studio 2005 to develop native (unmanaged) C++ DLL, and I
>expose the interface of the DLL to exe through COM interface.

If you've got dummy methods that you fear are being called by the
other application, add some diagnostic logging so you have a better
idea what's going on.

Dave
George - 26 Oct 2007 17:48 GMT
Hi David,

What do you mean *debugger* and *The SysInternals Process Explorer tool*?
Something in Visual Studio 2005?

regards,
George

> >Are there any tool or other methods which could be used to monitor which
> >class/method exe is accessing a DLL?
[quoted text clipped - 20 lines]
>
> Dave
David Lowndes - 26 Oct 2007 20:52 GMT
>What do you mean *debugger* and *The SysInternals Process Explorer tool*?
>Something in Visual Studio 2005?

VS2005 has the debugger integrated - just press F5 to run your program
under the debugger.

Process Explorer is one of the invaluable free tools supplied by
SysInternals (now part of MS).

http://www.microsoft.com/technet/sysinternals/default.mspx

Dave
George - 29 Oct 2007 15:47 GMT
Thanks Dave,

I have downloaded process monitor tool and it looks great! So many cool
figures and dynamic. :-)

For my original question, I think it should be better that I solve it by
myself mostly from my own efforts, but to tell the truth I have no experience
of this tool and it is highly appreciated if you could give me some start
point of this tool, e.g. which menu and which function item I should use from
this tool to monitor the interactions between EXE and COM DLL. Then, from
your directed start point, I will do some research work by myself to make my
hands dirty.

regards,
George

> >What do you mean *debugger* and *The SysInternals Process Explorer tool*?
> >Something in Visual Studio 2005?
[quoted text clipped - 8 lines]
>
> Dave
David Lowndes - 29 Oct 2007 16:22 GMT
>For my original question, I think it should be better that I solve it by
>myself mostly from my own efforts, but to tell the truth I have no experience
>of this tool and it is highly appreciated if you could give me some start
>point of this tool, e.g. which menu and which function item I should use from
>this tool to monitor the interactions between EXE and COM DLL.

I won't let you monitor the interactions of your COM DLL, but it will
let you find which processes have it loaded - use the Find menu item
to find the name of your DLL and it'll show any processes that
currently have it loaded.

Dave
George - 30 Oct 2007 06:34 GMT
Thanks Dave,

I have tried with process explorer, but it could only get the list of the
DLL which is loaded by an EXE, and can not monitor the interactions between
EXE and DLL (e.g. function call), right?

regards,
George

> >For my original question, I think it should be better that I solve it by
> >myself mostly from my own efforts, but to tell the truth I have no experience
[quoted text clipped - 8 lines]
>
> Dave
David Lowndes - 30 Oct 2007 08:47 GMT
>I have tried with process explorer, but it could only get the list of the
>DLL which is loaded by an EXE, and can not monitor the interactions between
>EXE and DLL (e.g. function call), right?

Yes.

It sounds like you need some sort of COM spy utility. The only one I
can immediately see is here:
http://staff.develop.com/jasonw/comspy/default.htm - but it doesn't
appear to be maintained :(

Dave
Ben Voigt [C++ MVP] - 29 Oct 2007 14:26 GMT
> >Are there any tool or other methods which could be used to monitor which
>>class/method exe is accessing a DLL?
[quoted text clipped - 19 lines]
> other application, add some diagnostic logging so you have a better
> idea what's going on.

For example, force all your dummy functions to call DebugBreak.

> Dave
George - 29 Oct 2007 15:34 GMT
Thanks Ben,

Your solution does not work for me. Because in my situation, I do not have
the non-implemented methods -- even an empty skeleton with a single return
statement. So, I do not have a function to set a break point or break
activelt using DebugBreak.  

regards,
George

> > >Are there any tool or other methods which could be used to monitor which
> >>class/method exe is accessing a DLL?
[quoted text clipped - 23 lines]
>
> > Dave
Ben Voigt [C++ MVP] - 29 Oct 2007 17:41 GMT
> Thanks Ben,
>
> Your solution does not work for me. Because in my situation, I do not have
> the non-implemented methods -- even an empty skeleton with a single return
> statement. So, I do not have a function to set a break point or break
> activelt using DebugBreak.

What does exist?  There must be something... because if the function didn't
exist at all there would be no way to compile a call to it.

So what does this non-implemented method look like?  A coclass that doesn't
implement a particular interface (break on the failure path of
IUnknown::QueryInterface)?  A dispinterface with some DISPIDs not
implemented (break on the failure path of IDispatch::Invoke)?

> regards,
> George
George - 30 Oct 2007 06:37 GMT
Thanks Ben,

There are some optional interface, which I do not implement (means no
skeleton functions -- e.g. only a return value in implementation body).

Have I made myself understood? Any comments?

regards,
George

> > Thanks Ben,
> >
[quoted text clipped - 13 lines]
> > regards,
> > George
Ben Voigt [C++ MVP] - 01 Nov 2007 15:44 GMT
> Thanks Ben,
>
> There are some optional interface, which I do not implement (means no
> skeleton functions -- e.g. only a return value in implementation body).
>
> Have I made myself understood? Any comments?

If you are not implementing an optional interface, then you return failure
from IUnknown::QueryInterface when that IID is requested, correct?
Therefore just make QueryInterface write a log message or call
OutputDebugString when it sees an unsupported IID, then you can find out
which interfaces the application is trying to use.

> regards,
> George
[quoted text clipped - 20 lines]
>> > regards,
>> > George
George - 29 Nov 2007 09:30 GMT
Thanks Ben,

Seems that some implementation of the methods are not correct, since all the
IID are implemented in QueryInterface.

regards,
George

> > Thanks Ben,
> >
[quoted text clipped - 33 lines]
> >> > regards,
> >> > George

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.