/* POLE - Portable library to access OLE Storage
Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the authors nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <list>
#include <string>
#include "pole.h"
void visit( int indent, POLE::Storage* storage, std::string path )
{
std::list<std::string> entries;
entries = storage->entries( path );
std::list<std::string>::iterator it;
for( it = entries.begin(); it != entries.end(); ++it )
{
std::string name = *it;
std::string fullname = path + name;
for( int j = 0; j < indent; j++ ) std::cout << " ";
POLE::Stream* ss = new POLE::Stream( storage, fullname );
std::cout << name;
if( ss ) if( !ss->fail() )std::cout << " (" << ss->size() << ")";
std::cout << std::endl;
delete ss;
if( storage->isDirectory( fullname ) )
visit( indent+1, storage, fullname + "/" );
}
}
void dump( POLE::Storage* storage, char* stream_name )
{
POLE::Stream* stream = new POLE::Stream( storage, stream_name );
if( !stream ) return;
if( stream->fail() ) return;
// std::cout << "Size: " << stream->size() << " bytes" << std::endl;
unsigned char buffer[16];
for( ;; )
{
unsigned read = stream->read( buffer, sizeof( buffer ) );
for( unsigned i = 0; i < read; i++ )
printf( "%02x ", buffer[i] );
std::cout << " ";
for( unsigned i = 0; i < read; i++ )
printf( "%c", ((buffer[i]>=32)&&(buffer[i]<128)) ? buffer[i] : '.' );
std::cout << std::endl;
if( read < sizeof( buffer ) ) break;
}
delete stream;
}
void extract( POLE::Storage* storage, char* stream_name, char* outfile )
{
POLE::Stream* stream = new POLE::Stream( storage, stream_name );
if( !stream ) return;
if( stream->fail() ) return;
std::ofstream file;
file.open( outfile, std::ios::binary|std::ios::out );
unsigned char buffer[16];
for( ;; )
{
unsigned read = stream->read( buffer, sizeof( buffer ) );
file.write( (const char*)buffer, read );
if( read < sizeof( buffer ) ) break;
}
file.close();
delete stream;
}
int main(int argc, char *argv[])
{
if( argc < 2 )
{
std::cout << "Usage:" << std::endl;
std::cout << argv[0] << " filename [stream-name [output-file]]" << std::endl;
return 0;
}
char* filename = argv[1];
char* streamname = (argc<3) ? 0 : argv[2];
char* outfile = (argc<4) ? 0 : argv[3];
POLE::Storage* storage = new POLE::Storage( filename );
storage->open();
if( storage->result() != POLE::Storage::Ok )
{
std::cout << "Error on file " << filename << std::endl;
return 1;
}
if( !streamname )
visit( 0, storage, "/" );
else if( !outfile )
dump( storage, streamname );
else
extract( storage, streamname, outfile );
delete storage;
return 0;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Navicat for SQLite mac 安装工具 (1992个子文件)
CodeResources 534KB
CodeResources 59KB
CodeResources 15KB
CodeResources 3KB
style.css 1KB
style.css 1KB
style.css 1017B
dtree.css 521B
dtree.css 521B
Current 1B
Current 1B
Thumbs.db 679KB
Thumbs.db 626KB
Thumbs.db 15KB
libxl.dylib 44.07MB
libscintilla.dylib 11.8MB
libogdf.dylib 9.07MB
libdbdiagram.dylib 4.27MB
libcrypto.1.0.0.dylib 3.11MB
libxml2.2.dylib 2.77MB
libglib-2.0.0.dylib 2.18MB
libprotobuf.7.dylib 2.08MB
libiconv.2.dylib 2.02MB
libcairo.2.dylib 1.88MB
WXEncryptionSQLite.dylib 1.42MB
libmimetic.0.dylib 1.16MB
libpixman-1.0.dylib 1.06MB
libsshmgr.dylib 891KB
libssl.1.0.0.dylib 744KB
libiodbc.2.dylib 601KB
libjpeg.8.dylib 544KB
libnavicatsync.dylib 543KB
libpng15.15.dylib 400KB
libboost_thread.dylib 331KB
libcairo-script-interpreter.2.dylib 294KB
libmdb.dylib 184KB
libintl.8.dylib 125KB
libcole.dylib 94KB
libboost_system.dylib 81KB
libcustomcontrol.dylib 55KB
libcharset.1.dylib 42KB
ScheduleHelperPremium.entitlements 559B
Inherited.entitlements 288B
finish_installation 201KB
mac_logo.gif 1KB
mac_logo.gif 1KB
nolines_plus.gif 870B
nolines_plus.gif 870B
nolines_minus.gif 861B
nolines_minus.gif 861B
folderopen.gif 564B
folderopen.gif 564B
page.gif 550B
page.gif 550B
folder.gif 336B
folder.gif 336B
btn_next_off.gif 294B
btn_next_off.gif 294B
btn_previous_off.gif 284B
btn_previous_off.gif 284B
btn_home_off.gif 197B
btn_home_off.gif 197B
plus.gif 89B
plus.gif 89B
plusbottom.gif 88B
plusbottom.gif 88B
minus.gif 86B
minus.gif 86B
minusbottom.gif 85B
minusbottom.gif 85B
join.gif 69B
join.gif 69B
empty.gif 67B
empty.gif 67B
line.gif 66B
joinbottom.gif 66B
line.gif 66B
joinbottom.gif 66B
mailimap_types.h 99KB
maildriver_types.h 26KB
mailimf_types.h 21KB
mailimap_types_helper.h 18KB
mailimap.h 17KB
maildriver.h 17KB
mailmime_types.h 12KB
mailimf_types_helper.h 12KB
mailimf.h 12KB
mailmessage.h 11KB
annotatemore_types.h 9KB
mailstorage_types.h 6KB
mailmime_types_helper.h 6KB
chash.h 5KB
newsnntp.h 5KB
mailimf_write_file.h 5KB
pop3driver_types.h 5KB
acl_types.h 5KB
mailengine.h 5KB
acl.h 5KB
clist.h 5KB
imapdriver_types.h 5KB
共 1992 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
糊糊_ci
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功