ff0d94b893895f75196acf42b8506c82b7c5410b
[reactos.git] / reactos / drivers / net / ndis / ndis / main.c
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 #include <ndissys.h>
14 #include <protocol.h>
15 #include <miniport.h>
16
17
18 #ifdef DBG
19
20 /* See debug.h for debug/trace constants */
21 DWORD DebugTraceLevel = MIN_TRACE;
22
23 #endif /* DBG */
24
25 /* see miniport.c */
26 extern KSPIN_LOCK OrphanAdapterListLock;
27 extern LIST_ENTRY OrphanAdapterListHead;
28
29 \f
30 VOID STDCALL MainUnload(
31 PDRIVER_OBJECT DriverObject)
32 /*
33 * FUNCTION: Unloads the driver
34 * ARGUMENTS:
35 * DriverObject = Pointer to driver object created by the system
36 */
37 {
38 NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
39 }
40
41 \f
42 NTSTATUS
43 STDCALL
44 DriverEntry(
45 PDRIVER_OBJECT DriverObject,
46 PUNICODE_STRING RegistryPath)
47 /*
48 * FUNCTION: Main driver entry point
49 * ARGUMENTS:
50 * DriverObject = Pointer to a driver object for this driver
51 * RegistryPath = Registry node for configuration parameters
52 * RETURNS:
53 * Status of driver initialization
54 */
55 {
56 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
57
58 InitializeListHead(&ProtocolListHead);
59 KeInitializeSpinLock(&ProtocolListLock);
60
61 InitializeListHead(&MiniportListHead);
62 KeInitializeSpinLock(&MiniportListLock);
63
64 InitializeListHead(&AdapterListHead);
65 KeInitializeSpinLock(&AdapterListLock);
66
67 InitializeListHead(&OrphanAdapterListHead);
68 KeInitializeSpinLock(&OrphanAdapterListLock);
69
70 DriverObject->DriverUnload = MainUnload;
71
72 /*
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. :)
76 */
77 //NdisStartDevices();
78
79 return STATUS_SUCCESS;
80 }
81
82 \f
83 /*
84 * @implemented
85 */
86 VOID
87 CDECL
88 NdisWriteErrorLogEntry(
89 IN NDIS_HANDLE NdisAdapterHandle,
90 IN NDIS_ERROR_CODE ErrorCode,
91 IN ULONG NumberOfErrorValues,
92 IN ULONG ERROR_LOG_MAXIMUM_SIZE)
93 /* IN ULONG ...)
94 * ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
95 */
96 /*
97 * FUNCTION: Write a syslog error
98 * ARGUMENTS:
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
103 * NOTES:
104 * - THIS IS >CDECL<
105 * - This needs to be fixed to do var args
106 * - FIXME - this needs to be properly implemented once we have an event log
107 */
108 {
109 NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
110 ASSERT(0);
111 }
112
113 \f
114 /*
115 * @implemented
116 */
117 VOID
118 EXPORT
119 NdisInitializeReadWriteLock(
120 IN PNDIS_RW_LOCK Lock)
121 /*
122 * FUNCTION: Initialize a NDIS_RW_LOCK
123 * ARGUMENTS:
124 * Lock: pointer to the lock to initialize
125 * NOTES:
126 * NDIS 5.0
127 */
128 {
129 memset(Lock,0,sizeof(NDIS_RW_LOCK));
130 }
131
132 \f
133 /*
134 * @implemented
135 */
136 NDIS_STATUS
137 EXPORT
138 NdisWriteEventLogEntry(
139 IN PVOID LogHandle,
140 IN NDIS_STATUS EventCode,
141 IN ULONG UniqueEventValue,
142 IN USHORT NumStrings,
143 IN PVOID StringsList OPTIONAL,
144 IN ULONG DataSize,
145 IN PVOID Data OPTIONAL)
146 /*
147 * FUNCTION: Log an event in the system event log
148 * ARGUMENTS:
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
156 * NOTES:
157 * - STDCALL, not CDECL like WriteError...
158 * - FIXME Needs to use the real log interface, once there is one
159 */
160 {
161 /*
162 * just returning true until we have an event log
163 */
164 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
165 return NDIS_STATUS_SUCCESS;
166 }
167
168 /* EOF */
169