Support unrar64.dll
[xy_vsfilter.git] / src / decss / VobFile.h
blob4be1dbcb732fc969dbb44f2b133d21ed2d85a92c
1 #pragma once
3 #pragma warning(disable : 4200)
5 #include <atlbase.h>
6 #include <atlcoll.h>
7 //#include <winioctl.h> // platform sdk
8 #include "..\..\include\winddk\ntddcdvd.h"
10 class CDVDSession
12 protected:
13 HANDLE m_hDrive;
15 DVD_SESSION_ID m_session;
16 bool BeginSession();
17 void EndSession();
19 BYTE m_SessionKey[5];
20 bool Authenticate();
22 BYTE m_DiscKey[6], m_TitleKey[6];
23 bool GetDiscKey();
24 bool GetTitleKey(int lba, BYTE* pKey);
26 public:
27 CDVDSession();
28 virtual ~CDVDSession();
30 bool Open(LPCTSTR path);
31 void Close();
33 operator HANDLE() {return m_hDrive;}
34 operator DVD_SESSION_ID() {return m_session;}
36 bool SendKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData);
37 bool ReadKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData, int lba = 0);
40 class CLBAFile : private CFile
42 public:
43 CLBAFile();
44 virtual ~CLBAFile();
46 bool IsOpen();
48 bool Open(LPCTSTR path);
49 void Close();
51 int GetLength();
52 int GetPosition();
53 int Seek(int lba);
54 bool Read(BYTE* buff);
57 class CVobFile : public CDVDSession
59 // all files
60 typedef struct {CString fn; int size;} file_t;
61 CAtlArray<file_t> m_files;
62 int m_iFile;
63 int m_pos, m_size, m_offset;
65 // currently opened file
66 CLBAFile m_file;
68 // attribs
69 bool m_fDVD, m_fHasDiscKey, m_fHasTitleKey;
71 public:
72 CVobFile();
73 virtual ~CVobFile();
75 bool IsDVD();
76 bool HasDiscKey(BYTE* key);
77 bool HasTitleKey(BYTE* key);
79 bool Open(CString fn, CAtlList<CString>& files /* out */); // vts ifo
80 bool Open(CAtlList<CString>& files, int offset = -1); // vts vobs, video vob offset in lba
81 void Close();
83 int GetLength();
84 int GetPosition();
85 int Seek(int pos);
86 bool Read(BYTE* buff);