Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.7 KiB

  1. // Copyright (c) 1997, Microsoft Corporation, all rights reserved
  2. // Copyright (c) 1997, Parallel Technologies, Inc., all rights reserved
  3. //
  4. // main.c
  5. // RAS DirectParallel mini-port/call-manager driver
  6. // Main routine (DriverEntry) and global data definitions
  7. //
  8. // 01/07/97 Steve Cobb
  9. // 09/15/97 Jay Lowe, Parallel Technologies, Inc.
  10. #include "ptiwan.h"
  11. //-----------------------------------------------------------------------------
  12. // Local prototypes
  13. //-----------------------------------------------------------------------------
  14. NDIS_STATUS
  15. DriverEntry(
  16. IN PDRIVER_OBJECT DriverObject,
  17. IN PUNICODE_STRING RegistryPath );
  18. // Mark routine to be unloaded after initialization.
  19. //
  20. #pragma NDIS_INIT_FUNCTION(DriverEntry)
  21. //-----------------------------------------------------------------------------
  22. // Routines
  23. //-----------------------------------------------------------------------------
  24. NDIS_STATUS
  25. DriverEntry(
  26. IN PDRIVER_OBJECT DriverObject,
  27. IN PUNICODE_STRING RegistryPath )
  28. // Standard 'DriverEntry' driver initialization entrypoint called by the
  29. // I/0 system at IRQL PASSIVE_LEVEL before any other call to the driver.
  30. //
  31. // On NT, 'DriverObject' is the driver object created by the I/0 system
  32. // and 'RegistryPath' specifies where driver specific parameters are
  33. // stored. These arguments are opaque to this driver (and should remain
  34. // so for portability) which only forwards them to the NDIS wrapper.
  35. //
  36. // Returns the value returned by NdisMRegisterMiniport, per the doc on
  37. // "DriverEntry of NDIS Miniport Drivers".
  38. //
  39. {
  40. NDIS_STATUS status;
  41. NDIS_MINIPORT_CHARACTERISTICS nmc;
  42. NDIS_HANDLE NdisWrapperHandle;
  43. TRACE( TL_N, TM_Init, ( "DriverEntry" ) );
  44. #ifdef TESTMODE
  45. TRACE( TL_N, TM_Init, ( "DriverEntry: g_ulTraceLevel = $%x", &g_ulTraceLevel ) );
  46. TRACE( TL_N, TM_Init, ( "DriverEntry: g_ulTraceMask = $%x", &g_ulTraceMask ) );
  47. #endif
  48. // Register this driver with the NDIS wrapper. This call must occur
  49. // before any other NdisXxx calls.
  50. //
  51. NdisMInitializeWrapper(
  52. &NdisWrapperHandle, DriverObject, RegistryPath, NULL );
  53. // Set up the mini-port characteristics table that tells NDIS how to call
  54. // our mini-port.
  55. //
  56. NdisZeroMemory( &nmc, sizeof(nmc) );
  57. nmc.MajorNdisVersion = NDIS_MajorVersion;
  58. nmc.MinorNdisVersion = NDIS_MinorVersion;
  59. nmc.Reserved = NDIS_USE_WAN_WRAPPER;
  60. // no CheckForHangHandler
  61. // no DisableInterruptHandler
  62. // no EnableInterruptHandler
  63. nmc.HaltHandler = PtiHalt;
  64. // no HandleInterruptHandler
  65. nmc.InitializeHandler = PtiInit;
  66. // no ISRHandler
  67. // no QueryInformationHandler (see CoRequestHandler)
  68. nmc.ResetHandler = PtiReset;
  69. // no SendHandler (see CoSendPacketsHandler)
  70. // no WanSendHandler (see CoSendPacketsHandler)
  71. // no SetInformationHandler (see CoRequestHandler)
  72. // no TransferDataHandler
  73. // no WanTransferDataHandler
  74. nmc.ReturnPacketHandler = PtiReturnPacket;
  75. // no SendPacketsHandler (see CoSendPacketsHandler)
  76. // no AllocateCompleteHandler
  77. // no CoCreateVcHandler
  78. // no CoDeleteVcHandler
  79. nmc.CoActivateVcHandler = PtiCoActivateVc;
  80. nmc.CoDeactivateVcHandler = PtiCoDeactivateVc;
  81. nmc.CoSendPacketsHandler = PtiCoSendPackets;
  82. nmc.CoRequestHandler = PtiCoRequest;
  83. // Register this driver as the DirectParallel mini-port. This will result in NDIS
  84. // calling back at PtiInit
  85. //
  86. TRACE( TL_V, TM_Init, ( "NdisMRegMp" ) );
  87. status = NdisMRegisterMiniport( NdisWrapperHandle, &nmc, sizeof(nmc) );
  88. TRACE( TL_A, TM_Init, ( "NdisMRegMp=$%x", status ) );
  89. if (status != NDIS_STATUS_SUCCESS)
  90. {
  91. NdisTerminateWrapper( NdisWrapperHandle, NULL );
  92. }
  93. return status;
  94. }