diff --git a/reactos/drivers/network/tcpip/include/debug.h b/reactos/drivers/network/tcpip/include/debug.h index 8b8419cdfca..af16b58769d 100644 --- a/reactos/drivers/network/tcpip/include/debug.h +++ b/reactos/drivers/network/tcpip/include/debug.h @@ -9,11 +9,9 @@ #ifndef __DEBUG_H #define __DEBUG_H -#define NORMAL_MASK 0x000000FF -#define SPECIAL_MASK 0xFFFFFF00 -#define MIN_TRACE 0x00000001 -#define MID_TRACE 0x00000002 -#define MAX_TRACE 0x00000003 +#define MIN_TRACE DPFLTR_WARNING_LEVEL +#define MID_TRACE DPFLTR_WARNING_LEVEL | DPFLTR_TRACE_LEVEL +#define MAX_TRACE DPFLTR_WARNING_LEVEL | DPFLTR_TRACE_LEVEL | DPFLTR_INFO_LEVEL #define DEBUG_CHECK 0x00000100 #define DEBUG_MEMORY 0x00000200 @@ -33,33 +31,14 @@ #define DEBUG_CPOINT 0x00800000 #define DEBUG_LOCK 0x01000000 #define DEBUG_INFO 0x02000000 -#define DEBUG_ULTRA 0xFFFFFFFF +#define DEBUG_ULTRA 0x7FFFFFFF #ifdef DBG -extern DWORD DebugTraceLevel; - -#ifdef _MSC_VER - +#define REMOVE_PARENS(...) __VA_ARGS__ #define TI_DbgPrint(_t_, _x_) \ - if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \ - ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ - DbgPrint _x_ ; \ - } - -#else /* _MSC_VER */ - -#define TI_DbgPrint(_t_, _x_) \ - if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \ - ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ - DbgPrint _x_ ; \ - } - -#endif /* _MSC_VER */ - -#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x)) + DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) & DPFLTR_MASK, "(%s:%d) ", __FILE__, __LINE__), \ + DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) & DPFLTR_MASK, REMOVE_PARENS _x_) #else /* DBG */ diff --git a/reactos/drivers/network/tcpip/tcpip/main.c b/reactos/drivers/network/tcpip/tcpip/main.c index 2792100f7fa..370b8fb90bc 100644 --- a/reactos/drivers/network/tcpip/tcpip/main.c +++ b/reactos/drivers/network/tcpip/tcpip/main.c @@ -419,10 +419,7 @@ TiDispatchOpenClose( } -NTSTATUS -#ifndef _MSC_VER -STDCALL -#endif +NTSTATUS NTAPI TiDispatchInternal( PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -526,10 +523,7 @@ TiDispatchInternal( } -NTSTATUS -#ifndef _MSC_VER -STDCALL -#endif +NTSTATUS NTAPI TiDispatch( PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -687,10 +681,7 @@ VOID STDCALL IPTimeoutDpcFn( } } -NTSTATUS -#ifndef _MSC_VER -STDCALL -#endif +NTSTATUS NTAPI DriverEntry( PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) @@ -870,14 +861,14 @@ DriverEntry( DueTime.QuadPart = -(LONGLONG)IP_TIMEOUT * 10000; KeSetTimerEx(&IPTimer, DueTime, IP_TIMEOUT, &IPTimeoutDpc); + /* ROS Hack: ideally, DebugTraceLevel variable should be removed */ + DbgSetDebugFilterState(DPFLTR_TCPIP_ID, DebugTraceLevel, TRUE); + return STATUS_SUCCESS; } -VOID -#ifndef _MSC_VER -STDCALL -#endif +VOID NTAPI IPAddInterface( DWORD Unknown0, DWORD Unknown1, @@ -889,10 +880,7 @@ IPAddInterface( } -VOID -#ifndef _MSC_VER -STDCALL -#endif +VOID NTAPI IPDelInterface( DWORD Unknown0) { @@ -900,10 +888,7 @@ IPDelInterface( } -VOID -#ifndef _MSC_VER -STDCALL -#endif +VOID NTAPI LookupRoute( DWORD Unknown0, DWORD Unknown1) diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 9a3c71f89eb..69f559073fb 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -240,7 +240,12 @@ typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; #define DPFLTR_INFO_LEVEL 3 #define DPFLTR_MASK 0x80000000 -#define DPFLTR_PREFETCHER_ID 63 +typedef enum _DPFLTR_TYPE +{ + DPFLTR_I8042PRT_ID = 15, + DPFLTR_TCPIP_ID = 30, + DPFLTR_PREFETCHER_ID = 65, +} DPFLTR_TYPE; #define MAXIMUM_PROCESSORS 32 diff --git a/reactos/lib/drivers/ip/network/routines.c b/reactos/lib/drivers/ip/network/routines.c index 3753ca42c2c..3de49816cc6 100644 --- a/reactos/lib/drivers/ip/network/routines.c +++ b/reactos/lib/drivers/ip/network/routines.c @@ -94,7 +94,8 @@ VOID DisplayTCPPacket( UINT Length; PCHAR Buffer; - if ((DebugTraceLevel & (DEBUG_PBUFFER | DEBUG_TCP)) != (DEBUG_PBUFFER | DEBUG_TCP)) { + if (!DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) || + !DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK)) { return; } @@ -137,7 +138,8 @@ VOID DisplayIPPacket( PNDIS_BUFFER NextBuffer; PCHAR CharBuffer; - if ((DebugTraceLevel & (DEBUG_PBUFFER | DEBUG_IP)) != (DEBUG_PBUFFER | DEBUG_IP)) { + if (!DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) || + !DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK)) { return; }