-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76ce9db
commit 88c597f
Showing
230 changed files
with
100,758 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.SUFFIXES: .S .c | ||
|
||
SOURCEPATH=. | ||
SSL_PATH=../openssl/include | ||
XOR_PATH=./crypto | ||
ZLIB_PATH=./zlib | ||
DARWIN_PATH=../../include | ||
GCC_PATH=../../include/gcc | ||
|
||
CFLAGS=-nostdinc -nostdlib | ||
#CFLAGS+= -I ../../test/source/bionic/libc/include | ||
#CFLAGS+= -I ../../test/source/bionic/libc/kernel/common/linux/ | ||
#CFLAGS+= -I ../../test/source/bionic/libc/kernel/common/ | ||
#CFLAGS+= -I ../../test/source/bionic/libc/arch-x86/include/ | ||
#CFLAGS+= -I ../../test/source/bionic/libc/kernel/arch-x86/ | ||
|
||
CFLAGS+= -I$(SSL_PATH) | ||
CFLAGS+= -D_BYTE_ORDER=_LITTLE_ENDIAN -D_SIZE_T_DECLARED | ||
#CFLAGS+= -Dwchar_t="char" | ||
CFLAGS+= -fno-builtin | ||
#-DElf_Size="u_int32_t" | ||
CFLAGS+= -I$(SOURCEPATH) -I$(XOR_PATH) -I$(ZLIB_PATH) -I$(SSL_PATH) -I$(DARWIN_PATH) | ||
#CFLAGS+= -D__linux__ -D__DARWIN__ -DMALLOC_PRODUCTION | ||
CFLAGS+= -I. | ||
CFLAGS+= -march=i386 -m32 -g -fPIC -Os -DPIC | ||
|
||
#CC=gcc | ||
CC=i686-apple-darwin10-gcc | ||
AR=i686-apple-darwin10-ar | ||
LD=i686-apple-darwin10-ld | ||
RM=rm | ||
|
||
objects = args.o base.o base_dispatch.o base_dispatch_common.o buffer.o \ | ||
channel.o common.o core.o list.o remote.o thread.o xor.o zlib.o | ||
|
||
CFLAGS+= -fno-stack-protector | ||
|
||
|
||
BASEVPATH=.:./crypto:./arch/posix:./zlib: | ||
OSVPATH=./arch/posix | ||
ARCHVPATH=./arch/posix | ||
VPATH=$(BASEVPATH):$(OSVPATH):$(ARCHVPATH) | ||
|
||
CFLAGS+= -I$(ARCHVPATH) | ||
|
||
|
||
all: libsupport.dylib | ||
|
||
libsupport.dylib: $(objects) | ||
$(CC) $(CFLAGS) -dynamiclib $(objects) -lc -lssl -lcrypto -o $@ | ||
|
||
clean: | ||
$(RM) -f *.o *.a *.dylib zlib/zlib.o | ||
|
||
.PHONY: clean | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "common.h" | ||
|
||
DWORD | ||
remote_request_core_migrate(Remote *remote, Packet *packet) | ||
{ | ||
return (EOPNOTSUPP); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include <fcntl.h> | ||
#include "common.h" | ||
|
||
//#define errno 0 | ||
|
||
DWORD | ||
buffer_from_file(LPCSTR filePath, PUCHAR *buffer, PULONG length) | ||
{ | ||
int fd, res = 0; | ||
off_t size; | ||
char *buf = NULL; | ||
|
||
if ((fd = open(filePath, O_RDONLY)) < 0) { | ||
res = errno; | ||
return (res); | ||
} | ||
/* | ||
* find the end | ||
*/ | ||
if ((size = lseek(fd, 0, SEEK_END)) < 0) { | ||
res = errno; | ||
goto done; | ||
} | ||
if ((res = lseek(fd, 0, SEEK_SET)) < 0) { | ||
res = errno; | ||
goto done; | ||
} | ||
if ((buf = malloc(size)) == NULL) { | ||
res = ENOMEM; | ||
goto done; | ||
} | ||
if (read(fd, buf, size) < size) { | ||
res = errno; | ||
free(buf); | ||
} | ||
done: | ||
close(fd); | ||
if (res == 0) { | ||
if (buffer) | ||
*buffer = buf; | ||
else | ||
free(buf); | ||
if (length) | ||
*length = size; | ||
} | ||
return (res); | ||
} | ||
|
||
DWORD | ||
buffer_to_file(LPCSTR filePath, PUCHAR buffer, ULONG length) | ||
{ | ||
int fd, res = 0; | ||
off_t size; | ||
|
||
if ((fd = open(filePath, O_CREAT|O_TRUNC|O_WRONLY, 0777)) < 0) { | ||
res = errno; | ||
return (res); | ||
} | ||
if (write(fd, buffer, length) < length) | ||
res = errno; | ||
|
||
close(fd); | ||
return (res); | ||
} |
Oops, something went wrong.