ReactOS 0.4.17-dev-1321-g5c122a9
main.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: ndis/main.c
5 * PURPOSE: Driver entry point
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Vizzini (vizzini@plasmic.com)
8 * REVISIONS:
9 * CSH 01/08-2000 Created
10 * 20 Aug 2003 Vizzini - NDIS4/5 revisions
11 * 3 Oct 2003 Vizzini - formatting and minor bugfixing
12 */
13
14#include "ndissys.h"
15
16#if DBG
17
18/* See debug.h for debug/trace constants */
20
21#endif /* DBG */
22
24
26
27static
28CODE_SEG("INIT")
29VOID
31{
33 ULONG AllowFlowControlUnderDebugger;
34
35 /* Set defaults */
37 AllowFlowControlUnderDebugger = FALSE;
38
40
42 QueryTable[0].Name = L"AllowFlowControlUnderDebugger";
43 QueryTable[0].EntryContext = &AllowFlowControlUnderDebugger;
45 QueryTable[0].DefaultData = &AllowFlowControlUnderDebugger;
46 QueryTable[0].DefaultLength = sizeof(ULONG);
47
49 L"NDIS\\Parameters",
51 NULL,
52 NULL);
53
54 /*
55 * Disable flow control when a Kernel Debugger is attached.
56 *
57 * When the debugger stops at a breakpoint the NIC keeps frame reception,
58 * which could eventually cause the receiver to run out of buffers.
59 * At this point, the NIC may start spamming pause frames.
60 * This is undesirable for some use cases.
61 */
63 NdisEnableTxRxFlowControl = AllowFlowControlUnderDebugger;
64}
65
68/*
69 * FUNCTION: Unloads the driver
70 * ARGUMENTS:
71 * DriverObject = Pointer to driver object created by the system
72 */
73{
74 NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
75}
76
77CODE_SEG("INIT")
83/*
84 * FUNCTION: Main driver entry point
85 * ARGUMENTS:
86 * DriverObject = Pointer to a driver object for this driver
87 * RegistryPath = Registry node for configuration parameters
88 * RETURNS:
89 * Status of driver initialization
90 */
91{
92 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
93
96
99
102
103 DriverObject->DriverUnload = MainUnload;
104
105 CancelId = 0;
106
108
109 return STATUS_SUCCESS;
110}
111
112
113/*
114 * @implemented
115 */
116VOID
117_cdecl
119 IN NDIS_HANDLE NdisAdapterHandle,
122 ...)
123/*
124 * FUNCTION: Write a syslog error
125 * ARGUMENTS:
126 * NdisAdapterHandle: Handle passed into MiniportInitialize
127 * ErrorCode: 32-bit error code to be logged
128 * NumberOfErrorValues: number of errors to log
129 * Variable: list of log items
130 * NOTES:
131 * - THIS IS >CDECL<
132 * - This needs to be fixed to do var args
133 * - FIXME - this needs to be properly implemented once we have an event log
134 */
135{
136 NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
137 /* ASSERT(0); */
138}
139
140
141/*
142 * @implemented
143 */
145EXPORT
154/*
155 * FUNCTION: Log an event in the system event log
156 * ARGUMENTS:
157 * LogHandle: pointer to the driver object of the protocol logging the event
158 * EventCode: NDIS_STATUS_XXX describing the event
159 * UniqueEventValue: identifies this instance of the error value
160 * NumStrings: number of strings in StringList
161 * StringList: list of strings to log
162 * DataSize: number of bytes in Data
163 * Data: binary dump data to help analyzing the event
164 * NOTES:
165 * - NTAPI, not CDECL like WriteError...
166 * - FIXME Needs to use the real log interface, once there is one
167 */
168{
169 /*
170 * just returning true until we have an event log
171 */
172 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
173 return NDIS_STATUS_SUCCESS;
174}
175
176/* EOF */
#define CODE_SEG(...)
LONG NTSTATUS
Definition: precomp.h:26
#define MIN_TRACE
Definition: debug.h:14
#define MAX_TRACE
Definition: debug.h:16
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DRIVER_INITIALIZE DriverEntry
Definition: main.c:9
#define L(x)
Definition: resources.c:13
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
LIST_ENTRY AdapterListHead
Definition: miniport.c:57
LIST_ENTRY MiniportListHead
Definition: miniport.c:53
KSPIN_LOCK AdapterListLock
Definition: miniport.c:58
KSPIN_LOCK MiniportListLock
Definition: miniport.c:54
LIST_ENTRY ProtocolListHead
Definition: protocol.c:19
KSPIN_LOCK ProtocolListLock
Definition: protocol.c:20
ULONG NdisEnableTxRxFlowControl
Definition: main.c:25
static VOID NdisReadRegistryEntries(VOID)
Definition: main.c:30
NDIS_STATUS EXPORT NdisWriteEventLogEntry(IN PVOID LogHandle, IN NDIS_STATUS EventCode, IN ULONG UniqueEventValue, IN USHORT NumStrings, IN PVOID StringsList OPTIONAL, IN ULONG DataSize, IN PVOID Data OPTIONAL)
Definition: main.c:146
LONG CancelId
Definition: main.c:23
VOID _cdecl NdisWriteErrorLogEntry(IN NDIS_HANDLE NdisAdapterHandle, IN NDIS_ERROR_CODE ErrorCode, IN ULONG NumberOfErrorValues,...)
Definition: main.c:118
VOID NTAPI MainUnload(PDRIVER_OBJECT DriverObject)
Definition: main.c:66
ULONG DebugTraceLevel
Definition: ndis.c:13
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID StringsList
Definition: ndis.h:4756
_In_ NDIS_ERROR_CODE _In_ ULONG NumberOfErrorValues
Definition: ndis.h:4439
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4757
_In_ UINT _Out_ PNDIS_HANDLE LogHandle
Definition: ndis.h:5384
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT NumStrings
Definition: ndis.h:4755
_In_ NDIS_STATUS EventCode
Definition: ndis.h:4753
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4438
#define NDIS_ERROR_CODE
Definition: ndis.h:560
_In_ NDIS_STATUS _In_ ULONG UniqueEventValue
Definition: ndis.h:4754
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4231
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define RTL_REGISTRY_SERVICES
Definition: nt_native.h:162
int NDIS_STATUS
Definition: ntddndis.h:496
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define REG_DWORD
Definition: sdbapi.c:615
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define RTL_QUERY_REGISTRY_TYPECHECK
Definition: winternl.h:3589
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
#define RTL_QUERY_REGISTRY_TYPECHECK_SHIFT
Definition: winternl.h:3591
#define KD_DEBUGGER_ENABLED
Definition: kdfuncs.h:130