快讯

在BMP文件中隐藏信息

2004-02-14 09:34  出处:PConline  作者:网上收集  责任编辑:zwg 

/**********************ARCHIVE MANAGER*******************************/ int formatDataspace(BITMAP* BMPworking, HEAP* filespace) { LOOKUP* hotspots; unsigned long int bit1,bit2,bit3,bit4; unsigned long int maxencode,longtemp,i; putToHeap('B',filespace); putToHeap('S',filespace); putToHeap('\0',filespace); /* archive total length inc all hdr:- changed later LONG */ putToHeap('\0',filespace); putToHeap('\0',filespace); putToHeap('\0',filespace); putToHeap(THIS_PROTO_VER,filespace); putToHeap('O',filespace); putToHeap('K',filespace); putToHeap('\0',filespace); /* length of this file block inc filename hdr */ putToHeap('\0',filespace); putToHeap('\0',filespace); putToHeap('\0',filespace); hotspots=(LOOKUP*)calloc(1,sizeof(LOOKUP)); if (hotspots==NULL) { printf("ERROR\n\nOut of memory\n"); exit(4); } hotspots- >dataspace=(unsigned long int*)calloc(LOOKUP_INITLEN,sizeof(unsigned long int)); if (hotspots==NULL) { printf("ERROR\n\nOut of memory\n"); exit (4); } hotspots- >currentlen=LOOKUP_INITLEN; maxencode=resolveMaxEncode(BMPworking, hotspots); if (maxencode< 13) return FALSE; longtemp=maxencode; bit4=(unsigned int)longtemp/16777216; longtemp=longtemp-(unsigned long)((unsigned long)bit4*16777216); bit3=(unsigned int)longtemp/65536; longtemp=longtemp-(unsigned long)((unsigned long)bit3*65536); bit2=(unsigned int)longtemp/256; longtemp=longtemp-(unsigned long)((unsigned long)bit2*256); bit1=(unsigned int)longtemp; *(filespace- >dataspace+2)=bit1; *(filespace- >dataspace+3)=bit2; *(filespace- >dataspace+4)=bit3; *(filespace- >dataspace+5)=bit4; for (i=filespace- >heaplen; i< maxencode; i++) putToHeap('\0',filespace); /* encode blank data into bitmap */ encodeData(BMPworking,filespace,hotspots); return TRUE; } void dumpFileDirectory(HEAP* filespace) { unsigned long int offset,filelen; unsigned long int filectr,bytectr; int filenamelen; offset=9; filectr=0; bytectr=0; printf("\nFilename Size (bytes)\n-------- ------------\n"); for (;;) { filelen=0; filelen+=((unsigned long int)(*(filespace- >dataspace+(offset++)))*1); filelen+=((unsigned long int)(*(filespace- >dataspace+(offset++)))*256); filelen+=((unsigned long int)(*(filespace- >dataspace+(offset++)))*65536); filelen+=((unsigned long int)(*(filespace- >dataspace+(offset++)))*16777216); if (filelen==0) break; filenamelen=strlen(filespace- >dataspace+offset)+1; printf("%-18s%lu\n",filespace- >dataspace+offset,filelen-filenamelen); offset=offset+filelen; filectr++; bytectr+=filelen-filenamelen; } if (filectr==0) printf("No files found in archive!\n"); else printf("\nTotal %lu byte(s), in %lu file(s)\n",bytectr,filectr); }
键盘也能翻页,试试“← →”键
IT热词搜索 来源:360新闻
软件论坛帖子排行
相关文章

相关软件:

腾讯QQ2012
大小:52.93 MB 授权:免费
腾讯QQ2012
立即下载
腾讯QQ2013
大小:49.32 MB 授权:免费
腾讯QQ2013
立即下载