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.

139 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. smb64.c
  5. Abstract:
  6. This module implements thunking needed for the SMB MiniRDR
  7. Author:
  8. David Kruse [DKruse] 30-November 2000
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. PBYTE
  14. Smb64ThunkFileRenameInfo(
  15. IN PFILE_RENAME_INFORMATION pRenameInfo,
  16. IN OUT PULONG pBufferSize,
  17. OUT NTSTATUS* pStatus
  18. );
  19. PBYTE
  20. Smb64ThunkRemoteLinkTrackingInfo(
  21. IN PBYTE pData,
  22. IN OUT PULONG BufferSize,
  23. OUT NTSTATUS* pStatus
  24. );
  25. #ifdef ALLOC_PRAGMA
  26. #pragma alloc_text(PAGE, Smb64ThunkFileRenameInfo)
  27. #pragma alloc_text(PAGE, Smb64ThunkRemoteLinkTrackingInfo)
  28. #endif
  29. PBYTE
  30. Smb64ThunkFileRenameInfo(
  31. IN PFILE_RENAME_INFORMATION pRenameInfo,
  32. IN OUT PULONG pBufferSize,
  33. OUT NTSTATUS* pStatus
  34. )
  35. /*++
  36. Routine Description:
  37. This routine thunks the FILE_RENAME_INFORMATION structure IN PLACE. This means that the
  38. original buffer will no longer be intact after this call! (However, it requires no memory
  39. allocation either)
  40. Arguments:
  41. RxContext - the RDBSS context
  42. Return Value:
  43. RXSTATUS - The return status for the operation
  44. Notes:
  45. Remoting of FSCTL's is permitted only to NT servers.
  46. --*/
  47. {
  48. PFILE_RENAME_INFORMATION32 pRenameInfo32;
  49. // Allocate the new buffer
  50. pRenameInfo32 = RxAllocatePoolWithTag( NonPagedPool, *pBufferSize, MRXSMB_MISC_POOLTAG );
  51. if( !pRenameInfo32 )
  52. {
  53. *pStatus = STATUS_INSUFFICIENT_RESOURCES;
  54. return NULL;
  55. }
  56. // Copy the data into the new buffer
  57. pRenameInfo32->ReplaceIfExists = pRenameInfo->ReplaceIfExists;
  58. pRenameInfo32->RootDirectory = *((PULONG)&pRenameInfo->RootDirectory);
  59. pRenameInfo32->FileNameLength = pRenameInfo->FileNameLength;
  60. RtlCopyMemory( &pRenameInfo32->FileName, &pRenameInfo->FileName, pRenameInfo->FileNameLength );
  61. // Succeeded. Return
  62. *pStatus = STATUS_SUCCESS;
  63. return (PBYTE)pRenameInfo32;
  64. }
  65. PBYTE
  66. Smb64ThunkRemoteLinkTrackingInfo(
  67. IN PBYTE pData,
  68. IN OUT PULONG BufferSize,
  69. OUT NTSTATUS* pStatus
  70. )
  71. /*++
  72. Routine Description:
  73. This routine handles all the FSCTL's
  74. Arguments:
  75. RxContext - the RDBSS context
  76. Return Value:
  77. RXSTATUS - The return status for the operation
  78. Notes:
  79. Remoting of FSCTL's is permitted only to NT servers.
  80. --*/
  81. {
  82. PREMOTE_LINK_TRACKING_INFORMATION pRemoteLink = (PREMOTE_LINK_TRACKING_INFORMATION)pData;
  83. PREMOTE_LINK_TRACKING_INFORMATION32 pRemoteLink32;
  84. // Allocate the new buffer
  85. pRemoteLink32 = RxAllocatePoolWithTag( NonPagedPool, *BufferSize, MRXSMB_MISC_POOLTAG );
  86. if( !pRemoteLink32 )
  87. {
  88. *pStatus = STATUS_INSUFFICIENT_RESOURCES;
  89. return NULL;
  90. }
  91. // Copy the data into the new buffer
  92. pRemoteLink32->TargetFileObject = *((PULONG)&pRemoteLink->TargetFileObject);
  93. pRemoteLink32->TargetLinkTrackingInformationLength = pRemoteLink->TargetLinkTrackingInformationLength;
  94. RtlCopyMemory( &pRemoteLink32->TargetLinkTrackingInformationBuffer,
  95. &pRemoteLink->TargetLinkTrackingInformationBuffer,
  96. pRemoteLink->TargetLinkTrackingInformationLength );
  97. // Succeeded. Return
  98. *pStatus = STATUS_SUCCESS;
  99. return (PBYTE)pRemoteLink32;
  100. }