資源簡介
1.已經(jīng)取得了root權(quán)限的Android手機一部(比如我自己來說,就是Note 2國行單卡版N7100和HTCNew One電信雙卡版802D)。
2.已經(jīng)安裝了busybox(注意:必須安裝在/system/bin目錄下,而不是/system/xbin,可以使用“Busybox Pro”進(jìn)行安裝)。
代碼片段和文件信息
/*
?*?xz_pipe_comp.c
?*?A?simple?example?of?pipe-only?xz?compressor?implementation.
?*?version:?2010-07-12?-?by?Daniel?Mealha?Cabrita
?*?Not?copyrighted?--?provided?to?the?public?domain.
?*
?*?Compiling:
?*?link?with?liblzma.?GCC?example:
?*?$?gcc?-llzma?xz_pipe_comp.c?-o?xz_pipe_comp
?*
?*?Usage?example:
?*?$?cat?some_file?|?./xz_pipe_comp?>?some_file.xz
?*/
#include?
#include?
#include?
#include?
#include?
/*?COMPRESSION?SETTINGS?*/
/*?analogous?to?xz?CLI?options:?-0?to?-9?*/
#define?COMPRESSION_LEVEL?6
/*?boolean?setting?analogous?to?xz?CLI?option:?-e?*/
#define?COMPRESSION_EXTREME?true
/*?see:?/usr/include/lzma/check.h?LZMA_CHECK_*?*/
#define?INTEGRITY_CHECK?LZMA_CHECK_CRC64
/*?read/write?buffer?sizes?*/
#define?IN_BUF_MAX 4096
#define?OUT_BUF_MAX 4096
/*?error?codes?*/
#define?RET_OK 0
#define?RET_ERROR_INIT 1
#define?RET_ERROR_INPUT 2
#define?RET_ERROR_OUTPUT 3
#define?RET_ERROR_COMPRESSION 4
/*?note:?in_file?and?out_file?must?be?open?already?*/
int?xz_compress?(FILE?*in_file?FILE?*out_file)
{
uint32_t?preset?=?COMPRESSION_LEVEL?|?(COMPRESSION_EXTREME???LZMA_PRESET_EXTREME?:?0);
lzma_check?check?=?INTEGRITY_CHECK;
lzma_stream?strm?=?LZMA_STREAM_INIT;?/*?alloc?and?init?lzma_stream?struct?*/
uint8_t?in_buf?[IN_BUF_MAX];
uint8_t?out_buf?[OUT_BUF_MAX];
size_t?in_len; /*?length?of?useful?data?in?in_buf?*/
size_t?out_len; /*?length?of?useful?data?in?out_buf?*/
bool?in_finished?=?false;
bool?out_finished?=?false;
lzma_action?action;
lzma_ret?ret_xz;
int?ret;
ret?=?RET_OK;
/*?initialize?xz?encoder?*/
ret_xz?=?lzma_easy_encoder?(&strm?preset?check);
if?(ret_xz?!=?LZMA_OK)?{
fprintf?(stderr?“l(fā)zma_easy_encoder?error:?%d\n“?(int)?ret_xz);
return?RET_ERROR_INIT;
}
while?((!?in_finished)?&&?(!?out_finished))?{
/*?read?incoming?data?*/
in_len?=?fread?(in_buf?1?IN_BUF_MAX?in_file);
if?(feof?(in_file))?{
in_finished?=?true;
}
if?(ferror?(in_file))?{
in_finished?=?true;
ret?=?RET_ERROR_INPUT;
}
strm.next_in?=?in_buf;
strm.avail_in?=?in_len;
/*?if?no?more?data?from?in_buf?flushes?the
???internal?xz?buffers?and?closes?the?xz?data
???with?LZMA_FINISH?*/
action?=?in_finished???LZMA_FINISH?:?LZMA_RUN;
/*?loop?until?there‘s?no?pending?compressed?output?*/
do?{
/*?out_buf?is?clean?at?this?point?*/
strm.next_out?=?out_buf;
strm.avail_out?=?OUT_BUF_MAX;
/*?compress?data?*/
ret_xz?=?lzma_code?(&strm?action);
if?((ret_xz?!=?LZMA_OK)?&&?(ret_xz?!=?LZMA_STREAM_END))?{
fprintf?(stderr?“l(fā)zma_code?error:?%d\n“?(int)?ret_xz);
out_finished?=?true;
ret?=?RET_ERROR_COMPRESSION;
}?else?{
/*?write?compressed?data?*/
out_len?=?OUT_BUF_MAX?-?strm.avail_out;
fwrite?(out_buf?1?out_len?out_file);
if?(ferror?(out_file))?{
out_finished?=?true;
ret?=?RET_ERROR_OUTPUT;
}
}
}?while?(strm.avail_out?==?0);
}
lzma_end?(&strm);
return?ret;
}
int?main?()
{
int?ret;
ret?=?xz
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????821600??2014-01-26?11:55??cygwin\adb.exe
?????文件?????102760??2013-11-15?16:46??cygwin\AdbWinApi.dll
?????文件??????67440??2013-11-15?16:46??cygwin\AdbWinUsbApi.dll
?????文件?????151043??2012-07-13?02:34??cygwin\bin\a2p.exe
?????文件??????18958??2012-04-24?19:52??cygwin\bin\addftinfo.exe
?????文件?????165866??2012-04-24?19:52??cygwin\bin\afmtodit
?????文件???????1786??2011-11-15?06:31??cygwin\bin\apropos
?????文件??????18446??2012-02-06?19:29??cygwin\bin\arch.exe
?????文件??????90126??2011-12-04?03:56??cygwin\bin\ash.exe
????....S..????????19??2003-01-01?07:40??cygwin\bin\awk
?????文件???????9742??2012-04-14?07:20??cygwin\bin\banner.exe
?????文件??????26126??2012-02-06?19:29??cygwin\bin\ba
?????文件??????17422??2012-02-06?19:29??cygwin\bin\ba
?????文件?????536078??2011-02-26?04:31??cygwin\bin\bash.exe
?????文件???????6942??2011-02-26?04:30??cygwin\bin\bashbug
?????文件??????27662??2011-05-22?00:47??cygwin\bin\bunzip2.exe
?????文件??????27662??2011-05-22?00:47??cygwin\bin\bzcat.exe
????....S..????????17??2003-01-01?07:40??cygwin\bin\bzcmp
?????文件???????2128??2011-05-22?00:46??cygwin\bin\bzdiff
????....S..????????17??2003-01-01?07:40??cygwin\bin\bzegrep
????....S..????????17??2003-01-01?07:40??cygwin\bin\bzfgrep
?????文件???????3642??2011-05-22?00:46??cygwin\bin\bzgrep
?????文件??????27662??2011-05-22?00:47??cygwin\bin\bzip2.exe
?????文件???????9230??2011-05-22?00:47??cygwin\bin\bzip2recover.exe
????....S..????????17??2003-01-01?07:40??cygwin\bin\bzless
?????文件???????1297??2011-05-22?00:46??cygwin\bin\bzmore
?????文件??????36607??2012-07-13?02:22??cygwin\bin\c2ph
?????文件??????20509??2012-11-05?07:47??cygwin\bin\cal.exe
?????文件??????36878??2012-02-06?19:29??cygwin\bin\cat.exe
?????文件??????40974??2012-02-06?19:29??cygwin\bin\chcon.exe
............此處省略10052個文件信息
評論
共有 條評論