一、ndk编译android上运转的c程序
新建个hello目录,底下要有jni目录,下面便是Android.mk文件
1.Android.mk文件内容如下:
LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES:= hello.cLOCAL_MODULE:= helloLOCAL_FORCE_STATIC_EXECUTABLE := true#LOCAL_STATIC_LIBRARIES := libc#LOCAL_CFLAGS += -Iinclude/dir -DSOMEFLAGSinclude $(BUILD_EXECUTABLE)
2.jni下新建个hello.c,内容取自kanxue论坛上的一份代码:
#include#include int main(int argc,char *argv[]){char name[]="helloworld";int keys[]={0xb,0x1f,0x19,0x19,0x49,0xb,0xb,0xb,0x31,0x53};char Thekeys[11];int i;for(i=0;i<10;i++){keys[i]^=7;keys[i]=keys[i]/6;keys[i]+=22;keys[i]-=24;keys[i]^=name[i];}for(i=0;i<10;i++){Thekeys[i]=keys[i];}Thekeys[i]=0;if(!strcmp(Thekeys,argv[1]))printf("Good Work,you have Successed!");elseprintf("NO,you are failed!");return 0;}
3.编译
moonflow@WIN-KG08V2FIOKP /cygdrive/c/helloc/jni$ $NDK/ndk-buildCygwin : Generating dependency file converter scriptCompile thumb : hello <= hello.cExecutable : helloInstall : hello => libs/armeabi/hello
4.参阅:
http://leave001.blog.163.com/blog/static/16269129320128113217384/
http://guoh.org/lifelog/2012/02/run-native-c-code-on-android/
http://www.cnblogs.com/newcj/archive/2011/08/14/2138553.html
二、ARM crackme学习
ARM开端完结,开端以crackme操练作为学习的意图