xref: /reactos/drivers/network/ndis/ndis/main.c (revision c2c66aff)
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 */
19 ULONG DebugTraceLevel = MIN_TRACE;
20 
21 #endif /* DBG */
22 
23 LONG CancelId;
24 
25 
MainUnload(PDRIVER_OBJECT DriverObject)26 VOID NTAPI 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 
38 NTSTATUS
39 NTAPI
DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath)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   CancelId = 0;
66 
67   return STATUS_SUCCESS;
68 }
69 
70 
71 /*
72  * @implemented
73  */
74 VOID
75 _cdecl
NdisWriteErrorLogEntry(IN NDIS_HANDLE NdisAdapterHandle,IN NDIS_ERROR_CODE ErrorCode,IN ULONG NumberOfErrorValues,...)76 NdisWriteErrorLogEntry(
77     IN  NDIS_HANDLE     NdisAdapterHandle,
78     IN  NDIS_ERROR_CODE ErrorCode,
79     IN  ULONG           NumberOfErrorValues,
80     ...)
81 /*
82  * FUNCTION: Write a syslog error
83  * ARGUMENTS:
84  *     NdisAdapterHandle:  Handle passed into MiniportInitialize
85  *     ErrorCode:  32-bit error code to be logged
86  *     NumberOfErrorValues: number of errors to log
87  *     Variable: list of log items
88  * NOTES:
89  *     - THIS IS >CDECL<
90  *     - This needs to be fixed to do var args
91  *     - FIXME - this needs to be properly implemented once we have an event log
92  */
93 {
94   NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
95   /* ASSERT(0); */
96 }
97 
98 
99 /*
100  * @implemented
101  */
102 NDIS_STATUS
103 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)104 NdisWriteEventLogEntry(
105     IN  PVOID       LogHandle,
106     IN  NDIS_STATUS EventCode,
107     IN  ULONG       UniqueEventValue,
108     IN  USHORT      NumStrings,
109     IN  PVOID       StringsList OPTIONAL,
110     IN  ULONG       DataSize,
111     IN  PVOID       Data        OPTIONAL)
112 /*
113  * FUNCTION: Log an event in the system event log
114  * ARGUMENTS:
115  *     LogHandle: pointer to the driver object of the protocol logging the event
116  *     EventCode: NDIS_STATUS_XXX describing the event
117  *     UniqueEventValue: identifies this instance of the error value
118  *     NumStrings: number of strings in StringList
119  *     StringList: list of strings to log
120  *     DataSize: number of bytes in Data
121  *     Data: binary dump data to help analyzing the event
122  * NOTES:
123  *     - NTAPI, not CDECL like WriteError...
124  *     - FIXME Needs to use the real log interface, once there is one
125  */
126 {
127   /*
128    * just returning true until we have an event log
129    */
130   NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
131   return NDIS_STATUS_SUCCESS;
132 }
133 
134 /* EOF */
135