- Use documented structure instead array

- Add some defines

svn path=/trunk/; revision=42232
This commit is contained in:
Dmitry Chapyshev 2009-07-26 13:16:19 +00:00
parent b163f7f34a
commit 92a18fff94
3 changed files with 50 additions and 21 deletions

View file

@ -14,6 +14,8 @@
#include <ntdddisk.h>
#include <ntddcdrm.h>
#include "udfs.h"
//
// Tag for memory allocations
//

View file

@ -20,9 +20,10 @@ NTAPI
FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize)
{
PUCHAR Buffer = NULL;
PVOLSTRUCTDESC VolumeStructDesc = NULL;
LARGE_INTEGER Offset;
ULONG State = 0;
PAGED_CODE();
Offset.QuadPart = UDFS_VRS_START_OFFSET;
while (TRUE)
@ -31,7 +32,7 @@ FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject,
&Offset,
SectorSize,
SectorSize,
(PVOID)&Buffer,
(PVOID)&VolumeStructDesc,
NULL))
{
break;
@ -41,28 +42,27 @@ FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject,
{
case 0:
if ((Buffer[1] == 'B') &&
(Buffer[2] == 'E') &&
(Buffer[3] == 'A') &&
(Buffer[4] == '0') &&
(Buffer[5] == '1'))
if (!strncmp((const char*)VolumeStructDesc->Ident,
VSD_STD_ID_BEA01,
VSD_STD_ID_LEN))
{
State = 1;
}
else
{
ExFreePool(Buffer);
ExFreePool(VolumeStructDesc);
return FALSE;
}
break;
case 1:
if ((Buffer[1] == 'N') &&
(Buffer[2] == 'S') &&
(Buffer[3] == 'R') &&
(Buffer[4] == '0') &&
((Buffer[5] == '2') || (Buffer[5] == '3')))
if (!strncmp((const char*)VolumeStructDesc->Ident,
VSD_STD_ID_NSR03,
VSD_STD_ID_LEN) ||
!strncmp((const char*)VolumeStructDesc->Ident,
VSD_STD_ID_NSR02,
VSD_STD_ID_LEN))
{
State = 2;
}
@ -70,13 +70,11 @@ FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject,
case 2:
if ((Buffer[1] == 'T') &&
(Buffer[2] == 'E') &&
(Buffer[3] == 'A') &&
(Buffer[4] == '0') &&
(Buffer[5] == '1'))
if (!strncmp((const char*)VolumeStructDesc->Ident,
VSD_STD_ID_TEA01,
VSD_STD_ID_LEN))
{
ExFreePool(Buffer);
ExFreePool(VolumeStructDesc);
return TRUE;
}
break;
@ -85,12 +83,12 @@ FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject,
Offset.QuadPart += SectorSize;
if (Offset.QuadPart == UDFS_AVDP_SECTOR)
{
ExFreePool(Buffer);
ExFreePool(VolumeStructDesc);
return FALSE;
}
}
ExFreePool(Buffer);
ExFreePool(VolumeStructDesc);
return TRUE;
}

View file

@ -0,0 +1,29 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS File System Recognizer
* FILE: drivers/filesystems/fs_rec/udfs.h
* PURPOSE: UDFS Header File
* PROGRAMMER: Dmitry Chapyshev (dmitry@reactos.org)
*/
/* Standard Identifier (EMCA 167r2 2/9.1.2) */
#define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */
/* Standard Identifier (ECMA 167r3 2/9.1.2) */
#define VSD_STD_ID_BEA01 "BEA01" /* (2/9.2) */
#define VSD_STD_ID_BOOT2 "BOOT2" /* (2/9.4) */
#define VSD_STD_ID_CD001 "CD001" /* (ECMA-119) */
#define VSD_STD_ID_CDW02 "CDW02" /* (ECMA-168) */
#define VSD_STD_ID_NSR03 "NSR03" /* (3/9.1) */
#define VSD_STD_ID_TEA01 "TEA01" /* (2/9.3) */
/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
#define VSD_STD_ID_LEN 5
typedef struct _VOLSTRUCTDESC
{
UCHAR Type;
UCHAR Ident[VSD_STD_ID_LEN];
UCHAR Version;
UCHAR Data[2041];
} VOLSTRUCTDESC, *PVOLSTRUCTDESC;