使用zlib对swf压缩文件进行解压缩
来源:百度文库 编辑:神马文学网 时间:2024/05/01 03:54:52
在flash6.0以后的版本中,输出文件时,都提供了压缩这一选项,如果要在程序中获得flash的内容,必须对flash进行解压缩。它使用的压缩方法是zlib开放源码的压缩方法。从第9个字节开始到文件末尾全部进行了压缩,对其解压缩也是非常简单,可以使用zlib1.dll中提供的uncompress对其进行解压缩。
具体使用方法,参见zlib的官方网站:http://www.zlib.net
里面惟一需要注意的是:压缩和解压缩的缓冲区的大小,应该是实际内容大小的 1.01倍+12 个字节。否则就可能出现错误。
基本代码如下:
CFile tmpfile;
tmpfile.Open(filepath,CFile::modeRead);
DWORD complen=tmpfile.GetLength();
BYTE* header=(BYTE*)::GlobalAlloc(GPTR,8);
BYTE* buf=(BYTE*)::GlobalAlloc(GPTR,(complen-8)*1.01+12);
BYTE* bufd=(BYTE*)::GlobalAlloc(GPTR,(filelen-8)*1.01+12);
tmpfile.Read(header,8);
tmpfile.ReadHuge(buf,complen-8);
tmpfile.Close();
unsigned long destlen;//return the value of the destlen.
uncompress(bufd,&destlen,buf,(complen-8)*1.01+12);
//uncompress the swf file and return the destination file length.
header[0]=‘F‘;//change the header indentifier.
CString temp1,temp2;
temp1=filepath.Left(filepath.GetLength()-4);
temp2.Format("~%s$.swf",temp1);
CFile filedes;
filedes.Open(temp2,CFile::modeCreate|CFile::modeWrite);
filedes.Write(header,8);
filedes.Write(bufd,destlen);
filedes.Close();
::GlobalFree(buf);
::GlobalFree(bufd);
return temp2;
- 作者:ar4ever 2006年10月7日, 星期六 20:14
具体使用方法,参见zlib的官方网站:http://www.zlib.net
里面惟一需要注意的是:压缩和解压缩的缓冲区的大小,应该是实际内容大小的 1.01倍+12 个字节。否则就可能出现错误。
基本代码如下:
CFile tmpfile;
tmpfile.Open(filepath,CFile::modeRead);
DWORD complen=tmpfile.GetLength();
BYTE* header=(BYTE*)::GlobalAlloc(GPTR,8);
BYTE* buf=(BYTE*)::GlobalAlloc(GPTR,(complen-8)*1.01+12);
BYTE* bufd=(BYTE*)::GlobalAlloc(GPTR,(filelen-8)*1.01+12);
tmpfile.Read(header,8);
tmpfile.ReadHuge(buf,complen-8);
tmpfile.Close();
unsigned long destlen;//return the value of the destlen.
uncompress(bufd,&destlen,buf,(complen-8)*1.01+12);
//uncompress the swf file and return the destination file length.
header[0]=‘F‘;//change the header indentifier.
CString temp1,temp2;
temp1=filepath.Left(filepath.GetLength()-4);
temp2.Format("~%s$.swf",temp1);
CFile filedes;
filedes.Open(temp2,CFile::modeCreate|CFile::modeWrite);
filedes.Write(header,8);
filedes.Write(bufd,destlen);
filedes.Close();
::GlobalFree(buf);
::GlobalFree(bufd);
return temp2;
- 作者:ar4ever 2006年10月7日, 星期六 20:14
使用zlib对swf压缩文件进行解压缩
使用zlib对swf压缩文件进行解压缩
使用zlib对swf压缩文件进行解压缩--学习纪事
压缩解压缩的函数库zlib的使用--gqlyxg1981的博客
压缩解压缩的函数库zlib的使用--gqlyxg1981的博客
压缩文件winrar使用技巧
使用Javassist对.class文件进行修改
使用Hashtable对字符串进行碰撞
编译器从业者 (Beta): 使用zlib库压缩数据
使用Google工具轻松对网站进行管理
使用自定义函数对 ASP.NET 服务器控件进行验证
在Linux下压缩文件 tar命令的使用
在Linux下压缩文件 tar命令的使用
SWF转换器 - 硕思闪客精灵使用教程
Compress zlib
PHP的GZIP压缩页面例子,使用zlib扩展实现页面GZIP压缩输出
使用ipmi进行服务器管理
支招装修 如何对装修进行定位和合理使用预算--焦点装修家居网
支招装修 如何对装修进行定位和合理使用预算
使用 Sitemaps 索引文件(对多个 Sitemaps 文件进行分组)
关于使用LoadRunner对Appeon Web应用进行压力测试的初步介绍 - 楷的日志...
关于对曲仁矿务局水改工程资金使用情况进行检查的通知
压缩文件破解
在图中如何加入SWF特效---------经常使用