This file contains hidden or 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
// | |
// main.m | |
// process | |
// | |
// Created by piao on 15/8/13. | |
// Copyright (c) 2015年 piao. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <sys/sysctl.h> |
This file contains hidden or 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
ARCHS = armv7 armv7s arm64 | |
TARGET = iphone:8.4:7.0 | |
#TARGET = iPhone:latest:7.0 | |
#ARCHS这些定义一定要放到include之上 | |
include theos/makefiles/common.mk | |
TWEAK_NAME = test | |
test_FILES = Tweak.xm | |
test_FRAMEWORKS = UIKit |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
#include <mach/host_info.h> | |
#include <mach/mach_host.h> | |
#include <mach/shared_region.h> | |
#include <mach/mach.h> | |
#include <mach-o/dyld.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#import <dlfcn.h> | |
This file contains hidden or 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
//////////////////////////////////////////////////////////////////////// | |
/// armv7传参研究 | |
//////////////////////////////////////////////////////////////////////// | |
//--------------------------------------------------------------------- | |
int func(int a, int b, int c, int d, int e, int f) | |
{ | |
int ret = a + b + c + d + e + f; | |
return ret; | |
} | |
_func: |
This file contains hidden or 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
// 参考官方判断方法:http://www.opensource.apple.com/source/cctools/cctools-870/include/mach/arm/thread_status.h | |
void checkArch(){ | |
#if defined (__arm64__)/* || defined (__aarch64__) */ | |
printf("[PiaoYun]running 64-bit [__arm64__ arch]\n"); | |
#elif defined(__arm64__) | |
printf("[PiaoYun]runing 32-bit [__arm__ arch]\n"); | |
#else | |
#error [PiaoYun]Unknown arch | |
#endif | |
} |
This file contains hidden or 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
// | |
// main.c | |
// iOS_ARM | |
// | |
// Created by piao on 15/7/21. | |
// Copyright (c) 2015年 __MyCompanyName__. All rights reserved. | |
// | |
#if defined (__arm64__) /*|| defined (__aarch64__)*/ | |
This file contains hidden or 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
// | |
// main.m | |
// debug | |
// | |
// Created by piao on 15/7/20. | |
// Copyright (c) 2015年 piao. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
This file contains hidden or 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
// 演示代码 | |
// #import <mach-o/dyld-interposing.h> | |
// from dyld-interposing.h | |
#define DYLD_INTERPOSE(_replacement,_replacee) __attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee __attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee }; | |
ssize_t hacked_write(int fildes, const void *buf, size_t nbyte) | |
{ | |
printf("[++++]into hacked_write---by piaoyun"); | |
return write(fildes, buf, nbyte); | |
} |