michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef ArchiveReader_h__ michael@0: #define ArchiveReader_h__ michael@0: michael@0: #include "mozilla/NullPtr.h" michael@0: #include michael@0: #include "mar.h" michael@0: michael@0: #ifdef XP_WIN michael@0: typedef WCHAR NS_tchar; michael@0: #else michael@0: typedef char NS_tchar; michael@0: #endif michael@0: michael@0: // This class provides an API to extract files from an update archive. michael@0: class ArchiveReader michael@0: { michael@0: public: michael@0: ArchiveReader() : mArchive(nullptr) {} michael@0: ~ArchiveReader() { Close(); } michael@0: michael@0: int Open(const NS_tchar *path); michael@0: int VerifySignature(); michael@0: int VerifyProductInformation(const char *MARChannelID, michael@0: const char *appVersion); michael@0: void Close(); michael@0: michael@0: int ExtractFile(const char *item, const NS_tchar *destination); michael@0: int ExtractFileToStream(const char *item, FILE *fp); michael@0: michael@0: private: michael@0: int ExtractItemToStream(const MarItem *item, FILE *fp); michael@0: michael@0: MarFile *mArchive; michael@0: }; michael@0: michael@0: #endif // ArchiveReader_h__