├── __init__.py ├── arm └── __init__.py ├── intel ├── __init__.py └── intelmodules.py ├── winapi └── __init__.py ├── onionduke ├── __init__.py └── OD_stub.exe ├── preprocessor ├── __init__.py ├── template.py ├── debug.py └── nsis_3_0.py ├── .gitignore ├── aPLib ├── contrib │ ├── ada │ │ ├── ACU_Dos │ │ │ ├── aplib.ali │ │ │ └── apacdemo.ali │ │ ├── ACU_Win │ │ │ ├── aplib.ali │ │ │ └── apacdemo.ali │ │ ├── gnat.ago │ │ ├── mk_gnwin.bat │ │ ├── mk_gndos.bat │ │ ├── mk_aonix.bat │ │ ├── aplib.ads │ │ └── aplib.adb │ ├── masm32 │ │ ├── ap.ico │ │ ├── appack.asm │ │ ├── file0750.bmp │ │ ├── rsrc.rc │ │ ├── aplib.inc │ │ ├── makeit.bat │ │ ├── filedlgs.asm │ │ ├── ctrls.asm │ │ ├── tbmacros.asm │ │ ├── appack.inc │ │ └── toolbar.asm │ ├── bcb │ │ ├── aptest.res │ │ ├── MainFormUnit.ddp │ │ ├── README_ABOUT_APLIB_DLL.txt │ │ ├── aptest.cpp │ │ ├── apacksamplec.h │ │ ├── MainFormUnit.h │ │ ├── MainFormUnit.dfm │ │ └── aptest.bpr │ ├── 16bit │ │ ├── deppack.nas │ │ └── makeit.bat │ ├── delphi │ │ ├── aptest.res │ │ ├── t_main.dfm │ │ ├── aptest.dpr │ │ ├── makefile │ │ ├── aptest.dof │ │ ├── aplib.pas │ │ ├── t_main.pas │ │ ├── aplibud.pas │ │ └── aplibu.pas │ ├── PowerBASIC │ │ ├── aplib.bas │ │ └── aplib.inc │ ├── tmt │ │ ├── makeit.bat │ │ ├── appack.pas │ │ └── apunpack.pas │ ├── dotnet │ │ ├── mk.bat │ │ ├── IbsenSoftware │ │ │ └── aPLib │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ └── DllInterface.cs │ │ └── appack.cs │ ├── PowerBuilder │ │ ├── str_filetime.srs │ │ ├── str_security_attibutes.srs │ │ ├── str_overlapped.srs │ │ ├── str_ofstruct.srs │ │ ├── str_netresource.srs │ │ └── example.txt │ ├── vpascal │ │ ├── descript.ion │ │ ├── vpc.cfg │ │ ├── aplib.def │ │ ├── test_exe.cmd │ │ ├── appack.pas │ │ ├── apunpack.pas │ │ └── make_exe.cmd │ └── AppleII │ │ ├── readme.txt │ │ └── apsrcdst.s ├── doc │ ├── aPLib.chm │ └── html │ │ ├── objects.inv │ │ ├── _static │ │ ├── up.png │ │ ├── down.png │ │ ├── file.png │ │ ├── minus.png │ │ ├── plus.png │ │ ├── comment.png │ │ ├── up-pressed.png │ │ ├── ajax-loader.gif │ │ ├── comment-close.png │ │ ├── down-pressed.png │ │ ├── comment-bright.png │ │ ├── grey.css │ │ └── pygments.css │ │ ├── .buildinfo │ │ ├── _sources │ │ ├── index.txt │ │ ├── acknowledgements.txt │ │ ├── license.txt │ │ └── compression.txt │ │ └── search.html ├── lib │ ├── elf │ │ ├── aplib.a │ │ └── aplib.h │ ├── coff │ │ ├── aplib.lib │ │ └── aplib.h │ ├── dll │ │ ├── aplib.dll │ │ ├── aplib.lib │ │ └── aplib.h │ ├── dll64 │ │ ├── aplib.dll │ │ ├── aplib.lib │ │ └── aplib.h │ ├── elf64 │ │ ├── aplib.a │ │ └── aplib.h │ ├── macho │ │ ├── aplib.a │ │ └── aplib.h │ ├── macho64 │ │ ├── aplib.a │ │ └── aplib.h │ ├── omf │ │ ├── aplib.lib │ │ ├── aplib.obj │ │ ├── crc32.obj │ │ ├── depack.obj │ │ ├── depackf.obj │ │ ├── depacks.obj │ │ ├── scheck.obj │ │ ├── sdepack.obj │ │ ├── spack.obj │ │ ├── sgetsize.obj │ │ └── aplib.h │ └── coff64 │ │ ├── aplib.lib │ │ └── aplib.h ├── example │ ├── make_pc.bat │ ├── make_vc.bat │ ├── make_bcc.bat │ ├── make_wat.bat │ ├── make_dll.bat │ ├── makefile.mgw │ ├── makefile.cyg │ ├── makefile.elf │ └── makefile.macho ├── src │ ├── depack.h │ ├── depacks.h │ ├── 64bit │ │ ├── sgetsize.asm │ │ ├── scheck.asm │ │ ├── depack.asm │ │ ├── spack.asm │ │ ├── sdepack.asm │ │ └── depackf.asm │ ├── 32bit │ │ ├── sgetsize.asm │ │ ├── scheck.asm │ │ ├── depack.asm │ │ ├── sdepack.asm │ │ ├── spack.asm │ │ └── depackf.asm │ └── depack.c └── readme.txt ├── certs └── .gitignore ├── osslsigncode ├── misc │ ├── softhsm-example-token │ │ ├── .gitignore │ │ ├── README │ │ └── gen-token.sh │ ├── valgrind.supp │ └── pagehash.py ├── TODO ├── .gitignore ├── Makefile.am ├── LICENSE ├── tests │ └── testsign.sh ├── README.unauthblob ├── ChangeLog └── configure.ac ├── asm └── src │ └── loadliba_single_shell_reverse_tcp.asm ├── update.sh ├── LICENSE.txt ├── COPYING └── install.sh /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /intel/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /winapi/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /onionduke/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /preprocessor/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.exe 3 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/ACU_Dos/aplib.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/ACU_Win/aplib.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/ACU_Dos/apacdemo.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/ACU_Win/apacdemo.ali: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /certs/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /aPLib/doc/aPLib.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/aPLib.chm -------------------------------------------------------------------------------- /aPLib/lib/elf/aplib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/elf/aplib.a -------------------------------------------------------------------------------- /onionduke/OD_stub.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/onionduke/OD_stub.exe -------------------------------------------------------------------------------- /aPLib/lib/coff/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/coff/aplib.lib -------------------------------------------------------------------------------- /aPLib/lib/dll/aplib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/dll/aplib.dll -------------------------------------------------------------------------------- /aPLib/lib/dll/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/dll/aplib.lib -------------------------------------------------------------------------------- /aPLib/lib/dll64/aplib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/dll64/aplib.dll -------------------------------------------------------------------------------- /aPLib/lib/dll64/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/dll64/aplib.lib -------------------------------------------------------------------------------- /aPLib/lib/elf64/aplib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/elf64/aplib.a -------------------------------------------------------------------------------- /aPLib/lib/macho/aplib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/macho/aplib.a -------------------------------------------------------------------------------- /aPLib/lib/macho64/aplib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/macho64/aplib.a -------------------------------------------------------------------------------- /aPLib/lib/omf/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/aplib.lib -------------------------------------------------------------------------------- /aPLib/lib/omf/aplib.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/aplib.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/crc32.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/crc32.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/depack.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/depack.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/depackf.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/depackf.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/depacks.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/depacks.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/scheck.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/scheck.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/sdepack.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/sdepack.obj -------------------------------------------------------------------------------- /aPLib/lib/omf/spack.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/spack.obj -------------------------------------------------------------------------------- /aPLib/contrib/masm32/ap.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/masm32/ap.ico -------------------------------------------------------------------------------- /aPLib/doc/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/objects.inv -------------------------------------------------------------------------------- /aPLib/lib/coff64/aplib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/coff64/aplib.lib -------------------------------------------------------------------------------- /aPLib/lib/omf/sgetsize.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/lib/omf/sgetsize.obj -------------------------------------------------------------------------------- /osslsigncode/misc/softhsm-example-token/.gitignore: -------------------------------------------------------------------------------- 1 | softhsm.conf 2 | test.* 3 | openssl.conf 4 | config.py 5 | softhsm.* 6 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/gnat.ago: -------------------------------------------------------------------------------- 1 | -O2 -gnatp 2 | -i -aOACU_Win -largs ..\..\lib\coff\aplib.lib 3 | 4 | 5 | WINDOWS_TARGET 6 | -------------------------------------------------------------------------------- /aPLib/contrib/bcb/aptest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/bcb/aptest.res -------------------------------------------------------------------------------- /aPLib/doc/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/up.png -------------------------------------------------------------------------------- /aPLib/contrib/16bit/deppack.nas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/16bit/deppack.nas -------------------------------------------------------------------------------- /aPLib/contrib/delphi/aptest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/delphi/aptest.res -------------------------------------------------------------------------------- /aPLib/contrib/delphi/t_main.dfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/delphi/t_main.dfm -------------------------------------------------------------------------------- /aPLib/contrib/masm32/appack.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/masm32/appack.asm -------------------------------------------------------------------------------- /aPLib/doc/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/down.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/file.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/minus.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/plus.png -------------------------------------------------------------------------------- /aPLib/contrib/PowerBASIC/aplib.bas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/PowerBASIC/aplib.bas -------------------------------------------------------------------------------- /aPLib/contrib/PowerBASIC/aplib.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/PowerBASIC/aplib.inc -------------------------------------------------------------------------------- /aPLib/contrib/bcb/MainFormUnit.ddp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/bcb/MainFormUnit.ddp -------------------------------------------------------------------------------- /aPLib/contrib/masm32/file0750.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/contrib/masm32/file0750.bmp -------------------------------------------------------------------------------- /aPLib/doc/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/comment.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/up-pressed.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /aPLib/doc/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/comment-close.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/down-pressed.png -------------------------------------------------------------------------------- /aPLib/doc/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/backdoorfactory/backdoor-factory/HEAD/aPLib/doc/html/_static/comment-bright.png -------------------------------------------------------------------------------- /aPLib/example/make_pc.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Pelles C example --- 3 | ECHO. 4 | 5 | cc /Ot /I..\lib\coff appack.c ..\lib\coff\aplib.lib 6 | -------------------------------------------------------------------------------- /aPLib/example/make_vc.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Visual C/C++ example --- 3 | ECHO. 4 | 5 | cl /nologo /O2 /I..\lib\coff appack.c ..\lib\coff\aplib.lib 6 | -------------------------------------------------------------------------------- /aPLib/example/make_bcc.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Borland C/C++ example --- 3 | ECHO. 4 | 5 | bcc32 -I..\lib\omf appack.c ..\lib\omf\aplib.lib -eappack.exe 6 | -------------------------------------------------------------------------------- /aPLib/contrib/tmt/makeit.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib TMT Pascal example --- 3 | ECHO. 4 | 5 | tmtpc -C aplibu.pas 6 | tmtpc -$LOGO- appack.pas 7 | tmtpc -$LOGO- apunpack.pas 8 | -------------------------------------------------------------------------------- /aPLib/example/make_wat.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Watcom C/C++ example --- 3 | ECHO. 4 | 5 | wcl386 /oneax /oe /oh /5r /zc -zld /i=..\lib\omf appack.c /"library ..\lib\omf\aplib" 6 | -------------------------------------------------------------------------------- /aPLib/contrib/dotnet/mk.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib .NET dll wrapper --- 3 | ECHO. 4 | 5 | csc /nologo /w:3 /t:library /debug- /o+ /out:IbsenSoftware.aPLib.dll IbsenSoftware\aPLib\*.cs 6 | -------------------------------------------------------------------------------- /aPLib/contrib/16bit/makeit.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib 16bit NASM depacker examples --- 3 | ECHO. 4 | 5 | call nasm deppack.nas -o deppack.com 6 | call nasm depptiny.nas -o depptiny.com 7 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/rsrc.rc: -------------------------------------------------------------------------------- 1 | #include "\masm32\include\resource.h" 2 | 3 | 500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "ap.ico" 4 | 5 | 750 BITMAP MOVEABLE PURE LOADONCALL DISCARDABLE "file0750.bmp" 6 | -------------------------------------------------------------------------------- /aPLib/contrib/PowerBuilder/str_filetime.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_filetime.srs 2 | global type str_filetime from structure 3 | unsignedlong dwlowdatetime 4 | unsignedlong dwhighdatetime 5 | end type 6 | 7 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/mk_gnwin.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Ada example for GNAT/Windows --- 3 | ECHO. 4 | 5 | gnatmake -g -i %1 -O2 -gnatp -aOACU_Win apacdemo -largs ..\..\lib\coff\aplib.lib 6 | 7 | if exist b~*.* del b~*.* 8 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/mk_gndos.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Ada example for GNAT/DOS (ez2load) --- 3 | ECHO. 4 | 5 | gnatmake -g -i %1 -O2 -gnatp -aOACU_DOS apacdemo -largs ..\..\lib\coff\aplib.a 6 | 7 | if exist b_*.* del b_*.* 8 | -------------------------------------------------------------------------------- /aPLib/example/make_dll.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Visual C/C++ DLL example --- 3 | ECHO. 4 | 5 | cl /nologo /O2 /I..\lib\dll /DAP_DLL appack.c ..\lib\dll\aplib.lib 6 | 7 | ECHO. 8 | ECHO Remember to copy APLIB.DLL here before running. 9 | -------------------------------------------------------------------------------- /aPLib/contrib/PowerBuilder/str_security_attibutes.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_security_attibutes.srs 2 | global type str_security_attibutes from structure 3 | unsignedlong nlength 4 | long lpsecuritydescriptor 5 | boolean binherithandle 6 | end type 7 | 8 | -------------------------------------------------------------------------------- /aPLib/doc/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: e2bf9e15fc4b949553f854f04617e85b 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /osslsigncode/misc/valgrind.supp: -------------------------------------------------------------------------------- 1 | { 2 | ignore-curl-init-leaks 3 | Memcheck:Leak 4 | fun:malloc 5 | ... 6 | fun:curl_global_init 7 | } 8 | { 9 | ignore-curl-init-leaks2 10 | Memcheck:Leak 11 | fun:calloc 12 | ... 13 | fun:curl_global_init 14 | } 15 | -------------------------------------------------------------------------------- /aPLib/contrib/delphi/aptest.dpr: -------------------------------------------------------------------------------- 1 | program aPTest; 2 | 3 | uses 4 | Forms, 5 | t_main in 't_main.pas' {frmMain}; 6 | 7 | {$R *.RES} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.CreateForm(TfrmMain, frmMain); 12 | Application.Run; 13 | end. 14 | -------------------------------------------------------------------------------- /osslsigncode/TODO: -------------------------------------------------------------------------------- 1 | - signature extraction/removal/verificaton on MSI/CAB files 2 | - improved signature verification on PE files 3 | - clean up / untangle code 4 | - separate timestamping 5 | - man page 6 | - remove mmap usage to increase portability 7 | - tests 8 | - fix other stuff marked 'XXX' 9 | -------------------------------------------------------------------------------- /aPLib/contrib/PowerBuilder/str_overlapped.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_overlapped.srs 2 | global type str_overlapped from structure 3 | unsignedlong Internal 4 | unsignedlong InternalHigh 5 | unsignedlong Offset 6 | unsignedlong OffsetHigh 7 | unsignedlong hEvent 8 | end type 9 | 10 | -------------------------------------------------------------------------------- /aPLib/contrib/PowerBuilder/str_ofstruct.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_ofstruct.srs 2 | global type str_ofstruct from structure 3 | unsignedinteger cbytes 4 | unsignedinteger ffixeddisk 5 | unsignedlong nerrcode 6 | unsignedlong reserved1 7 | unsignedlong reserved2 8 | string szpathname 9 | end type 10 | 11 | -------------------------------------------------------------------------------- /aPLib/contrib/bcb/README_ABOUT_APLIB_DLL.txt: -------------------------------------------------------------------------------- 1 | If you want to use the aplib.dll with your bcb project, link with the aplib.lib file here in the LibForDll directory. 2 | If you don't want to use the dll, then just link with the static aplib.lib in the ..\..\lib\omf directory. 3 | The sample project uses the static lib in ..\..\lib\omf -------------------------------------------------------------------------------- /aPLib/contrib/PowerBuilder/str_netresource.srs: -------------------------------------------------------------------------------- 1 | $PBExportHeader$str_netresource.srs 2 | global type str_netresource from structure 3 | unsignedlong dwscope 4 | unsignedlong dwtype 5 | unsignedlong dwdisplaytype 6 | unsignedlong dwusage 7 | string lplocalname 8 | string lpremotename 9 | string lpcomment 10 | string lpprovider 11 | end type 12 | 13 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/descript.ion: -------------------------------------------------------------------------------- 1 | aplib.def Interface Definition for APLIB.DLL (OS/2) 2 | aplibu.pas Interface Unit to ..\..\lib\omf\aplib.lib 3 | aplibud.pas Dynamic Version of aplibu 4 | appack.pas demo program for the Compressor 5 | apunpack.pas demo program for the Decompressor 6 | make_exe.cmd make demo executables (adapt path) 7 | test_exe.cmd test make_exe result 8 | vpc.cfg VPC.CFG compiler parameter (adapt path) 9 | -------------------------------------------------------------------------------- /aPLib/doc/html/_static/grey.css: -------------------------------------------------------------------------------- 1 | /* slightly less colorful style overrides */ 2 | 3 | @import url("default.css"); 4 | 5 | th { 6 | background-color: #eee; 7 | } 8 | 9 | div.seealso { 10 | background-color: #eee; 11 | border: 1px solid #ccc; 12 | } 13 | 14 | pre { 15 | background-color: #eeeeee; 16 | border: 1px solid #ccc; 17 | } 18 | 19 | tt { 20 | background-color: inherit; 21 | font-size: inherit; 22 | } 23 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/vpc.cfg: -------------------------------------------------------------------------------- 1 | /iY:\VP21\source\rtl 2 | /lY:\VP21\lib.%p;Y:\VP21\units.%p 3 | /oY:\VP21\out.%p\units 4 | /rY:\VP21\res.%p 5 | /uY:\VP21\units.%p;Y:\VP21\source\rtl;Y:\VP21\source\%p 6 | /B 7 | /P0 8 | /$D- 9 | /$Delphi- 10 | /$Optimize+ 11 | /$L- 12 | /$V- 13 | /$LocInfo- 14 | /$G+ 15 | /$G3+ 16 | /$I+ 17 | /$Q- 18 | /$R- 19 | /$S- 20 | /$SmartLink+ 21 | /$Speed- 22 | /$Use32+ 23 | /$V+ 24 | /$W- 25 | /$X+ 26 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/mk_aonix.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO --- Building aPLib Ada example for Aonix ObjectAda for Windows --- 3 | ECHO. 4 | 5 | SET OAPATH=C:\Program Files\Aonix\ObjectAda\bin\ 6 | 7 | if not exist "%OAPATH%adareg.exe" echo Wrong path [%OAPATH%] - change mk_aonix.bat! 8 | 9 | if exist unit.map goto build 10 | 11 | "%OAPATH%adareg" *.ad? 12 | ECHO. 13 | 14 | :build 15 | 16 | "%OAPATH%adabuild" apacdemo -ll ..\..\lib\coff\aplib.lib 17 | ECHO. 18 | 19 | ECHO Warning: this version doesn't work yet! :-( 20 | -------------------------------------------------------------------------------- /osslsigncode/.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | Makefile 3 | Makefile.in 4 | aclocal.m4 5 | autom4te.cache/ 6 | compile 7 | config.h 8 | config.h.in 9 | config.h.in~ 10 | config.log 11 | config.status 12 | configure 13 | depcomp 14 | install-sh 15 | missing 16 | osslsigncode 17 | osslsigncode.o 18 | stamp-h1 19 | 20 | .#*# 21 | .*.bak 22 | .*.orig 23 | .*.rej 24 | .*~ 25 | #*# 26 | *.bak 27 | *.d 28 | *.def 29 | *.dll 30 | *.exe 31 | *.la 32 | *.lib 33 | *.lo 34 | *.orig 35 | *.pdb 36 | *.rej 37 | *.u 38 | *.rc 39 | *.pc 40 | *~ 41 | *.gz 42 | *.bz2 43 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/aplib.def: -------------------------------------------------------------------------------- 1 | LIBRARY 'aplib.dll' 2 | 3 | STUB NONE 4 | 5 | DESCRIPTION '@#Jibz,V.K.:1.01#@ aPLib Compression/Decompression Library' 6 | 7 | EXPORTS 8 | _aP_pack @1 9 | _aP_workmem_size @2 10 | _aP_max_packed_size @3 11 | _aP_depack_asm @4 12 | _aP_depack_asm_fast @5 13 | _aP_depack_asm_safe @6 14 | _aP_crc32 @7 15 | _aPsafe_pack @8 16 | _aPsafe_check @9 17 | _aPsafe_get_orig_size @10 18 | _aPsafe_depack @11 19 | -------------------------------------------------------------------------------- /aPLib/example/makefile.mgw: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## MinGW GCC makefile 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack.exe 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 -s 14 | ldflags = $(cflags) 15 | incdir = ../lib/coff 16 | libs = $(incdir)/aplib.lib 17 | 18 | .PHONY: all clean 19 | 20 | all: $(target) 21 | 22 | $(target): $(objects) 23 | gcc $(ldflags) -o $@ $^ $(libs) 24 | 25 | %.o : %.c 26 | gcc -c -I$(incdir) $(cflags) -o $@ $< 27 | 28 | clean: 29 | $(RM) $(objects) $(target) 30 | -------------------------------------------------------------------------------- /aPLib/example/makefile.cyg: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## Cygwin GCC makefile 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack.exe 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 -s -mno-cygwin 14 | ldflags = $(cflags) 15 | incdir = ../lib/coff 16 | libs = $(incdir)/aplib.lib 17 | 18 | .PHONY: all clean 19 | 20 | all: $(target) 21 | 22 | $(target): $(objects) 23 | gcc $(ldflags) -o $@ $^ $(libs) 24 | 25 | %.o : %.c 26 | gcc -c -I$(incdir) $(cflags) -o $@ $< 27 | 28 | clean: 29 | $(RM) $(objects) $(target) 30 | -------------------------------------------------------------------------------- /aPLib/example/makefile.elf: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## GCC makefile (Linux, FreeBSD, BeOS and QNX) 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 -s 14 | ldflags = $(cflags) 15 | incdir = ../lib/elf 16 | libs = $(incdir)/aplib.a 17 | 18 | .PHONY: all clean 19 | 20 | all: $(target) 21 | 22 | $(target): $(objects) 23 | gcc $(ldflags) -o $@ $^ $(libs) 24 | 25 | %.o : %.c 26 | gcc -c -I$(incdir) $(cflags) -o $@ $< 27 | 28 | clean: 29 | $(RM) $(objects) $(target) 30 | -------------------------------------------------------------------------------- /aPLib/example/makefile.macho: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## GCC makefile (Linux, FreeBSD, BeOS and QNX) 5 | ## 6 | ## Copyright (c) 1998-2014 Joergen Ibsen 7 | ## All Rights Reserved 8 | ## 9 | 10 | target = appack 11 | objects = appack.o 12 | 13 | cflags = -Wall -O2 14 | ldflags = $(cflags) 15 | incdir = ../lib/macho64 16 | libs = $(incdir)/aplib.a 17 | 18 | .PHONY: all clean 19 | 20 | all: $(target) 21 | 22 | $(target): $(objects) 23 | gcc $(ldflags) -o $@ $^ $(libs) 24 | 25 | %.o : %.c 26 | gcc -c -I$(incdir) $(cflags) -o $@ $< 27 | 28 | clean: 29 | $(RM) $(objects) $(target) 30 | -------------------------------------------------------------------------------- /osslsigncode/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 1.10 2 | MAINTAINERCLEANFILES = \ 3 | config.log config.status \ 4 | $(srcdir)/Makefile.in \ 5 | $(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \ 6 | $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \ 7 | $(srcdir)/depcomp $(srcdir)/aclocal.m4 $(srcdir)/ylwrap \ 8 | $(srcdir)/config.guess $(srcdir)/config.sub 9 | EXTRA_DIST = .gitignore 10 | 11 | AM_CFLAGS = $(GSF_CFLAGS) $(OPENSSL_CFLAGS) $(OPTIONAL_LIBCURL_CFLAGS) 12 | 13 | bin_PROGRAMS = osslsigncode 14 | 15 | osslsigncode_SOURCES = osslsigncode.c 16 | osslsigncode_LDADD = $(GSF_LIBS) $(OPENSSL_LIBS) $(OPTIONAL_LIBCURL_LIBS) 17 | -------------------------------------------------------------------------------- /aPLib/src/depack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * C depacker, header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef DEPACK_H_INCLUDED 13 | #define DEPACK_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | /* function prototype */ 24 | unsigned int aP_depack(const void *source, void *destination); 25 | 26 | #ifdef __cplusplus 27 | } /* extern "C" */ 28 | #endif 29 | 30 | #endif /* DEPACK_H_INCLUDED */ 31 | -------------------------------------------------------------------------------- /asm/src/loadliba_single_shell_reverse_tcp.asm: -------------------------------------------------------------------------------- 1 | ;-----------------------------------------------------------------------------; 2 | ; Author: Joshua Pitts @midnite_runr 3 | ; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4 4 | ; Version: 1.0 (28 July 2009) 5 | ; Size: 283 bytes 6 | ; Build: >build.py loadliba_single_shell_reverse_tcp 7 | ; Does not include code from BDF python intel/Winintel32.py for ASLR bypass and 8 | ; LoadLibraryA and GetProcAddress api call assignment. 9 | ;-----------------------------------------------------------------------------; 10 | [BITS 32] 11 | [ORG 0] 12 | 13 | 14 | %include "./src/loadliba_reverse_tcp.asm" 15 | 16 | %include "./src/loadliba_shell.asm" 17 | -------------------------------------------------------------------------------- /aPLib/doc/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | 2 | Welcome to the aPLib documentation! 3 | =================================== 4 | 5 | aPLib is a compression library based on the algorithm used in aPACK (my 16-bit 6 | executable packer). aPLib is an easy-to-use alternative to many of the 7 | heavy-weight compression libraries available. 8 | 9 | The compression ratios achieved by aPLib combined with the speed and tiny 10 | footprint of the decompressors (as low as 169 bytes!) makes it the ideal 11 | choice for many products. 12 | 13 | Contents: 14 | 15 | .. toctree:: 16 | :maxdepth: 2 17 | 18 | license 19 | general 20 | compression 21 | decompression 22 | acknowledgements 23 | changes 24 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/aplib.inc: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; MASM32 include file 5 | ;; 6 | 7 | aP_pack proto c, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD 8 | aP_workmem_size proto c, :DWORD 9 | aP_max_packed_size proto c, :DWORD 10 | aP_depack_asm proto c, :DWORD, :DWORD 11 | aP_depack_asm_fast proto c, :DWORD, :DWORD 12 | aP_depack_asm_safe proto c, :DWORD, :DWORD, :DWORD, :DWORD 13 | aP_crc32 proto c, :DWORD, :DWORD 14 | 15 | aPsafe_pack proto c, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD 16 | aPsafe_check proto c, :DWORD 17 | aPsafe_get_orig_size proto c, :DWORD 18 | aPsafe_depack proto c, :DWORD, :DWORD, :DWORD, :DWORD 19 | -------------------------------------------------------------------------------- /osslsigncode/misc/softhsm-example-token/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a basic setup for testing pkcs11-support. If you get 3 | this to work you have a decent chance of using your real HSM or hardware token. 4 | 5 | You need the following packages (ubuntu/debian names): 6 | 7 | - libengine-pkcs11-openssl 8 | - softhsm 9 | 10 | Type 'make' to generate a softhsm token with a test-key on id a1b2 with PIN-code 11 | "secret1". To use this token with osslsigncode try something like this (from this 12 | directory): 13 | 14 | env SOFTHSM_CONF=`pwd`/softhsm.conf ../../osslsigncode sign \ 15 | -pkcs11engine /usr/lib/engines/engine_pkcs11.so \ 16 | -pkcs11module /usr/lib/softhsm/libsofthsm.so -key a1b2 -certs test.crt ... 17 | 18 | Use 'secret1' as the password at the prompt. 19 | -------------------------------------------------------------------------------- /aPLib/src/depacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * C safe depacker, header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef DEPACKS_H_INCLUDED 13 | #define DEPACKS_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | /* function prototype */ 24 | unsigned int aP_depack_safe(const void *source, 25 | unsigned int srclen, 26 | void *destination, 27 | unsigned int dstlen); 28 | 29 | #ifdef __cplusplus 30 | } /* extern "C" */ 31 | #endif 32 | 33 | #endif /* DEPACKS_H_INCLUDED */ 34 | -------------------------------------------------------------------------------- /aPLib/contrib/delphi/makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## aPLib compression library - the smaller the better :) 3 | ## 4 | ## Delphi example makefile (Borland make) 5 | ## 6 | ## Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | ## All Rights Reserved 8 | ## 9 | 10 | # Add -DDYNAMIC_VERSION to the dccflags variable to link with the 11 | # dll interface (remember to copy the aPLib dll here). 12 | 13 | libdir = ..\..\lib\omf 14 | 15 | target = aptest.exe 16 | objects = t_main.dcu aplib.dcu aplibu.dcu aplibud.dcu aptest.dpr $(libdir)\aplib.obj $(libdir)\depack.obj $(libdir)\depackf.obj 17 | 18 | dcc = dcc32.exe 19 | dccflags = -Q -$A+ -$O+ -$D- 20 | 21 | .phony: clean 22 | 23 | $(target): $(objects) 24 | $(dcc) $(dccflags) aptest.dpr 25 | 26 | .pas.dcu: 27 | $(dcc) $(dccflags) $< 28 | 29 | clean: 30 | del $(target) 31 | del *.dcu 32 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/makeit.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if not exist rsrc.rc goto over1 4 | \MASM32\BIN\Rc.exe /v rsrc.rc 5 | \MASM32\BIN\Cvtres.exe /machine:ix86 rsrc.res 6 | :over1 7 | 8 | if exist %1.obj del aPPack.obj 9 | if exist %1.exe del aPPack.exe 10 | 11 | \MASM32\BIN\Ml.exe /c /coff aPPack.asm 12 | if errorlevel 1 goto errasm 13 | 14 | if not exist rsrc.obj goto nores 15 | 16 | \MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS aPPack.obj rsrc.obj 17 | if errorlevel 1 goto errlink 18 | 19 | dir aPPack.* 20 | goto TheEnd 21 | 22 | :nores 23 | \MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS aPPack.obj 24 | if errorlevel 1 goto errlink 25 | dir aPPack.* 26 | goto TheEnd 27 | 28 | :errlink 29 | echo _ 30 | echo Link error 31 | goto TheEnd 32 | 33 | :errasm 34 | echo _ 35 | echo Assembly Error 36 | goto TheEnd 37 | 38 | :TheEnd 39 | 40 | pause 41 | -------------------------------------------------------------------------------- /aPLib/contrib/dotnet/IbsenSoftware/aPLib/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // aPLib compression library - the smaller the better :) 3 | // 4 | // C# wrapper 5 | // 6 | // Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | // All Rights Reserved 8 | // 9 | // http://www.ibsensoftware.com/ 10 | // 11 | 12 | using System.Reflection; 13 | using System.Runtime.CompilerServices; 14 | 15 | [assembly: AssemblyTitle("aPLib dll wrapper")] 16 | [assembly: AssemblyDescription("C# wrapper for the aPLib dll")] 17 | [assembly: AssemblyConfiguration("")] 18 | [assembly: AssemblyCompany("Ibsen Software")] 19 | [assembly: AssemblyProduct("aPLib compression library")] 20 | [assembly: AssemblyCopyright("Copyright (c) 1998-2009 by Joergen Ibsen. All Rights Reserved.")] 21 | [assembly: AssemblyTrademark("")] 22 | [assembly: AssemblyCulture("")] 23 | 24 | [assembly: AssemblyVersion("1.0.0.0")] 25 | 26 | [assembly: AssemblyDelaySign(false)] 27 | [assembly: AssemblyKeyFile("")] 28 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/test_exe.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | if [%1] == [L1] goto L1 3 | 4 | cls 5 | set testfile=aPPack.exe 6 | call %0 L1 dynamic os2 7 | call %0 L1 dynamic w32 8 | call %0 L1 static d32 9 | call %0 L1 static os2 10 | call %0 L1 static w32 11 | goto END 12 | 13 | :L1 14 | echo ** %2 ** %3 ** 15 | cd %2\%3 16 | if exist out.apk del out.apk 17 | if exist test.ap del test.ap 18 | if exist test.unp del test.unp 19 | if [%3] == [d32] Dos4GW.exe aPPack.exe %testfile% test.ap 20 | if [%3] == [os2] aPPack.exe %testfile% test.ap 21 | if [%3] == [w32] call pec aPPack.exe %testfile% test.ap 22 | if not exist test.ap pause 23 | if [%3] == [d32] Dos4GW.exe aPUnpack.exe test.ap test.unp 24 | if [%3] == [os2] aPUnpack.exe test.ap test.unp 25 | if [%3] == [w32] call pec aPUnpack.exe test.ap test.unp 26 | if not exist test.unp pause 27 | if exist test.ap del test.ap 28 | if exist test.unp del test.unp 29 | cd ..\.. 30 | 31 | :END 32 | -------------------------------------------------------------------------------- /aPLib/contrib/bcb/aptest.cpp: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | 3 | #include 4 | #pragma hdrstop 5 | //--------------------------------------------------------------------------- 6 | USEFORM("MainFormUnit.cpp", MainForm); 7 | //--------------------------------------------------------------------------- 8 | WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) 9 | { 10 | try 11 | { 12 | Application->Initialize(); 13 | Application->CreateForm(__classid(TMainForm), &MainForm); 14 | Application->Run(); 15 | } 16 | catch (Exception &exception) 17 | { 18 | Application->ShowException(&exception); 19 | } 20 | catch (...) 21 | { 22 | try 23 | { 24 | throw Exception(""); 25 | } 26 | catch (Exception &exception) 27 | { 28 | Application->ShowException(&exception); 29 | } 30 | } 31 | return 0; 32 | } 33 | //--------------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /aPLib/contrib/PowerBuilder/example.txt: -------------------------------------------------------------------------------- 1 | Compress File: 2 | 3 | Integer li_rtn 4 | String ls_source 5 | String ls_dest 6 | 7 | uo_external_function_compression compression_func 8 | 9 | compression_func = Create uo_external_function_compression 10 | 11 | ls_source = as_source + as_file 12 | ls_dest = as_dest + compression_func.uof_compressed_name(as_file) 13 | 14 | li_rtn = compression_func.uof_compress(ls_source, ls_dest, as_message) 15 | 16 | Destroy compression_func 17 | 18 | Return li_rtn 19 | 20 | 21 | 22 | 23 | Decompress File: 24 | Integer li_rtn 25 | String ls_source 26 | String ls_dest 27 | 28 | uo_external_function_compression compression_func 29 | 30 | compression_func = Create uo_external_function_compression 31 | 32 | ls_source = as_source + compression_func.uof_compressed_name(as_file) 33 | ls_dest = as_dest + as_file 34 | 35 | li_rtn = compression_func.uof_decompress(ls_source, ls_dest, as_message) 36 | 37 | Destroy compression_func 38 | 39 | Return li_rtn -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ $EUID -ne 0 ]]; then 4 | echo "You must root" 2>&1 5 | exit 1 6 | fi 7 | 8 | #update capstone 9 | 10 | cd capstone 11 | 12 | 13 | if [[ `git pull` != "Already up-to-date." ]]; then 14 | 15 | git checkout b53a59af53ffbd5dbe8dbcefba41a00cf4fc7469 16 | 17 | ./make.sh 18 | 19 | ./make.sh install 20 | 21 | uname -a | grep BSD &> /dev/null 22 | if [ $? -eq 0 ]; then 23 | echo 'Installing Capstone python bindings for *bsd' 24 | rm -rf ./build 25 | python setup.py build -b ./build install 26 | else 27 | make install 28 | fi 29 | 30 | #check if kali 31 | uname -a | grep -i kali &> /dev/null 32 | if [ $? -eq 0 ]; then 33 | echo "Adding capstone path for Kali64 in /etc/ls.so.conf.d/capstone.conf" 34 | echo "#capstone shared libs" >> /etc/ld.so.conf.d/capstone.conf 35 | echo "/usr/lib64" >> /etc/ld.so.conf.d/capstone.conf 36 | ldconfig 37 | fi 38 | else 39 | echo "Capstone is up-to-date." 40 | fi 41 | 42 | # update pefile 43 | 44 | pip install --upgrade pefile 45 | -------------------------------------------------------------------------------- /aPLib/src/64bit/sgetsize.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit safe assembler header access 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aPsafe_get_orig_size 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aPsafe_get_orig_size: 21 | ; aPsafe_get_orig_size(const void *source) 22 | 23 | mov edx, [rcx] ; edx = header.tag 24 | 25 | or rax, -1 ; rax = -1 26 | 27 | cmp edx, 032335041h ; check tag == 'AP32' 28 | jne .return_rax 29 | 30 | mov edx, [rcx + 4] ; edx = header.header_size 31 | cmp edx, 24 ; check header_size >= 24 32 | jb .return_rax 33 | 34 | mov eax, [rcx + 16] ; rax = header.orig_size 35 | 36 | .return_rax: 37 | ret 38 | 39 | ; ============================================================= 40 | -------------------------------------------------------------------------------- /aPLib/doc/html/_sources/acknowledgements.txt: -------------------------------------------------------------------------------- 1 | 2 | Acknowledgements 3 | ================ 4 | 5 | Greetings and thanks to: 6 | 7 | * d'b for our continuous discussions of compression techniques :) 8 | * TAD for all the great ideas and the good discussions 9 | * The people who made the Epsilon Compression Page 10 | * Pasi 'Albert' Ojala for his info on PuCrunch 11 | * RIT Research Labs for making Dos Navigator .. it's the BEST! 12 | * LiuTaoTao for making TR .. one of the best debuggers around! 13 | * Eugene Suslikov (SEN) for making HIEW .. it ROCKS! 14 | * Oleg for his work on the TMT Pascal code 15 | * Veit Kannegieser for his work on the VPascal code 16 | * METALBRAIN for his work on the 16bit depackers 17 | * Gautier for his work on the Ada code 18 | * Alexey Solodovnikov for his work on the Delphi code 19 | * Steve Hutchesson for his work on the MASM32 code 20 | * Agner Fog for objconv and his great info on calling conventions 21 | * All other people who make good software freely available for non-commercial 22 | use! 23 | 24 | A special thanks to the beta-testers: 25 | 26 | * x-otic (thx mate ;) 27 | * Oleg Prokhorov (great optimisations and bug reports!) 28 | * Lawrence E. Boothby 29 | * METALBRAIN (believe in miracles, my friend ;) 30 | * eL PuSHeR 31 | * Elli 32 | * Veit Kannegieser 33 | * Gautier 34 | -------------------------------------------------------------------------------- /aPLib/src/32bit/sgetsize.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm safe assembler header access 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aPsafe_get_orig_size as '_aPsafe_get_orig_size' 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aPsafe_get_orig_size: 21 | ; aPsafe_get_orig_size(const void *source) 22 | 23 | .ret$ equ 7*4 24 | .src$ equ 8*4 + 4 25 | 26 | pushad 27 | 28 | mov esi, [esp + .src$] ; esi -> buffer 29 | 30 | mov ebx, [esi] ; ebx = header.tag 31 | 32 | or eax, -1 ; eax = -1 33 | 34 | cmp ebx, 032335041h ; check tag == 'AP32' 35 | jne .return_eax 36 | 37 | mov ebx, [esi + 4] ; ebx = header.header_size 38 | cmp ebx, 24 ; check header_size >= 24 39 | jb .return_eax 40 | 41 | mov eax, [esi + 16] ; eax = header.orig_size 42 | 43 | .return_eax: 44 | mov [esp + .ret$], eax ; return unpacked length in eax 45 | 46 | popad 47 | 48 | ret 49 | 50 | ; ============================================================= 51 | -------------------------------------------------------------------------------- /osslsigncode/misc/softhsm-example-token/gen-token.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | P11_ENGINE=/usr/lib/engines/engine_pkcs11.so 4 | P11_MODULE=/usr/lib/softhsm/libsofthsm.so 5 | 6 | ## 7 | 8 | export SOFTHSM_CONF=softhsm.conf 9 | cat>config.py<softhsm.conf<openssl.conf< source 29 | 30 | test rcx, rcx 31 | jz .return_error 32 | 33 | mov eax, [rdi] ; eax = header.tag 34 | 35 | cmp eax, 032335041h ; check tag == 'AP32' 36 | jne .return_error 37 | 38 | mov eax, [rdi + 4] ; rax = header.header_size 39 | cmp eax, 24 ; check header_size >= 24 40 | jb .return_error 41 | 42 | add rcx, rax ; rcx -> packed data 43 | mov edx, [rdi + 8] ; rdx = header.packed_size 44 | 45 | call aP_crc32 46 | 47 | cmp eax, [rdi + 12] ; check eax == header.packed_crc 48 | 49 | mov eax, [rdi + 16] ; rax = header.orig_size 50 | 51 | je .return_rax 52 | 53 | .return_error: 54 | or rax, -1 ; rax = -1 55 | 56 | .return_rax: 57 | add rsp, 32 58 | pop rdi 59 | 60 | ret 61 | 62 | ; ============================================================= 63 | -------------------------------------------------------------------------------- /osslsigncode/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | OpenSSL based Authenticode signing for PE/MSI/Java CAB files. 3 | 4 | Copyright (C) 2005-2014 Per Allansson 5 | 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | 20 | In addition, as a special exception, the copyright holders give 21 | permission to link the code of portions of this program with the 22 | OpenSSL library under certain conditions as described in each 23 | individual source file, and distribute linked combinations 24 | including the two. 25 | You must obey the GNU General Public License in all respects 26 | for all of the code used other than OpenSSL. If you modify 27 | file(s) with this exception, you may extend this exception to your 28 | version of the file(s), but you are not obligated to do so. If you 29 | do not wish to do so, delete this exception statement from your 30 | version. If you delete this exception statement from all source 31 | files in the program, then also delete it here. 32 | */ 33 | 34 | -------------------------------------------------------------------------------- /aPLib/doc/html/_sources/license.txt: -------------------------------------------------------------------------------- 1 | .. include:: 2 | 3 | License 4 | ======= 5 | 6 | aPLib is freeware. If you use aPLib in a product, an acknowledgement would be 7 | appreciated, e.g. by adding something like the following to the documentation: 8 | 9 | | This product uses the aPLib compression library, 10 | | Copyright |copy| 1998-2014 Joergen Ibsen, All Rights Reserved. 11 | | For more information, please visit: http://www.ibsensoftware.com/ 12 | 13 | You may not redistribute aPLib without all of the files. 14 | 15 | You may not edit or reverse engineer any of the files (except the header 16 | files and the decompression code, which you may edit as long as you do not 17 | remove the copyright notice). 18 | 19 | You may not sell aPLib, or any part of it, for money (except for charging for 20 | the media). 21 | 22 | ``#ifndef COMMON_SENSE`` 23 | 24 | This software is provided "as is". In no event shall I, the author, be 25 | liable for any kind of loss or damage arising out of the use, abuse or 26 | the inability to use this software. USE IT ENTIRELY AT YOUR OWN RISK! 27 | 28 | This software comes without any kind of warranty, either expressed or 29 | implied, including, but not limited to the implied warranties of 30 | merchantability or fitness for any particular purpose. 31 | 32 | If you do not agree with these terms or if your jurisdiction does not 33 | allow the exclusion of warranty and liability as stated above you are NOT 34 | allowed to use this software at all. 35 | 36 | ``#else`` 37 | 38 | Bla bla bla .. the usual stuff - you know it anyway: 39 | 40 | If anything goes even remotely wrong - blame _yourself_, NOT me! 41 | 42 | ``#endif`` 43 | -------------------------------------------------------------------------------- /aPLib/src/32bit/scheck.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm safe assembler crc checker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aPsafe_check as '_aPsafe_check' 15 | 16 | extrn '_aP_crc32' as aP_crc32 17 | 18 | ; ============================================================= 19 | 20 | section '.text' code readable executable 21 | 22 | aPsafe_check: 23 | ; aPsafe_check(const void *source) 24 | 25 | .ret$ equ 7*4 26 | .src$ equ 8*4 + 4 27 | 28 | pushad 29 | 30 | mov esi, [esp + .src$] ; esi -> buffer 31 | 32 | test esi, esi 33 | jz .return_error 34 | 35 | mov ebx, [esi] ; ebx = header.tag 36 | 37 | cmp ebx, 032335041h ; check tag == 'AP32' 38 | jne .return_error 39 | 40 | mov ebx, [esi + 4] ; ebx = header.header_size 41 | cmp ebx, 24 ; check header_size >= 24 42 | jb .return_error 43 | 44 | add ebx, esi ; ebx -> packed data 45 | 46 | push dword [esi + 8] ; push header.packed_size 47 | push ebx 48 | call aP_crc32 49 | add esp, 8 50 | 51 | cmp eax, [esi + 12] ; check eax == header.packed_crc 52 | 53 | mov eax, [esi + 16] ; eax = header.orig_size 54 | 55 | je .return_eax 56 | 57 | .return_error: 58 | or eax, -1 ; eax = -1 59 | 60 | .return_eax: 61 | mov [esp + .ret$], eax ; return unpacked length in eax 62 | 63 | popad 64 | 65 | ret 66 | 67 | ; ============================================================= 68 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/aplib.ads: -------------------------------------------------------------------------------- 1 | -- 2 | -- aPLib compression library - the smaller the better :) 3 | -- 4 | -- Ada binding for aplib.a 5 | -- 6 | -- Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | -- All Rights Reserved 8 | -- 9 | -- http://www.ibsensoftware.com/ 10 | -- 11 | -- Ada binding by Gautier de Montmollin - gdemont@hotmail.com, gdm@mydiax.ch 12 | -- 13 | 14 | 15 | package aPLib is 16 | 17 | -- Give the maximum "packed" size possible - it can be more than 18 | -- the unpacked size in case of uncompressible data: 19 | 20 | function Evaluate_max_packed_space( unpacked_size: Integer ) return Integer; 21 | pragma Import(C, Evaluate_max_packed_space, "aP_max_packed_size"); 22 | -- Was, before v0.34 b4: (((unpacked_size * 9) / 8) + 16) 23 | 24 | 25 | -- A template for packing data: 26 | 27 | generic 28 | type packed_data is private; 29 | type unpacked_data is private; 30 | with procedure Call_back( unpacked_bytes, packed_bytes: in integer; 31 | continue : out boolean ); 32 | 33 | procedure Pack( source : in unpacked_data; 34 | destination : out packed_data; 35 | packed_length: out integer ); 36 | 37 | -- A template for unpacking data: 38 | 39 | generic 40 | type packed_data is private; 41 | type unpacked_data is private; 42 | 43 | procedure Depack( source : in packed_data; 44 | destination: out unpacked_data ); 45 | 46 | -- Exceptions for errors that could occur: 47 | 48 | pack_failed, unpack_failed: exception; 49 | 50 | -- Just for information 51 | 52 | function aP_workmem_size(inputsize: integer) return integer; 53 | pragma Import(C, aP_workmem_size, "aP_workmem_size"); 54 | 55 | end aPLib; 56 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/filedlgs.asm: -------------------------------------------------------------------------------- 1 | ; ######################################################################## 2 | 3 | GetFileName PROTO :DWORD, :DWORD, :DWORD 4 | SaveFileName PROTO :DWORD, :DWORD, :DWORD 5 | FillBuffer PROTO :DWORD, :DWORD, :BYTE 6 | 7 | .data 8 | szFileName db 260 dup(0) 9 | ofn OPENFILENAME <> ; structure 10 | 11 | .code 12 | 13 | ; ######################################################################## 14 | 15 | GetFileName proc hParent:DWORD,lpTitle:DWORD,lpFilter:DWORD 16 | 17 | mov ofn.lStructSize, sizeof OPENFILENAME 18 | m2m ofn.hWndOwner, hParent 19 | m2m ofn.hInstance, hInstance 20 | m2m ofn.lpstrFilter, lpFilter 21 | m2m ofn.lpstrFile, offset szFileName 22 | mov ofn.nMaxFile, sizeof szFileName 23 | m2m ofn.lpstrTitle, lpTitle 24 | mov ofn.Flags, OFN_EXPLORER or OFN_FILEMUSTEXIST or \ 25 | OFN_LONGNAMES 26 | 27 | invoke GetOpenFileName,ADDR ofn 28 | 29 | ret 30 | 31 | GetFileName endp 32 | 33 | ; ######################################################################### 34 | 35 | SaveFileName proc hParent:DWORD,lpTitle:DWORD,lpFilter:DWORD 36 | 37 | mov ofn.lStructSize, sizeof OPENFILENAME 38 | m2m ofn.hWndOwner, hParent 39 | m2m ofn.hInstance, hInstance 40 | m2m ofn.lpstrFilter, lpFilter 41 | m2m ofn.lpstrFile, offset szFileName 42 | mov ofn.nMaxFile, sizeof szFileName 43 | m2m ofn.lpstrTitle, lpTitle 44 | mov ofn.Flags, OFN_EXPLORER or OFN_LONGNAMES or OFN_OVERWRITEPROMPT 45 | 46 | invoke GetSaveFileName,ADDR ofn 47 | 48 | ret 49 | 50 | SaveFileName endp 51 | 52 | ; ######################################################################## 53 | -------------------------------------------------------------------------------- /preprocessor/debug.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # settings 4 | # Complete these as you need 5 | ############################################# 6 | 7 | # ENABLE preprocessor 8 | enabled = True 9 | 10 | # If you want to keep the temp file for inspection - pre-patch state. 11 | # THE NAME is self.tmp_file 12 | keep_temp = False 13 | 14 | # Recheck the file before patching or the next preprocessor 15 | recheck_support = False 16 | 17 | # file format that this is for (PE, ELF, MACHO, ALL) 18 | # if not specified the processor will run against all 19 | file_format = "ALL" 20 | 21 | ############################################# 22 | 23 | 24 | class preprocessor: 25 | 26 | # REQUIRED 27 | def __init__(self, BDF): 28 | 29 | # REQUIRED -- exposes BDF objects to the preprocessor environment 30 | self.BDF = BDF 31 | # You can set a return, just add a check that returns False 32 | # 'None' does not flag 33 | self.result = True 34 | 35 | # REQUIRED 36 | def run(self): 37 | # call your program main here, we're calling print_debug() 38 | self.print_debug() 39 | 40 | return self.result 41 | 42 | def print_debug(self): 43 | print "*"*25, "DEBUG INFO", "*"*25 44 | 45 | try: 46 | for item, data in vars(self.BDF).iteritems(): 47 | # file Items (flItms) will be printed later 48 | if item == 'flItms': 49 | continue 50 | # This will give ARGS info 51 | print item, ":" ,data 52 | 53 | # BDF functions are exposed | print PE flItms (PE only) 54 | if 'flItms' in vars(self.BDF): 55 | self.BDF.print_flItms(self.BDF.flItms) 56 | 57 | except Exception, e: 58 | print "!" * 50 59 | print "\t[!] Exception:", str(e) 60 | print "!" * 50 61 | 62 | self.result = False 63 | 64 | print "*"*25, "END DEBUG INFO", "*"*25 65 | 66 | -------------------------------------------------------------------------------- /aPLib/contrib/bcb/apacksamplec.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // apackcsample.c 3 | //--------------------------------------------------------------------------- 4 | 5 | //--------------------------------------------------------------------------- 6 | // Header Guard 7 | #ifndef aspacksamplecH 8 | #define aspacksamplecH 9 | //--------------------------------------------------------------------------- 10 | 11 | 12 | //--------------------------------------------------------------------------- 13 | // Calling Convenction (depends on library) 14 | // This version works with watcom version of the lib 15 | //#define STDPREFIX __stdcall 16 | #define STDPREFIX __cdecl 17 | //--------------------------------------------------------------------------- 18 | 19 | 20 | //--------------------------------------------------------------------------- 21 | // Forward declarations 22 | // 23 | typedef STDPREFIX int (callbackfuncdef)(unsigned int insize, unsigned int inpos, unsigned int outpos, void *cbparam); 24 | typedef STDPREFIX void (resultcallbackfundef)(char *errorstring,int errorcode); 25 | // 26 | int STDPREFIX samplecallback(unsigned int insize, unsigned int inpos, unsigned int outpos, void *cbparam); 27 | void STDPREFIX sampleresultcallback(char *errorstr); 28 | // 29 | unsigned int ratio(unsigned int x, unsigned int y); 30 | int compress_file(const char *oldname, const char *packedname,callbackfuncdef *callbackfp,resultcallbackfundef *resultcallbackfp); 31 | int decompress_file(const char *packedname, const char *newname,callbackfuncdef *callbackfp,resultcallbackfundef *resultcallbackfp); 32 | int samplemain(int argc, char *argv[]); 33 | void show_syntax(void); 34 | //--------------------------------------------------------------------------- 35 | 36 | 37 | 38 | 39 | 40 | 41 | //--------------------------------------------------------------------------- 42 | // Header Guard 43 | #endif 44 | //--------------------------------------------------------------------------- -------------------------------------------------------------------------------- /aPLib/contrib/tmt/appack.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * TMT Pascal packing example 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> VPascal by Veit Kannegieser, 23.09.1998 12 | * -> TMT Pascal by Oleg Prokhorov 13 | *) 14 | 15 | uses aplibu; 16 | 17 | var 18 | infile,outfile :file; 19 | inbuffer,outbuffer :pointer; 20 | workmem :pointer; 21 | insize,outsize :longint; 22 | 23 | begin 24 | (* check number of parameters *) 25 | if paramcount<1 then 26 | begin 27 | writeln; 28 | writeln('Syntax: APPACK [output file]'); 29 | writeln; 30 | halt(1); 31 | end; 32 | 33 | (* open input file and read data *) 34 | assign(infile,paramstr(1)); 35 | reset(infile,1); 36 | insize:=filesize(infile); 37 | getmem(inbuffer,insize); 38 | blockread(infile,inbuffer^,insize); 39 | close(infile); 40 | 41 | (* get output mem and workmem *) 42 | getmem(outbuffer,aP_max_packed_size(insize)); 43 | getmem(workmem,aP_workmem_size(insize)); 44 | 45 | (* pack data *) 46 | outsize:=aPsafe_pack(inbuffer^,outbuffer^,insize,workmem^,@cb1,nil); 47 | writeln; 48 | 49 | if outsize=aPLib_Error then 50 | begin 51 | WriteLn; 52 | WriteLn('ERR: an error occured while compressing'); 53 | WriteLn; 54 | Halt(1); 55 | end; 56 | 57 | (* write packed data *) 58 | if paramcount<2 then 59 | begin 60 | assign(outfile,'out.apk'); 61 | writeln; 62 | writeln('No output file specified, writing to ''out.apk'''); 63 | end else assign(outfile,paramstr(2)); 64 | rewrite(outfile,1); 65 | blockwrite(outfile,outbuffer^,outsize); 66 | close(outfile); 67 | 68 | (* free mem *) 69 | freemem(inbuffer,insize); 70 | freemem(outbuffer,aP_max_packed_size(insize)); 71 | freemem(workmem,aP_workmem_size(insize)); 72 | 73 | end. 74 | -------------------------------------------------------------------------------- /aPLib/lib/elf/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * ELF format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/lib/macho/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * Mach-O format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/lib/elf64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * ELF 64-bit format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/lib/macho64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * Mach-O 64-bit format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/ctrls.asm: -------------------------------------------------------------------------------- 1 | ; ######################################################################## 2 | 3 | PushButton PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD 4 | EditSl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD 5 | Static PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD 6 | 7 | .data 8 | btnClass db "BUTTON",0 9 | EditClass db "EDIT",0 10 | statClass db "STATIC",0 11 | 12 | .code 13 | 14 | ; ######################################################################## 15 | 16 | PushButton proc lpText:DWORD,hParent:DWORD, 17 | a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD 18 | 19 | ; invoke PushButton,ADDR szText,hWnd,20,20,100,25,500 20 | 21 | invoke CreateWindowEx,0, 22 | ADDR btnClass,lpText, 23 | WS_CHILD or WS_VISIBLE, 24 | a,b,wd,ht,hParent,ID, 25 | hInstance,NULL 26 | 27 | ret 28 | 29 | PushButton endp 30 | 31 | ; ######################################################################### 32 | 33 | EditSl proc szMsg:DWORD,a:DWORD,b:DWORD, 34 | wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD 35 | 36 | ; invoke EditSl,ADDR adrTxt,200,10,150,25,hWnd,700 37 | 38 | 39 | invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClass,szMsg, 40 | WS_VISIBLE or WS_CHILDWINDOW or \ 41 | ES_AUTOHSCROLL or ES_NOHIDESEL, 42 | a,b,wd,ht,hParent,ID,hInstance,NULL 43 | 44 | ret 45 | 46 | EditSl endp 47 | 48 | ; ######################################################################## 49 | 50 | Static proc lpText:DWORD,hParent:DWORD, 51 | a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD 52 | 53 | ; invoke Static,ADDR szText,hWnd,20,20,100,25,500 54 | 55 | invoke CreateWindowEx,WS_EX_STATICEDGE, 56 | ADDR statClass,lpText, 57 | WS_CHILD or WS_VISIBLE or SS_CENTER, 58 | a,b,wd,ht,hParent,ID, 59 | hInstance,NULL 60 | 61 | ret 62 | 63 | Static endp 64 | 65 | ; ######################################################################## 66 | 67 | -------------------------------------------------------------------------------- /aPLib/lib/coff64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * COFF 64-bit format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int aPsafe_check(const void *source); 53 | 54 | unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/contrib/tmt/apunpack.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * TMT Pascal depacking example 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> VPascal by Veit Kannegieser, 23.09.1998 12 | * -> TMT Pascal by Oleg Prokhorov 13 | *) 14 | 15 | uses aplibu; 16 | 17 | var 18 | infile,outfile :file; 19 | inbuffer,outbuffer :pointer; 20 | insize,outsize :longint; 21 | outmemsize :longint; 22 | 23 | begin 24 | (* check number of parameters *) 25 | if paramcount<1 then 26 | begin 27 | writeln; 28 | writeln('Syntax: APUNPACK [output file]'); 29 | writeln; 30 | halt(1); 31 | end; 32 | 33 | (* open input file and read header *) 34 | assign(infile,paramstr(1)); 35 | reset(infile,1); 36 | insize:=filesize(infile); 37 | 38 | (* get mem and read input file *) 39 | getmem(inbuffer,insize); 40 | blockread(infile,inbuffer^,insize); 41 | close(infile); 42 | 43 | (* check header and get original size *) 44 | outmemsize := aPsafe_get_orig_size(inbuffer^); 45 | if outmemsize=aPLib_Error then 46 | begin 47 | writeln('File is not packed with aPPack.'); 48 | halt(0); 49 | end; 50 | 51 | (* get mem for unpacked data *) 52 | getmem(outbuffer,outmemsize); 53 | 54 | (* unpack data *) 55 | outsize:=aPsafe_depack(inbuffer^,insize,outbuffer^,outmemsize); 56 | 57 | if outsize=aPLib_Error then 58 | begin 59 | WriteLn; 60 | WriteLn('ERR: compressed data error'); 61 | WriteLn; 62 | Halt(1); 63 | end; 64 | 65 | if outsize<>outmemsize then halt(1); 66 | 67 | (* write unpacked data *) 68 | if paramcount<2 then 69 | begin 70 | assign(outfile,'out.dat'); 71 | writeln; 72 | writeln('No output file specified, writing to ''out.dat'''); 73 | end else assign(outfile,paramstr(2)); 74 | rewrite(outfile,1); 75 | blockwrite(outfile,outbuffer^,outsize); 76 | close(outfile); 77 | 78 | (* free memory *) 79 | freemem(inbuffer,insize); 80 | freemem(outbuffer,outmemsize); 81 | 82 | end. 83 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/appack.pas: -------------------------------------------------------------------------------- 1 | {$M 32000} 2 | {$I+} 3 | program test__aplib_pack; 4 | 5 | (* 6 | * aPLib compression library - the smaller the better :) 7 | * 8 | * VPascal packing example 9 | * 10 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 11 | * All Rights Reserved 12 | * 13 | * http://www.ibsensoftware.com/ 14 | * 15 | * -> VPascal by Veit Kannegieser, 23.09.1998 16 | *) 17 | 18 | 19 | {$IfDef DYNAMIC_VERSION} 20 | uses aplibud; 21 | {$Else} 22 | uses aplibu; 23 | {$EndIf} 24 | 25 | var 26 | infile ,outfile :file; 27 | inbuffer ,outbuffer :pointer; 28 | workmem :pointer; 29 | insize ,outsize :longint; 30 | 31 | begin 32 | (* check number of parameters *) 33 | if ParamCount<1 then 34 | begin 35 | WriteLn; 36 | WriteLn('Syntax: APPACK [output file]'); 37 | WriteLn; 38 | Halt(1); 39 | end; 40 | 41 | (* open input file and read data *) 42 | Assign(infile,ParamStr(1)); 43 | FileMode:=$40; (* open_access_ReadOnly OR open_share_DenyNone *) 44 | Reset(infile,1); 45 | insize:=FileSize(infile); 46 | GetMem(inbuffer,insize); 47 | BlockRead(infile,inbuffer^,insize); 48 | Close(infile); 49 | 50 | (* get output mem and workmem *) 51 | GetMem(outbuffer,_aP_max_packed_size(insize)); 52 | GetMem(workmem,_aP_workmem_size(insize)); 53 | 54 | (* pack data *) 55 | outsize:=_aPsafe_pack(inbuffer^,outbuffer^,insize,workmem^,cb1,nil); 56 | Writeln; 57 | 58 | if outsize=aPLib_Error then 59 | begin 60 | WriteLn; 61 | WriteLn('ERR: an error occured while compressing'); 62 | WriteLn; 63 | Halt(1); 64 | end; 65 | 66 | (* write packed data *) 67 | if ParamCount<2 then 68 | begin 69 | Assign(outfile,'out.apk'); 70 | WriteLn; 71 | WriteLn('No output file specified, writing to ''out.apk'''); 72 | end 73 | else 74 | Assign(outfile,ParamStr(2)); 75 | FileModeReadWrite:=$42; (* open_access_ReadWrite OR open_share_DenyNone *) 76 | Rewrite(outfile,1); 77 | BlockWrite(outfile,outbuffer^,outsize); 78 | Close(outfile); 79 | 80 | (* free mem *) 81 | Dispose(inbuffer); 82 | Dispose(outbuffer); 83 | Dispose(workmem); 84 | 85 | end. 86 | 87 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/apunpack.pas: -------------------------------------------------------------------------------- 1 | program test__aplib_depack; 2 | 3 | (* 4 | * aPLib compression library - the smaller the better :) 5 | * 6 | * VPascal depacking example 7 | * 8 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 9 | * All Rights Reserved 10 | * 11 | * http://www.ibsensoftware.com/ 12 | * 13 | * -> VPascal by Veit Kannegieser, 23.09.1998 14 | *) 15 | 16 | {$IfDef DYNAMIC_VERSION} 17 | uses aplibud; 18 | {$Else} 19 | uses aplibu; 20 | {$EndIf} 21 | 22 | var 23 | infile ,outfile :file; 24 | inbuffer ,outbuffer :pointer; 25 | insize ,outsize :longint; 26 | outmemsize :longint; 27 | 28 | begin 29 | (* check number of parameters *) 30 | if ParamCount<1 then 31 | begin 32 | WriteLn; 33 | WriteLn('Syntax: APUNPACK [output file]'); 34 | WriteLn; 35 | Halt(1); 36 | end; 37 | 38 | (* open input file and read header *) 39 | Assign(infile,ParamStr(1)); 40 | FileMode:=$40; (* open_access_ReadOnly OR open_share_DenyNone *) 41 | Reset(infile,1); 42 | insize:=FileSize(infile); 43 | 44 | (* get mem and read input file *) 45 | GetMem(inbuffer,insize); 46 | BlockRead(infile,inbuffer^,insize); 47 | Close(infile); 48 | 49 | (* get original size from header and get mem *) 50 | outmemsize := _aPsafe_get_orig_size(inbuffer^); 51 | GetMem(outbuffer,outmemsize); 52 | 53 | (* unpack data *) 54 | outsize:=_aPsafe_depack(inbuffer^,insize,outbuffer^,outmemsize); 55 | 56 | if outsize=aPLib_Error then 57 | begin 58 | WriteLn; 59 | WriteLn('ERR: compressed data error'); 60 | WriteLn; 61 | Halt(1); 62 | end; 63 | 64 | if outsize<>outmemsize then Halt(1); 65 | 66 | (* write unpacked data *) 67 | if ParamCount<2 then 68 | begin 69 | Assign(outfile,'out.dat'); 70 | WriteLn; 71 | WriteLn('No output file specified, writing to ''out.dat'''); 72 | end 73 | else 74 | Assign(outfile,ParamStr(2)); 75 | FileModeReadWrite:=$42; (* open_access_ReadWrite OR open_share_DenyNone *) 76 | Rewrite(outfile,1); 77 | BlockWrite(outfile,outbuffer^,outsize); 78 | Close(outfile); 79 | 80 | (* free mem *) 81 | Dispose(inbuffer); 82 | Dispose(outbuffer); 83 | 84 | end. 85 | 86 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/tbmacros.asm: -------------------------------------------------------------------------------- 1 | ; --------------------------- 2 | ; macros for creating toolbar 3 | ; --------------------------- 4 | 5 | TBextraData MACRO 6 | mov tbb.fsState, TBSTATE_ENABLED 7 | mov tbb.dwData, 0 8 | mov tbb.iString, 0 9 | ENDM 10 | 11 | ; ------------------------------ 12 | 13 | TBbutton MACRO bID, cID 14 | mov tbb.iBitmap, bID ;; button ID number 15 | mov tbb.idCommand, cID ;; command ID number 16 | mov tbb.fsStyle, TBSTYLE_BUTTON 17 | invoke SendMessage,hToolBar,TB_ADDBUTTONS,1,ADDR tbb 18 | ENDM 19 | 20 | ; ------------------------------ 21 | 22 | TBblank MACRO 23 | mov tbb.iBitmap, 0 24 | mov tbb.idCommand, 0 25 | mov tbb.fsStyle, TBSTYLE_SEP 26 | invoke SendMessage,hToolBar,TB_ADDBUTTONS,1,ADDR tbb 27 | ENDM 28 | 29 | ; ------------------------------ 30 | 31 | Create_Tool_Bar MACRO Wd, Ht 32 | 33 | szText tbClass,"ToolbarWindow32" 34 | 35 | invoke CreateWindowEx,0, 36 | ADDR tbClass, 37 | ADDR szDisplayName, 38 | WS_CHILD or WS_VISIBLE or CCS_NODIVIDER or TBSTYLE_FLAT, 39 | 0,0,500,40, 40 | hWin,NULL, 41 | hInstance,NULL 42 | 43 | ;; or TBSTYLE_FLAT 44 | 45 | mov hToolBar, eax 46 | 47 | invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0 48 | 49 | ;; --------------------------------------- 50 | ;; Put width & height of bitmap into DWORD 51 | ;; --------------------------------------- 52 | mov ecx,Wd ;; loword = bitmap Width 53 | mov eax,Ht ;; hiword = bitmap Height 54 | shl eax,16 55 | mov ax, cx 56 | 57 | mov bSize, eax 58 | 59 | invoke SendMessage,hToolBar,TB_SETBITMAPSIZE,0,bSize 60 | 61 | invoke SetBmpColor,hTbBmp 62 | mov hTbBmp,eax 63 | 64 | mov tbab.hInst, 0 65 | m2m tbab.nID, hTbBmp 66 | invoke SendMessage,hToolBar,TB_ADDBITMAP,12,ADDR tbab 67 | 68 | invoke SendMessage,hToolBar,TB_SETBUTTONSIZE,0,bSize 69 | ENDM 70 | 71 | -------------------------------------------------------------------------------- /aPLib/lib/coff/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * COFF format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int __cdecl aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int __cdecl aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int __cdecl aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int __cdecl aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int __cdecl aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int __cdecl aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int __cdecl aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int __cdecl aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int __cdecl aPsafe_check(const void *source); 53 | 54 | unsigned int __cdecl aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int __cdecl aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/lib/omf/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * OMF format header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | unsigned int __cdecl aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | unsigned int __cdecl aP_workmem_size(unsigned int inputsize); 31 | 32 | unsigned int __cdecl aP_max_packed_size(unsigned int inputsize); 33 | 34 | unsigned int __cdecl aP_depack_asm(const void *source, void *destination); 35 | 36 | unsigned int __cdecl aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | unsigned int __cdecl aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | unsigned int __cdecl aP_crc32(const void *source, unsigned int length); 44 | 45 | unsigned int __cdecl aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (__cdecl *callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | unsigned int __cdecl aPsafe_check(const void *source); 53 | 54 | unsigned int __cdecl aPsafe_get_orig_size(const void *source); 55 | 56 | unsigned int __cdecl aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/contrib/bcb/MainFormUnit.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | // MainFormUnit.cpp 3 | //--------------------------------------------------------------------------- 4 | 5 | //--------------------------------------------------------------------------- 6 | // Header Guard 7 | #ifndef MainFormUnitH 8 | #define MainFormUnitH 9 | //--------------------------------------------------------------------------- 10 | 11 | //--------------------------------------------------------------------------- 12 | // Application Includes 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | //--------------------------------------------------------------------------- 21 | 22 | 23 | //--------------------------------------------------------------------------- 24 | class TMainForm : public TForm 25 | { 26 | private: 27 | bool wantscancel; 28 | __published: 29 | // IDE-managed Components 30 | TPanel *Panel1; 31 | TLabel *LabelaPLib2; 32 | TLabel *LabelaPLib1; 33 | TLabel *Label5; 34 | TGroupBox *GroupBox1; 35 | TLabel *LabelResult; 36 | TProgressBar *ProgressBar; 37 | TButton *ButtonCancel; 38 | TButton *ButtonCompress; 39 | TButton *ButtonDecompress; 40 | TOpenDialog *OpenDialog; 41 | void __fastcall ButtonCompressClick(TObject *Sender); 42 | void __fastcall ButtonDecompressClick(TObject *Sender); 43 | void __fastcall ButtonCancelClick(TObject *Sender); 44 | public: 45 | // constructor 46 | __fastcall TMainForm(TComponent* Owner); 47 | public: 48 | void Initialize(); 49 | void SetStateRunning(); 50 | void SetStateNotRunning(); 51 | public: 52 | bool get_wantscancel() {return wantscancel;}; 53 | }; 54 | //--------------------------------------------------------------------------- 55 | 56 | 57 | 58 | 59 | 60 | 61 | //--------------------------------------------------------------------------- 62 | // C++ Builder Global Instance Pointer 63 | extern PACKAGE TMainForm *MainForm; 64 | //--------------------------------------------------------------------------- 65 | 66 | 67 | 68 | 69 | 70 | //--------------------------------------------------------------------------- 71 | // End of Header Guard 72 | #endif 73 | //--------------------------------------------------------------------------- 74 | -------------------------------------------------------------------------------- /aPLib/contrib/dotnet/IbsenSoftware/aPLib/DllInterface.cs: -------------------------------------------------------------------------------- 1 | // 2 | // aPLib compression library - the smaller the better :) 3 | // 4 | // C# wrapper 5 | // 6 | // Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | // All Rights Reserved 8 | // 9 | // http://www.ibsensoftware.com/ 10 | // 11 | 12 | namespace IbsenSoftware.aPLib 13 | { 14 | using System.Runtime.InteropServices; 15 | 16 | public class DllInterface 17 | { 18 | // declare delegate type used for compression callback 19 | public delegate int CompressionCallback( 20 | int length, 21 | int slen, 22 | int dlen, 23 | int cbparam 24 | ); 25 | 26 | [DllImport("aplib.dll")] 27 | public static extern int aP_pack( 28 | [In] byte[] source, 29 | [Out] byte[] destination, 30 | int length, 31 | [In] byte[] workmem, 32 | CompressionCallback callback, 33 | int cbparam 34 | ); 35 | 36 | [DllImport("aplib.dll")] 37 | public static extern int aP_workmem_size(int length); 38 | 39 | [DllImport("aplib.dll")] 40 | public static extern int aP_max_packed_size(int length); 41 | 42 | [DllImport("aplib.dll")] 43 | public static extern int aP_depack_asm( 44 | [In] byte[] source, 45 | [Out] byte[] destination 46 | ); 47 | 48 | [DllImport("aplib.dll")] 49 | public static extern int aP_depack_asm_fast( 50 | [In] byte[] source, 51 | [Out] byte[] destination 52 | ); 53 | 54 | [DllImport("aplib.dll")] 55 | public static extern int aP_depack_asm_safe( 56 | [In] byte[] source, 57 | int srclen, 58 | [Out] byte[] destination, 59 | int dstlen 60 | ); 61 | 62 | [DllImport("aplib.dll")] 63 | public static extern int aP_crc32([In] byte[] source, int length); 64 | 65 | [DllImport("aplib.dll")] 66 | public static extern int aPsafe_pack( 67 | [In] byte[] source, 68 | [Out] byte[] destination, 69 | int length, 70 | [In] byte[] workmem, 71 | CompressionCallback callback, 72 | int cbparam 73 | ); 74 | 75 | [DllImport("aplib.dll")] 76 | public static extern int aPsafe_check([In] byte[] source); 77 | 78 | [DllImport("aplib.dll")] 79 | public static extern int aPsafe_get_orig_size([In] byte[] source); 80 | 81 | [DllImport("aplib.dll")] 82 | public static extern int aPsafe_depack( 83 | [In] byte[] source, 84 | int srclen, 85 | [Out] byte[] destination, 86 | int dstlen 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /aPLib/lib/dll64/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * DLL 64-bit header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | __declspec(dllimport) unsigned int aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | __declspec(dllimport) unsigned int aP_workmem_size(unsigned int inputsize); 31 | 32 | __declspec(dllimport) unsigned int aP_max_packed_size(unsigned int inputsize); 33 | 34 | __declspec(dllimport) unsigned int aP_depack_asm(const void *source, void *destination); 35 | 36 | __declspec(dllimport) unsigned int aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | __declspec(dllimport) unsigned int aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | __declspec(dllimport) unsigned int aP_crc32(const void *source, unsigned int length); 44 | 45 | __declspec(dllimport) unsigned int aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (*callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | __declspec(dllimport) unsigned int aPsafe_check(const void *source); 53 | 54 | __declspec(dllimport) unsigned int aPsafe_get_orig_size(const void *source); 55 | 56 | __declspec(dllimport) unsigned int aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /osslsigncode/tests/testsign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -f putty*.exe 4 | 5 | PUTTY_URL="http://the.earth.li/~sgtatham/putty/0.64/x86/putty.exe" 6 | [ -f putty.exe ] || wget -q -O putty.exe $PUTTY_URL 7 | [ -f putty.exe ] || curl -o putty.exe $PUTTY_URL 8 | 9 | if [ ! -f putty.exe ]; then 10 | echo "FAIL: Couldn't download putty.exe" 11 | exit 1 12 | fi 13 | 14 | rm -f key.* cert.* 15 | 16 | keytool -genkey \ 17 | -alias selfsigned -keysize 2048 -keyalg RSA -keypass passme -storepass passme -keystore key.ks << EOF 18 | John Doe 19 | ACME In 20 | ACME 21 | Springfield 22 | LaLaLand 23 | SE 24 | yes 25 | EOF 26 | 27 | 28 | echo "Converting key/cert to PKCS12 container" 29 | keytool -importkeystore \ 30 | -srckeystore key.ks -srcstoretype JKS -srckeypass passme -srcstorepass passme -srcalias selfsigned \ 31 | -destkeystore key.p12 -deststoretype PKCS12 -destkeypass passme -deststorepass passme 32 | 33 | rm -f key.ks 34 | 35 | echo "Converting key to PEM format" 36 | openssl pkcs12 -in key.p12 -passin pass:passme -nocerts -nodes -out key.pem 37 | echo "Converting key to PEM format (with password)" 38 | openssl rsa -in key.pem -out keyp.pem -passout pass:passme 39 | echo "Converting key to DER format" 40 | openssl rsa -in key.pem -outform DER -out key.der -passout pass:passme 41 | echo "Converting key to PVK format" 42 | openssl rsa -in key.pem -outform PVK -pvk-strong -out key.pvk -passout pass:passme 43 | 44 | echo "Converting cert to PEM format" 45 | openssl pkcs12 -in key.p12 -passin pass:passme -nokeys -out cert.pem 46 | echo "Converting cert to SPC format" 47 | openssl crl2pkcs7 -nocrl -certfile cert.pem -outform DER -out cert.spc 48 | 49 | 50 | ../osslsigncode sign -spc cert.spc -key key.pem putty.exe putty1.exe 51 | ../osslsigncode sign -certs cert.spc -key keyp.pem -pass passme putty.exe putty2.exe 52 | ../osslsigncode sign -certs cert.pem -key keyp.pem -pass passme putty.exe putty3.exe 53 | ../osslsigncode sign -certs cert.spc -key key.der putty.exe putty4.exe 54 | ../osslsigncode sign -pkcs12 key.p12 -pass passme putty.exe putty5.exe 55 | ../osslsigncode sign -certs cert.spc -key key.pvk -pass passme putty.exe putty6.exe 56 | 57 | echo "" 58 | echo "" 59 | 60 | check=`sha1sum putty[1-9]*.exe | cut -d' ' -f1 | uniq | wc -l` 61 | cmp putty1.exe putty2.exe && \ 62 | cmp putty2.exe putty3.exe && \ 63 | cmp putty3.exe putty4.exe && \ 64 | cmp putty4.exe putty5.exe && \ 65 | cmp putty5.exe putty6.exe 66 | if [ $? -ne 0 ]; then 67 | echo "Failure is not an option." 68 | else 69 | echo "Yes, it works." 70 | fi 71 | 72 | 73 | -------------------------------------------------------------------------------- /aPLib/lib/dll/aplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * DLL header file 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #ifndef APLIB_H_INCLUDED 13 | #define APLIB_H_INCLUDED 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ifndef APLIB_ERROR 20 | # define APLIB_ERROR ((unsigned int) (-1)) 21 | #endif 22 | 23 | __declspec(dllimport) unsigned int __stdcall aP_pack(const void *source, 24 | void *destination, 25 | unsigned int length, 26 | void *workmem, 27 | int (__stdcall *callback)(unsigned int, unsigned int, unsigned int, void *), 28 | void *cbparam); 29 | 30 | __declspec(dllimport) unsigned int __stdcall aP_workmem_size(unsigned int inputsize); 31 | 32 | __declspec(dllimport) unsigned int __stdcall aP_max_packed_size(unsigned int inputsize); 33 | 34 | __declspec(dllimport) unsigned int __stdcall aP_depack_asm(const void *source, void *destination); 35 | 36 | __declspec(dllimport) unsigned int __stdcall aP_depack_asm_fast(const void *source, void *destination); 37 | 38 | __declspec(dllimport) unsigned int __stdcall aP_depack_asm_safe(const void *source, 39 | unsigned int srclen, 40 | void *destination, 41 | unsigned int dstlen); 42 | 43 | __declspec(dllimport) unsigned int __stdcall aP_crc32(const void *source, unsigned int length); 44 | 45 | __declspec(dllimport) unsigned int __stdcall aPsafe_pack(const void *source, 46 | void *destination, 47 | unsigned int length, 48 | void *workmem, 49 | int (__stdcall *callback)(unsigned int, unsigned int, unsigned int, void *), 50 | void *cbparam); 51 | 52 | __declspec(dllimport) unsigned int __stdcall aPsafe_check(const void *source); 53 | 54 | __declspec(dllimport) unsigned int __stdcall aPsafe_get_orig_size(const void *source); 55 | 56 | __declspec(dllimport) unsigned int __stdcall aPsafe_depack(const void *source, 57 | unsigned int srclen, 58 | void *destination, 59 | unsigned int dstlen); 60 | 61 | #ifdef __cplusplus 62 | } /* extern "C" */ 63 | #endif 64 | 65 | #endif /* APLIB_H_INCLUDED */ 66 | -------------------------------------------------------------------------------- /aPLib/contrib/ada/aplib.adb: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- File: aplib.adb; see specification (aplib.ads) 3 | ----------------------------------------------------------------------------- 4 | with System, Ada.Unchecked_Deallocation; 5 | 6 | -- with Ada.Text_IO; use Ada.Text_IO; -- OA debug 7 | 8 | package body aPLib is 9 | 10 | procedure Pack( source : in unpacked_data; 11 | destination : out packed_data; 12 | packed_length: out integer ) is 13 | 14 | type byte is mod 2 ** 8; for byte'size use 8; 15 | type twa is array( 0..aP_workmem_size(source'size / 8) ) of byte; 16 | pragma pack(twa); 17 | 18 | type pwa is access twa; 19 | procedure Dispose is new Ada.Unchecked_Deallocation( twa, pwa ); 20 | 21 | type p_cb is access function (unpacked, packed: integer) return integer; 22 | 23 | function aP_pack(source: unpacked_data; 24 | destination_addr: System.Address; -- trick for "in" par. 25 | length: integer; 26 | work_mem: twa; 27 | cb: p_cb) 28 | return integer; 29 | 30 | pragma Import(C, aP_pack, "aP_pack"); 31 | 32 | function cb(unpacked, packed: integer) return integer is 33 | cont: boolean; 34 | begin 35 | Call_back(unpacked, packed, cont); 36 | return Boolean'Pos(cont); -- 0 false, 1 true 37 | end cb; 38 | 39 | p_to_cb: p_cb:= cb'access; 40 | tmp_work_mem: pwa:= New twa; 41 | begin 42 | -- Put_Line("OA3 "); 43 | -- packed_length:= 44 | -- aP_pack( source'Address, destination'Address, 45 | -- source'size / 8, tmp_work_mem.all'Address, cb'Address ); 46 | -- Put_Line("OA4 "); 47 | 48 | packed_length:= 49 | aP_pack( source, destination'Address, 50 | source'size / 8, tmp_work_mem.all, p_to_cb ); 51 | 52 | Dispose( tmp_work_mem ); -- we immediately free the work memory 53 | 54 | if packed_length=0 then -- 0 means error 55 | raise Pack_failed; 56 | end if; 57 | end Pack; 58 | 59 | procedure Depack( source : in packed_data; 60 | destination: out unpacked_data ) is 61 | 62 | function aP_depack_asm_fast( 63 | source: packed_data; 64 | destination_addr: System.Address -- trick for "in" par. 65 | ) return integer; 66 | pragma Import(C, aP_depack_asm_fast, "aP_depack_asm_fast"); 67 | 68 | begin 69 | if aP_depack_asm_fast( source, destination'Address )=0 then 70 | raise Unpack_failed; 71 | end if; 72 | end Depack; 73 | 74 | end aPLib; 75 | -------------------------------------------------------------------------------- /preprocessor/nsis_3_0.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # settings 4 | # Complete these as you need 5 | ############################################# 6 | 7 | # ENABLE preprocessor 8 | enabled = False 9 | 10 | # If you want the temp file used in the preprocessor saved 11 | # THE NAME is self.tmp_file 12 | keep_temp = False 13 | 14 | # check if file is modified beyond patching support 15 | recheck_support = True 16 | 17 | # file format that this is for (PE, ELF, MACHO, ALL) 18 | # if not specified the processor will run against all 19 | file_format = "PE" 20 | 21 | ############################################# 22 | 23 | # add your imports here 24 | import re 25 | 26 | class preprocessor: 27 | 28 | # REQUIRED 29 | def __init__(self, BDF): 30 | 31 | # REQUIRED 32 | self.BDF = BDF 33 | 34 | # Other 35 | self.nsis_binary = False 36 | 37 | # REQUIRED 38 | def run(self): 39 | # call your program main here 40 | self.nsis30() 41 | 42 | def nsis30(self): 43 | print '\tNSIS 3.0 CRC32 Check | Patch Out Preprocessor' 44 | with open(self.BDF.tmp_file.name, 'r+b') as self.f: 45 | self.check_NSIS() 46 | if self.nsis_binary is True: 47 | print "\t[*] NSIS 3.0 Binary loaded" 48 | self.patch_crc32_check() 49 | else: 50 | print "\t[*] NSIS 3.0 Binary NOT loaded" 51 | 52 | def check_NSIS(self): 53 | check_one = False 54 | check_two = False 55 | check_three = False 56 | 57 | filecontents = self.f.read() 58 | 59 | if 'NSIS Error'in filecontents: 60 | check_one = True 61 | 62 | if 'Installer integrity check has failed.' in filecontents: 63 | check_two = True 64 | 65 | if 'http://nsis.sf.net/NSIS_Error' in filecontents: 66 | check_three = True 67 | 68 | if check_one is True and check_two is True and check_three is True: 69 | self.nsis_binary = True 70 | 71 | 72 | def patch_crc32_check(self): 73 | p = re.compile("\x3B\x45\x08\x0F\x85\x9C\x00\x00\x00") 74 | self.f.seek(0) 75 | locations = [] 76 | match_loc = 0 77 | for m in p.finditer(self.f.read()): 78 | locations.append(m.start()) 79 | 80 | if len(locations) > 1: 81 | print "\t[*] More than one binary match, picking first" 82 | match_loc = locations[0] 83 | else: 84 | match_loc = locations[0] 85 | 86 | print "\t[*] Patch location", hex(match_loc) 87 | 88 | self.f.seek(match_loc + 4) 89 | self.f.write("\x84") 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /aPLib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | ______ ______ ____ ______ ____ 4 | _\__ /_ _\ /_ _\ /___ _\____/ _\ /___ 5 | / // / // / // /___ / / 6 | / / // / // / // / // / / 7 | /_ / //_ ___//_ / //_ / //_ / / 8 | /______\ /___\ /______\ /______\ /______\ 9 | -= t h e s m a l l e r t h e b e t t e r =- 10 | 11 | Copyright (c) 1998-2014 Joergen Ibsen, All Rights Reserved 12 | 13 | http://www.ibsensoftware.com/ 14 | 15 | 16 | 17 | About 18 | ----- 19 | 20 | aPLib is a compression library based on the algorithm used in aPACK (my 21 | 16-bit executable packer). aPLib is an easy-to-use alternative to many of the 22 | heavy-weight compression libraries available. 23 | 24 | The compression ratios achieved by aPLib combined with the speed and tiny 25 | footprint of the depackers (as low as 169 bytes!) makes it the ideal choice 26 | for many products. 27 | 28 | Please read the documentation file 'doc/aPLib.chm' or 29 | 'doc/html/index.html'. 30 | 31 | 32 | 33 | License 34 | ------- 35 | 36 | aPLib is freeware. If you use aPLib in a product, an acknowledgement would be 37 | appreciated, e.g. by adding something like the following to the documentation: 38 | 39 | This product uses the aPLib compression library, 40 | Copyright (c) 1998-2014 Joergen Ibsen, All Rights Reserved. 41 | For more information, please visit: http://www.ibsensoftware.com/ 42 | 43 | You may not redistribute aPLib without all of the files. 44 | 45 | You may not edit or reverse engineer any of the files (except the header files 46 | and the decompression code, which you may edit as long as you do not remove 47 | the copyright notice). 48 | 49 | You may not sell aPLib, or any part of it, for money (except for charging for 50 | the media). 51 | 52 | #ifndef COMMON_SENSE 53 | 54 | This software is provided "as is". In no event shall I, the author, be 55 | liable for any kind of loss or damage arising out of the use, abuse or 56 | the inability to use this software. USE IT ENTIRELY AT YOUR OWN RISK! 57 | 58 | This software comes without any kind of warranty, either expressed or 59 | implied, including, but not limited to the implied warranties of 60 | merchantability or fitness for any particular purpose. 61 | 62 | If you do not agree with these terms or if your jurisdiction does not 63 | allow the exclusion of warranty and liability as stated above you are 64 | NOT allowed to use this software at all. 65 | 66 | #else 67 | 68 | Bla bla bla .. the usual stuff - you know it anyway: 69 | 70 | If anything goes even remotely wrong - blame _yourself_, NOT me! 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #depends: 4 | # capstone (newest) 5 | # pefile 6 | # python-capstone 7 | # autoconf 8 | 9 | 10 | if [[ $EUID -ne 0 ]]; then 11 | echo "You must be root" 2>&1 12 | exit 1 13 | fi 14 | 15 | #check if kali 16 | uname -a | grep -i kali &> /dev/null 17 | if [ $? -eq 0 ]; then 18 | apt-get update 19 | apt-get install -y python-capstone autoconf libtool curl libcurl4-openssl-dev 20 | 21 | echo '[*] Install osslsigncode' 22 | cd osslsigncode 23 | ./autogen.sh 24 | ./configure 25 | make 26 | make install 27 | cd .. 28 | 29 | #install appack 30 | uname -a | grep -i "armv" &> /dev/null 31 | if [ $? -ne 0 ]; then 32 | echo "[*] installing appack for onionduke" 33 | sudo apt-get install -y libc6-dev-i386 34 | cd ./aPLib/example/ 35 | gcc -c -I../lib/elf -m32 -Wall -O2 -s -o appack.o appack.c -v 36 | gcc -m32 -Wall -O2 -s -o appack appack.o ../lib/elf/aplib.a -v 37 | sudo cp ./appack /usr/bin/appack 38 | else 39 | echo "Arm not supported for aPLib" 40 | fi 41 | fi 42 | 43 | #other linux 44 | uname -a | grep -v "kali" | grep -i linux &> /dev/null 45 | if [ $? -eq 0 ]; then 46 | 47 | if hash pip 2>/dev/null; then 48 | sudo apt-get install -y python-pip autoconf libtool curl libcurl4-openssl-dev 49 | pip install pefile 50 | #install capstone 51 | pip install capstone 52 | else 53 | echo '[!!!!] Install pefile and capstone manually, pip is not installed' 54 | echo '[!!!!] or install pip and retry' 55 | echo "" 56 | fi 57 | 58 | echo '[*] Install osslsigncode' 59 | cd osslsigncode 60 | ./autogen.sh 61 | ./configure 62 | make 63 | make install 64 | cd .. 65 | 66 | uname -a | grep -i "armv" &> /dev/null 67 | if [ $? -ne 0 ]; then 68 | echo "[*] installing appack for onionduke" 69 | echo "[*] installing dependences" 70 | sudo apt-get install libc6-dev-i386 71 | cd ./aPLib/example/ 72 | gcc -c -I../lib/elf -m32 -Wall -O2 -s -o appack.o appack.c -v 73 | gcc -m32 -Wall -O2 -s -o appack appack.o ../lib/elf/aplib.a -v 74 | sudo cp ./appack /usr/bin/appack 75 | else 76 | echo "[!!!!] Arm not supported for aPLib" 77 | fi 78 | fi 79 | 80 | #OS X appack install 81 | uname -a | grep -i Darwin &> /dev/null 82 | if [ $? -eq 0 ]; then 83 | brew install autoconf 84 | brew install automake 85 | brew install libtool 86 | 87 | pip install pefile 88 | pip install capstone 89 | 90 | echo '[*] Install osslsigncode' 91 | cd osslsigncode 92 | ./autogen.sh 93 | ./configure 94 | make 95 | make install 96 | cd .. 97 | 98 | cd ./aPLib/example/ 99 | clang -c -I../lib/macho64 -Wall -O2 -o appack.o appack.c -v 100 | clang -Wall -O2 -o appack appack.o ../lib/macho64/aplib.a -v 101 | cp ./appack /usr/local/bin/appack 102 | fi 103 | 104 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/appack.inc: -------------------------------------------------------------------------------- 1 | ; ######################################################################### 2 | 3 | ; include files 4 | ; ~~~~~~~~~~~~~ 5 | include \MASM32\INCLUDE\windows.inc 6 | include \MASM32\INCLUDE\masm32.inc 7 | include \MASM32\INCLUDE\gdi32.inc 8 | include \MASM32\INCLUDE\user32.inc 9 | include \MASM32\INCLUDE\kernel32.inc 10 | include \MASM32\INCLUDE\Comctl32.inc 11 | include \MASM32\INCLUDE\comdlg32.inc 12 | include \MASM32\INCLUDE\shell32.inc 13 | include \MASM32\include\oleaut32.inc 14 | include aplib.inc 15 | 16 | ; libraries 17 | ; ~~~~~~~~~ 18 | includelib \MASM32\LIB\masm32.lib 19 | 20 | includelib \MASM32\LIB\gdi32.lib 21 | includelib \MASM32\LIB\user32.lib 22 | includelib \MASM32\LIB\kernel32.lib 23 | includelib \MASM32\LIB\Comctl32.lib 24 | includelib \MASM32\LIB\comdlg32.lib 25 | includelib \MASM32\LIB\shell32.lib 26 | includelib \MASM32\LIB\oleaut32.lib 27 | includelib ..\..\lib\coff\aplib.lib 28 | 29 | ; ######################################################################### 30 | 31 | ;================= 32 | ; Local prototypes 33 | ;================= 34 | WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD 35 | WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD 36 | TopXY PROTO :DWORD,:DWORD 37 | Paint_Proc PROTO :DWORD,:DWORD 38 | PackFile PROTO :DWORD 39 | UnpackFile PROTO 40 | cbProc PROTO C :DWORD,:DWORD,:DWORD,:DWORD 41 | 42 | wsprintfA PROTO C :DWORD,:VARARG 43 | wsprintf equ 44 | 45 | ;============= 46 | ; Local macros 47 | ;============= 48 | 49 | szText MACRO Name, Text:VARARG 50 | LOCAL lbl 51 | jmp lbl 52 | Name db Text,0 53 | lbl: 54 | ENDM 55 | 56 | m2m MACRO M1, M2 57 | push M2 58 | pop M1 59 | ENDM 60 | 61 | return MACRO arg 62 | mov eax, arg 63 | ret 64 | ENDM 65 | 66 | stralloc MACRO ln 67 | invoke SysAllocStringByteLen,0,ln 68 | ENDM 69 | 70 | strfree MACRO strhandle 71 | invoke SysFreeString,strhandle 72 | ENDM 73 | 74 | .data 75 | CommandLine dd 0 76 | hWnd dd 0 77 | hInstance dd 0 78 | hIcon dd 0 79 | hEdit1 dd 0 80 | hButn1 dd 0 81 | hButn2 dd 0 82 | hStat1 dd 0 83 | Packing dd 0 84 | ContPack dd 1 85 | killFlag dd 0 86 | szDisplayName db "aPLib Pack",0 87 | plSelect db "Please Select File First",0 88 | 89 | ; ########################### Inserted modules ############################ 90 | 91 | include toolbar.asm 92 | include filedlgs.asm 93 | include ctrls.asm 94 | 95 | ; ######################################################################### 96 | -------------------------------------------------------------------------------- /osslsigncode/README.unauthblob: -------------------------------------------------------------------------------- 1 | # This is NOT the official repo for osslsigncode 2 | This project was copied from osslsigncode 1.7.1 to apply some patches for compiling with cygwin and being able to add unauthenticated blobs. The official source for the project is at: http://sourceforge.net/projects/osslsigncode/ 3 | 4 | ## Features added 5 | Adds the argument "-addUnauthenticatedBlob" to add a 1024 byte unauthenticated blob of data to the signature in the same area as the timestamp. This can be used while signing, while timestamping (new `add` command added to allow just time-stamping, after a file has been code signed, or by itself. 6 | 7 | Examples: 8 | ``` 9 | # Example 1. Sign and add blob to unsigned file 10 | osslsigncode sign -addUnauthenticatedBlob -pkcs12 yourcert.pfx -pass your_password -n "Your Company" -i https://YourSite.com/ -in srepp.msi -out srepp_added.msi 11 | ``` 12 | 13 | ``` 14 | # Example 2. Timestamp and add blob to signed file 15 | osslsigncode.exe add -addUnauthenticatedBlob -t http://timestamp.verisign.com/scripts/timstamp.dll -in your_signed_file.exe -out out.exe 16 | ``` 17 | 18 | ``` 19 | # Example 3. Add blob to signed and time-stamped file 20 | osslsigncode.exe add -addUnauthenticatedBlob -in your_signed_file.exe -out out.exe 21 | ``` 22 | 23 | ``` 24 | # Example 4. Sign, timestamp, and add blob 25 | # Technically you can do this, but this would mean your signing certificate 26 | # is on a computer that is connected the Internet, 27 | # which means you are doing something wrong, 28 | # so I'm not going to show how to do that. 29 | 30 | ``` 31 | 32 | This technique (but not this project) is used by Dropbox, GoToMeeting, and Summit Route. You can read more about this technique here: 33 | 34 | - https://tech.dropbox.com/2014/08/tech-behind-dropboxs-new-user-experience-for-mobile/ 35 | - http://blogs.msdn.com/b/ieinternals/archive/2014/09/04/personalizing-installers-using-unauthenticated-data-inside-authenticode-signed-binaries.aspx 36 | 37 | 38 | ## WARNING 39 | The capability this adds can allow you to do dumb things. Be very careful with what you put in the unauthenticated blob, as an attacker could modify this. Do NOT under any circumstances put a URL here that you will use to download an additional file. If you do do that, you would need to check the newly downloaded file is code signed AND that it has been signed with your cert AND that it is the version you expect. You should consider using asymmetrical encryption for the data you put in the blob, such that the executable contains the public key to decrypt the data. Basically, be VERY careful. 40 | 41 | 42 | ## Compiling under cygwin 43 | 44 | - Ensure you install the development libraries for openssl, libgfs, and curl. 45 | - Install pkg-config 46 | - Run 47 | ``` 48 | export SHELLOPTS 49 | set -o igncr 50 | ./configure 51 | make 52 | ``` 53 | 54 | ## Download 55 | 56 | - Compiled binary for cygwin: https://summitroute.com/downloads/osslsigncode.exe 57 | - Compiled binary plus all the required DLL's (self-extracting exe): https://summitroute.com/downloads/osslsigncode-cygwin_files.exe 58 | -------------------------------------------------------------------------------- /intel/intelmodules.py: -------------------------------------------------------------------------------- 1 | ''' 2 | 3 | Copyright (c) 2013-2016, Joshua Pitts 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, 7 | are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its contributors 17 | may be used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | 32 | ''' 33 | 34 | 35 | def eat_code_caves(flItms, caveone, cavetwo): 36 | """ 37 | Return the difference between caves RVA positions 38 | """ 39 | 40 | try: 41 | if flItms['CavesPicked'][cavetwo][0] == flItms['CavesPicked'][caveone][0]: 42 | return int(flItms['CavesPicked'][cavetwo][1], 16) - int(flItms['CavesPicked'][caveone][1], 16) 43 | 44 | else: 45 | caveone_found = False 46 | cavetwo_found = False 47 | for section in flItms['Sections']: 48 | if flItms['CavesPicked'][caveone][0] == section[0] and caveone_found is False: 49 | rva_one = int(flItms['CavesPicked'][caveone][1], 16) - int(flItms['CavesPicked'][caveone][4], 16) + flItms['CavesPicked'][caveone][8] 50 | caveone_found = True 51 | 52 | if flItms['CavesPicked'][cavetwo][0] == section[0] and cavetwo_found is False: 53 | rva_two = int(flItms['CavesPicked'][cavetwo][1], 16) - int(flItms['CavesPicked'][cavetwo][4], 16) + flItms['CavesPicked'][cavetwo][8] 54 | cavetwo_found = True 55 | 56 | if caveone_found is True and cavetwo_found is True: 57 | if flItms['CavesPicked'][caveone][1] < flItms['CavesPicked'][cavetwo][1]: 58 | return -(rva_one - rva_two) 59 | else: 60 | return rva_two - rva_one 61 | 62 | except Exception: 63 | return 0 64 | -------------------------------------------------------------------------------- /aPLib/src/64bit/depack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit assembler depacker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aP_depack_asm 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aP_depack_asm: 21 | ; aP_depack_asm(const void *source, void *destination) 22 | 23 | push rbx 24 | push rsi 25 | push rdi 26 | 27 | push rdx 28 | 29 | mov rsi, rcx 30 | mov rdi, rdx 31 | 32 | cld 33 | mov dl, 80h 34 | xor ebx, ebx 35 | 36 | literal: 37 | movsb 38 | mov bl, 2 39 | nexttag: 40 | call getbit 41 | jnc literal 42 | 43 | xor ecx, ecx 44 | call getbit 45 | jnc codepair 46 | xor eax, eax 47 | call getbit 48 | jnc shortmatch 49 | mov bl, 2 50 | inc ecx 51 | mov al, 10h 52 | .getmorebits: 53 | call getbit 54 | adc al, al 55 | jnc .getmorebits 56 | jnz domatch 57 | stosb 58 | jmp nexttag 59 | codepair: 60 | call getgamma_no_ecx 61 | sub ecx, ebx 62 | jnz normalcodepair 63 | call getgamma 64 | jmp domatch_lastpos 65 | 66 | shortmatch: 67 | lodsb 68 | shr eax, 1 69 | jz donedepacking 70 | adc ecx, ecx 71 | jmp domatch_with_2inc 72 | 73 | normalcodepair: 74 | xchg eax, ecx 75 | dec eax 76 | shl eax, 8 77 | lodsb 78 | call getgamma 79 | 80 | cmp eax, 32000 81 | jae short domatch_with_2inc 82 | cmp ah, 5 83 | jae short domatch_with_inc 84 | cmp eax, 7fh 85 | ja short domatch_new_lastpos 86 | 87 | domatch_with_2inc: 88 | inc ecx 89 | 90 | domatch_with_inc: 91 | inc ecx 92 | 93 | domatch_new_lastpos: 94 | xchg eax, r8d 95 | domatch_lastpos: 96 | mov eax, r8d 97 | 98 | mov bl, 1 99 | 100 | domatch: 101 | push rsi 102 | mov rsi, rdi 103 | sub rsi, rax 104 | rep movsb 105 | pop rsi 106 | jmp nexttag 107 | 108 | getbit: 109 | add dl, dl 110 | jnz .stillbitsleft 111 | mov dl, [rsi] 112 | inc rsi 113 | adc dl, dl 114 | .stillbitsleft: 115 | ret 116 | 117 | getgamma: 118 | xor ecx, ecx 119 | getgamma_no_ecx: 120 | inc ecx 121 | .getgammaloop: 122 | call getbit 123 | adc ecx, ecx 124 | call getbit 125 | jc .getgammaloop 126 | ret 127 | 128 | donedepacking: 129 | pop rdx 130 | sub rdi, rdx 131 | xchg eax, edi 132 | 133 | pop rdi 134 | pop rsi 135 | pop rbx 136 | 137 | ret 138 | 139 | ; ============================================================= 140 | -------------------------------------------------------------------------------- /aPLib/contrib/delphi/aplib.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * Delphi aPLib wrapper for example 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> Delphi by Solodovnikov Alexey 21.03.1999 (alenka@mail.line.ru) 12 | *) 13 | 14 | unit aPLib; 15 | 16 | interface 17 | 18 | uses 19 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 20 | (*$IFDEF DYNAMIC_VERSION*) 21 | aPLibud; 22 | (*$ELSE*) 23 | aPLibu; 24 | (*$ENDIF*) 25 | 26 | const 27 | aP_pack_break : DWORD = 0; 28 | aP_pack_continue : DWORD = 1; 29 | 30 | aPLib_Error : DWORD = DWORD(-1); (* indicates error compressing/decompressing *) 31 | 32 | type 33 | 34 | TaPLib = class(TComponent) 35 | private 36 | FWorkMem : Pointer; 37 | FLength : DWORD; 38 | FSource : Pointer; 39 | FDestination : Pointer; 40 | 41 | protected 42 | 43 | public 44 | 45 | CallBack : TaPack_Status; 46 | 47 | procedure Pack; 48 | procedure DePack; 49 | 50 | property Source : Pointer read FSource write FSource; 51 | property Destination : Pointer read FDestination write FDestination; 52 | property Length : DWORD read FLength write FLength; 53 | 54 | published 55 | 56 | end; 57 | 58 | procedure Register; 59 | 60 | implementation 61 | 62 | procedure Register; 63 | begin 64 | RegisterComponents('Samples', [TaPLib]); 65 | end; 66 | 67 | procedure TaPLib.Pack; 68 | begin 69 | if FDestination <> nil then 70 | begin 71 | FreeMem(FDestination); 72 | FDestination := nil; 73 | end; 74 | 75 | if FWorkMem <> nil then 76 | begin 77 | FreeMem(FWorkMem); 78 | FWorkMem := nil; 79 | end; 80 | 81 | GetMem(FDestination,_aP_max_packed_size(FLength)); 82 | if FDestination = nil then raise Exception.Create('Out of memory'); 83 | 84 | GetMem(FWorkMem,_aP_workmem_size(FLength)); 85 | if FWorkMem = nil then raise Exception.Create('Out of memory'); 86 | 87 | FLength := _aPsafe_pack(FSource^, FDestination^, FLength, FWorkMem^, CallBack, nil); 88 | 89 | if FLength = aPLib_Error then raise Exception.Create('Compression error'); 90 | end; 91 | 92 | procedure TaPLib.DePack; 93 | var 94 | DLength : DWORD; 95 | begin 96 | if FDestination <> nil then 97 | begin 98 | FreeMem(FDestination); 99 | FDestination := nil; 100 | end; 101 | 102 | DLength := _aPsafe_get_orig_size(FSource^); 103 | if DLength = aPLib_Error then raise Exception.Create('File is not packed with aPLib'); 104 | 105 | Getmem(FDestination, DLength); 106 | if FDestination = nil then raise Exception.Create('Out of memory'); 107 | 108 | FLength := _aPsafe_depack(FSource^, FLength, FDestination^, DLength); 109 | 110 | if FLength = aPLib_Error then raise Exception.Create('Decompression error'); 111 | end; 112 | 113 | end. 114 | -------------------------------------------------------------------------------- /aPLib/src/32bit/depack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm assembler depacker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aP_depack_asm as '_aP_depack_asm' 15 | 16 | ; ============================================================= 17 | 18 | section '.text' code readable executable 19 | 20 | aP_depack_asm: 21 | ; aP_depack_asm(const void *source, void *destination) 22 | 23 | _ret$ equ 7*4 24 | _src$ equ 8*4 + 4 25 | _dst$ equ 8*4 + 8 26 | 27 | pushad 28 | 29 | mov esi, [esp + _src$] ; C calling convention 30 | mov edi, [esp + _dst$] 31 | 32 | cld 33 | mov dl, 80h 34 | xor ebx,ebx 35 | 36 | literal: 37 | movsb 38 | mov bl, 2 39 | nexttag: 40 | call getbit 41 | jnc literal 42 | 43 | xor ecx, ecx 44 | call getbit 45 | jnc codepair 46 | xor eax, eax 47 | call getbit 48 | jnc shortmatch 49 | mov bl, 2 50 | inc ecx 51 | mov al, 10h 52 | .getmorebits: 53 | call getbit 54 | adc al, al 55 | jnc .getmorebits 56 | jnz domatch 57 | stosb 58 | jmp nexttag 59 | codepair: 60 | call getgamma_no_ecx 61 | sub ecx, ebx 62 | jnz normalcodepair 63 | call getgamma 64 | jmp domatch_lastpos 65 | 66 | shortmatch: 67 | lodsb 68 | shr eax, 1 69 | jz donedepacking 70 | adc ecx, ecx 71 | jmp domatch_with_2inc 72 | 73 | normalcodepair: 74 | xchg eax, ecx 75 | dec eax 76 | shl eax, 8 77 | lodsb 78 | call getgamma 79 | 80 | cmp eax, 32000 81 | jae domatch_with_2inc 82 | cmp ah, 5 83 | jae domatch_with_inc 84 | cmp eax, 7fh 85 | ja domatch_new_lastpos 86 | 87 | domatch_with_2inc: 88 | inc ecx 89 | 90 | domatch_with_inc: 91 | inc ecx 92 | 93 | domatch_new_lastpos: 94 | xchg eax, ebp 95 | domatch_lastpos: 96 | mov eax, ebp 97 | 98 | mov bl, 1 99 | 100 | domatch: 101 | push esi 102 | mov esi, edi 103 | sub esi, eax 104 | rep movsb 105 | pop esi 106 | jmp nexttag 107 | 108 | getbit: 109 | add dl, dl 110 | jnz .stillbitsleft 111 | mov dl, [esi] 112 | inc esi 113 | adc dl, dl 114 | .stillbitsleft: 115 | ret 116 | 117 | getgamma: 118 | xor ecx, ecx 119 | getgamma_no_ecx: 120 | inc ecx 121 | .getgammaloop: 122 | call getbit 123 | adc ecx, ecx 124 | call getbit 125 | jc .getgammaloop 126 | ret 127 | 128 | donedepacking: 129 | sub edi, [esp + _dst$] 130 | mov [esp + _ret$], edi ; return unpacked length in eax 131 | 132 | popad 133 | 134 | ret 135 | 136 | ; ============================================================= 137 | -------------------------------------------------------------------------------- /aPLib/src/64bit/spack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit safe assembler wrapper for aP_pack 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | ; header format: 13 | ; 14 | ; offs size data 15 | ; -------------------------------------- 16 | ; 0 dword tag ('AP32') 17 | ; 4 dword header_size (24 bytes) 18 | ; 8 dword packed_size 19 | ; 12 dword packed_crc 20 | ; 16 dword orig_size 21 | ; 20 dword orig_crc 22 | 23 | format MS64 COFF 24 | 25 | public aPsafe_pack 26 | 27 | extrn aP_pack 28 | extrn aP_crc32 29 | 30 | ; ============================================================= 31 | 32 | section '.text' code readable executable 33 | 34 | aPsafe_pack: 35 | ; aPsafe_pack(const void *source, 36 | ; void *destination, 37 | ; unsigned int length, 38 | ; void *workmem, 39 | ; int (*callback)(unsigned int, unsigned int, void *), 40 | ; void *cbparam) 41 | 42 | mov [rsp + 8], rcx 43 | mov [rsp + 16], rdx 44 | mov [rsp + 24], r8 45 | mov [rsp + 32], r9 46 | push rdi 47 | sub rsp, 48 48 | 49 | mov rdi, rdx ; rdi -> destination 50 | 51 | or rax, -1 ; rax = -1 52 | 53 | test rcx, rcx ; check parameters 54 | jz .return_rax ; 55 | test rdx, rdx ; 56 | jz .return_rax ; 57 | test r8, r8 ; 58 | jz .return_rax ; 59 | 60 | mov edx, 032335041h 61 | mov [rdi], edx ; set header.tag 62 | 63 | mov edx, 24 64 | mov [rdi + 4], edx ; set header.header_size 65 | 66 | mov rdx, r8 67 | mov [rdi + 16], edx ; set header.orig_size 68 | 69 | call aP_crc32 70 | 71 | mov [rdi + 20], eax ; set header.orig_crc 72 | 73 | mov r10, [rsp + 96] ; r10 -> callback 74 | mov r11, [rsp + 104] ; r11 = cbparam 75 | 76 | mov rcx, [rsp + 64] 77 | mov rdx, [rsp + 72] 78 | mov r8, [rsp + 80] 79 | mov r9, [rsp + 88] 80 | mov [rsp + 32], r10 81 | mov [rsp + 40], r11 82 | add rdx, 24 ; rdx -> after header 83 | 84 | call aP_pack 85 | 86 | cmp eax, -1 87 | je .return_rax 88 | 89 | mov [rdi + 8], eax ; set header.packed_size 90 | 91 | mov rcx, [rsp + 72] ; rcx -> destination 92 | mov rdx, rax ; rdx = packed size 93 | add rcx, 24 ; rcx -> after header 94 | 95 | call aP_crc32 96 | 97 | mov [rdi + 12], eax ; set header.packed_crc 98 | 99 | mov eax, [rdi + 8] ; eax = header.packed_size 100 | add rax, 24 ; rax = final size 101 | 102 | .return_rax: 103 | add rsp, 48 104 | pop rdi 105 | 106 | ret 107 | 108 | ; ============================================================= 109 | -------------------------------------------------------------------------------- /aPLib/contrib/masm32/toolbar.asm: -------------------------------------------------------------------------------- 1 | ; ######################################################################## 2 | 3 | Do_ToolBar PROTO :DWORD 4 | SetBmpColor PROTO :DWORD 5 | 6 | include tbmacros.asm 7 | 8 | .data 9 | hTbBmp dd 0 10 | hToolBar dd 0 11 | 12 | .code 13 | 14 | ; ######################################################################## 15 | 16 | Do_ToolBar proc hWin :DWORD 17 | 18 | ; --------------------------------------- 19 | ; This proc works by using macros so that 20 | ; the code is easier to read and modify 21 | ; --------------------------------------- 22 | 23 | LOCAL bSize :DWORD 24 | LOCAL tbab :TBADDBITMAP 25 | LOCAL tbb :TBBUTTON 26 | 27 | ; ------------------ 28 | ; The toolbar bitmap 29 | ; ~~~~~~~~~~~~~~~~~~ 30 | ; You must supply a bitmap for the toolbar that has the 31 | ; correct number of the required images, each of the same 32 | ; size and in the following strip bitmap form. 33 | 34 | ; ------------------------------------- 35 | ; | 1 | 2 | 3 | 4 | 5 | 6 | 36 | ; ------------------------------------- 37 | 38 | ; ------------------------ 39 | ; Uncomment following when 40 | ; bitmap has been created 41 | ; ------------------------ 42 | invoke LoadBitmap,hInstance,750 43 | mov hTbBmp,eax 44 | 45 | ; -------------------------------------------------- 46 | ; Set toolbar button dimensions here, width & height 47 | ; -------------------------------------------------- 48 | Create_Tool_Bar 75, 75 49 | 50 | TBextraData ; additional data for TBBUTTON structure 51 | 52 | ; ----------------------------------- 53 | ; Add toolbar buttons and spaces here 54 | ; Syntax for the macro TBbutton is 55 | ; TBbutton bmpID number, WM_COMMAND ID number 56 | ; WM_COMMAND ID numbers start at 50 57 | ; ----------------------------------- 58 | TBbutton 0, 50 59 | TBbutton 1, 51 60 | TBbutton 2, 52 61 | TBbutton 3, 53 62 | 63 | ret 64 | 65 | Do_ToolBar endp 66 | 67 | ; ######################################################################## 68 | 69 | SetBmpColor proc hBitmap:DWORD 70 | 71 | LOCAL mDC :DWORD 72 | LOCAL hBrush :DWORD 73 | LOCAL hOldBmp :DWORD 74 | LOCAL hReturn :DWORD 75 | LOCAL hOldBrush :DWORD 76 | 77 | invoke CreateCompatibleDC,NULL 78 | mov mDC,eax 79 | 80 | invoke SelectObject,mDC,hBitmap 81 | mov hOldBmp,eax 82 | 83 | invoke GetSysColor,COLOR_BTNFACE 84 | invoke CreateSolidBrush,eax 85 | mov hBrush,eax 86 | 87 | invoke SelectObject,mDC,hBrush 88 | mov hOldBrush,eax 89 | 90 | invoke GetPixel,mDC,1,1 91 | invoke ExtFloodFill,mDC,1,1,eax,FLOODFILLSURFACE 92 | 93 | invoke SelectObject,mDC,hOldBrush 94 | invoke DeleteObject,hBrush 95 | 96 | invoke SelectObject,mDC,hBitmap 97 | mov hReturn,eax 98 | invoke DeleteDC,mDC 99 | 100 | mov eax,hReturn 101 | 102 | ret 103 | 104 | SetBmpColor endp 105 | 106 | ; ######################################################################### 107 | -------------------------------------------------------------------------------- /aPLib/src/64bit/sdepack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit safe assembler wrapper for aP_depack_asm_safe 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aPsafe_depack 15 | 16 | extrn aP_depack_asm_safe 17 | extrn aP_crc32 18 | 19 | ; ============================================================= 20 | 21 | section '.text' code readable executable 22 | 23 | aPsafe_depack: 24 | ; aPsafe_depack(const void *source, 25 | ; size_t srclen, 26 | ; void *destination 27 | ; size_t dstlen) 28 | 29 | mov [rsp + 8], rcx 30 | mov [rsp + 16], rdx 31 | mov [rsp + 24], r8 32 | mov [rsp + 32], r9 33 | push rdi 34 | sub rsp, 32 35 | 36 | mov rdi, rcx ; rdi -> source 37 | 38 | test rcx, rcx 39 | jz .return_error 40 | 41 | test r8, r8 42 | jz .return_error 43 | 44 | cmp rdx, 24 ; check srclen >= 24 45 | jb .return_error ; 46 | 47 | mov eax, [rdi] ; eax = header.tag 48 | 49 | cmp eax, 032335041h ; check tag == 'AP32' 50 | jne .return_error 51 | 52 | mov eax, [rdi + 4] ; rax = header.header_size 53 | cmp eax, 24 ; check header_size >= 24 54 | jb .return_error 55 | 56 | sub rdx, rax ; rdx = srclen without header 57 | jc .return_error ; 58 | 59 | cmp [rdi + 8], edx ; check header.packed_size is 60 | ja .return_error ; within remaining srclen 61 | 62 | add rcx, rax ; rcx -> packed data 63 | 64 | mov edx, [rdi + 8] ; rdx = header.packed_size 65 | 66 | call aP_crc32 67 | 68 | cmp eax, [rdi + 12] ; check eax == header.packed_crc 69 | jne .return_error 70 | 71 | mov r9, [rsp + 72] ; r9 = dstlen 72 | 73 | mov edx, [rdi + 16] ; rdx = header.orig_size 74 | cmp rdx, r9 ; check header.orig_size is ok 75 | ja .return_error 76 | 77 | mov eax, [rdi + 4] ; rax = header.header_size 78 | 79 | mov rcx, [rsp + 48] ; rcx -> source 80 | mov edx, [rdi + 8] ; rdx = header.packed_size 81 | mov r8, [rsp + 64] ; r8 -> destination 82 | 83 | add rcx, rax ; rcx -> compressed data 84 | 85 | call aP_depack_asm_safe 86 | 87 | mov edx, [rdi + 16] ; rdx = header.orig_size 88 | 89 | cmp rax, rdx ; check rax == header.orig_size 90 | jne .return_error 91 | 92 | mov rcx, [rsp + 64] ; rcx -> destination 93 | 94 | call aP_crc32 95 | 96 | cmp eax, [rdi + 20] ; check eax = header.orig_crc 97 | 98 | mov eax, [rdi + 16] ; rax = header.orig_size 99 | 100 | je .return_rax 101 | 102 | .return_error: 103 | or rax, -1 ; rax = -1 104 | 105 | .return_rax: 106 | add rsp, 32 107 | pop rdi 108 | 109 | ret 110 | 111 | ; ============================================================= 112 | -------------------------------------------------------------------------------- /aPLib/src/32bit/sdepack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm safe assembler wrapper for aP_depack_asm_safe 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aPsafe_depack as '_aPsafe_depack' 15 | 16 | extrn '_aP_depack_asm_safe' as aP_depack_asm_safe 17 | extrn '_aP_crc32' as aP_crc32 18 | 19 | ; ============================================================= 20 | 21 | section '.text' code readable executable 22 | 23 | aPsafe_depack: 24 | ; aPsafe_depack(const void *source, 25 | ; size_t srclen, 26 | ; void *destination 27 | ; size_t dstlen) 28 | 29 | .ret$ equ 7*4 30 | .src$ equ 8*4 + 4 31 | .slen$ equ 8*4 + 8 32 | .dst$ equ 8*4 + 12 33 | .dlen$ equ 8*4 + 16 34 | 35 | pushad 36 | 37 | mov esi, [esp + .src$] ; esi -> inbuffer 38 | mov ecx, [esp + .slen$] ; ecx = srclen 39 | mov edi, [esp + .dst$] ; edi -> outbuffer 40 | 41 | test esi, esi 42 | jz .return_error 43 | 44 | test edi, edi 45 | jz .return_error 46 | 47 | cmp ecx, 24 ; check srclen >= 24 48 | jb .return_error 49 | 50 | mov ebx, [esi] ; ebx = header.tag 51 | 52 | cmp ebx, 032335041h ; check tag == 'AP32' 53 | jne .return_error 54 | 55 | mov ebx, [esi + 4] ; ebx = header.header_size 56 | cmp ebx, 24 ; check header_size >= 24 57 | jb .return_error 58 | 59 | sub ecx, ebx ; ecx = srclen without header 60 | jc .return_error 61 | 62 | cmp [esi + 8], ecx ; check header.packed_size is 63 | ja .return_error ; within remaining srclen 64 | 65 | add ebx, esi ; ebx -> packed data 66 | 67 | push dword [esi + 8] ; push header.packed_size 68 | push ebx 69 | call aP_crc32 70 | add esp, 8 71 | 72 | cmp eax, [esi + 12] ; check eax == header.packed_crc 73 | jne .return_error 74 | 75 | mov ecx, [esp + .dlen$] ; ecx = dstlen 76 | cmp [esi + 16], ecx ; check header.orig_size is ok 77 | ja .return_error 78 | 79 | push ecx ; push dstlen 80 | push edi 81 | push dword [esi + 8] ; push header.packed_size 82 | push ebx 83 | call aP_depack_asm_safe 84 | add esp, 16 85 | 86 | cmp eax, [esi + 16] ; check eax == header.orig_size 87 | jne .return_error 88 | 89 | mov ebx, eax ; ebx = unpacked size 90 | 91 | push eax 92 | push edi 93 | call aP_crc32 94 | add esp, 8 95 | 96 | cmp eax, [esi + 20] ; check eax == header.orig_crc 97 | 98 | mov eax, ebx ; eax = unpacked size 99 | 100 | je .return_eax 101 | 102 | .return_error: 103 | or eax, -1 ; eax = -1 104 | 105 | .return_eax: 106 | mov [esp + .ret$], eax ; return unpacked length in eax 107 | 108 | popad 109 | 110 | ret 111 | 112 | ; ============================================================= 113 | -------------------------------------------------------------------------------- /aPLib/src/32bit/spack.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm safe assembler wrapper for aP_pack 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | ; header format: 13 | ; 14 | ; offs size data 15 | ; -------------------------------------- 16 | ; 0 dword tag ('AP32') 17 | ; 4 dword header_size (24 bytes) 18 | ; 8 dword packed_size 19 | ; 12 dword packed_crc 20 | ; 16 dword orig_size 21 | ; 20 dword orig_crc 22 | 23 | format MS COFF 24 | 25 | public aPsafe_pack as '_aPsafe_pack' 26 | 27 | extrn '_aP_pack' as aP_pack 28 | extrn '_aP_crc32' as aP_crc32 29 | 30 | ; ============================================================= 31 | 32 | section '.text' code readable executable 33 | 34 | aPsafe_pack: 35 | ; aPsafe_pack(const void *source, 36 | ; void *destination, 37 | ; unsigned int length, 38 | ; void *workmem, 39 | ; int (*callback)(unsigned int, unsigned int, void *), 40 | ; void *cbparam) 41 | 42 | .ret$ equ 7*4 43 | .src$ equ 8*4 + 4 44 | .dst$ equ 8*4 + 8 45 | .len$ equ 8*4 + 12 46 | .wmem$ equ 8*4 + 16 47 | .cb$ equ 8*4 + 20 48 | .cbp$ equ 8*4 + 24 49 | 50 | pushad 51 | 52 | mov ebp, esp 53 | 54 | mov esi, [ebp + .src$] ; esi -> inbuffer 55 | mov edi, [ebp + .dst$] ; edi -> outbuffer 56 | mov ecx, [ebp + .len$] ; ecx = length 57 | 58 | or eax, -1 ; eax = -1 59 | 60 | test esi, esi ; check parameters 61 | jz .return_eax ; 62 | test edi, edi ; 63 | jz .return_eax ; 64 | test ecx, ecx ; 65 | jz .return_eax ; 66 | 67 | mov ebx, 032335041h 68 | mov [edi], ebx ; set header.tag 69 | mov ebx, 24 70 | mov [edi + 4], ebx ; set header.header_size 71 | 72 | add ebx, edi ; ebx -> destination for packed data 73 | 74 | mov [edi + 16], ecx ; set header.orig_size 75 | 76 | push ecx 77 | push esi 78 | call aP_crc32 79 | add esp, 8 80 | 81 | mov [edi + 20], eax ; set header.orig_crc 82 | 83 | push dword [ebp + .cbp$] ; callback param 84 | push dword [ebp + .cb$] ; callback 85 | push dword [ebp + .wmem$] ; workmem 86 | push ecx ; length 87 | push ebx ; destination 88 | push esi ; source 89 | call aP_pack 90 | add esp, 24 91 | 92 | cmp eax, -1 93 | je .return_eax 94 | 95 | mov [edi + 8], eax ; set header.packed_size 96 | 97 | mov edx, eax ; edx = packed size 98 | 99 | push eax 100 | push ebx 101 | call aP_crc32 102 | add esp, 8 103 | 104 | mov [edi + 12], eax ; set header.packed_crc 105 | 106 | lea eax, [edx + 24] ; eax = packed size + header size 107 | 108 | .return_eax: 109 | mov [esp + .ret$], eax ; return unpacked length in eax 110 | 111 | popad 112 | 113 | ret 114 | 115 | ; ============================================================= 116 | -------------------------------------------------------------------------------- /osslsigncode/ChangeLog: -------------------------------------------------------------------------------- 1 | === 1.8 (2015-xx-xx) 2 | 3 | - add support for pkcs11-based hardware tokens 4 | (Patch from Leif Johansson) 5 | - improved error reporting of timestamping errors 6 | (Patch from Carlo Teubner) 7 | 8 | === 1.7.1 (2014-07-11) 9 | 10 | - MSI: added -add-msi-dse option 11 | (Patch from Mikkel Krautz) 12 | - MSI: fix build when GSF_CAN_READ_MSI_METADATA defined 13 | (Patch from Mikkel Krautz) 14 | 15 | === 1.7 (2014-07-10) 16 | 17 | - add support for nested signatures 18 | (Patch from Mikkel Krautz) 19 | - fix compilation problem with OpenSSL < 1.0.0 20 | - added OpenSSL linkage exception to license 21 | 22 | === 1.6 (2014-01-21) 23 | 24 | - add support for reading password from file 25 | - add support for asking for password (on systems that 26 | provide support for it) 27 | - add support for compiling and running on Windows 28 | (Patch from Heiko Hund) 29 | - fix compilation without curl 30 | (Fix from Heiko Hund) 31 | - added support for giving multiple timestamp servers 32 | as arguments (first one that succeeds will be used) 33 | - signatures on hierarchical MSI files were broken 34 | (Fix from Mikkel Krautz) 35 | - MSI: Add support for MsiDigitalSignatureEx signature 36 | (Patch from Mikkel Krautz) 37 | - add support for adding additional/cross certificates 38 | through -ac option 39 | (Thanks to Lars Munch for idea + testing) 40 | - MSI: Add support for signature extract/remove/verify 41 | (Patches from Mikkel Krautz) 42 | - PE/MSI: Implement -require-leaf-hash for verify. 43 | (Patch from Mikkel Krautz) 44 | 45 | === 1.5.2 (2013-03-13) 46 | 47 | - added support for signing with SHA-384 and SHA-512 48 | - added support for page hashing (-ph option) 49 | 50 | === 1.5.1 (2013-03-12) 51 | 52 | - forgot to bump version number... 53 | 54 | === 1.5 (2013-03-12) 55 | 56 | - added support for signing MSI files (patch from Marc-André Lureau) 57 | - calculate correct PE checksum instead of setting it to 0 58 | (patch from Roland Schwingel) 59 | - added support for RFC3161 timestamping (-ts option) 60 | - added support for extracting/removing/verifying signature on PE files 61 | - fixed problem with not being able to decode timestamps with no newlines 62 | - added stricter checks for PE file validity 63 | - added support for reading keys from PVK files (requires OpenSSL 1.0.0 or later) 64 | - added support for reading certificates from PEM files 65 | - renamed program option: -spc to -certs (old option name still valid) 66 | 67 | 68 | === 1.4 (2011-08-12) 69 | 70 | - improved build system (patch from Alon Bar-Lev) 71 | - support reading cert+key from PKCS12 file (patch from Alon Bar-Lev) 72 | - support reading key from PEM file 73 | - added support for sha1/sha256 - default hash is now sha1 74 | - added flag for commercial signing (default is individual) 75 | 76 | === 1.3.1 (2009-08-07) 77 | 78 | - support signing of 64-bit executables (fix from Paul Kendall) 79 | 80 | === 1.3 (2008-01-31) 81 | 82 | - fixed padding problem (fix from Ryan Rubley) 83 | - allow signing of already signed files (fix from Ryan Rubley) 84 | - added Ryan Rubley's PVK-to-DER guide into the README 85 | 86 | === 1.2 (2005-01-21) 87 | 88 | - autoconf:ed (Thanks to Roy Keene) 89 | - added documentation 90 | - don't override PKCS7_get_signed_attribute, it wasn't 91 | actually needed, it was me being confused. 92 | - compiles without curl, which means no timestamping 93 | - version number output 94 | 95 | === 1.1 (2005-01-19) 96 | 97 | - Initial release 98 | -------------------------------------------------------------------------------- /osslsigncode/configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.60) 2 | 3 | AC_INIT([osslsigncode], [1.7.1], [pallansson@gmail.com]) 4 | AC_CONFIG_AUX_DIR([.]) 5 | AC_CONFIG_HEADERS([config.h]) 6 | AM_INIT_AUTOMAKE 7 | 8 | AC_CONFIG_SRCDIR([osslsigncode.c]) 9 | 10 | dnl Checks for programs. 11 | AC_PROG_CC 12 | AC_USE_SYSTEM_EXTENSIONS 13 | 14 | AC_ARG_ENABLE( 15 | [strict], 16 | [AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@disabled@:>@])], 17 | , 18 | [enable_strict="no"] 19 | ) 20 | 21 | AC_ARG_ENABLE( 22 | [pedantic], 23 | [AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])], 24 | , 25 | [enable_pedantic="no"] 26 | ) 27 | 28 | AC_ARG_WITH( 29 | [curl], 30 | [AS_HELP_STRING([--with-curl],[enable curl @<:@enabled@:>@])], 31 | , 32 | [with_curl="yes"] 33 | ) 34 | 35 | if test "${enable_pedantic}" = "yes"; then 36 | enable_strict="yes"; 37 | CFLAGS="${CFLAGS} -pedantic" 38 | fi 39 | if test "${enable_strict}" = "yes"; then 40 | CFLAGS="${CFLAGS} -Wall -Wextra" 41 | fi 42 | 43 | PKG_PROG_PKG_CONFIG 44 | AC_PROG_CPP 45 | AC_PROG_INSTALL 46 | AC_PROG_LN_S 47 | AC_PROG_MKDIR_P 48 | AC_PROG_SED 49 | AC_PROG_MAKE_SET 50 | 51 | AC_C_CONST 52 | AC_HEADER_STDC 53 | AC_HEADER_TIME 54 | AC_CHECK_HEADERS( 55 | [sys/mman.h], 56 | [AC_CHECK_FUNC( 57 | [mmap], 58 | [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])], 59 | [AC_MSG_ERROR([Need mmap to build.])] 60 | )], 61 | [have_mmap=no] 62 | ) 63 | AC_CHECK_HEADERS( 64 | [windows.h], 65 | [], 66 | [have_MapViewOfFile=no] 67 | ) 68 | AS_IF([test "x$have_mmap$have_MapViewOfFile" = "xnono"], 69 | [AC_MSG_ERROR([Need file mapping function to buid.])]) 70 | 71 | AC_CHECK_LIB( 72 | [dl], 73 | [dlopen], 74 | [DL_LIBS="-ldl"] 75 | ) 76 | 77 | AC_CHECK_HEADERS([termios.h]) 78 | AC_CHECK_FUNCS(getpass) 79 | 80 | AC_ARG_WITH([gsf], 81 | AS_HELP_STRING([--without-gsf], [Ignore presence of libgsf and disable it]) 82 | ) 83 | AS_IF([test "x$with_gsf" != "xno"], 84 | [PKG_CHECK_MODULES([GSF], [libgsf-1], [have_gsf=yes], [have_gsf=no])], 85 | [have_gsf=no] 86 | ) 87 | AS_IF([test "x$have_gsf" = "xyes"], 88 | [AC_DEFINE([WITH_GSF], 1, [Have libgsf?])], 89 | [AS_IF([test "x$with_gsf" = "xyes"], 90 | [AC_MSG_ERROR([libgsf requested but not found])])] 91 | ) 92 | 93 | 94 | PKG_CHECK_MODULES( 95 | [OPENSSL], 96 | [libcrypto >= 0.9.8], 97 | , 98 | [PKG_CHECK_MODULES( 99 | [OPENSSL], 100 | [openssl >= 0.9.8], 101 | , 102 | [AC_CHECK_LIB( 103 | [crypto], 104 | [RSA_verify], 105 | [OPENSSL_LIBS="-lcrypto ${SOCKETS_LIBS} ${DL_LIBS}"], 106 | [AC_MSG_ERROR([OpenSSL 0.9.8 or later is required. http://www.openssl.org/])], 107 | [${DL_LIBS}] 108 | )] 109 | )] 110 | ) 111 | 112 | PKG_CHECK_MODULES( 113 | [LIBCURL], 114 | [libcurl >= 7.12.0], 115 | , 116 | [AC_CHECK_LIB( 117 | [curl], 118 | [curl_easy_strerror], 119 | [LIBCURL_LIBS="-lcurl"], 120 | , 121 | [${DL_LIBS}] 122 | )] 123 | ) 124 | 125 | if test "${with_curl}" = "yes"; then 126 | test -z "${LIBCURL_LIBS}" && AC_MSG_ERROR([Curl 7.12.0 or later is required for timestamping support. http://curl.haxx.se/]) 127 | OPTIONAL_LIBCURL_CFLAGS="${LIBCURL_CFLAGS}" 128 | OPTIONAL_LIBCURL_LIBS="${LIBCURL_LIBS}" 129 | AC_DEFINE([ENABLE_CURL], [1], [libcurl is enabled]) 130 | fi 131 | 132 | AC_SUBST([OPTIONAL_LIBCURL_CFLAGS]) 133 | AC_SUBST([OPTIONAL_LIBCURL_LIBS]) 134 | 135 | AC_CONFIG_FILES([Makefile]) 136 | AC_OUTPUT 137 | -------------------------------------------------------------------------------- /aPLib/doc/html/search.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Search — aPLib 1.1.1 documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 46 | 47 |
48 |
49 |
50 |
51 | 52 |

