├── Molebox ├── src │ ├── messages.h │ ├── toolkit.h │ ├── build_time.c │ ├── logo.ico │ ├── xpm │ │ ├── vline.png │ │ ├── activateG_xpm.png │ │ ├── activateR_xpm.png │ │ ├── vline_xpm.xpm │ │ ├── file.xpm │ │ ├── folder.xpm │ │ ├── flop_xpm.xpm │ │ ├── save_xpm.xpm │ │ ├── pack_xpm.xpm │ │ ├── info_xpm.xpm │ │ ├── save_exit_xpm.xpm │ │ └── appicon_xpm.xpm │ ├── main.cpp │ ├── tr.py │ ├── myafx.cpp │ ├── about.cpp │ ├── classes.cpp │ ├── myafx.h │ └── newsubfolder.cpp ├── makeit.cmd └── makefile.mak ├── MxbPack ├── src │ ├── splicer.h │ ├── build_time.c │ ├── pe32.ico │ ├── mxbpack.ico │ ├── pebox.ico │ ├── success.c │ ├── myafx.cpp │ ├── rgsreg.cpp │ ├── mxbpack_RC.rc │ ├── packager.h │ ├── XorS.h │ ├── import.h │ ├── myafx.h │ ├── onexit.c │ ├── xorS.S │ └── classes.cpp ├── stub │ ├── pycparser │ │ ├── test.c │ │ ├── _build_tables.py │ │ ├── plyparser.py │ │ └── __init__.py │ ├── vs6.cmd │ ├── rotor.h │ └── mkrotor.py ├── makeit.cmd ├── QNN.inl └── makefile.mak ├── Core ├── Xi │ ├── winmm.Xi │ ├── oleaut32.Xi │ ├── version.Xi │ ├── ole32.Xi │ ├── gdi32.Xi │ ├── Makefile.mak │ ├── user32.Xi │ ├── advapi32.Xi │ └── ntdll.Xi ├── classes │ ├── sources │ │ ├── makeit │ │ ├── _algo.h │ │ ├── polygon.h │ │ ├── _codecop.h │ │ ├── hinstance.h │ │ ├── dllmain.cpp │ │ ├── newdes.cpp │ │ ├── zlib.cpp │ │ ├── xdom.cpp │ │ ├── format.cpp │ │ ├── logger.cpp │ │ ├── makeall.bat │ │ ├── string.cpp │ │ ├── sysutil.cpp │ │ ├── threads.cpp │ │ ├── genericio.cpp │ │ ├── keylist.cpp │ │ ├── messages.cpp │ │ ├── com_dynamic.cpp │ │ ├── defparser.cpp │ │ ├── hinstance.cpp │ │ ├── saxparser.cpp │ │ ├── com_register.cpp │ │ ├── lz77ss.cpp │ │ ├── symboltable.cpp │ │ ├── _crc32.cpp │ │ ├── collection.cpp │ │ ├── _adler32.cpp │ │ ├── _codecop.cpp │ │ ├── streams.cpp │ │ ├── _specific.cpp │ │ ├── xoredstring_xor.py │ │ ├── makeallrebuild.bat-10.bat │ │ ├── makeallrebuild.bat-10d.bat │ │ ├── makeallrebuild.bat │ │ ├── lz77ss.h │ │ ├── zlib.h │ │ ├── wexcept.h │ │ ├── _shash.h │ │ ├── _crc32.h │ │ ├── xoredstring.h │ │ ├── newdes.h │ │ ├── defparser.h │ │ ├── symboltable.h │ │ ├── fuslog.h │ │ ├── md5.h │ │ ├── mymath.h │ │ ├── tuple.h │ │ ├── refcounted.h │ │ ├── symboltable.inl │ │ ├── stack.h │ │ ├── zlib.inl │ │ ├── com_support.cpp │ │ ├── com_register.h │ │ ├── logger.h │ │ ├── _adler32.h │ │ ├── keylist.inl │ │ ├── guid.h │ │ ├── newdes.inl │ │ ├── blowfish.h │ │ ├── _specific.inl │ │ ├── _codecop.inl │ │ └── substream.h │ ├── _classes.h │ └── RSA512.SRC │ │ └── rsa.h ├── include │ ├── nt.h │ ├── stbinfo.h │ ├── teggovbox.h │ ├── splicer.h │ ├── spackstru.h │ ├── syncronized.h │ ├── XorS.h │ ├── xojuman.h │ ├── import.h │ ├── logger.h │ ├── vfs.h │ └── _common.h ├── src │ ├── fw │ │ ├── makeit.cmd │ │ ├── fwlds.x │ │ ├── fwstart.S │ │ ├── makefile.mak │ │ ├── S.py │ │ ├── fwinstall.h │ │ └── fwxor.S │ ├── hc │ │ └── tests │ │ │ ├── test1.reg │ │ │ └── regimport.c │ ├── splash_pp.cpp │ ├── myaux.cpp │ ├── auxS.S │ ├── apif_cmdline.cpp │ ├── apifS.S │ ├── fpattern_a.c │ ├── fpattern_w.c │ └── Makefile.mak ├── mbin2c.exe ├── DLL.def ├── DLL.rc ├── makeit.cmd ├── Makefile.mak ├── Makefile.rules ├── xor_data.py ├── DLL.rc.py └── _lzss.c ├── makeall.cmd ├── docs ├── assets │ ├── screen01.png │ └── screen02.png ├── _config.yml ├── Gemfile └── _layouts │ └── default.html ├── .gitattributes ├── version.c ├── mkmolebox.cmd ├── mkzip.cmd ├── .gitignore ├── mkxtrenal.cmd ├── Include ├── layout.h └── teggovbox.h └── README.md /Molebox/src/messages.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /MxbPack/src/splicer.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Molebox/src/toolkit.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /MxbPack/stub/pycparser/test.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Core/Xi/winmm.Xi: -------------------------------------------------------------------------------- 1 | timeGetTime,DWORD 2 | -------------------------------------------------------------------------------- /Core/classes/sources/makeit: -------------------------------------------------------------------------------- 1 | makeit.py -------------------------------------------------------------------------------- /Core/include/nt.h: -------------------------------------------------------------------------------- 1 | #include "../../include/nt.h" -------------------------------------------------------------------------------- /Core/include/stbinfo.h: -------------------------------------------------------------------------------- 1 | 2 | #include "../../include/stbinfo.h" 3 | -------------------------------------------------------------------------------- /Core/include/teggovbox.h: -------------------------------------------------------------------------------- 1 | #include "../../include/teggovbox.h" 2 | -------------------------------------------------------------------------------- /Core/src/fw/makeit.cmd: -------------------------------------------------------------------------------- 1 | cd %~dp0 2 | nmake -f Makefile.mak %* 3 | -------------------------------------------------------------------------------- /Core/mbin2c.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Core/mbin2c.exe -------------------------------------------------------------------------------- /makeall.cmd: -------------------------------------------------------------------------------- 1 | 2 | cmd /c mkxtrenal.cmd 3 | cmd /c mkmolebox.cmd 4 | cmd /c mkzip.cmd 5 | -------------------------------------------------------------------------------- /Core/DLL.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | _Inity@16 @1 3 | _SDK_Init@28 @2 4 | _SDK_Inject@20 @3 5 | -------------------------------------------------------------------------------- /Molebox/src/build_time.c: -------------------------------------------------------------------------------- 1 | #include 2 | time_t _BUILD_TIME_EXACT = POSIXBUILDTIME; 3 | -------------------------------------------------------------------------------- /Molebox/src/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Molebox/src/logo.ico -------------------------------------------------------------------------------- /MxbPack/src/build_time.c: -------------------------------------------------------------------------------- 1 | #include 2 | time_t _BUILD_TIME_EXACT = POSIXBUILDTIME; 3 | -------------------------------------------------------------------------------- /MxbPack/src/pe32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/MxbPack/src/pe32.ico -------------------------------------------------------------------------------- /MxbPack/src/mxbpack.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/MxbPack/src/mxbpack.ico -------------------------------------------------------------------------------- /MxbPack/src/pebox.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/MxbPack/src/pebox.ico -------------------------------------------------------------------------------- /Molebox/src/xpm/vline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Molebox/src/xpm/vline.png -------------------------------------------------------------------------------- /docs/assets/screen01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/docs/assets/screen01.png -------------------------------------------------------------------------------- /docs/assets/screen02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/docs/assets/screen02.png -------------------------------------------------------------------------------- /Core/classes/sources/_algo.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Core/classes/sources/_algo.h -------------------------------------------------------------------------------- /Core/classes/sources/polygon.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Core/classes/sources/polygon.h -------------------------------------------------------------------------------- /Core/classes/sources/_codecop.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Core/classes/sources/_codecop.h -------------------------------------------------------------------------------- /Core/classes/sources/hinstance.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Core/classes/sources/hinstance.h -------------------------------------------------------------------------------- /Molebox/src/xpm/activateG_xpm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Molebox/src/xpm/activateG_xpm.png -------------------------------------------------------------------------------- /Molebox/src/xpm/activateR_xpm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudachen/Molebox/HEAD/Molebox/src/xpm/activateR_xpm.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.inl linguist-language=C++ 2 | *.h linguist-language=C++ 3 | *.c linguist-language=C++ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MxbPack/src/success.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("success\n"); 6 | return 48; 7 | } 8 | -------------------------------------------------------------------------------- /Core/Xi/oleaut32.Xi: -------------------------------------------------------------------------------- 1 | # 2 | # splited import table declaration 3 | # $Id$ 4 | # 5 | 6 | -SysAllocString,BSTR,const OLECHAR* 7 | 8 | -------------------------------------------------------------------------------- /version.c: -------------------------------------------------------------------------------- 1 | #include 2 | int _MAJOR_VERSION = 4; 3 | int _BUILD_NUMBER = 6000; 4 | time_t _BUILD_TIME = POSIXBUILDTIME; 5 | -------------------------------------------------------------------------------- /Core/src/hc/tests/test1.reg: -------------------------------------------------------------------------------- 1 | 2 | [HKCR\keyvalue\val] 3 | @ = "default" 4 | "dword-opt" = dword:567843 5 | "strig-opt" = "test text \nstring value\0" 6 | 7 | -------------------------------------------------------------------------------- /Core/Xi/version.Xi: -------------------------------------------------------------------------------- 1 | VerQueryValueW,BOOL,const void *,LPWSTR,LPVOID,PUINT 2 | GetFileVersionInfoW,BOOL,LPWSTR,DWORD,DWORD,LPVOID 3 | GetFileVersionInfoSizeW,DWORD,LPWSTR,LPDWORD 4 | -------------------------------------------------------------------------------- /MxbPack/stub/vs6.cmd: -------------------------------------------------------------------------------- 1 | 2 | @echo off 3 | 4 | set PATH=c:\Opt\C++\6.6\bin;%PATH% 5 | set INCLUDE=c:\Opt\C++\6.6\include;%INCLUDE% 6 | set LIB=c:\Opt\C++\6.6\lib;%LIB% 7 | 8 | %* 9 | 10 | -------------------------------------------------------------------------------- /Molebox/makeit.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set MAKEIT_DIR=%~dp0 4 | set MAKEIT_REL=release 5 | set WORKSPACE=MOLEBOX 6 | set MSRT=_100 7 | set ENVIRONS=env32 8 | 9 | cmd /c %XTERNAL%\makeit_proc.cmd x86 dll %* 10 | -------------------------------------------------------------------------------- /MxbPack/makeit.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set MAKEIT_DIR=%~dp0 4 | set MAKEIT_REL=release 5 | set WORKSPACE=MOLEBOX 6 | set MSRT=_100 7 | set ENVIRONS=env32 8 | 9 | cmd /c %XTERNAL%\makeit_proc.cmd x86 dll %* 10 | -------------------------------------------------------------------------------- /MxbPack/QNN.inl: -------------------------------------------------------------------------------- 1 | #define STUBS_COUNT 1 2 | #include "Q0.inl" 3 | struct stubSdata { unsigned char * data; unsigned size; }; 4 | typedef struct stubSdata stubSdata; 5 | stubSdata stubS[] = { 6 | { Q0, Q0_size }, 7 | {0,0}}; 8 | -------------------------------------------------------------------------------- /mkmolebox.cmd: -------------------------------------------------------------------------------- 1 | 2 | cd %~dp0 3 | set CURR=%CD% 4 | if exist "%~dp0xternal" set XTERNAL=%~dp0xternal 5 | echo %XTERNAL% 6 | 7 | for %%c in (Core MxbPack Molebox) do ( 8 | cd %%c 9 | cmd /c makeit.cmd 10 | cd %CURR% 11 | ) 12 | 13 | -------------------------------------------------------------------------------- /Core/Xi/ole32.Xi: -------------------------------------------------------------------------------- 1 | # 2 | # splited import table declaration 3 | # $Id$ 4 | # 5 | 6 | CoRegisterClassObject,HRESULT,REFCLSID,IUnknown *,DWORD,DWORD,LPDWORD 7 | ReadClassStm,HRESULT,IStream*,CLSID* 8 | CoInitialize,HRESULT,DWORD 9 | CoInitializeEx,HRESULT,VOID*,DWORD 10 | CoUninitialize,HRESULT 11 | 12 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | 2 | theme: jekyll-theme-slate 3 | title: Molebox Virtualization 4 | google_analytics: UA-99577378-1 5 | repository: sudachen/Molebox 6 | github: 7 | repository_url: https://github.com/sudachen/Molebox 8 | gems: 9 | - jekyll-feed 10 | - jekyll-theme-slate 11 | exclude: 12 | - Gemfile 13 | - Gemfile.lock 14 | 15 | 16 | -------------------------------------------------------------------------------- /Core/include/splicer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | extern void InitHeapAndSplicer(STB_INFO* info, void* base); 9 | extern void* AllocExecutableBlock(int); 10 | extern void FreeExecutableBlock(void*); 11 | extern void* Splice5(void* f); 12 | extern void* WrapWithJxThunk(void*); -------------------------------------------------------------------------------- /MxbPack/src/myafx.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "myafx.h" 9 | 10 | teggo::XFILE Xo = xout; 11 | teggo::XFILE Xoln = xoutln; 12 | 13 | void SwitchXoToUtf8(bool useUtf8) 14 | { 15 | Xo = useUtf8?xout8:xout; 16 | Xoln = useUtf8?xout8ln:xoutln; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Molebox/src/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "myafx.h" 9 | 10 | 11 | //int main(int argv, char const **argc) 12 | // { 13 | // EhFilter ehf = MessageBoxEhFiler(); 14 | // GetModuleVersion(Hinstance->GetModulePath(),&_MAJOR_VERSION,&_MINOR_VERSION,&_BUILD_NUMBER); 15 | // } 16 | -------------------------------------------------------------------------------- /Core/classes/sources/dllmain.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include 9 | 10 | BOOL WINAPI DllMain( 11 | HINSTANCE hinstDLL, // handle to the DLL module 12 | DWORD fdwReason, // reason for calling function 13 | LPVOID lpvReserved // reserved 14 | ) 15 | { 16 | return TRUE; 17 | } 18 | -------------------------------------------------------------------------------- /Core/classes/sources/newdes.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | #endif 12 | 13 | #define _TEGGO_NEWDES_HERE 14 | #include "newdes.inl" 15 | 16 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_ndes_module() {}; 17 | -------------------------------------------------------------------------------- /Core/classes/sources/zlib.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | #endif 12 | 13 | #define _TEGGO_ZLIB_HERE 14 | #include "_specific.h" 15 | #include "zlib.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_zlib_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/xdom.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_XDOM_HERE 15 | #include "xdom.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_xdom_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/format.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #include "detect_compiler.h" 10 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 11 | #pragma code_seg(".text$classes") 12 | //#pragma data_seg(".data$classes") 13 | #endif 14 | 15 | #define _TEGGO_FORMAT_HERE 16 | #include "format.h" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_format_module() {} 19 | -------------------------------------------------------------------------------- /Core/classes/sources/logger.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_LOGGER_HERE 15 | #include "logger.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_logger_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/makeall.bat: -------------------------------------------------------------------------------- 1 | for /F %%i in ('cd') do set P=%%i 2 | set PATH=%P%\..\..\Python26;%P%\..\..\C++\mingw32;%PATH% 3 | 4 | set PSDK=%P%\..\..\C++\PSDK 5 | set PSDK_INCLUDE=%PSDK%\include 6 | set PSDK_LIB=%PSDK%\lib 7 | set CLDIR=%P%\..\..\C++\7 8 | set PATH=%CLDIR%\bin;%PSDK%\bin;%PATH% 9 | set LIB=%PSDK%\lib;%CLDIR%\lib 10 | set INCLUDE=%PSDK%\include;%CLDIR%\include 11 | 12 | python ./makeit.py debug 13 | python ./makeit.py 14 | -------------------------------------------------------------------------------- /Core/classes/sources/string.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_STRING_HERE 15 | #include "string.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_strings_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/sysutil.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_SYSUTIL_HERE 15 | #include "sysutil.h" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_sysutil_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/threads.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_THREADS_HERE 15 | #include "threads.h" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_threads_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/genericio.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_GENIO_HERE 15 | #include "genericio.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_genericio_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/keylist.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_KEYLIST_HERE 15 | #include "keylist.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_keylist_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/messages.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_MESSAGES_HERE 15 | #include "messages.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_messages_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/com_dynamic.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_COMDYNAMIC_HERE 15 | #include "com_dynamic.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_com_dynamic_module() {}; -------------------------------------------------------------------------------- /Core/classes/sources/defparser.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_DEFPARS_HERE 15 | #include "defparser.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_defparser_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/hinstance.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_INSTANCE_HERE 15 | #include "hinstance.h" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_hinstance_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/saxparser.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_SAXPARS_HERE 15 | #include "saxparser.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_saxparser_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/com_register.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_COMREGISTER_HERE 15 | #include "com_register.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_com_register_module() {}; -------------------------------------------------------------------------------- /Core/classes/sources/lz77ss.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | #endif 12 | 13 | #define _TEGGO_LZ77SS_HERE 14 | #include "_specific.h" 15 | //#include "lz77ss.h" 16 | #include "lz77ss.inl" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_lz77ss_module() {}; 19 | -------------------------------------------------------------------------------- /Core/classes/sources/symboltable.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_SYMTABLE_HERE 15 | #include "symboltable.inl" 16 | 17 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_symboltable_module() {}; 18 | -------------------------------------------------------------------------------- /Core/classes/sources/_crc32.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_CRC32_HERE 15 | #include "_specific.h" 16 | #include "_crc32.h" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_crc32_module() {} 19 | -------------------------------------------------------------------------------- /Core/classes/sources/collection.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #include "detect_compiler.h" 10 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 11 | #pragma code_seg(".text$classes") 12 | //#pragma data_seg(".data$classes") 13 | #endif 14 | 15 | #define _TEGGO_COLLECTION_HERE 16 | #include "collection.inl" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_collection_module() {}; 19 | -------------------------------------------------------------------------------- /Core/classes/sources/_adler32.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_ADLER_HERE 15 | #include "_specific.h" 16 | #include "_adler32.h" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_addler32_module() {}; 19 | -------------------------------------------------------------------------------- /Core/classes/sources/_codecop.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_CODECOP_HERE 15 | #include "_specific.h" 16 | #include "_codecop.inl" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_codecop_module() {} 19 | -------------------------------------------------------------------------------- /Core/include/spackstru.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey.sudachen@desanova.cl 5 | 6 | */ 7 | 8 | #include "../../include/layout.h" 9 | 10 | typedef SVFS_FILE_KEY SPACK_FILE_KEY; 11 | typedef SVFS_PUBLIC_NAME SPACK_PUBLIC_NAME; 12 | typedef SVFS_FILE_BLOCK SPACK_FILE_BLOCK; 13 | typedef SVFS_FILE_INFO SPACK_FILE_INFO; 14 | typedef SVFS_PACKAGE SPACK_PACKAGE; 15 | typedef SVFS_FIPROXY SPACK_FIPROXY; 16 | typedef SVFS_HEADER SPACK_HEADER; 17 | -------------------------------------------------------------------------------- /Core/include/syncronized.h: -------------------------------------------------------------------------------- 1 | 2 | /*template < class T > 3 | struct SinchronizedT 4 | { 5 | T t_; 6 | struct U 7 | { 8 | T *t_; 9 | Tlocker &l_; 10 | T *operator->() { return t_; } 11 | U(T *t, Tlocker &l) : t_(t), l_(l) { l_.Lock(); } 12 | ~U() { l_.Unlock(); } 13 | }; 14 | Tlocker l_; 15 | SinchronizedT() {}; 16 | U operator ->() { return U(&t_,l_); } 17 | };*/ 18 | 19 | 20 | -------------------------------------------------------------------------------- /Core/classes/sources/streams.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "detect_compiler.h" 9 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 10 | #pragma code_seg(".text$classes") 11 | //#pragma data_seg(".data$classes") 12 | #endif 13 | 14 | #define _TEGGO_STREAMS_HERE 15 | #define _TEGGO_STREAMS_LOGWRITE_HERE 16 | #include "streams.inl" 17 | 18 | extern "C" _TEGGO_EXPORTABLE void __teggo_classes_streams_module() {}; 19 | -------------------------------------------------------------------------------- /Core/classes/sources/_specific.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #define _Nomemory _Nomemory__ 10 | 11 | #include "detect_compiler.h" 12 | #if CXX_COMPILER_IS_MSVC_COMPATIBLE 13 | #pragma code_seg(".text$classes") 14 | //#pragma data_seg(".data$classes") 15 | #endif 16 | 17 | #define _TEGGO_SPECIFIC_HERE 18 | #include "_specific.h" 19 | #include "_specific.inl" 20 | 21 | #undef _Nomemory 22 | 23 | namespace std 24 | { 25 | void _Nomemory(void) {} 26 | } -------------------------------------------------------------------------------- /MxbPack/src/rgsreg.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #define UNICODE 9 | 10 | #include "myafx.h" 11 | #include 12 | //#include 13 | #include 14 | 15 | bool RegisterRcScript(pchar_t text,unsigned len,pwide_t modname) 16 | { 17 | CRegObject cro; 18 | cro.FinalConstruct(); 19 | cro.AddReplacement(L"MODULE",modname); 20 | CRegParser crp(&cro); 21 | return SUCCEEDED(crp.RegisterBuffer((wchar_t*)text,TRUE)); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Core/classes/sources/xoredstring_xor.py: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # 4 | # Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | # 6 | # 7 | 8 | import sys 9 | 10 | name = sys.argv[1] 11 | xormask = ord(sys.argv[2]) 12 | text = sys.argv[3] 13 | 14 | r = [] 15 | 16 | s = "0x%02x" % xormask 17 | for i in text: 18 | r.append( ord(i) ^ xormask ) 19 | xormask = ((xormask << 1) | (xormask >> 7)) & 0x0ff 20 | 21 | for i in r: 22 | s+= (", 0x%02x" % i) 23 | print "static XoredStringA<%d> %s = {{" % (len(text)+1,name) 24 | print s 25 | print "}};" 26 | -------------------------------------------------------------------------------- /mkzip.cmd: -------------------------------------------------------------------------------- 1 | 2 | if exist "%~dp0xternal" set XTERNAL="%~dp0xternal" 3 | echo %XTERNAL% 4 | 5 | cd %~dp0 6 | 7 | set DIST=Molebox_GPL 8 | if not exist %DIST% mkdir %DIST% 9 | 10 | del /q %DIST%\* 11 | del /q molebox_gpl.zip 12 | 13 | set LIBRARIES=zlib libwx3 libtiff libpng libjpeg expatw libhash 14 | 15 | copy ~Release\molebox.exe %DIST% 16 | copy ~Release\mxbpack.exe %DIST% 17 | for %%i in (%LIBRARIES%) do copy ~Release\%%i_32r10.dll %DIST% 18 | 19 | %XTERNAL%\Env\7z a -tzip molebox_gpl.zip %DIST% 20 | 21 | del /q %DIST%\* 22 | rmdir %DIST% 23 | 24 | 25 | -------------------------------------------------------------------------------- /Core/classes/sources/makeallrebuild.bat-10.bat: -------------------------------------------------------------------------------- 1 | for /F %%i in ('cd') do set P=%%i 2 | set PATH=%P%\..\..\Python26;%P%\..\..\C++\mingw32;%PATH% 3 | 4 | set PSDK=%P%\..\..\C++\PSDK71 5 | set PSDK_INCLUDE=%PSDK%\include 6 | set PSDK_LIB=%PSDK%\lib 7 | set CLDIR=%P%\..\..\C++\10.1 8 | set PATH=%CLDIR%\bin;%PSDK%\bin;%PATH% 9 | set LIB=%PSDK%\lib;%CLDIR%\lib 10 | set INCLUDE=%PSDK%\include;%CLDIR%\include 11 | 12 | 13 | python ./makeit.py -j vc10 debug clean 14 | python ./makeit.py -j vc10 clean 15 | python ./makeit.py -j vc10 debug 16 | python ./makeit.py -j vc10 17 | -------------------------------------------------------------------------------- /Core/classes/sources/makeallrebuild.bat-10d.bat: -------------------------------------------------------------------------------- 1 | for /F %%i in ('cd') do set P=%%i 2 | set PATH=%P%\..\..\Python26;%P%\..\..\C++\mingw32;%PATH% 3 | 4 | set PSDK=%P%\..\..\C++\PSDK71 5 | set PSDK_INCLUDE=%PSDK%\include 6 | set PSDK_LIB=%PSDK%\lib 7 | set CLDIR=%P%\..\..\C++\10.1 8 | set PATH=%CLDIR%\bin;%PSDK%\bin;%PATH% 9 | set LIB=%PSDK%\lib;%CLDIR%\lib 10 | set INCLUDE=%PSDK%\include;%CLDIR%\include 11 | 12 | 13 | python ./makeit.py -j vc10md debug clean 14 | python ./makeit.py -j vc10md clean 15 | python ./makeit.py -j vc10md debug 16 | python ./makeit.py -j vc10md 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | *.smod 19 | 20 | # Compiled Static libraries 21 | *.lai 22 | *.la 23 | *.a 24 | *.lib 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | 31 | 32 | *.pyc 33 | 34 | ~* 35 | .* 36 | *.pyd 37 | *.lib 38 | *.exp 39 | *.pdb 40 | *.idb 41 | *.orig 42 | 43 | /Core/cor0S.c 44 | /MxbPack/Q0.c 45 | *.BIN 46 | *.map 47 | *.zip 48 | /xternal 49 | -------------------------------------------------------------------------------- /Core/classes/sources/makeallrebuild.bat: -------------------------------------------------------------------------------- 1 | for /F %%i in ('cd') do set P=%%i 2 | set PATH=%P%\..\..\Python26;%P%\..\..\C++\mingw32;%PATH% 3 | 4 | set PSDK=%P%\..\..\C++\PSDK 5 | set PSDK_INCLUDE=%PSDK%\include 6 | set PSDK_LIB=%PSDK%\lib 7 | set CLDIR=%P%\..\..\C++\7 8 | set PATH=%CLDIR%\bin;%PSDK%\bin;%PATH% 9 | set LIB=%PSDK%\lib;%CLDIR%\lib 10 | set INCLUDE=%PSDK%\include;%CLDIR%\include 11 | 12 | 13 | python ./makeit.py shared debug clean 14 | python ./makeit.py shared clean 15 | python ./makeit.py debug clean 16 | python ./makeit.py clean 17 | python ./makeit.py debug 18 | python ./makeit.py 19 | -------------------------------------------------------------------------------- /mkxtrenal.cmd: -------------------------------------------------------------------------------- 1 | 2 | set MSRT=_100 3 | set XTERNAL_TARGET=x86 4 | set LIBRARIES=zlib libtiff libpng libjpeg libwx3 expatw libhash 5 | set LIBRARIES2=zlib libhash libpict 6 | 7 | cd %~dp0 8 | set CURR=%CD% 9 | if exist "%~dp0xternal" set XTERNAL=%~dp0xternal 10 | cd "%XTERNAL%" 11 | for %%i in (%LIBRARIES%) do cmd /c make_one.cmd %%i dll x86 rt100 12 | for %%i in (%LIBRARIES2%) do cmd /c make_one.cmd %%i static x86 rt100 13 | cd %CURR% 14 | 15 | for %%c in (~Release ~Debug) do ( 16 | if not exist %%c mkdir %%c 17 | for %%i in (%LIBRARIES%) do copy "%XTERNAL%\%%c"\%%i_32r10*.dll %%c 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /Core/Xi/gdi32.Xi: -------------------------------------------------------------------------------- 1 | # 2 | # splited import table declaration 3 | # $Id$ 4 | # 5 | 6 | AddFontResourceA,int,LPCTSTR 7 | RemoveFontResourceA,BOOL,LPCTSTR 8 | DeleteDC,BOOL,HDC 9 | CreateDIBSection,HBITMAP,HDC,CONST BITMAPINFO *,UINT,VOID **,HANDLE,DWORD 10 | CreateCompatibleDC,HDC,HDC 11 | BitBlt,BOOL,HDC,int,int,int,int,HDC,int,int,DWORD 12 | SelectObject,HGDIOBJ,HDC,HGDIOBJ 13 | GetObjectA,int,HGDIOBJ,int,LPVOID 14 | DeleteObject,BOOL,HGDIOBJ 15 | GetDC,HDC,HWND 16 | ReleaseDC,BOOL,HWND,HDC 17 | SetDIBits,int,HDC,HBITMAP,UINT,UINT,VOID*,BITMAPINFO*,UINT 18 | CreateCompatibleBitmap,HBITMAP,HDC,int,int 19 | 20 | -------------------------------------------------------------------------------- /Core/classes/sources/lz77ss.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___4d88f09e_0e1b_433b_9d95_d7984107b2bd___ 9 | #define ___4d88f09e_0e1b_433b_9d95_d7984107b2bd___ 10 | 11 | #include "_specific.h" 12 | 13 | #if defined _TEGGOINLINE 14 | #include "./lz77ss.inl" 15 | #else 16 | extern "C" _TEGGO_EXPORTABLE int lz77ss_compress(void* in_b, int in_b_len, void* out_b, int out_b_len); 17 | extern "C" _TEGGO_EXPORTABLE int lz77ss_decompress(void* in_b, int in_b_len, void* out_b, int out_b_len); 18 | #endif 19 | 20 | #endif /*___4d88f09e_0e1b_433b_9d95_d7984107b2bd___*/ 21 | -------------------------------------------------------------------------------- /Core/src/splash_pp.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "_common.h" 3 | #include "logger.h" 4 | #include "vfs.h" 5 | 6 | extern "C" void* Pict_From_BMP_Specific_NoX(void* bytes, int count, int format); 7 | extern "C" void Execute_Splash_Thread(void*); 8 | 9 | void SplashScreen() 10 | { 11 | void* pict = 0; 12 | if (FioProxyPtr fp = VFS->GetProxy(L"_$splash$_.bmp", 0, true)) 13 | { 14 | u32_t wasread; 15 | BufferT buffer(fp->Size()); 16 | fp->Read(0, +buffer, buffer.Count(), &wasread); 17 | pict = Pict_From_BMP_Specific_NoX(+buffer, buffer.Count(), 0); 18 | } 19 | if (pict) 20 | Execute_Splash_Thread(pict); 21 | } 22 | -------------------------------------------------------------------------------- /Core/DLL.rc: -------------------------------------------------------------------------------- 1 | 2 | 1 VERSIONINFO 3 | FILEVERSION 4,0,0,6000 4 | PRODUCTVERSION 4,0,0,6000 5 | FILEFLAGSMASK 0x3fL 6 | #ifdef _DEBUG 7 | FILEFLAGS 0x1L 8 | #else 9 | FILEFLAGS 0x0L 10 | #endif 11 | FILEOS 0x40004L 12 | FILETYPE 0x2L 13 | FILESUBTYPE 0x0L 14 | BEGIN 15 | BLOCK "StringFileInfo" 16 | BEGIN 17 | BLOCK "000004b0" 18 | BEGIN 19 | VALUE "FileDescription", "MOLEBOX VIRTUALIZATION CORE (STEELBOX)\0" 20 | VALUE "FileVersion", "4, 0, 0, 6000\0" 21 | VALUE "ProductVersion", "4, 0, 0, 6000\0" 22 | END 23 | END 24 | BLOCK "VarFileInfo" 25 | BEGIN 26 | VALUE "Translation", 0x0, 1200 27 | END 28 | END 29 | 30 | -------------------------------------------------------------------------------- /Core/classes/sources/zlib.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___ccec6e05_9363_4b36_9628_f75bb5368d07___ 9 | #define ___ccec6e05_9363_4b36_9628_f75bb5368d07___ 10 | 11 | #include "_specific.h" 12 | 13 | #if defined _TEGGOINLINE 14 | #include "./zlib.inl" 15 | #else 16 | CXX_EXTERNC _TEGGO_EXPORTABLE int zlib_compress(void* in_b, int in_b_len, void* out_b, int out_b_len); 17 | CXX_EXTERNC _TEGGO_EXPORTABLE int zlib_compress_l(void* in_b, int in_b_len, void* out_b, int out_b_len, int level); 18 | CXX_EXTERNC _TEGGO_EXPORTABLE int zlib_decompress(void* in_b, int in_b_len, void* out_b, int out_b_len); 19 | #endif 20 | 21 | #endif /*___ccec6e05_9363_4b36_9628_f75bb5368d07___*/ 22 | -------------------------------------------------------------------------------- /Core/src/fw/fwlds.x: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT(pei-i386) 2 | ENTRY(_Start) 3 | SEARCH_DIR("/mingw/mingw32/lib"); SEARCH_DIR("/mingw/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); 4 | SECTIONS 5 | { 6 | . = SIZEOF_HEADERS; 7 | . = ALIGN(__section_alignment__); 8 | __extra_base__ = __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ); 9 | .extra __extra_base__ : 10 | { 11 | *(.text$start) 12 | *(.text$ndes) 13 | *(.text$xor) 14 | *(.text$aux) 15 | *(.text$code) 16 | } 17 | /DISCARD/ : 18 | { 19 | *(.text) 20 | *(.reloc) 21 | *(.edata) 22 | *(.bss) 23 | *(COMMON) 24 | *(.rsrc) 25 | *(.idata*) 26 | *(.data*) 27 | *(.rdata*) 28 | *(.END) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Core/classes/sources/wexcept.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined __E48D916E_9149_4F44_9FA5_10FA6930CFD5__ 9 | #define __E48D916E_9149_4F44_9FA5_10FA6930CFD5__ 10 | 11 | #include "_specific.h" 12 | #include "format.h" 13 | #include "string.h" 14 | 15 | namespace teggo 16 | { 17 | struct WideException 18 | { 19 | WideException(pwide_t what=0) : what_(what) {} 20 | WideException(FormatT const& fwhat) { fwhat.Write(what_); } 21 | virtual pwide_t What() const { return what_?what_.Str():L"unknown wexception"; } 22 | virtual ~WideException() {} 23 | 24 | widestring what_; 25 | }; 26 | } 27 | 28 | #endif // __E48D916E_9149_4F44_9FA5_10FA6930CFD5__ 29 | -------------------------------------------------------------------------------- /MxbPack/src/mxbpack_RC.rc: -------------------------------------------------------------------------------- 1 | 2 | 3 | "APPICON" ICON DISCARDABLE "mxbpack.ico" 4 | 200 ICON DISCARDABLE "pe32.ico" 5 | 6 | 1 VERSIONINFO 7 | FILEVERSION 4,0,0,6000 8 | PRODUCTVERSION 4,0,0,6000 9 | FILEFLAGSMASK 0x3fL 10 | #ifdef _DEBUG 11 | FILEFLAGS 0x1L 12 | #else 13 | FILEFLAGS 0x0L 14 | #endif 15 | FILEOS 0x40004L 16 | FILETYPE 0x2L 17 | FILESUBTYPE 0x0L 18 | BEGIN 19 | BLOCK "StringFileInfo" 20 | BEGIN 21 | BLOCK "000004b0" 22 | BEGIN 23 | VALUE "FileDescription", "The Molebox Wrapper\0" 24 | VALUE "FileVersion", "4, 0, 0, 6000\0" 25 | VALUE "ProductVersion", "4, 0, 0, 6000\0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0, 1200 31 | END 32 | END 33 | 34 | -------------------------------------------------------------------------------- /Core/classes/sources/_shash.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | namespace teggo 9 | { 10 | 11 | _TEGGO_EXPORTABLE u32_t Shash(char const* t,int len = -1); 12 | 13 | #if defined _TEGGO_SPECIFIC_HERE || defined _TEGGOINLINE 14 | 15 | #if defined _TEGGO_SPECIFIC_HERE 16 | _TEGGO_EXPORTABLE 17 | #else 18 | CXX_FAKE_INLINE 19 | #endif 20 | 21 | u32_t Shash(char const* t,int len) 22 | { 23 | byte_t const* p = (byte_t const*)t; 24 | u32_t h = 0; 25 | if ( len < 0 ) 26 | for ( ; *p; ++p ) 27 | h = ( h << 1 ) | *p; 28 | else 29 | while ( len-- > 0 ) 30 | h = ( h << 1 ) | *p++; 31 | return h; 32 | } 33 | 34 | #endif 35 | 36 | } // namespace 37 | -------------------------------------------------------------------------------- /Core/makeit.cmd: -------------------------------------------------------------------------------- 1 | 2 | @echo off 3 | 4 | set CPU=X86 5 | set BUILD=RELEASE 6 | set goal= 7 | 8 | 9 | set PYTHON_HOME=c:\Python27 10 | set PATH=%XTERNAL%\Env;%PYTHON_HOME%;%PATH% 11 | cd %~dp0 12 | set ENV=env32_100.cmd 13 | set BUILDBOT_VERSION_INCREMENT=YES 14 | 15 | for /F %%i in ('%XTERNAL%\posixtime.exe') do set POSIXBUILDTIME=%%i 16 | 17 | :repeat 18 | if "%1" == "debug" set BUILD=DEBUG 19 | if "%1" == "release" set BUILD=RELEASE 20 | if "%1" == "clean" set goal=%goal% clean 21 | if "%1" == "all" set goal=%goal% all 22 | if "%1" == "build" set goal=%goal% all 23 | if "%1" == "rebuild" set goal=clean all 24 | if "%1" == "-t" goto :add_goal 25 | shift 26 | if "%1" neq "" goto :repeat 27 | 28 | %ENV% nmake -f Makefile.mak %goal% 29 | 30 | goto :eof 31 | 32 | :add_goal 33 | shift 34 | set goal=%goal% %1 35 | shift 36 | goto :repeat 37 | -------------------------------------------------------------------------------- /MxbPack/src/packager.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (C) 2008, Alexey Sudachen, DesaNova Ltda. 5 | http://www.desanova.com 6 | 7 | */ 8 | 9 | struct Packager : Ireferred 10 | { 11 | 12 | enum 13 | { 14 | F_HIDDEN = 1L, 15 | F_COMPRESSED = 1L << 1, 16 | F_ENCRYPTED = 1L << 2, 17 | F_ACTIVEX = 1L << 3, 18 | F_EXECUTABLE = 1L << 4, 19 | F_EXTERNAL = 1L << 5, 20 | F_NOACCESS = 1L << 6, 21 | }; 22 | 23 | virtual bool Start(DataStream* ds, pchar_t pwd, EhFilter ehf) = 0; 24 | virtual bool File(StringParam srcname, StringParam dstname, unsigned flags, EhFilter ehf, unsigned* persent) = 0; 25 | virtual bool Stream(byte_t* data, unsigned count,bool xzip,EhFilter ehf) = 0; 26 | virtual bool Finish(u32_t /*out*/ *offset,EhFilter ehf) = 0; 27 | 28 | virtual ~Packager() {} 29 | static rcc_ptr Create(); 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /Core/include/XorS.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___7aa75ac8_0ea9_466e_b151_d6eb6831e1fe___ 9 | #define ___7aa75ac8_0ea9_466e_b151_d6eb6831e1fe___ 10 | 11 | #define _XOr(a,L,S) (+xordata::XoredStringX(L,S)) 12 | #define _XOrL(a,_L,_S) L##a 13 | 14 | namespace xordata 15 | { 16 | 17 | extern "C" void* __cdecl _UnXOrS(int source, int count); 18 | extern "C" void __cdecl _UnXOrSfree(void*); 19 | 20 | template 21 | struct XoredStringX 22 | { 23 | tUUU* t_; 24 | XoredStringX(unsigned L, unsigned S) : t_((tUUU*)_UnXOrS(S, L* sizeof(tUUU))) {} 25 | ~XoredStringX() {_UnXOrSfree(t_);} 26 | inline tUUU* operator +() const { return t_; } 27 | //inline operator tUUU *() const { return t_; } 28 | }; 29 | } 30 | 31 | #endif /*___7aa75ac8_0ea9_466e_b151_d6eb6831e1fe___*/ 32 | -------------------------------------------------------------------------------- /MxbPack/src/XorS.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___7aa75ac8_0ea9_466e_b151_d6eb6831e1fe___ 9 | #define ___7aa75ac8_0ea9_466e_b151_d6eb6831e1fe___ 10 | 11 | #define _XOr(a,L,S) (+xordata::XoredStringX(L,S)) 12 | #define _XOrL(a,_L,_S) L##a 13 | 14 | namespace xordata 15 | { 16 | 17 | extern "C" void* __cdecl _UnXOrS(int source,int count); 18 | extern "C" void __cdecl _UnXOrSfree(void*); 19 | 20 | template 21 | struct XoredStringX 22 | { 23 | tUUU* t_; 24 | XoredStringX(unsigned L, unsigned S) : t_((tUUU*)_UnXOrS(S,L* sizeof(tUUU))) {} 25 | ~XoredStringX() {_UnXOrSfree(t_);} 26 | inline tUUU* operator +() const { return t_; } 27 | //inline operator tUUU *() const { return t_; } 28 | }; 29 | } 30 | 31 | #endif /*___7aa75ac8_0ea9_466e_b151_d6eb6831e1fe___*/ 32 | -------------------------------------------------------------------------------- /MxbPack/stub/pycparser/_build_tables.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # pycparser: _build_tables.py 3 | # 4 | # A dummy for generating the lexing/parsing tables and and 5 | # compiling them into .pyc for faster execution in optimized mode. 6 | # Also generates AST code from the _c_ast.yaml configuration file. 7 | # 8 | # Copyright (C) 2008, Eli Bendersky 9 | # License: LGPL 10 | #----------------------------------------------------------------- 11 | 12 | # Generate c_ast.py 13 | # 14 | from _ast_gen import ASTCodeGenerator 15 | ast_gen = ASTCodeGenerator('_c_ast.yaml') 16 | ast_gen.generate(open('c_ast.py', 'w')) 17 | 18 | import c_parser 19 | 20 | # Generates the tables 21 | # 22 | c_parser.CParser( 23 | lex_optimize=True, 24 | yacc_debug=False, 25 | yacc_optimize=True) 26 | 27 | # Load to compile into .pyc 28 | # 29 | import lextab 30 | import yacctab 31 | import c_ast 32 | -------------------------------------------------------------------------------- /Core/include/xojuman.h: -------------------------------------------------------------------------------- 1 | 2 | enum 3 | { 4 | XOJUMAN_MAX_PACKAGE_COUNT = 100, 5 | XOJUMAN_MAX_PACKAGE_NAME_LEN = 16, 6 | XOJUMAN_MAX_PATH_LEN = 256, 7 | }; 8 | 9 | 10 | typedef struct _XOJUMAN_INHERIT_PACKAGE 11 | { 12 | void* handle; 13 | INT64T offs; 14 | int opts; 15 | unsigned char pwd[16]; 16 | char name[XOJUMAN_MAX_PACKAGE_NAME_LEN + 1]; 17 | } XOJUMAN_INHERIT_PACKAGE; 18 | 19 | typedef struct _XOJUMAN_STARTUP_INFO 20 | { 21 | int flags; 22 | 23 | void* core_handle; 24 | int core_size; 25 | byte_t orign[12]; 26 | void* reserved_space; 27 | 28 | int subsystem; 29 | int master_id; 30 | int pkg_count; 31 | 32 | wchar_t container[XOJUMAN_MAX_PATH_LEN + 1]; 33 | wchar_t appname[XOJUMAN_MAX_PATH_LEN + 1]; 34 | wchar_t cmdline[XOJUMAN_MAX_PATH_LEN + 1]; 35 | wchar_t regmask[XOJUMAN_MAX_PATH_LEN + 1]; 36 | 37 | XOJUMAN_INHERIT_PACKAGE pkg[XOJUMAN_MAX_PACKAGE_COUNT]; 38 | } XOJUMAN_STARTUP_INFO; 39 | 40 | -------------------------------------------------------------------------------- /Core/Xi/Makefile.mak: -------------------------------------------------------------------------------- 1 | PROJECT=XI 2 | BASEDIR=.. 3 | SRCDIR=. 4 | !include $(BASEDIR)\Makefile.rules 5 | 6 | TARGET = $(LIBDIR)\Xi.lib 7 | 8 | OBJECTS = \ 9 | $(OBJDIR)\kernel32.obj \ 10 | $(OBJDIR)\gdi32.obj \ 11 | $(OBJDIR)\advapi32.obj \ 12 | $(OBJDIR)\ntdll.obj \ 13 | $(OBJDIR)\ole32.obj \ 14 | $(OBJDIR)\oleaut32.obj \ 15 | $(OBJDIR)\user32.obj \ 16 | $(OBJDIR)\version.obj \ 17 | $(OBJDIR)\winmm.obj \ 18 | 19 | ASMS = $(OBJECTS:.obj=.S) 20 | 21 | _all: $(OBJDIR) $(TARGET) 22 | 23 | $(OBJECTS) : $(ASMS) 24 | 25 | $(TARGET): $(OBJECTS) 26 | @echo -- collect -- $@ 27 | @link /lib -nologo -machine:$(CPU) -out:$(TARGET) $(OBJECTS) 28 | 29 | {}.Xi{$(OBJDIR)}.S: 30 | @echo generating $(*F).S 31 | @python xigentor.py $< $(OBJDIR)\$(*F).S $(*F) 32 | 33 | {$(OBJDIR)}.S{$(OBJDIR)}.obj: 34 | @echo compiling $(*F).S 35 | @$(AS) $(_M64) $< -o$(OBJDIR)\$(*F).obj 36 | 37 | clean: 38 | -erase $(OBJECTS) 39 | -erase $(ASMS) 40 | -erase $(TARGET) 41 | -erase *.H *.S 42 | 43 | -------------------------------------------------------------------------------- /MxbPack/stub/rotor.h: -------------------------------------------------------------------------------- 1 | #define _ROTOR_SID 58244 2 | #define _ROTOR "\207\074\155\357\240\201\373\351\273\203\013\073\146\147\370\122\075\336\056\040\031\055\106\235\254\274\234\066\251\051\105\173\345\172\012\156\366\250\321\154\322\365\071\020\052\220\174\120\350\070\367\271\142\261\356\233\024\171\124\176\133\335\153\243\375\026\000\275\042\266\347\204\255\316\137\006\362\244\302\061\324\160\315\210\331\017\045\241\063\030\132\140\111\151\214\246\304\076\327\314\237\123\157\072\001\270\301\060\353\107\212\005\064\034\037\054\131\260\307\035\354\323\032\377\253\206\134\311\014\161\224\222\065\164\330\332\360\257\023\004\170\175\112\130\144\113\217\016\231\103\376\062\115\371\163\114\326\276\002\126\223\101\027\136\162\263\252\265\010\247\047\177\166\053\227\021\125\057\272\025\343\300\342\036\167\100\200\226\346\044\205\104\102\041\003\340\067\143\306\141\236\117\303\310\007\312\152\050\202\277\221\374\150\121\264\245\216\165\215\355\352\213\305\337\267\256\127\011\046\015\211\372\333\230\242\145\334\232\320\364\110\325\313\225\022\317\363\043\344\135\341\116\033\361\262\077" 3 | 4 | -------------------------------------------------------------------------------- /Core/classes/sources/_crc32.h: -------------------------------------------------------------------------------- 1 | 2 | #if !defined __DC6F6981_BBF5_4871_B1AF_5404567FD536__ 3 | #define __DC6F6981_BBF5_4871_B1AF_5404567FD536__ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace teggo 10 | { 11 | 12 | inline uint32_t Crc32(uint32_t crc, const void* buf, size_t len) 13 | { 14 | return Crc_32(crc, buf, len); 15 | } 16 | 17 | inline uint16_t Crc16(uint16_t crc, const uint8_t* buf, size_t len) 18 | { 19 | return Crc_16(crc, buf, len); 20 | } 21 | 22 | inline uint8_t Crc8(uint8_t crc, const uint8_t* buf, size_t len) 23 | { 24 | return Crc_8(crc, buf, len); 25 | } 26 | 27 | #if defined _TEGGOINLINE || defined _TEGGO_CRC32_HERE 28 | 29 | CXX_EXTERNC unsigned long crc32(unsigned long crc, const unsigned char* buf, unsigned int len) 30 | { 31 | return Crc32(crc,buf,len); 32 | } 33 | 34 | #endif // defined _TEGGOINLINE || defined _TEGGO_CRC32_HERE 35 | 36 | } // namespace 37 | 38 | #endif // __DC6F6981_BBF5_4871_B1AF_5404567FD536__ 39 | -------------------------------------------------------------------------------- /MxbPack/src/import.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | EXTERN_C void* _NTDLL; 9 | EXTERN_C void* _KERN32; 10 | EXTERN_C void* (__stdcall* _get_module_hook)(char* modname); 11 | EXTERN_C void* (__stdcall* _load_module_hook)(char* modname); 12 | EXTERN_C void* get_predefined_module(char* modname); 13 | EXTERN_C void* GetProcAddressIndirect(void* module,char* procname,int hint); 14 | 15 | 16 | /// - light imports - /// 17 | 18 | enum 19 | { 20 | IMPORT_ERR_MODULE_NO_EXISTS = 1, 21 | }; 22 | 23 | enum 24 | { 25 | LI_USE_FULL_THUNK = 1, 26 | LI_DONT_SPLICE = 2, 27 | LI_WRAP_DEPENDEND = 4, 28 | LI_UNPROTECT_SECTION = 8, 29 | LI_HOOK_API = 16, 30 | }; 31 | 32 | typedef void* (__stdcall* loadlibrary_t)(char* dllname); 33 | EXTERN_C void Import(unsigned char* base, IMAGE_NT_HEADERS const* nth, loadlibrary_t l); 34 | EXTERN_C void Import1(IMAGE_IMPORT_DESCRIPTOR* import,unsigned char* base, loadlibrary_t l); 35 | EXTERN_C void Relocate(unsigned char* base, IMAGE_NT_HEADERS const* nth); 36 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | ruby RUBY_VERSION 3 | 4 | # Hello! This is where you manage which Jekyll version is used to run. 5 | # When you want to use a different version, change it below, save the 6 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: 7 | # 8 | # bundle exec jekyll serve 9 | # 10 | # This will help ensure the proper Jekyll version is running. 11 | # Happy Jekylling! 12 | gem "jekyll", "3.4.3" 13 | 14 | # This is the default theme for new Jekyll sites. You may change this to anything you like. 15 | gem "minima", "~> 2.0" 16 | 17 | # If you want to use GitHub Pages, remove the "gem "jekyll"" above and 18 | # uncomment the line below. To upgrade, run `bundle update github-pages`. 19 | gem "github-pages", group: :jekyll_plugins 20 | 21 | # If you have any plugins, put them here! 22 | group :jekyll_plugins do 23 | gem "jekyll-feed", "~> 0.6" 24 | end 25 | 26 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 27 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 28 | 29 | gem "jekyll-theme-slate" 30 | -------------------------------------------------------------------------------- /Core/Makefile.mak: -------------------------------------------------------------------------------- 1 | 2 | all: Xi_Build Core_Build Cor0S 3 | clean: Xi_Clean Core_Clean 4 | 5 | Xi_Build: 6 | @echo build Xi.lib 7 | @cd Xi 8 | @$(MAKE) /nologo -f Makefile.mak 9 | @cd .. 10 | 11 | Xi_Clean: 12 | @echo clean Xi.lib 13 | @cd Xi 14 | @$(MAKE) /nologo -f Makefile.mak clean 15 | @cd .. 16 | 17 | Core_Build: 18 | @echo build cor1xxx.dll 19 | @cd src 20 | @$(MAKE) /nologo -f Makefile.mak 21 | @cd .. 22 | 23 | Core_Clean: 24 | @echo clean core.lib 25 | @cd src 26 | @$(MAKE) /nologo -f Makefile.mak clean 27 | @cd .. 28 | 29 | molebox.BIN.C molebox.BIN: build_molebox_BIN 30 | build_molebox_BIN: mkfw.exe loader.lso 31 | mkfw.exe 32 | 33 | _lzss.pyd: 34 | cl -nologo -Z7 -LD -MT -Ox _lzss.c classes/sources/lz77ss.cpp -I"$(PYTHON_HOME)/include" "$(PYTHON_HOME)/Libs/python27.lib" -Fe"_lzss.pyd" -link -dll -debug -incremental:no -export:init_lzss 35 | 36 | Cor0S: Core_Build _lzss.pyd 37 | !if "$(BUILD)" == "RELEASE" 38 | $(PYTHON_HOME)\python ecore.py ../~Release/cor1rel.dll ../~Release/cor1rel.Biz ../~Release/cor1rel.raw 39 | mbin2c ../~Release/cor1rel.Biz core0S > cor0S.c 40 | !endif 41 | 42 | -------------------------------------------------------------------------------- /Core/classes/sources/xoredstring.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___4d259329_5ee0_475c_9566_f52f55850619___ 9 | #define ___4d259329_5ee0_475c_9566_f52f55850619___ 10 | 11 | namespace teggo 12 | { 13 | 14 | char* XoredStringA_Xor(unsigned char const* data, unsigned n, char* val) 15 | { 16 | int x = data[0]; 17 | for ( unsigned i = 1; i < n; ++i ) 18 | { 19 | val[i-1] = data[i] ^ x; 20 | x = ((x << 1) | (x >> 7)) & 0x0ff; 21 | } 22 | val[n-1] = 0; 23 | return val; 24 | } 25 | 26 | template 27 | struct XoredStringA_ 28 | { 29 | mutable char value[tN]; 30 | }; 31 | 32 | 33 | template 34 | struct XoredStringA 35 | { 36 | unsigned char text[tN]; 37 | inline char* Xor(XoredStringA_ const& a = XoredStringA_()) 38 | { 39 | return XoredStringA_Xor(text,tN,a.value); 40 | } 41 | }; 42 | 43 | } // namespace 44 | 45 | #endif // ___4d259329_5ee0_475c_9566_f52f55850619___ 46 | -------------------------------------------------------------------------------- /Core/classes/sources/newdes.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___6ea1d37e_eace_4986_b99a_fcd335057356___ 9 | #define ___6ea1d37e_eace_4986_b99a_fcd335057356___ 10 | 11 | #if !defined _WITHOUT_TFFCLS 12 | #include "./_specific.h" 13 | #else 14 | #include "./detect_compiler.h" 15 | #define _TEGGO_EXPORTABLE 16 | #endif 17 | 18 | #include 19 | 20 | namespace teggo 21 | { 22 | 23 | struct NEWDES_Cipher // trivial 'aka C' structure 24 | { 25 | NDES_CONTEXT ctx; 26 | 27 | _TEGGO_EXPORTABLE void SetupEncipher(void const* key); 28 | _TEGGO_EXPORTABLE void SetupDecipher(void const* key); 29 | _TEGGO_EXPORTABLE void DoCipher(void* data, u32_t count_of_blocks); 30 | _TEGGO_EXPORTABLE void DoCipherCBCI(void* data, u32_t count_of_blocks, uint64_t IVc = 0); 31 | _TEGGO_EXPORTABLE void DoCipherCBCO(void* data, u32_t count_of_blocks, uint64_t IVc = 0); 32 | _TEGGO_EXPORTABLE void DoCipherBlock(void* b); 33 | }; 34 | } 35 | 36 | #include "./newdes.inl" 37 | 38 | #endif // ___6ea1d37e_eace_4986_b99a_fcd335057356___ 39 | -------------------------------------------------------------------------------- /Core/classes/sources/defparser.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___15724387_86d6_46a7_8d40_ca2bf44700d6___ 9 | #define ___15724387_86d6_46a7_8d40_ca2bf44700d6___ 10 | 11 | #include "_specific.h" 12 | #include "string.h" 13 | #include "streams.h" 14 | #include "refcounted.h" 15 | #include "xdom.h" 16 | 17 | namespace teggo 18 | { 19 | 20 | _TEGGO_EXPORTABLE TEGGOt_E CXX_STDCALL DEFparse(DataStream* ds, XMLdocumentBuilder* db); 21 | _TEGGO_EXPORTABLE TEGGOt_E CXX_STDCALL DEFparse(StringParam source, XMLdocumentBuilder* db); 22 | _TEGGO_EXPORTABLE Xdocument CXX_STDCALL XopenDefDocument(StringParam docname); 23 | _TEGGO_EXPORTABLE Xdocument CXX_STDCALL XopenDefDocument(DataStream&); 24 | _TEGGO_EXPORTABLE TEGGOt_E CXX_STDCALL XwriteDefDocument(Xnode* root_node, StringParam fname, bool use_utf8 = false); 25 | _TEGGO_EXPORTABLE TEGGOt_E CXX_STDCALL XwriteDefDocument(Xnode* root_node, DataStream* ds, bool use_utf8 = false); 26 | 27 | } // namespace teggo 28 | 29 | #if defined _TEGGOINLINE 30 | #include "defparser.inl" 31 | #endif 32 | 33 | #endif //___15724387_86d6_46a7_8d40_ca2bf44700d6___ 34 | -------------------------------------------------------------------------------- /Core/classes/sources/symboltable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___9edf61b2_cac8_4452_b9f5_62d63e759207___ 9 | #define ___9edf61b2_cac8_4452_b9f5_62d63e759207___ 10 | 11 | #include "_specific.h" 12 | #include "string.h" 13 | #include "flatset.h" 14 | #include "refcounted.h" 15 | 16 | namespace teggo 17 | { 18 | 19 | struct SymbolTable : Refcounted 20 | { 21 | _TEGGO_EXPORTABLE pwide_t FindSymbol(pwide_t); 22 | _TEGGO_EXPORTABLE pwide_t GetSymbol(pwide_t); 23 | _TEGGO_EXPORTABLE SymbolTable(); 24 | _TEGGO_EXPORTABLE ~SymbolTable(); 25 | private: 26 | struct PWIDE { unsigned len; pwide_t text; }; 27 | struct PWideLess 28 | { 29 | bool operator() (const PWIDE& a,const PWIDE& b) const 30 | { 31 | return a.len < b.len || (a.len == b.len && wcsicmp(a.text,b.text) < 0); 32 | } 33 | }; 34 | FlatsetT table_; 35 | }; 36 | } 37 | 38 | #if defined _TEGGOINLINE 39 | #include "symboltable.inl" 40 | #endif 41 | 42 | #endif //___9edf61b2_cac8_4452_b9f5_62d63e759207___ 43 | -------------------------------------------------------------------------------- /Core/src/hc/tests/regimport.c: -------------------------------------------------------------------------------- 1 | 2 | #define _LIBYOYO 3 | #define _REGIMPORT_BUILTIN 4 | 5 | #include "../yoyo.hc" 6 | #include "../regimport.hc" 7 | #include "../prog.hc" 8 | #include "../file.hc" 9 | 10 | void usage() 11 | { 12 | puts("use: regimport file.reg"); 13 | } 14 | 15 | int main(int argc, char **argv) 16 | { 17 | Prog_Init(argc,argv,"?|h",PROG_EXIT_ON_ERROR); 18 | 19 | //__Try_Exit(argv[0]) 20 | { 21 | YO_BUFFER *bf; 22 | REGISTRY_RECORD *r; 23 | char *text; 24 | int charset; 25 | int thold = 0; 26 | 27 | if ( Prog_Arguments_Count() < 1 ) 28 | { 29 | usage(); 30 | exit(-1); 31 | } 32 | 33 | __Auto_Ptr(bf) bf = Oj_Read_All(File_Open(Prog_Argument(0),"rt")); 34 | 35 | Buffer_Fill_Append(bf,0,2); 36 | text = bf->at; 37 | charset = Detect_Registry_Charset(&text); 38 | 39 | for ( thold = 0; __Purge(&thold) && 0 != (r = Next_Registry_Record(&text,charset)); ) 40 | { 41 | puts(Format_Registry_Record(r,RR_CHARSET_UTF8)); 42 | } 43 | 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Core/classes/sources/fuslog.h: -------------------------------------------------------------------------------- 1 | 2 | namespace teggo 3 | { 4 | 5 | struct fuslog 6 | { 7 | enum { FUS_UNKNOWN = 0, FUS_TRUE, FUS_FALSE }; 8 | byte_t val_; 9 | fuslog() : val_(FUS_UNKNOWN) {} 10 | fuslog(fuslog const& x) : val_(x.val_) {} 11 | fuslog(bool b) {} 12 | bool False() { return val_ == FUS_FALSE; } 13 | bool True() { return val_ == FUS_TRUE; } 14 | void operator |= (bool b) { if ( b ) val_ = FUS_TRUE; } 15 | void operator &= (bool b) { if ( !b ) val_ = FUS_FALSE; } 16 | }; 17 | 18 | // if ( false || fusval ) -> false if fusval is not true 19 | // if ( true || fusval ) -> true 20 | // if ( false && fusval ) -> false 21 | // if ( true && fusval ) -> true if fusval is not false 22 | 23 | inline bool operator || ( bool b, fuslog f ) { if ( !b && f.val_ != fuslog::FUS_TRUE ) return false; return true; } 24 | inline bool operator && ( bool b, fuslog f ) { if ( b && f.val_ != fuslog::FUS_FALSE ) return true; return false; } 25 | inline bool operator || ( fuslog f, bool b ) { return b || f; } 26 | inline bool operator && ( fuslog f, bool b ) { return b && f; } 27 | 28 | } // namespace 29 | -------------------------------------------------------------------------------- /Core/Xi/user32.Xi: -------------------------------------------------------------------------------- 1 | # 2 | # splited import table declaration 3 | # $Id$ 4 | # 5 | 6 | MessageBoxA,int,HWND,LPCSTR,LPCSTR,UINT 7 | MessageBoxW,int,HWND,LPCWSTR,LPCWSTR,UINT 8 | MessageBoxExA,int,HWND,LPCSTR,LPCSTR,UINT,int 9 | PostMessageA,BOOL,HWND,UINT,WPARAM,LPARAM 10 | CharUpperBuffA,DWORD,LPSTR,DWORD 11 | ChangeDisplaySettingsA,LONG,LPDEVMODEA,DWORD 12 | DefWindowProcA,HRESULT,HWND,UINT,WPARAM,LPARAM 13 | EndPaint,BOOL,HWND,CONST PAINTSTRUCT * 14 | BeginPaint,HDC,HWND,LPPAINTSTRUCT 15 | SetForegroundWindow,BOOL,HWND 16 | SetActiveWindow,HWND,HWND 17 | SetFocus,HWND,HWND 18 | DestroyWindow,BOOL,HWND 19 | GetWindowThreadProcessId,DWORD,HWND,LPDWORD 20 | EnumWindows,BOOL,WNDENUMPROC,LPARAM 21 | DispatchMessageA,LRESULT,CONST MSG* 22 | TranslateMessage,BOOL,CONST MSG* 23 | GetMessageA,BOOL,LPMSG,HWND,UINT,UINT 24 | CreateWindowExA,HWND,DWORD,LPCSTR,LPCSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID 25 | AdjustWindowRectEx,BOOL,LPRECT,DWORD,BOOL,DWORD 26 | GetSystemMetrics,int,int 27 | RegisterClassExA,ATOM,CONST WNDCLASSEX * 28 | LoadImageA,HANDLE,HINSTANCE,LPCSTR,UINT,int,int,UINT 29 | CharToOemA,BOOL,LPCSTR,LPSTR 30 | wvsprintfA,int,LPSTR,LPCSTR,va_list 31 | %wsprintfA,int 32 | ShowWindow,BOOL,HWND,int 33 | KillTimer,BOOL,HWND,UINT_PTR 34 | SetTimer,UINT_PTR,HWND,UINT_PTR,UINT,TIMERPROC 35 | UpdateWindow,BOOL,HWND 36 | -------------------------------------------------------------------------------- /Core/include/import.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | EXTERN_C void* _NTDLL; 9 | EXTERN_C void* _KERN32; 10 | EXTERN_C void* _USER32; 11 | EXTERN_C void* _ADVA32; 12 | EXTERN_C void* (__stdcall* _get_module_hook)(char* modname); 13 | EXTERN_C void* (__stdcall* _load_module_hook)(char* modname); 14 | EXTERN_C void* get_predefined_module(char* modname); 15 | EXTERN_C void* GetProcAddressIndirect(void* module, char* procname, int hint); 16 | 17 | /// - light imports - /// 18 | 19 | enum 20 | { 21 | IMPORT_ERR_MODULE_NO_EXISTS = 1, 22 | }; 23 | 24 | enum 25 | { 26 | LI_USE_FULL_THUNK = 1, 27 | LI_DONT_SPLICE = 2, 28 | LI_WRAP_DEPENDEND = 4, 29 | LI_UNPROTECT_SECTION = 8, 30 | LI_HOOK_API = 16, 31 | }; 32 | 33 | typedef void* (__stdcall* loadlibrary_t)(char* dllname); 34 | typedef void* (__stdcall* getproc_t)(void* module, char* procname); 35 | EXTERN_C void Import(unsigned char* base, IMAGE_NT_HEADERS const* nth, loadlibrary_t l CXX_OPTIONAL_0, 36 | getproc_t g CXX_OPTIONAL_0); 37 | EXTERN_C void Import1(IMAGE_IMPORT_DESCRIPTOR* import, unsigned char* base, loadlibrary_t l CXX_OPTIONAL_0, 38 | getproc_t g CXX_OPTIONAL_0); 39 | EXTERN_C void Relocate(unsigned char* base, IMAGE_NT_HEADERS const* nth); 40 | -------------------------------------------------------------------------------- /Molebox/makefile.mak: -------------------------------------------------------------------------------- 1 | 2 | TOPDIR =.. 3 | INCLUDE = $(INCLUDE);$(TOPDIR)\include;$(TOPDIR)\Core\classes;$(TOPDIR)\Core\classes\RSA512.SRC 4 | EXECUTABLE = $(PROJECT) 5 | 6 | 7 | !if "$(TARGET_CPU)" != "X86" 8 | all: 9 | build: 10 | rebuild: 11 | info: 12 | clean: 13 | !else 14 | 15 | !include $(XTERNAL)\Make.rules.mak 16 | 17 | CCXFLAGS = $(CCXFLAGS) -D_TEGGOSTATIC -DUNICODE -D_GUI_APP_ 18 | 19 | SRCDIR = src 20 | OBJECTS = \ 21 | $(OBJDIR)\classes.obj \ 22 | $(OBJDIR)\renamemove.obj \ 23 | $(OBJDIR)\queryaddfiles.obj \ 24 | $(OBJDIR)\newsubfolder.obj \ 25 | $(OBJDIR)\messages.obj \ 26 | $(OBJDIR)\processdlg.obj \ 27 | $(OBJDIR)\config.obj \ 28 | $(OBJDIR)\about.obj \ 29 | $(OBJDIR)\mxf.obj \ 30 | $(OBJDIR)\mainframe.obj \ 31 | $(OBJDIR)\myafx.obj \ 32 | $(OBJDIR)\version.obj \ 33 | $(OBJDIR)\build_time.obj \ 34 | $(OBJDIR)\molebox_RC.obj 35 | 36 | $(OBJDIR)\version.obj : $(TOPDIR)\version.c 37 | $(CC) -c $(CCFLAGS) $(DLL_OPTS) $(INCL) -Fo$@ $** 38 | 39 | LIBRARIES= oleaut32.lib advapi32.lib user32.lib shell32.lib ws2_32.lib mpr.lib zlib$(LIBSFX).lib libwx3$(LIBSFX).lib libtiff$(LIBSFX).lib libjpeg$(LIBSFX).lib libpng$(LIBSFX).lib expatw$(LIBSFX).lib libhash$(LIBSFX).lib 40 | 41 | !if "$(STATIC_LIB)"!="YES" 42 | !else 43 | !endif 44 | 45 | !include $(XTERNAL)\Make.exe.mak 46 | 47 | !endif 48 | 49 | 50 | -------------------------------------------------------------------------------- /Core/src/fw/fwstart.S: -------------------------------------------------------------------------------- 1 | .section .text$start, "rx" 2 | 3 | .global _Entry 4 | _Entry: 5 | jmp __Molebox_Install 6 | .global _Inject 7 | _Inject: 8 | jmp __Molebox_Inject 9 | .align 16 10 | __Core_Offset_Value: 11 | .long 0x4b495551 12 | __Core_Size_Value: 13 | .long 0x31584f42 14 | __Core_Key: 15 | .byte 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 16 | 17 | .global __Core_Size 18 | __Core_Size: 19 | call __Core_Size@e 20 | __Core_Size@e: 21 | pop %eax 22 | sub $(__Core_Size@e-__Core_Size_Value),%eax 23 | mov (%eax),%eax 24 | ret 25 | .global __Core_Offset 26 | __Core_Offset: 27 | call __Core_Offset@e 28 | __Core_Offset@e: 29 | pop %eax 30 | sub $(__Core_Offset@e-__Core_Offset_Value),%eax 31 | mov (%eax),%eax 32 | ret 33 | .global __Self_Ptr 34 | __Self_Ptr: 35 | call __Self_Ptr@e 36 | __Self_Ptr@e: 37 | pop %eax 38 | sub $(__Self_Ptr@e-_Entry),%eax 39 | ret 40 | .global __Self_Key 41 | __Self_Key: 42 | call __Self_Key@e 43 | __Self_Key@e: 44 | pop %eax 45 | sub $(__Self_Key@e-__Core_Key),%eax 46 | ret 47 | 48 | __Molebox_Install: 49 | movl 4(%esp),%eax 50 | or %eax,%eax 51 | jne _Molebox_Install 52 | jmp _Molebox_Init 53 | -------------------------------------------------------------------------------- /Core/classes/sources/md5.h: -------------------------------------------------------------------------------- 1 | 2 | #if !defined __60EDC02C_AAD6_415D_B287_0490666C10E9__ 3 | #define __60EDC02C_AAD6_415D_B287_0490666C10E9__ 4 | 5 | #if !defined _WITHOUT_TFFCLS 6 | #include "./_specific.h" 7 | #else 8 | #include "./detect_compiler.h" 9 | #endif 10 | 11 | #include 12 | 13 | namespace teggo 14 | { 15 | class MD5_Hash 16 | { 17 | public: 18 | MD5_Hash(); 19 | void Update(void const* input, unsigned long input_length); 20 | void Finalize(void* outDigest); 21 | 22 | private: 23 | MD5_CONTEXT context; 24 | 25 | }; 26 | 27 | inline MD5_Hash::MD5_Hash() 28 | { 29 | MD5_Start(&context); 30 | } 31 | 32 | CXX_FAKE_INLINE 33 | void MD5_Hash::Update(void const* _input, unsigned long input_length) 34 | { 35 | MD5_Update(&context,_input,input_length); 36 | } 37 | 38 | // AlgMD5 finalization. Writing the message digest and zeroizing the context. 39 | CXX_FAKE_INLINE 40 | void MD5_Hash::Finalize (void* outDigest) 41 | { 42 | MD5_Finish(&context,outDigest); 43 | } 44 | 45 | CXX_FAKE_INLINE 46 | void Md5sign(void const* data,unsigned len,void* md5sign) 47 | { 48 | MD5_Hash md5; 49 | md5.Update(data,len); 50 | md5.Finalize(md5sign); 51 | } 52 | 53 | } // namespace 54 | 55 | #endif // __60EDC02C_AAD6_415D_B287_0490666C10E9__ 56 | -------------------------------------------------------------------------------- /Core/classes/sources/mymath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined __ED377106_626B_434d_8DDD_F6089E43BA37__ 9 | #define __ED377106_626B_434d_8DDD_F6089E43BA37__ 10 | 11 | #include "_specific.h" 12 | 13 | namespace teggo 14 | { 15 | 16 | static const float F_PI = float(3.14159265358979323846264338327950288419716939937510582); 17 | static const double LF_PI = double(3.14159265358979323846264338327950288419716939937510582); 18 | static const float F_EPSILON = float(1e-6); 19 | static const double LF_EPSILON = double(1e-6); 20 | 21 | template inline 22 | bool CXX_STDCALL in_epsilon(real val) { return fabs(val) < real(1e-6); } 23 | template inline 24 | bool CXX_STDCALL is_fequal(real a,real b) { return fabs(a-b) < real(1e-6); } 25 | 26 | template 27 | int CXX_STDCALL SolveQuadratic(real A,real B,real C,real (&solution)[2]) 28 | { 29 | real D = B*B - 4*A*C; 30 | 31 | if ( D < 0 ) 32 | return 0; 33 | 34 | if ( D == 0 ) 35 | return solution[0] = -B/(2*A), 1; 36 | else 37 | { 38 | real sqrtD = sqrt(D); 39 | solution[0] = (-B + sqrtD)/(2*A); 40 | solution[1] = (-B - sqrtD)/(2*A); 41 | return 2; 42 | } 43 | } 44 | 45 | } // namespace 46 | 47 | #endif // __ED377106_626B_434d_8DDD_F6089E43BA37__ 48 | -------------------------------------------------------------------------------- /Molebox/src/xpm/vline_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *vline_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 2 1", 5 | " c black", 6 | ". c None", 7 | /* pixels */ 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 | -------------------------------------------------------------------------------- /Core/src/fw/makefile.mak: -------------------------------------------------------------------------------- 1 | 2 | .SUFFIXES: .S .c .cpp .obj 3 | TOPDIR=..\..\.. 4 | 5 | !if "$(TEMP_BUILD)"=="" 6 | TEMP_BUILD=$(TEMP) 7 | !endif 8 | 9 | TMPDIR=$(TEMP_BUILD)\mkfw_WORKSPACE 10 | OBJDIR=$(TMPDIR)\obj 11 | BINDIR=..\.. 12 | XTERNAL=$(TOPDIR)\xternal 13 | PATH=$(XTERNAL)\src\_Env;$(XTERNAL)\src\_Env\gcc\i386-mingw32\bin;$(PATH) 14 | 15 | TARGETS = $(BINDIR)\loader.lso $(BINDIR)\mkfw.exe 16 | all: $(TMPDIR) $(OBJDIR) $(TARGETS) 17 | 18 | $(TMPDIR) $(OBJDIR): 19 | md $@ 20 | 21 | $(BINDIR)\loader.lso: $(OBJDIR)\fwinstall.obj $(OBJDIR)\fwaux.obj $(OBJDIR)\fwndes.obj $(OBJDIR)\fwstart.obj $(OBJDIR)\fwxor.obj 22 | gcc $** --shared -Wl,-T,fwlds.x -Wl,-nostdlib -Wl,-s -Wl,-Map -Wl,$@.txt -o $@ --no-exceptions 23 | $(BINDIR)\mkfw.exe: $(OBJDIR)\mkfw.obj $(OBJDIR)\lzss.obj $(BINDIR)\loader.lso 24 | vs2010 link /debug /out:$@ /pdb:$@.pdb /incremental:no $(OBJDIR)\mkfw.obj $(OBJDIR)\lzss.obj libpe-mt10d.lib libhash-mt10d.lib 25 | 26 | {}.c{$(OBJDIR)}.obj: 27 | gcc -c -o $@ --no-exceptions -O1 -pie -I../../include $< 28 | {}.S{$(OBJDIR)}.obj: 29 | as -o $@ $< 30 | 31 | $(OBJDIR)\mkfw.obj : mkfw.cpp $(XTERNAL)\src\libpe\include\libpe.h 32 | vs2010 cl /c /FC /MTd -Fo$@ /Zi /EHsc mkfw.cpp -I../../include 33 | $(OBJDIR)\lzss.obj : lzss.c 34 | vs2010 cl /c /FC /MTd -Fo$@ /Zi lzss.c 35 | 36 | clean: 37 | -del /q/s $(OBJDIR)\fwinstall.obj $(OBJDIR)\fwaux.obj $(OBJDIR)\fwndes.obj $(OBJDIR)\fwstart.obj $(OBJDIR)\fwxor.obj 38 | -del /q/s $(OBJDIR)\mkfw.obj $(OBJDIR)\lzss.obj 39 | -del /q/s $(TARGETS) 40 | -------------------------------------------------------------------------------- /Core/src/myaux.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "_common.h" 9 | 10 | // \\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug 11 | 12 | EXTERN_C void StartDebugger() 13 | { 14 | unsigned long pid = GetProcessId(INVALID_HANDLE_VALUE); 15 | STARTUPINFO s0 = {0}; 16 | PROCESS_INFORMATION p0 = {0}; 17 | CreateProcess( 18 | 0, 19 | (char*)(0|_S*"windbg -p %d "%pid), 20 | 0, 21 | 0, 22 | 0, 23 | 0, 24 | 0, 25 | 0, 26 | &s0,&p0); 27 | Sleep(5000); 28 | __asm int 3 29 | ; 30 | } 31 | 32 | EXTERN_C int AuxReadFile(HANDLE f,void* ptr, unsigned len) 33 | { 34 | unsigned long foo = 0; 35 | byte_t* p = (byte_t*)ptr; 36 | do 37 | { 38 | foo = 0; 39 | if ( ReadFile(f,p,len,&foo,0) && foo ) 40 | { p += foo; len-=foo; } 41 | else 42 | return 0; 43 | //else 44 | // __asm__(("int3")); 45 | } 46 | while (len); 47 | return 1; 48 | } 49 | 50 | EXTERN_C void* AuxAllocExec(int sz) 51 | { 52 | void* m = 0; 53 | if ( m = VirtualAlloc(0,sz,MEM_COMMIT,PAGE_EXECUTE_READWRITE) ) 54 | return m; 55 | if ( m = VirtualAlloc(0,sz,MEM_COMMIT,PAGE_READWRITE) ) 56 | return m; 57 | __asm int 3 58 | ; 59 | return 0; 60 | } 61 | 62 | EXTERN_C void AuxFree(void* p) 63 | { 64 | VirtualFree(p,0,MEM_RELEASE); 65 | } 66 | 67 | 68 | -------------------------------------------------------------------------------- /Core/include/logger.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | enum _Lx_logger_out_ 9 | { 10 | xlog = -1, 11 | xdbg = 3, 12 | }; 13 | 14 | extern bool iflog; 15 | #define XLOG !iflog||xlog 16 | //#define XLOG xlog 17 | extern bool ifdbg; 18 | #define XDBG !ifdbg||xlog 19 | 20 | int StartLog(); 21 | 22 | void LogoutS(BaseStringT&); 23 | void LogoutS(pwide_t text, int level); 24 | void LogoutS(pchar_t text, int level); 25 | void LogoutS_(pchar_t text, int count, int level); 26 | void LogoutFormatted(FormatT const& fmt, _Lx_logger_out_ lo); 27 | void LogoutString(pwide_t text, int lo); 28 | void LogoutString(pchar_t text, int lo); 29 | 30 | template 31 | inline void operator << (_Lx_logger_out_ lo, tTc const* text) 32 | { LogoutString(text, lo); } 33 | 34 | template 35 | inline bool operator | (_Lx_logger_out_ lo, tTc const* text) 36 | { LogoutString(text, lo); return false; } 37 | 38 | template 39 | inline void operator << (_Lx_logger_out_ lo, BaseStringT const& text) 40 | { LogoutString(+text, lo); } 41 | 42 | template 43 | inline bool operator | (_Lx_logger_out_ lo, BaseStringT const& text) 44 | { LogoutString(+text, lo); return false; } 45 | 46 | inline void operator << (_Lx_logger_out_ lo, FormatT const& fmt) 47 | { LogoutFormatted(fmt, lo); } 48 | 49 | inline bool operator | (_Lx_logger_out_ lo, FormatT const& fmt) 50 | { LogoutFormatted(fmt, lo); return false; } 51 | -------------------------------------------------------------------------------- /Core/Xi/advapi32.Xi: -------------------------------------------------------------------------------- 1 | # 2 | # splited import table declaration 3 | # $Id$ 4 | # 5 | 6 | RegOpenKeyA,LONG,HKEY,LPCSTR,PHKEY 7 | RegOpenKeyW,LONG,HKEY,LPCWSTR,PHKEY 8 | RegOpenKeyExA,LONG,HKEY,LPCSTR,DWORD,REGSAM,PHKEY 9 | RegOpenKeyExW,LONG,HKEY,LPCWSTR,DWORD,REGSAM,PHKEY 10 | RegCreateKeyA,LONG,HKEY,LPCSTR,PHKEY 11 | RegCreateKeyW,LONG,HKEY,LPCWSTR,PHKEY 12 | RegCreateKeyExA,LONG,HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,LPSECURITY_ATTRIBUTES,PHKEY,LPDWORD 13 | RegCreateKeyExW,LONG,HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,LPSECURITY_ATTRIBUTES,PHKEY,LPDWORD 14 | RegQueryValueA,LONG,HKEY,LPCSTR,LPSTR,PLONG 15 | RegQueryValueW,LONG,HKEY,LPCWSTR,LPWSTR,PLONG 16 | RegQueryValueExA,LONG,HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD 17 | RegQueryValueExW,LONG,HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD 18 | RegSetValueA,LONG,HKEY,LPCSTR,DWORD,LPCSTR,DWORD 19 | RegSetValueW,LONG,HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD 20 | RegSetValueExA,LONG,HKEY,LPCSTR,DWORD,DWORD,const BYTE*,DWORD 21 | RegSetValueExW,LONG,HKEY,LPCWSTR,DWORD,DWORD,const BYTE*,DWORD 22 | RegCloseKey,LONG,HKEY 23 | RegDeleteKeyA,LONG,HKEY,LPCSTR 24 | RegDeleteKeyW,LONG,HKEY,LPCWSTR 25 | RegEnumKeyExA,LONG,HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD,PFILETIME 26 | RegEnumKeyExW,LONG,HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD,PFILETIME 27 | ConvertSidToStringSidW,BOOL,VOID*,LPWSTR* 28 | GetTokenInformation,BOOL,HANDLE,TOKEN_INFORMATION_CLASS,LPVOID,DWORD,PDWORD 29 | OpenProcessToken,BOOL,HANDLE,DWORD,HANDLE* 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Core/classes/sources/tuple.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___7ddf9ffd_bc93_44ea_99c1_ac70e15bdf58___ 9 | #define ___7ddf9ffd_bc93_44ea_99c1_ac70e15bdf58___ 10 | 11 | #include "_specific.h" 12 | 13 | namespace teggo 14 | { 15 | template 16 | struct Tuple2 17 | { 18 | tA _0; 19 | tB _1; 20 | Tuple2( tA a, tB b ) : _0(a), _1(b) {} 21 | Tuple2() {} 22 | }; 23 | 24 | template 25 | Tuple2 tuple2(tA a,tB b) { return Tuple2(a,b); } 26 | 27 | template 28 | struct Tuple3 29 | { 30 | tA _0; 31 | tB _1; 32 | tC _2; 33 | Tuple3( tA a, tB b, tC c ) : _0(a), _1(b), _2(c) {} 34 | Tuple3() {} 35 | }; 36 | 37 | template 38 | Tuple3 tuple3(tA a,tB b,tC c) { return Tuple3(a,b,c); } 39 | 40 | template 41 | struct Tuple4 42 | { 43 | tA _0; 44 | tB _1; 45 | tC _2; 46 | tD _3; 47 | Tuple4( tA a, tB b, tC c, tD d ) : _0(a), _1(b), _2(c), _3(d) {} 48 | Tuple4() {} 49 | }; 50 | 51 | template 52 | Tuple4 tuple4(tA a,tB b,tC c,tD d) { return Tuple4(a,b,c,d); } 53 | 54 | } // namespace teggo 55 | 56 | #endif // ___7ddf9ffd_bc93_44ea_99c1_ac70e15bdf58___ 57 | -------------------------------------------------------------------------------- /Core/src/auxS.S: -------------------------------------------------------------------------------- 1 | .text 2 | .global _memcopy 3 | _memcopy: 4 | push %esi 5 | push %edi 6 | push %ecx 7 | mov 16(%esp),%edi 8 | mov 20(%esp),%esi 9 | mov 24(%esp),%ecx 10 | /* 11 | _memcopy@4: 12 | cmp %ecx,$4 13 | jb _memcopy@1 14 | mov (%esi),%eax 15 | mov %eax,(%edi) 16 | sub $4,%ecx 17 | add $4,%esi 18 | add $4,%edi 19 | jmp _memcopy@4 20 | _memcopy@1: 21 | */ 22 | or %ecx,%ecx 23 | jz _memcpy@exit 24 | _memcopy@1l: 25 | mov (%esi),%al 26 | mov %al,(%edi) 27 | inc %esi 28 | inc %edi 29 | dec %ecx 30 | jnz _memcopy@1l 31 | _memcpy@exit: 32 | pop %ecx 33 | pop %edi 34 | pop %esi 35 | ret 36 | 37 | .global _memsetS 38 | _memsetS: 39 | push %edi 40 | push %ecx 41 | mov 12(%esp),%edi 42 | mov 16(%esp),%eax 43 | mov 20(%esp),%ecx 44 | or %ecx,%ecx 45 | jz _memset@e 46 | _memset@l: 47 | mov %al,(%edi) 48 | inc %edi 49 | dec %ecx 50 | jnz _memset@l 51 | _memset@e: 52 | pop %ecx 53 | pop %edi 54 | ret 55 | 56 | .global __TIB 57 | __TIB: 58 | mov %fs:0x18, %eax 59 | ret 60 | 61 | .global __PEB 62 | __PEB: 63 | call __TIB 64 | mov 48(%eax),%eax 65 | ret 66 | 67 | .global __LASTSTATUS 68 | __LASTSTATUS: 69 | call __TIB 70 | add $3060,%eax 71 | ret 72 | 73 | .global __PROCPARAM 74 | __PROCPARAM: 75 | call __PEB 76 | mov 16(%eax),%eax 77 | ret 78 | 79 | .global __CURDIRHANDLE 80 | __CURDIRHANDLE: 81 | call __PROCPARAM 82 | add $36,%eax /* CURDIR */ 83 | mov 8(%eax),%eax 84 | ret 85 | 86 | .global __Internal_Exec 87 | __Internal_Exec: 88 | mov 4(%esp),%eax 89 | call *%eax 90 | push %eax 91 | call _ExitProcess@4 92 | 93 | .section .rdata, "r" 94 | ret 95 | -------------------------------------------------------------------------------- /Core/classes/sources/refcounted.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined __50DFA54F_0876_4F8C_9226_0BD2D899B7D0__ 9 | #define __50DFA54F_0876_4F8C_9226_0BD2D899B7D0__ 10 | 11 | #include "_specific.h" 12 | #include "guid.h" 13 | 14 | namespace teggo 15 | { 16 | 17 | struct CXX_NO_VTABLE Ireferred 18 | { 19 | virtual u32_t Release() = 0; 20 | virtual u32_t AddRef() = 0; 21 | virtual void* QueryInterface(guid_t const& guid) { return 0; } 22 | virtual ~Ireferred() {} 23 | //_TEGGO_EXPORTABLE virtual void Finalize(); 24 | // template 25 | // tTx *Cast(Ireferred *p, tTx *_=0) 26 | // { return (tTx*)QueryInterface(TEGGO_GUIDOF(tTx)); } 27 | }; 28 | 29 | template 30 | struct RefcountedT : tTbase 31 | { 32 | u32_t Release() 33 | { 34 | if ( long refcount = InterlockedDecrement(&refcount_) ) 35 | return refcount; 36 | else 37 | return (delete this), 0; 38 | } 39 | 40 | u32_t AddRef() 41 | { 42 | return InterlockedIncrement(&refcount_); 43 | } 44 | 45 | RefcountedT() : refcount_(1) {} 46 | u32_t _Refcount() { return refcount_; } 47 | 48 | protected: 49 | virtual ~RefcountedT() {} 50 | 51 | private: 52 | RefcountedT( const RefcountedT&); 53 | RefcountedT& operator =( const RefcountedT&); 54 | long refcount_; 55 | }; 56 | 57 | typedef RefcountedT Refcounted; 58 | 59 | } // namespace 60 | 61 | #endif // __50DFA54F_0876_4F8C_9226_0BD2D899B7D0__ 62 | -------------------------------------------------------------------------------- /Molebox/src/tr.py: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # 4 | # Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | # 6 | # 7 | 8 | import re, random, os, os.path, rfc822, sys 9 | 10 | def Main(): 11 | 12 | force = False 13 | last_number = 1; 14 | strings = {} 15 | 16 | for f_name in os.listdir("."): 17 | 18 | if not f_name.endswith(".cpp"): 19 | continue 20 | 21 | do_rename = False 22 | print f_name 23 | f = open(f_name,"r") 24 | fo = open(f_name+'.tr~',"w+") 25 | for l in f.xreadlines(): 26 | j = l 27 | while True: 28 | m = re.search(r'Tr\((\d*),"((?:(\\")|[^"])*)"\)',j) 29 | if m: 30 | do_rename = True 31 | lS = m.group(2) 32 | lN = last_number 33 | last_number += 1 34 | strings[lN] = unicode(lS) 35 | fo.write(j[0:m.start()]) 36 | fo.write('Tr(%d,"%s")'%(lN,lS)) 37 | j = j[m.end():] 38 | continue 39 | break 40 | fo.write(j) 41 | fo.close() 42 | f.close() 43 | if do_rename: 44 | os.unlink(f_name) 45 | os.rename(f_name+'.tr~',f_name) 46 | else: 47 | os.unlink(f_name+'.tr~') 48 | 49 | fm = open('tr.inl',"w+") 50 | fm.write("const size_t _TR_COUNT_ = "+str(last_number)+";\n") 51 | fm.write("const char* _TR_["+str(last_number)+"] = {\n") 52 | for l,j in strings.items(): 53 | fm.write("\"%d:%s\",\n"%(l,j.encode('utf8'))) 54 | fm.write("};\n") 55 | fm.close() 56 | 57 | if __name__ == '__main__': 58 | Main() 59 | -------------------------------------------------------------------------------- /Include/layout.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (C) 2014, Alexey Sudachen, https://goo.gl/lJNXya. 5 | 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | typedef void SVFS_PACKAGE; 12 | typedef void SVFS_FIPROXY; 13 | 14 | enum { SVFS_FILE_BLOCK_SIZE = 48 * 1024 }; 15 | 16 | enum 17 | { 18 | SVFS_HIDDEN = 1L, 19 | SVFS_COMPRESSED = 1L << 1, 20 | SVFS_ENCRYPTED = 1L << 2, 21 | SVFS_ACTIVEX = 1L << 3, 22 | SVFS_EXECUTABLE = 1L << 4, 23 | SVFS_EXTERNAL = 1L << 5, 24 | SVFS_NOACCESS = 1L << 6, 25 | SVFS_DIRECTORY = 0x80000000, 26 | }; 27 | 28 | struct SVFS_FILE_KEY 29 | { 30 | uint32_t crc; 31 | uint8_t sign[16]; 32 | }; 33 | 34 | struct SVFS_PUBLIC_NAME 35 | { 36 | const wchar_t* S; 37 | uint32_t length; 38 | }; 39 | 40 | struct SVFS_FILE_BLOCK 41 | { 42 | uint16_t packed_size; 43 | uint16_t real_size; 44 | uint16_t flags; 45 | uint16_t crc; 46 | uint32_t offset; 47 | }; 48 | 49 | struct SVFS_FILE_INFO 50 | { 51 | SVFS_PACKAGE* pkg; 52 | SVFS_FIPROXY* proxy; 53 | SVFS_PUBLIC_NAME name; 54 | SVFS_FILE_KEY key; 55 | SVFS_FILE_INFO* dir; 56 | 57 | uint32_t flags, size, count; 58 | 59 | #ifndef SVFS_PACKER 60 | union 61 | { 62 | SVFS_FILE_BLOCK block[1]; 63 | SVFS_FILE_INFO* ls[1]; 64 | }; 65 | #endif 66 | 67 | }; 68 | 69 | struct SVFS_HEADER 70 | { 71 | uint32_t tree_boffs; 72 | uint32_t tree_size; 73 | uint32_t root_roffs; 74 | uint32_t base_boffs; 75 | uint32_t crc; 76 | uint32_t map_roffs; 77 | uint32_t map_count; 78 | uint32_t reserved; 79 | uint32_t stream_ptr; 80 | uint32_t stream_size; 81 | uint8_t signature[8]; 82 | }; 83 | -------------------------------------------------------------------------------- /MxbPack/src/myafx.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #include 10 | #define NT_HEADERS(x) ((IMAGE_NT_HEADERS*)((unsigned char*)x + ((IMAGE_DOS_HEADER*)x)->e_lfanew)) 11 | 12 | #include 13 | 14 | #if defined _DEMOVERSION_ 15 | static const bool ISDEMOVERSION = true; 16 | #else 17 | static const bool ISDEMOVERSION = false; 18 | #endif 19 | 20 | #if defined _BUNDLER_ 21 | static const bool ISMOLEBUNDLER = true; 22 | #else 23 | static const bool ISMOLEBUNDLER = false; 24 | #endif 25 | 26 | #if defined _PROTECTOR_ 27 | static const bool ISMOLEPROTECTOR = true; 28 | #else 29 | static const bool ISMOLEPROTECTOR = false; 30 | #endif 31 | 32 | void usage(); 33 | bool ProcessSpack(StringParam mainstorage, Xdocument config, EhFilter ehf); 34 | int GenerateIAT(byte_t* section,unsigned section_rva,unsigned section_size,IMAGE_DATA_DIRECTORY* dict, unsigned reserve, 35 | EhFilter ehf); 36 | bool GetRequiredResources(byte_t* mapped, IMAGE_NT_HEADERS* nth, BufferT& data); 37 | bool RscFixup(byte_t* rsrc,unsigned rsrc_rva ); 38 | bool TakeOriginalResources(byte_t* mapped, IMAGE_NT_HEADERS* nth, BufferT& data); 39 | 40 | extern "C" int _MAJOR_VERSION; 41 | extern "C" int _BUILD_NUMBER; 42 | extern "C" time_t _BUILD_TIME; 43 | 44 | template 45 | StringT TrimLength(tChr const* t, unsigned trim_len) 46 | { 47 | if ( trim_len < 3 ) trim_len = 3; 48 | unsigned l = StrLen(t); 49 | if ( l > trim_len ) 50 | { 51 | StringT s("..."); 52 | s += t+(l-(trim_len-3)); 53 | return s; 54 | } 55 | else 56 | return StringT(t); 57 | } 58 | 59 | extern teggo::XFILE Xo; 60 | extern teggo::XFILE Xoln; 61 | extern void SwitchXoToUtf8(bool = true); 62 | -------------------------------------------------------------------------------- /Core/classes/sources/symboltable.inl: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___66e66e00_3224_4300_a779_4b8e401dadb7___ 9 | #define ___66e66e00_3224_4300_a779_4b8e401dadb7___ 10 | 11 | #include "symboltable.h" 12 | 13 | #if defined _TEGGO_SYMTABLE_HERE 14 | # define _TEGGO_SYMTABLE_FAKE_INLINE _TEGGO_EXPORTABLE 15 | #else 16 | # define _TEGGO_SYMTABLE_FAKE_INLINE CXX_FAKE_INLINE 17 | #endif 18 | 19 | namespace teggo 20 | { 21 | 22 | _TEGGO_SYMTABLE_FAKE_INLINE 23 | pwide_t SymbolTable::FindSymbol(pwide_t val) 24 | { 25 | if ( !val ) return 0; 26 | PWIDE pw; 27 | pw.text = val; 28 | pw.len = wcslen(val); 29 | if ( PWIDE* ppw = table_.Get(pw) ) 30 | return ppw->text; 31 | return 0; 32 | } 33 | 34 | _TEGGO_SYMTABLE_FAKE_INLINE 35 | pwide_t SymbolTable::GetSymbol(pwide_t val) 36 | { 37 | PWIDE pw; 38 | pw.text = val; 39 | pw.len = wcslen(val); 40 | if ( PWIDE* ppw = table_.Get(pw) ) 41 | return ppw->text; 42 | else 43 | { 44 | pw.text = new wchar_t[pw.len+1]; 45 | for ( unsigned i = 0; i < pw.len; ++i ) ((wchar_t*)pw.text)[i] = towlower(val[i]); 46 | ((wchar_t*)pw.text)[pw.len] = 0; 47 | table_.Put(pw); 48 | return pw.text; 49 | } 50 | } 51 | 52 | _TEGGO_SYMTABLE_FAKE_INLINE 53 | SymbolTable::SymbolTable() 54 | { 55 | } 56 | 57 | _TEGGO_SYMTABLE_FAKE_INLINE 58 | SymbolTable::~SymbolTable() 59 | { 60 | for ( FlatsetT::Iterator i = table_.Iterate(); i.Next(); ) 61 | delete[] (wchar_t*)i->text; 62 | } 63 | } // namespace teggo 64 | 65 | #endif //___66e66e00_3224_4300_a779_4b8e401dadb7___ 66 | -------------------------------------------------------------------------------- /Core/Makefile.rules: -------------------------------------------------------------------------------- 1 | 2 | all: _all_ALL 3 | .SUFFIXES: .Xi .S .c .cpp 4 | 5 | #default CPU is X86 6 | #default BUILD configuration is RELEASE 7 | 8 | !if "$(CPU)"=="" 9 | CPU=X86 10 | !endif 11 | 12 | !if "$(BUILD)" == "" 13 | BUILD=RELEASE 14 | !endif 15 | 16 | !if "$(BUILD)" == "DEBUG" 17 | DBGSFX=_Dbg 18 | DLLSFX=dbg 19 | DNAME=~Debug 20 | !else 21 | DBGSFX= 22 | DLLSFX=rel 23 | DNAME=~Release 24 | !endif 25 | 26 | !if "$(TEMP_BUILD)"=="" 27 | TEMP_BUILD=$(TEMP) 28 | !endif 29 | 30 | TMPDIR = $(TEMP_BUILD)\molebox\$(CPU)$(DBGSFX) 31 | OBJDIR = $(TMPDIR)\obj\$(PROJECT) 32 | LIBDIR=$(BASEDIR)\..\$(DNAME)\.lib 33 | OUTDIR=$(BASEDIR)\..\$(DNAME) 34 | BINDIR=$(OUTDIR) 35 | 36 | $(TMPDIR) $(LIBDIR) $(OUTDIR) $(OBJDIR): 37 | @md $@ 38 | 39 | # C definitins 40 | 41 | !if "$(CPU)"=="X64" 42 | WINDEF=-D_WIN64 43 | !else 44 | WINDEF=-D_WIN32 45 | !endif 46 | 47 | CFLAGS= -nologo -FC -GS- -Gs- -EHs-c- -GR- -GF -Gy -Z7 $(WINDEF) -DPOSIXBUILDTIME=%POSIXBUILDTIME% 48 | CCFLAGS= -nologo -FC -GS- -Gs- -EHs-c- -GR- -GF -Gy -Z7 $(WINDEF) -DPOSIXBUILDTIME=%POSIXBUILDTIME% 49 | 50 | INCL=-I$(BASEDIR)\include -I$(BASEDIR)\classes -I$(BASEDIR)\classes\RSA512.SRC -I$(XTERNAL)\include 51 | LIB=$(LIB);$(XTERNAL)\~Release\.lib;$(XTERNAL)\~Debug\.lib 52 | 53 | !if "$(BUILD)" == "DEBUG" 54 | LIBSFX=_32r10d-mt 55 | CFLAGS = $(CFLAGS) -MTd -Od -DDEBUG -D_DEBUG 56 | !else 57 | LIBSFX=_32r10-mt 58 | CCFLAGS = $(CCFLAGS) -MT -Ox -Oi -Oy- -FD -DRELEASE -D_RELEASE 59 | !endif 60 | 61 | #assembler definitions 62 | 63 | AS=$(XTERNAL)\Env\gnu\GNU_as.exe 64 | 65 | _all_ALL: $(TMPDIR) $(LIBDIR) $(OUTDIR) _all 66 | 67 | {$(SRCDIR)}.c{$(OBJDIR)}.obj: 68 | @$(CC) -c $(CFLAGS) $(INCL) -Fo$@ $< 69 | 70 | {$(SRCDIR)}.cpp{$(OBJDIR)}.obj: 71 | @$(CC) -c $(CCFLAGS) $(INCL) -Fo$@ $< 72 | 73 | {$(SRCDIR)}.S{$(OBJDIR)}.obj: 74 | @echo $(*F) 75 | @$(AS) $(M64) $< -o$(OBJDIR)\$(*F).obj 76 | -------------------------------------------------------------------------------- /Core/xor_data.py: -------------------------------------------------------------------------------- 1 | 2 | import re,random,os,rfc822,sys 3 | 4 | def xor_part(part,mask): 5 | def unhex(a): 6 | f = { 7 | '0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9, 8 | 'a':10,'A':10,'b':11,'B':11,'c':12,'C':12, 9 | 'd':13,'D':13,'e':14,'E':14,'f':15,'F':15} 10 | return (f[a[0]]<<4)|(f[a[1]]) 11 | 12 | part = map(unhex,part.split('\\x')) 13 | for i in xrange(len(part)): 14 | part[i] = int(part[i] ^ mask) & 0x0ff 15 | mask = (mask >> 1) | int(mask << 31) 16 | part = ''.join(map(lambda x: '\\x%02x'%x, part)) 17 | return part,mask 18 | 19 | def Main(fname): 20 | f_in_xdata = False 21 | f_xor_mask = 0 22 | f = open(fname,"r") 23 | fo = open(fname+'.xor',"w+") 24 | for l in f.xreadlines(): 25 | j = l 26 | if f_in_xdata: 27 | m = re.search('\/\/END XORED DATA,([0-9]+)\/\/',j) 28 | if m: 29 | f_in_xdata = False 30 | else: 31 | m = re.search('([^/]*)\"[^\"]*\"[^/]*\/\/([^\"]*)"\\\\x([^\"]*)"(.*)',j) 32 | if m: 33 | lPref = m.group(1) 34 | lCmnt = m.group(4) 35 | lPart = m.group(3) 36 | nPart,f_xor_mask = xor_part(lPart,f_xor_mask) 37 | j = lPref + '%-24s'%('"'+nPart+'"') + '// "\\x'+lPart+'"' + lCmnt + '\n' 38 | #print j 39 | else: 40 | m = re.search('\/\/BEGIN XORED DATA,([0-9]+)\/\/',j) 41 | if m: 42 | lS = m.group(1) 43 | f_xor_mask = 1664525*int(lS) + 1013904223 44 | f_in_xdata = True 45 | #print lS 46 | fo.write(j) 47 | fo.close() 48 | f.close() 49 | os.unlink(fname) 50 | os.rename(fname+'.xor',fname) 51 | 52 | #print sys.argv 53 | Main(sys.argv[1]) 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Molebox [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) 2 | Molebox Virtualization Solution. 3 | The first public version released in 2004. Commercial support discontinued in 2014. 4 | 5 | MoleBox lets you convert your application into an all-sufficient stand-alone executable, containing everything needed: components, media assets, registry entries. Moleboxed environment is private, which means that all packaged elements are available to your application only. 6 | 7 | ## Build Requirements 8 | 1. Visual Studio 2010 9 | 2. Python 2.7 installed/linked into c:\Python27 10 | 11 | 12 | ## How to Build Molebox 13 | ``` 14 | git clone https://github.com/sudachen/Molebox.git 15 | cd Molebox 16 | git clone https://github.com/sudachen/xternal.git 17 | makeall.cmd 18 | ``` 19 | 20 | ## User Manual 21 | 22 | + [Overview](https://sudachen.github.io/Molebox/#overview) 23 | + [Features](https://sudachen.github.io/Molebox/#features) 24 | + [System Requirements](https://sudachen.github.io/Molebox/#system-requirements) 25 | + [How To Package Your Application](https://sudachen.github.io/Molebox/#how-to-package-your-application) 26 | + [Creating Packages Through GUI](https://sudachen.github.io/Molebox/#creating-packages-through-gui) 27 | + [Setting Package Options](https://sudachen.github.io/Molebox/#setting-package-options) 28 | + [Adding Files](https://sudachen.github.io/Molebox/#adding-files) 29 | + [Important notice on virtual paths](https://sudachen.github.io/Molebox/#important-notice-on-virtual-paths) 30 | + [Compiling the Package](https://sudachen.github.io/Molebox/#compiling-the-package) 31 | + [Creating Packages Through Command Line](https://sudachen.github.io/Molebox/#creating-packages-through-command-line) 32 | + [Creating Patches and Updates](https://sudachen.github.io/Molebox/#creating-patches-and-updates) 33 | 34 | 35 | -------------------------------------------------------------------------------- /Core/classes/sources/stack.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined __8A26ECE9_C113_4110_9252_CACCAD8E56AB__ 9 | #define __8A26ECE9_C113_4110_9252_CACCAD8E56AB__ 10 | 11 | #include "_specific.h" 12 | 13 | namespace teggo 14 | { 15 | 16 | template 17 | struct StackT 18 | { 19 | byte_t buffer_[sizeof(tTx)*tCount]; 20 | unsigned p_; 21 | StackT() : p_(0) {} 22 | 23 | ~StackT() 24 | { 25 | while ( !Empty() ) Pop(); 26 | } 27 | 28 | StackT& Push( const tTx& val ) 29 | { 30 | if ( tCheckit ) 31 | VIOLATION( ( p_ >= sizeof(buffer_) ), 32 | L"stack overflow, size limit reached" ); 33 | new (&buffer_[p_]) tTx(val); 34 | p_ += sizeof(tTx); 35 | return *this; 36 | } 37 | 38 | void Pop() 39 | { 40 | if ( tCheckit ) 41 | VIOLATION( ( p_ == 0 ), 42 | L"stack underflow" ); 43 | p_ -= sizeof(tTx); 44 | ((tTx*)&buffer_[p_])->~tTx(); 45 | } 46 | 47 | tTx& Top() 48 | { 49 | return *(tTx*)&buffer_[p_ - sizeof(tTx)]; 50 | } 51 | 52 | tTx& operator *() 53 | { 54 | return Top(); 55 | } 56 | 57 | tTx* operator ->() 58 | { 59 | return &Top(); 60 | } 61 | 62 | bool Empty() 63 | { 64 | return p_ == 0; 65 | } 66 | 67 | unsigned Size() 68 | { 69 | return p_ / sizeof(tTx); 70 | } 71 | 72 | tTx& operator [](unsigned i) 73 | { 74 | return *(tTx*)&buffer_[sizeof(tTx)*i]; 75 | } 76 | }; 77 | 78 | } // namespace 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /Core/classes/sources/zlib.inl: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if defined _TEGGO_ZLIB_HERE || defined _TEGGOINLINE 9 | 10 | #include 11 | #include 12 | 13 | #define ZLIB_STATIC static 14 | 15 | #ifdef __cplusplus 16 | 17 | #if defined _TEGGOINLINE 18 | # define _ZLIB_FAKE_INLINE ZLIB_STATIC CXX_FAKE_INLINE 19 | # define _ZLIB_EXPORTABLE CXX_FAKE_INLINE 20 | #else 21 | # define _ZLIB_FAKE_INLINE ZLIB_STATIC 22 | # define _ZLIB_EXPORTABLE extern "C" _TEGGO_EXPORTABLE 23 | #endif 24 | 25 | #else /* raw C */ 26 | 27 | #if defined _TEGGOINLINE 28 | # define _ZLIB_FAKE_INLINE ZLIB_STATIC 29 | # define _ZLIB_EXPORTABLE ZLIB_STATIC 30 | #else 31 | # define _ZLIB_FAKE_INLINE ZLIB_STATIC 32 | # define _ZLIB_EXPORTABLE _TEGGO_EXPORTABLE 33 | #endif 34 | 35 | #endif 36 | 37 | CXX_EXTERNC int compress(void* dest, u32_t* destLen, void const* source, u32_t sourceLen, int level); 38 | CXX_EXTERNC int uncompress(void* dest, u32_t* destLen, void const* source, u32_t sourceLen); 39 | 40 | _ZLIB_EXPORTABLE int zlib_compress_l(void const* in_b, int in_b_len, void* out_b, int out_b_len, int level) 41 | { 42 | u32_t l = out_b_len; 43 | int r = compress(out_b,&l,in_b,in_b_len,level); 44 | switch ( r ) 45 | { 46 | case 0: 47 | return l; 48 | default: 49 | return -1; 50 | } 51 | } 52 | 53 | _ZLIB_EXPORTABLE int zlib_compress(void const* in_b, int in_b_len, void* out_b, int out_b_len) 54 | { 55 | return zlib_compress_l(in_b,in_b_len,out_b,out_b_len,6); 56 | } 57 | 58 | _ZLIB_EXPORTABLE int zlib_decompress(void const* in_b, int in_b_len, void* out_b, int out_b_len) 59 | { 60 | u32_t l = out_b_len; 61 | int r = uncompress(out_b,&l,in_b,in_b_len); 62 | switch ( r ) 63 | { 64 | case 0: 65 | return l; 66 | default: 67 | return -1; 68 | } 69 | } 70 | 71 | /*#else no here*/ 72 | #endif 73 | -------------------------------------------------------------------------------- /Include/teggovbox.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___86f249bb_663f_4d00_a538_e2d00cda08aa___ 9 | #define ___86f249bb_663f_4d00_a538_e2d00cda08aa___ 10 | 11 | enum _TEGGOVBOX_CONSTANTS 12 | { 13 | // TEGGOVBOX_TEXTFORMAT = 0x100000, 14 | // TEGGOVBOX_BINARYFORMAT = 0x200000, 15 | 16 | TEGGOVBOX_LOG_ACTIVITY = 1L, 17 | TEGGOVBOX_VIRTUALIZE_REGISTRY = 1L << 1, 18 | TEGGOVBOX_VIRTUALIZE_FS = 1L << 2, 19 | //TEGGOVBOX_VIRTUALIZE_FS_FOR_WRITE = (1L<<3) | (1L<<2), 20 | TEGGOVBOX_SEARCH_FOR_EMBEDDINGS = 1L << 4, 21 | TEGGOVBOX_LOG_ACTIVITY_DBG = 1L << 5, 22 | TEGGOVBOX_VIRTUALIZE_REGISTRY_FULL = 1L << 6, 23 | TEGGOVBOX_CORE_PROCESS = 1 << 3, 24 | TEGGOVBOX_CORE_INJECT = 1 << 7, 25 | //TEGGOVBOX_LOG_REGISTRY_LOADING = 1L<<7, 26 | 27 | // TEGGOVBOX_LAST_ENTRIES_ONLY = 0x1000, 28 | // TEGGOVBOX_TEXT_FORMAT = 0, 29 | // TEGGOVBOX_BINARY_FORMAT = 1, 30 | TEGGOVBOX_ONELINE_FORMAT = 2, 31 | }; 32 | 33 | typedef struct _TEGGOVBOX_FUNCTIONS_TABLE 34 | { 35 | long(__stdcall* WriteVirtualRegistry)(unsigned flags, wchar_t const* filename, wchar_t const* filter); 36 | long(__stdcall* SerilizeVirtualRegistryAsText)(unsigned flags, wchar_t const* filter, char** p, int* len); 37 | long(__stdcall* DeserilizeVirtualRegistryFromText)(unsigned flags, wchar_t const* filter); 38 | //long (__stdcall *MaskVirtualRegistryValues)(unsigned flags,wchar_t const *pattern,wchar_t const *mask); 39 | //long (__stdcall *MarkVirtualRegistry)(); 40 | long(__stdcall* LogState)(); 41 | } TEGGOVBOX_FUNCTIONS_TABLE; 42 | 43 | #define TEGGOVBOX_INSTALL_ROUTINE "_Install@8" 44 | typedef TEGGOVBOX_FUNCTIONS_TABLE* (__stdcall* TEGGOVBOX_INSTALL_FUNCTION)(unsigned flags, void*); 45 | 46 | #endif /*___86f249bb_663f_4d00_a538_e2d00cda08aa___*/ 47 | -------------------------------------------------------------------------------- /Core/include/vfs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "svfs.h" 9 | 10 | using svfs::FioProxy; 11 | using svfs::FioProxyPtr; 12 | 13 | typedef RefcountedT> VfsDirlist; 14 | typedef rcc_ptr VfsDirlistPtr; 15 | 16 | struct _VFS 17 | { 18 | static FioProxyPtr GetProxy(pwide_t filename, BaseStringT* = 0, bool = false); 19 | static FioProxyPtr GetProxyInternal(BaseStringT const& path); 20 | static FioProxyPtr GetProxyInternal_(BaseStringT const& path); 21 | static void InitAndLoadInternalCatalog(unsigned search_for_embeddings); 22 | static void _AfterMountPackage(svfs::PackagePtr& pkg, pchar_t pkgname, pchar_t intern, StringEfA& sefa); 23 | static void MoundDefaults(); 24 | static VfsDirlistPtr ListDir(FioProxy* fio, pwide_t mask); 25 | static VfsDirlistPtr ListEmbeddedFiles(pwide_t mask); 26 | static CRITICAL_SECTION* _GetLock(); 27 | static void SelfExtraData(u32_t offs, u32_t count); 28 | static HANDLE AppFolderHandle(); 29 | static HANDLE SelfHandle(); 30 | static unsigned Mount(pwide_t msk, pchar_t pwd, bool atAppfold); 31 | static unsigned MountS(pwide_t mask, cbyte_t* pwdsign, bool atAppfold); 32 | static unsigned Mount_At(pwide_t source, pchar_t pwd, i64_t offs); 33 | static unsigned MountS_At(pwide_t, pchar_t pkgname, cbyte_t* pwdsign, i64_t offs); 34 | static unsigned MountS_At(HANDLE, pchar_t pkgname, cbyte_t* pwdsign, i64_t offs); 35 | static unsigned MountS_At(DataStreamPtr, pchar_t pkgname, cbyte_t* pwdsign, i64_t offs); 36 | static StringW containerName; 37 | static int GetPkgsCount(); 38 | static svfs::Package* GetPackage(int no); 39 | static void Call_If(int mask, int (*)(int, pwide_t)); 40 | }; 41 | 42 | struct 43 | { 44 | _VFS* operator ->() const { return 0; } 45 | operator CRITICAL_SECTION* () const { return (*this)->_GetLock(); } 46 | } const VFS = {}; 47 | -------------------------------------------------------------------------------- /MxbPack/makefile.mak: -------------------------------------------------------------------------------- 1 | 2 | TOPDIR =.. 3 | INCLUDE = $(INCLUDE);$(TOPDIR)\include;$(TOPDIR)\Core\classes;$(TOPDIR)\Core\classes\RSA512.SRC 4 | EXECUTABLE = $(PROJECT) 5 | 6 | 7 | !if "$(TARGET_CPU)" != "X86" 8 | all: 9 | build: 10 | rebuild: 11 | info: 12 | clean: 13 | !else 14 | 15 | !include $(XTERNAL)\Make.rules.mak 16 | 17 | CCXFLAGS = $(CCXFLAGS) -D_TEGGOSTATIC -DSVFS_PACKER 18 | 19 | SRCDIR = src 20 | OBJECTS = \ 21 | $(OBJDIR)\resources.obj \ 22 | $(OBJDIR)\rgsreg.obj \ 23 | $(OBJDIR)\commandstream.obj \ 24 | $(OBJDIR)\teggovbox.obj \ 25 | $(OBJDIR)\iatgen.obj \ 26 | $(OBJDIR)\xfile.obj \ 27 | $(OBJDIR)\stubpack.obj \ 28 | $(OBJDIR)\pwafx.obj \ 29 | $(OBJDIR)\myafx.obj \ 30 | $(OBJDIR)\fpattern_a.obj \ 31 | $(OBJDIR)\version.obj \ 32 | $(OBJDIR)\build_time.obj \ 33 | $(OBJDIR)\main.obj \ 34 | $(OBJDIR)\mxbpack_RC.obj \ 35 | $(OBJDIR)\packager.obj \ 36 | $(OBJDIR)\pebox.obj \ 37 | $(OBJDIR)\splicer.obj \ 38 | $(OBJDIR)\import.obj \ 39 | $(OBJDIR)\rsa.obj \ 40 | $(OBJDIR)\rsa_accel.obj \ 41 | $(OBJDIR)\xorS.obj \ 42 | $(OBJDIR)\classes.obj \ 43 | $(OBJDIR)\cor0S.obj 44 | 45 | $(OBJDIR)\rsa.obj : $(TOPDIR)\Core\classes\RSA512.SRC\rsa.cpp 46 | $(CC) -c $(CCXFLAGS) $(DLL_OPTS) $(INCL) -Fo$@ $** 47 | 48 | $(OBJDIR)\rsa_accel.obj : $(TOPDIR)\Core\classes\RSA512.SRC\rsa_accel.S 49 | $(AS) $(ASFLAGS) -o$@ $** 50 | 51 | $(OBJDIR)\fpattern_a.obj : $(TOPDIR)\Core\src\fpattern_a.c 52 | $(CC) -c $(CCFLAGS) $(DLL_OPTS) $(INCL) -Fo$@ $** 53 | 54 | $(OBJDIR)\version.obj : $(TOPDIR)\version.c 55 | $(CC) -c $(CCFLAGS) $(DLL_OPTS) $(INCL) -Fo$@ $** 56 | 57 | $(OBJDIR)\cor0S.obj : $(TOPDIR)\Core\cor0S.c 58 | $(CC) -c $(CCFLAGS) $(DLL_OPTS) $(INCL) -Fo$@ $** 59 | 60 | LIBRARIES= advapi32.lib user32.lib shell32.lib ws2_32.lib mpr.lib zlib$(LIBSFX).lib libhash$(LIBSFX).lib 61 | 62 | !if "$(STATIC_LIB)"!="YES" 63 | !else 64 | !endif 65 | 66 | !include $(XTERNAL)\Make.exe.mak 67 | 68 | !endif 69 | 70 | 71 | -------------------------------------------------------------------------------- /Core/DLL.rc.py: -------------------------------------------------------------------------------- 1 | import re,time,os 2 | 3 | RC_PROTO = r""" 4 | 1 VERSIONINFO 5 | FILEVERSION %%VERSION%%,0,0,%%BUILD%% 6 | PRODUCTVERSION %%VERSION%%,0,0,%%BUILD%% 7 | FILEFLAGSMASK 0x3fL 8 | #ifdef _DEBUG 9 | FILEFLAGS 0x1L 10 | #else 11 | FILEFLAGS 0x0L 12 | #endif 13 | FILEOS 0x40004L 14 | FILETYPE 0x2L 15 | FILESUBTYPE 0x0L 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "000004b0" 20 | BEGIN 21 | VALUE "Comments", "\0" 22 | VALUE "CompanyName", "DesaNova Ltda.\0" 23 | VALUE "FileDescription", "MOLEBOX REVISION IV VBOXCORE (STEELBOX)\0" 24 | VALUE "FileVersion", "%%VERSION%%, 0, 0, %%BUILD%%\0" 25 | VALUE "InternalName", "\0" 26 | VALUE "LegalCopyright", "Copyright (c) 2008-2009, Alexey Sudachen, DesaNova Ltda.\0" 27 | VALUE "LegalTrademarks", "\0" 28 | VALUE "OriginalFilename", "\0" 29 | VALUE "PrivateBuild", "\0" 30 | VALUE "ProductName", "\0" 31 | VALUE "ProductVersion", "%%VERSION%%, 0, 0, %%BUILD%%\0" 32 | VALUE "SpecialBuild", "\0" 33 | END 34 | END 35 | BLOCK "VarFileInfo" 36 | BEGIN 37 | VALUE "Translation", 0x0, 1200 38 | END 39 | END 40 | """ 41 | 42 | VERSION = 4 43 | 44 | b = int(open("../version.build","r").readline()) 45 | 46 | if os.getenv('BUILDBOT_VERSION_INCREMENT',None): 47 | b += 1 48 | open("../version.build","w+").write(str(b)) 49 | 50 | l = RC_PROTO.split('\n') 51 | o = open("DLL.rc","w+t") 52 | for i in l: 53 | i = re.sub( '%%BUILD%%', str(b), i) 54 | i = re.sub( '%%VERSION%%', str(VERSION), i) 55 | o.write("%s\n" % i) 56 | o.close() 57 | 58 | o = open("version.c","w+") 59 | o.write("#include \n"); 60 | o.write("int _MAJOR_VERSION = %d;\n" % VERSION) 61 | o.write("int _BUILD_NUMBER = %d;\n" % b) 62 | t = time.mktime(time.strptime("30 11 2011","%d %m %Y")) 63 | print time.asctime(time.localtime(t)) 64 | o.write("time_t _BUILD_TIME = %.0f;\n" % t ) 65 | o.close() 66 | -------------------------------------------------------------------------------- /MxbPack/stub/pycparser/plyparser.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # plyparser.py 3 | # 4 | # PLYParser class and other utilites for simplifying programming 5 | # parsers with PLY 6 | # 7 | # Copyright (C) 2008-2009, Eli Bendersky 8 | # License: LGPL 9 | #----------------------------------------------------------------- 10 | 11 | 12 | class Coord(object): 13 | """ Coordinates of a syntactic element. Consists of: 14 | - File name 15 | - Line number 16 | - (optional) column number, for the Lexer 17 | """ 18 | def __init__(self, file, line, column=None): 19 | self.file = file 20 | self.line = line 21 | self.column = column 22 | 23 | def __str__(self): 24 | str = "%s:%s" % (self.file, self.line) 25 | if self.column: str += ":%s" % self.column 26 | return str 27 | 28 | 29 | class ParseError(Exception): pass 30 | 31 | 32 | class PLYParser(object): 33 | def _create_opt_rule(self, rulename): 34 | """ Given a rule name, creates an optional ply.yacc rule 35 | for it. The name of the optional rule is 36 | _opt 37 | """ 38 | optname = rulename + '_opt' 39 | 40 | def optrule(self, p): 41 | p[0] = p[1] 42 | 43 | optrule.__doc__ = '%s : empty\n| %s' % (optname, rulename) 44 | optrule.__name__ = 'p_%s' % optname 45 | setattr(self.__class__, optrule.__name__, optrule) 46 | 47 | def _coord(self, lineno, column=None): 48 | return Coord( 49 | file=self.clex.filename, 50 | line=lineno, 51 | column=column) 52 | 53 | def _parse_error(self, msg, coord): 54 | raise ParseError("%s: %s" % (coord, msg)) 55 | 56 | 57 | if __name__ == '__main__': 58 | pp = PLYParser() 59 | pp._create_opt_rule('java') 60 | 61 | ar = [4, 6] 62 | pp.p_java_opt(ar) 63 | 64 | print ar 65 | print pp.p_java_opt.__doc__ 66 | 67 | print dir(pp) 68 | -------------------------------------------------------------------------------- /Core/classes/_classes.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2008, Alexey Sudachen. 5 | 6 | */ 7 | 8 | #if !defined ___8b26359a_427b_42e9_b63d_afe88156eb1e___ 9 | #define ___8b26359a_427b_42e9_b63d_afe88156eb1e___ 10 | 11 | #include "sources/_specific.h" 12 | 13 | #if !defined CXX_NO_GUID_SUPPORT 14 | #include "sources/guid.h" 15 | using teggo::GuidT; 16 | #endif // CXX_NO_GUID_SUPPORT 17 | 18 | #include "sources/hinstance.h" 19 | #include "sources/ptr_mem.h" 20 | #include "sources/ptr_rcc.h" 21 | #include "sources/refcounted.h" 22 | #include "sources/string.h" 23 | #include "sources/splitter.h" 24 | #include "sources/format.h" 25 | #include "sources/wexcept.h" 26 | #include "sources/slist.h" 27 | #include "sources/keylist.h" 28 | #include "sources/array.h" 29 | #include "sources/stack.h" 30 | #include "sources/flatmap.h" 31 | #include "sources/flatset.h" 32 | #include "sources/collection.h" 33 | #include "sources/genericio.h" 34 | #include "sources/sysutil.h" 35 | #include "sources/tuple.h" 36 | 37 | #include "sources/com_generic.h" 38 | #include "sources/com_dynamic.h" 39 | #include "sources/com_register.h" 40 | 41 | #include "sources/weaklink.h" 42 | #include "sources/logger.h" 43 | #include "sources/streams.h" 44 | #include "sources/symboltable.h" 45 | #include "sources/xdom.h" 46 | #include "sources/saxparser.h" 47 | #include "sources/defparser.h" 48 | #include "sources/messages.h" 49 | #include "sources/cargs.h" 50 | 51 | #include "sources/rectangle.h" 52 | #include "sources/vector.h" 53 | #include "sources/polygon.h" 54 | 55 | #include "sources/lz77ss.h" 56 | #include "sources/zlib.h" 57 | //#include "sources/lz+.h" 58 | 59 | #include "sources/newdes.h" 60 | #include "sources/blowfish.h" 61 | #include "sources/md5.h" 62 | #include "sources/mymath.h" 63 | 64 | #include "sources/threads.h" 65 | #include "sources/x86code.h" 66 | 67 | #include "sources/print.h" 68 | #include "sources/path.h" 69 | #include "sources/cpuinfo.h" 70 | 71 | #include "sources/fuslog.h" 72 | #include "sources/datetime.h" 73 | 74 | #endif // ___8b26359a_427b_42e9_b63d_afe88156eb1e___ 75 | -------------------------------------------------------------------------------- /Core/src/fw/S.py: -------------------------------------------------------------------------------- 1 | 2 | import re, random, os, os.path, time 3 | 4 | files = ['fwinstall.c'] 5 | 6 | def Main(): 7 | 8 | xored_strings = [] 9 | for i in xrange(int(random.random() * 3)): 10 | xored_strings.append(int(random.random()*0xff)) 11 | 12 | xor_magic = int(time.time()) 13 | 14 | for f_name in files: 15 | f = open(f_name,"r") 16 | fo = open(f_name+'.xor',"w+") 17 | for l in f.xreadlines(): 18 | j = l 19 | while True: 20 | m = re.search(r'_S\((\d*)\s*,\s*"((?:(\\")|[^"])*)"\)',j) 21 | if m: 22 | print m.group() 23 | lS = m.group(2) 24 | lSq = lS.replace('\\\\','\\').replace('\\"','"').replace('\\n','\n').replace('\\0','\0') 25 | for i in xrange(int(random.random()*5+1)): xored_strings.append(int(random.random()*0xff)) 26 | magic = (len(xored_strings) + (len(xored_strings) << 16)) ^ xor_magic 27 | fo.write(j[0:m.start()]) 28 | fo.write(r'_S(%d,"%s")'%(magic,lS)) 29 | j = j[m.end():] 30 | S = int(random.random()*0x80) + 5 31 | xored_strings.append(S) 32 | for i in lSq: 33 | Q = ord(i) 34 | xored_strings.append(S^Q) 35 | S = ((Q << 4) | (Q >> 4))&0x0ff 36 | xored_strings.append(S) 37 | continue 38 | else: 39 | break 40 | fo.write(j) 41 | fo.close() 42 | f.close() 43 | if os.path.exists( f_name+'.bak' ) : os.unlink(f_name+'.bak') 44 | os.rename(f_name,f_name+'.bak') 45 | os.rename(f_name+'.xor',f_name) 46 | 47 | fS = open("fwxor.S","w+") 48 | fS.write('.section .text$xor, "rx"\n') 49 | fS.write('XORED_TABLE:') 50 | 51 | for i in xrange(len(xored_strings)): 52 | if i % 16 == 0: 53 | fS.write('\n.byte ') 54 | else: 55 | fS.write(',') 56 | 57 | fS.write('0x%02x'%xored_strings[i]) 58 | 59 | fS.write('\n') 60 | fS.write(\ 61 | ''' 62 | .global __S_Table 63 | __S_Table: 64 | mov 4(%esp),%eax 65 | call __S_Table@e 66 | __S_Table@e: 67 | xor $'''+str(xor_magic)+''',%eax 68 | and $65535,%eax 69 | addl (%esp),%eax 70 | add $4,%esp 71 | sub $(__S_Table@e-XORED_TABLE),%eax 72 | ret 73 | ''') 74 | 75 | Main() 76 | -------------------------------------------------------------------------------- /Core/src/apif_cmdline.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "_common.h" 9 | #include "apif.h" 10 | #include "logger.h" 11 | #include "XorS.h" 12 | #include "xnt.h" 13 | 14 | extern "C" void* _PEB(); 15 | 16 | struct CmdlineFilter : APIfilter 17 | { 18 | 19 | wchar_t* cmdlineW; 20 | char* cmdlineA; 21 | wchar_t* peb_cmdl; 22 | 23 | wchar_t* GetPebCmdline() 24 | { 25 | _XPEB* peb = (_XPEB*)_PEB(); 26 | MY_RTL_USER_PROCESS_PARAMETERS* para = peb->ProcessParameters; 27 | return para->CommandLine.Buffer; 28 | } 29 | 30 | void UpdateCmdline() 31 | { 32 | wchar_t* q = GetPebCmdline(); 33 | if ( peb_cmdl != q ) 34 | { 35 | wcsncpy(cmdlineW,q,4095); 36 | WideCharToMultiByte(CP_ACP,0,cmdlineW,-1,cmdlineA,4095,0,0); 37 | peb_cmdl = q; 38 | } 39 | } 40 | 41 | CmdlineFilter() : cmdlineW(0), cmdlineA(0), peb_cmdl(0) 42 | { 43 | byte_t* q = (byte_t*)VirtualAlloc(0,4096*3,MEM_COMMIT,PAGE_READWRITE); 44 | cmdlineW = (wchar_t*)q; 45 | cmdlineA = (char*)q+4096*2; 46 | } 47 | 48 | APIF_STATUS DoGetCmdlA(void* args, longptr_t* result) 49 | { 50 | UpdateCmdline(); 51 | *result = (longptr_t)cmdlineA; 52 | return APIF_RETURN; 53 | } 54 | 55 | APIF_STATUS DoGetCmdlW(void* args, longptr_t* result) 56 | { 57 | UpdateCmdline(); 58 | *result = (longptr_t)cmdlineW; 59 | return APIF_RETURN; 60 | } 61 | 62 | virtual APIF_STATUS DoCall(int apif_id, void* args, longptr_t* result) 63 | { 64 | switch (apif_id) 65 | { 66 | case APIF_CMDLINEA: 67 | return DoGetCmdlA(args,result); 68 | case APIF_CMDLINEW: 69 | return DoGetCmdlW(args,result); 70 | } 71 | return APIF_CONTINUE; 72 | } 73 | }; 74 | 75 | CmdlineFilter apif_cmdlfilt = CmdlineFilter(); 76 | 77 | void APIF_RegisterCmdlHooks() 78 | { 79 | APIF->Push(&apif_cmdlfilt); 80 | }; 81 | -------------------------------------------------------------------------------- /Core/classes/sources/com_support.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | const pchar_t FormatGUID(const GUID& guid,BaseStringT& s) 4 | { 5 | s << _S* 6 | BaseStringT::SelectTstr( 7 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 8 | L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"), 9 | guid.Data1,guid.Data2,guid.Data3, 10 | guid.Data4[0],guid.Data4[1],guid.Data4[2],guid.Data4[3], 11 | guid.Data4[4],guid.Data4[5],guid.Data4[6],guid.Data4[7]); 12 | } 13 | #endif // MOLESTUDIO_NO_GUID_SUPPORT 14 | 15 | #if !defined MOLESTUDIO_NO_GUID_SUPPORT 16 | template CXX_NO_INLINE 17 | const tTchr* GUIDToRegString(const GUID& guid,BaseStringT& s) 18 | { 19 | return 20 | s.SetF( 21 | BaseStringT::SelectTstr( 22 | "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", 23 | L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"), 24 | guid.Data1,guid.Data2,guid.Data3, 25 | guid.Data4[0],guid.Data4[1],guid.Data4[2],guid.Data4[3], 26 | guid.Data4[4],guid.Data4[5],guid.Data4[6],guid.Data4[7]); 27 | } 28 | #endif 29 | 30 | #if !defined MOLESTUDIO_NO_GUID_SUPPORT 31 | 32 | inline widestring GUIDToWideString(const GUID& guid) 33 | { 34 | widestring ws; 35 | GUIDToString(guid,ws); 36 | return ws; 37 | } 38 | 39 | inline widestring GUIDToWideRegString(const GUID& guid) 40 | { 41 | widestring ws; 42 | GUIDToRegString(guid,ws); 43 | return ws; 44 | } 45 | 46 | inline asciistring GUIDToAsciiString(const GUID& guid) 47 | { 48 | asciistring as; 49 | GUIDToString(guid,as); 50 | return as; 51 | } 52 | 53 | inline asciistring GUIDToAsciiRegString(const GUID& guid) 54 | { 55 | asciistring as; 56 | GUIDToRegString(guid,as); 57 | return as; 58 | } 59 | 60 | #if !defined CXX_NO_GUID_SUPPORT 61 | CXX_NO_INLINE 62 | static StringT GenGUID() 63 | { 64 | GUID guid; 65 | CoCreateGuid(&guid); 66 | StringT s; 67 | GUIDToString(guid,s); 68 | return s; 69 | } 70 | #endif 71 | 72 | }; 73 | 74 | 75 | #endif // MOLESTUDIO_NO_GUID_SUPPORT 76 | 77 | -------------------------------------------------------------------------------- /Core/include/_common.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #define _TEGGOSTATIC 9 | #define _TEGGOSTRIP__EXPR__ 10 | #define _TEGGOSTRIP__FILE__ 11 | #define _TEGGO_WITHOUT_SHL 12 | #define __BUILD_CORE__ 13 | 14 | #define _DISABLE_DBGOUTPUT 15 | 16 | #if defined _WIN32 && !defined _WINDOWS_ 17 | # if !defined _X86_ 18 | # define _X86_ 1 19 | # endif 20 | # if !defined WINVER 21 | # define WINVER 0x600 22 | # endif 23 | # if !defined _WIN32_WINNT 24 | # define _WIN32_WINNT 0x0600 25 | # endif 26 | #endif 27 | 28 | #include 29 | 30 | typedef __int64 INT64T; 31 | 32 | #include 33 | #include 34 | #include 35 | #include "xnt.h" 36 | #include "../Xi/ntdll.h" 37 | //#include "Xi/Xi.h" 38 | 39 | #undef EXTERN_C 40 | 41 | #define _FREE Lfree 42 | #define _MALLOC Lalloc 43 | #define _TEGGONEW 1 44 | 45 | #if defined __cplusplus 46 | extern "C" void* Lalloc(unsigned sz); 47 | extern "C" void Lfree(void* pp); 48 | #include "../Classes/classes.h" 49 | #else 50 | void* Lalloc(unsigned sz); 51 | void Lfree(void* pp); 52 | #define EXTERN_C 53 | #endif // __cplusplus 54 | 55 | #include "stbinfo.h" 56 | 57 | EXTERN_C int _MAJOR_VERSION; 58 | EXTERN_C int _BUILD_NUMBER; 59 | EXTERN_C void memsetS(void* b, int val, unsigned n); 60 | EXTERN_C void memcopy(void* dst, void* src, unsigned n); 61 | EXTERN_C char* __cdecl _UnXOr(int source, int count, char* buffer); 62 | //EXTERN_C void __cdecl _UnXOrFree(void* ); 63 | 64 | EXTERN_C void StartDebugger(); 65 | EXTERN_C int AuxReadFile(HANDLE f, void* ptr, unsigned len); 66 | EXTERN_C void* AuxAllocExec(int sz); 67 | EXTERN_C void AuxFree(void*); 68 | 69 | EXTERN_C unsigned* _LASTSTATUS(); 70 | EXTERN_C HANDLE _CURDIRHANDLE(); 71 | 72 | EXTERN_C unsigned isNestedProcess; 73 | 74 | typedef struct _CRPROC_INFO 75 | { 76 | wchar_t fullExePath[1024]; 77 | wchar_t internalName[256]; 78 | unsigned char internalSign[16]; 79 | struct 80 | { 81 | unsigned injected : 1; 82 | unsigned suspended : 1; 83 | } f; 84 | } CRPROC_INFO; 85 | 86 | EXTERN_C void* _TIB(); 87 | -------------------------------------------------------------------------------- /Core/classes/sources/com_register.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined __506DA0C7_943D_4E7C_A382_00B907BB5CD8__ 9 | #define __506DA0C7_943D_4E7C_A382_00B907BB5CD8__ 10 | 11 | #if !defined CXX_NO_MSCOM_SUPPORT 12 | 13 | #include "_specific.h" 14 | #include "hinstance.h" 15 | #include "string.h" 16 | #include "com_generic.h" 17 | 18 | #define ComRegIfSok(hr,expr) FAILED(hr) ? hr : (expr) 19 | 20 | namespace teggo 21 | { 22 | 23 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegWriteStr(pchar_t root,pchar_t key,pchar_t subkey,pchar_t value, 24 | HKEY ROOT=HKEY_CLASSES_ROOT); 25 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegDeleteKey(pchar_t key,HKEY ROOT=HKEY_CLASSES_ROOT); 26 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegLoadTypeLib(ITypeLib** pI,pwide_t p = 0,HinstanceType& hinstance = Hinstance); 27 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegRegisterTypeLib(HinstanceType& hinstance = Hinstance); 28 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegUnregisterTypeLib(HinstanceType& hinstance = Hinstance); 29 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegRegisterCoClass(const GUID& clsid,pchar_t progID,pchar_t desc,long ver, 30 | HinstanceType& hinstance = Hinstance); 31 | _TEGGO_EXPORTABLE HRESULT CXX_STDCALL ComRegUnregisterCoClass(const GUID& clsid,pchar_t progID,long ver); 32 | 33 | _TEGGO_EXPORTABLE const wchar_t* CXX_STDCALL GUIDToRegString(const GUID& guid,BaseStringT& s); 34 | _TEGGO_EXPORTABLE const char* CXX_STDCALL GUIDToRegString(const GUID& guid,BaseStringT& s); 35 | 36 | typedef char _GUID_char48_t[48]; 37 | _TEGGO_EXPORTABLE pchar_t CXX_STDCALL GUIDToRegStringA(const GUID& guid, 38 | mutable_t<_GUID_char48_t> const& val = mutable_t<_GUID_char48_t>()); 39 | typedef wchar_t _GUID_wchar48_t[48]; 40 | _TEGGO_EXPORTABLE pwide_t CXX_STDCALL GUIDToRegStringW(const GUID& guid, 41 | mutable_t<_GUID_wchar48_t> const& val = mutable_t<_GUID_wchar48_t>()); 42 | } 43 | 44 | #endif // !defined CXX_NO_MSCOM_SUPPORT 45 | 46 | #endif // __506DA0C7_943D_4E7C_A382_00B907BB5CD8__ 47 | -------------------------------------------------------------------------------- /Molebox/src/xpm/file.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * file_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 41 1", 5 | "> c #97C4E7", 6 | "# c #4381AA", 7 | "d c #FFFFFF", 8 | "< c #71B2DE", 9 | "+ c #538BB1", 10 | "& c #D1E5F5", 11 | "q c #63B3DE", 12 | "6 c #F1F4F7", 13 | "* c #CAE1F3", 14 | "y c #7AC4E5", 15 | "= c #C3DDF1", 16 | "X c #74A1BD", 17 | "- c #BCD9EF", 18 | "5 c #619BC4", 19 | "3 c #E6EAF1", 20 | "2 c #4B8EBF", 21 | "o c #6B97B6", 22 | ". c #4B82A8", 23 | " c None", 24 | "w c #54A6D8", 25 | "1 c #71A8D1", 26 | ", c #85BBE2", 27 | "t c #EFF6FC", 28 | "7 c #DEEDF8", 29 | "@ c #4388B4", 30 | "a c #F7FBFD", 31 | "$ c #D7E0E9", 32 | "r c #FAFCFE", 33 | "4 c #DAEAF7", 34 | "e c #E9F3FA", 35 | "0 c #76BAE2", 36 | "% c #7FA6C0", 37 | "s c #FDFDFE", 38 | "O c #5896BE", 39 | "p c #B6D5EE", 40 | "8 c #87ABC3", 41 | ": c #A5CCEA", 42 | "9 c #E5F0F9", 43 | "; c #AFD1EC", 44 | "i c #F4F9FD", 45 | "u c #8FB0C3", 46 | /* pixels */ 47 | " ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " .XXXooOO++@#$ ", 53 | " %&*=-;:>>,<123 ", 54 | " %4&*=-;:>>,1>56 ", 55 | " %74&*=-;:>>1*>56 ", 56 | " 89700qqqqwq1e*>X ", 57 | " 8e974&*=-;:1re*>8 ", 58 | " 8te974&*=-;11111# ", 59 | " 8tty000qqqqqww>,+ ", 60 | " uitte974&*=-p:>>+ ", 61 | " uaitte974&*=-p:>O ", 62 | " uaayyyy000qqqqp:O ", 63 | " uraaitte974&*=-po ", 64 | " urraaitte974&*=-o ", 65 | " usryyyyyyy000q*=X ", 66 | " ussrraaitte974&*X ", 67 | " udssrraaitte974&X ", 68 | " uddyyyyyyyyyy074% ", 69 | " udddssrraaitte97% ", 70 | " uddddssrraaitte9% ", 71 | " udddddssrraaitte8 ", 72 | " uddddddssrraaitt8 ", 73 | " uuuuuuuuuuuuuu88u ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " " 79 | }; 80 | -------------------------------------------------------------------------------- /Molebox/src/xpm/folder.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * folder_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 41 1", 5 | "6 c #EDF2FB", 6 | "- c #AAC1E8", 7 | ": c #B9CDED", 8 | "X c #295193", 9 | ", c #C6D6F0", 10 | "a c #4A7CCE", 11 | "u c #779DDB", 12 | "y c #7FA2DD", 13 | "$ c #3263B4", 14 | "5 c #EAF0FA", 15 | ". c #2D59A3", 16 | "o c #6E96D8", 17 | "* c #356AC1", 18 | "r c #F7F9FD", 19 | "> c #BED0EE", 20 | "3 c #E1E9F7", 21 | "7 c #F0F5FC", 22 | "< c #CBD9F1", 23 | "2 c #DAE5F6", 24 | "# c #3161B1", 25 | " c None", 26 | "0 c #FDFEFF", 27 | "= c #9FB9E5", 28 | "e c #AEC5EA", 29 | "t c #89A9DF", 30 | "q c #98B5E4", 31 | "p c #5584D1", 32 | "d c #3A70CA", 33 | "@ c #305FAC", 34 | "i c #5D89D3", 35 | "1 c #D2DFF4", 36 | "% c #3366B9", 37 | "9 c #FAFCFE", 38 | "8 c #F5F8FD", 39 | "s c #4075CC", 40 | "O c #638ED5", 41 | "w c #90AFE2", 42 | "& c #3467BC", 43 | "+ c #2F5DA9", 44 | "; c #B3C8EB", 45 | "4 c #E5EDF9", 46 | /* pixels */ 47 | " ", 48 | " ", 49 | " ", 50 | " ", 51 | " ", 52 | " ", 53 | " ......X ", 54 | " .oooooO+ ", 55 | " .ooooooo. ", 56 | " .+@@@##$%%&&&&&****. ", 57 | " .=-;:>,<12345678900. ", 58 | " .q=-;:>,<1234567890. ", 59 | " .wq=-e:>,<12345678r. ", 60 | " .twq=-e:>,<12345678. ", 61 | " .ytwq=-e:>,<1234567. ", 62 | " .uytwq=-e:>,<123456. ", 63 | " .ouytwq=-e:>,<12345. ", 64 | " .Oouytwq=-e;>,<1234. ", 65 | " .iOouytwq=-e;>,<123. ", 66 | " .piOouytwq=-e;>,<12. ", 67 | " .apiOouytwq=-e;>,<1. ", 68 | " .sapiOouytwq=-e;>,<. ", 69 | " .dsapiOouytwq=-e;>,. ", 70 | " ...................# ", 71 | " ", 72 | " ", 73 | " ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " " 79 | }; 80 | -------------------------------------------------------------------------------- /Molebox/src/myafx.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "myafx.h" 9 | 10 | int _MAJOR_VERSION = 0; 11 | int _MINOR_VERSION = 0; 12 | int _BUILD_NUMBER = 0; 13 | 14 | pwide_t Translate(int i,pwide_t text) 15 | { 16 | return text; 17 | } 18 | 19 | #include "tr.inl" 20 | 21 | pwide_t MessageValue(int i ) 22 | { 23 | static FlatmapT* xmap = 0; 24 | if ( !xmap ) 25 | { 26 | xmap = new FlatmapT(); 27 | for ( int i = 0; i < _TR_COUNT_; ++i) 28 | { 29 | StringW line = _TR_[i]; 30 | StringW n = line.TillAndTrim(L':',true); n.Trim(); 31 | int lN = ToLong(+n,0); 32 | line.Trim(); 33 | line.ReplaceS(L"\\n",L"\n"); 34 | xmap->Put(lN,line); 35 | } 36 | } 37 | if ( xmap ) 38 | if ( StringW* val = xmap->Get(i) ) 39 | return +*val; 40 | return L"~~~notfound~~~~"; 41 | } 42 | 43 | void DirList_(StringParam rfold, StringW const& prefix, StringParam patt, ArrayT& names, u32_t flgs) 44 | { 45 | WIN32_FIND_DATAW wdta; 46 | StringW searchS = JoinPath(rfold,prefix+patt); 47 | HANDLE fh = FindFirstFileW(+searchS,&wdta); 48 | if ( fh != INVALID_HANDLE_VALUE ) 49 | { 50 | do 51 | { 52 | if ( wdta.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) 53 | { 54 | if ( wdta.cFileName[0] == '.' 55 | && ( wdta.cFileName[1] == '\0' || ( wdta.cFileName[1] == '.' && wdta.cFileName[2] == '\0' )) ) 56 | continue; 57 | if ( !(flgs&DIRLIST_FILESONLY) ) 58 | names.Push(prefix + wdta.cFileName); 59 | if ( flgs&DIRLIST_RECURSIVE ) 60 | DirList_(rfold,prefix+wdta.cFileName+"/",patt,names,flgs); 61 | } 62 | else if ( !(flgs&DIRLIST_DIRESONLY) ) 63 | names.Push(prefix + wdta.cFileName); 64 | } 65 | while ( FindNextFileW(fh,&wdta) ); 66 | FindClose(fh); 67 | } 68 | } 69 | 70 | void DirList(StringParam rfold, StringParam patt, ArrayT& names, u32_t flgs) 71 | { 72 | DirList_(rfold, StringW(""), patt, names, flgs); 73 | } 74 | -------------------------------------------------------------------------------- /MxbPack/stub/mkrotor.py: -------------------------------------------------------------------------------- 1 | 2 | import sys, random 3 | 4 | R = [32, 137, 239, 188, 102, 125, 221, 72, 212, 68, 81, 37, 86, 237, 147, 149, 5 | 70, 229, 17, 124, 115, 207, 33, 20, 122, 143, 25, 215, 51, 183, 138, 142, 6 | 146, 211, 110, 173, 1, 228, 189, 14, 103, 78, 162, 36, 253, 167, 116, 255, 7 | 158, 45, 185, 50, 98, 168, 250, 235, 54, 141, 195, 247, 240, 63, 148, 2, 8 | 224, 169, 214, 180, 62, 22, 117, 108, 19, 172, 161, 159, 160, 47, 43, 171, 9 | 194, 175, 178, 56, 196, 112, 23, 220, 89, 21, 164, 130, 157, 8, 85, 251, 10 | 216, 44, 94, 179, 226, 38, 90, 119, 40, 202, 34, 206, 35, 69, 231, 246, 11 | 29, 109, 74, 71, 176, 6, 60, 145, 65, 13, 77, 151, 12, 127, 95, 199, 12 | 57, 101, 5, 232, 150, 210, 129, 24, 181, 10, 121, 187, 48, 193, 139, 252, 13 | 219, 64, 88, 233, 96, 128, 80, 53, 191, 144, 218, 11, 106, 132, 155, 104, 14 | 91, 136, 31, 42, 243, 66, 126, 135, 30, 26, 87, 186, 182, 154, 242, 123, 15 | 82, 166, 208, 39, 152, 190, 113, 205, 114, 105, 225, 84, 73, 163, 99, 111, 16 | 204, 61, 200, 217, 170, 15, 198, 28, 192, 254, 134, 234, 222, 7, 236, 248, 17 | 201, 41, 177, 156, 92, 131, 67, 249, 245, 184, 203, 9, 241, 0, 27, 46, 18 | 133, 174, 75, 18, 93, 209, 100, 120, 76, 213, 16, 83, 4, 107, 140, 52, 19 | 58, 55, 3, 244, 97, 197, 238, 227, 118, 49, 79, 230, 223, 165, 153, 59] 20 | 21 | def next(S): 22 | while True: 23 | S = ( S * 1664525 + 1013904223) & 0xffffffff 24 | yield S 25 | 26 | def shuffle(a, S): 27 | S = list(reversed(S)) 28 | r = a[:] 29 | a = [0] 30 | while len(r) != 0: 31 | i = S[0]%(len(a)) 32 | S = S[1:] 33 | a.insert(i,r.pop(-1)) 34 | return a 35 | 36 | def unshuffle(a, S): 37 | r = [] 38 | a = a[:] 39 | while len(a) != 1: 40 | i = S[0]%(len(a)-1) 41 | r.append(a.pop(i)) 42 | S = S[1:] 43 | return r 44 | 45 | def gen_rotor(SID): 46 | g = next(SID) 47 | S1 = [ g.next() for i in range(len(R)) ] 48 | Q = shuffle(R,S1) 49 | G = unshuffle(Q,S1) 50 | assert G == R 51 | return '"' + ''.join(['\%03o'%i for i in Q[:-1]]) + '"' 52 | 53 | if __name__ == '__main__': 54 | SID = int(random.random()*65535) 55 | rotor = gen_rotor(SID) 56 | sys.stdout.write("#define _ROTOR_SID %d\n"%SID) 57 | sys.stdout.write("#define _ROTOR %s\n\n"%rotor) 58 | 59 | 60 | -------------------------------------------------------------------------------- /Core/_lzss.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LZSS python module 4 | there is simple & dirty LZ77 implementation 5 | 6 | (c)2008, Alexey Sudachen, alexey@sudachen.name 7 | 8 | */ 9 | 10 | 11 | #include 12 | 13 | extern int lz77ss_compress(char *in_b, int in_b_len, unsigned char *out_b, int out_b_len); 14 | extern int lz77ss_decompress(unsigned char *in_b, int in_b_len, char *out_b, int out_b_len); 15 | 16 | static PyObject *lzss_compress(PyObject *_0,PyObject *args) 17 | { 18 | char *in_b,*prefix = 0; 19 | int in_b_len,prefix_len = 0; 20 | if ( PyArg_ParseTuple(args,"s#|s#",&in_b,&in_b_len,&prefix,&prefix_len) ) 21 | { 22 | int out_b_len = in_b_len, out_i = 0; 23 | unsigned char *out_b = 0; 24 | PyObject *ret = 0; 25 | out_b = malloc(out_b_len+prefix_len); 26 | if ( prefix_len ) 27 | memcpy(out_b,prefix,prefix_len); 28 | out_i = lz77ss_compress(in_b,in_b_len,out_b+prefix_len,out_b_len); 29 | if ( out_i > 0 ) 30 | ret = PyString_FromStringAndSize(out_b,out_i+prefix_len); 31 | else 32 | PyErr_SetString(PyExc_Exception,"LZSS failed"); 33 | free(out_b); 34 | return ret; 35 | } 36 | return 0; 37 | } 38 | 39 | 40 | static PyObject *lzss_decompress(PyObject *_0,PyObject *args) 41 | { 42 | char *in_b; 43 | int in_b_len; 44 | if ( PyArg_ParseTuple(args,"s#",&in_b,&in_b_len) ) 45 | { 46 | int out_b_len = 0, out_i = 0; 47 | unsigned char *out_b = 0; 48 | PyObject *ret = 0; 49 | 50 | out_b_len = (unsigned int)in_b[0]|((unsigned int)in_b[1]<<8)| 51 | ((unsigned int)in_b[2]<<16)|((unsigned int)in_b[3]<<24); 52 | 53 | out_b = malloc(out_b_len); 54 | out_i = lz77ss_decompress(in_b+4,in_b_len-4,out_b,out_b_len); 55 | if ( out_i > 0 ) 56 | ret = PyString_FromStringAndSize(out_b,out_i); 57 | else 58 | PyErr_SetString(PyExc_Exception,"LZSS failed"); 59 | free(out_b); 60 | } 61 | return 0; 62 | } 63 | 64 | static PyMethodDef lzss_funcs[] = 65 | { 66 | {"compress",lzss_compress,METH_VARARGS,0}, 67 | {"decompress",lzss_decompress,METH_VARARGS,0}, 68 | {0,0,0,0}, 69 | }; 70 | 71 | void init_lzss() 72 | { 73 | Py_InitModule("_lzss", lzss_funcs); 74 | } 75 | -------------------------------------------------------------------------------- /Core/classes/sources/logger.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined ___1a21d8d4_6b42_4208_b579_a39b603bc4f8___ 9 | #define ___1a21d8d4_6b42_4208_b579_a39b603bc4f8___ 10 | 11 | #include "_specific.h" 12 | #include "string.h" 13 | #include "format.h" 14 | 15 | enum _T_logger_out_ 16 | { 17 | Lout = -1, 18 | Lerr = 0, 19 | Ldbg1 = 1, Ldbg2, Ldbg3, Ldbg4, Ldbg5, Ldbg6, 20 | Ldbg = Ldbg3, 21 | LdbgMax = Ldbg5 22 | }; 23 | 24 | _TEGGO_EXPORTABLE void CXX_STDCALL operator << ( _T_logger_out_, teggo::FormatT const& fmt); 25 | _TEGGO_EXPORTABLE void CXX_STDCALL operator << ( _T_logger_out_, teggo::FormatT const& fmt); 26 | 27 | namespace teggo 28 | { 29 | 30 | typedef HANDLE LOG_HANDLE; 31 | 32 | #ifdef _TEGGOINLINE 33 | template struct logcontrol_ 34 | #else 35 | struct logcontrol 36 | #endif 37 | { 38 | _TEGGO_EXPORTABLE static LOG_HANDLE handle; 39 | _TEGGO_EXPORTABLE static int dbglevel; 40 | _TEGGO_EXPORTABLE static bool reopen; 41 | }; 42 | #ifdef _TEGGOINLINE 43 | typedef logcontrol_ logcontrol; 44 | #endif 45 | 46 | inline bool LogLevelGeq(int lo) { return lo <= logcontrol::dbglevel; } 47 | 48 | _TEGGO_EXPORTABLE int CXX_STDCALL OpenLog(pwide_t logname = 0,pwide_t suffix = 0); 49 | _TEGGO_EXPORTABLE void CXX_STDCALL CloseLog(); 50 | _TEGGO_EXPORTABLE bool CXX_STDCALL LogIsOpen(); 51 | 52 | _TEGGO_EXPORTABLE void CXX_STDCALL Logout( pwide_t text, int level ); 53 | _TEGGO_EXPORTABLE void CXX_STDCALL Logout( pchar_t text, int level ); 54 | _TEGGO_EXPORTABLE void CXX_STDCALL Logout_( pchar_t text, int count, int level ); 55 | _TEGGO_EXPORTABLE void CXX_STDCALL LogoutBufferCRLF_( pchar_t buff, int count, int level ); 56 | 57 | } // namsepace 58 | 59 | template 60 | inline void CXX_STDCALL operator << ( _T_logger_out_ lo, tTc const* text) 61 | { teggo::Logout( text, lo ); } 62 | 63 | template 64 | inline void CXX_STDCALL operator << ( _T_logger_out_ lo, teggo::BaseStringT const& text) 65 | { teggo::Logout( +text, lo ); } 66 | 67 | #if defined _TEGGOINLINE 68 | #include "Logger.inl" 69 | #endif 70 | 71 | #endif // ___1a21d8d4_6b42_4208_b579_a39b603bc4f8___ 72 | -------------------------------------------------------------------------------- /Molebox/src/xpm/flop_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *flop_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 46 1", 5 | " c gray15", 6 | ". c #2D2D2D", 7 | "X c #333333", 8 | "o c #393939", 9 | "O c #525252", 10 | "+ c #5C5D5D", 11 | "@ c #5F5E61", 12 | "# c #605F60", 13 | "$ c #5F6160", 14 | "% c #636363", 15 | "& c #6B6B6B", 16 | "* c #737373", 17 | "= c #787877", 18 | "- c #777878", 19 | "; c #7C7C7C", 20 | ": c #FF6600", 21 | "> c #FF6D0C", 22 | ", c #7F817F", 23 | "< c #7E7E80", 24 | "1 c #838383", 25 | "2 c #878788", 26 | "3 c #888788", 27 | "4 c #878988", 28 | "5 c #8C8C8C", 29 | "6 c #8F9090", 30 | "7 c #939393", 31 | "8 c #989597", 32 | "9 c #989897", 33 | "0 c #989799", 34 | "q c #9C9C9C", 35 | "w c #A1A19F", 36 | "e c #9E9FA2", 37 | "r c #9FA0A0", 38 | "t c #A4A4A4", 39 | "y c #ACACAC", 40 | "u c #B4B4B4", 41 | "i c #BCBCBC", 42 | "p c gray77", 43 | "a c #CBCBCB", 44 | "s c #D4D4D4", 45 | "d c #DDDDDD", 46 | "f c #E3E3E3", 47 | "g c gray91", 48 | "h c gray96", 49 | "j c #FEFEFE", 50 | "k c None", 51 | /* pixels */ 52 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", 53 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", 54 | "kkXXXXXXXXXXXXXXXXXXXXXXXXXXXXkk", 55 | "kkXttt>::::::::::::::::::>554Xkk", 56 | "kkXtXX>::::::::::::::::::>XX1Xkk", 57 | "kkXtXX>::::::::::::::::::>XX1Xkk", 58 | "kkXtttjjjjjjjjjjjjjjjjjjjj211Xkk", 59 | "kkXtttjjjjjjjjjjjjjjjjjjjh1<;Xkk", 60 | "kkXtttjj::::::::::::::::jj<<;Xkk", 61 | "kkXtttjjjjjjjjjjjjjjjjjjjh;;;Xkk", 62 | "kkXtttjjjjjjjjjjjjjjjjjjjh;;;Xkk", 63 | "kkXttqjj::::::::::::::::jj;;*Xkk", 64 | "kkXtrtjjjjjjjjjjjjjjjjjjjh;**Xkk", 65 | "kkXtrrjjjjjjjjjjjjjjjjjjjj***Xkk", 66 | "kkXwerjj::::::::::::::::jj**&Xkk", 67 | "kkXrqehjjjjjjjjjjjjjjjjjjh*&&Xkk", 68 | "kkXrqqhjhjhjjjhjjjhjjhjhjh&&&Xkk", 69 | "kkXqq9q99776353211;;;-***&&&%Xkk", 70 | "kkX0q887776533511,;;;***&&&&%Xkk", 71 | "kkX8877%oXXXXXXXXoXXXXoO&&&%%Xkk", 72 | "kkX7766odffdssapiuyyqq7X&%%%%Xkk", 73 | "kkX5555XfgXXXXaaiiyywq7X&&%%%Xkk", 74 | "kkX5334offX11Xapiuytqq5o%%%%%Xkk", 75 | "kkX2221XfgX,;Xapiuytq85X%%%#+Xkk", 76 | "kkX1111odfX,;Xppuutrq85X%%$$@Xkk", 77 | "kkX111,offX;;Xpiuytr985o%%+++Xkk", 78 | "kkX11,,odfX;=Xiuyyrq975X+#+++Xkk", 79 | "kk.+11,odfXXXXiuytrq865X#++++Xkk", 80 | "kkk O,;osdssaiyytqq7772X+++++Xkk", 81 | "kkkk XXXXXXXXXXXXXXXXXXXXXXXX.kk", 82 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", 83 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" 84 | }; 85 | -------------------------------------------------------------------------------- /Molebox/src/xpm/save_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *save_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 46 1", 5 | " c gray15", 6 | ". c #2D2D2D", 7 | "X c #333333", 8 | "o c #393939", 9 | "O c #525252", 10 | "+ c #5C5D5D", 11 | "@ c #5F5E61", 12 | "# c #605F60", 13 | "$ c #5F6160", 14 | "% c #636363", 15 | "& c #6B6B6B", 16 | "* c #737373", 17 | "= c #787877", 18 | "- c #777878", 19 | "; c #7C7C7C", 20 | ": c #FF6600", 21 | "> c #FF6D0C", 22 | ", c #7F817F", 23 | "< c #7E7E80", 24 | "1 c #838383", 25 | "2 c #878788", 26 | "3 c #888788", 27 | "4 c #878988", 28 | "5 c #8C8C8C", 29 | "6 c #8F9090", 30 | "7 c #939393", 31 | "8 c #989597", 32 | "9 c #989897", 33 | "0 c #989799", 34 | "q c #9C9C9C", 35 | "w c #A1A19F", 36 | "e c #9E9FA2", 37 | "r c #9FA0A0", 38 | "t c #A4A4A4", 39 | "y c #ACACAC", 40 | "u c #B4B4B4", 41 | "i c #BCBCBC", 42 | "p c gray77", 43 | "a c #CBCBCB", 44 | "s c #D4D4D4", 45 | "d c #DDDDDD", 46 | "f c #E3E3E3", 47 | "g c gray91", 48 | "h c gray96", 49 | "j c #FEFEFE", 50 | "k c None", 51 | /* pixels */ 52 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", 53 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", 54 | "kkXXXXXXXXXXXXXXXXXXXXXXXXXXXXkk", 55 | "kkXttt>::::::::::::::::::>554Xkk", 56 | "kkXtXX>::::::::::::::::::>XX1Xkk", 57 | "kkXtXX>::::::::::::::::::>XX1Xkk", 58 | "kkXtttjjjjjjjjjjjjjjjjjjjj211Xkk", 59 | "kkXtttjjjjjjjjjjjjjjjjjjjh1<;Xkk", 60 | "kkXtttjj::::::::::::::::jj<<;Xkk", 61 | "kkXtttjjjjjjjjjjjjjjjjjjjh;;;Xkk", 62 | "kkXtttjjjjjjjjjjjjjjjjjjjh;;;Xkk", 63 | "kkXttqjj::::::::::::::::jj;;*Xkk", 64 | "kkXtrtjjjjjjjjjjjjjjjjjjjh;**Xkk", 65 | "kkXtrrjjjjjjjjjjjjjjjjjjjj***Xkk", 66 | "kkXwerjj::::::::::::::::jj**&Xkk", 67 | "kkXrqehjjjjjjjjjjjjjjjjjjh*&&Xkk", 68 | "kkXrqqhjhjhjjjhjjjhjjhjhjh&&&Xkk", 69 | "kkXqq9q99776353211;;;-***&&&%Xkk", 70 | "kkX0q887776533511,;;;***&&&&%Xkk", 71 | "kkX8877%oXXXXXXXXoXXXXoO&&&%%Xkk", 72 | "kkX7766odffdssapiuyyqq7X&%%%%Xkk", 73 | "kkX5555XfgXXXXaaiiyywq7X&&%%%Xkk", 74 | "kkX5334offX11Xapiuytqq5o%%%%%Xkk", 75 | "kkX2221XfgX,;Xapiuytq85X%%%#+Xkk", 76 | "kkX1111odfX,;Xppuutrq85X%%$$@Xkk", 77 | "kkX111,offX;;Xpiuytr985o%%+++Xkk", 78 | "kkX11,,odfX;=Xiuyyrq975X+#+++Xkk", 79 | "kk.+11,odfXXXXiuytrq865X#++++Xkk", 80 | "kkk O,;osdssaiyytqq7772X+++++Xkk", 81 | "kkkk XXXXXXXXXXXXXXXXXXXXXXXX.kk", 82 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk", 83 | "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" 84 | }; 85 | -------------------------------------------------------------------------------- /Core/classes/RSA512.SRC/rsa.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ___1e1e0e4e_b624_4a9c_9aea_48994ce31c97___ 3 | #define ___1e1e0e4e_b624_4a9c_9aea_48994ce31c97___ 4 | 5 | enum 6 | { 7 | RSA_DEFAULT_VALUE_BITS = 512, 8 | RSA_DEFAULT_VALUE_BYTES = RSA_DEFAULT_VALUE_BITS/8, 9 | RSA_DEFAULT_VALUE_WORDS = RSA_DEFAULT_VALUE_BITS/(8*4), 10 | RSA_DEFAULT_PRINT_LEN = RSA_DEFAULT_VALUE_BITS/3+1, 11 | }; 12 | typedef u32_t RSA_VALUE_TYPE[RSA_DEFAULT_VALUE_WORDS]; 13 | typedef u32_t RSA_MULRES_TYPE[2*RSA_DEFAULT_VALUE_WORDS]; 14 | 15 | extern "C" void _lv_mul4(u32_t a, u32_t *b, u32_t bl, u32_t *r, u32_t l); 16 | extern "C" u32_t _lv_add4(u32_t a, u32_t *r, u32_t rl); 17 | extern "C" u32_t _lv_shl(u32_t a,u32_t *r, u32_t rl); 18 | extern "C" u32_t _lv_less( u32_t *a, u32_t al, u32_t *b, u32_t bl ); 19 | extern "C" u32_t _lv_less0( u32_t *a, u32_t *b, u32_t l ); 20 | extern "C" void _lv_sshl1( u32_t *a, u32_t al, u32_t *r, u32_t rl ); 21 | extern "C" u32_t _lv_sshl( u32_t n, u32_t *a, u32_t al, u32_t *r, u32_t rl ); 22 | extern "C" u32_t _lv_maxbit( u32_t *a, u32_t al ); 23 | extern "C" void _lv_sub(u32_t *m, u32_t ml, u32_t *r, u32_t rl); 24 | extern "C" u32_t _lv_add(u32_t *m, u32_t ml, u32_t *r, u32_t rl); 25 | extern "C" void _lv_mul(u32_t *a,u32_t *b,u32_t *r, u32_t l); 26 | extern "C" void _lv_mul0(u32_t *a,u32_t *b,u32_t *r, u32_t l); 27 | extern "C" void long_mul_mod( u32_t *a, u32_t *b, u32_t *m, u32_t *r, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 28 | extern "C" void long_exp_mod( u32_t *p, u32_t *e, u32_t *m, u32_t *r, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 29 | extern "C" int long_print( char *text, int len, u32_t const *a, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 30 | extern "C" void long_scan( char const *text, u32_t *r, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 31 | extern "C" u32_t long_div2( u16_t a, u32_t *r, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 32 | extern "C" void long_mul4( u32_t a, u32_t *r, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 33 | extern "C" void long_add4( u32_t a, u32_t *r, u32_t RSA_VALUE_BITS = RSA_DEFAULT_VALUE_BITS ); 34 | 35 | #define RSA_mulmod long_mul_mod 36 | #define RSA_expmod long_exp_mod 37 | #define RSA_lprint long_print 38 | #define RSA_lscan long_scan 39 | #define RSA_div2 long_div2 40 | #define RSA_mul4 long_mul4 41 | #define RSA_add4 long_add4 42 | 43 | #endif /*___1e1e0e4e_b624_4a9c_9aea_48994ce31c97___*/ 44 | -------------------------------------------------------------------------------- /Core/classes/sources/_adler32.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined ___a33f5e10_fd2f_4ac4_93c4_25e70e1220cc___ 9 | #define ___a33f5e10_fd2f_4ac4_93c4_25e70e1220cc___ 10 | 11 | #if defined _WITHOUT_TFFCLS 12 | #include "./detect_compiler.h" 13 | #endif 14 | 15 | #define _ADLER32_DO1(buf,i) {s1 += buf[i]; s2 += s1;} 16 | #define _ADLER32_DO2(buf,i) _ADLER32_DO1(buf,i); _ADLER32_DO1(buf,i+1); 17 | #define _ADLER32_DO4(buf,i) _ADLER32_DO2(buf,i); _ADLER32_DO2(buf,i+2); 18 | #define _ADLER32_DO8(buf,i) _ADLER32_DO4(buf,i); _ADLER32_DO4(buf,i+4); 19 | #define _ADLER32_DO16(buf) _ADLER32_DO8(buf,0); _ADLER32_DO8(buf,8); 20 | 21 | namespace teggo 22 | { 23 | 24 | u32_t CXX_STDCALL Adler32(u32_t adler,const byte_t* buf,u32_t len); 25 | 26 | #if defined _TEGGOINLINE || defined _TEGGO_ADLER_HERE || defined _ADLER32_LOCAL 27 | 28 | CXX_EXTERNC u32_t adler32(u32_t adler,const byte_t* buf,u32_t len) { return Adler32(adler,buf,len); } 29 | 30 | # if defined _TEGGOINLINE || defined _ADLER32_LOCAL 31 | CXX_FAKE_INLINE 32 | # endif 33 | 34 | u32_t CXX_STDCALL Adler32(u32_t adler,const byte_t* buf,u32_t len) 35 | { 36 | enum 37 | { 38 | BASE = 65521L, /* largest prime smaller than 65536 */ 39 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ 40 | NMAX = 5552 41 | }; 42 | 43 | u32_t s1 = adler & 0xffff; 44 | u32_t s2 = (adler >> 16) & 0xffff; 45 | int k; 46 | 47 | if (buf == 0) return 1L; 48 | 49 | while (len > 0) 50 | { 51 | k = len < NMAX ? len : NMAX; 52 | len -= k; 53 | while (k >= 16) 54 | { 55 | _ADLER32_DO16(buf); 56 | buf += 16; 57 | k -= 16; 58 | } 59 | if (k != 0) 60 | do 61 | { 62 | s1 += *buf++; 63 | s2 += s1; 64 | } 65 | while (--k); 66 | s1 %= BASE; 67 | s2 %= BASE; 68 | } 69 | return (s2 << 16) | s1; 70 | } 71 | #endif 72 | 73 | #undef _ADLER32_DO1 74 | #undef _ADLER32_DO2 75 | #undef _ADLER32_DO4 76 | #undef _ADLER32_DO8 77 | #undef _ADLER32_DO16 78 | 79 | } //namespace 80 | 81 | #endif // ___a33f5e10_fd2f_4ac4_93c4_25e70e1220cc___ 82 | -------------------------------------------------------------------------------- /Core/classes/sources/keylist.inl: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined ___aa7f0f01_6ce7_451c_964a_c4d68c7902bc___ 9 | #define ___aa7f0f01_6ce7_451c_964a_c4d68c7902bc___ 10 | 11 | #include "keylist.h" 12 | 13 | namespace teggo 14 | { 15 | 16 | #if !defined _TEGGO_KEYLIST_HERE 17 | # define _TEGGO_KEYLIST_FAKE_INLINE CXX_FAKE_INLINE 18 | #else 19 | # define _TEGGO_KEYLIST_FAKE_INLINE _TEGGO_EXPORTABLE 20 | #endif 21 | 22 | _TEGGO_KEYLIST_FAKE_INLINE 23 | KeyListRecord* CXX_STDCALL KeyListRecord::Insert(pwide_t key,KeyListRecord** rec,unsigned sizeOfT) 24 | { 25 | long key_len = key?wcslen(key):0; 26 | 27 | if ( !key ) 28 | { 29 | while ( *rec ) 30 | { 31 | if ( *(wchar_t*)((char*)(*rec + 1) + sizeOfT) != 0 ) 32 | break; 33 | rec = &(*rec)->next; 34 | } 35 | } 36 | 37 | KeyListRecord* rec0 = 38 | (KeyListRecord*)new byte_t[sizeof(KeyListRecord)+sizeOfT+(key_len+1)*sizeof(wchar_t)]; 39 | 40 | rec0->next = *rec; 41 | *rec = rec0; 42 | 43 | if ( key ) 44 | memcpy( ((byte_t*)(rec0+1) + sizeOfT), key, (key_len+1)*sizeof(wchar_t) ); 45 | 46 | return rec0; 47 | } 48 | 49 | _TEGGO_KEYLIST_FAKE_INLINE 50 | KeyListRecord** CXX_STDCALL KeyListRecord::FindRecordByKey(pwide_t key,KeyListRecord** rec,unsigned sizeOfT) 51 | { 52 | while ( *rec ) 53 | { 54 | pwide_t k = pwide_t((byte_t*)(*rec+1)+sizeOfT); 55 | if ( *k == 0 ) 56 | return 0; 57 | if ( wcscmp(k,key) == 0 ) 58 | return rec; 59 | rec = &(*rec)->next; 60 | } 61 | 62 | return 0; 63 | } 64 | 65 | _TEGGO_KEYLIST_FAKE_INLINE 66 | KeyListRecord** CXX_STDCALL KeyListRecord::FindRecordByKeyI(pwide_t key,KeyListRecord** rec,unsigned sizeOfT) 67 | { 68 | while ( *rec ) 69 | { 70 | pwide_t k = pwide_t((byte_t*)(*rec+1)+sizeOfT); 71 | 72 | if ( *k == 0 ) 73 | return 0; 74 | 75 | if ( wcsicmp(k,key) == 0 ) 76 | return rec; 77 | 78 | rec = &(*rec)->next; 79 | } 80 | 81 | return 0; 82 | } 83 | 84 | } // namespace 85 | 86 | #endif // #define ___aa7f0f01_6ce7_451c_964a_c4d68c7902bc___ 87 | -------------------------------------------------------------------------------- /Core/classes/sources/guid.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #if !defined __7CEC2042_1664_4CD3_AA3D_48DB4768C18E__ 9 | #define __7CEC2042_1664_4CD3_AA3D_48DB4768C18E__ 10 | 11 | 12 | #include "_specific.h" 13 | 14 | #if !defined CXX_NO_GUID_SUPPORT 15 | 16 | typedef GUID guid_t; 17 | 18 | template 19 | struct teggo_GuidOf 20 | { 21 | typedef typename tTx::Guid Guid; 22 | }; 23 | 24 | template inline 25 | guid_t const* CXX_STDCALL teggo_guidof( tTx const* /*fake*/ = 0) 26 | { 27 | typedef typename teggo_GuidOf::Guid Guid; 28 | return &Guid::value; 29 | } 30 | 31 | namespace teggo 32 | { 33 | 34 | template < 35 | unsigned tLx, 36 | unsigned tWx1, unsigned tWx2, 37 | unsigned tBx1, unsigned tBx2, unsigned tBx3, unsigned tBx4, 38 | unsigned tBx5, unsigned tBx6, unsigned tBx7, unsigned tBx8 > 39 | struct GuidT 40 | { 41 | static guid_t const value; 42 | }; 43 | 44 | template < 45 | unsigned tLx, 46 | unsigned tWx1, unsigned tWx2, 47 | unsigned tBx1, unsigned tBx2, unsigned tBx3, unsigned tBx4, 48 | unsigned tBx5, unsigned tBx6, unsigned tBx7, unsigned tBx8 > 49 | guid_t const GuidT 50 | ::value = { tLx, tWx1, tWx2, { tBx1,tBx2,tBx3,tBx4,tBx5,tBx6,tBx7,tBx8 } }; 51 | 52 | struct GUIDless 53 | { 54 | bool operator() ( guid_t const& a, guid_t const& b ) const 55 | { 56 | return memcmp(&a,&b,sizeof(guid_t)) < 0; 57 | } 58 | }; 59 | 60 | inline int CXX_STDCALL GUIDcmpf( void const* a, void const* b ) 61 | { 62 | return memcmp(a,b,sizeof(guid_t)); 63 | } 64 | } 65 | 66 | #define TEGGO_DECLARE_GUID(x,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 67 | typedef teggo::GuidT x; 68 | 69 | #define TEGGO_DECLARE_GUIDOF(x,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 70 | template <> \ 71 | struct teggo_GuidOf { typedef teggo::GuidT Guid; }; 72 | 73 | #define TEGGO_DECLARE_GUIDOF_(x,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ 74 | struct x; \ 75 | TEGGO_DECLARE_GUIDOF(x,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) 76 | 77 | #define TEGGO_GUIDOF_(x) teggo_GuidOf::Guid::value 78 | #define TEGGO_GUIDOF(x) (*teggo_guidof((x*)0)) 79 | #endif // CXX_NO_GUID_SUPPORT 80 | 81 | #endif // __7CEC2042_1664_4CD3_AA3D_48DB4768C18E__ 82 | -------------------------------------------------------------------------------- /Core/classes/sources/newdes.inl: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___101853ab_405b_443a_8d26_152269b14074___ 9 | #define ___101853ab_405b_443a_8d26_152269b14074___ 10 | 11 | #include "./newdes.h" 12 | 13 | #if defined _TEGGOINLINE || defined _WITHOUT_TFFCLS || defined _TEGGO_NEWDES_HERE 14 | 15 | namespace teggo 16 | { 17 | 18 | #if defined _TEGGO_NEWDES_HERE 19 | # define _TEGGO_NEWDES_FAKE_INLINE _TEGGO_EXPORTABLE 20 | #else 21 | # define _TEGGO_NEWDES_FAKE_INLINE CXX_FAKE_INLINE 22 | #endif 23 | 24 | _TEGGO_NEWDES_FAKE_INLINE 25 | void NEWDES_Cipher::SetupEncipher(void const* key) 26 | { 27 | NDES_Init_Encipher(&ctx,key); 28 | } 29 | 30 | _TEGGO_NEWDES_FAKE_INLINE 31 | void NEWDES_Cipher::SetupDecipher(void const* key) 32 | { 33 | NDES_Init_Decipher(&ctx,key); 34 | } 35 | 36 | _TEGGO_NEWDES_FAKE_INLINE 37 | void NEWDES_Cipher::DoCipherBlock(void* b) 38 | { 39 | NDES_Cipher_8(&ctx,b); 40 | } 41 | 42 | _TEGGO_NEWDES_FAKE_INLINE 43 | void NEWDES_Cipher::DoCipher(void* data,u32_t count) 44 | { 45 | NDES_Cipher(&ctx,data,count); 46 | } 47 | 48 | _TEGGO_NEWDES_FAKE_INLINE 49 | void NEWDES_Cipher::DoCipherCBCI(void* data,u32_t count, uint64_t IVc) 50 | { 51 | byte_t q[NDES_BLOCK_BYTES] = {0}; 52 | if (IVc) memcpy(q,&IVc,8); 53 | for (u32_t i = 0; i < count; ++i) 54 | { 55 | for ( int j =0; j < NDES_BLOCK_BYTES; ++j ) 56 | *((byte_t*)data+NDES_BLOCK_BYTES*i+j) ^= *(q+j); 57 | DoCipherBlock((byte_t*)data+NDES_BLOCK_BYTES*i); 58 | memcpy(q,(byte_t*)data+NDES_BLOCK_BYTES*i,NDES_BLOCK_BYTES); 59 | } 60 | } 61 | 62 | _TEGGO_NEWDES_FAKE_INLINE 63 | void NEWDES_Cipher::DoCipherCBCO(void* data,u32_t count, uint64_t IVc) 64 | { 65 | byte_t q[NDES_BLOCK_BYTES] = {0}; 66 | if (IVc) memcpy(q,&IVc,8); 67 | for (u32_t i = 0; i < count; ++i) 68 | { 69 | byte_t w[NDES_BLOCK_BYTES]; 70 | memcpy(w,(byte_t*)data+NDES_BLOCK_BYTES*i,NDES_BLOCK_BYTES); 71 | DoCipherBlock((byte_t*)data+NDES_BLOCK_BYTES*i); 72 | for ( int j =0; j < NDES_BLOCK_BYTES; ++j ) 73 | *((byte_t*)data+NDES_BLOCK_BYTES*i+j) ^= *(q+j); 74 | memcpy(q,w,NDES_BLOCK_BYTES); 75 | } 76 | } 77 | 78 | } // namespace 79 | 80 | #endif 81 | #endif // ___101853ab_405b_443a_8d26_152269b14074___ 82 | -------------------------------------------------------------------------------- /Core/src/apifS.S: -------------------------------------------------------------------------------- 1 | 2 | .global __NtDlF 3 | __NtDlF: 4 | __DlF_HANDLER: 5 | mov $0x7fffffff,%eax 6 | __DlF_ORIGN: 7 | push $0x7fffffff 8 | or %eax,%eax 9 | jnz __NtDlF@E 10 | ret 11 | __NtDlF@E: 12 | __DlF_RETN: 13 | push $0x7fffffff 14 | 15 | pushl $0 /* result */ 16 | push %esp /* & result */ 17 | 18 | /* 19 | &result 20 | ------- 21 | result +4 22 | retn +8 23 | orign +12 24 | retaddress +16 25 | args +20 26 | */ 27 | 28 | push %esp 29 | add $20,(%esp) 30 | __DlF_APIFID: 31 | push $0x7fffffff 32 | 33 | /* 34 | apifid 35 | &args 36 | &result 37 | ------ 38 | */ 39 | 40 | jmp *%eax 41 | int3 42 | __NtDlF0_END: 43 | 44 | .global __DlF_COPY /* (dst) */ 45 | __DlF_COPY: 46 | mov 4(%esp),%eax 47 | pushl $(__NtDlF0_END-__NtDlF) 48 | push $__NtDlF 49 | push %eax 50 | call _memcopy 51 | add $12,%esp 52 | ret 53 | 54 | .global __DlF_SIZE 55 | __DlF_SIZE: 56 | mov $(__NtDlF0_END-__NtDlF),%eax 57 | ret 58 | 59 | .global __DlF_SET_ORIGN /* (p, val) */ 60 | __DlF_SET_ORIGN: 61 | mov 4(%esp),%eax 62 | mov 8(%esp),%edx 63 | add $(__DlF_ORIGN-__NtDlF+1),%eax 64 | mov %edx,(%eax) 65 | ret 66 | 67 | .global __DlF_SET_APIFID /* (p, val) */ 68 | __DlF_SET_APIFID: 69 | mov 4(%esp),%eax 70 | mov 8(%esp),%edx 71 | add $(__DlF_APIFID-__NtDlF+1),%eax 72 | mov %edx,(%eax) 73 | ret 74 | 75 | .global __DlF_SET_RETN /* (p, val) */ 76 | __DlF_SET_RETN: 77 | mov 4(%esp),%eax 78 | mov 8(%esp),%edx 79 | add $(__DlF_RETN-__NtDlF+1),%eax 80 | mov %edx,(%eax) 81 | ret 82 | 83 | .global __DlF_SET_HANDLER /* (p, val) */ 84 | __DlF_SET_HANDLER: 85 | mov 4(%esp),%eax 86 | mov 8(%esp),%edx 87 | add $(__DlF_HANDLER-__NtDlF+1),%eax 88 | mov %edx,(%eax) 89 | ret 90 | 91 | .global __NtDlFhandler 92 | __NtDlFhandler: 93 | 94 | push %esi 95 | push %edi 96 | push %ebx 97 | push %ecx 98 | call _APIF_DoCall /* (apifid,args,&result) */ 99 | pop %ecx 100 | pop %ebx 101 | pop %edi 102 | pop %esi 103 | add $12,%esp 104 | 105 | /* 106 | result 107 | retn +4 108 | orign +8 109 | --------- 110 | */ 111 | 112 | or %eax,%eax /* RETURN ? */ 113 | jnz __NtDlFhandler@1 114 | mov 12(%esp), %eax /* retaddress */ 115 | mov %esp,%edx 116 | add 4(%esp),%edx 117 | add $12,%edx 118 | mov %eax,(%edx) 119 | pop %eax 120 | mov %edx,%esp 121 | ret 122 | 123 | __NtDlFhandler@1: /* call to orign */ 124 | 125 | add $8,%esp 126 | ret 127 | -------------------------------------------------------------------------------- /Core/src/fw/fwinstall.h: -------------------------------------------------------------------------------- 1 | 2 | typedef unsigned char byte_t; 3 | typedef long longptr_t; 4 | 5 | int _DLO(void); 6 | int ISNTDLL(int S); 7 | int ISK32DLL(int S); 8 | int LZSS_Decomress(byte_t* in_b, int in_b_len, char* out_b, int out_b_len); 9 | void Do_Cipher(byte_t* unrav, void* b, int count); 10 | void Setup_Decipher(byte_t* unrav, void* K); 11 | unsigned adler32(unsigned adler, byte_t* buf, unsigned len); 12 | int _Core_Offset(); 13 | int _Core_Size(); 14 | void* _Self_Ptr(); 15 | void* _Self_Key(); 16 | void* _Query_DT64(); 17 | 18 | void* _S_Table(int); 19 | #define _S(Mag,Text) _S_Table(Mag) 20 | 21 | typedef void* (__stdcall* VA_t)(void*, int, int, int); 22 | typedef void (__stdcall* VF_t)(void*, int, int); 23 | typedef void* (__stdcall* CFM_t)(void*, void*, int, int, int, void*); 24 | typedef void* (__stdcall* MVOF_t)(void*, int, int, int, int); 25 | typedef void* (__stdcall* MVOFX_t)(void*, int, int, int, int, void*); 26 | typedef void (__stdcall* UVOF_t)(void*); 27 | typedef void (__stdcall* CH_t)(void*); 28 | typedef void* (__stdcall* GPA_t)(void*, char*); 29 | typedef void* (__stdcall* Ldrl_t)(char*); 30 | typedef void* (__stdcall* GMH_t)(char*); 31 | typedef int (__stdcall* GEV_t)(char*, void*, int); 32 | typedef void *(__stdcall *CF_t)(void*,unsigned,unsigned,void*,unsigned,unsigned,void*); 33 | typedef int (__stdcall *SFP_t)(void*,unsigned,unsigned*,unsigned); 34 | typedef int (__stdcall *RF_t)(void*,void*,unsigned,unsigned*,void*); 35 | 36 | #define FILE_MAP_WRITE 0x0002 37 | #define FILE_MAP_READ 0x0004 38 | #define FILE_MAP_EXECUTE 0x0008 39 | 40 | typedef struct _FUNCS 41 | { 42 | void* eh; 43 | wchar_t* modname; 44 | int injected; 45 | VA_t Virtual_Alloc; 46 | VF_t Virtual_Free; 47 | CFM_t Create_File_Mapping; 48 | MVOF_t Map_View_Of_File; 49 | UVOF_t Unmap_View_Of_File; 50 | CH_t Close_Handle; 51 | GPA_t Get_Proc_Address; 52 | Ldrl_t Load_Library; 53 | GMH_t Get_Module_Handle; 54 | GEV_t Get_Env_Value; 55 | MVOFX_t Map_View_Of_File_Ex; 56 | CF_t Create_File; 57 | SFP_t Set_File_Pointer; 58 | RF_t Read_File; 59 | } FUNCS; 60 | 61 | void memcopy(byte_t* to, byte_t* from, int count); 62 | void* S_Decrypt(char* b, byte_t* S); 63 | void Relocate_Core(CORE0_HEADER* core); 64 | void Import_Core(CORE0_HEADER* core, FUNCS* f); 65 | void* Find_Dll(int T); 66 | void* Find_Func(void* handle, char* name); 67 | void* Find_GPA(void* ntdll, void* kernl); 68 | int LZSS_Decompress(byte_t* in_b, int in_b_len, char* out_b, int out_b_len); 69 | void Displace_Support_Info(void* core, FUNCS* f); 70 | -------------------------------------------------------------------------------- /MxbPack/stub/pycparser/__init__.py: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------- 2 | # pycparser: __init__.py 3 | # 4 | # This package file exports some convenience functions for 5 | # interacting with pycparser 6 | # 7 | # Copyright (C) 2008-2009, Eli Bendersky 8 | # License: LGPL 9 | #----------------------------------------------------------------- 10 | 11 | __all__ = ['c_lexer', 'c_parser', 'c_ast'] 12 | __version__ = '1.06' 13 | 14 | from subprocess import Popen, PIPE 15 | from types import ListType 16 | 17 | from c_parser import CParser 18 | 19 | 20 | def parse_file( filename, use_cpp=False, 21 | cpp_path='cpp', cpp_args=''): 22 | """ Parse a C file using pycparser. 23 | 24 | filename: 25 | Name of the file you want to parse. 26 | 27 | use_cpp: 28 | Set to True if you want to execute the C pre-processor 29 | on the file prior to parsing it. 30 | 31 | cpp_path: 32 | If use_cpp is True, this is the path to 'cpp' on your 33 | system. If no path is provided, it attempts to just 34 | execute 'cpp', so it must be in your PATH. 35 | 36 | cpp_args: 37 | If use_cpp is True, set this to the command line 38 | arguments strings to cpp. Be careful with quotes - 39 | it's best to pass a raw string (r'') here. 40 | For example: 41 | r'-I../utils/fake_libc_include' 42 | If several arguments are required, pass a list of 43 | strings. 44 | 45 | When successful, an AST is returned. ParseError can be 46 | thrown if the file doesn't parse successfully. 47 | 48 | Errors from cpp will be printed out. 49 | """ 50 | if use_cpp: 51 | path_list = [cpp_path] 52 | if isinstance(cpp_args, ListType): 53 | path_list += cpp_args 54 | elif cpp_args != '': 55 | path_list += [cpp_args] 56 | path_list += [filename] 57 | 58 | # Note the use of universal_newlines to treat all newlines 59 | # as \n for Python's purpose 60 | # 61 | pipe = Popen( path_list, 62 | stdout=PIPE, 63 | universal_newlines=True) 64 | text = pipe.communicate()[0] 65 | else: 66 | text = open(filename, 'rU').read() 67 | 68 | parser = CParser() 69 | return parser.parse(text, filename) 70 | 71 | 72 | if __name__ == "__main__": 73 | pass 74 | 75 | 76 | -------------------------------------------------------------------------------- /Core/src/fw/fwxor.S: -------------------------------------------------------------------------------- 1 | .section .text$xor, "rx" 2 | XORED_TABLE: 3 | .byte 0x82,0x68,0x24,0xa0,0x34,0x60,0x11,0x22,0x17,0x77,0x48,0x95,0x53,0x32,0x33,0x25 4 | .byte 0x42,0x17,0x70,0x22,0x34,0x42,0x25,0x44,0x37,0xf8,0xaa,0x0f,0x3f,0x78,0x11,0x22 5 | .byte 0x17,0x77,0x48,0x95,0x77,0x70,0x22,0x34,0x42,0x25,0x44,0x37,0x57,0xfd,0x07,0x52 6 | .byte 0x0e,0x42,0xab,0x97,0x72,0x0a,0xad,0xf4,0x54,0x46,0x64,0x5e,0xd6,0x14,0x6b,0xa2 7 | .byte 0x5d,0x1a,0x11,0x22,0x0a,0xbb,0x92,0x33,0x3b,0xa3,0x1e,0xe5,0x78,0x82,0x2a,0xa3 8 | .byte 0x17,0x14,0x7d,0x56,0x62,0x34,0x0c,0xe4,0x53,0x32,0x36,0x7a,0x87,0x78,0xaa,0xa9 9 | .byte 0x95,0x36,0x47,0x4e,0x18,0x0c,0xe4,0x53,0x32,0x36,0x7a,0x80,0x16,0x42,0x33,0x56 10 | .byte 0x81,0xd4,0x30,0x77,0x11,0x22,0x02,0x3a,0x90,0x0e,0xe4,0x48,0x98,0x8b,0xb3,0x38 11 | .byte 0x92,0x11,0x04,0x64,0x4e,0xf7,0x74,0x4a,0xa3,0x17,0x14,0x7a,0xd4,0x72,0x07,0x44 12 | .byte 0x46,0x42,0x37,0x62,0x22,0x10,0x0d,0xfa,0xa3,0x1b,0xb5,0x66,0x77,0x6e,0xf8,0x81 13 | .byte 0x37,0x14,0xd2,0x18,0x55,0xb5,0x66,0x51,0x0c,0xf3,0x21,0x38,0x92,0x20,0x0d,0xfa 14 | .byte 0xa3,0x56,0x2e,0xf9,0xb9,0x21,0x61,0x60,0x35,0x3b,0x8b,0xb7,0x66,0x51,0x0c,0xf3 15 | .byte 0x21,0x38,0x92,0x20,0x0d,0xfa,0xa3,0x56,0x8b,0xf7,0xbf,0xef,0xc0,0x1f,0x5c,0x58 16 | .byte 0xa9,0x85,0x52,0x1e,0xe5,0x78,0x82,0x2a,0xa3,0x56,0x8d,0x33,0xc6,0x70,0xf9,0x41 17 | .byte 0x0c,0xb5,0x66,0x51,0x0c,0xf3,0x21,0x38,0x92,0x20,0x0d,0xfa,0xa3,0x13,0x2c,0x87 18 | .byte 0x6e,0xea,0x20,0xd9,0xd8,0x2b,0x66,0x9b,0xb8,0x81,0x16,0x6b,0xac,0xda,0xb0,0x0c 19 | .byte 0xd1,0x00,0x06,0x6b,0xa5,0x58,0x9b,0xb6,0x7b,0xa6,0x60,0x0b,0xc4,0x20,0x04,0x45 20 | .byte 0x63,0x8c,0x53,0xfb,0x08,0x6b,0x59,0x84,0x16,0x77,0x24,0x41,0x58,0x86,0x2a,0xaa 21 | .byte 0xc6,0x3c,0xd1,0x71,0x89,0xd5,0x41,0x1e,0xa6,0x71,0x0f,0xeb,0xbc,0xfa,0x8f,0xe2 22 | .byte 0x07,0x36,0x1b,0x83,0x2c,0x0e,0x43,0x9b,0xb8,0x81,0x16,0x6b,0xac,0xda,0xb0,0x0c 23 | .byte 0xd1,0x00,0x06,0x6b,0xa5,0x58,0x9b,0xb6,0x7b,0xa6,0x60,0x0b,0xc4,0x20,0x04,0x45 24 | .byte 0x63,0xd8,0x0a,0x75,0x40,0x4e,0x06,0x65,0x59,0x84,0x16,0x77,0x24,0x41,0x58,0x86 25 | .byte 0x2a,0xaa,0xc6,0x7a,0x8b,0xbb,0xbd,0x04,0x10,0x4f,0xbc,0xfa,0x8f,0xe2,0x3e,0xd7 26 | .byte 0x35,0x25,0x63,0xd1,0x14,0x68,0x0b,0x59,0x84,0x16,0x77,0x24,0x41,0x58,0x86,0x2a 27 | .byte 0xaa,0xc6,0xa6,0x1d,0xc5,0x5f,0xd9,0x43,0x1c,0xa6,0x71,0x0f,0xeb,0xbc,0xfa,0x8c 28 | .byte 0xc3,0x35,0x42,0x07,0x36,0x13,0x03 29 | 30 | .global __S_Table 31 | __S_Table: 32 | mov 4(%esp),%eax 33 | call __S_Table@e 34 | __S_Table@e: 35 | xor $1399483384,%eax 36 | and $65535,%eax 37 | addl (%esp),%eax 38 | add $4,%esp 39 | sub $(__S_Table@e-XORED_TABLE),%eax 40 | ret 41 | -------------------------------------------------------------------------------- /Molebox/src/about.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "myafx.h" 9 | #include "wx/aboutdlg.h" 10 | #include "wx/sizer.h" 11 | #include "wx/html/htmlwin.h" 12 | 13 | struct AboutDialog : wxDialog 14 | { 15 | AboutDialog(wxWindow* parent) : wxDialog(parent,wxID_ANY,L"About",wxDefaultPosition,wxDefaultSize,wxCAPTION) 16 | { 17 | } 18 | 19 | void CreateControls() 20 | { 21 | wxBoxSizer* topszr = new wxBoxSizer(wxVERTICAL); 22 | wxPanel* pan = new wxPanel(this); 23 | wxHtmlWindow* html = new wxHtmlWindow(pan,wxID_ANY,wxDefaultPosition,wxSize(520,480),wxHW_SCROLLBAR_NEVER|wxSUNKEN_BORDER); 24 | 25 | static const wchar_t about_html[] = 26 | L"
\n" 27 | L"
\n" 28 | //L"
\n" 29 | L"
MoleBox Virtualization Solution
GPL revision

