f4bf18eb14f2e4dac9a460399788bacc61448828
[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
14 #include <roscfg.h>
15 #include "ndissys.h"
16
17
18 #ifdef DBG
19
20 /* See debug.h for debug/trace constants */
21 DWORD DebugTraceLevel = /*MIN_TRACE*/DEBUG_ULTRA;
22
23 #endif /* DBG */
24
25 \f
26 VOID STDCALL MainUnload(
27 PDRIVER_OBJECT DriverObject)
28 /*
29 * FUNCTION: Unloads the driver
30 * ARGUMENTS:
31 * DriverObject = Pointer to driver object created by the system
32 */
33 {
34 NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
35 }
36
37 \f
38 NTSTATUS
39 STDCALL
40 DriverEntry(
41 PDRIVER_OBJECT DriverObject,
42 PUNICODE_STRING RegistryPath)
43 /*
44 * FUNCTION: Main driver entry point
45 * ARGUMENTS:
46 * DriverObject = Pointer to a driver object for this driver
47 * RegistryPath = Registry node for configuration parameters
48 * RETURNS:
49 * Status of driver initialization
50 */
51 {
52 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
53
54 InitializeListHead(&ProtocolListHead);
55 KeInitializeSpinLock(&ProtocolListLock);
56
57 InitializeListHead(&MiniportListHead);
58 KeInitializeSpinLock(&MiniportListLock);
59
60 InitializeListHead(&AdapterListHead);
61 KeInitializeSpinLock(&AdapterListLock);
62
63 DriverObject->DriverUnload = MainUnload;
64
65 /*
66 * until we have PNP support, query the enum key and NdisFindDevice() each one
67 * NOTE- this will load and start other services before this one returns STATUS_SUCCESS.
68 * I hope there aren't code reentrancy problems. :)
69 */
70 //NdisStartDevices();
71
72 return STATUS_SUCCESS;
73 }
74
75 \f
76 /*
77 * @implemented
78 */
79 VOID
80 CDECL
81 NdisWriteErrorLogEntry(
82 IN NDIS_HANDLE NdisAdapterHandle,
83 IN NDIS_ERROR_CODE ErrorCode,
84 IN ULONG NumberOfErrorValues,
85 ...)
86 /*
87 * FUNCTION: Write a syslog error
88 * ARGUMENTS:
89 * NdisAdapterHandle: Handle passed into MiniportInitialize
90 * ErrorCode: 32-bit error code to be logged
91 * NumberOfErrorValues: number of errors to log
92 * Variable: list of log items
93 * NOTES:
94 * - THIS IS >CDECL<
95 * - This needs to be fixed to do var args
96 * - FIXME - this needs to be properly implemented once we have an event log
97 */
98 {
99 NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
100 /* ASSERT(0); */
101 }
102
103 \f
104 /*
105 * @implemented
106 */
107 VOID
108 EXPORT
109 NdisInitializeReadWriteLock(
110 IN PNDIS_RW_LOCK Lock)
111 /*
112 * FUNCTION: Initialize a NDIS_RW_LOCK
113 * ARGUMENTS:
114 * Lock: pointer to the lock to initialize
115 * NOTES:
116 * NDIS 5.0
117 */
118 {
119 memset(Lock,0,sizeof(NDIS_RW_LOCK));
120 }
121
122 \f
123 /*
124 * @implemented
125 */
126 NDIS_STATUS
127 EXPORT
128 NdisWriteEventLogEntry(
129 IN PVOID LogHandle,
130 IN NDIS_STATUS EventCode,
131 IN ULONG UniqueEventValue,
132 IN USHORT NumStrings,
133 IN PVOID StringsList OPTIONAL,
134 IN ULONG DataSize,
135 IN PVOID Data OPTIONAL)
136 /*
137 * FUNCTION: Log an event in the system event log
138 * ARGUMENTS:
139 * LogHandle: pointer to the driver object of the protocol logging the event
140 * EventCode: NDIS_STATUS_XXX describing the event
141 * UniqueEventValue: identifiees this instance of the error value
142 * NumStrings: number of strings in StringList
143 * StringList: list of strings to log
144 * DataSize: number of bytes in Data
145 * Data: binary dump data to help analyzing the event
146 * NOTES:
147 * - STDCALL, not CDECL like WriteError...
148 * - FIXME Needs to use the real log interface, once there is one
149 */
150 {
151 /*
152 * just returning true until we have an event log
153 */
154 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
155 return NDIS_STATUS_SUCCESS;
156 }
157
158 /* EOF */
159