filters
klaola.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef KLAOLA_H
00028 #define KLAOLA_H
00029
00030 #include <myfile.h>
00031 #include <qstring.h>
00032 #include <qptrlist.h>
00033
00034 class KLaola {
00035
00036 public:
00037 KLaola(const myFile &file);
00038 ~KLaola();
00039
00040 bool isOk() {return ok;}
00041
00042
00043
00044 class OLENode {
00045 public:
00046 virtual ~OLENode() {};
00047 virtual unsigned handle() const = 0;
00048 virtual QString name() const = 0;
00049
00050
00051
00052 virtual bool isDirectory() const = 0;
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 virtual QString readClassStream() const = 0;
00063
00064
00065 virtual QString describe() const = 0;
00066 protected:
00067 OLENode() {}
00068 };
00069
00070
00071
00072 typedef QPtrList<OLENode> NodeList;
00073 NodeList parseRootDir();
00074 NodeList parseCurrentDir();
00075 const NodeList currentPath() const;
00076 const NodeList find(const QString &name, bool onlyCurrentDir=false);
00077 bool enterDir(const OLENode *node);
00078 bool leaveDir();
00079
00080
00081
00082
00083 myFile stream(const OLENode *node);
00084 myFile stream(unsigned handle);
00085
00086 private:
00087 KLaola(const KLaola &);
00088 const KLaola &operator=(const KLaola &);
00089 static const int s_area;
00090
00091 unsigned char read8(int i) const;
00092 unsigned short read16(int i) const;
00093 unsigned int read32(int i) const;
00094
00095
00096 bool parseHeader();
00097 void readBigBlockDepot();
00098 void readSmallBlockDepot();
00099 void readSmallBlockFile();
00100 void readRootList();
00101 void readPPSEntry(int pos, const int handle);
00102 void createTree(const int handle, const short index);
00103 const unsigned char *readBBStream(int start, bool setmaxSblock=false);
00104 const unsigned char *readSBStream(int start) const;
00105 int nextBigBlock(int pos) const;
00106 int nextSmallBlock(int pos) const;
00107
00108
00109
00110 void testIt(QString prefix = "");
00111
00112 public:
00113 typedef enum
00114 {
00115 DIRECTORY = 1,
00116 FILE = 2,
00117 ROOT_ENTRY = 5
00118 } NodeType;
00119
00120
00121 typedef enum
00122 {
00123 OLE_MANAGED_0,
00124 CLSID,
00125 OLE_MANAGED_2,
00126 PARENT_MANAGED,
00127
00128 STRUCTURED_STORAGE,
00129
00130 RESERVED_FIRST,
00131 RESERVED_LAST = 31,
00132 NONE = 32
00133 } Prefix;
00134
00135 class Node: public OLENode {
00136 public:
00137 Node(KLaola *laola) { m_laola = laola; }
00138 ~Node() {}
00139 unsigned handle() const { return m_handle; }
00140 QString name() const;
00141 bool isDirectory() const { return (type == DIRECTORY) || (type == ROOT_ENTRY); }
00142 QString readClassStream() const;
00143 QString describe() const;
00144
00145 KLaola *m_laola;
00146 unsigned m_handle;
00147 Prefix m_prefix;
00148 QString m_name;
00149 NodeType type;
00150 int prevHandle;
00151 int nextHandle;
00152 int dirHandle;
00153 int ts1s;
00154 int ts1d;
00155 int ts2s;
00156 int ts2d;
00157 unsigned sb;
00158 unsigned size;
00159 bool deadDir;
00160 };
00161
00162 private:
00163
00164
00165 NodeList m_nodeList;
00166 NodeList m_currentPath;
00167
00168
00169
00170
00171 struct TreeNode
00172 {
00173 Node *node;
00174 short subtree;
00175 };
00176 typedef QPtrList<TreeNode> SubTree;
00177 QPtrList<SubTree> m_nodeTree;
00178
00179 bool ok;
00180
00181 myFile m_file;
00182 unsigned char *bigBlockDepot;
00183 unsigned char *smallBlockDepot;
00184 unsigned char *smallBlockFile;
00185
00186 unsigned int maxblock;
00187 unsigned int maxSblock;
00188 unsigned int num_of_bbd_blocks;
00189 unsigned int root_startblock;
00190 unsigned int sbd_startblock;
00191 unsigned int *bbd_list;
00192 };
00193 #endif // KLAOLA_H
|