\n" 30 | L"
follow molebox on github goo.gl/UY1PHP
\n" 31 | L"Version %1
\n" 32 | L"
\n"; 33 | 34 | BufferT b(about_html,about_html+sizeof(about_html)); 35 | 36 | static StringW version_tmpl = "%1"; 37 | static StringW version_val = _S*L"%d.%d" %_MAJOR_VERSION %_BUILD_NUMBER; 38 | 39 | b.Replace(+version_tmpl,version_tmpl.Length(),+version_val,version_val.Length(),towlower); 40 | html->SetPage(+b); 41 | html->SetSize( html->GetInternalRepresentation()->GetWidth(), 42 | html->GetInternalRepresentation()->GetHeight()); 43 | html->SetBorders(0); 44 | pan->SetSize(html->GetSize()); 45 | topszr->Add(pan, 0, wxALL, 10); 46 | wxSizer* buttons = CreateButtonSizer(wxOK); 47 | //buttons->Add( new wxButton(this,ctID_EXTEND,L"Renew subscription") ); 48 | topszr->Add( buttons, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 10 ); 49 | SetSizer(topszr); 50 | topszr->Fit(this); 51 | wxSize sz = GetSize(); 52 | wxSize psz = GetParent()->GetSize(); 53 | wxPoint xy = GetParent()->GetPosition(); 54 | SetPosition(wxPoint(xy.x+(psz.x-sz.x)/2,xy.y+(psz.y-sz.y)/2)); 55 | //SetClientSize(topszr->ComputeFittingClientSize(this)); 56 | } 57 | 58 | DECLARE_EVENT_TABLE() 59 | }; 60 | 61 | BEGIN_EVENT_TABLE( AboutDialog, wxDialog ) 62 | //EVT_BUTTON( wxID_OK, ConfigDialog::OnOK ) 63 | //EVT_BUTTON( ctID_HELP, ActivateDialog::OnHelp ) 64 | END_EVENT_TABLE() 65 | 66 | void ShowAboutInfo(wxWindow* parent) 67 | { 68 | AboutDialog dialog(parent); 69 | dialog.CreateControls(); 70 | dialog.ShowModal(); 71 | } 72 | -------------------------------------------------------------------------------- /Core/classes/sources/blowfish.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #ifndef ___4c244a21_2eff_49f3_a429_0b734f7e9cd1___ 9 | #define ___4c244a21_2eff_49f3_a429_0b734f7e9cd1___ 10 | 11 | #if !defined _WITHOUT_TFFCLS 12 | #include "./_specific.h" 13 | #else 14 | #include "./detect_compiler.h" 15 | #define _TEGGO_EXPORTABLE 16 | #endif 17 | 18 | #include 19 | 20 | namespace teggo 21 | { 22 | 23 | struct BLOWFISH_Cipher 24 | { 25 | enum { BLOCK_BYTES = 8 }; 26 | enum { KEY_BYTES = 15 }; 27 | enum DIRECTION { ENCRYPTION, DECRYPTION }; 28 | 29 | BF_CONTEXT self; 30 | DIRECTION direction; 31 | 32 | void SetupEncipher(void const* key, size_t count = KEY_BYTES) 33 | { 34 | Blowfish_Init(&self,key,count); 35 | direction = ENCRYPTION; 36 | } 37 | void SetupDecipher(void const* key, size_t count = KEY_BYTES) 38 | { 39 | Blowfish_Init(&self,key,count); 40 | direction = DECRYPTION; 41 | } 42 | 43 | void DoCipherBlock(void* b) 44 | { 45 | if ( direction == ENCRYPTION ) 46 | Blowfish_Encrypt8(&self,b); 47 | else 48 | Blowfish_Decrypt8(&self,b); 49 | } 50 | 51 | void DoCipher(void* data, u32_t count_of_blocks) 52 | { 53 | for (u32_t i = 0; i < count_of_blocks; ++i) 54 | DoCipherBlock((byte_t*)data+BLOCK_BYTES*i); 55 | } 56 | 57 | void DoCipherCBCI(void* data, u32_t count_of_blocks, uint64_t IVc = 0) 58 | { 59 | byte_t q[BLOCK_BYTES] = {0}; 60 | if (IVc) memcpy(q,&IVc,8); 61 | for (u32_t i = 0; i < count_of_blocks; ++i) 62 | { 63 | for ( int j =0; j < BLOCK_BYTES; ++j ) 64 | *((byte_t*)data+BLOCK_BYTES*i+j) ^= *(q+j); 65 | DoCipherBlock((byte_t*)data+BLOCK_BYTES*i); 66 | memcpy(q,(byte_t*)data+BLOCK_BYTES*i,BLOCK_BYTES); 67 | } 68 | 69 | } 70 | 71 | void DoCipherCBCO(void* data, u32_t count_of_blocks, uint64_t IVc = 0) 72 | { 73 | byte_t q[BLOCK_BYTES] = {0}; 74 | if (IVc) memcpy(q,&IVc,8); 75 | for (u32_t i = 0; i < count_of_blocks; ++i) 76 | { 77 | byte_t w[BLOCK_BYTES]; 78 | memcpy(w,(byte_t*)data+BLOCK_BYTES*i,BLOCK_BYTES); 79 | DoCipherBlock((byte_t*)data+BLOCK_BYTES*i); 80 | for ( int j =0; j < BLOCK_BYTES; ++j ) 81 | *((byte_t*)data+BLOCK_BYTES*i+j) ^= *(q+j); 82 | memcpy(q,w,BLOCK_BYTES); 83 | } 84 | } 85 | }; 86 | } 87 | 88 | #endif // ___4c244a21_2eff_49f3_a429_0b734f7e9cd1___ 89 | -------------------------------------------------------------------------------- /Core/classes/sources/_specific.inl: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #if !defined ___BE1F879C_7BF4_4220_B0CA_C5385185DE0C___ 10 | #define ___BE1F879C_7BF4_4220_B0CA_C5385185DE0C___ 11 | 12 | #include "_specific.h" 13 | 14 | #if defined _TEGGO_SPECIFIC_HERE 15 | # define _TEGGO_SPECIFIC_FAKE_INLINE _TEGGO_EXPORTABLE 16 | #else 17 | # define _TEGGO_SPECIFIC_FAKE_INLINE CXX_FAKE_INLINE 18 | #endif 19 | 20 | _TEGGO_SPECIFIC_FAKE_INLINE 21 | pchar_t CXX_STDCALL TeggoErrorText(TEGGOt_E e) 22 | { 23 | switch ( e ) 24 | { 25 | case TEGGO_OK: return "succeeded"; 26 | case TEGGO_FAIL: return "failed with unknown reason"; 27 | case TEGGO_NOFILE: return "no file"; 28 | case TEGGO_BADARG: return "bad argument provided"; 29 | case TEGGO_ASSERT: return "expression asserted"; 30 | case TEGGO_NOACCESS: return "access violation"; 31 | case TEGGO_NODATA: return "there is no data"; 32 | case TEGGO_IOFAIL: return "input/output failed"; 33 | case TEGGO_UNSUPPORTED: return "routine unsupported"; 34 | default: 35 | return "unknown error"; 36 | } 37 | } 38 | 39 | #if !defined _TEGGOINLINE 40 | template<> 41 | _TEGGO_EXPORTABLE_DATA wchar_t Teggo_LastError_::reason[128] = {0}; 42 | template<> 43 | _TEGGO_EXPORTABLE_DATA u32_t Teggo_LastError_::value = 0; 44 | #endif 45 | 46 | namespace teggo 47 | { 48 | 49 | _TEGGO_SPECIFIC_FAKE_INLINE 50 | wchar_t CXX_STDCALL ucs2_btowc(char c) 51 | { 52 | #if SYSTEM_IS_WINDOWS 53 | wchar_t wc[2] = {0}; 54 | //mbtowc(&wc,&c,1); 55 | MultiByteToWideChar(CP_ACP,0,&c,1,&wc[0],1); 56 | return *wc; 57 | #elif SYSTEM_IS_MACOSX 58 | return c; 59 | #else 60 | return c; 61 | #endif 62 | } 63 | 64 | _TEGGO_SPECIFIC_FAKE_INLINE 65 | char CXX_STDCALL ucs2_wctob(wchar_t wc) 66 | { 67 | #if SYSTEM_IS_WINDOWS 68 | char c[16] = { 0 }; 69 | //wctomb(c,wc); 70 | WideCharToMultiByte(CP_ACP,0,&wc,1,&c[0],1,0,0); 71 | return c[0]; 72 | #elif SYSTEM_IS_MACOSX 73 | return (char)wc; 74 | #else 75 | return (char)wc; 76 | #endif 77 | } 78 | 79 | _TEGGO_SPECIFIC_FAKE_INLINE 80 | void* DefaultAllocator::Allocate( u32_t sz ) 81 | { 82 | void* p = _MALLOC((size_t)sz); //operator new ((size_t)sz,nothrow); 83 | VIOLATION( p == 0 , L"OutOfMemory" ); 84 | return p; 85 | } 86 | 87 | _TEGGO_SPECIFIC_FAKE_INLINE 88 | void DefaultAllocator::Deallocate( void* p ) 89 | { 90 | //operator delete ( p ); 91 | if ( p ) _FREE(p); 92 | } 93 | 94 | } 95 | 96 | #undef _TEGGO_SPECIFIC_FAKE_INLINE 97 | 98 | #endif // ___BE1F879C_7BF4_4220_B0CA_C5385185DE0C___ 99 | -------------------------------------------------------------------------------- /MxbPack/src/onexit.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int _atexit( void (*func)(void) ) 5 | { 6 | //printf("%08x\n",func); 7 | return 0; 8 | } 9 | 10 | /* 11 | int onexit( void (*func)(void) ) 12 | { 13 | return 0; 14 | } 15 | 16 | void abort ( void ) 17 | { 18 | } 19 | 20 | 21 | void assert (int expression) 22 | { 23 | } 24 | 25 | char *strncpy(char *dest, const char *source, size_t count) 26 | { 27 | char *start = dest; 28 | 29 | while (count && (*dest++ = *source++)) count--; 30 | if (count) while (--count) *dest++ = '\0'; 31 | return start; 32 | } 33 | 34 | int strncmp(const char *s1, const char *s2, size_t count) 35 | { 36 | if (!count) return 0; 37 | 38 | while (--count && *s1 && *s1 == *s2) 39 | { 40 | s1++; 41 | s2++; 42 | } 43 | 44 | return *(unsigned char *) s1 - *(unsigned char *) s2; 45 | } 46 | 47 | void *memset(void *p, int c, size_t n) 48 | { 49 | char *pb = (char *) p; 50 | char *pbend = pb + n; 51 | while (pb != pbend) *pb++ = c; 52 | return p; 53 | } 54 | 55 | int memcmp(const void *dst, const void *src, size_t n) 56 | { 57 | if (!n) return 0; 58 | 59 | while (--n && *(char *) dst == *(char *) src) 60 | { 61 | dst = (char *) dst + 1; 62 | src = (char *) src + 1; 63 | } 64 | 65 | return *((unsigned char *) dst) - *((unsigned char *) src); 66 | } 67 | 68 | void *memcpy(void *dst, const void *src, size_t n) 69 | { 70 | void *ret = dst; 71 | 72 | while (n--) 73 | { 74 | *(char *)dst = *(char *)src; 75 | dst = (char *) dst + 1; 76 | src = (char *) src + 1; 77 | } 78 | 79 | return ret; 80 | } 81 | 82 | char *strcpy(char *dst, const char *src) 83 | { 84 | char *cp = dst; 85 | while (*cp++ = *src++); 86 | return dst; 87 | } 88 | 89 | int strlen(const char *s) 90 | { 91 | const char *eos = s; 92 | while (*eos++); 93 | return (int) (eos - s - 1); 94 | } 95 | 96 | int strcmp(const char *s1, const char *s2) 97 | { 98 | int ret = 0; 99 | while (!(ret = *(unsigned char *) s1 - *(unsigned char *) s2) && *s2) ++s1, ++s2; 100 | 101 | if (ret < 0) 102 | ret = -1; 103 | else if (ret > 0) 104 | ret = 1 ; 105 | 106 | return ret; 107 | } 108 | 109 | typedef unsigned short wchar_t; 110 | wchar_t* wcscpy(wchar_t *__restrict__ dest, const wchar_t *__restrict__ src) 111 | { 112 | wchar_t* orig=dest; 113 | for (; (*dest=*src); ++src,++dest) ; 114 | return orig; 115 | } 116 | 117 | extern __stdcall void *HeapAlloc(void *heap,unsigned flags,unsigned size); 118 | extern __stdcall void HeapFree(void *heap,unsigned flags,void *p); 119 | extern __stdcall void *GetProcessHeap(); 120 | 121 | void *malloc(unsigned l) 122 | { 123 | return HeapAlloc(GetProcessHeap(),0,l); 124 | } 125 | 126 | void free(void *p) 127 | { 128 | HeapFree(GetProcessHeap(),0,p); 129 | } 130 | */ 131 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{ site.title | default: site.github.repository_name }} 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 | on GitHub 22 | 23 |

