ReactOS  0.4.15-dev-1070-ge1a01de
udfs.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS File System Recognizer
4  * FILE: drivers/filesystems/fs_rec/udfs.c
5  * PURPOSE: USFS Recognizer
6  * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7  * Eric Kohl
8  */
9 
10 /* INCLUDES *****************************************************************/
11 
12 #include "fs_rec.h"
13 
14 #define NDEBUG
15 #include <debug.h>
16 
17 #include "udfs.h"
18 
19 /* FUNCTIONS ****************************************************************/
20 
21 BOOLEAN
22 NTAPI
25 {
26  PVOLSTRUCTDESC VolumeStructDesc = NULL;
28  BOOLEAN ret = FALSE;
29  int i;
30  PAGED_CODE();
31 
32  Offset.QuadPart = 16 * SectorSize;
33  for (i = 0; i < 16; i++)
34  {
36  &Offset,
37  SectorSize,
38  SectorSize,
39  (PVOID *)&VolumeStructDesc,
40  NULL))
41  {
42  break;
43  }
44 
45  if (!strncmp((const char*)VolumeStructDesc->Ident,
48  {
49  DPRINT("BEA01 found\n");
50  }
51 
52  if (!strncmp((const char*)VolumeStructDesc->Ident,
55  {
56  DPRINT("NSR03 found\n");
57  ret = TRUE;
58  }
59 
60  if (!strncmp((const char*)VolumeStructDesc->Ident,
63  {
64  DPRINT("NSR02 found\n");
65  ret = TRUE;
66  }
67 
68  if (!strncmp((const char*)VolumeStructDesc->Ident,
71  {
72  DPRINT("TEA01 found\n");
73  }
74 
75  if (!strncmp((const char*)VolumeStructDesc->Ident,
78  {
79  DPRINT("CD001 found\n");
80  }
81 
82  if (!strncmp((const char*)VolumeStructDesc->Ident,
85  {
86  DPRINT("CDW02 found\n");
87  }
88 
89  if (!strncmp((const char*)VolumeStructDesc->Ident,
92  {
93  DPRINT("BOOT2 found\n");
94  }
95 
96  Offset.QuadPart += SectorSize;
97  }
98 
99  if (VolumeStructDesc)
100  ExFreePool(VolumeStructDesc);
101  return ret;
102 }
103 
104 NTSTATUS
105 NTAPI
107  IN PIRP Irp)
108 {
109  PIO_STACK_LOCATION Stack;
111  PDEVICE_OBJECT MountDevice;
113  PAGED_CODE();
114 
115  /* Get the I/O Stack and check the function type */
117  switch (Stack->MinorFunction)
118  {
119  case IRP_MN_MOUNT_VOLUME:
120 
121  /* Assume failure */
123 
124  /* Get the device object and request the sector size */
125  MountDevice = Stack->Parameters.MountVolume.DeviceObject;
126  if (FsRecGetDeviceSectorSize(MountDevice, &SectorSize))
127  {
128  /* Check if it's an actual UDF volume */
129  if (FsRecIsUdfsVolume(MountDevice, SectorSize))
130  {
131  /* It is! */
133  }
134  }
135 
136  break;
137 
139 
140  /* Load the file system */
142  L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Udfs");
143  break;
144 
145  default:
146 
147  /* Invalid request */
149  }
150 
151  /* Return Status */
152  return Status;
153 }
154 
155 /* EOF */
#define IN
Definition: typedefs.h:39
#define VSD_STD_ID_BEA01
Definition: udfs.h:13
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI FsRecGetDeviceSectorSize(IN PDEVICE_OBJECT DeviceObject, OUT PULONG SectorSize)
Definition: blockdev.c:80
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MN_LOAD_FILE_SYSTEM
Definition: iotypes.h:4385
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define VSD_STD_ID_NSR03
Definition: udfs.h:17
#define STATUS_FS_DRIVER_REQUIRED
Definition: ntstatus.h:645
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define FALSE
Definition: types.h:117
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
#define VSD_STD_ID_CDW02
Definition: udfs.h:16
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define IRP_MN_MOUNT_VOLUME
Definition: iotypes.h:4383
#define VSD_STD_ID_TEA01
Definition: udfs.h:18
#define VSD_STD_ID_CD001
Definition: udfs.h:15
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define VSD_STD_ID_LEN
Definition: udfs.h:21
int ret
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN NTAPI FsRecReadBlock(IN PDEVICE_OBJECT DeviceObject, IN PLARGE_INTEGER Offset, IN ULONG Length, IN ULONG SectorSize, IN OUT PVOID *Buffer, OUT PBOOLEAN DeviceError OPTIONAL)
Definition: blockdev.c:152
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
#define VSD_STD_ID_BOOT2
Definition: udfs.h:14
NTSTATUS NTAPI FsRecUdfsFsControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: udfs.c:106
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#define VSD_STD_ID_NSR02
Definition: udfs.h:10
NTSTATUS NTAPI FsRecLoadFileSystem(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR DriverServiceName)
Definition: fs_rec.c:23
BOOLEAN NTAPI FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize)
Definition: udfs.c:23
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG SectorSize
Definition: halfuncs.h:291
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PAGED_CODE()