Search

53 |
54 | 55 |

56 | Please activate JavaScript to enable the search 57 | functionality. 58 |

59 |
60 |

61 | From here you can search these documents. Enter your search 62 | words into the box below and click "search". Note that the search 63 | function will automatically search for all of the words. Pages 64 | containing fewer words won't appear in the result list. 65 |

66 |
67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 |
75 | 76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | 94 | 98 | 99 | -------------------------------------------------------------------------------- /aPLib/src/32bit/depackf.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm fast assembler depacker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS COFF 13 | 14 | public aP_depack_asm_fast as '_aP_depack_asm_fast' 15 | 16 | ; ============================================================= 17 | 18 | macro getbitM 19 | { 20 | local .stillbitsleft 21 | add dl, dl 22 | jnz .stillbitsleft 23 | mov dl, [esi] 24 | inc esi 25 | adc dl, dl 26 | .stillbitsleft: 27 | } 28 | 29 | macro domatchM reg 30 | { 31 | push esi 32 | mov esi, edi 33 | sub esi, reg 34 | rep movsb 35 | pop esi 36 | } 37 | 38 | macro getgammaM reg 39 | { 40 | local .getmore 41 | 42 | mov reg, 1 43 | .getmore: 44 | getbitM 45 | adc reg, reg 46 | getbitM 47 | jc .getmore 48 | } 49 | 50 | ; ============================================================= 51 | 52 | section '.text' code readable executable 53 | 54 | aP_depack_asm_fast: 55 | ; aP_depack_asm_fast(const void *source, void *destination) 56 | 57 | _ret$ equ 7*4 58 | _src$ equ 8*4 + 4 59 | _dst$ equ 8*4 + 8 60 | 61 | pushad 62 | 63 | mov esi, [esp + _src$] ; C calling convention 64 | mov edi, [esp + _dst$] 65 | 66 | cld 67 | mov dl, 80h 68 | 69 | literal: 70 | mov al, [esi] 71 | add esi, 1 72 | mov [edi], al 73 | add edi, 1 74 | 75 | mov ebx, 2 76 | 77 | nexttag: 78 | getbitM 79 | jnc literal 80 | 81 | getbitM 82 | jnc codepair 83 | 84 | xor eax, eax 85 | getbitM 86 | jnc shortmatch 87 | 88 | getbitM 89 | adc eax, eax 90 | getbitM 91 | adc eax, eax 92 | getbitM 93 | adc eax, eax 94 | getbitM 95 | adc eax, eax 96 | jz .thewrite 97 | 98 | mov ebx, edi 99 | sub ebx, eax 100 | mov al, [ebx] 101 | 102 | .thewrite: 103 | mov [edi], al 104 | inc edi 105 | 106 | mov ebx, 2 107 | jmp nexttag 108 | 109 | codepair: 110 | getgammaM eax 111 | sub eax, ebx 112 | mov ebx, 1 113 | jnz normalcodepair 114 | 115 | getgammaM ecx 116 | domatchM ebp 117 | 118 | jmp nexttag 119 | 120 | normalcodepair: 121 | dec eax 122 | 123 | shl eax, 8 124 | mov al, [esi] 125 | inc esi 126 | 127 | mov ebp, eax 128 | 129 | getgammaM ecx 130 | 131 | cmp eax, 32000 132 | sbb ecx, -1 133 | 134 | cmp eax, 1280 135 | sbb ecx, -1 136 | 137 | cmp eax, 128 138 | adc ecx, 0 139 | 140 | cmp eax, 128 141 | adc ecx, 0 142 | 143 | domatchM eax 144 | jmp nexttag 145 | 146 | shortmatch: 147 | mov al, [esi] 148 | inc esi 149 | 150 | xor ecx, ecx 151 | db 0c0h, 0e8h, 001h 152 | jz donedepacking 153 | 154 | adc ecx, 2 155 | 156 | mov ebp, eax 157 | 158 | domatchM eax 159 | 160 | mov ebx, 1 161 | jmp nexttag 162 | 163 | donedepacking: 164 | sub edi, [esp + _dst$] 165 | mov [esp + _ret$], edi ; return unpacked length in eax 166 | 167 | popad 168 | 169 | ret 170 | 171 | ; ============================================================= 172 | -------------------------------------------------------------------------------- /aPLib/contrib/delphi/t_main.pas: -------------------------------------------------------------------------------- 1 | unit t_main; 2 | 3 | interface 4 | 5 | uses 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 | aPLib, ExtCtrls, StdCtrls, ComCtrls; 8 | 9 | type 10 | TfrmMain = class(TForm) 11 | aPLib: TaPLib; 12 | Button1: TButton; 13 | Button2: TButton; 14 | Panel1: TPanel; 15 | OD: TOpenDialog; 16 | GroupBox1: TGroupBox; 17 | PB: TProgressBar; 18 | Label3: TLabel; 19 | Label4: TLabel; 20 | Label1: TLabel; 21 | Label2: TLabel; 22 | Label5: TLabel; 23 | CancelBtn: TButton; 24 | procedure Button1Click(Sender: TObject); 25 | procedure Button2Click(Sender: TObject); 26 | procedure CancelBtnClick(Sender: TObject); 27 | private 28 | { Private declarations } 29 | public 30 | Cancel : Boolean; 31 | FileSize : DWORD; 32 | end; 33 | 34 | (*$IFDEF DYNAMIC_VERSION*) 35 | function CallBack(w0, w1, w2 : DWORD; cbparam : Pointer) : DWORD;stdcall; 36 | (*$ELSE*) 37 | function CallBack(w0, w1, w2 : DWORD; cbparam : Pointer) : DWORD;cdecl; 38 | (*$ENDIF*) 39 | 40 | var 41 | frmMain: TfrmMain; 42 | 43 | implementation 44 | 45 | {$R *.DFM} 46 | 47 | function CallBack(w0, w1, w2 : DWORD; cbparam : Pointer) : DWORD; 48 | begin 49 | with frmMain do 50 | begin 51 | Label4.Caption := FormatFloat('##%', ((FileSize - (w1-w2))/FileSize) * 100); 52 | PB.Position := Round(w1/FileSize*100); 53 | 54 | Application.ProcessMessages; 55 | 56 | if Cancel then Result := aP_pack_break 57 | else Result := aP_pack_continue; 58 | end; 59 | end; 60 | 61 | procedure TfrmMain.Button1Click(Sender: TObject); 62 | var 63 | FileIn, 64 | FileOut : TFileStream; 65 | Length : DWORD; 66 | Buffer : Pointer; 67 | begin 68 | if not OD.Execute then Exit; 69 | 70 | FileIn := TFileStream.Create(OD.FileName,fmOpenRead or fmShareDenyWrite); 71 | GetMem(Buffer, FileIn.Size); 72 | Length := FileIn.Size; 73 | FileIn.Read(Buffer^, Length); 74 | 75 | aPLib.Source := Buffer; 76 | aPLib.Length := Length; 77 | 78 | aPlib.CallBack := @CallBack; 79 | 80 | FileSize := FileIn.Size; 81 | Cancel := False; 82 | CancelBtn.Enabled := True; 83 | 84 | aPLib.Pack; 85 | 86 | FileIn.Destroy; 87 | 88 | if aPLib.Length = 0 then Exit; 89 | 90 | FileOut := TFileStream.Create(ExtractFilePath(OD.FileName)+'out.apk', fmCreate); 91 | FileOut.Write(aPLib.Destination^, aPLib.Length); 92 | FileOut.Destroy; 93 | 94 | CancelBtn.Enabled := False; 95 | 96 | ShowMessage('Packed file name is out.apk !'); 97 | 98 | end; 99 | 100 | procedure TfrmMain.Button2Click(Sender: TObject); 101 | var 102 | FileIn, 103 | FileOut : TFileStream; 104 | Length : DWORD; 105 | Buffer : Pointer; 106 | begin 107 | if not OD.Execute then Exit; 108 | 109 | FileIn := TFileStream.Create(OD.FileName,fmOpenRead or fmShareDenyWrite); 110 | GetMem(Buffer, Length); 111 | Length := FileIn.Size; 112 | FileIn.Read(Buffer^, Length); 113 | 114 | aPLib.Source := Buffer; 115 | aPLib.Length := Length; 116 | 117 | aPLib.DePack; 118 | 119 | FileIn.Destroy; 120 | 121 | FileOut := TFileStream.Create(ExtractFilePath(OD.FileName)+'out.dat', fmCreate or fmOpenWrite); 122 | FileOut.Write(aPLib.Destination^, aPLib.Length); 123 | FileOut.Destroy; 124 | 125 | ShowMessage('Original file name is out.dat !'); 126 | end; 127 | 128 | procedure TfrmMain.CancelBtnClick(Sender: TObject); 129 | begin 130 | Cancel := True; 131 | end; 132 | 133 | end. 134 | -------------------------------------------------------------------------------- /aPLib/src/64bit/depackf.asm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; aPLib compression library - the smaller the better :) 3 | ;; 4 | ;; fasm 64-bit fast assembler depacker 5 | ;; 6 | ;; Copyright (c) 1998-2014 Joergen Ibsen 7 | ;; All Rights Reserved 8 | ;; 9 | ;; http://www.ibsensoftware.com/ 10 | ;; 11 | 12 | format MS64 COFF 13 | 14 | public aP_depack_asm_fast 15 | 16 | ; ============================================================= 17 | 18 | macro getbitM 19 | { 20 | local .stillbitsleft 21 | 22 | add dl, dl 23 | jnz .stillbitsleft 24 | mov dl, [rsi] 25 | inc rsi 26 | adc dl, dl 27 | .stillbitsleft: 28 | } 29 | 30 | macro domatchM reg 31 | { 32 | local .more 33 | 34 | mov r10, rdi 35 | sub r10, reg 36 | 37 | .more: 38 | mov al, [r10] 39 | add r10, 1 40 | mov [rdi], al 41 | add rdi, 1 42 | sub rcx, 1 43 | jnz .more 44 | } 45 | 46 | macro getgammaM reg 47 | { 48 | local .getmorebits 49 | 50 | mov reg, 1 51 | .getmorebits: 52 | getbitM 53 | adc reg, reg 54 | getbitM 55 | jc .getmorebits 56 | } 57 | 58 | ; ============================================================= 59 | 60 | section '.text' code readable executable 61 | 62 | aP_depack_asm_fast: 63 | ; aP_depack_asm_fast(const void *source, void *destination) 64 | 65 | mov [rsp + 8], rsi 66 | mov [rsp + 16], rdx 67 | push rdi 68 | 69 | mov rsi, rcx 70 | mov rdi, rdx 71 | 72 | cld 73 | mov dl, 80h 74 | 75 | literal: 76 | mov al, [rsi] 77 | add rsi, 1 78 | mov [rdi], al 79 | add rdi, 1 80 | 81 | mov r9, 2 82 | 83 | nexttag: 84 | getbitM 85 | jnc literal 86 | 87 | getbitM 88 | jnc codepair 89 | 90 | xor rax, rax 91 | getbitM 92 | jnc shortmatch 93 | 94 | getbitM 95 | adc rax, rax 96 | getbitM 97 | adc rax, rax 98 | getbitM 99 | adc rax, rax 100 | getbitM 101 | adc rax, rax 102 | jz thewrite 103 | 104 | mov r9, rdi 105 | sub r9, rax 106 | mov al, [r9] 107 | 108 | thewrite: 109 | mov [rdi], al 110 | add rdi, 1 111 | 112 | mov r9, 2 113 | jmp short nexttag 114 | 115 | codepair: 116 | getgammaM rax 117 | sub rax, r9 118 | mov r9, 1 119 | jnz normalcodepair 120 | 121 | getgammaM rcx 122 | domatchM r8 123 | 124 | jmp nexttag 125 | 126 | normalcodepair: 127 | add rax, -1 128 | 129 | shl rax, 8 130 | mov al, [rsi] 131 | add rsi, 1 132 | 133 | mov r8, rax 134 | 135 | getgammaM rcx 136 | 137 | cmp rax, 32000 138 | sbb rcx, -1 139 | 140 | cmp rax, 1280 141 | sbb rcx, -1 142 | 143 | cmp rax, 128 144 | adc rcx, 0 145 | 146 | cmp rax, 128 147 | adc rcx, 0 148 | 149 | domatchM rax 150 | jmp nexttag 151 | 152 | shortmatch: 153 | mov al, [rsi] 154 | add rsi, 1 155 | 156 | xor rcx, rcx 157 | db 0c0h, 0e8h, 001h 158 | jz donedepacking 159 | 160 | adc rcx, 2 161 | 162 | mov r8, rax 163 | 164 | domatchM rax 165 | 166 | mov r9, 1 167 | jmp nexttag 168 | 169 | donedepacking: 170 | mov rax, rdi 171 | sub rax, [rsp + 24] 172 | 173 | mov rsi, [rsp + 16] 174 | pop rdi 175 | 176 | ret 177 | 178 | ; ============================================================= 179 | -------------------------------------------------------------------------------- /aPLib/src/depack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * C depacker 5 | * 6 | * Copyright (c) 1998-2014 Joergen Ibsen 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | */ 11 | 12 | #include "depack.h" 13 | 14 | /* internal data structure */ 15 | struct APDSTATE { 16 | const unsigned char *source; 17 | unsigned char *destination; 18 | unsigned int tag; 19 | unsigned int bitcount; 20 | }; 21 | 22 | static unsigned int aP_getbit(struct APDSTATE *ud) 23 | { 24 | unsigned int bit; 25 | 26 | /* check if tag is empty */ 27 | if (!ud->bitcount--) { 28 | /* load next tag */ 29 | ud->tag = *ud->source++; 30 | ud->bitcount = 7; 31 | } 32 | 33 | /* shift bit out of tag */ 34 | bit = (ud->tag >> 7) & 0x01; 35 | ud->tag <<= 1; 36 | 37 | return bit; 38 | } 39 | 40 | static unsigned int aP_getgamma(struct APDSTATE *ud) 41 | { 42 | unsigned int result = 1; 43 | 44 | /* input gamma2-encoded bits */ 45 | do { 46 | result = (result << 1) + aP_getbit(ud); 47 | } while (aP_getbit(ud)); 48 | 49 | return result; 50 | } 51 | 52 | unsigned int aP_depack(const void *source, void *destination) 53 | { 54 | struct APDSTATE ud; 55 | unsigned int offs, len, R0, LWM; 56 | int done; 57 | int i; 58 | 59 | ud.source = (const unsigned char *) source; 60 | ud.destination = (unsigned char *) destination; 61 | ud.bitcount = 0; 62 | 63 | R0 = (unsigned int) -1; 64 | LWM = 0; 65 | done = 0; 66 | 67 | /* first byte verbatim */ 68 | *ud.destination++ = *ud.source++; 69 | 70 | /* main decompression loop */ 71 | while (!done) { 72 | if (aP_getbit(&ud)) { 73 | if (aP_getbit(&ud)) { 74 | if (aP_getbit(&ud)) { 75 | offs = 0; 76 | 77 | for (i = 4; i; i--) { 78 | offs = (offs << 1) + aP_getbit(&ud); 79 | } 80 | 81 | if (offs) { 82 | *ud.destination = *(ud.destination - offs); 83 | ud.destination++; 84 | } 85 | else { 86 | *ud.destination++ = 0x00; 87 | } 88 | 89 | LWM = 0; 90 | } 91 | else { 92 | offs = *ud.source++; 93 | 94 | len = 2 + (offs & 0x0001); 95 | 96 | offs >>= 1; 97 | 98 | if (offs) { 99 | for (; len; len--) { 100 | *ud.destination = *(ud.destination - offs); 101 | ud.destination++; 102 | } 103 | } 104 | else { 105 | done = 1; 106 | } 107 | 108 | R0 = offs; 109 | LWM = 1; 110 | } 111 | } 112 | else { 113 | offs = aP_getgamma(&ud); 114 | 115 | if ((LWM == 0) && (offs == 2)) { 116 | offs = R0; 117 | 118 | len = aP_getgamma(&ud); 119 | 120 | for (; len; len--) { 121 | *ud.destination = *(ud.destination - offs); 122 | ud.destination++; 123 | } 124 | } 125 | else { 126 | if (LWM == 0) { 127 | offs -= 3; 128 | } 129 | else { 130 | offs -= 2; 131 | } 132 | 133 | offs <<= 8; 134 | offs += *ud.source++; 135 | 136 | len = aP_getgamma(&ud); 137 | 138 | if (offs >= 32000) { 139 | len++; 140 | } 141 | if (offs >= 1280) { 142 | len++; 143 | } 144 | if (offs < 128) { 145 | len += 2; 146 | } 147 | 148 | for (; len; len--) { 149 | *ud.destination = *(ud.destination - offs); 150 | ud.destination++; 151 | } 152 | 153 | R0 = offs; 154 | } 155 | 156 | LWM = 1; 157 | } 158 | } 159 | else { 160 | *ud.destination++ = *ud.source++; 161 | LWM = 0; 162 | } 163 | } 164 | 165 | return (unsigned int) (ud.destination - (unsigned char *) destination); 166 | } 167 | -------------------------------------------------------------------------------- /aPLib/contrib/AppleII/apsrcdst.s: -------------------------------------------------------------------------------- 1 | ;aPLib data decompressor for Apple II 2 | ;Peter Ferrie (peter.ferrie@gmail.com) 3 | ;assemble using ACME 4 | ;srcpakoff+paksize ;packed data offset + packed data size 26 | sta src+1 27 | lda #orgoff+orgsize ;original unpacked data offset + original unpacked size 30 | sta dst+1 31 | !if (>(oep-1)=>(orgoff+orgsize)) { ;oep = original entrypoint 32 | pha 33 | } else { 34 | lda #>(oep-1) 35 | pha 36 | } 37 | lda # 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | [Version Info] 59 | IncludeVerInfo=0 60 | AutoIncBuild=0 61 | MajorVer=1 62 | MinorVer=0 63 | Release=0 64 | Build=0 65 | Debug=0 66 | PreRelease=0 67 | Special=0 68 | Private=0 69 | DLL=0 70 | Locale=1033 71 | CodePage=1252 72 | 73 | [Version Info Keys] 74 | CompanyName= 75 | FileDescription= 76 | FileVersion=1.0.0.0 77 | InternalName= 78 | LegalCopyright= 79 | LegalTrademarks= 80 | OriginalFilename= 81 | ProductName= 82 | ProductVersion=1.0.0.0 83 | Comments= 84 | 85 | [Excluded Packages] 86 | 87 | [HistoryLists\hlIncludePath] 88 | Count=0 89 | 90 | [HistoryLists\hlLibraryPath] 91 | Count=0 92 | 93 | [HistoryLists\hlDebugSourcePath] 94 | Count=0 95 | 96 | [Debugging] 97 | DebugSourceDirs=$(BCB)\source\vcl 98 | 99 | [Parameters] 100 | RunParams= 101 | Launcher= 102 | UseLauncher=0 103 | DebugCWD= 104 | HostApplication= 105 | RemoteHost= 106 | RemotePath= 107 | RemoteLauncher= 108 | RemoteCWD= 109 | RemoteDebug=0 110 | 111 | [Compiler] 112 | ShowInfoMsgs=0 113 | LinkDebugVcl=0 114 | LinkCGLIB=0 115 | 116 | [CORBA] 117 | AddServerUnit=1 118 | AddClientUnit=1 119 | PrecompiledHeaders=1 120 | 121 | -------------------------------------------------------------------------------- /aPLib/contrib/delphi/aplibud.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * Delphi interface to aPLib dll 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> Delphi by Solodovnikov Alexey 21.03.1999 (alenka@mail.line.ru) 12 | *) 13 | 14 | unit aPLibud; 15 | 16 | interface 17 | 18 | uses 19 | Windows; 20 | 21 | const 22 | aP_pack_break : DWORD = 0; 23 | aP_pack_continue : DWORD = 1; 24 | 25 | aPLib_Error : DWORD = DWORD(-1); (* indicates error compressing/decompressing *) 26 | 27 | type 28 | 29 | TaPack_Status = function(w0, w1, w2 : DWORD; 30 | cbparam : Pointer) : DWORD;stdcall; 31 | 32 | function _aP_pack(var Source; 33 | var Destination; 34 | Length : DWORD; 35 | var WorkMem; 36 | Callback : TaPack_Status; 37 | cbparam : Pointer) : DWORD;stdcall; 38 | function _aP_workmem_size(InputSize : DWORD) : DWORD;stdcall; 39 | function _aP_max_packed_size(InputSize : DWORD) : DWORD;stdcall; 40 | function _aP_depack_asm(var Source, Destination) : DWORD;stdcall; 41 | function _aP_depack_asm_fast(var Source, Destination) : DWORD;stdcall; 42 | function _aP_depack_asm_safe(var Source; 43 | SrcLen : DWORD; 44 | var Destination; 45 | DstLen :DWORD) : DWORD;stdcall; 46 | function _aP_crc32(var Source; Length : DWORD) : DWORD;stdcall; 47 | function _aPsafe_pack(var Source; 48 | var Destination; 49 | Length : DWORD; 50 | var WorkMem; 51 | Callback : TaPack_Status; 52 | cbparam : Pointer) : DWORD;stdcall; 53 | function _aPsafe_check(var Source) : DWORD;stdcall; 54 | function _aPsafe_get_orig_size(var Source) : DWORD;stdcall; 55 | function _aPsafe_depack(var Source; 56 | SrcLen : DWORD; 57 | var Destination; 58 | DstLen :DWORD) : DWORD;stdcall; 59 | 60 | implementation 61 | 62 | const 63 | DLL = 'aplib.dll'; 64 | 65 | function _aP_pack(var Source; 66 | var Destination; 67 | Length : DWORD; 68 | var WorkMem; 69 | CallBack : TaPack_Status; 70 | cbparam : Pointer) : DWORD;stdcall;external DLL; 71 | 72 | function _aP_workmem_size(InputSize : DWORD) : DWORD;stdcall;external DLL; 73 | 74 | function _aP_max_packed_size(InputSize : DWORD) : DWORD;stdcall;external DLL; 75 | 76 | function _aP_depack_asm(var Source, Destination) : DWORD;stdcall;external DLL; 77 | 78 | function _aP_depack_asm_fast(var Source, Destination) : DWORD;stdcall;external DLL; 79 | 80 | function _aP_depack_asm_safe(var Source; 81 | SrcLen : DWORD; 82 | var Destination; 83 | DstLen :DWORD) : DWORD;external DLL; 84 | 85 | function _aP_crc32(var Source; Length : DWORD) : DWORD;stdcall;external DLL; 86 | 87 | function _aPsafe_pack(var Source; 88 | var Destination; 89 | Length : DWORD; 90 | var WorkMem; 91 | CallBack : TaPack_Status; 92 | cbparam : Pointer) : DWORD;stdcall;external DLL; 93 | 94 | function _aPsafe_check(var Source) : DWORD;stdcall;external DLL; 95 | 96 | function _aPsafe_get_orig_size(var Source) : DWORD;stdcall;external DLL; 97 | 98 | function _aPsafe_depack(var Source; 99 | SrcLen : DWORD; 100 | var Destination; 101 | DstLen :DWORD) : DWORD;external DLL; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /aPLib/contrib/vpascal/make_exe.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | cls 3 | rem VP base directory -- also change in vpc.cfg 4 | set vpbase=y:\vp21 5 | set host=os2 6 | if [os_shell]==[] set host=w32 7 | set vpbin=%vpbase%\bin.%host% 8 | set beginlibpath=%vpbin% 9 | 10 | if exist dynamic goto md1 11 | echo *** MkDir *** 12 | md dynamic 13 | md dynamic\lnx 14 | md dynamic\os2 15 | md dynamic\w32 16 | md static 17 | md static\os2 18 | md static\w32 19 | md static\d32 20 | md static\lnx 21 | :md1 22 | 23 | echo *** DLL *** 24 | 25 | rem OS/2 26 | link386 /NoLogo /NoIgnoreCase /Map ..\..\lib\omf\aplib.lib,dynamic\os2\aplib.dll,dynamic\os2\aplib.map,,aplib.def 27 | cd dynamic\os2 28 | mapsym aplib.map > nul 29 | del aplib.map 30 | cd ..\.. 31 | rem if errorlevel 1 goto Error_Exit 32 | 33 | rem Win32 34 | copy ..\..\lib\dll\aplib.dll dynamic\w32\aplib.dll 35 | if errorlevel 1 goto Error_Exit 36 | 37 | rem Linux 38 | echo gcc -shared -nostdlib -Wl,--whole-archive aplib.a -o aplib.so > dynamic\lnx\aplib.txt 39 | 40 | echo *** dynamic EXE *** 41 | 42 | echo * OS/2: aPPack 43 | set cfg=/Edynamic\os2 -CO -DDYNAMIC_VERSION @vpc.cfg 44 | %vpbin%\vpc %cfg% aPPack.pas 45 | if errorlevel 1 goto Error_Exit 46 | echo * OS/2: aPUnpack 47 | %vpbin%\vpc %cfg% aPUnpack.pas 48 | if errorlevel 1 goto Error_Exit 49 | 50 | echo * Win32: aPPack 51 | set cfg=/Edynamic\w32 -CW -DDYNAMIC_VERSION @vpc.cfg 52 | %vpbin%\vpc %cfg% aPPack.pas 53 | if errorlevel 1 GOTO Error_Exit 54 | echo * Win32: aPUnpack 55 | %vpbin%\vpc %cfg% aPUnpack.pas 56 | if errorlevel 1 goto Error_Exit 57 | 58 | if not exist %vpbase%\units.lnx goto No_Linux_dyn 59 | echo * Linux: aPPack 60 | set cfg=/Edynamic\lnx -CL:LNX:LINUX -DDYNAMIC_VERSION @vpc.cfg 61 | %vpbin%\vpc %cfg% aPPack.pas 62 | if errorlevel 1 goto Error_Exit 63 | %vpbin%\pe2elf -m3 dynamic\lnx\aPPack.exe 64 | if errorlevel 1 goto Error_Exit 65 | del dynamic\lnx\aPPack.exe 66 | echo * Linux: aPUnpack 67 | %vpbin%\vpc %cfg% aPUnpack.pas 68 | if errorlevel 1 goto Error_Exit 69 | %vpbin%\pe2elf -m3 dynamic\lnx\aPUnpack.exe 70 | if errorlevel 1 goto Error_Exit 71 | del dynamic\lnx\aPUnpack.exe 72 | :No_Linux_dyn 73 | 74 | 75 | echo *** static EXE *** 76 | 77 | echo * OS/2: aPPack 78 | set cfg=/Estatic\os2 -CO @vpc.cfg 79 | %vpbin%\vpc %cfg% aPPack.pas 80 | if errorlevel 1 goto Error_Exit 81 | echo * OS/2: aPUnpack 82 | %vpbin%\vpc %cfg% aPUnpack.pas 83 | if errorlevel 1 goto Error_Exit 84 | 85 | echo * Win32: aPPack 86 | set cfg=/Estatic\w32 -CW @vpc.cfg 87 | %vpbin%\vpc %cfg% aPPack.pas 88 | if errorlevel 1 goto Error_Exit 89 | echo * Win32: aPUnpack 90 | %vpbin%\vpc %cfg% aPUnpack.pas 91 | if errorlevel 1 goto Error_Exit 92 | 93 | 94 | if not exist %vpbase%\units.d32 goto No_DPMI32 95 | echo * DPMI32: aPPack 96 | copy %vpbase%\bin.d32\wdosxle.exe static\d32\wdosxle.exe 97 | set cfg=/Estatic\d32 -CW:D32:DPMI32 @vpc.cfg 98 | %vpbin%\vpc %cfg% aPPack.pas 99 | if errorlevel 1 goto Error_Exit 100 | %vpbin%\pe2le static\d32\aPPack.exe static\d32\aPPack.exe /s:wdxs_le.exe 101 | 32lite -8:0 -9:0 static\d32\aPPack.exe 102 | echo * DPMI32: aPUnpack 103 | %vpbin%\vpc %cfg% aPUnpack.pas 104 | if errorlevel 1 goto Error_Exit 105 | %vpbin%\pe2le static\d32\aPUnpack.exe static\d32\aPUnpack.exe /s:wdxs_le.exe 106 | call 32lite -8:0 -9:0 static\d32\aPUnpack.exe 107 | :No_DPMI32 108 | 109 | if not exist %vpbase%\units.lnx goto No_Linux 110 | echo * Linux: aPPack 111 | set cfg=/Estatic\lnx -CL:LNX:LINUX @vpc.cfg 112 | %vpbin%\vpc %cfg% aPPack.pas 113 | if errorlevel 1 goto Error_Exit 114 | %vpbin%\pe2elf -m3 static\lnx\aPPack.exe 115 | if errorlevel 1 goto Error_Exit 116 | del static\lnx\aPPack.exe 117 | echo * Linux: aPUnpack 118 | %vpbin%\vpc %cfg% aPUnpack.pas 119 | if errorlevel 1 goto Error_Exit 120 | %vpbin%\pe2elf -m3 static\lnx\aPUnpack.exe 121 | if errorlevel 1 goto Error_Exit 122 | del static\lnx\aPUnpack.exe 123 | :No_Linux 124 | 125 | call LxLite static\os2\* dynamic\os2\* /U+ /F+ /ZS /T 126 | 127 | goto End 128 | 129 | :Error_Exit 130 | PAUSE 131 | 132 | :End 133 | -------------------------------------------------------------------------------- /aPLib/doc/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 11 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 16 | .highlight .go { color: #333333 } /* Generic.Output */ 17 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 21 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #902000 } /* Keyword.Type */ 27 | .highlight .m { color: #208050 } /* Literal.Number */ 28 | .highlight .s { color: #4070a0 } /* Literal.String */ 29 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 30 | .highlight .nb { color: #007020 } /* Name.Builtin */ 31 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #60add5 } /* Name.Constant */ 33 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 34 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #007020 } /* Name.Exception */ 36 | .highlight .nf { color: #06287e } /* Name.Function */ 37 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 38 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 41 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 44 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 45 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 46 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 47 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 48 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 49 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 50 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 51 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 52 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 53 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 54 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 55 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 56 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 57 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 58 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 59 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 60 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 61 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 62 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /aPLib/contrib/dotnet/appack.cs: -------------------------------------------------------------------------------- 1 | // 2 | // aPLib compression library - the smaller the better :) 3 | // 4 | // C# example 5 | // 6 | // Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | // All Rights Reserved 8 | // 9 | // http://www.ibsensoftware.com/ 10 | // 11 | 12 | using System; 13 | using System.IO; 14 | 15 | using IbsenSoftware.aPLib; 16 | 17 | class appack 18 | { 19 | static int ShowProgress(int length, int slen, int dlen, int cbparam) 20 | { 21 | Console.Write("{0} -> {1}\r", slen, dlen); 22 | return 1; 23 | } 24 | 25 | static void CompressStream(Stream from, Stream to) 26 | { 27 | byte[] src = new byte[from.Length]; 28 | 29 | // read file 30 | if (from.Read(src, 0, src.Length) == src.Length) 31 | { 32 | int dstSize = DllInterface.aP_max_packed_size(src.Length); 33 | int wrkSize = DllInterface.aP_workmem_size(src.Length); 34 | 35 | // allocate mem 36 | byte[] dst = new byte[dstSize]; 37 | byte[] wrk = new byte[wrkSize]; 38 | 39 | // compress data 40 | int packedSize = DllInterface.aPsafe_pack( 41 | src, 42 | dst, 43 | src.Length, 44 | wrk, 45 | new DllInterface.CompressionCallback(ShowProgress), 46 | 0 47 | ); 48 | 49 | // write compressed data 50 | to.Write(dst, 0, packedSize); 51 | 52 | Console.WriteLine("compressed to {0} bytes", packedSize); 53 | } 54 | } 55 | 56 | static void DecompressStream(Stream from, Stream to) 57 | { 58 | byte[] src = new byte[from.Length]; 59 | 60 | // read file 61 | if (from.Read(src, 0, src.Length) == src.Length) 62 | { 63 | int dstSize = DllInterface.aPsafe_get_orig_size(src); 64 | 65 | // allocate mem 66 | byte[] dst = new byte[dstSize]; 67 | 68 | // decompress data 69 | int depackedSize = DllInterface.aPsafe_depack(src, src.Length, dst, dstSize); 70 | 71 | // write compressed data 72 | to.Write(dst, 0, depackedSize); 73 | 74 | Console.WriteLine("decompressed to {0} bytes", depackedSize); 75 | } 76 | } 77 | 78 | public static void Main(string[] args) 79 | { 80 | Console.WriteLine("==============================================================================="); 81 | Console.WriteLine("aPLib example in C# Copyright (c) 1998-2009 by Joergen Ibsen / Jibz"); 82 | Console.WriteLine(" All Rights Reserved\n"); 83 | Console.WriteLine(" http://www.ibsensoftware.com/"); 84 | Console.WriteLine("===============================================================================\n"); 85 | 86 | if ((args.Length != 3) || ((args[0] != "c") && (args[0] != "d"))) 87 | { 88 | Console.WriteLine("Syntax: appack "); 89 | return; 90 | } 91 | 92 | string inFilename = args[1]; 93 | string outFilename = args[2]; 94 | 95 | if (!File.Exists(inFilename)) 96 | { 97 | Console.WriteLine("Error: unable to find file '{0}'", inFilename); 98 | return; 99 | } 100 | 101 | try { 102 | 103 | using (FileStream inFile = File.OpenRead(inFilename), 104 | outFile = File.Create(outFilename)) 105 | { 106 | if (args[0] == "c") 107 | { 108 | CompressStream(inFile, outFile); 109 | } else { 110 | DecompressStream(inFile, outFile); 111 | } 112 | } 113 | 114 | } catch (Exception e) { 115 | 116 | Console.WriteLine("Error: {0}", e.ToString()); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /aPLib/contrib/delphi/aplibu.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * aPLib compression library - the smaller the better :) 3 | * 4 | * Delphi interface to aPLib Delphi objects 5 | * 6 | * Copyright (c) 1998-2009 by Joergen Ibsen / Jibz 7 | * All Rights Reserved 8 | * 9 | * http://www.ibsensoftware.com/ 10 | * 11 | * -> Delphi by Solodovnikov Alexey 21.03.1999 (alenka@mail.line.ru) 12 | *) 13 | 14 | unit aPLibu; 15 | 16 | interface 17 | 18 | uses 19 | Windows; 20 | 21 | const 22 | aP_pack_break : DWORD = 0; 23 | aP_pack_continue : DWORD = 1; 24 | 25 | aPLib_Error : DWORD = DWORD(-1); (* indicates error compressing/decompressing *) 26 | 27 | type 28 | 29 | TaPack_Status = function(w0, w1, w2 : DWORD; 30 | cbparam : Pointer) : DWORD;cdecl; 31 | 32 | function _aP_pack(var Source; 33 | var Destination; 34 | Length : DWORD; 35 | var WorkMem; 36 | Callback : TaPack_Status; 37 | cbparam : Pointer) : DWORD;cdecl; 38 | function _aP_workmem_size(InputSize : DWORD) : DWORD;cdecl; 39 | function _aP_max_packed_size(InputSize : DWORD) : DWORD;cdecl; 40 | function _aP_depack_asm(var Source, Destination) : DWORD;cdecl; 41 | function _aP_depack_asm_fast(var Source, Destination) : DWORD;cdecl; 42 | function _aP_depack_asm_safe(var Source; 43 | SrcLen : DWORD; 44 | var Destination; 45 | DstLen :DWORD) : DWORD;cdecl; 46 | function _aP_crc32(var Source; Length : DWORD) : DWORD;cdecl; 47 | function _aPsafe_pack(var Source; 48 | var Destination; 49 | Length : DWORD; 50 | var WorkMem; 51 | Callback : TaPack_Status; 52 | cbparam : Pointer) : DWORD;cdecl; 53 | function _aPsafe_check(var Source) : DWORD;cdecl; 54 | function _aPsafe_get_orig_size(var Source) : DWORD;cdecl; 55 | function _aPsafe_depack(var Source; 56 | SrcLen : DWORD; 57 | var Destination; 58 | DstLen :DWORD) : DWORD;cdecl; 59 | 60 | implementation 61 | 62 | function _aP_pack(var Source; 63 | var Destination; 64 | Length : DWORD; 65 | var WorkMem; 66 | CallBack : TaPack_Status; 67 | cbparam : Pointer) : DWORD;external; 68 | 69 | function _aP_workmem_size(InputSize : DWORD) : DWORD;external; 70 | 71 | function _aP_max_packed_size(InputSize : DWORD) : DWORD;external; 72 | 73 | function _aP_depack_asm(var Source, Destination) : DWORD;external; 74 | 75 | function _aP_depack_asm_fast(var Source, Destination) : DWORD;external; 76 | 77 | function _aP_depack_asm_safe(var Source; 78 | SrcLen : DWORD; 79 | var Destination; 80 | DstLen :DWORD) : DWORD;external; 81 | 82 | function _aP_crc32(var Source; Length : DWORD) : DWORD;external; 83 | 84 | function _aPsafe_pack(var Source; 85 | var Destination; 86 | Length : DWORD; 87 | var WorkMem; 88 | CallBack : TaPack_Status; 89 | cbparam : Pointer) : DWORD;external; 90 | 91 | function _aPsafe_check(var Source) : DWORD;external; 92 | 93 | function _aPsafe_get_orig_size(var Source) : DWORD;external; 94 | 95 | function _aPsafe_depack(var Source; 96 | SrcLen : DWORD; 97 | var Destination; 98 | DstLen :DWORD) : DWORD;external; 99 | 100 | {$L ..\..\lib\omf\aplib.obj} 101 | {$L ..\..\lib\omf\depack.obj} 102 | {$L ..\..\lib\omf\depackf.obj} 103 | {$L ..\..\lib\omf\depacks.obj} 104 | {$L ..\..\lib\omf\crc32.obj} 105 | {$L ..\..\lib\omf\spack.obj} 106 | {$L ..\..\lib\omf\scheck.obj} 107 | {$L ..\..\lib\omf\sgetsize.obj} 108 | {$L ..\..\lib\omf\sdepack.obj} 109 | 110 | end. 111 | -------------------------------------------------------------------------------- /aPLib/doc/html/_sources/compression.txt: -------------------------------------------------------------------------------- 1 | 2 | Compression 3 | =========== 4 | 5 | The following is a description of the aPLib compression functionality. 6 | 7 | 8 | Compression Functions 9 | --------------------- 10 | 11 | .. c:function:: size_t aP_pack(const void *source, void *destination, \ 12 | size_t length, void *workmem, \ 13 | int (*callback)(size_t, size_t, size_t, void *), \ 14 | void *cbparam) 15 | 16 | Compress *length* bytes of data from *source* to *destination*, using 17 | *workmem* as temporary storage. 18 | 19 | The *destination* buffer should be large enough to hold 20 | ``aP_max_packed_size(length)`` bytes. 21 | 22 | The *workmem* buffer should be ``aP_workmem_size(length)`` bytes large. 23 | 24 | The callback function, *callback*, must take four parameters. The first is 25 | *length*, the second is the number of input bytes that has been 26 | compressed, the third is how many output bytes they have been compressed 27 | to, and the fourth is *cbparam*. If you do not have a callback, use 28 | ``NULL`` instead. If the callback returns a non-zero value then 29 | :c:func:`aP_pack()` will continue compressing -- if it returns zero, 30 | :c:func:`aP_pack()` will stop and return ``APLIB_ERROR``. 31 | 32 | :param source: pointer to data to be compressed 33 | :param destination: pointer to where compressed data should be stored 34 | :param length: length of uncompressed data in bytes 35 | :param workmem: pointer to work memory used during compression 36 | :param callback: pointer to callback function (or ``NULL``) 37 | :param cbparam: callback argument 38 | :return: length of compressed data, or ``APLIB_ERROR`` on error 39 | 40 | .. c:function:: size_t aP_workmem_size(size_t input_size) 41 | 42 | Compute required size of *workmem* buffer used by :c:func:`aP_pack()` for 43 | compressing *input_size* bytes of data. 44 | 45 | The current code always returns 640k (640*1024). 46 | 47 | :param input_size: length of uncompressed data in bytes 48 | :return: required length of work buffer 49 | 50 | .. c:function:: size_t aP_max_packed_size(size_t input_size) 51 | 52 | Compute maximum possible compressed size when compressing *input_size* 53 | bytes of incompressible data. 54 | 55 | The current code returns ``(input_size + (input_size / 8) + 64)``. 56 | 57 | :param input_size: length of uncompressed data in bytes 58 | :return: maximum possible size of compressed data 59 | 60 | 61 | Safe Wrapper Functions 62 | ---------------------- 63 | 64 | .. c:function:: size_t aPsafe_pack(const void *source, void *destination, \ 65 | size_t length, void *workmem, \ 66 | int (*callback)(size_t, size_t, size_t, void *), \ 67 | void *cbparam) 68 | 69 | Wrapper function for :c:func:`aP_pack()`, which adds a header to the 70 | compressed data containing the length of the original data, and CRC32 71 | checksums of the original and compressed data. 72 | 73 | :param source: pointer to data to be compressed 74 | :param destination: pointer to where compressed data should be stored 75 | :param length: length of uncompressed data in bytes 76 | :param workmem: pointer to work memory used during compression 77 | :param callback: pointer to callback function (or ``NULL``) 78 | :param cbparam: callback argument 79 | :return: length of compressed data, or ``APLIB_ERROR`` on error 80 | 81 | .. seealso:: :c:func:`aP_pack()` 82 | 83 | 84 | Example 85 | ------- 86 | 87 | .. code-block:: c 88 | 89 | /* allocate workmem and destination memory */ 90 | char *workmem = malloc(aP_workmem_size(length)); 91 | char *compressed = malloc(aP_max_packed_size(length)); 92 | 93 | /* compress data[] to compressed[] */ 94 | size_t outlength = aPsafe_pack(data, compressed, length, workmem, NULL, NULL); 95 | 96 | /* if APLIB_ERROR is returned, and error occured */ 97 | if (outlength == APLIB_ERROR) { 98 | printf("An error occured!\n"); 99 | } 100 | else { 101 | printf("Compressed %u bytes to %u bytes\n", length, outlength); 102 | } 103 | --------------------------------------------------------------------------------