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 * 20 Aug 2003 Vizzini - NDIS4/5 revisions
11 * 3 Oct 2003 Vizzini - formatting and minor bugfixing
20 /* See debug.h for debug/trace constants */
21 DWORD DebugTraceLevel
= MIN_TRACE
;
26 extern KSPIN_LOCK OrphanAdapterListLock
;
27 extern LIST_ENTRY OrphanAdapterListHead
;
30 VOID STDCALL
MainUnload(
31 PDRIVER_OBJECT DriverObject
)
33 * FUNCTION: Unloads the driver
35 * DriverObject = Pointer to driver object created by the system
38 NDIS_DbgPrint(MAX_TRACE
, ("Leaving.\n"));
45 PDRIVER_OBJECT DriverObject
,
46 PUNICODE_STRING RegistryPath
)
48 * FUNCTION: Main driver entry point
50 * DriverObject = Pointer to a driver object for this driver
51 * RegistryPath = Registry node for configuration parameters
53 * Status of driver initialization
56 NDIS_DbgPrint(MAX_TRACE
, ("Called.\n"));
58 InitializeListHead(&ProtocolListHead
);
59 KeInitializeSpinLock(&ProtocolListLock
);
61 InitializeListHead(&MiniportListHead
);
62 KeInitializeSpinLock(&MiniportListLock
);
64 InitializeListHead(&AdapterListHead
);
65 KeInitializeSpinLock(&AdapterListLock
);
67 InitializeListHead(&OrphanAdapterListHead
);
68 KeInitializeSpinLock(&OrphanAdapterListLock
);
70 DriverObject
->DriverUnload
= MainUnload
;
73 * until we have PNP support, query the enum key and NdisFindDevice() each one
74 * NOTE- this will load and start other services before this one returns STATUS_SUCCESS.
75 * I hope there aren't code reentrancy problems. :)
79 return STATUS_SUCCESS
;
88 NdisWriteErrorLogEntry(
89 IN NDIS_HANDLE NdisAdapterHandle
,
90 IN NDIS_ERROR_CODE ErrorCode
,
91 IN ULONG NumberOfErrorValues
,
92 IN ULONG ERROR_LOG_MAXIMUM_SIZE
)
94 * ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
97 * FUNCTION: Write a syslog error
99 * NdisAdapterHandle: Handle passed into MiniportInitialize
100 * ErrorCode: 32-bit error code to be logged
101 * NumberOfErrorValues: number of errors to log
102 * Variable: list of log items
105 * - This needs to be fixed to do var args
106 * - FIXME - this needs to be properly implemented once we have an event log
109 NDIS_DbgPrint(MIN_TRACE
, ("ERROR: ErrorCode 0x%x\n", ErrorCode
));
119 NdisInitializeReadWriteLock(
120 IN PNDIS_RW_LOCK Lock
)
122 * FUNCTION: Initialize a NDIS_RW_LOCK
124 * Lock: pointer to the lock to initialize
129 memset(Lock
,0,sizeof(NDIS_RW_LOCK
));
138 NdisWriteEventLogEntry(
140 IN NDIS_STATUS EventCode
,
141 IN ULONG UniqueEventValue
,
142 IN USHORT NumStrings
,
143 IN PVOID StringsList OPTIONAL
,
145 IN PVOID Data OPTIONAL
)
147 * FUNCTION: Log an event in the system event log
149 * LogHandle: pointer to the driver object of the protocol logging the event
150 * EventCode: NDIS_STATUS_XXX describing the event
151 * UniqueEventValue: identifiees this instance of the error value
152 * NumStrings: number of strings in StringList
153 * StringList: list of strings to log
154 * DataSize: number of bytes in Data
155 * Data: binary dump data to help analyzing the event
157 * - STDCALL, not CDECL like WriteError...
158 * - FIXME Needs to use the real log interface, once there is one
162 * just returning true until we have an event log
164 NDIS_DbgPrint(MAX_TRACE
, ("Called.\n"));
165 return NDIS_STATUS_SUCCESS
;