ReactOS  0.4.13-dev-1148-g9b75b67
filter.cpp File Reference
#include "udffs.h"
Include dependency graph for filter.cpp:

Go to the source code of this file.

Macros

#define UDF_BUG_CHECK_ID   UDF_FILE_FILTER
 

Functions

VOID UDFCheckOtherFS (PDEVICE_OBJECT deviceObject)
 
VOID UDFCheckOtherFSByName (PCWSTR DeviceObjectName)
 

Macro Definition Documentation

◆ UDF_BUG_CHECK_ID

#define UDF_BUG_CHECK_ID   UDF_FILE_FILTER

Definition at line 24 of file filter.cpp.

Function Documentation

◆ UDFCheckOtherFS()

VOID UDFCheckOtherFS ( PDEVICE_OBJECT  deviceObject)

Definition at line 27 of file filter.cpp.

27  {
28  PFILTER_DEV_EXTENSION FilterDevExt;
29  PDEVICE_OBJECT filterDeviceObject;
30  NTSTATUS RC;
31 
32 // BrutePoint();
33 
34  // Acquire GlobalDataResource
35  UDFAcquireResourceExclusive(&(UDFGlobalData.GlobalDataResource), TRUE);
36 
37  if (!NT_SUCCESS(RC = IoCreateDevice(
38  UDFGlobalData.DriverObject, // our driver object
39  sizeof(FILTER_DEV_EXTENSION), // don't need an extension
40  // for this object
41  NULL, // name - can be used to
42  // "open" the driver
43  // see the R.Nagar's book
44  // for alternate choices
46  0, // no special characteristics
47  // do not want this as an
48  // exclusive device, though
49  // we might
50  FALSE,
51  &filterDeviceObject))) {
52  // failed to create a filter device object, leave ...
53  // Release the global resource.
54  UDFReleaseResource( &(UDFGlobalData.GlobalDataResource) );
55  return;
56  }
57  FilterDevExt = (PFILTER_DEV_EXTENSION)filterDeviceObject->DeviceExtension;
58  // Zero it out (typically this has already been done by the I/O
59  // Manager but it does not hurt to do it again)!
60  RtlZeroMemory(FilterDevExt, sizeof(FILTER_DEV_EXTENSION));
61 
62  // Initialize the signature fields
64  FilterDevExt->NodeIdentifier.NodeSize = sizeof(FILTER_DEV_EXTENSION);
65 
66  UDFPrint(("UDFCheckOtherFS: Attaching filter devobj %x to FS devobj %x \n",filterDeviceObject,deviceObject));
67  deviceObject = IoGetAttachedDevice( deviceObject );
68  UDFPrint(("UDFCheckOtherFS: top devobj is %x \n",deviceObject));
69  FilterDevExt->lowerFSDeviceObject = deviceObject;
70 
71  RC = IoAttachDeviceByPointer( filterDeviceObject, deviceObject );
72  if (!NT_SUCCESS(RC)) {
73  IoDeleteDevice( filterDeviceObject );
74  } else {
75  filterDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
76  }
77  // Release the global resource.
78  UDFReleaseResource( &(UDFGlobalData.GlobalDataResource) );
79 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
LONG NTSTATUS
Definition: precomp.h:26
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
uint32 NodeType
Definition: struct.h:75
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define UDF_NODE_TYPE_FILTER_DEVOBJ
Definition: struct.h:64
UDFData UDFGlobalData
Definition: udfinit.cpp:25
uint32 NodeSize
Definition: struct.h:76
PDEVICE_OBJECT lowerFSDeviceObject
Definition: struct.h:350
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDEVICE_OBJECT NTAPI IoGetAttachedDevice(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1385
struct _FILTER_DEV_EXTENSION FILTER_DEV_EXTENSION
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:108
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI IoAttachDeviceByPointer(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:947
struct _FILTER_DEV_EXTENSION * PFILTER_DEV_EXTENSION
UDFIdentifier NodeIdentifier
Definition: struct.h:348

Referenced by UDFCheckOtherFSByName().

◆ UDFCheckOtherFSByName()

VOID UDFCheckOtherFSByName ( PCWSTR  DeviceObjectName)

Definition at line 82 of file filter.cpp.

82  {
83  PFILE_OBJECT fileObject;
84  PDEVICE_OBJECT deviceObject;
85  UNICODE_STRING nameString;
86  NTSTATUS RC;
87 
88  UDFPrint(("UDFCheckOtherFSByName: trying %s \n",DeviceObjectName));
89 
90  RtlInitUnicodeString( &nameString, DeviceObjectName );
92  &nameString,
94  &fileObject,
95  &deviceObject
96  );
97 
98  if (!NT_SUCCESS(RC)) {
99  UDFPrint(("UDFCheckOtherFSByName: error %x while calling IoGetDeviceObjectPointer \n",RC));
100  return;
101  }
102 
103  UDFCheckOtherFS(deviceObject);
104 
105  ObDereferenceObject( fileObject );
106 }
#define UDFPrint(Args)
Definition: udffs.h:225
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
* PFILE_OBJECT
Definition: iotypes.h:1955
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
VOID UDFCheckOtherFS(PDEVICE_OBJECT deviceObject)
Definition: filter.cpp:27
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)