a0rtega / pafish

Pafish is a testing tool that uses different techniques to detect virtual machines and malware analysis environments in the same way that malware families do

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compile error

opened this issue · comments

Hi, error in VBOX.c compiling under linux. All other modules compile OK.

Maybe related to the asterisk (*) after IP_ADAPTER_ADDRESSES ? Sorry github seems to mess with the error output... i've included a pic.

screenshot from 2015-02-18 11 16 37

Ubuntu 14.04 // gcc version 4.8.2 (GCC)

$ sudo make -B -i
i686-w64-mingw32-gcc -c main.c -o Objects/MingW/main.o -O1
i686-w64-mingw32-gcc -c common.c -o Objects/MingW/common.o -O1
i686-w64-mingw32-gcc -c utils.c -o Objects/MingW/utils.o -O1
i686-w64-mingw32-gcc -c debuggers.c -o Objects/MingW/debuggers.o -O1
i686-w64-mingw32-gcc -c sandboxie.c -o Objects/MingW/sandboxie.o -O1
i686-w64-mingw32-gcc -c vbox.c -o Objects/MingW/vbox.o -O1
vbox.c: In function ‘vbox_mac’:
vbox.c:236:44: error: ‘GAA_FLAG_INCLUDE_PREFIX’ undeclared (first use in this function)
int ret = GetAdaptersAddresses(AF_UNSPEC,GAA_FLAG_INCLUDE_PREFIX,0,0,&alist_size);

vbox.c:236:44: note: each undeclared identifier is reported only once for each function it appears in
vbox.c:238:4: error: unknown type name ‘IP_ADAPTER_ADDRESSES’
IP_ADAPTER_ADDRESSES* palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT,alist_size);

vbox.c:238:36: error: ‘IP_ADAPTER_ADDRESSES’ undeclared (first use in this function)
IP_ADAPTER_ADDRESSES* palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT,alist_size);

vbox.c:238:57: error: expected expression before ‘)’ token
IP_ADAPTER_ADDRESSES* palist = (IP_ADAPTER_ADDRESSES*)LocalAlloc(LMEM_ZEROINIT,alist_size);

vbox.c:241:27: error: ‘ppalist’ undeclared (first use in this function)
IP_ADAPTER_ADDRESSES* ppalist=palist;

make: [Objects/MingW/vbox.o] Error 1 (ignored)
i686-w64-mingw32-gcc -c gensandbox.c -o Objects/MingW/gensandbox.o -O1
i686-w64-mingw32-gcc -c wine.c -o Objects/MingW/wine.o -O1
i686-w64-mingw32-gcc -c vmware.c -o Objects/MingW/vmware.o -O1
i686-w64-mingw32-gcc -c qemu.c -o Objects/MingW/qemu.o -O1
i686-w64-mingw32-gcc -c hooks.c -o Objects/MingW/hooks.o -O1
i686-w64-mingw32-windres Objects/MingW/pafish_private.rc --input-format=rc -o Objects/MingW/pafish_private.res -O coff
i686-w64-mingw32-gcc Objects/MingW/main.o Objects/MingW/common.o Objects/MingW/utils.o Objects/MingW/debuggers.o Objects/MingW/sandboxie.o Objects/MingW/vbox.o Objects/MingW/gensandbox.o Objects/MingW/wine.o Objects/MingW/vmware.o Objects/MingW/qemu.o Objects/MingW/hooks.o Objects/MingW/pafish_private.res -o "Output/MingW/pafish.exe" -lwsock32 -liphlpapi -lsetupapi -lmpr -s
i686-w64-mingw32-gcc: error: Objects/MingW/vbox.o: No such file or directory
make: [Output/MingW/pafish.exe] Error 1 (ignored)

Hello!

Yes, I'm aware of this problem but I didn't find the solution to it. Looks like some structs missing in linux ming version.

I'll have a look at this, in the worst case I'll drop the compilation of this function in linux.

I get these same errors on Win7 running mingw32, mingw64, and TDM-64. What's your build setup for windows, @a0rtega ?

@kdar That's weird. I've compiled on Windows XP in the past and W7 x64 recently, and never had this problem when compiling on Windows.

Can you paste the error trace you have so we can have a look?

make -f Makefile.win
gcc.exe -c vbox.c -o Objects/MingW/vbox.o -I"C:/MinGW32/include" -Wall -Wextra -O0
vbox.c: In function 'vbox_mac':
vbox.c:160:3: warning: implicit declaration of function 'GetAdaptersAddresses' [-Wimplicit-function-declaration]
int ret = GetAdaptersAddresses(AF_UNSPEC,GAA_FLAG_INCLUDE_PREFIX,0,0,&alist_size);
^
vbox.c:160:44: error: 'GAA_FLAG_INCLUDE_PREFIX' undeclared (first use in this function)
int ret = GetAdaptersAddresses(AF_UNSPEC,GAA_FLAG_INCLUDE_PREFIX,0,0,&alist_size);
^
vbox.c:160:44: note: each undeclared identifier is reported only once for each function it appears in
vbox.c:162:4: error: unknown type name 'IP_ADAPTER_ADDRESSES'
IP_ADAPTER_ADDRESSES* palist = (IP_ADAPTER_ADDRESSES_)LocalAlloc(LMEM_ZEROINIT,alist_size);
^
vbox.c:162:36: error: 'IP_ADAPTER_ADDRESSES' undeclared (first use in this function)
IP_ADAPTER_ADDRESSES_ palist = (IP_ADAPTER_ADDRESSES_)LocalAlloc(LMEM_ZEROINIT,alist_size);
^
vbox.c:162:57: error: expected expression before ')' token
IP_ADAPTER_ADDRESSES_ palist = (IP_ADAPTER_ADDRESSES_)LocalAlloc(LMEM_ZEROINIT,alist_size);
^
vbox.c:165:27: error: 'ppalist' undeclared (first use in this function)
IP_ADAPTER_ADDRESSES_ ppalist=palist;
^
make: *** [Objects/MingW/vbox.o] Error 1

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=D:/DEV/MSYS64/MINGW64/BIN/../lib/gcc/x86_64-w64-mingw32/4.9.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-4.9.2/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/4.9.2 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-cloog-backend=isl --enable-version-specific-runtime-libs --disable-cloog-version-check --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-cloog=/mingw64 --with-pkgversion='Rev5, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 4.9.2 (Rev5, Built by MSYS2 project)

Hey @kdar I have just tried with MSYS as you do, and it didn't work for me neither.

I usually build directly with the official MinGW: http://www.mingw.org/

But I also tried with Cygwin now and it worked at the first try (install mingw-gcc-core and make): https://cygwin.com/index.html

Hope it helps, cheers!

This should be fixed in the latest master revision. It checks the defines needed for those functions and structs, and will skip the compilation of that part if not found, triggering a warning.

I had the same problems, fixed it by adding the winsock2.h include before the windows.h include. I have reverted your patch and added the include, and it compiled fine (Gentoo with mingw32 cross-compiler). I will create a pull request.