{{ site.title | default: site.github.repository_name }}

24 |

by Alexey Sudachén

25 | 26 | {% if site.show_downloads %} 27 |
28 | Download this project as a .zip file 29 | Download this project as a tar.gz file 30 |
31 | {% endif %} 32 |
33 |
34 | 35 | 36 |
37 |
38 | {{ content }} 39 |
40 |
41 | 42 | 51 | 52 | {% if site.google_analytics %} 53 | 61 | {% endif %} 62 | 63 | 64 | -------------------------------------------------------------------------------- /Molebox/src/xpm/pack_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *pack_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 75 1", 5 | " c gray18", 6 | ". c #333333", 7 | "X c #393939", 8 | "o c #42423F", 9 | "O c #444543", 10 | "+ c #4A4A45", 11 | "@ c #4E4E4B", 12 | "# c #51514B", 13 | "$ c #555555", 14 | "% c #575857", 15 | "& c #5E5E5E", 16 | "* c #62625C", 17 | "= c #6D6C5D", 18 | "- c #646464", 19 | "; c #6F6F61", 20 | ": c #6C6B6C", 21 | "> c #757474", 22 | ", c #7B7A74", 23 | "< c #777778", 24 | "1 c #7E7E7E", 25 | "2 c #807F7F", 26 | "3 c #7F807F", 27 | "4 c #8F8E6F", 28 | "5 c #8D8C71", 29 | "6 c #80807F", 30 | "7 c #8F8E7B", 31 | "8 c #7F8080", 32 | "9 c #838382", 33 | "0 c #888787", 34 | "q c #8B8B8B", 35 | "w c #939393", 36 | "e c #989798", 37 | "r c #9C9C9C", 38 | "t c #AEAD8D", 39 | "y c #B2B18A", 40 | "u c #B0AF97", 41 | "i c #B4B392", 42 | "p c #B8B69A", 43 | "a c #A2A2A2", 44 | "s c #A7A7A8", 45 | "d c #AAAAAA", 46 | "f c #B4B4B4", 47 | "g c #B7B8B7", 48 | "h c #BCBCBC", 49 | "j c #C5C39A", 50 | "k c #D1CFA2", 51 | "l c #D6D4AB", 52 | "z c #D8D5AA", 53 | "x c #DDDBB4", 54 | "c c #DEDDB8", 55 | "v c #F1EEA6", 56 | "b c #F2EFAC", 57 | "n c #F7F4AA", 58 | "m c #FFFCAF", 59 | "M c #E3E2BC", 60 | "N c #EDEBBD", 61 | "B c #F2EFB7", 62 | "V c #FFFCB1", 63 | "C c #F5F3BB", 64 | "Z c #FFFCB9", 65 | "A c #C3C4C4", 66 | "S c #CCCCCC", 67 | "D c #D0CFCF", 68 | "F c #D0D0CF", 69 | "G c #D4D4D4", 70 | "H c #DBDBDB", 71 | "J c #F2EFC1", 72 | "K c #F2F0C0", 73 | "L c #F8F5C3", 74 | "P c #FFFDC3", 75 | "I c #F2F1C8", 76 | "U c #FFFDCB", 77 | "Y c #FFFDD3", 78 | "T c #FFFEE3", 79 | "R c None", 80 | /* pixels */ 81 | "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR", 82 | "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR", 83 | "RR..XX..X....X.X.X..X....X.X..RR", 84 | "RR.AHHHHHHHHHHHHHHHHHHHHHHHHA.RR", 85 | "RR.eererereereerrrererrereeee.RR", 86 | "RR.errrrrrrararrrrrrrrrrrrare.RR", 87 | "RR.errarraararrrararaarrrarae.RR", 88 | "RR.eaaaaraaraaaahh.RR", 100 | "RR.hdXu77777745ulUUYJj;O:9shh.RR", 101 | "RR.AdX..........lUUxi;@>qshAA.RR", 102 | "RR.Af1---------XJUxi+&qfAFGGGGGS.RR", 106 | "RRXSGGGGGGGGGGAa, 3 | #include 4 | #include 5 | 6 | #define FPAT_DEL '/' /* Path delimiter */ 7 | #define FPAT_DEL2 '\\' /* Path delimiter */ 8 | #define FPAT_ANY '?' /* Any one char */ 9 | #define FPAT_CLOS '*' /* Zero or more chars */ 10 | 11 | #ifndef DELIM 12 | #define DELIM 0 13 | #endif 14 | 15 | #define DEL FPAT_DEL 16 | #define DEL2 FPAT_DEL2 17 | #define lowercase(c) tolower(c) 18 | 19 | 20 | static int fpattern_submatch(const char *pat, const char *fname) 21 | { 22 | int fch; 23 | int pch; 24 | int i; 25 | 26 | /* Attempt to match subpattern against subfilename */ 27 | while (*pat != '\0') 28 | { 29 | fch = *fname; 30 | pch = *pat; 31 | pat++; 32 | 33 | switch (pch) 34 | { 35 | case FPAT_ANY: 36 | /* Match a single char */ 37 | #if DELIM 38 | if (fch == DEL || fch == DEL2 || fch == '\0') 39 | return (FALSE); 40 | #else 41 | if (fch == '\0') 42 | return (FALSE); 43 | #endif 44 | fname++; 45 | break; 46 | 47 | case FPAT_CLOS: 48 | /* Match zero or more chars */ 49 | i = 0; 50 | #if DELIM 51 | while (fname[i] != '\0' && 52 | fname[i] != DEL && fname[i] != DEL2) 53 | i++; 54 | #else 55 | while (fname[i] != '\0') 56 | i++; 57 | #endif 58 | while (i >= 0) 59 | { 60 | if (fpattern_submatch(pat, fname+i)) 61 | return (TRUE); 62 | i--; 63 | } 64 | return (FALSE); 65 | 66 | #if DELIM 67 | case DEL: 68 | #if DEL2 != DEL 69 | case DEL2: 70 | #endif 71 | /* Match path delimiter char */ 72 | if (fch != DEL && fch != DEL2) 73 | return (FALSE); 74 | fname++; 75 | break; 76 | #endif 77 | 78 | default: 79 | /* Match a (non-null) char exactly */ 80 | if (lowercase(fch) != lowercase(pch)) 81 | return (FALSE); 82 | fname++; 83 | break; 84 | } 85 | } 86 | 87 | /* Check for complete match */ 88 | if (*fname != '\0') 89 | return (FALSE); 90 | 91 | /* Successful match */ 92 | return (TRUE); 93 | } 94 | 95 | 96 | int fpattern_match(const char *pat, const char *fname) 97 | { 98 | int rc; 99 | 100 | /* Check args */ 101 | if (fname == NULL) 102 | return (FALSE); 103 | 104 | if (pat == NULL) 105 | return (FALSE); 106 | 107 | /* Attempt to match pattern against filename */ 108 | if (fname[0] == '\0') 109 | return (pat[0] == '\0'); /* Special case */ 110 | if ( strcmp(pat,"*.*") == 0 ) pat = "*"; 111 | rc = fpattern_submatch(pat, fname); 112 | 113 | return (rc); 114 | } 115 | -------------------------------------------------------------------------------- /Molebox/src/xpm/info_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *info_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 80 1", 5 | " c #060606", 6 | ". c gray6", 7 | "X c #121212", 8 | "o c #1B1B1B", 9 | "O c #262626", 10 | "+ c #2C2C2C", 11 | "@ c #323232", 12 | "# c #3C3C3C", 13 | "$ c #464645", 14 | "% c #494945", 15 | "& c #4C4C4B", 16 | "* c #56564E", 17 | "= c #59594D", 18 | "- c #555453", 19 | "; c #5E5D54", 20 | ": c #5A5A5A", 21 | "> c #646353", 22 | ", c #696854", 23 | "< c #636359", 24 | "1 c #69695C", 25 | "2 c #6D6C6C", 26 | "3 c #747474", 27 | "4 c #7C7C7C", 28 | "5 c #8B8A67", 29 | "6 c #8D8C68", 30 | "7 c #80807F", 31 | "8 c #BAB87E", 32 | "9 c #807F80", 33 | "0 c #838383", 34 | "q c #8D8C8C", 35 | "w c #949394", 36 | "e c #9C9C9C", 37 | "r c #A09F9F", 38 | "t c #A0A09F", 39 | "y c #A09FA0", 40 | "u c #A5A4A4", 41 | "i c #A8A7A7", 42 | "p c #ACABAB", 43 | "a c #B0AFAF", 44 | "s c #B0B0AF", 45 | "d c #B0AFB0", 46 | "f c #B4B3B3", 47 | "g c #B8B7B7", 48 | "h c #B8B8B7", 49 | "j c #BBBBBB", 50 | "k c #C1BF83", 51 | "l c #C0BFBF", 52 | "z c #BFC0BF", 53 | "x c #C4C186", 54 | "c c #CDCB97", 55 | "v c #CECC98", 56 | "b c #DEDB92", 57 | "n c #D3D29C", 58 | "m c #E0DC93", 59 | "M c #F2EE95", 60 | "N c #F2EF98", 61 | "B c #C0C0BF", 62 | "V c #E7E5AB", 63 | "C c #E9E7B2", 64 | "Z c #EAE8B7", 65 | "A c #E4E2BA", 66 | "S c #E8E7BD", 67 | "D c #E9E8BC", 68 | "F c #FAF7B7", 69 | "G c #FBF9BB", 70 | "H c #BFBFC0", 71 | "J c #C0BFC0", 72 | "K c #C5C4C4", 73 | "L c #CCCCCC", 74 | "P c #D0CFCF", 75 | "I c #D0CFD0", 76 | "U c #D3D3D3", 77 | "Y c #D8D8D8", 78 | "T c #F4F3C6", 79 | "R c #F8F7C7", 80 | "E c #FBF9C4", 81 | "W c #F6F5C8", 82 | "Q c #F8F7C8", 83 | "! c #FBF9C9", 84 | "~ c None", 85 | /* pixels */ 86 | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 87 | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 88 | "~~~~~~~~~~~~@@@@@@@@~~~~~~~~~~~~", 89 | "~~~~~~~~~~@:0uKYUKp0-@~~~~~~~~~~", 90 | "~~~~~~~~@:wKKhituufBKw-@~~~~~~~~", 91 | "~~~~~~~@3ghue6,%&:qeijf3@~~~~~~~", 92 | "~~~~~~@4Kpeeq&68k6%qeral4@~~~~~~", 93 | "~~~~~@2gptee3>MMMM>3rrepj2@~~~~~", 94 | "~~~~~-udueue3,NMMM>3ueetau-~~~~~", 95 | "~~~~@9fuuyuuq%pmbx%quuuuig7@~~~~", 96 | "~~~~&pfuuuuuu0&$$&0uuuuuuap&~~~~", 97 | "~~~+2apppupppiuewiipiipiipf2+~~~", 98 | "~~~@0gppppppw#$-*$&eppppppg0@~~~", 99 | "~~~@egsssfddq;ncvn&eddffffge@~~~", 100 | "~~~@pgfffgffw;FFFV*effgfffgp@~~~", 101 | "~~~@gghghhggw>GGGV*rggghhggf@~~~", 102 | "~~~@pjjjjjjzw 27 | 28 | extern "C" void Lfree(void* pp) 29 | { 30 | HeapFree(GetProcessHeap(),0,pp); 31 | } 32 | 33 | extern "C" void* Lalloc(unsigned sz) 34 | { 35 | return HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,sz); 36 | } 37 | 38 | 39 | #define _X86_ASSEMBLER 40 | 41 | /* 42 | namespace aux { 43 | CXX_EXTERNC void *CXX_STDCALL Lalloc(u32_t sz); 44 | CXX_EXTERNC void *CXX_STDCALL LallocZ(u32_t sz); 45 | CXX_EXTERNC void CXX_STDCALL Lfree(void *p); 46 | CXX_EXTERNC void CXX_STDCALL LfreePA(void *p, u32_t cnt); 47 | } 48 | */ 49 | 50 | #define _TEGGO_ADLER_HERE 51 | #define _TEGGO_CODECOP_HERE 52 | #define _TEGGO_CRC32_HERE 53 | #define _TEGGO_SPECIFIC_HERE 54 | #define _TEGGO_FORMAT_HERE 55 | #define _TEGGO_GENIO_HERE 56 | #define _TEGGO_INSTANCE_HERE 57 | #define _TEGGO_LZPLUS_DECODER_HERE 58 | #define _TEGGO_STRING_HERE 59 | #define _TEGGO_SYSUTIL_HERE 60 | #define _TEGGO_XHASH_HERE 61 | #define _TEGGO_NEWDES_HERE 62 | #define _TEGGO_HOOKMGR_HERE 63 | #define _TEGGO_X86CODE_HERE 64 | #define _TEGGO_THREADS_HERE 65 | #define _TEGGO_DISABLE_DBGOUTPUT 66 | #define _TEGGO_THREADS_HERE 67 | #define _TEGGO_STREAMS_HERE 68 | #define _TEGGO_ZLIB_HERE 69 | #define _TEGGO_COLLECTION_HERE 70 | #define _TEGGO_XDOM_HERE 71 | #define _TEGGO_SAXPARS_HERE 72 | #define _TEGGO_LOGGER_HERE 73 | #define _TEGGO_SYMTABLE_HERE 74 | #define _TEGGO_MESSAGES_HERE 75 | #define _TEGGO_COMREGISTER_HERE 76 | #define _TEGGO_SYSUTIL_HERE 77 | #define _TEGGO_LZ77SS_HERE 78 | 79 | #include "../Classes/Sources/_specific.h" 80 | #include "../Classes/Sources/_adler32.h" 81 | #include "../Classes/Sources/_codecop.inl" 82 | #include "../Classes/Sources/_crc32.h" 83 | #include "../Classes/Sources/_specific.inl" 84 | #include "../Classes/Sources/format.h" 85 | #include "../Classes/Sources/genericio.inl" 86 | #include "../Classes/Sources/hinstance.h" 87 | #include "../Classes/Sources/string.inl" 88 | #include "../Classes/Sources/sysutil.h" 89 | #include "../Classes/Sources/x86code.h" 90 | #include "../Classes/Sources/threads.h" 91 | #include "../Classes/Sources/streams.inl" 92 | #include "../Classes/Sources/zlib.inl" 93 | #include "../Classes/Sources/collection.inl" 94 | #include "../Classes/Sources/xdom.inl" 95 | #include "../Classes/Sources/saxparser.inl" 96 | #include "../Classes/Sources/symboltable.inl" 97 | #include "../Classes/Sources/logger.inl" 98 | #include "../Classes/Sources/messages.inl" 99 | #include "../Classes/Sources/com_register.inl" 100 | #include "../Classes/Sources/sysutil.h" 101 | #include "../Classes/Sources/lz77ss.inl" 102 | -------------------------------------------------------------------------------- /Molebox/src/xpm/save_exit_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *save_exit_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 82 1", 5 | " c #0E0E0D", 6 | ". c #151615", 7 | "X c #1C1C1C", 8 | "o c #20211F", 9 | "O c #232323", 10 | "+ c #2B2B2B", 11 | "@ c #333333", 12 | "# c #393434", 13 | "$ c #3D3D3D", 14 | "% c #453434", 15 | "& c #4C3535", 16 | "* c #423F3F", 17 | "= c #523737", 18 | "- c #5E3333", 19 | "; c #583838", 20 | ": c #613535", 21 | "> c #6D3232", 22 | ", c #6F3939", 23 | "< c #733434", 24 | "1 c #783737", 25 | "2 c #783838", 26 | "3 c #444343", 27 | "4 c #4C4C4C", 28 | "5 c #534949", 29 | "6 c #5B4C4C", 30 | "7 c #535353", 31 | "8 c #5A5A5A", 32 | "9 c #644A4A", 33 | "0 c #646463", 34 | "q c #69696A", 35 | "w c #776161", 36 | "e c #7B6565", 37 | "r c #7E6969", 38 | "t c #737373", 39 | "y c #7B7B7B", 40 | "u c #CB3F3F", 41 | "i c #FF2E2E", 42 | "p c #E93D3D", 43 | "a c #FF3333", 44 | "s c #FF3C3C", 45 | "d c #864E4E", 46 | "f c #884F4F", 47 | "g c #855454", 48 | "h c #8D5454", 49 | "j c #8D5A5A", 50 | "k c #985C5C", 51 | "l c #956464", 52 | "z c #9D6161", 53 | "x c #9F6868", 54 | "c c #D94343", 55 | "v c #E94848", 56 | "b c #FF4444", 57 | "n c #FE4C4C", 58 | "m c #FF5656", 59 | "M c #FF5A5A", 60 | "N c #FF6B6B", 61 | "B c #FF7777", 62 | "V c #FF7B7B", 63 | "C c #848484", 64 | "Z c #888787", 65 | "A c #8B8B8B", 66 | "S c #939393", 67 | "D c #9C9C9C", 68 | "F c #A4A4A4", 69 | "G c #ABABAB", 70 | "H c #B4B4B4", 71 | "J c #B7B8B7", 72 | "K c #BCBCBC", 73 | "L c #FF8F8F", 74 | "P c #FF9292", 75 | "I c #FF9B9B", 76 | "U c #F6A3A3", 77 | "Y c #FDA4A4", 78 | "T c #FFAAAA", 79 | "R c #C6C6C6", 80 | "E c #C7C7C8", 81 | "W c #CBCBCB", 82 | "Q c #CFD0D0", 83 | "! c #D4D4D4", 84 | "~ c #DBDBDB", 85 | "^ c #E5E5E5", 86 | "/ c None", 87 | /* pixels */ 88 | "////////////////////////////////", 89 | "////////////////////////////////", 90 | "/////////////@@#@@@/////////////", 91 | "//////////#4qZDGGDC03@//////////", 92 | "////////@4SJERRRREREHZ3@////////", 93 | "///////#ZREERRRRRRRREEKt@///////", 94 | "//////3FEEDGRRRRRRREHGEES#//////", 95 | "/////$FWEA$$HRERREEH$$FEWA@/////", 96 | "////@CWEZ5Yx$HWWWWH$lU3SWWq/////", 97 | "////7WEy6YYYz$HWWH$kYYI*ZWJ$////", 98 | "///@SQF*TIIIIk$KJ$jYIIIU@FQy////", 99 | "///4KWH3eYIPIPh$$gPIPIYr4JQG@///", 100 | "///0!WHC$wPPLPLgdPPLPPe$CHQW4///", 101 | "//+y!QKSt$9NBVVVVVVBN9$tSK!!0///", 102 | "//+S!!WHSt$&bnmMMmnb=*tSJW!!tO//", 103 | "//+D~!!QHSt$&iiaaii&$tSJQ~!~yO//", 104 | "//+S!~~!QJA#>aaaaaa<#AJQ~~~~tO//", 105 | "//+C~!~~~K$-aaaaaaaa<$K~~~~~0o//", 106 | "//+q~~~~R$:ssssasssss<$R~~~Q7///", 107 | "///4Q~~K$-bssss%%pssss1$K~~K#///", 108 | "///+F^~*:bbbbb#$$@ubbbb2$!^C+///", 109 | "///O8~!y&bbbn%*tt$@cbbb,8W!3X///", 110 | "////+DWF8=nn%*ySAy*#vn&4DWy+////", 111 | "////o3JHC4;&$yDKKDy$##4CFD@X////", 112 | "/////O8HGC4$yDR~~RDy$7CFD$O/////", 113 | "//////O$DFCyDE~^^~RDCZFC#O//////", 114 | "///////O@8AFR~^^^^^RFC4+o///////", 115 | "////////X+#8CHW^~WGt4@+.////////", 116 | "//////////X+@@@@#@@@+.//////////", 117 | "//////////// .XOOX. ////////////", 118 | "////////////////////////////////", 119 | "////////////////////////////////" 120 | }; 121 | -------------------------------------------------------------------------------- /Molebox/src/xpm/appicon_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char *appicon_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 110 2", 5 | " c #0E1419", 6 | ". c #0F1C29", 7 | "X c #192530", 8 | "o c #16293D", 9 | "O c #1E2D3B", 10 | "+ c #1F2D3B", 11 | "@ c #182B3E", 12 | "# c #21303F", 13 | "$ c #182E44", 14 | "% c #192F46", 15 | "& c #1D3145", 16 | "* c #1C344C", 17 | "= c #1D3954", 18 | "- c #1F3D5A", 19 | "; c #1F3D5B", 20 | ": c #223343", 21 | "> c #243445", 22 | ", c #253646", 23 | "< c #243C55", 24 | "1 c #243D55", 25 | "2 c #213D58", 26 | "3 c #213F5E", 27 | "4 c #2C4155", 28 | "5 c #24405B", 29 | "6 c #21405F", 30 | "7 c #2E4459", 31 | "8 c #2F465C", 32 | "9 c #30465D", 33 | "0 c #31485F", 34 | "q c #224364", 35 | "w c #244566", 36 | "e c #24486B", 37 | "r c #254A6F", 38 | "t c #294A6A", 39 | "y c #294A6B", 40 | "u c #284B6F", 41 | "i c #314C67", 42 | "p c #324E69", 43 | "a c #304E6D", 44 | "s c #304F6E", 45 | "d c #365069", 46 | "f c #31506F", 47 | "g c #274D73", 48 | "h c #294E74", 49 | "j c #2A5077", 50 | "k c #2A5178", 51 | "l c #305172", 52 | "z c #355370", 53 | "x c #355371", 54 | "c c #3C5A77", 55 | "v c #3D5A77", 56 | "b c #3D5A78", 57 | "n c #3D5B79", 58 | "m c #3B5C7C", 59 | "M c #3E5E7D", 60 | "N c #3F5E7D", 61 | "B c #405F7E", 62 | "V c #2B5681", 63 | "C c #2C5783", 64 | "Z c #2C5884", 65 | "A c #2D5A86", 66 | "S c #2D5B88", 67 | "D c #2E5C8A", 68 | "F c #306091", 69 | "G c #306192", 70 | "H c #316293", 71 | "J c #326598", 72 | "K c #336598", 73 | "L c #33669A", 74 | "P c #33679B", 75 | "I c #34679B", 76 | "U c #34689C", 77 | "Y c #34689D", 78 | "T c #416080", 79 | "R c #416181", 80 | "E c #416182", 81 | "W c #45688B", 82 | "Q c #496D90", 83 | "! c #4A6F95", 84 | "~ c #4A7095", 85 | "^ c #4B7095", 86 | "/ c #4C7197", 87 | "( c #4B7298", 88 | ") c #4F769C", 89 | "_ c #4F769D", 90 | "` c #517AA2", 91 | "' c #547EA8", 92 | "] c #5680AB", 93 | "[ c #5783AE", 94 | "{ c #5884B0", 95 | "} c #5985B1", 96 | "| c #5985B2", 97 | " . c #5986B2", 98 | ".. c #5A86B3", 99 | "X. c #5A87B3", 100 | "o. c #5A87B4", 101 | "O. c #5C8AB7", 102 | "+. c #5D8BB9", 103 | "@. c #5D8CBA", 104 | "#. c #6191C2", 105 | "$. c #6293C4", 106 | "%. c #6394C5", 107 | "&. c #6699CC", 108 | "*. c #6699CD", 109 | "=. c #679ACE", 110 | "-. c #689CD1", 111 | ";. c #689DD1", 112 | ":. c #699DD1", 113 | ">. c #699DD2", 114 | ",. c None", 115 | /* pixels */ 116 | ",.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.", 117 | ",.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.", 118 | ",.,.,.,.,.,.,.,.X ,.,.,.,.,.,.,.", 119 | ",.,.,.,.,.,.> ` O./ 7 ,.,.,.,.,.", 120 | ",.,.,.# n [ ) B Q %.$./ 9 ,.,.,.", 121 | ",.,.@ p { &.X.f 2 s ( @.W < ,.,.", 122 | ",.,.r A t x 5 A Y S * & j S % ,.", 123 | ",.% H I J C q 3 - 6 g H J Y g ,.", 124 | ",.o e H I I I 3 . D U I I V = ,.", 125 | ",.,.: l h H H < O k J A t i ,.", 126 | ",.,.n %.Q l w m v s u m o.{ ,.,.", 127 | ",.,.d &.>.@.R ' R _ ! &.>.] ,.,.", 128 | ",.,.,.n { &.>.O.B >.>.#./ 4 ,.,.", 129 | ",.,.,.,.O v { { R #.! 7 ,.,.,.,.", 130 | ",.,.,.,.,.,.,.0 > 0 ,.,.,.,.,.,.", 131 | ",.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,." 132 | }; 133 | -------------------------------------------------------------------------------- /MxbPack/src/classes.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #define _FREE Lfree 10 | #define _MALLOC Lalloc 11 | #define _TEGGONEW 1 12 | 13 | #define _TEGGOSTATIC 14 | #define _TEGGOSTRIP__EXPR__ 15 | #define _TEGGOSTRIP__FILE__ 16 | 17 | #if defined _WIN32 && !defined _WINDOWS_ 18 | # if !defined _X86_ 19 | # define _X86_ 1 20 | # endif 21 | # if !defined WINVER 22 | # define WINVER 0x400 23 | # endif 24 | #endif 25 | 26 | #include 27 | 28 | extern "C" void Lfree(void* pp) 29 | { 30 | HeapFree(GetProcessHeap(),0,pp); 31 | } 32 | 33 | extern "C" void* Lalloc(unsigned sz) 34 | { 35 | return HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,sz); 36 | } 37 | 38 | 39 | #define _X86_ASSEMBLER 40 | 41 | /* 42 | namespace aux { 43 | CXX_EXTERNC void *CXX_STDCALL Lalloc(u32_t sz); 44 | CXX_EXTERNC void *CXX_STDCALL LallocZ(u32_t sz); 45 | CXX_EXTERNC void CXX_STDCALL Lfree(void *p); 46 | CXX_EXTERNC void CXX_STDCALL LfreePA(void *p, u32_t cnt); 47 | } 48 | */ 49 | 50 | #define _TEGGO_ADLER_HERE 51 | #define _TEGGO_CODECOP_HERE 52 | #define _TEGGO_CRC32_HERE 53 | #define _TEGGO_SPECIFIC_HERE 54 | #define _TEGGO_FORMAT_HERE 55 | #define _TEGGO_GENIO_HERE 56 | #define _TEGGO_INSTANCE_HERE 57 | #define _TEGGO_LZPLUS_DECODER_HERE 58 | #define _TEGGO_STRING_HERE 59 | #define _TEGGO_SYSUTIL_HERE 60 | #define _TEGGO_XHASH_HERE 61 | #define _TEGGO_NEWDES_HERE 62 | #define _TEGGO_HOOKMGR_HERE 63 | #define _TEGGO_X86CODE_HERE 64 | #define _TEGGO_THREADS_HERE 65 | #define _TEGGO_DISABLE_DBGOUTPUT 66 | #define _TEGGO_THREADS_HERE 67 | #define _TEGGO_STREAMS_HERE 68 | #define _TEGGO_ZLIB_HERE 69 | #define _TEGGO_COLLECTION_HERE 70 | #define _TEGGO_XDOM_HERE 71 | #define _TEGGO_SAXPARS_HERE 72 | #define _TEGGO_LOGGER_HERE 73 | #define _TEGGO_SYMTABLE_HERE 74 | #define _TEGGO_MESSAGES_HERE 75 | #define _TEGGO_COMREGISTER_HERE 76 | #define _TEGGO_SYSUTIL_HERE 77 | #define _TEGGO_LZ77SS_HERE 78 | 79 | #include "../Classes/Sources/_specific.h" 80 | #include "../Classes/Sources/_adler32.h" 81 | #include "../Classes/Sources/_codecop.inl" 82 | #include "../Classes/Sources/_crc32.h" 83 | #include "../Classes/Sources/_specific.inl" 84 | #include "../Classes/Sources/format.h" 85 | #include "../Classes/Sources/genericio.inl" 86 | #include "../Classes/Sources/hinstance.h" 87 | #include "../Classes/Sources/string.inl" 88 | #include "../Classes/Sources/sysutil.h" 89 | #include "../Classes/Sources/newdes.inl" 90 | #include "../Classes/Sources/x86code.h" 91 | #include "../Classes/Sources/threads.h" 92 | #include "../Classes/Sources/streams.inl" 93 | #include "../Classes/Sources/zlib.inl" 94 | #include "../Classes/Sources/collection.inl" 95 | #include "../Classes/Sources/xdom.inl" 96 | #include "../Classes/Sources/saxparser.inl" 97 | #include "../Classes/Sources/symboltable.inl" 98 | #include "../Classes/Sources/logger.inl" 99 | #include "../Classes/Sources/messages.inl" 100 | #include "../Classes/Sources/com_register.inl" 101 | #include "../Classes/Sources/sysutil.h" 102 | #include "../Classes/Sources/lz77ss.inl" 103 | -------------------------------------------------------------------------------- /Core/src/fpattern_w.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define FPAT_DEL '/' /* Path delimiter */ 6 | #define FPAT_DEL2 '\\' /* Path delimiter */ 7 | #define FPAT_ANY '?' /* Any one char */ 8 | #define FPAT_CLOS '*' /* Zero or more chars */ 9 | #define FPAT_ANY2 '>' /* Any one char */ 10 | #define FPAT_CLOS2 '<' /* Zero or more chars */ 11 | 12 | #ifndef DELIM 13 | #define DELIM 0 14 | #endif 15 | 16 | #define DEL FPAT_DEL 17 | #define DEL2 FPAT_DEL2 18 | #define lowercase(c) tolower(c) 19 | 20 | 21 | static int w_fpattern_submatch(const wchar_t *pat, const wchar_t *fname) 22 | { 23 | int fch; 24 | int pch; 25 | int i; 26 | 27 | /* Attempt to match subpattern against subfilename */ 28 | while (*pat != '\0') 29 | { 30 | fch = *fname; 31 | pch = *pat; 32 | pat++; 33 | 34 | switch (pch) 35 | { 36 | case FPAT_ANY: 37 | case FPAT_ANY2: 38 | /* Match a single char */ 39 | #if DELIM 40 | if (fch == DEL || fch == DEL2 || fch == '\0') 41 | return (FALSE); 42 | #else 43 | if (fch == '\0') 44 | return (FALSE); 45 | #endif 46 | fname++; 47 | break; 48 | 49 | case FPAT_CLOS: 50 | case FPAT_CLOS2: 51 | /* Match zero or more chars */ 52 | i = 0; 53 | #if DELIM 54 | while (fname[i] != '\0' && 55 | fname[i] != DEL && fname[i] != DEL2) 56 | i++; 57 | #else 58 | while (fname[i] != '\0') 59 | i++; 60 | #endif 61 | while (i >= 0) 62 | { 63 | if (w_fpattern_submatch(pat, fname+i)) 64 | return (TRUE); 65 | i--; 66 | } 67 | return (FALSE); 68 | 69 | #if DELIM 70 | case DEL: 71 | #if DEL2 != DEL 72 | case DEL2: 73 | #endif 74 | /* Match path delimiter char */ 75 | if (fch != DEL && fch != DEL2) 76 | return (FALSE); 77 | fname++; 78 | break; 79 | #endif 80 | 81 | default: 82 | /* Match a (non-null) char exactly */ 83 | if (lowercase(fch) != lowercase(pch)) 84 | return (FALSE); 85 | fname++; 86 | break; 87 | } 88 | } 89 | 90 | /* Check for complete match */ 91 | if (*fname != '\0') 92 | return (FALSE); 93 | 94 | /* Successful match */ 95 | return (TRUE); 96 | } 97 | 98 | 99 | int w_fpattern_match(const wchar_t *pat, const wchar_t *fname) 100 | { 101 | int rc; 102 | 103 | /* Check args */ 104 | if (fname == NULL) 105 | return (FALSE); 106 | 107 | if (pat == NULL) 108 | return (FALSE); 109 | 110 | /* Attempt to match pattern against filename */ 111 | if (fname[0] == '\0') 112 | return (pat[0] == '\0'); /* Special case */ 113 | if ( wcscmp(pat,L"*.*") == 0 ) pat = L"*"; 114 | rc = w_fpattern_submatch(pat, fname); 115 | 116 | return (rc); 117 | } 118 | -------------------------------------------------------------------------------- /Core/classes/sources/_codecop.inl: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2005-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #if !defined ___41F3F0C3_8C9B_4A61_8846_83C5692309C0___ 10 | #define ___41F3F0C3_8C9B_4A61_8846_83C5692309C0___ 11 | 12 | #include "_specific.h" 13 | 14 | #if defined _TEGGO_CODECOP_HERE 15 | # define _TEGGO_CODECOP_FAKE_INLINE _TEGGO_EXPORTABLE 16 | #else 17 | # define _TEGGO_CODECOP_FAKE_INLINE CXX_FAKE_INLINE 18 | #endif 19 | 20 | //extern "C" void __stdcall DebugBreak(void); 21 | 22 | #if defined _DEBUG 23 | //extern "C" int __stdcall IsDebuggerPresent(void); 24 | _TEGGO_CODECOP_FAKE_INLINE 25 | void CXX_STDCALL _Teggo_Debug_Code_Here_() 26 | { 27 | if ( IsDebuggerPresent() ) 28 | DebugBreak(); 29 | } 30 | #endif 31 | 32 | namespace teggo 33 | { 34 | 35 | _TEGGO_CODECOP_FAKE_INLINE 36 | void CXX_STDCALL CodePolice__::Message(pwide_t msg,pwide_t prefix, int lineno, pchar_t fname) 37 | { 38 | __asm int 3; 39 | # if SYSTEM_IS_WINDOWS 40 | HANDLE errh = GetStdHandle(STD_ERROR_HANDLE); 41 | if ( errh && errh != INVALID_HANDLE_VALUE ) 42 | # endif 43 | fprintf(stderr,"%ls: %ls, at '%s':%d \n",prefix,msg,fname,lineno); 44 | # if SYSTEM_IS_WINDOWS 45 | else 46 | { 47 | int (__stdcall *MessageBoxW_fn)(HWND,pwide_t,pwide_t,int); 48 | HMODULE usr32dll = LoadLibraryA("user32.dll"); 49 | *((FARPROC*)&MessageBoxW_fn) 50 | = GetProcAddress(usr32dll,"MessageBoxW"); 51 | MessageBoxW_fn(0,msg,prefix,0); 52 | FreeLibrary(usr32dll); 53 | } 54 | # endif 55 | } 56 | 57 | _TEGGO_CODECOP_FAKE_INLINE 58 | void CXX_STDCALL CodePolice__::Terminator(pwide_t msg, int lineno, pchar_t fname) 59 | { 60 | char mem[96] = {0}; 61 | Message(msg,L"CodPolice::Termination",lineno,fname); 62 | _Teggo_Debug_Code_Here_(); 63 | abort(); 64 | } 65 | 66 | _TEGGO_CODECOP_FAKE_INLINE 67 | void CXX_STDCALL CodePolice__::Notifier(pwide_t msg, int lineno, pchar_t fname) 68 | { 69 | static pwide_t prefix = L"CodPolice::Notification"; 70 | Message(msg,L"CodPolice::Notification",lineno,fname); 71 | } 72 | 73 | 74 | template <> _TEGGO_CODECOP_FAKE_INLINE 75 | void CodePolice_<0>::Analyse( ILLEGAL_SITUATION sit, pwide_t descr, int lineno, pchar_t fname ) 76 | { 77 | if ( sit == SIT_VIOLATION || sit == SIT_ASSERTION || sit == SIT_EMERGENCY ) 78 | { 79 | if ( terminate_ ) 80 | (*terminate_)(descr,lineno,fname); 81 | } 82 | else if ( sit == SIT_WARNING ) 83 | { 84 | if ( notify_ ) 85 | (*notify_)(descr,lineno,fname); 86 | } 87 | } 88 | 89 | #if defined _TEGGO_CODECOP_HERE 90 | //template <> 91 | _TEGGO_EXPORTABLE_DATA 92 | CodePolice_<0> CodePolice_Office<0>::police_ 93 | = 94 | { 95 | &CodePolice__::Notifier, 96 | &CodePolice__::Terminator 97 | }; 98 | #endif 99 | 100 | } // namespace teggo 101 | 102 | #undef _TEGGO_CODECOP_FAKE_INLINE 103 | 104 | #endif // ___41F3F0C3_8C9B_4A61_8846_83C5692309C0___ 105 | -------------------------------------------------------------------------------- /Core/Xi/ntdll.Xi: -------------------------------------------------------------------------------- 1 | -NtContinue,VOID,CONTEXT*,BOOLEAN 2 | -NtQuerySection,ULONG,HANDLE,ULONG,PVOID,ULONG,PULONG 3 | #RtlNtStatusToDosErrorNoTeb,ULONG,ULONG 4 | -RtlNtStatusToDosError,ULONG,ULONG 5 | #RtlGetLastNtStatus,ULONG 6 | #RtlGetLastWin32Error,ULONG 7 | -RtlDosPathNameToNtPathName_U,INT,PCWSTR,UNICODE_STRING *,PWSTR *,INT 8 | -RtlFreeUnicodeString,VOID,UNICODE_STRING * 9 | -NtCreateSection,LONG,HANDLE *,ULONG,OBJECT_ATTRIBUTES *,LARGE_INTEGER *,ULONG,ULONG,HANDLE 10 | -NtMapViewOfSection,LONG,HANDLE,HANDLE,VOID **,ULONG,ULONG,LARGE_INTEGER *,ULONG *,ULONG,ULONG,ULONG 11 | -NtAllocateVirtualMemory,LONG,HANDLE,VOID **,ULONG,ULONG *,ULONG,ULONG 12 | -NtClose,LONG,HANDLE 13 | -NtOpenKey,LONG,HANDLE*,ULONG,OBJECT_ATTRIBUTES * 14 | -NtCreateKey,LONG,HANDLE*,ULONG,OBJECT_ATTRIBUTES *,ULONG,UNICODE_STRING*,ULONG,ULONG* 15 | -NtQueryKey,LONG,HANDLE,KEY_INFORMATION_CLASS,void *,ULONG,ULONG * 16 | -NtQueryObject,LONG,HANDLE,ULONG,VOID *,ULONG,ULONG * 17 | -NtEnumerateKey,LONG,HANDLE,ULONG,KEY_INFORMATION_CLASS,VOID *,ULONG,ULONG * 18 | -NtEnumerateValueKey,LONG,HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,VOID *,ULONG,ULONG * 19 | -NtSetInformationProcess,LONG,HANDLE,ULONG,VOID*,ULONG 20 | -NtQueryInformationProcess,LONG,HANDLE,ULONG,VOID*,ULONG,ULONG* 21 | -RtlAcquirePebLock,VOID 22 | -RtlReleasePebLock,VOID 23 | #NtCurrentTeb,PXTEB 24 | #NtOpenDirectoryObject,LONG,HANDLE*,ACCESS_MASK,OBJECT_ATTRIBUTES* 25 | #NtCreateProcess,LONG,HANDLE*,ACCESS_MASK,OBJECT_ATTRIBUTES*,HANDLE,BOOLEAN,HANDLE,HANDLE,HANDLE 26 | #RtlInitializeContext,LONG,HANDLE,PVOID,PVOID,PVOID,PVOID 27 | -NtProtectVirtualMemory,LONG,HANDLE,VOID**,ULONG*,ULONG,ULONG* 28 | #RtlCreateProcessParameters,LONG,PRTL_USER_PROCESS_PARAMETERS*,PUNICODE_STRING,PUNICODE_STRING,PUNICODE_STRING,PUNICODE_STRING,PVOID,PUNICODE_STRING,PUNICODE_STRING,PUNICODE_STRING,PUNICODE_STRING 29 | -NtWriteVirtualMemory,LONG,HANDLE,PVOID,PVOID,ULONG,ULONG* 30 | -NtReadVirtualMemory,LONG,HANDLE,PVOID,PVOID,ULONG,ULONG* 31 | #RtlDestroyProcessParameters,LONG,PRTL_USER_PROCESS_PARAMETERS 32 | #NtCreateThread,LONG,HANDLE*,ACCESS_MASK,VOID*,VOID*,VOID*,VOID*,VOID*,BOOLEAN 33 | -CsrClientCallServer,LONG,VOID*,VOID*,ULONG,ULONG 34 | -NtResumeThread,LONG,HANDLE,PULONG 35 | -RtlInitUnicodeString,VOID,PUNICODE_STRING,PCWSTR 36 | -RtlQueryEnvironmentVariable_U,LONG,PVOID,PUNICODE_STRING,PUNICODE_STRING 37 | #DbgUiConnectToDbg,LONG 38 | #NtCreateProcessEx,LONG,HANDLE*,ACCESS_MASK,OBJECT_ATTRIBUTES*,HANDLE,BOOLEAN,HANDLE,HANDLE,HANDLE,HANDLE 39 | -NtQueryFullAttributesFile,LONG,OBJECT_ATTRIBUTES*,VOID* 40 | -NtCreateFile,LONG,HANDLE*,ACCESS_MASK,OBJECT_ATTRIBUTES*,IO_STATUS_BLOCK*,LARGE_INTEGER*,ULONG,ULONG,ULONG,ULONG,VOID*,ULONG 41 | -NtOpenFile,LONG,HANDLE*,ACCESS_MASK,OBJECT_ATTRIBUTES*,IO_STATUS_BLOCK*,ULONG,ULONG 42 | -NtQueryVirtualMemory,LONG,HANDLE,VOID*,DWORD,VOID*,DWORD,VOID* 43 | -NtReadFile,LONG,HANDLE,HANDLE,PIO_APC_ROUTINE,VOID*,IO_STATUS_BLOCK*,VOID*,ULONG,LARGE_INTEGER*,ULONG* 44 | -NtDuplicateObject,LONG,HANDLE,HANDLE,HANDLE,HANDLE*,ACCESS_MASK,BOOLEAN,ULONG 45 | -NtUnmapViewOfSection,LONG,HANDLE,VOID* 46 | -NtQueryDirectoryFile,LONG,HANDLE,HANDLE,PIO_APC_ROUTINE,VOID*,IO_STATUS_BLOCK*,VOID*,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,UNICODE_STRING*,BOOLEAN 47 | -NtQueryInformationFile,LONG,HANDLE,IO_STATUS_BLOCK*,VOID*,ULONG,FILE_INFORMATION_CLASS 48 | -NtQueryAttributesFile,LONG,POBJECT_ATTRIBUTES,PFILE_BASIC_INFORMATION 49 | -------------------------------------------------------------------------------- /Molebox/src/myafx.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | 9 | #include 10 | #include 11 | 12 | //extern pwide_t Translate(int i,pwide_t text); 13 | //#define Tr(i,t) Translate(i,L##t) 14 | extern pwide_t MessageValue(int i); 15 | #define Tr(i,t) MessageValue(i) 16 | 17 | struct MessageBoxEhFiler : teggo::ErrorFilter 18 | { 19 | virtual bool Ascii(const char* message, int e) const 20 | { 21 | MessageBoxA(0,message,e?"error":"warning",0); 22 | return !e; 23 | } 24 | }; 25 | 26 | extern int _MAJOR_VERSION; 27 | extern int _MINOR_VERSION; 28 | extern int _BUILD_NUMBER; 29 | extern "C" time_t _BUILD_TIME; 30 | 31 | enum 32 | { 33 | tmID_DEFAULT = 1000, 34 | myID_PKGCONFIGURE = wxID_HIGHEST, 35 | myID_PKGDOPACK, 36 | myID_NEWSUBFOLDER, 37 | myID_ADDFOLDER, 38 | myID_DELFOLDER, 39 | myID_ADDFILES, 40 | myID_DELFILES, 41 | myID_EDIT, 42 | myID_SAVEnEXIT, 43 | myID_SPLITTER1, 44 | myID_SPLITTER2, 45 | myID_SPLITTER3, 46 | myID_SPLITTER4, 47 | ctID_FOLDERSTREE, 48 | myID_ACTIVATE, 49 | ctID_INPUTTEXT1, 50 | ctID_INPUTTEXT2, 51 | ctID_INPUTTEXT3, 52 | ctID_INPUTTEXT4, 53 | ctID_INPUTTEXT5, 54 | ctID_INPUTTEXT6, 55 | ctID_INPUTTEXT7, 56 | ctID_INPUTTEXT8, 57 | ctID_INPUTTEXT9, 58 | ctID_ACTIVATOR, 59 | ctID_ACTIVATE, 60 | ctID_WEBACTIVATE, 61 | ctID_ORDER, 62 | ctID_BROWSE_TARGET, 63 | ctID_BROWSE_SOURCE, 64 | ctID_BROWSE_ACT, 65 | ctID_CONTENT_ENCRYPT, 66 | ctID_CONTENT_ZIP, 67 | ctID_RELINK, 68 | ctID_ACT, 69 | ctID_ANTICRACK, 70 | ctID_LOGGING, 71 | ctID_EXE_USEREG, 72 | ctID_CONTENT_BUILDREG, 73 | ctID_HASCODE, 74 | ctID_GOTEST, 75 | ctID_BREAK, 76 | ctID_EXE_AUTOBUNDLE, 77 | myID_FOLDRENAME, 78 | myID_FILERENAME, 79 | ctID_ENV, 80 | ctID_ENVIRONMENT, 81 | ctID_BROWSE_ENV, 82 | ctID_REG, 83 | ctID_STATICREG, 84 | ctID_BROWSE_REG, 85 | ctID_CMDL, 86 | ctID_COMMANDLINE, 87 | ctID_ANY, 88 | ctID_ACQUIRE_TOKEN, 89 | ctID_HELP, 90 | ctID_CONFLICT, 91 | ctID_EXTEND, 92 | }; 93 | 94 | void ShowAboutInfo(wxWindow* parent); 95 | void ShowExpiredInfo(wxWindow* parent); 96 | void ShowActivateDialog(wxWindow* parent); 97 | bool ShowConfigDialog(wxWindow* parent); 98 | bool DoPackingProcess(wxWindow* parent); 99 | void DisplayError(wxWindow* parent,StringParam message,StringParam title); 100 | void DisplayMessage(wxWindow* parent,StringParam message,StringParam title); 101 | bool AreYouSure(wxWindow* parent,StringParam message,StringParam title); 102 | bool QueryNewSubfolder(wxWindow* parent, StringW& subfolder); 103 | bool QueryAddFiles(wxWindow* parent, ArrayT const& names, StringW& folder); 104 | bool RenameMove(wxWindow* parent, StringW& targ_subfolder, StringW& inout_name, bool operate_folder, bool enable_rename); 105 | 106 | void DirList(StringParam rfold, StringParam patt, ArrayT& names, u32_t flgs); 107 | enum 108 | { 109 | DIRLIST_FILESONLY = 1, 110 | DIRLIST_DIRESONLY = 2, 111 | DIRLIST_RECURSIVE = 4, 112 | DIRLIST_FULLPATH = 8, 113 | }; 114 | 115 | extern void ShowHelpSection(StringParam name); 116 | 117 | -------------------------------------------------------------------------------- /Core/src/Makefile.mak: -------------------------------------------------------------------------------- 1 | PROJECT=Core 2 | BASEDIR=.. 3 | SRCDIR=. 4 | !include $(BASEDIR)\Makefile.rules 5 | 6 | TARGETS=$(LIBDIR)\Core$(DBGSFX).lib $(BINDIR)\cor1$(DLLSFX).dll 7 | _all: $(OBJDIR) $(LIBDIR) $(BINDIR) $(TMPDIR) $(TARGETS) 8 | 9 | OBJECTS= \ 10 | $(OBJDIR)\xorS.obj \ 11 | $(OBJDIR)\xorC.obj \ 12 | $(OBJDIR)\apif_register.obj \ 13 | $(OBJDIR)\apif_sectionobjects.obj \ 14 | $(OBJDIR)\apif_fileobjects.obj \ 15 | $(OBJDIR)\apif_actctx.obj \ 16 | $(OBJDIR)\apif_crproc.obj \ 17 | $(OBJDIR)\apif_cmdline.obj \ 18 | $(OBJDIR)\apif.obj \ 19 | $(OBJDIR)\vfs.obj \ 20 | $(OBJDIR)\svfs.obj \ 21 | $(OBJDIR)\regimport.obj \ 22 | $(OBJDIR)\fpattern_a.obj \ 23 | $(OBJDIR)\fpattern_w.obj \ 24 | $(OBJDIR)\import.obj \ 25 | $(OBJDIR)\logger.obj \ 26 | $(OBJDIR)\myaux.obj \ 27 | $(OBJDIR)\splicer.obj \ 28 | $(OBJDIR)\classes.obj \ 29 | $(OBJDIR)\version.obj \ 30 | $(OBJDIR)\public_api.obj \ 31 | $(OBJDIR)\argv.obj \ 32 | $(OBJDIR)\splash_pp.obj \ 33 | $(OBJDIR)\rsa.obj \ 34 | $(OBJDIR)\rsa_accel.obj \ 35 | $(OBJDIR)\selfload.obj \ 36 | $(OBJDIR)\auxS.obj \ 37 | $(OBJDIR)\apifS.obj \ 38 | $(OBJDIR)\splash.obj \ 39 | 40 | $(OBJDIR)\xorS.obj : $(SRCDIR)\xorS.S 41 | @echo $(*F).S 42 | @$(AS) $(_M64) -o$@ $(SRCDIR)\xorS.S 43 | $(SRCDIR)\xorS.S: 44 | ..\XorS.py $(SRCDIR)\xorS.S 45 | 46 | $(OBJDIR)\xorC.obj : $(SRCDIR)\xorC.S 47 | @echo $(*F).S 48 | @$(AS) $(_M64) -o$@ $(SRCDIR)\xorC.S 49 | $(SRCDIR)\xorC.S: 50 | ..\XorC.py $(SRCDIR)\xorC.S 51 | 52 | {$(BASEDIR)\classes\sources\Z}.c{$(OBJDIR)}.obj: 53 | @cl $(CFLAGS) $(INCL) -c -Fo$@ $< 54 | 55 | {$(BASEDIR)\classes\RSA512.SRC}.cpp{$(OBJDIR)}.obj: 56 | @cl $(CCFLAGS) $(INCL) -c -Fo$@ $< 57 | 58 | {$(BASEDIR)\classes\RSA512.SRC}.S{$(OBJDIR)}.obj: 59 | @echo $(*F) 60 | @$(AS) $(_M64) -o$@ $< 61 | 62 | {$(BASEDIR)\..}.c{$(OBJDIR)}.obj: 63 | @cl $(CFLAGS) $(INCL) -c -Fo$@ $< 64 | 65 | $(LIBDIR)\Core$(DBGSFX).lib: $(OBJECTS) 66 | @echo -- collect -- $@ 67 | @link /lib -nologo -machine:$(CPU) -out:$@ $** 68 | 69 | $(OBJDIR)\DLL.res: $(BASEDIR)\DLL.rc 70 | @echo DLL.rc 71 | @rc /fo $@ $** 72 | 73 | MERGE = \ 74 | -align:0x4000 \ 75 | -section:.text,RWE \ 76 | -merge:.iX=.text \ 77 | -merge:.A0=.text \ 78 | -merge:.A1=.text \ 79 | -merge:.A2=.text \ 80 | -merge:.A3=.text \ 81 | -merge:.A4=.text \ 82 | -merge:.A5=.text \ 83 | -merge:.A6=.text \ 84 | -merge:.A7=.text \ 85 | -merge:.A8=.text \ 86 | -merge:.A9=.text \ 87 | -merge:.data=.text \ 88 | -merge:.bss=.text \ 89 | -merge:.k=.text \ 90 | -merge:.xdata=.text \ 91 | -merge:.xbss=.text \ 92 | -merge:.z=.text \ 93 | -merge:.XORS=.text \ 94 | -merge:.rdata=.text \ 95 | -merge:.edata=.expo \ 96 | 97 | $(BINDIR)\cor1$(DLLSFX).dll: $(LIBDIR)\Core$(DBGSFX).lib $(OBJDIR)\DLL.res $(LIBDIR)\Xi.lib 98 | @echo -- collect -- $@ 99 | @link /dll /pdb:$(BINDIR)\cor1$(DLLSFX).pdb /map:$(BINDIR)\cor1$(DLLSFX).map.txt /debug /nologo /machine:$(CPU) /out:$@ \ 100 | $** libhash$(LIBSFX).lib zlib$(LIBSFX).lib libpict$(LIBSFX).lib \ 101 | /def:$(BASEDIR)\DLL.def /incremental:no /noentry /opt:icf /opt:ref $(MERGE) 102 | 103 | clean: 104 | -del /q /f /s $(OBJECTS) 105 | -del /q /f /s $(TARGETS) 106 | -del /q /f /s $(OBJDIR)\XorS.S 107 | -del /q /f /s $(OBJDIR)\XorC.S 108 | -------------------------------------------------------------------------------- /Core/classes/sources/substream.h: -------------------------------------------------------------------------------- 1 | struct DataSubstream : RefcountedT 2 | { 3 | typedef DataStream::offset_t offset_t; 4 | _TEGGO_EXPORTABLE DataSubstream(DataStream* container,offset_t offset,offset_t count,unsigned flags); 5 | _TEGGO_EXPORTABLE ~DataSubstream(); 6 | _TEGGO_EXPORTABLE int Write( void const* buf, int count ); 7 | _TEGGO_EXPORTABLE int Read( void* buf, int count ); 8 | _TEGGO_EXPORTABLE u32_t Features(); 9 | _TEGGO_EXPORTABLE offset_t Available(); 10 | _TEGGO_EXPORTABLE TEGGOt_E Flush(); 11 | _TEGGO_EXPORTABLE TEGGOt_E Close(); 12 | _TEGGO_EXPORTABLE bool IsClosed(); 13 | _TEGGO_EXPORTABLE virtual StringT Identifier(); 14 | 15 | DataStreamPtr ds_; 16 | offset_t start_; 17 | offset_t count_; 18 | offset_t pos_; 19 | bool seekBefore; 20 | }; 21 | 22 | _TEGGO_STREAMS_FAKE_INLINE 23 | DataSubstream::DataSubstream(DataStream* container,offset_t offset,offset_t count,unsigned flags) 24 | { 25 | if ( container ) 26 | { 27 | ds_ = RccRefe(container); 28 | seekBefore = (container->Features() & CAN_SEEK) && !(flags&STREAM_NOTSEEK_BEFORE); 29 | start_ = offset; 30 | count_ = count; 31 | pos_ = 0; 32 | } 33 | } 34 | 35 | _TEGGO_STREAMS_FAKE_INLINE 36 | DataSubstream::~DataSubstream() 37 | { 38 | Close(); 39 | } 40 | 41 | _TEGGO_STREAMS_FAKE_INLINE 42 | int DataSubstream::Write( void const* buf, int count ) 43 | { 44 | if ( ds_ ) 45 | { 46 | if ( count_ >0 && pos_ + count > count_ ) count = count_ - pos_; 47 | if ( count > 0 ) 48 | { 49 | if ( seekBefore ) ds_->Seek(start_+pos_); 50 | int q = ds_->Write(buf,count); 51 | if ( q > 0 ) pos_ += q; 52 | REQUIRE( count_ < 0 || pos_ <= count_ ); 53 | return q; 54 | } 55 | else 56 | return 0; 57 | } 58 | return -1; 59 | } 60 | 61 | _TEGGO_STREAMS_FAKE_INLINE 62 | int DataSubstream::Read( void* buf, int count ) 63 | { 64 | return -1; 65 | } 66 | 67 | _TEGGO_STREAMS_FAKE_INLINE 68 | u32_t DataSubstream::Features() 69 | { 70 | if ( ds_ ) 71 | { 72 | unsigned f = ds_->Features() & (CAN_SEEK|CAN_WRITE|CAN_READ); 73 | return f; 74 | } 75 | return 0; 76 | } 77 | 78 | _TEGGO_STREAMS_FAKE_INLINE 79 | DataSubstream::offset_t DataSubstream::Available() 80 | { 81 | if ( ds_ ) 82 | { 83 | offset_t a = ds_->Available(); 84 | if ( a < start_ ) a = 0; 85 | else a-=start_; 86 | if ( count_ < 0 ) return a; 87 | else 88 | return cxx_min(count_,a); 89 | } 90 | return 0; 91 | } 92 | 93 | _TEGGO_STREAMS_FAKE_INLINE 94 | TEGGOt_E DataSubstream::Flush() 95 | { 96 | if ( ds_ ) 97 | return ds_->Flush(); 98 | return TEGGO_CLOSED; 99 | } 100 | 101 | _TEGGO_STREAMS_FAKE_INLINE 102 | TEGGOt_E DataSubstream::Close() 103 | { 104 | Unrefe(ds_); 105 | return TEGGO_OK; 106 | } 107 | 108 | _TEGGO_STREAMS_FAKE_INLINE 109 | bool DataSubstream::IsClosed() 110 | { 111 | return !ds_; 112 | } 113 | 114 | _TEGGO_STREAMS_FAKE_INLINE 115 | StringW DataSubstream::Identifier() 116 | { 117 | if ( ds_ ) 118 | return StringW(_S*L"substream:%s"%ds_->Identifier()); 119 | return ""; 120 | } 121 | 122 | -------------------------------------------------------------------------------- /Molebox/src/newsubfolder.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2008-2009, Alexey Sudachen, alexey@sudachen.name 5 | 6 | */ 7 | 8 | #include "myafx.h" 9 | #include "mxf.h" 10 | #include "wx/sizer.h" 11 | #include "wx/busyinfo.h" 12 | #include "wx/msgdlg.h" 13 | #include "wx/statbox.h" 14 | #include "wx/statline.h" 15 | #include "wx/choice.h" 16 | 17 | struct QueryNewSubfolderDlg : wxDialog 18 | { 19 | StringW& ret_; 20 | wxTextCtrl* subfold_; 21 | wxChoice* parfold_; 22 | BufferT objs_; 23 | 24 | QueryNewSubfolderDlg(wxWindow* parent,StringW& ret) 25 | : wxDialog(parent,wxID_ANY,Tr(138,"New Subfolder"),wxDefaultPosition,wxDefaultSize,wxCAPTION), 26 | ret_(ret) 27 | { 28 | 29 | wxBoxSizer* topszr = new wxBoxSizer(wxVERTICAL); 30 | topszr->Add(MakeSubControls(this), 1, wxGROW|wxALL, 10); 31 | wxSizer* buttons = CreateButtonSizer(wxOK|wxCANCEL); 32 | topszr->Add( buttons, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 10 ); 33 | SetSizer(topszr); 34 | topszr->Fit(this); 35 | 36 | wxSize sz = GetSize(); 37 | wxSize psz = GetParent()->GetSize(); 38 | wxPoint xy = GetParent()->GetPosition(); 39 | SetPosition(wxPoint(xy.x+(psz.x-sz.x)/2,xy.y+(psz.y-sz.y)/2)); 40 | } 41 | 42 | void MxfIterate(wxArrayString& strs, BufferT& objs, int& id, MxfFolderPtr& r ) 43 | { 44 | int i = strs.Count(); 45 | if ( r == g_curr_mxfFolder ) 46 | id = i; 47 | StringW path = r->GetPkgPath(); 48 | if ( !path ) path = L""; 49 | strs.Add(+path); 50 | objs.Push(+r); 51 | for ( MxfFolderPtr* p = r->Begin(); p!=r->End(); ++p ) 52 | MxfIterate(strs,objs,id,*p); 53 | }; 54 | 55 | wxPanel* MakeSubControls(wxWindow* parent) 56 | { 57 | wxBoxSizer* topszr = new wxBoxSizer(wxVERTICAL); 58 | wxPanel* pan = new wxPanel(parent); 59 | 60 | int cur_fold_id = 0; 61 | wxArrayString strings; 62 | MxfIterate(strings,objs_,cur_fold_id,g_root_mxfFolder); 63 | 64 | subfold_ = new wxTextCtrl(pan, ctID_INPUTTEXT1, wxEmptyString, wxDefaultPosition, wxSize(60*6,-1)); 65 | parfold_ = new wxChoice(pan, ctID_INPUTTEXT2, wxDefaultPosition, wxDefaultSize, strings); 66 | parfold_->SetSelection(cur_fold_id); 67 | 68 | topszr->Add( new wxStaticText(pan,wxID_ANY,Tr(139,"Enter name of new Subfolder here")), 0, wxBOTTOM|wxTOP , 5 ); 69 | topszr->Add( subfold_, 1, wxGROW|wxBOTTOM , 5 ); 70 | topszr->Add( new wxStaticText(pan,wxID_ANY,Tr(140,"Select the Parent folder")), 0, wxBOTTOM , 5 ); 71 | topszr->Add( parfold_, 1, wxGROW|wxBOTTOM , 5 ); 72 | pan->SetSizer(topszr); 73 | return pan; 74 | } 75 | 76 | void OnOK(wxCommandEvent&) 77 | { 78 | ret_ = ""; 79 | MxfFolder* p = objs_[parfold_->GetCurrentSelection()]; 80 | p->ResolvePkgPath(ret_,+StringW(subfold_->GetValue().c_str().AsWChar()).Trim()); 81 | EndModal(wxID_OK); 82 | } 83 | 84 | DECLARE_EVENT_TABLE() 85 | }; 86 | 87 | BEGIN_EVENT_TABLE( QueryNewSubfolderDlg, wxDialog ) 88 | EVT_BUTTON( wxID_OK, QueryNewSubfolderDlg::OnOK ) 89 | END_EVENT_TABLE() 90 | 91 | bool QueryNewSubfolder(wxWindow* parent, StringW& subfolder) 92 | { 93 | QueryNewSubfolderDlg dlg(parent,subfolder); 94 | return dlg.ShowModal() == wxID_OK; 95 | } 96 | --------------------------------------------------------------------------------