2007-12-07 00:26:56 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdexcept>
|
|
|
|
#include "VolumeDescriptor.h"
|
|
|
|
|
|
|
|
using namespace Framework;
|
|
|
|
using namespace ISO9660;
|
|
|
|
using namespace std;
|
|
|
|
|
2008-03-17 19:20:37 +00:00
|
|
|
CVolumeDescriptor::CVolumeDescriptor(CStream* stream)
|
2007-12-07 00:26:56 +00:00
|
|
|
{
|
2008-03-17 19:20:37 +00:00
|
|
|
//Starts at LBA 16
|
2008-04-05 03:38:53 +00:00
|
|
|
stream->Seek(0x8000, Framework::STREAM_SEEK_SET);
|
2008-03-17 19:20:37 +00:00
|
|
|
stream->Read(&m_nType, 1);
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-03-17 19:20:37 +00:00
|
|
|
if(m_nType != 0x01)
|
|
|
|
{
|
|
|
|
throw runtime_error("Invalid ISO9660 Volume Descriptor.");
|
|
|
|
}
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-03-17 19:20:37 +00:00
|
|
|
stream->Read(m_sStdId, 5);
|
|
|
|
m_sStdId[5] = 0x00;
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-03-17 19:20:37 +00:00
|
|
|
if(strcmp(m_sStdId, "CD001"))
|
|
|
|
{
|
|
|
|
throw runtime_error("Invalid ISO9660 Volume Descriptor.");
|
|
|
|
}
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-04-05 03:38:53 +00:00
|
|
|
stream->Seek(34, Framework::STREAM_SEEK_CUR);
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-03-17 19:20:37 +00:00
|
|
|
stream->Read(m_sVolumeId, 32);
|
|
|
|
m_sVolumeId[32] = 0x00;
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-04-05 03:38:53 +00:00
|
|
|
stream->Seek(68, Framework::STREAM_SEEK_CUR);
|
2007-12-07 00:26:56 +00:00
|
|
|
|
2008-03-17 19:20:37 +00:00
|
|
|
stream->Read(&m_nLPathTableAddress, 4);
|
|
|
|
stream->Read(&m_nMPathTableAddress, 4);
|
2007-12-07 00:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CVolumeDescriptor::~CVolumeDescriptor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 CVolumeDescriptor::GetLPathTableAddress() const
|
|
|
|
{
|
2008-03-17 19:20:37 +00:00
|
|
|
return m_nLPathTableAddress;
|
2007-12-07 00:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32 CVolumeDescriptor::GetMPathTableAddress() const
|
|
|
|
{
|
2008-03-17 19:20:37 +00:00
|
|
|
return m_nMPathTableAddress;
|
2007-12-07 00:26:56 +00:00
|
|
|
}
|