From: Alexander Shiryaev Date: Fri, 16 Nov 2012 15:47:16 +0000 (+0400) Subject: HostPackedFiles implemented; DevPacked added; loader simplified X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=4d118bc168ef105230b75f358c6917ed7ee5cbd3;p=bbcp.git HostPackedFiles implemented; DevPacked added; loader simplified --- diff --git a/new/Dev/Docu/Packer.odc b/new/Dev/Docu/Packer.odc new file mode 100644 index 0000000..70a04f4 Binary files /dev/null and b/new/Dev/Docu/Packer.odc differ diff --git a/new/Dev/Mod/Packer.odc b/new/Dev/Mod/Packer.odc new file mode 100644 index 0000000..a8afd4f Binary files /dev/null and b/new/Dev/Mod/Packer.odc differ diff --git a/new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc b/new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc index 24afbb4..0fcdfe2 100644 Binary files a/new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc and b/new/_LinuxOpenBSD_/Host/Mod/PackedFiles.odc differ diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox-dl.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox-dl.c deleted file mode 100644 index c4ac847..0000000 --- a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox-dl.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -int main (int argc, char *argv[]) -{ - void * h; - /* - void * h1; - void (*SetKernelBaseStack) (int); - void (*Init) (void); - */ - int res; - - h = dlopen("libBB.so", RTLD_LAZY | RTLD_GLOBAL); - if (h != NULL) { - /* - h1 = dlsym(h, "SetKernelBaseStack"); - if (h1 != NULL) { - *(void **) (&SetKernelBaseStack) = h1; - h1 = dlsym(h, "Init"); - if (h1 != NULL) { - *(void **) (&Init) = h1; - - asm ("movl %%esp, %[res]" : [res] "=m" (res) ); - SetKernelBaseStack(res - 8); - - printf("before Init()\n"); - Init(); - printf("after Init()\n"); - - res = 0; - } else { - perror(dlerror()); - res = 3; - } - } else { - perror(dlerror()); - res = 2; - } - */ - res = 0; - } else { - perror(dlerror()); - res = 1; - } - - return res; -} diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox.c deleted file mode 100644 index 1e77b70..0000000 --- a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox.c +++ /dev/null @@ -1,4 +0,0 @@ -int main (int argc, char *argv[]) -{ - return 0; -} diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox1.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox1.c deleted file mode 100644 index 155069f..0000000 --- a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/BlackBox1.c +++ /dev/null @@ -1,24 +0,0 @@ -// #include - -// extern void SetKernelBaseStack (int); -extern void Init (void); - -int main (int argc, char *argv[]) -{ - // int res; - - // printf("START\n"); - - /* 2012.09.02: This is from oberoncore.ru - 2012.09.05: not required in case of static linking of shared library (-lBB) */ - // asm ("movl %%esp, %[res]" : [res] "=m" (res) ); - // SetKernelBaseStack(res - 8); - // printf("SetKernelBaseStack(0x%02x): done\n", res - 8); - // -> base stack = locals of main proc - - Init(); - - // printf("END\n"); - - return 0; -} diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/dev0.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/dev0.c deleted file mode 100644 index 64bddd7..0000000 --- a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/dev0.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -int main (int argc, char *argv[]) -{ - void * h; - int res; - - h = dlopen("libBB0.so", RTLD_LAZY | RTLD_GLOBAL); - if (h != NULL) { - res = 0; - } else { - perror(dlerror()); - res = 1; - } - - return res; -} diff --git a/new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c new file mode 100644 index 0000000..74bb6c2 --- /dev/null +++ b/new/_LinuxOpenBSD_/Lin/Rsrc/loader/loader.c @@ -0,0 +1,23 @@ +#include +#include + +int main (int argc, char *argv[]) +{ + void * h; + int res; + + if (argc == 2) { + h = dlopen(argv[1], RTLD_LAZY | RTLD_GLOBAL); + if (h != NULL) { + res = 0; + } else { + perror(dlerror()); + res = 2; + } + } else { + fprintf(stderr, "usage: %s file.so\n", argv[0]); + res = 1; + } + + return res; +} diff --git a/new/_LinuxOpenBSD_GUI/Port.odc b/new/_LinuxOpenBSD_GUI/Port.odc index f7789ed..433bef4 100644 Binary files a/new/_LinuxOpenBSD_GUI/Port.odc and b/new/_LinuxOpenBSD_GUI/Port.odc differ diff --git a/new/_LinuxOpenBSD_GUI/TODO.odc b/new/_LinuxOpenBSD_GUI/TODO.odc index dd0a760..b6c9641 100644 Binary files a/new/_LinuxOpenBSD_GUI/TODO.odc and b/new/_LinuxOpenBSD_GUI/TODO.odc differ diff --git a/new/_Linux_/BlackBox b/new/_Linux_/BlackBox deleted file mode 120000 index b4db3bb..0000000 --- a/new/_Linux_/BlackBox +++ /dev/null @@ -1 +0,0 @@ -Lin/Rsrc/loader/BlackBox \ No newline at end of file diff --git a/new/_Linux_/Lin/Rsrc/loader/BlackBox b/new/_Linux_/Lin/Rsrc/loader/BlackBox deleted file mode 100755 index c456d0e..0000000 Binary files a/new/_Linux_/Lin/Rsrc/loader/BlackBox and /dev/null differ diff --git a/new/_Linux_/Lin/Rsrc/loader/Makefile b/new/_Linux_/Lin/Rsrc/loader/Makefile index 16b78c9..4af1536 100644 --- a/new/_Linux_/Lin/Rsrc/loader/Makefile +++ b/new/_Linux_/Lin/Rsrc/loader/Makefile @@ -4,18 +4,12 @@ # ${.ALLSRC} $^ # ${.IMPSRC} $< -all: dev0 BlackBox +all: loader CFLAGS += -Wall -O0 -g -m32 -#BlackBox: BlackBox.c -# ${CC} ${CFLAGS} -o $@ $^ -L. -lBB - -BlackBox: BlackBox-dl.c - ${CC} ${CFLAGS} -o $@ $^ -ldl - -dev0: dev0.c +loader: loader.c ${CC} ${CFLAGS} -o $@ $^ -ldl clean: - rm -f dev0 BlackBox + rm -f loader diff --git a/new/_Linux_/Lin/Rsrc/loader/dev0 b/new/_Linux_/Lin/Rsrc/loader/dev0 deleted file mode 100755 index 2ea46b7..0000000 Binary files a/new/_Linux_/Lin/Rsrc/loader/dev0 and /dev/null differ diff --git a/new/_Linux_/Lin/Rsrc/loader/libBB.so b/new/_Linux_/Lin/Rsrc/loader/libBB.so deleted file mode 120000 index 85c28c4..0000000 --- a/new/_Linux_/Lin/Rsrc/loader/libBB.so +++ /dev/null @@ -1 +0,0 @@ -../../../libBB.so \ No newline at end of file diff --git a/new/_Linux_/Lin/Rsrc/loader/libBB0.so b/new/_Linux_/Lin/Rsrc/loader/libBB0.so deleted file mode 120000 index 6319f6b..0000000 --- a/new/_Linux_/Lin/Rsrc/loader/libBB0.so +++ /dev/null @@ -1 +0,0 @@ -../../../libBB0.so \ No newline at end of file diff --git a/new/_Linux_/Lin/Rsrc/loader/loader b/new/_Linux_/Lin/Rsrc/loader/loader new file mode 100755 index 0000000..91423d9 Binary files /dev/null and b/new/_Linux_/Lin/Rsrc/loader/loader differ diff --git a/new/_Linux_/dev0 b/new/_Linux_/dev0 deleted file mode 120000 index b787eae..0000000 --- a/new/_Linux_/dev0 +++ /dev/null @@ -1 +0,0 @@ -Lin/Rsrc/loader/dev0 \ No newline at end of file diff --git a/new/_Linux_/loader b/new/_Linux_/loader new file mode 120000 index 0000000..dc66ef1 --- /dev/null +++ b/new/_Linux_/loader @@ -0,0 +1 @@ +Lin/Rsrc/loader/loader \ No newline at end of file diff --git a/new/_OpenBSD_/BlackBox b/new/_OpenBSD_/BlackBox deleted file mode 120000 index b4db3bb..0000000 --- a/new/_OpenBSD_/BlackBox +++ /dev/null @@ -1 +0,0 @@ -Lin/Rsrc/loader/BlackBox \ No newline at end of file diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/BlackBox b/new/_OpenBSD_/Lin/Rsrc/loader/BlackBox deleted file mode 100755 index 8090ec9..0000000 Binary files a/new/_OpenBSD_/Lin/Rsrc/loader/BlackBox and /dev/null differ diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/Makefile b/new/_OpenBSD_/Lin/Rsrc/loader/Makefile index b3bdcd5..f4104dd 100644 --- a/new/_OpenBSD_/Lin/Rsrc/loader/Makefile +++ b/new/_OpenBSD_/Lin/Rsrc/loader/Makefile @@ -6,28 +6,12 @@ CFLAGS += -Wall -O0 -g -all: libdlobsdwrap.so dev0 BlackBox - -# libdlobsdwrap.so: universal method of correct access to dl* functions -# in case of dynamic loading of libBB*.so "ld.so" in LibDl may be used instead of "libc.so", but not in case of static linking -# wrapper method is universal +all: loader # -pthread required to dlopen libraries that depends on pthread -#BlackBox: BlackBox.c -# ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -L. -lBB -pthread - -BlackBox: BlackBox-dl.c +loader: loader.c ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -pthread -#dev0: BlackBox1.c -# ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -L . -lBB0 - -dev0: dev0.c - ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} - -libdlobsdwrap.so: libdlobsdwrap.c - ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -fPIC -shared - clean: - rm -f dev0 BlackBox libdlobsdwrap.so + rm -f loader diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/dev0 b/new/_OpenBSD_/Lin/Rsrc/loader/dev0 deleted file mode 100755 index b145e7a..0000000 Binary files a/new/_OpenBSD_/Lin/Rsrc/loader/dev0 and /dev/null differ diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libBB.so b/new/_OpenBSD_/Lin/Rsrc/loader/libBB.so deleted file mode 120000 index 85c28c4..0000000 --- a/new/_OpenBSD_/Lin/Rsrc/loader/libBB.so +++ /dev/null @@ -1 +0,0 @@ -../../../libBB.so \ No newline at end of file diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libBB0.so b/new/_OpenBSD_/Lin/Rsrc/loader/libBB0.so deleted file mode 120000 index 6319f6b..0000000 --- a/new/_OpenBSD_/Lin/Rsrc/loader/libBB0.so +++ /dev/null @@ -1 +0,0 @@ -../../../libBB0.so \ No newline at end of file diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.c b/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.c deleted file mode 100644 index 22c437b..0000000 --- a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -void * __dlopen (const char *path, int mode) -{ - return dlopen(path, mode); -} - -int __dlclose (void *handle) -{ - return dlclose(handle); -} - -void * __dlsym (void *handle, const char *symbol) -{ - return dlsym(handle, symbol); -} - -const char * __dlerror (void) -{ - return dlerror(); -} diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so b/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so deleted file mode 100755 index 8874e67..0000000 Binary files a/new/_OpenBSD_/Lin/Rsrc/loader/libdlobsdwrap.so and /dev/null differ diff --git a/new/_OpenBSD_/Lin/Rsrc/loader/loader b/new/_OpenBSD_/Lin/Rsrc/loader/loader new file mode 100755 index 0000000..745fb08 Binary files /dev/null and b/new/_OpenBSD_/Lin/Rsrc/loader/loader differ diff --git a/new/_OpenBSD_/dev0 b/new/_OpenBSD_/dev0 deleted file mode 120000 index b787eae..0000000 --- a/new/_OpenBSD_/dev0 +++ /dev/null @@ -1 +0,0 @@ -Lin/Rsrc/loader/dev0 \ No newline at end of file diff --git a/new/_OpenBSD_/libdlobsdwrap.so b/new/_OpenBSD_/libdlobsdwrap.so deleted file mode 120000 index 7c1e1bb..0000000 --- a/new/_OpenBSD_/libdlobsdwrap.so +++ /dev/null @@ -1 +0,0 @@ -Lin/Rsrc/loader/libdlobsdwrap.so \ No newline at end of file diff --git a/new/_OpenBSD_/loader b/new/_OpenBSD_/loader new file mode 120000 index 0000000..dc66ef1 --- /dev/null +++ b/new/_OpenBSD_/loader @@ -0,0 +1 @@ +Lin/Rsrc/loader/loader \ No newline at end of file diff --git a/new/build b/new/build index 44a52bd..d0e5223 100755 --- a/new/build +++ b/new/build @@ -118,15 +118,15 @@ DevCompiler.CompileThis ConsCompiler DATA ./run-BlackBox <