Commit 3702d71a authored by Sergey.Kirillov's avatar Sergey.Kirillov Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52217 954022d7-b5bf-4e40-9824-e11837661b57
parent 66e17312
// AVSOfficeEpubFile.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
// The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you
[ module(dll, uuid = "{18A70273-06FE-4b56-ADB6-B72992B202FD}",
name = "AVSOfficeEpubFile",
helpstring = "AVSOfficeEpubFile 1.0 Type Library",
resource_name = "IDR_AVSOFFICEEPUBFILE") ]
class CAVSOfficeEpubFileModule
{
public:
// Override CAtlDllModuleT members
};
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
#define COMPONENT_NAME "OfficeEpubFile"
#include "../../../../Common/FileInfo.h"
#include "version.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE 25, 1
#pragma code_page(1251)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTVER
PRODUCTVERSION INTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "InternalName", COMPONENT_FILE_NAME_DLL
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "LegalTrademarks", LEGAL_COPYRIGHT
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
IDR_AVSOFFICEEPUBFILE REGISTRY "AVSOfficeEpubFile.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "AVSOfficeEpubFile"
END
/////////////////////////////////////////////////////////////////////////////
#endif
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'AVSOfficeEpubFile'
'AVSOfficeEpubFile.DLL'
{
val AppID = s '%APPID%'
}
}
}

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AVSOfficeEpubFile", "AVSOfficeEpubFile.vcproj", "{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}"
ProjectSection(ProjectDependencies) = postProject
{52B37168-F0D9-403D-ADD4-5C07B4602643} = {52B37168-F0D9-403D-ADD4-5C07B4602643}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_regexp", "boost_regexp\boost_regexp.vcproj", "{52B37168-F0D9-403D-ADD4-5C07B4602643}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}.Debug|Win32.ActiveCfg = Debug|Win32
{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}.Debug|Win32.Build.0 = Debug|Win32
{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}.Release|Win32.ActiveCfg = Release|Win32
{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}.Release|Win32.Build.0 = Release|Win32
{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{CF852DB8-5A50-4C30-B683-5503D8DAF7B3}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{52B37168-F0D9-403D-ADD4-5C07B4602643}.Debug|Win32.ActiveCfg = Debug|Win32
{52B37168-F0D9-403D-ADD4-5C07B4602643}.Debug|Win32.Build.0 = Debug|Win32
{52B37168-F0D9-403D-ADD4-5C07B4602643}.Release|Win32.ActiveCfg = Release|Win32
{52B37168-F0D9-403D-ADD4-5C07B4602643}.Release|Win32.Build.0 = Release|Win32
{52B37168-F0D9-403D-ADD4-5C07B4602643}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{52B37168-F0D9-403D-ADD4-5C07B4602643}.ReleaseASC|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal
This diff is collapsed.
This diff is collapsed.
// AVSDocumentConverter.h : Declaration of the CAVSDocumentConverter
#pragma once
#include "resource.h" // main symbols
#include "..\Common\OfficeFileTemplate.h"
#include "AtlDefine.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
// IAVSDocumentConverter
[
object,
uuid("DA839E4E-A559-4ee1-A863-4A6D44484989"),
dual, helpstring("IAVSOfficeEpubFile Interface"),
pointer_default(unique)
]
__interface IOfficeEpubFile : IAVSOfficeFileTemplate
{
[id(10)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(20)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
[id(30), propget] HRESULT CommandRenderer([out, retval] IUnknown** ppunkRend);
[id(30), propput] HRESULT CommandRenderer([in] IUnknown* punkRend);
};
// CAVSOfficeEpubFile
[
coclass,
default(IOfficeEpubFile),
threading(apartment),
event_source(com),
vi_progid("AVSOfficeEpubFile.AVSDocume"),
progid("AVSOfficeEpubFile.AVSDocu.1"),
version(1.0),
uuid("82506410-0164-459a-A191-381C22F1550E"),
helpstring("AVSOfficeEpubFile Class")
]
class ATL_NO_VTABLE COfficeEpubFile : public IOfficeEpubFile
{
public:
COfficeEpubFile():m_piCommandsRenderer(NULL)
{
m_nTasksAll = 0;
m_nTasksComplete = 0;
m_bCancel = false;
m_sMetadata = _T("");
}
__event __interface _IAVSOfficeFileTemplateEvents;
__event __interface _IAVSOfficeFileTemplateEvents2;
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
RELEASEINTERFACE (m_piCommandsRenderer);
}
public:
STDMETHOD(LoadFromFile)( BSTR bstrSrcFileName, BSTR bstrDstPath, BSTR bstrXMLOptions);
STDMETHOD(SaveToFile)( BSTR bstrDstFileName, BSTR bstrSrcPath, BSTR bstrXMLOptions);
STDMETHOD(SetAdditionalParam)( BSTR ParamName, VARIANT ParamValue);
STDMETHOD(GetAdditionalParam)( BSTR ParamName, VARIANT* ParamValue);
STDMETHOD(get_CommandRenderer)(IUnknown** ppunkRend);
STDMETHOD(put_CommandRenderer)(IUnknown* ppunkRend);
public:
HRESULT OnProgressHtml( LONG nID, LONG nPercent );
HRESULT OnProgressHtmlEx( LONG nID, LONG nPercent, SHORT* Cancel );
private:
BOOL IsEpubFile(CString sFilename, long& nError );
bool SaveCover( CString sFilename, long& nWidth, long& nHeight );
void UpdateGdiPlusRenderer(double dWidthMm, double dHeightMm,AVSMediaCore3::IAVSUncompressedVideoFrame** piImage,AVSGraphics::IAVSGraphicsRenderer** piRend);
private:
AVSGraphics::IAVSDocumentRenderer * m_piCommandsRenderer;
int m_nTasksAll;
int m_nTasksComplete;
bool m_bCancel;
CString m_sMetadata;
};
\ No newline at end of file
#pragma once
#include "EpubPackage.h"
class EpubContainer
{
public: EpubPackage m_oEpubPackage;
public: int Load( CString sFolderPath )
{
CString sContainer = sFolderPath + _T("\\META-INF\\container.xml");
XmlUtils::CXmlReader oXmlReader;
if( TRUE == oXmlReader.OpenFromFile( sContainer ) )
if( TRUE == oXmlReader.ReadRootNode( _T("container") ) )
if( TRUE == oXmlReader.ReadNode( _T("rootfiles") ) )
if( TRUE == oXmlReader.ReadNodeList( _T("rootfile") ) )
{
for( int i = 0; i < oXmlReader.GetLengthList(); i++ )
{
CString sMime = oXmlReader.ReadNodeAttribute( i, _T("media-type") );
CString sPackagePath = oXmlReader.ReadNodeAttribute( i, _T("full-path") );
if( _T("") != sPackagePath && _T("application/oebps-package+xml") == sMime )
return m_oEpubPackage.Load( sFolderPath + _T("\\") + sPackagePath );
}
}
return -1;
}
public: int Create( CString sFolderPath )
{
HANDLE hFile = NULL;
DWORD dwBetysWritten = 0;
// mime
hFile = ::CreateFile( sFolderPath + _T("\\mimetype"), GENERIC_WRITE, 0, 0, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, 0);
if( INVALID_HANDLE_VALUE == hFile )
return -1;
CStringA sMime = "application/epub+zip";
::WriteFile( hFile, sMime, sMime.GetLength(), &dwBetysWritten, NULL );
RELEASEHANDLE( hFile );
// META-INF
CreateDirectory( sFolderPath + _T("\\META-INF"), NULL );
//container.xml
hFile = ::CreateFile( sFolderPath + _T("\\META-INF\\container.xml"), GENERIC_WRITE, 0, 0, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, 0);
if( INVALID_HANDLE_VALUE == hFile )
return -1;
CStringA sContainer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
sContainer.Append( "<container xmlns=\"urn:oasis:names:tc:opendocument:xmlns:container\" version=\"1.0\"><rootfiles><rootfile full-path=\"OPS/content.opf\" media-type=\"application/oebps-package+xml\"/></rootfiles></container>" );
::WriteFile( hFile, sContainer, sContainer.GetLength(), &dwBetysWritten, NULL );
RELEASEHANDLE( hFile );
// package
CreateDirectory( sFolderPath + _T("\\OPS"), NULL );
return m_oEpubPackage.Create( sFolderPath + _T("\\OPS\\"), _T("OPS/") );
}
public: void Save( CString sFolderPath )
{
m_oEpubPackage.Save();
//encryption.xml
if( m_oEpubPackage.m_aCrypted.GetCount() > 0 )
{
HANDLE hFile = NULL;
DWORD dwBetysWritten = 0;
hFile = ::CreateFile( sFolderPath + _T("\\META-INF\\encryption.xml"), GENERIC_WRITE, 0, 0, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, 0);
if( INVALID_HANDLE_VALUE == hFile )
return ;
CString sEncryption = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sEncryption.Append( _T("<encryption xmlns=\"urn:oasis:names:tc:opendocument:xmlns:container\">") );
for( int i = 0; i < (int)m_oEpubPackage.m_aCrypted.GetCount(); i++ )
sEncryption.Append( m_oEpubPackage.m_aCrypted[i] );
sEncryption.Append( _T("</encryption>") );
// utf-8
CStringA sContentUtf;
int nBufSize = WideCharToMultiByte(CP_UTF8, 0, sEncryption, -1, NULL, NULL, NULL, NULL);
LPSTR p = sContentUtf.GetBuffer( nBufSize );
WideCharToMultiByte(CP_UTF8, 0, sEncryption, -1, p, nBufSize, NULL, NULL);
sContentUtf.ReleaseBuffer();
::WriteFile( hFile, sContentUtf, sContentUtf.GetLength(), &dwBetysWritten, NULL );
RELEASEHANDLE( hFile );
}
}
};
\ No newline at end of file
#pragma once
#include "SHA1/sha1.h"
#include "../AVSOfficeUniversalConverter/Utils.h"
#define ZLIB_WINAPI
#define CODEPAGE_ISSUE_FIX
#include "zlib.h"
#define BUFFER_ENCODE_READ 2048 // 1040
#define BUFFER_ENCODE_WRITE 8196
#define BUFFER_DECODE_READ 2048
#define BUFFER_DECODE_WRITE 8196
CStringA Strip( CStringA sInput )
{
CStringA sResult = sInput;
sResult.Remove( ' ' );
sResult.Remove( 0x20 );
sResult.Remove( 0x09 );
sResult.Remove( 0x0D );
sResult.Remove( 0x0A );
return sResult;
}
//XOR ,
bool CryptFile( CString sSourceFile, CString sDestFilename, CStringA sInit, bool bEncode, bool bIDPF = true )
{
byte* mask = NULL;
int masklength = 0;
int headerLen = 0;
if( true == bIDPF )
{//IDPF
// SHA-1 hash sInit
SHA1 oSha1;
oSha1.Reset();
sInit = Strip( sInit );
oSha1.Input( sInit, sInit.GetLength() );
unsigned int Hash[5];
if( false == oSha1.Result( (unsigned int*)Hash ) )
return false;
//
mask = new byte[ 20 ];
masklength = 20;
headerLen = 1040;
for( int i = 0; i < 5 ; i++ )
{
mask[ i * 4 + 0 ] = (Hash[i] & 0xff000000) >> 24;
mask[ i * 4 + 1 ] = (Hash[i] & 0x00ff0000) >> 16;
mask[ i * 4 + 2 ] = (Hash[i] & 0x0000ff00) >> 8;
mask[ i * 4 + 3 ] = (Hash[i] & 0x000000ff) >> 0;
}
}
else
{//ADOBE
if( -1 != sInit.Find( "urn:uuid:" ) )
sInit.Delete( 0, 9 );
CAtlArray<byte> aTempBytes;
int acc = 0;
int len = sInit.GetLength();
for (int i = 0; i < len; i++)
{
char c = sInit[i];
int n;
if ('0' <= c && c <= '9')
n = c - '0';
else if ('a' <= c && c <= 'f')
n = c - ('a' - 10);
else if ('A' <= c && c <= 'F')
n = c - ('A' - 10);
else
continue;
if (acc == 0)
{
acc = 0x100 | (n << 4);
}
else
{
aTempBytes.Add(acc | n);
acc = 0;
}
}
if (aTempBytes.GetCount() != 16)
return false;
masklength = aTempBytes.GetCount();
mask = new byte[ masklength ];
headerLen = 1024;
for( int i = 0; i < masklength; i++ )
mask[i] = aTempBytes[i];
}
BYTE* byteReadBuffer = NULL;
DWORD dwReadBuffSize = NULL;
if( true == bEncode )
{
byteReadBuffer = new BYTE[ BUFFER_ENCODE_READ ];
dwReadBuffSize = BUFFER_ENCODE_READ;
}
else
{
byteReadBuffer = new BYTE[ BUFFER_DECODE_READ ];
dwReadBuffSize = BUFFER_DECODE_READ;
}
//
HANDLE hFileRead = ::CreateFile( sSourceFile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
DWORD dwBytesRead = 0;
//
HANDLE hFileWrite = ::CreateFile( sDestFilename, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );
DWORD dwBytesWrite = 0;
if( INVALID_HANDLE_VALUE == hFileRead || INVALID_HANDLE_VALUE == hFileWrite )
return false;
//
BYTE* outBuff = NULL;
DWORD dwOutBuffSize = NULL;
if( true == bEncode )
{
outBuff = new BYTE[ BUFFER_ENCODE_WRITE ];
dwOutBuffSize = BUFFER_ENCODE_WRITE;
}
else
{
outBuff = new BYTE[ BUFFER_DECODE_WRITE ];
dwOutBuffSize = BUFFER_DECODE_WRITE;
}
::ReadFile( hFileRead, byteReadBuffer, dwReadBuffSize, &dwBytesRead, NULL );
long dwRead = 0, dwWritten = 0;
bool bFirst = true;
bool bError = false;
int nRes = 0;
z_stream strm;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
if( true == bEncode )
nRes = deflateInit2( &strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -15, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY );
else
nRes = inflateInit2( &strm, -15 );
if (nRes != Z_OK)
return false;
nRes = 0;
do
{
if( true == bEncode )
{
strm.next_in = byteReadBuffer;
strm.avail_in = dwBytesRead;
do
{
strm.avail_out = dwOutBuffSize;
strm.next_out = outBuff;
nRes = deflate( &strm, Z_FULL_FLUSH );
if( S_OK != nRes && Z_STREAM_END != nRes )
return false;
long nBytesToWrite = dwOutBuffSize - strm.avail_out;
if( headerLen > 0 )
{
int nMinSize = headerLen;
if( nMinSize > nBytesToWrite )
nMinSize = nBytesToWrite;
headerLen -= nMinSize;
for( int i = 0; i < nMinSize; i++ )
outBuff[ i ] = outBuff[ i ] ^ mask[ i % masklength ];
}
DWORD dwBytesWrittenInFile = 0;
::WriteFile( hFileWrite, outBuff , nBytesToWrite, &dwBytesWrittenInFile, NULL );
}
while( strm.avail_in != 0 );
::ReadFile( hFileRead, byteReadBuffer ,dwReadBuffSize, &dwBytesRead, NULL );
}
else
{
strm.next_in = byteReadBuffer;
strm.avail_in = dwBytesRead;
if( headerLen > 0 )
{
int nMinSize = headerLen;
if( nMinSize > dwBytesRead )
nMinSize = dwBytesRead;
headerLen -= nMinSize;
for( int i = 0; i < nMinSize; i++ )
byteReadBuffer[ i ] = byteReadBuffer[ i ] ^ mask[ i % masklength ];
}
do
{
strm.avail_out = dwOutBuffSize;
strm.next_out = outBuff;
nRes = inflate(&strm, Z_NO_FLUSH);
if( S_OK != nRes && Z_STREAM_END != nRes )
return false;
long nBytesToWrite = dwOutBuffSize - strm.avail_out;
DWORD dwBytesWrittenInFile = 0;
::WriteFile( hFileWrite, outBuff , nBytesToWrite, &dwBytesWrittenInFile, NULL );
}
while( strm.avail_in != 0 );
::ReadFile( hFileRead, byteReadBuffer ,dwReadBuffSize, &dwBytesRead, NULL );
}
}
while( Z_STREAM_END != nRes && dwBytesRead > 0 );
if( true == bEncode )
deflateEnd(&strm);
else
inflateEnd(&strm);
RELEASEARRAYOBJECTS( byteReadBuffer );
RELEASEARRAYOBJECTS( outBuff );
RELEASEARRAYOBJECTS( mask );
CloseHandle( hFileRead );
CloseHandle( hFileWrite );
return true;
}
\ No newline at end of file
This diff is collapsed.
#pragma once
#include "..\AVSOfficeFile\OfficeEventsTemplate.h"
template <class T, class Reciever>
class COfficeHtmlEvent : public COfficeEventTemplate<T,Reciever>
{
public:
COfficeHtmlEvent(Reciever *pReciever):COfficeEventTemplate(pReciever)
{
m_cnt = 0;
m_dwAdvise = 0;
};
HRESULT OnProgress( LONG nID, LONG nPercent )
{
m_pReciever->OnProgressHtml( nID, nPercent );
return S_OK;
}
HRESULT OnProgressEx( LONG nID, LONG nPercent, SHORT* Cancel )
{
m_pReciever->OnProgressHtmlEx( nID, nPercent, Cancel );
return S_OK;
}
STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
//CTemporaryCS oCS(&m_csThread);
HRESULT hr;
VARIANTARG varg0;
VARIANTARG varg1;
VARIANTARG varg2;
switch(dispIdMember) {
case 1:
VariantInit(&varg0);
VariantInit(&varg1);
hr = DispGetParam(pDispParams,0,VT_I4,&varg0,puArgErr);
hr = DispGetParam(pDispParams,1,VT_I4,&varg1,puArgErr);
OnProgress( varg0.lVal, varg1.lVal );
return(S_OK);
break;
case 2:
VariantInit(&varg0);
VariantInit(&varg1);
VariantInit(&varg2);
hr = DispGetParam(pDispParams,0,VT_I4,&varg0,puArgErr);
hr = DispGetParam(pDispParams,1,VT_I4,&varg1,puArgErr);
hr = DispGetParam(pDispParams,2,VT_I2,&varg2,puArgErr);
OnProgressEx( varg0.lVal, varg1.lVal, &varg2.iVal );
if (pDispParams->rgvarg[0].vt & VT_BYREF) // implemented now for last VT_I2 arg only
{
SHORT* p = (SHORT*)pDispParams->rgvarg[0].byref;
if (p) *p = varg2.iVal;
}
return(S_OK);
break;
default:
return(E_NOTIMPL);
}
}
};
\ No newline at end of file
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by AVSOfficeCAVSOfficeEpubFile.rc
//
#define IDS_PROJNAME 100
#define IDR_AVSOFFICEEPUBFILE 101
#define IDR_CRPT1 202
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 203
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
This diff is collapsed.
/*
* sha1.h
*
* Copyright (C) 1998, 2009
* Paul E. Jones <paulej@packetizer.com>
* All Rights Reserved.
*
*****************************************************************************
* $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $
*****************************************************************************
*
* Description:
* This class implements the Secure Hashing Standard as defined
* in FIPS PUB 180-1 published April 17, 1995.
*
* Many of the variable names in this class, especially the single
* character names, were used because those were the names used
* in the publication.
*
* Please read the file sha1.cpp for more information.
*
*/
#ifndef _SHA1_H_
#define _SHA1_H_
class SHA1
{
public:
SHA1();
virtual ~SHA1();
/*
* Re-initialize the class
*/
void Reset();
/*
* Returns the message digest
*/
bool Result(unsigned *message_digest_array);
/*
* Provide input to SHA1
*/
void Input( const unsigned char *message_array,
unsigned length);
void Input( const char *message_array,
unsigned length);
void Input(unsigned char message_element);
void Input(char message_element);
SHA1& operator<<(const char *message_array);
SHA1& operator<<(const unsigned char *message_array);
SHA1& operator<<(const char message_element);
SHA1& operator<<(const unsigned char message_element);
private:
/*
* Process the next 512 bits of the message
*/
void ProcessMessageBlock();
/*
* Pads the current message block to 512 bits
*/
void PadMessage();
/*
* Performs a circular left shift operation
*/
inline unsigned CircularShift(int bits, unsigned word);
unsigned H[5]; // Message digest buffers
unsigned Length_Low; // Message length in bits
unsigned Length_High; // Message length in bits
unsigned char Message_Block[64]; // 512-bit message blocks
int Message_Block_Index; // Index into message block array
bool Computed; // Is the digest computed?
bool Corrupted; // Is the message digest corruped?
};
#endif
/*
*
* Copyright (c) 2004
* John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE: c_regex_traits.cpp
* VERSION: see <boost/version.hpp>
* DESCRIPTION: Implements out of line c_regex_traits<char> members
*/
#define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
#include <boost/regex/v4/c_regex_traits.hpp>
#include <boost/regex/v4/primary_transform.hpp>
#include <boost/regex/v4/regex_traits_defaults.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{
using ::strxfrm; using ::isspace;
using ::ispunct; using ::isalpha;
using ::isalnum; using ::iscntrl;
using ::isprint; using ::isupper;
using ::islower; using ::isdigit;
using ::isxdigit; using ::strtol;
}
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost{
c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform(const char* p1, const char* p2)
{
std::string result(10, ' ');
std::size_t s = result.size();
std::size_t r;
std::string src(p1, p2);
while(s < (r = std::strxfrm(&*result.begin(), src.c_str(), s)))
{
result.append(r - s + 3, ' ');
s = result.size();
}
result.erase(r);
return result;
}
c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform_primary(const char* p1, const char* p2)
{
static char s_delim;
static const int s_collate_type = ::boost::re_detail::find_sort_syntax(static_cast<c_regex_traits<char>*>(0), &s_delim);
std::string result;
//
// What we do here depends upon the format of the sort key returned by
// sort key returned by this->transform:
//
switch(s_collate_type)
{
case ::boost::re_detail::sort_C:
case ::boost::re_detail::sort_unknown:
// the best we can do is translate to lower case, then get a regular sort key:
{
result.assign(p1, p2);
for(std::string::size_type i = 0; i < result.size(); ++i)
result[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(result[i])));
result = transform(&*result.begin(), &*result.begin() + result.size());
break;
}
case ::boost::re_detail::sort_fixed:
{
// get a regular sort key, and then truncate it:
result = transform(p1, p2);
result.erase(s_delim);
break;
}
case ::boost::re_detail::sort_delim:
// get a regular sort key, and then truncate everything after the delim:
result = transform(p1, p2);
if(result.size() && (result[0] == s_delim))
break;
std::size_t i;
for(i = 0; i < result.size(); ++i)
{
if(result[i] == s_delim)
break;
}
result.erase(i);
break;
}
if(result.empty())
result = std::string(1, char(0));
return result;
}
enum
{
char_class_space=1<<0,
char_class_print=1<<1,
char_class_cntrl=1<<2,
char_class_upper=1<<3,
char_class_lower=1<<4,
char_class_alpha=1<<5,
char_class_digit=1<<6,
char_class_punct=1<<7,
char_class_xdigit=1<<8,
char_class_alnum=char_class_alpha|char_class_digit,
char_class_graph=char_class_alnum|char_class_punct,
char_class_blank=1<<9,
char_class_word=1<<10,
char_class_unicode=1<<11
};
c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2)
{
static const char_class_type masks[] =
{
0,
char_class_alnum,
char_class_alpha,
char_class_blank,
char_class_cntrl,
char_class_digit,
char_class_digit,
char_class_graph,
char_class_lower,
char_class_lower,
char_class_print,
char_class_punct,
char_class_space,
char_class_space,
char_class_upper,
char_class_unicode,
char_class_upper,
char_class_alnum | char_class_word,
char_class_alnum | char_class_word,
char_class_xdigit,
};
int id = ::boost::re_detail::get_default_class_id(p1, p2);
if(id < 0)
{
std::string s(p1, p2);
for(std::string::size_type i = 0; i < s.size(); ++i)
s[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(s[i])));
id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
}
BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0]));
return masks[id+1];
}
bool BOOST_REGEX_CALL c_regex_traits<char>::isctype(char c, char_class_type mask)
{
return
((mask & char_class_space) && (std::isspace)(static_cast<unsigned char>(c)))
|| ((mask & char_class_print) && (std::isprint)(static_cast<unsigned char>(c)))
|| ((mask & char_class_cntrl) && (std::iscntrl)(static_cast<unsigned char>(c)))
|| ((mask & char_class_upper) && (std::isupper)(static_cast<unsigned char>(c)))
|| ((mask & char_class_lower) && (std::islower)(static_cast<unsigned char>(c)))
|| ((mask & char_class_alpha) && (std::isalpha)(static_cast<unsigned char>(c)))
|| ((mask & char_class_digit) && (std::isdigit)(static_cast<unsigned char>(c)))
|| ((mask & char_class_punct) && (std::ispunct)(static_cast<unsigned char>(c)))
|| ((mask & char_class_xdigit) && (std::isxdigit)(static_cast<unsigned char>(c)))
|| ((mask & char_class_blank) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::re_detail::is_separator(c))
|| ((mask & char_class_word) && (c == '_'));
}
c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_collatename(const char* p1, const char* p2)
{
std::string s(p1, p2);
s = ::boost::re_detail::lookup_default_collate_name(s);
if(s.empty() && (p2-p1 == 1))
s.append(1, *p1);
return s;
}
int BOOST_REGEX_CALL c_regex_traits<char>::value(char c, int radix)
{
char b[2] = { c, '\0', };
char* ep;
int result = std::strtol(b, &ep, radix);
if(ep == b)
return -1;
return result;
}
}
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif
/*
*
* Copyright (c) 2004
* John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE cpp_regex_traits.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Implements cpp_regex_traits<char> (and associated helper classes).
*/
#define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#ifndef BOOST_NO_STD_LOCALE
#include <boost/regex/regex_traits.hpp>
#include <boost/regex/pattern_except.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{
using ::memset;
}
#endif
namespace boost{ namespace re_detail{
void cpp_regex_traits_char_layer<char>::init()
{
// we need to start by initialising our syntax map so we know which
// character is used for which purpose:
std::memset(m_char_map, 0, sizeof(m_char_map));
#ifndef BOOST_NO_STD_MESSAGES
#ifndef __IBMCPP__
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
#else
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
#endif
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
if(cat_name.size())
{
cat = this->m_pmessages->open(
cat_name,
this->m_locale);
if((int)cat < 0)
{
std::string m("Unable to open message catalog: ");
std::runtime_error err(m + cat_name);
boost::re_detail::raise_runtime_error(err);
}
}
//
// if we have a valid catalog then load our messages:
//
if((int)cat >= 0)
{
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
{
string_type mss = this->m_pmessages->get(cat, 0, i, get_default_syntax(i));
for(string_type::size_type j = 0; j < mss.size(); ++j)
{
m_char_map[static_cast<unsigned char>(mss[j])] = i;
}
}
this->m_pmessages->close(cat);
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
this->m_pmessages->close(cat);
throw;
}
#endif
}
else
{
#endif
for(regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
{
const char* ptr = get_default_syntax(j);
while(ptr && *ptr)
{
m_char_map[static_cast<unsigned char>(*ptr)] = j;
++ptr;
}
}
#ifndef BOOST_NO_STD_MESSAGES
}
#endif
//
// finish off by calculating our escape types:
//
unsigned char i = 'A';
do
{
if(m_char_map[i] == 0)
{
if(this->m_pctype->is(std::ctype_base::lower, i))
m_char_map[i] = regex_constants::escape_type_class;
else if(this->m_pctype->is(std::ctype_base::upper, i))
m_char_map[i] = regex_constants::escape_type_not_class;
}
}while(0xFF != i++);
}
} // re_detail
} // boost
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment