Add debug SnoopFromInclude/SnoopFromExclude options
Mike Hearn
mh at codeweavers.com
Fri Mar 12 14:20:51 CST 2004
Mike Hearn <mh at codeweavers.com>
- Add debug SnoopFromInclude/SnoopFromExclude options
- Correct TRACE debug channel usage in SNOOP_SetupDLL
Index: dlls/ntdll/relay.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/relay.c,v
retrieving revision 1.9
diff -u -w -r1.9 relay.c
--- dlls/ntdll/relay.c 12 Mar 2004 01:59:35 -0000 1.9
+++ dlls/ntdll/relay.c 12 Mar 2004 20:14:38 -0000
@@ -47,6 +47,8 @@
static const WCHAR **debug_snoop_includelist;
static const WCHAR **debug_from_relay_excludelist;
static const WCHAR **debug_from_relay_includelist;
+static const WCHAR **debug_from_snoop_excludelist;
+static const WCHAR **debug_from_snoop_includelist;
/* compare an ASCII and a Unicode string without depending on the current codepage */
inline static int strcmpAW( const char *strA, const WCHAR *strW )
@@ -126,6 +128,8 @@
static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
static const WCHAR RelayFromIncludeW[] = {'R','e','l','a','y','F','r','o','m','I','n','c','l','u','d','e',0};
static const WCHAR RelayFromExcludeW[] = {'R','e','l','a','y','F','r','o','m','E','x','c','l','u','d','e',0};
+ static const WCHAR SnoopFromIncludeW[] = {'S','n','o','o','p','F','r','o','m','I','n','c','l','u','d','e',0};
+ static const WCHAR SnoopFromExcludeW[] = {'S','n','o','o','p','F','r','o','m','E','x','c','l','u','d','e',0};
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
@@ -180,6 +184,20 @@
debug_from_relay_excludelist = build_list( str );
}
+ RtlInitUnicodeString( &name, SnoopFromIncludeW );
+ if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
+ {
+ TRACE_(snoop)("SnoopFromInclude = %s\n", debugstr_w(str) );
+ debug_from_snoop_includelist = build_list( str );
+ }
+
+ RtlInitUnicodeString( &name, SnoopFromExcludeW );
+ if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
+ {
+ TRACE_(snoop)( "SnoopFromExclude = %s\n", debugstr_w(str) );
+ debug_from_snoop_excludelist = build_list( str );
+ }
+
NtClose( hkey );
}
@@ -337,6 +355,46 @@
return show;
}
+/***********************************************************************
+ * check_snoop_from_module
+ *
+ * Check if calls from a given module must be included in the snoop output.
+ */
+static BOOL check_snoop_from_module( LPCSTR module )
+{
+ static const WCHAR dllW[] = {'.','d','l','l',0 };
+ const WCHAR **listitem;
+ BOOL show;
+ UNICODE_STRING moduleW;
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&moduleW, module)) {
+ ERR("Could not parse \"%s\" as unicode string\n", module);
+ return FALSE;
+ }
+
+ if (!debug_from_snoop_excludelist && !debug_from_snoop_includelist) return TRUE;
+ if (debug_from_snoop_excludelist)
+ {
+ show = TRUE;
+ listitem = debug_from_snoop_excludelist;
+ }
+ else
+ {
+ show = FALSE;
+ listitem = debug_from_snoop_includelist;
+ }
+ for(; *listitem; listitem++)
+ {
+ int len;
+
+ if (!strcmpiW( *listitem, moduleW.Buffer )) return !show;
+ len = strlenW( *listitem );
+ if (!strncmpiW( *listitem, moduleW.Buffer, len ) && !strcmpiW( moduleW.Buffer + len, dllW ))
+ return !show;
+ }
+ return show;
+}
+
/***********************************************************************
* find_exported_name
@@ -793,7 +851,12 @@
if (!exports) return;
name = (char *)hmod + exports->Name;
- TRACE("hmod=%p, name=%s\n", hmod, name);
+ if (!check_snoop_from_module(name)) {
+ TRACE_(snoop)("skipping snoop for %s\n", name);
+ return;
+ }
+
+ TRACE_(snoop)("hmod=%p, name=%s\n", hmod, name);
while (*dll) {
if ((*dll)->hmod == hmod)
More information about the wine-patches
mailing list