delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/05/22:07:52

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3B96DA8B.3B50CB67@hszk.bme.hu>
Date: Thu, 06 Sep 2001 04:08:11 +0200
From: Nemeth Marton <nm127 AT hszk DOT bme DOT hu>
X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.4 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: How to build a "function call logger" .dll?

Hi!

I want to build a "function call logger" .dll which could write out each
function call with the call parameters to a logfile.

Original working of a "program.exe" and "funcs.dll":

 --------------------			-------------------------
 |  program.exe     |			| funcs.dll		|
 |                  |			|			|
 |  imports: func_a <==================== exports: func_a	|
 |                  |			|			|
 --------------------			-------------------------

If I want to log what functions the "program.exe" calls I have to make
an other "funcs.dll" as a replacement. The original "funcs.dll" can be
renamed as "funcs-orig.dll".
Now this should work as follows:

 --------------------	--------------------	-------------------------
 |  program.exe     |	| funcs.dll	   |	| funcs-orig.dll	|
 |                  |	|		   |	| 			|
 |		    |	|   imports: func_a <===== exports: func_a	|
 |  imports: func_a <====exports: func_a   |	|			|
 |                  |	|		   |	|			|
 --------------------	---------|-----------	-------------------------
				 |
				\|/
			    logfile.txt

The problem is that in the new source code I have to use 2 func_a: the
first one to export to the program.exe and the second one to import from
funcs-orig.dll like this:

void func_a() {		// this is the new exported function
	// log to logfile.txt
	func_a();	// this shoud be a call to funcs-orig.dll's func_a()
}

Is it possible to make something like this?

Thanks,

	NMarci

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019