ReactOS  0.4.15-dev-980-ge160524
main.c File Reference
#include <ne2000.h>
Include dependency graph for main.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
 
static BOOLEAN NTAPI MiniportCheckForHang (IN NDIS_HANDLE MiniportAdapterContext)
 
static VOID NTAPI MiniportDisableInterrupt (IN NDIS_HANDLE MiniportAdapterContext)
 
static VOID NTAPI MiniportEnableInterrupt (IN NDIS_HANDLE MiniportAdapterContext)
 
static VOID NTAPI MiniportHalt (IN NDIS_HANDLE MiniportAdapterContext)
 
static VOID NTAPI MiQueryResources (OUT PNDIS_STATUS Status, IN PNIC_ADAPTER Adapter, IN NDIS_HANDLE WrapperConfigurationContext)
 
VOID NTAPI MiniportShutdown (PVOID Context)
 
static NDIS_STATUS NTAPI MiniportInitialize (OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE WrapperConfigurationContext)
 
static VOID NTAPI MiniportISR (OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
 
static NDIS_STATUS NTAPI MiniportQueryInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
 
static NDIS_STATUS NTAPI MiniportReconfigure (OUT PNDIS_STATUS OpenErrorStatus, IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE WrapperConfigurationContext)
 
static NDIS_STATUS NTAPI MiniportReset (OUT PBOOLEAN AddressingReset, IN NDIS_HANDLE MiniportAdapterContext)
 
static NDIS_STATUS NTAPI MiniportSend (IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet, IN UINT Flags)
 
static NDIS_STATUS NTAPI MiniportSetInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
 
static NDIS_STATUS NTAPI MiniportTransferData (OUT PNDIS_PACKET Packet, OUT PUINT BytesTransferred, IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE MiniportReceiveContext, IN UINT ByteOffset, IN UINT BytesToTransfer)
 

Variables

static ULONG MiniportOIDList []
 
DRIVER_INFORMATION DriverInfo = { NULL, NULL, { NULL, NULL } }
 
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1)
 

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 921 of file main.c.

