新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > arm匯編學(xué)習(xí)(三)

arm匯編學(xué)習(xí)(三)

作者: 時(shí)間:2016-11-09 來源:網(wǎng)絡(luò) 收藏
一、ndk編譯android上運(yùn)行的c程序

新建個(gè)hello目錄,底下要有jni目錄,下面就是Android.mk文件

本文引用地址:http://m.butianyuan.cn/article/201611/317581.htm

1.Android.mk文件內(nèi)容如下:

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下新建個(gè)hello.c,內(nèi)容取自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學(xué)習(xí)

ARM初步完成,開始以crackme練習(xí)作為學(xué)習(xí)的目的



關(guān)鍵詞: arm匯編學(xué)

評(píng)論


技術(shù)專區(qū)

關(guān)閉