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.

175 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. filobsup.c
  5. Abstract:
  6. This module implements the Netware Redirector object support routines.
  7. Author:
  8. Manny Weiser (mannyw) 10-Feb-1993
  9. Revision History:
  10. --*/
  11. #include "procs.h"
  12. //
  13. // The debug trace level
  14. //
  15. #define Dbg (DEBUG_TRACE_FILOBSUP)
  16. #ifdef ALLOC_PRAGMA
  17. #pragma alloc_text( PAGE, NwSetFileObject )
  18. #pragma alloc_text( PAGE, NwDecodeFileObject )
  19. #endif
  20. VOID
  21. NwSetFileObject (
  22. IN PFILE_OBJECT FileObject OPTIONAL,
  23. IN PVOID FsContext,
  24. IN PVOID FsContext2
  25. )
  26. /*++
  27. Routine Description:
  28. This routine sets the file system pointers within the file object.
  29. Arguments:
  30. FileObject - Supplies a pointer to the file object being modified, and
  31. can optionally be null.
  32. FsContext - Supplies a pointer to either an icb, fcb, vcb, or dcb
  33. structure.
  34. FsContext2 - Supplies a pointer to a icb, or is null.
  35. Return Value:
  36. None.
  37. --*/
  38. {
  39. PAGED_CODE();
  40. DebugTrace(+1, Dbg, "NwSetFileObject, FileObject = %08lx\n", (ULONG_PTR)FileObject );
  41. //
  42. // Set the fscontext fields of the file object.
  43. //
  44. FileObject->FsContext = FsContext;
  45. FileObject->FsContext2 = FsContext2;
  46. DebugTrace(-1, Dbg, "NwSetFileObject -> VOID\n", 0);
  47. return;
  48. }
  49. NODE_TYPE_CODE
  50. NwDecodeFileObject (
  51. IN PFILE_OBJECT FileObject,
  52. OUT PVOID *FsContext,
  53. OUT PVOID *FsContext2
  54. )
  55. /*++
  56. Routine Description:
  57. This procedure takes a pointer to a file object, that has already been
  58. opened by the mailslot file system and figures out what it really
  59. is opened.
  60. Arguments:
  61. FileObject - Supplies the file object pointer being interrogated
  62. FsContext - Receives a pointer to the FsContext pointer
  63. FsContext2 - Receives a pointer to the FsContext2 pointer
  64. Return Value:
  65. NODE_TYPE_CODE - Returns the node type code for a Rcb, Scb, Dcb, Icb,
  66. or zero.
  67. Rcb - indicates that file object opens the netware redirector device.
  68. Scb - indicates that file object is for a server.
  69. Dcb - indicates that the file object is for a directory.
  70. Icb - indicates that the file object is for a file.
  71. Zero - indicates that the file object was for a netware file
  72. but has been closed.
  73. --*/
  74. {
  75. NODE_TYPE_CODE NodeTypeCode = NTC_UNDEFINED;
  76. PAGED_CODE();
  77. DebugTrace(+1, Dbg, "NwDecodeFileObject, FileObject = %08lx\n", (ULONG_PTR)FileObject);
  78. //
  79. // Read the fs FsContext fields of the file object.
  80. //
  81. *FsContext = FileObject->FsContext;
  82. *FsContext2 = FileObject->FsContext2;
  83. ASSERT ( *FsContext2 != NULL );
  84. NodeTypeCode = NodeType( *FsContext2 );
  85. DebugTrace(-1, Dbg, "NwDecodeFileObject -> %08lx\n", NodeTypeCode);
  86. return NodeTypeCode;
  87. }
  88. BOOLEAN
  89. NwIsIrpTopLevel (
  90. IN PIRP Irp
  91. )
  92. /*++
  93. Routine Description:
  94. This routine detects if an Irp is the Top level requestor, ie. if it is OK
  95. to do a verify or pop-up now. If TRUE is returned, then no file system
  96. resources are held above us.
  97. Arguments:
  98. Irp - Supplies the Irp being processed
  99. Status - Supplies the status to complete the Irp with
  100. Return Value:
  101. None.
  102. --*/
  103. {
  104. if ( NwGetTopLevelIrp() == NULL ) {
  105. NwSetTopLevelIrp( Irp );
  106. return TRUE;
  107. } else {
  108. return FALSE;
  109. }
  110. }