2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
5 * PURPOSE: Driver entry point
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Vizzini (vizzini@plasmic.com)
9 * CSH 01/08-2000 Created
10 * 8/20/2003 Vizzini - NDIS4/5 revisions
19 /* See debug.h for debug/trace constants */
20 DWORD DebugTraceLevel = MIN_TRACE;
25 extern KSPIN_LOCK OrphanAdapterListLock;
26 extern LIST_ENTRY OrphanAdapterListHead;
29 PDRIVER_OBJECT DriverObject)
31 * FUNCTION: Unloads the driver
33 * DriverObject = Pointer to driver object created by the system
36 NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
42 PDRIVER_OBJECT DriverObject,
43 PUNICODE_STRING RegistryPath)
45 * FUNCTION: Main driver entry point
47 * DriverObject = Pointer to a driver object for this driver
48 * RegistryPath = Registry node for configuration parameters
50 * Status of driver initialization
53 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
55 InitializeListHead(&ProtocolListHead);
56 KeInitializeSpinLock(&ProtocolListLock);
58 InitializeListHead(&MiniportListHead);
59 KeInitializeSpinLock(&MiniportListLock);
61 InitializeListHead(&AdapterListHead);
62 KeInitializeSpinLock(&AdapterListLock);
64 InitializeListHead(&OrphanAdapterListHead);
65 KeInitializeSpinLock(&OrphanAdapterListLock);
67 DriverObject->DriverUnload = (PDRIVER_UNLOAD)MainUnload;
70 * until we have PNP support, query the enum key and NdisFindDevice() each one
71 * NOTE- this will load and start other services before this one returns STATUS_SUCCESS.
72 * I hope there aren't code reentrancy problems. :)
76 return STATUS_SUCCESS;
84 NdisWriteErrorLogEntry(
85 IN NDIS_HANDLE NdisAdapterHandle,
86 IN NDIS_ERROR_CODE ErrorCode,
87 IN ULONG NumberOfErrorValues,
88 IN ULONG ERROR_LOG_MAXIMUM_SIZE)
90 * ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
93 * FUNCTION: Write a syslog error
95 * NdisAdapterHandle: Handle passed into MiniportInitialize
96 * ErrorCode: 32-bit error code to be logged
97 * NumberOfErrorValues: number of errors to log
98 * Variable: list of log items
101 * - This needs to be fixed to do var args
102 * - FIXME - this needs to be properly implemented once we have an event log
105 NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
108 /* break into a debugger so we can see what's up */
118 NdisInitializeReadWriteLock(
119 IN PNDIS_RW_LOCK Lock)
121 * FUNCTION: Initialize a NDIS_RW_LOCK
123 * Lock: pointer to the lock to initialize
128 memset(Lock,0,sizeof(NDIS_RW_LOCK));
136 NdisWriteEventLogEntry(
138 IN NDIS_STATUS EventCode,
139 IN ULONG UniqueEventValue,
140 IN USHORT NumStrings,
141 IN PVOID StringsList OPTIONAL,
143 IN PVOID Data OPTIONAL)
145 * FUNCTION: Log an event in the system event log
147 * LogHandle: pointer to the driver object of the protocol logging the event
148 * EventCode: NDIS_STATUS_XXX describing the event
149 * UniqueEventValue: identifiees this instance of the error value
150 * NumStrings: number of strings in StringList
151 * StringList: list of strings to log
152 * DataSize: number of bytes in Data
153 * Data: binary dump data to help analyzing the event
155 * - STDCALL, not CDECL like WriteError...
156 * - FIXME Needs to use the real log interface, once there is one
160 * just returning true until we have an event log
162 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
163 return NDIS_STATUS_SUCCESS;