新闻中心

EEPW首页>嵌入式系统>设计应用> arm汇编学习(三)

arm汇编学习(三)

作者: 时间:2016-11-09 来源:网络 收藏
一、ndk编译android上运行的c程序

新建个hello目录,底下要有jni目录,下面就是Android.mk文件

本文引用地址://m.amcfsurvey.com/article/201611/317581.htm

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 fai
           led!");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练习作为学习的目的



关键词:arm汇编学

评论


技术专区

关闭