Leaked source code of windows server 2003
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.

128 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. init.c
  5. Abstract:
  6. Author:
  7. Thomas J. Dimitri (TommyD) 08-May-1992
  8. Environment:
  9. Kernel Mode - Or whatever is the equivalent on OS/2 and DOS.
  10. Revision History:
  11. --*/
  12. #include "asyncall.h"
  13. // asyncmac.c will define the global parameters.
  14. #include "globals.h"
  15. #include "init.h"
  16. #ifdef MY_DEVICE_OBJECT
  17. VOID
  18. AsyncSetupExternalNaming(
  19. PDRIVER_OBJECT DriverObject
  20. )
  21. /*++
  22. Routine Description:
  23. This routine will be used to create a symbolic link
  24. to the driver name in the given object directory.
  25. It will also create an entry in the device map for
  26. this device.
  27. Arguments:
  28. MacName - The NDIS Mac Name in Open Adapter
  29. Return Value:
  30. None.
  31. --*/
  32. {
  33. NDIS_STRING SymbolicName = NDIS_STRING_CONST("\\DosDevices\\ASYNCMAC");
  34. NDIS_STRING Name = NDIS_STRING_CONST("\\Device\\ASYNCMAC");
  35. NTSTATUS Status;
  36. AsyncDeviceObject = NULL;
  37. Status =
  38. IoCreateDevice(DriverObject,
  39. sizeof(LIST_ENTRY),
  40. &Name,
  41. FILE_DEVICE_ASYMAC,
  42. 0,
  43. FALSE,
  44. (PDEVICE_OBJECT*)&AsyncDeviceObject);
  45. if (Status != STATUS_SUCCESS) {
  46. #if DBG
  47. DbgPrint("ASYNCMAC: IoCreateDevice Failed %4.4x\n", Status);
  48. #endif
  49. return;
  50. }
  51. AsyncDeviceObject->Flags |= DO_BUFFERED_IO;
  52. IoCreateSymbolicLink(&SymbolicName, &Name);
  53. }
  54. VOID
  55. AsyncCleanupExternalNaming(
  56. VOID
  57. )
  58. /*++
  59. Routine Description:
  60. This routine will be used to delete a symbolic link
  61. to the driver name in the given object directory.
  62. It will also delete an entry in the device map for
  63. this device.
  64. Arguments:
  65. MacName - The NDIS Mac Name in Open Adapter
  66. Return Value:
  67. None.
  68. --*/
  69. {
  70. NDIS_STRING SymbolicName = NDIS_STRING_CONST("\\DosDevices\\ASYNCMAC");
  71. DbgTracef(1,
  72. ("ASYNC: In SerialCleanupExternalNaming\n"));
  73. if (AsyncDeviceObject == NULL) {
  74. return;
  75. }
  76. IoDeleteSymbolicLink(&SymbolicName);
  77. IoDeleteDevice(AsyncDeviceObject);
  78. AsyncDeviceObject = NULL;
  79. }
  80. #endif