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.

92 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. csrdosdv.c
  5. Abstract:
  6. This module implements functions that are used by the DefineDosDevice API
  7. to communicate with csrss.
  8. Author:
  9. Michael Zoran (mzoran) 21-Jun-1998
  10. Revision History:
  11. --*/
  12. #include "basedll.h"
  13. NTSTATUS
  14. CsrBasepDefineDosDevice(
  15. DWORD dwFlags,
  16. PUNICODE_STRING pDeviceName,
  17. PUNICODE_STRING pTargetPath
  18. )
  19. {
  20. #if defined(BUILD_WOW6432)
  21. return NtWow64CsrBasepDefineDosDevice(dwFlags,
  22. pDeviceName,
  23. pTargetPath
  24. );
  25. #else
  26. BASE_API_MSG m;
  27. PBASE_DEFINEDOSDEVICE_MSG a = &m.u.DefineDosDeviceApi;
  28. PCSR_CAPTURE_HEADER p;
  29. ULONG PointerCount, n;
  30. if (0 == pTargetPath->MaximumLength) {
  31. PointerCount = 1;
  32. n = pDeviceName->MaximumLength;
  33. }
  34. else {
  35. PointerCount = 2;
  36. n = pDeviceName->MaximumLength + pTargetPath->MaximumLength;
  37. }
  38. p = CsrAllocateCaptureBuffer( PointerCount, n );
  39. if (p == NULL) {
  40. return STATUS_NO_MEMORY;
  41. }
  42. a->Flags = dwFlags;
  43. a->DeviceName.MaximumLength =
  44. (USHORT)CsrAllocateMessagePointer( p,
  45. pDeviceName->MaximumLength,
  46. (PVOID *)&a->DeviceName.Buffer
  47. );
  48. RtlUpcaseUnicodeString( &a->DeviceName, pDeviceName, FALSE );
  49. if (pTargetPath->Length != 0) {
  50. a->TargetPath.MaximumLength =
  51. (USHORT)CsrAllocateMessagePointer( p,
  52. pTargetPath->MaximumLength,
  53. (PVOID *)&a->TargetPath.Buffer
  54. );
  55. RtlCopyUnicodeString( &a->TargetPath, pTargetPath );
  56. }
  57. else {
  58. RtlInitUnicodeString( &a->TargetPath, NULL );
  59. }
  60. CsrClientCallServer( (PCSR_API_MSG)&m,
  61. p,
  62. CSR_MAKE_API_NUMBER( BASESRV_SERVERDLL_INDEX,
  63. BasepDefineDosDevice
  64. ),
  65. sizeof( *a )
  66. );
  67. CsrFreeCaptureBuffer( p );
  68. return m.ReturnValue;
  69. #endif
  70. }