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.

93 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1989 - 1999 Microsoft Corporation
  3. Module Name:
  4. write.c
  5. Abstract:
  6. This module implements the mini redirector call down routines pertaining
  7. to write of file system objects.
  8. --*/
  9. #include "precomp.h"
  10. #pragma hdrstop
  11. //
  12. // The local debug trace level
  13. //
  14. #define Dbg (DEBUG_TRACE_WRITE)
  15. NTSTATUS
  16. NulMRxWrite (
  17. IN PRX_CONTEXT RxContext)
  18. /*++
  19. Routine Description:
  20. This routine opens a file across the network.
  21. Arguments:
  22. RxContext - the RDBSS context
  23. Return Value:
  24. RXSTATUS - The return status for the operation
  25. --*/
  26. {
  27. NTSTATUS Status = STATUS_SUCCESS;
  28. RxCaptureFcb;
  29. PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  30. PVOID pbUserBuffer = NULL;
  31. ULONG ByteCount = (LowIoContext->ParamsFor).ReadWrite.ByteCount;
  32. RXVBO ByteOffset = (LowIoContext->ParamsFor).ReadWrite.ByteOffset;
  33. LONGLONG FileSize = 0;
  34. NulMRxGetFcbExtension(capFcb,pFcbExtension);
  35. PMRX_NET_ROOT pNetRoot = capFcb->pNetRoot;
  36. NulMRxGetNetRootExtension(pNetRoot,pNetRootExtension);
  37. BOOLEAN SynchronousIo = !BooleanFlagOn(RxContext->Flags,RX_CONTEXT_FLAG_ASYNC_OPERATION);
  38. PNULMRX_COMPLETION_CONTEXT pIoCompContext = NulMRxGetMinirdrContext(RxContext);
  39. PDEVICE_OBJECT deviceObject;
  40. RxTraceEnter("NulMRxWrite");
  41. RxDbgTrace(0, Dbg, ("NetRoot is 0x%x Fcb is 0x%x\n", pNetRoot, capFcb));
  42. //
  43. // Lengths that are not sector aligned will be rounded up to
  44. // the next sector boundary. The rounded up length should be
  45. // < AllocationSize.
  46. //
  47. RxGetFileSizeWithLock((PFCB)capFcb,&FileSize);
  48. RxDbgTrace(0, Dbg, ("UserBuffer is0x%x\n", pbUserBuffer ));
  49. RxDbgTrace(0, Dbg, ("ByteCount is %d ByteOffset is %d\n", ByteCount, ByteOffset ));
  50. //
  51. // Initialize the completion context in the RxContext
  52. //
  53. ASSERT( sizeof(*pIoCompContext) == MRX_CONTEXT_SIZE );
  54. RtlZeroMemory( pIoCompContext, sizeof(*pIoCompContext) );
  55. if( SynchronousIo ) {
  56. RxDbgTrace(0, Dbg, ("This I/O is sync\n"));
  57. pIoCompContext->IoType = IO_TYPE_SYNCHRONOUS;
  58. } else {
  59. RxDbgTrace(0, Dbg, ("This I/O is async\n"));
  60. pIoCompContext->IoType = IO_TYPE_ASYNC;
  61. }
  62. RxDbgTrace(0, Dbg, ("Status = %x Info = %x\n",RxContext->IoStatusBlock.Status,RxContext->IoStatusBlock.Information));
  63. RxTraceLeave(Status);
  64. return(Status);
  65. } // NulMRxWrite