932 {
934  NDIS_HANDLE NdisWrapperHandle;
936 
937  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
938 
939  NdisZeroMemory(&Miniport, sizeof(Miniport));
940  Miniport.MajorNdisVersion = DRIVER_NDIS_MAJOR_VERSION;
941  Miniport.MinorNdisVersion = DRIVER_NDIS_MINOR_VERSION;
942  Miniport.CheckForHangHandler = MiniportCheckForHang;
943  Miniport.DisableInterruptHandler = MiniportDisableInterrupt;
944  Miniport.EnableInterruptHandler = MiniportEnableInterrupt;
945  Miniport.HaltHandler = MiniportHalt;
946  Miniport.HandleInterruptHandler = MiniportHandleInterrupt;
947  Miniport.InitializeHandler = MiniportInitialize;
948  Miniport.ISRHandler = MiniportISR;
949  Miniport.QueryInformationHandler = MiniportQueryInformation;
950  Miniport.ReconfigureHandler = MiniportReconfigure;
951  Miniport.ResetHandler = MiniportReset;
952  Miniport.SendHandler = MiniportSend;
953  Miniport.SetInformationHandler = MiniportSetInformation;
954  Miniport.TransferDataHandler = MiniportTransferData;
955 
956  NdisMInitializeWrapper(&NdisWrapperHandle,
957  DriverObject,
958  RegistryPath,
959  NULL);
960 
961  if (!NdisWrapperHandle) {
962  NDIS_DbgPrint(MIN_TRACE, ("NdisMInitializeWrapper() failed\n"));
963  return STATUS_UNSUCCESSFUL;
964  }
965 
966  DriverInfo.NdisWrapperHandle = NdisWrapperHandle;
969 
970  Status = NdisMRegisterMiniport(NdisWrapperHandle,
971  &Miniport,
973  if (Status != NDIS_STATUS_SUCCESS) {
974  NDIS_DbgPrint(MIN_TRACE, ("NdisMRegisterMiniport() failed with status code (0x%X).\n", Status));
975  NdisTerminateWrapper(NdisWrapperHandle, NULL);
976  return STATUS_UNSUCCESSFUL;
977  }
978 
979  return STATUS_SUCCESS;
980 }
static VOID NTAPI MiniportHalt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:109
static VOID NTAPI MiniportDisableInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:79
static NDIS_STATUS NTAPI MiniportTransferData(OUT PNDIS_PACKET Packet, OUT PUINT BytesTransferred, IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE MiniportReceiveContext, IN UINT ByteOffset, IN UINT BytesToTransfer)
Definition: main.c:832
static NDIS_STATUS NTAPI MiniportReconfigure(OUT PNDIS_STATUS OpenErrorStatus, IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: main.c:633
static NDIS_STATUS NTAPI MiniportInitialize(OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: main.c:213
static VOID NTAPI MiniportEnableInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:94
int NDIS_STATUS
Definition: ntddndis.h:471
#define DRIVER_NDIS_MINOR_VERSION
Definition: ne2000.h:30
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
static NDIS_STATUS NTAPI MiniportSend(IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet, IN UINT Flags)
Definition: main.c:684
static BOOLEAN NTAPI MiniportCheckForHang(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:63
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
VOID EXPORT NdisTerminateWrapper(IN NDIS_HANDLE NdisWrapperHandle, IN PVOID SystemSpecific)
Definition: miniport.c:3012
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
VOID NTAPI MiniportHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:40
static NDIS_STATUS NTAPI MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
Definition: main.c:475
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
static VOID NTAPI MiniportISR(OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:450
Status
Definition: gdiplustypes.h:24
#define MAX_TRACE
Definition: debug.h:16
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
NDIS_HANDLE NdisWrapperHandle
Definition: ne2000.h:187
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
#define DRIVER_NDIS_MAJOR_VERSION
Definition: ne2000.h:29
#define MIN_TRACE
Definition: debug.h:14
#define NdisMInitializeWrapper(NdisWrapperHandle, SystemSpecific1, SystemSpecific2, SystemSpecific3)
Definition: ndis.h:5592
LIST_ENTRY AdapterListHead
Definition: ne2000.h:189
NDIS_STATUS EXPORT NdisMRegisterMiniport(IN NDIS_HANDLE NdisWrapperHandle, IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, IN UINT CharacteristicsLength)
Definition: miniport.c:2637
NDIS_HANDLE NdisMacHandle
Definition: ne2000.h:188
return STATUS_SUCCESS
Definition: btrfs.c:3014
static NDIS_STATUS NTAPI MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
Definition: main.c:726
static NDIS_STATUS NTAPI MiniportReset(OUT PBOOLEAN AddressingReset, IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:656

◆ MiniportCheckForHang()

static BOOLEAN NTAPI MiniportCheckForHang ( IN NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 63 of file main.c.

72 {
73  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
74 
75  return FALSE;
76 }
#define FALSE
Definition: types.h:117
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

Referenced by DriverEntry().

◆ MiniportDisableInterrupt()

static VOID NTAPI MiniportDisableInterrupt ( IN NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 79 of file main.c.

86 {
87  NDIS_DbgPrint(MAX_TRACE, ("Called. (MiniportDisableInterrupt).\n"));
88 #ifndef NOCARD
89  NICDisableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);
90 #endif
91 }
#define NICDisableInterrupts(Adapter)
Definition: 8390.h:159
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

Referenced by DriverEntry().

◆ MiniportEnableInterrupt()

static VOID NTAPI MiniportEnableInterrupt ( IN NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 94 of file main.c.

101 {
102  NDIS_DbgPrint(MAX_TRACE, ("Called. (MiniportEnableInterrupt).\n"));
103 #ifndef NOCARD
104  NICEnableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);
105 #endif
106 }
#define MAX_TRACE
Definition: debug.h:16
#define NICEnableInterrupts(Adapter)
Definition: 8390.h:164
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

Referenced by DriverEntry().

◆ MiniportHalt()

static VOID NTAPI MiniportHalt ( IN NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 109 of file main.c.

116 {
117  PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
118 
120 
121  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
122 #ifndef NOCARD
123  /* Stop the NIC */
124  NICStop(Adapter);
125 #endif
126  /* Wait for any DPCs to complete. FIXME: Use something else */
127  NdisStallExecution(250000);
128 
129  if (Adapter->InterruptRegistered)
130  /* Deregister interrupt */
132 
133  if (Adapter->IOPortRangeRegistered)
134  /* Deregister I/O port range */
136  Adapter->MiniportAdapterHandle,
137  Adapter->IoBaseAddress,
138  0x20,
139  Adapter->IOBase);
140 
141  if (Adapter->ShutdownHandlerRegistered)
143 
144  /* Remove adapter from global adapter list */
145  if ((&Adapter->ListEntry)->Blink != NULL) {
146  RemoveEntryList(&Adapter->ListEntry);
147  }
148 
149  /* Free adapter context area */
150  NdisFreeMemory(Adapter, sizeof(NIC_ADAPTER), 0);
151 }
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: ne2000.h:82
VOID EXPORT NdisMDeregisterAdapterShutdownHandler(IN NDIS_HANDLE MiniportHandle)
Definition: miniport.c:1517
#define ASSERT_IRQL_EQUAL(x)
Definition: debug.h:43
PUCHAR IOBase
Definition: ne2000.h:92
ULONG_PTR IoBaseAddress
Definition: ne2000.h:85
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
smooth NULL
Definition: ftsmooth.c:416
NDIS_STATUS NICStop(PNIC_ADAPTER Adapter)
Definition: 8390.c:451
LIST_ENTRY ListEntry
Definition: ne2000.h:78
NDIS_HANDLE MiniportAdapterHandle
Definition: ne2000.h:80
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define MAX_TRACE
Definition: debug.h:16
BOOLEAN IOPortRangeRegistered
Definition: ne2000.h:179
VOID EXPORT NdisMDeregisterIoPortRange(IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts, IN PVOID PortOffset)
Definition: io.c:1093
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
struct _NIC_ADAPTER * PNIC_ADAPTER
BOOLEAN InterruptRegistered
Definition: ne2000.h:180
#define NdisStallExecution
Definition: ndis.h:4453
BOOLEAN ShutdownHandlerRegistered
Definition: ne2000.h:181
VOID EXPORT NdisMDeregisterInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt)
Definition: io.c:700
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110

Referenced by DriverEntry(), and MiniportInitialize().

◆ MiniportInitialize()

static NDIS_STATUS NTAPI MiniportInitialize ( OUT PNDIS_STATUS  OpenErrorStatus,
OUT PUINT  SelectedMediumIndex,
IN PNDIS_MEDIUM  MediumArray,
IN UINT  MediumArraySize,
IN NDIS_HANDLE  MiniportAdapterHandle,
IN NDIS_HANDLE  WrapperConfigurationContext 
)
static

Definition at line 213 of file main.c.

232 {
233  UINT i;
235  PNIC_ADAPTER Adapter;
237  UINT *RegNetworkAddress = 0;
238  UINT RegNetworkAddressLength = 0;
239 
241 
242  NDIS_DbgPrint(MAX_TRACE, ("Called (Adapter %X).\n", MiniportAdapterHandle));
243 
244  /* Search for 802.3 media which is the only one we support */
245  for (i = 0; i < MediumArraySize; i++) {
246  if (MediumArray[i] == NdisMedium802_3)
247  break;
248  }
249 
250  if (i == MediumArraySize) {
251  NDIS_DbgPrint(MIN_TRACE, ("No supported media.\n"));
253  }
254 
256 
257  Status = NdisAllocateMemory((PVOID)&Adapter,
258  sizeof(NIC_ADAPTER),
259  0,
261  if (Status != NDIS_STATUS_SUCCESS) {
262  NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
263  return Status;
264  }
265 
266  NdisZeroMemory(Adapter, sizeof(NIC_ADAPTER));
267  Adapter->MiniportAdapterHandle = MiniportAdapterHandle;
268  Adapter->IoBaseAddress = DRIVER_DEFAULT_IO_BASE_ADDRESS;
269  Adapter->InterruptLevel = DRIVER_DEFAULT_INTERRUPT_NUMBER;
270  Adapter->InterruptVector = DRIVER_DEFAULT_INTERRUPT_NUMBER;
271  Adapter->InterruptShared = DRIVER_DEFAULT_INTERRUPT_SHARED;
272  Adapter->InterruptMode = DRIVER_DEFAULT_INTERRUPT_MODE;
273  Adapter->MaxMulticastListSize = DRIVER_MAX_MULTICAST_LIST_SIZE;
274  Adapter->InterruptMask = DRIVER_INTERRUPT_MASK;
275  Adapter->LookaheadSize = DRIVER_MAXIMUM_LOOKAHEAD;
276 
277  /* Query the resources from PnP. */
279 
280  /* Get the port, irq, and MAC address from registry if the PnP
281  failed. */
283  {
284  PNDIS_CONFIGURATION_PARAMETER ConfigurationParameter;
286 
289  {
293  {
294  NDIS_DbgPrint(MID_TRACE,("NdisReadConfiguration for Irq returned successfully, irq 0x%x\n",
295  ConfigurationParameter->ParameterData.IntegerData));
296  Adapter->InterruptLevel =
297  Adapter->InterruptVector = ConfigurationParameter->ParameterData.IntegerData;
298  }
299 
303  {
304  NDIS_DbgPrint(MID_TRACE,("NdisReadConfiguration for Port returned successfully, port 0x%x\n",
305  ConfigurationParameter->ParameterData.IntegerData));
306  Adapter->IoBaseAddress = ConfigurationParameter->ParameterData.IntegerData;
307  }
308 
310  }
311  else
312  {
313  NDIS_DbgPrint(MIN_TRACE,("NdisOpenConfiguration returned error 0x%x\n", Status));
314  }
315  }
316 
317  /* find the nic */
318  if (!NICCheck(Adapter)) {
319  NDIS_DbgPrint(MID_TRACE, ("No adapter found at (0x%X).\n", Adapter->IoBaseAddress));
320  NdisFreeMemory(Adapter, sizeof(NIC_ADAPTER), 0);
322  } else
323  NDIS_DbgPrint(MID_TRACE, ("Adapter found at (0x%X).\n", Adapter->IoBaseAddress));
324 
327  (NDIS_HANDLE)Adapter,
328  FALSE,
330 
332  (PVOID*)&Adapter->IOBase,
334  Adapter->IoBaseAddress,
335  0x20);
336 
337  if (Status != NDIS_STATUS_SUCCESS) {
338  NDIS_DbgPrint(MIN_TRACE, ("Cannot register port range. Status (0x%X).\n", Status));
339  MiniportHalt((NDIS_HANDLE)Adapter);
340  return Status;
341  }
342 
343  Adapter->IOPortRangeRegistered = TRUE;
344 
345  /* Initialize NIC */
346 #ifndef NOCARD
347  Status = NICInitialize(Adapter);
348  if (Status != NDIS_STATUS_SUCCESS) {
349  NDIS_DbgPrint(MIN_TRACE,("No NE2000 or compatible network adapter found at address 0x%X.\n",
350  Adapter->IOBase));
351 
352  NDIS_DbgPrint(MID_TRACE, ("Status (0x%X).\n", Status));
353  MiniportHalt((NDIS_HANDLE)Adapter);
354  return Status;
355  }
356 
359  {
360  NdisReadNetworkAddress(&Status, (PVOID *)&RegNetworkAddress, &RegNetworkAddressLength, ConfigurationHandle);
361  if(Status == NDIS_STATUS_SUCCESS && RegNetworkAddressLength == DRIVER_LENGTH_OF_ADDRESS)
362  {
363  int i;
364  NDIS_DbgPrint(MID_TRACE,("NdisReadNetworkAddress returned successfully, address %x:%x:%x:%x:%x:%x\n",
365  RegNetworkAddress[0], RegNetworkAddress[1], RegNetworkAddress[2], RegNetworkAddress[3],
366  RegNetworkAddress[4], RegNetworkAddress[5]));
367  for(i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
368  Adapter->StationAddress[i] = RegNetworkAddress[i];
369  }
370 
372  }
373 
374  if (Status != NDIS_STATUS_SUCCESS || RegNetworkAddressLength != DRIVER_LENGTH_OF_ADDRESS)
375  {
376  int i;
377  for (i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
378  Adapter->StationAddress[i] = Adapter->PermanentAddress[i];
379  }
380 
381  NDIS_DbgPrint(MID_TRACE, ("BOARDDATA:\n"));
382  for (i = 0; i < 4; i++) {
383  NDIS_DbgPrint(MID_TRACE, ("%02X %02X %02X %02X\n",
384  Adapter->SAPROM[i*4+0],
385  Adapter->SAPROM[i*4+1],
386  Adapter->SAPROM[i*4+2],
387  Adapter->SAPROM[i*4+3]));
388  }
389 
390  /* Setup adapter structure */
391  Adapter->TXStart = ((ULONG_PTR)Adapter->RamBase >> 8);
392  Adapter->TXCount = DRIVER_DEFAULT_TX_BUFFER_COUNT;
393  Adapter->TXFree = DRIVER_DEFAULT_TX_BUFFER_COUNT;
394  Adapter->TXCurrent = -1;
395  Adapter->PageStart = Adapter->TXStart + Adapter->TXCount;
396  Adapter->PageStop = Adapter->TXStart + (Adapter->RamSize >> 8);
397 
398  /* Initialize multicast address mask to accept all */
399  for (i = 0; i < 8; i++)
400  Adapter->MulticastAddressMask[i] = 0xFF;
401 
402  /* Setup the NIC */
403  NICSetup(Adapter);
404 
405  NDIS_DbgPrint(MID_TRACE, ("TXStart (0x%X) TXCount (0x%X) PageStart (0x%X)\n",
406  Adapter->TXStart,
407  Adapter->TXCount,
408  Adapter->PageStart));
409 
410  NDIS_DbgPrint(MID_TRACE, ("PageStop (0x%X) CurrentPage (0x%X) NextPacket (0x%X).\n",
411  Adapter->PageStop,
412  Adapter->CurrentPage,
413  Adapter->NextPacket));
414 #endif
415  /* Register the interrupt */
417  &Adapter->Interrupt,
419  Adapter->InterruptVector,
420  Adapter->InterruptLevel,
421  FALSE,
422  Adapter->InterruptShared,
423  Adapter->InterruptMode);
424  if (Status != NDIS_STATUS_SUCCESS) {
425  NDIS_DbgPrint(MIN_TRACE, ("Cannot register interrupt. Status (0x%X).\n", Status));
426  MiniportHalt((NDIS_HANDLE)Adapter);
427  return Status;
428  }
429 
430  Adapter->InterruptRegistered = TRUE;
431 #ifndef NOCARD
432  /* Start the NIC */
433  NICStart(Adapter);
434 #endif
435 
436  /* Register the shutdown handler */
438 
439  Adapter->ShutdownHandlerRegistered = TRUE;
440 
441  /* Add adapter to the global adapter list */
442  InsertTailList(&DriverInfo.AdapterListHead, &Adapter->ListEntry);
443 
444  NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
445 
446  return NDIS_STATUS_SUCCESS;
447 }
static VOID NTAPI MiniportHalt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:109
#define MID_TRACE
Definition: debug.h:15
NDIS_STATUS NICSetup(PNIC_ADAPTER Adapter)
Definition: 8390.c:352
#define TRUE
Definition: types.h:120
VOID EXPORT NdisOpenConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_HANDLE ConfigurationHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: config.c:197
#define ASSERT_IRQL_EQUAL(x)
Definition: debug.h:43
NDIS_STATUS EXPORT NdisMRegisterIoPortRange(OUT PVOID *PortOffset, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts)
Definition: io.c:1018
NDIS_STATUS NICInitialize(PNIC_ADAPTER Adapter)
Definition: 8390.c:289
#define DRIVER_LENGTH_OF_ADDRESS
Definition: ne2000.h:44
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT SelectedMediumIndex
Definition: ndis.h:6008
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT MediumArraySize
Definition: ndis.h:6013
#define InsertTailList(ListHead, Entry)
#define NDIS_STATUS_UNSUPPORTED_MEDIA
Definition: ndis.h:490
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
int NDIS_STATUS
Definition: ntddndis.h:471
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID EXPORT NdisReadConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue, IN NDIS_HANDLE ConfigurationHandle, IN PNDIS_STRING Keyword, IN NDIS_PARAMETER_TYPE ParameterType)
Definition: config.c:414
#define FALSE
Definition: types.h:117
#define DRIVER_INTERRUPT_MASK
Definition: ne2000.h:58
BOOLEAN NICCheck(PNIC_ADAPTER Adapter)
Definition: 8390.c:53
#define DRIVER_DEFAULT_TX_BUFFER_COUNT
Definition: ne2000.h:54
#define DRIVER_DEFAULT_INTERRUPT_SHARED
Definition: ne2000.h:34
VOID NTAPI MiniportShutdown(PVOID Context)
Definition: main.c:206
VOID EXPORT NdisCloseConfiguration(IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:136
VOID EXPORT NdisMSetAttributes(IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterContext, IN BOOLEAN BusMaster, IN NDIS_INTERFACE_TYPE AdapterType)
Definition: miniport.c:2858
struct Keyword Keyword
Definition: tokenize.c:33
NDIS_STATUS EXPORT NdisMRegisterInterrupt(OUT PNDIS_MINIPORT_INTERRUPT Interrupt, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InterruptVector, IN UINT InterruptLevel, IN BOOLEAN RequestIsr, IN BOOLEAN SharedInterrupt, IN NDIS_INTERRUPT_MODE InterruptMode)
Definition: io.c:941
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
NDIS_STATUS EXPORT NdisAllocateMemory(OUT PVOID *VirtualAddress, IN UINT Length, IN UINT MemoryFlags, IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: memory.c:57
#define NDIS_STATUS_ADAPTER_NOT_FOUND
Definition: ndis.h:470
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
Definition: ndis.h:3944
VOID EXPORT NdisReadNetworkAddress(OUT PNDIS_STATUS Status, OUT PVOID *NetworkAddress, OUT PUINT NetworkAddressLength, IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:740
Status
Definition: gdiplustypes.h:24
VOID EXPORT NdisInitUnicodeString(IN OUT PNDIS_STRING DestinationString, IN PCWSTR SourceString)
Definition: string.c:130
static const WCHAR L[]
Definition: oid.c:1250
#define DRIVER_MAX_MULTICAST_LIST_SIZE
Definition: ne2000.h:37
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DRIVER_MAXIMUM_LOOKAHEAD
Definition: ne2000.h:47
#define MAX_TRACE
Definition: debug.h:16
unsigned int UINT
Definition: ndis.h:50
static VOID NTAPI MiQueryResources(OUT PNDIS_STATUS Status, IN PNIC_ADAPTER Adapter, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: main.c:154
#define DRIVER_DEFAULT_IO_BASE_ADDRESS
Definition: ne2000.h:32
#define DRIVER_DEFAULT_INTERRUPT_NUMBER
Definition: ne2000.h:33
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
Definition: main.c:60
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
#define DRIVER_DEFAULT_INTERRUPT_MODE
Definition: ne2000.h:35
union _NDIS_CONFIGURATION_PARAMETER::@2065 ParameterData
VOID EXPORT NdisMRegisterAdapterShutdownHandler(IN NDIS_HANDLE MiniportHandle, IN PVOID ShutdownContext, IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler)
Definition: miniport.c:1694
#define MIN_TRACE
Definition: debug.h:14
#define ULONG_PTR
Definition: config.h:101
LIST_ENTRY AdapterListHead
Definition: ne2000.h:189
NDIS_STATUS NICStart(PNIC_ADAPTER Adapter)
Definition: 8390.c:429
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110

Referenced by DriverEntry().

◆ MiniportISR()

static VOID NTAPI MiniportISR ( OUT PBOOLEAN  InterruptRecognized,
OUT PBOOLEAN  QueueMiniportHandleInterrupt,
IN NDIS_HANDLE  MiniportAdapterContext 
)
static

Definition at line 450 of file main.c.

465 {
466  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
467 
468  NICDisableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);
469 
470  *InterruptRecognized = TRUE;
471  *QueueMiniportHandleInterrupt = TRUE;
472 }
#define TRUE
Definition: types.h:120
#define NICDisableInterrupts(Adapter)
Definition: 8390.h:159
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

Referenced by DriverEntry().

◆ MiniportQueryInformation()

static NDIS_STATUS NTAPI MiniportQueryInformation ( IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_OID  Oid,
IN PVOID  InformationBuffer,
IN ULONG  InformationBufferLength,
OUT PULONG  BytesWritten,
OUT PULONG  BytesNeeded 
)
static

Definition at line 475 of file main.c.

495 {
497  PVOID CopyFrom;
498  UINT CopySize;
499  ULONG GenericULONG;
500  USHORT GenericUSHORT;
501  NDIS_MEDIUM Medium = NdisMedium802_3;
502  PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
503 
504  NDIS_DbgPrint(MAX_TRACE, ("Called. Oid (0x%X).\n", Oid));
505 
507  CopyFrom = (PVOID)&GenericULONG;
508  CopySize = sizeof(ULONG);
509 
510  switch (Oid) {
512  CopyFrom = (PVOID)&MiniportOIDList;
513  CopySize = sizeof(MiniportOIDList);
514  break;
516  GenericULONG = (ULONG)NdisHardwareStatusReady;
517  break;
520  CopyFrom = (PVOID)&Medium;
521  CopySize = sizeof(NDIS_MEDIUM);
522  break;
524  GenericULONG = DRIVER_MAXIMUM_LOOKAHEAD;
525  break;
527  GenericULONG = DRIVER_FRAME_SIZE - DRIVER_HEADER_SIZE;
528  break;
529  case OID_GEN_LINK_SPEED:
530  GenericULONG = 100000; /* 10Mbps */
531  break;
533  GenericULONG = Adapter->TXCount * DRIVER_BLOCK_SIZE;
534  break;
536  GenericULONG = Adapter->RamSize -
537  (ULONG_PTR)Adapter->RamBase -
538  (Adapter->TXCount * DRIVER_BLOCK_SIZE);
539  break;
541  GenericULONG = DRIVER_BLOCK_SIZE;
542  break;
544  GenericULONG = DRIVER_BLOCK_SIZE;
545  break;
546  case OID_GEN_VENDOR_ID:
547  NdisMoveMemory(&GenericULONG, &Adapter->PermanentAddress, 3);
548  GenericULONG &= 0xFFFFFF00;
549  GenericULONG |= 0x01;
550  break;
552  CopyFrom = (PVOID)&DRIVER_VENDOR_DESCRIPTION;
553  CopySize = sizeof(DRIVER_VENDOR_DESCRIPTION);
554  break;
556  GenericUSHORT = (USHORT)DRIVER_VENDOR_DRIVER_VERSION;
557  CopyFrom = (PVOID)&GenericUSHORT;
558  CopySize = sizeof(USHORT);
559  break;
561  GenericULONG = Adapter->PacketFilter;
562  break;
564  GenericULONG = Adapter->LookaheadSize;
565  break;
568  CopyFrom = (PVOID)&GenericUSHORT;
569  CopySize = sizeof(USHORT);
570  break;
572  GenericULONG = DRIVER_FRAME_SIZE;
573  break;
575  NDIS_DbgPrint(MID_TRACE, ("OID_GEN_PROTOCOL_OPTIONS.\n"));
577  break;
578  case OID_GEN_MAC_OPTIONS:
579  GenericULONG = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
583  break;
585  GenericULONG = (ULONG)NdisMediaStateConnected;
586  break;
588  GenericULONG = 1;
589  break;
591  CopyFrom = (PVOID)&Adapter->PermanentAddress;
592  CopySize = DRIVER_LENGTH_OF_ADDRESS;
593  break;
595  CopyFrom = (PVOID)&Adapter->StationAddress;
596  CopySize = DRIVER_LENGTH_OF_ADDRESS;
597  break;
599  NDIS_DbgPrint(MID_TRACE, ("OID_802_3_MULTICAST_LIST.\n"));
601  break;
603  GenericULONG = Adapter->MaxMulticastListSize;
604  break;
606  NDIS_DbgPrint(MID_TRACE, ("OID_802_3_MAC_OPTIONS.\n"));
608  break;
609  default:
610  NDIS_DbgPrint(MIN_TRACE, ("Unknown OID (0x%X).\n", Oid));
612  break;
613  }
614 
615  if (Status == NDIS_STATUS_SUCCESS) {
616  if (CopySize > InformationBufferLength) {
617  *BytesNeeded = (CopySize - InformationBufferLength);
618  *BytesWritten = 0;
620  } else {
621  NdisMoveMemory(InformationBuffer, CopyFrom, CopySize);
622  *BytesWritten = CopySize;
623  *BytesNeeded = 0;
624  }
625  }
626 
627  NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status is (0x%X).\n", Status));
628 
629  return Status;
630 }
UINT LookaheadSize
Definition: ne2000.h:129
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define MID_TRACE
Definition: debug.h:15
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
enum _NDIS_MEDIUM NDIS_MEDIUM
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
PUCHAR RamBase
Definition: ne2000.h:98
ULONG PacketFilter
Definition: ne2000.h:126
DRIVER_HARDWARE_ADDRESS PermanentAddress
Definition: ne2000.h:105
#define DRIVER_LENGTH_OF_ADDRESS
Definition: ne2000.h:44
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
UINT TXCount
Definition: ne2000.h:161
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
UINT RamSize
Definition: ne2000.h:99
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
#define DRIVER_FRAME_SIZE
Definition: ne2000.h:42
int NDIS_STATUS
Definition: ntddndis.h:471
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define OID_GEN_PROTOCOL_OPTIONS
Definition: ntddndis.h:250
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define DRIVER_NDIS_MINOR_VERSION
Definition: ne2000.h:30
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED
Definition: ndis.h:683
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
static PSecPkgInfoA *static SEC_CHAR ULONG
Definition: main.c:37
#define DRIVER_BLOCK_SIZE
Definition: ne2000.h:50
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
Status
Definition: gdiplustypes.h:24
#define DRIVER_VENDOR_DESCRIPTION
Definition: ne2000.h:39
ULONG MaxMulticastListSize
Definition: ne2000.h:111
#define DRIVER_MAXIMUM_LOOKAHEAD
Definition: ne2000.h:47
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define MAX_TRACE
Definition: debug.h:16
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
unsigned short USHORT
Definition: pedump.c:61
#define DRIVER_VENDOR_DRIVER_VERSION
Definition: ne2000.h:40
#define OID_802_3_MAC_OPTIONS
Definition: ntddndis.h:306
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
unsigned int UINT
Definition: ndis.h:50
DRIVER_HARDWARE_ADDRESS StationAddress
Definition: ne2000.h:108
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define DRIVER_HEADER_SIZE
Definition: ne2000.h:43
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define DRIVER_NDIS_MAJOR_VERSION
Definition: ne2000.h:29
struct _NIC_ADAPTER * PNIC_ADAPTER
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define ULONG_PTR
Definition: config.h:101
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
static PSecPkgInfoA *static SEC_CHAR PVOID
Definition: main.c:37
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
static ULONG MiniportOIDList[]
Definition: main.c:29

Referenced by DriverEntry().

◆ MiniportReconfigure()

static NDIS_STATUS NTAPI MiniportReconfigure ( OUT PNDIS_STATUS  OpenErrorStatus,
IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_HANDLE  WrapperConfigurationContext 
)
static

Definition at line 633 of file main.c.

648 {
649  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
650 
651  return NDIS_STATUS_FAILURE;
652 }
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465

Referenced by DriverEntry().

◆ MiniportReset()

static NDIS_STATUS NTAPI MiniportReset ( OUT PBOOLEAN  AddressingReset,
IN NDIS_HANDLE  MiniportAdapterContext 
)
static

Definition at line 656 of file main.c.

669 {
670  NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
671 
672  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
673 
674 #ifndef NOCARD
675  NdisStatus = NICReset((PNIC_ADAPTER)MiniportAdapterContext);
676 #endif
677 
678  *AddressingReset = TRUE;
679 
680  return NdisStatus;
681 }
#define TRUE
Definition: types.h:120
int NDIS_STATUS
Definition: ntddndis.h:471
NDIS_STATUS NICReset(PNIC_ADAPTER Adapter)
Definition: 8390.c:500
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

Referenced by DriverEntry().

◆ MiniportSend()

static NDIS_STATUS NTAPI MiniportSend ( IN NDIS_HANDLE  MiniportAdapterContext,
IN PNDIS_PACKET  Packet,
IN UINT  Flags 
)
static

Definition at line 684 of file main.c.

698 {
699  PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
700 
702 
703 #ifndef NOCARD
704  NDIS_DbgPrint(MID_TRACE, ("Queueing packet.\n"));
705 
706  /* Queue the packet on the transmit queue */
707  RESERVED(Packet)->Next = NULL;
708  if (Adapter->TXQueueHead == NULL) {
709  Adapter->TXQueueHead = Packet;
710  } else {
711  RESERVED(Adapter->TXQueueTail)->Next = Packet;
712  }
713 
714  Adapter->TXQueueTail = Packet;
715 
716  /* Transmit the packet */
717  NICTransmit(Adapter);
718 
719  return NDIS_STATUS_PENDING;
720 #else
721  return NDIS_STATUS_SUCCESS;
722 #endif
723 }
#define MID_TRACE
Definition: debug.h:15
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
PNDIS_PACKET TXQueueHead
Definition: ne2000.h:169
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
#define ASSERT_IRQL_EQUAL(x)
Definition: debug.h:43
PNDIS_PACKET TXQueueTail
Definition: ne2000.h:171
smooth NULL
Definition: ftsmooth.c:416
VOID NICTransmit(PNIC_ADAPTER Adapter)
Definition: 8390.c:1124
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
__u8 RESERVED
Definition: mkdosfs.c:359
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
struct _NIC_ADAPTER * PNIC_ADAPTER

Referenced by DriverEntry().

◆ MiniportSetInformation()

static NDIS_STATUS NTAPI MiniportSetInformation ( IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_OID  Oid,
IN PVOID  InformationBuffer,
IN ULONG  InformationBufferLength,
OUT PULONG  BytesRead,
OUT PULONG  BytesNeeded 
)
static

Definition at line 726 of file main.c.

746 {
747  ULONG GenericULONG;
749  PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
750 
751  NDIS_DbgPrint(MAX_TRACE, ("Called. Oid (0x%X).\n", Oid));
752 
753  switch (Oid) {
755  /* Verify length */
756  if (InformationBufferLength < sizeof(ULONG)) {
757  *BytesRead = 0;
758  *BytesNeeded = sizeof(ULONG) - InformationBufferLength;
760  break;
761  }
762 
763  NdisMoveMemory(&GenericULONG, InformationBuffer, sizeof(ULONG));
764  /* Check for properties the driver don't support */
765  if (GenericULONG &
772  *BytesRead = 4;
773  *BytesNeeded = 0;
775  break;
776  }
777 
778  Adapter->PacketFilter = GenericULONG;
779 
780  /* FIXME: Set filter on hardware */
781 
782  break;
784  /* Verify length */
785  if (InformationBufferLength < sizeof(ULONG)) {
786  *BytesRead = 0;
787  *BytesNeeded = sizeof(ULONG) - InformationBufferLength;
789  break;
790  }
791 
792  NdisMoveMemory(&GenericULONG, InformationBuffer, sizeof(ULONG));
793  if (GenericULONG > DRIVER_MAXIMUM_LOOKAHEAD)
795  else
796  Adapter->LookaheadSize = GenericULONG;
797  break;
799  /* Verify length. Must be multiple of hardware address length */
800  if ((InformationBufferLength % DRIVER_LENGTH_OF_ADDRESS) != 0) {
801  *BytesRead = 0;
802  *BytesNeeded = 0;
804  break;
805  }
806 
807  /* Set new multicast address list */
808  NdisMoveMemory(Adapter->Addresses, InformationBuffer, InformationBufferLength);
809 
810  /* FIXME: Update hardware */
811 
812  break;
813  default:
814  NDIS_DbgPrint(MIN_TRACE, ("Invalid object ID (0x%X).\n", Oid));
815  *BytesRead = 0;
816  *BytesNeeded = 0;
818  break;
819  }
820 
821  if (Status == NDIS_STATUS_SUCCESS) {
822  *BytesRead = InformationBufferLength;
823  *BytesNeeded = 0;
824  }
825 
826  NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status (0x%X).\n", Status));
827 
828  return Status;
829 }
UINT LookaheadSize
Definition: ne2000.h:129
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
ULONG PacketFilter
Definition: ne2000.h:126
#define DRIVER_LENGTH_OF_ADDRESS
Definition: ne2000.h:44
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
int NDIS_STATUS
Definition: ntddndis.h:471
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_PACKET_TYPE_SOURCE_ROUTING
Definition: ndis.h:667
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_PACKET_TYPE_GROUP
Definition: ndis.h:671
DRIVER_HARDWARE_ADDRESS Addresses[DRIVER_MAX_MULTICAST_LIST_SIZE]
Definition: ne2000.h:114
static PSecPkgInfoA *static SEC_CHAR ULONG
Definition: main.c:37
#define NDIS_PACKET_TYPE_FUNCTIONAL
Definition: ndis.h:673
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
Status
Definition: gdiplustypes.h:24
#define DRIVER_MAXIMUM_LOOKAHEAD
Definition: ne2000.h:47
#define NDIS_PACKET_TYPE_SMT
Definition: ndis.h:669
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL
Definition: ndis.h:672
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
struct _NIC_ADAPTER * PNIC_ADAPTER
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define NDIS_PACKET_TYPE_MAC_FRAME
Definition: ndis.h:674
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

Referenced by DriverEntry().

◆ MiniportShutdown()

VOID NTAPI MiniportShutdown ( PVOID  Context)

Definition at line 206 of file main.c.

207 {
208  #ifndef NOCARD
210  #endif
211 }
NDIS_STATUS NICStop(PNIC_ADAPTER Adapter)
Definition: 8390.c:451

Referenced by MiniportInitialize().

◆ MiniportTransferData()

static NDIS_STATUS NTAPI MiniportTransferData ( OUT PNDIS_PACKET  Packet,
OUT PUINT  BytesTransferred,
IN NDIS_HANDLE  MiniportAdapterContext,
IN NDIS_HANDLE  MiniportReceiveContext,
IN UINT  ByteOffset,
IN UINT  BytesToTransfer 
)
static

Definition at line 832 of file main.c.

851 {
852  PNDIS_BUFFER DstBuffer;
853  UINT BytesCopied, BytesToCopy, DstSize;
854  ULONG SrcData;
855  PUCHAR DstData;
856  UINT RecvStart;
857  UINT RecvStop;
858  PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
859 
860  NDIS_DbgPrint(MAX_TRACE, ("Called. Packet (0x%X) ByteOffset (0x%X) BytesToTransfer (%d).\n",
861  Packet, ByteOffset, BytesToTransfer));
862 
863  if (BytesToTransfer == 0) {
864  *BytesTransferred = 0;
865  return NDIS_STATUS_SUCCESS;
866  }
867 
868  RecvStart = Adapter->PageStart * DRIVER_BLOCK_SIZE;
869  RecvStop = Adapter->PageStop * DRIVER_BLOCK_SIZE;
870 
871  NdisQueryPacket(Packet, NULL, NULL, &DstBuffer, NULL);
872  NdisQueryBuffer(DstBuffer, (PVOID)&DstData, &DstSize);
873 
874  SrcData = Adapter->PacketOffset + sizeof(DISCARD_HEADER) + ByteOffset;
875  if (ByteOffset + sizeof(DISCARD_HEADER) + BytesToTransfer >
876  Adapter->PacketHeader.PacketLength)
877  BytesToTransfer = Adapter->PacketHeader.PacketLength -
878  sizeof(DISCARD_HEADER) - ByteOffset;
879 
880  /* Start copying the data */
881  BytesCopied = 0;
882  for (;;) {
883  BytesToCopy = (DstSize < BytesToTransfer) ? DstSize : BytesToTransfer;
884  if (SrcData + BytesToCopy > RecvStop)
885  BytesToCopy = (RecvStop - SrcData);
886 
887  NICReadData(Adapter, DstData, SrcData, BytesToCopy);
888 
890  SrcData += BytesToCopy;
891  DstData = (PUCHAR)((ULONG_PTR) DstData + BytesToCopy);
892  BytesToTransfer -= BytesToCopy;
893  if (BytesToTransfer == 0)
894  break;
895 
896  DstSize -= BytesToCopy;
897  if (DstSize == 0) {
898  /* No more bytes in destination buffer. Proceed to
899  the next buffer in the destination buffer chain */
900  NdisGetNextBuffer(DstBuffer, &DstBuffer);
901  if (!DstBuffer)
902  break;
903 
904  NdisQueryBuffer(DstBuffer, (PVOID)&DstData, &DstSize);
905  }
906 
907  if (SrcData == RecvStop)
908  SrcData = RecvStart;
909  }
910 
911  NDIS_DbgPrint(MID_TRACE, ("Transferred (%d) bytes.\n", BytesToTransfer));
912 
913  *BytesTransferred = BytesCopied;
914 
915  return NDIS_STATUS_SUCCESS;
916 }
#define MID_TRACE
Definition: debug.h:15
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
struct _DISCARD_HEADER DISCARD_HEADER
MDL * PNDIS_BUFFER
Definition: ndis.h:343
unsigned char * PUCHAR
Definition: retypes.h:3
UINT PageStart
Definition: ne2000.h:133
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3167
#define NdisGetNextBuffer(CurrentBuffer, NextBuffer)
Definition: ndis.h:3386
uint32_t ULONG_PTR
Definition: typedefs.h:65
smooth NULL
Definition: ftsmooth.c:416
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
Definition: ndis.h:3167
ULONG PacketOffset
Definition: ne2000.h:154
#define DRIVER_BLOCK_SIZE
Definition: ne2000.h:50
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
PACKET_HEADER PacketHeader
Definition: ne2000.h:151
UINT PageStop
Definition: ne2000.h:134
VOID NICReadData(PNIC_ADAPTER Adapter, PUCHAR Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:791
#define MAX_TRACE
Definition: debug.h:16
unsigned int UINT
Definition: ndis.h:50
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
static __inline VOID NdisQueryPacket(IN PNDIS_PACKET Packet, OUT PUINT PhysicalBufferCount OPTIONAL, OUT PUINT BufferCount OPTIONAL, OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, OUT PUINT TotalPacketLength OPTIONAL)
Definition: ndis.h:3593
USHORT PacketLength
Definition: 8390.h:142
VOID EXPORT NdisQueryBuffer(IN PNDIS_BUFFER Buffer, OUT PVOID *VirtualAddress OPTIONAL, OUT PUINT Length)
Definition: buffer.c:953
struct _NIC_ADAPTER * PNIC_ADAPTER
unsigned int ULONG
Definition: retypes.h:1
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:725

Referenced by DriverEntry().

◆ MiQueryResources()

static VOID NTAPI MiQueryResources ( OUT PNDIS_STATUS  Status,
IN PNIC_ADAPTER  Adapter,
IN NDIS_HANDLE  WrapperConfigurationContext 
)
static

Definition at line 154 of file main.c.

158 {
159  PNDIS_RESOURCE_LIST AssignedResources;
160  UINT BufferSize = 0;
162  UINT i;
163 
166  NULL,
167  &BufferSize);
168  if (*Status == NDIS_STATUS_SUCCESS)
169  return;
170 
171  *Status = NdisAllocateMemory((PVOID)&AssignedResources,
172  BufferSize,
173  0,
175  if (*Status != NDIS_STATUS_SUCCESS)
176  return;
177 
180  AssignedResources,
181  &BufferSize);
182  if (*Status != NDIS_STATUS_SUCCESS)
183  return;
184 
185  for (i = 0; i < AssignedResources->Count; i++)
186  {
187  Descriptor = AssignedResources->PartialDescriptors + i;
188  switch (Descriptor->Type)
189  {
191  Adapter->InterruptLevel = Descriptor->u.Interrupt.Level;
192  Adapter->InterruptVector = Descriptor->u.Interrupt.Vector;
193  Adapter->InterruptShared = (Descriptor->ShareDisposition == CmResourceShareShared);
194  Adapter->InterruptMode = Descriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED ?
196  break;
197  case CmResourceTypePort:
198  Adapter->IoBaseAddress = Descriptor->u.Port.Start.LowPart;
199  break;
200  }
201  }
202 }
#define NdisInterruptLevelSensitive
Definition: ndis.h:920
VOID EXPORT NdisMQueryAdapterResources(OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PNDIS_RESOURCE_LIST ResourceList, IN OUT PUINT BufferSize)
Definition: hardware.c:103
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
#define CmResourceTypePort
Definition: hwresource.cpp:123
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define NdisInterruptLatched
Definition: ndis.h:921
NDIS_STATUS EXPORT NdisAllocateMemory(OUT PVOID *VirtualAddress, IN UINT Length, IN UINT MemoryFlags, IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: memory.c:57
#define BufferSize
Definition: classpnp.h:436
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
Status
Definition: gdiplustypes.h:24
unsigned int UINT
Definition: ndis.h:50
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
Definition: main.c:60
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PVOID * Descriptor
Definition: classpnp.h:1159

Referenced by MiniportInitialize().

Variable Documentation

◆ DriverInfo

DRIVER_INFORMATION DriverInfo = { NULL, NULL, { NULL, NULL } }

Definition at line 59 of file main.c.

Referenced by DriverEntry(), IopInitializeBootDrivers(), MiniportInitialize(), and SSI_DEF().

◆ HighestAcceptableMax

NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1)

Definition at line 60 of file main.c.

Referenced by MiniportInitialize(), and MiQueryResources().

◆ MiniportOIDList

ULONG MiniportOIDList[]
static
Initial value:
= {
}
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define OID_GEN_PROTOCOL_OPTIONS
Definition: ntddndis.h:250
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
#define OID_802_3_MAC_OPTIONS
Definition: ntddndis.h:306
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248

Definition at line 29 of file main.c.

Referenced by MiniportQueryInformation().