如何用汇编将多个文件压缩成一个文件

von 2005-05-23 04:44:44
我想用汇编把多个文件压缩成一个文件,我知道FCICreate等api可以实现这个功能,不过这些api
的参数多为call back 函数,其中有些函数比如FNFCIGETOPENINFO(get_open_info):
#define FNFCIGETOPENINFO(fn) int DIAMONDAPI fn(char *pszName, \
USHORT *pdate, \
USHORT *ptime, \
USHORT *pattribs, \
int FAR *err, \
void FAR *pv)

FNFCIGETOPENINFO(get_open_info)
{
BY_HANDLE_FILE_INFORMATION finfo;
FILETIME filetime;
HANDLE handle;
DWORD attrs;
int hf;

/*
* Need a Win32 type handle to get file date/time
* using the Win32 APIs, even though the handle we
* will be returning is of the type compatible with
* _open
*/
handle = CreateFile(
pszName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
NULL
);

if (handle == INVALID_HANDLE_VALUE)
{
return -1;
}

if (GetFileInformationByHandle(handle, &finfo) == FALSE)
{
CloseHandle(handle);
return -1;
}

FileTimeToLocalFileTime(
&finfo.ftLastWriteTime,
&filetime
);

FileTimeToDosDateTime(
&filetime,
pdate,
ptime
);

attrs = GetFileAttributes(pszName);

if (attrs == 0xFFFFFFFF)
{
/* failure */
*pattribs = 0;
}
else
{
/*
* Mask out all other bits except these four, since other
* bits are used by the cabinet format to indicate a
* special meaning.
*/
*pattribs = (int) (attrs & (_A_RDONLY | _A_SYSTEM | _A_HIDDEN | _A_ARCH));
}

CloseHandle(handle);


/*
* Return handle using _open
*/
hf = _open( pszName, _O_RDONLY | _O_BINARY );

if (hf == -1)
return -1; // abort on error

return hf;
}(代码来自http://download.microsoft.com/download/platformsdk/cab/2.0/w98nt42kmexp/en-us/Cabsdk.exe),意思就是用createfile得到handle 不能做返回值,还得用_open得到的handle
而且这两个handle 是不兼容的(值也是不一样的)
请问各位前辈,在汇编下如何使用fci?或则还有什么其他的方法实现将多个文件压缩成一个文件这个功能
...全文
170 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