Uwe Bonnes wrote:

Go ahead with implementing ;-)

Here is a implementation that can exclude relay calls from builtin dlls. I used '<builtin>' as the magic word because '%' is possible in file names.

Calls to window procedures and DLL attach/detach are still shown, but that is the same as the original nrelay patch.

> And let's add %deferred%

What do mean by 'deferred'?

Richard.
Index: dlls/ntdll/loader.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/loader.c,v
retrieving revision 1.98
diff -u -p -r1.98 loader.c
--- dlls/ntdll/loader.c	19 Jul 2005 11:44:32 -0000	1.98
+++ dlls/ntdll/loader.c	3 Aug 2005 15:48:44 -0000
@@ -389,12 +389,14 @@ static FARPROC find_ordinal_export( HMOD
     if (TRACE_ON(snoop))
     {
         const WCHAR *user = current_modref ? current_modref->ldr.BaseDllName.Buffer : NULL;
-        proc = SNOOP_GetProcAddress( module, exports, exp_size, proc, ordinal, user );
+        proc = SNOOP_GetProcAddress( module, exports, exp_size, proc, ordinal, user,
+                   current_modref ? current_modref->ldr.Flags & LDR_WINE_INTERNAL : FALSE );
     }
     if (TRACE_ON(relay))
     {
         const WCHAR *user = current_modref ? current_modref->ldr.BaseDllName.Buffer : NULL;
-        proc = RELAY_GetProcAddress( module, exports, exp_size, proc, user );
+        proc = RELAY_GetProcAddress( module, exports, exp_size, proc, user, 
+                   current_modref ? current_modref->ldr.Flags & LDR_WINE_INTERNAL : FALSE);
     }
     return proc;
 }
@@ -794,6 +796,8 @@ static void call_tls_callbacks( HMODULE 
                     GetCurrentThreadId(), *callback, module, reason_names[reason] );
     }
 }
+
+
 
 
 /*************************************************************************
Index: dlls/ntdll/relay.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/relay.c,v
retrieving revision 1.28
diff -u -p -r1.28 relay.c
--- dlls/ntdll/relay.c	22 Jul 2005 19:50:13 -0000	1.28
+++ dlls/ntdll/relay.c	3 Aug 2005 15:48:44 -0000
@@ -330,9 +330,10 @@ static BOOL check_relay_include( const c
  * Check if calls from a given module must be included in the relay/snoop output,
  * given the exclusion and inclusion lists.
  */
-static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludelist, const WCHAR *module )
+static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludelist, const WCHAR *module, BOOL from_builtin )
 {
     static const WCHAR dllW[] = {'.','d','l','l',0 };
+    static const WCHAR builtinW[] = {'<','b','u','i','l','t','i','n','>',0 };
     const WCHAR **listitem;
     BOOL show;
 
@@ -352,6 +353,7 @@ static BOOL check_from_module( const WCH
     {
         int len;
 
+        if (from_builtin && !strcmpiW( *listitem, builtinW )) return !show;
         if (!strcmpiW( *listitem, module )) return !show;
         len = strlenW( *listitem );
         if (!strncmpiW( *listitem, module, len ) && !strcmpiW( module + len, dllW ))
@@ -622,21 +624,20 @@ static BOOL is_register_entry_point( con
  * Return the proc address to use for a given function.
  */
 FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
-                              DWORD exp_size, FARPROC proc, const WCHAR *user )
+                              DWORD exp_size, FARPROC proc, const WCHAR *user, BOOL from_builtin )
 {
     const DEBUG_ENTRY_POINT *debug = (DEBUG_ENTRY_POINT *)proc;
     const DEBUG_ENTRY_POINT *list = (const DEBUG_ENTRY_POINT *)((const char *)exports + exp_size);
 
     if (debug < list || debug >= list + exports->NumberOfFunctions) return proc;
     if (list + (debug - list) != debug) return proc;  /* not a valid address */
-    if (check_from_module( debug_from_relay_includelist, debug_from_relay_excludelist, user ))
+    if (check_from_module( debug_from_relay_includelist, debug_from_relay_excludelist, user, from_builtin ))
        return proc;  /* we want to relay it */
     if (!debug->call) return proc;  /* not a normal function */
     if (debug->call != 0xe8 && debug->call != 0xe9) return proc; /* not a debug thunk at all */
     return debug->orig;
 }
 
-
 /***********************************************************************
  *           RELAY_SetupDLL
  *
@@ -774,7 +775,7 @@ void SNOOP_SetupDLL(HMODULE hmod)
  */
 FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports,
                               DWORD exp_size, FARPROC origfun, DWORD ordinal,
-                              const WCHAR *user)
+                              const WCHAR *user, BOOL from_builtin)
 {
     unsigned int i;
     const char *ename;
@@ -785,7 +786,7 @@ FARPROC SNOOP_GetProcAddress( HMODULE hm
     const IMAGE_SECTION_HEADER *sec;
 
     if (!TRACE_ON(snoop)) return origfun;
-    if (!check_from_module( debug_from_snoop_includelist, debug_from_snoop_excludelist, user ))
+    if (!check_from_module( debug_from_snoop_includelist, debug_from_snoop_excludelist, user, from_builtin ))
         return origfun; /* the calling module was explicitly excluded */
 
     if (!*(LPBYTE)origfun) /* 0x00 is an imposs. opcode, poss. dataref. */
Index: dlls/ntdll/ntdll_misc.h
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/ntdll_misc.h,v
retrieving revision 1.62
diff -u -p -r1.62 ntdll_misc.h
--- dlls/ntdll/ntdll_misc.h	2 Aug 2005 09:55:40 -0000	1.62
+++ dlls/ntdll/ntdll_misc.h	3 Aug 2005 15:48:44 -0000
@@ -64,9 +64,9 @@ extern void DECLSPEC_NORETURN server_abo
 
 /* module handling */
 extern FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
-                                     DWORD exp_size, FARPROC proc, const WCHAR *user );
+                                     DWORD exp_size, FARPROC proc, const WCHAR *user, BOOL from_builtin);
 extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size,
-                                     FARPROC origfun, DWORD ordinal, const WCHAR *user );
+                                     FARPROC origfun, DWORD ordinal, const WCHAR *user, BOOL from_builtin );
 extern void RELAY_SetupDLL( HMODULE hmod );
 extern void SNOOP_SetupDLL( HMODULE hmod );
 extern UNICODE_STRING system_dir;

Reply via email to