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.

98 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1997, 1998 Microsoft Corporation
  3. Module Name:
  4. silock.c
  5. Abstract:
  6. File locking routines for the single instance store
  7. Authors:
  8. Bill Bolosky, Summer, 1997
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. --*/
  13. #include "sip.h"
  14. #ifdef ALLOC_PRAGMA
  15. #pragma alloc_text(PAGE, SiLockControl)
  16. #endif
  17. NTSTATUS
  18. SiCompleteLockIrpRoutine(
  19. IN PVOID Context,
  20. IN PIRP Irp)
  21. /*++
  22. Routine Description:
  23. FsRtl has decided to complete a lock request irp. We don't want to really
  24. complete the irp because we're going to send it to NTFS to set up the parallel
  25. lock structure. So, we use this routine as the "CompleteLockIrp" routine for
  26. fsrtl, and then we don't really complete the irp.
  27. Arguments:
  28. Context - our context parameter (unused)
  29. irp - the create irp, which contains the create request in the
  30. current stack location.
  31. Return Value:
  32. the status from the irp
  33. --*/
  34. {
  35. UNREFERENCED_PARAMETER(Context);
  36. return Irp->IoStatus.Status;
  37. }
  38. NTSTATUS
  39. SiLockControl(
  40. IN PDEVICE_OBJECT DeviceObject,
  41. IN PIRP Irp)
  42. {
  43. NTSTATUS status;
  44. PSIS_SCB scb;
  45. PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp);
  46. PFILE_OBJECT fileObject = irpSp->FileObject;
  47. PSIS_PER_FILE_OBJECT perFO;
  48. PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
  49. PAGED_CODE();
  50. SipHandleControlDeviceObject(DeviceObject, Irp);
  51. if (!SipIsFileObjectSIS(fileObject,DeviceObject,FindActive,&perFO,&scb)) {
  52. SipDirectPassThroughAndReturn(DeviceObject, Irp);
  53. }
  54. SIS_MARK_POINT();
  55. // Now call the FsRtl routine to do the actual processing of the
  56. // Lock request
  57. status = FsRtlProcessFileLock( &scb->FileLock, Irp, NULL );
  58. //
  59. // Now, pass the request down on the link/copied file so that NTFS will also
  60. // maintain the file lock.
  61. //
  62. Irp->CurrentLocation++;
  63. Irp->Tail.Overlay.CurrentStackLocation++;
  64. return IoCallDriver( deviceExtension->AttachedToDeviceObject, Irp );
  65. }