Windows NT 4.0 source code leak
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.

108 lines
3.5 KiB

4 years ago
  1. /*++
  2. *****************************************************************************
  3. * *
  4. * This software contains proprietary and confidential information of *
  5. * *
  6. * Digi International Inc. *
  7. * *
  8. * By accepting transfer of this copy, Recipient agrees to retain this *
  9. * software in confidence, to prevent disclosure to others, and to make *
  10. * no use of this software other than that for which it was delivered. *
  11. * This is an unpublished copyrighted work of Digi International Inc. *
  12. * Except as permitted by federal law, 17 USC 117, copying is strictly *
  13. * prohibited. *
  14. * *
  15. *****************************************************************************
  16. Module Name:
  17. dgatlas.c
  18. Abstract:
  19. This module is responsible for Atlas functionality common to all
  20. drivers.
  21. --*/
  22. #include <ntddk.h>
  23. NTSTATUS DigiRegisterAtlasName( IN PUNICODE_STRING DeviceName,
  24. IN PUNICODE_STRING ValueName,
  25. IN PUNICODE_STRING ValueEntry )
  26. /*++
  27. Routine Description:
  28. This routine will register the passed in value name and its associated
  29. value for Atlas to find. In addition, we will create a symbolic
  30. link to a name which is accessible for Atlas to open and exchange
  31. information.
  32. Arguments:
  33. DeviceName - pointer to unicode string to use when creating a
  34. symbolic link. It is assumed this device name is all ready
  35. created and ready to have symbolic links created.
  36. ValueName - pointer to unicode string to be used as the registry
  37. value name.
  38. Value - pointer to unicode string to be used as the value associated
  39. with ValueName.
  40. Return Value:
  41. - STATUS_SUCCESS if successful
  42. - Error indicating problem
  43. --*/
  44. {
  45. #define DEFAULT_DIGI_ATLAS_DEVICEMAP L"DigiAtlas"
  46. NTSTATUS Status;
  47. UNICODE_STRING LinkName;
  48. WCHAR LinkNameBuffer[32];
  49. //
  50. // First, we create the required link symbolic name from the passed
  51. // in value name.
  52. //
  53. RtlInitUnicodeString( &LinkName, NULL );
  54. LinkName.Buffer = &LinkNameBuffer[0];
  55. LinkName.MaximumLength = sizeof(LinkNameBuffer);
  56. LinkName.Length = 0;
  57. RtlAppendUnicodeToString( &LinkName, L"\\DosDevices\\" );
  58. RtlAppendUnicodeStringToString( &LinkName, ValueEntry );
  59. //
  60. // Create the symbolic link first.
  61. //
  62. Status = IoCreateSymbolicLink( &LinkName,
  63. DeviceName );
  64. if( NT_ERROR(Status) )
  65. return( Status );
  66. //
  67. // We need to add a \\.\ to the beginning of ValueEntry.
  68. //
  69. LinkName.Length = 0;
  70. RtlZeroMemory( LinkName.Buffer, LinkName.MaximumLength );
  71. RtlAppendUnicodeToString( &LinkName, L"\\\\.\\" );
  72. RtlAppendUnicodeStringToString( &LinkName, ValueEntry );
  73. Status = RtlWriteRegistryValue( RTL_REGISTRY_DEVICEMAP,
  74. DEFAULT_DIGI_ATLAS_DEVICEMAP,
  75. ValueName->Buffer,
  76. REG_SZ,
  77. LinkName.Buffer,
  78. LinkName.Length + sizeof(WCHAR) );
  79. return( Status );
  80. } // end DigiRegisterAtlasName