飘云阁

 找回密码
 加入我们

QQ登录

只需一步,快速开始

查看: 9551|回复: 16

[iOS] [Tweak]QQ小尾巴插件Tweak代码更新

[复制链接]
  • TA的每日心情
    开心
    2019-3-17 22:44
  • 签到天数: 132 天

    [LV.7]常住居民III

    发表于 2016-10-10 22:48:29 | 显示全部楼层 |阅读模式
    本帖最后由 tree_fly 于 2016-10-10 22:48 编辑

    之前写的一篇帖子和Tweak,由于不能添加自定义小尾巴,没能让诸位装X的更彻底,闲暇时间更新了代码与大家分享。教你修改QQ手机型号为iPhone6Plushttps://www.chinapyg.com/thread-75886-1-1.html



    *OS获取设备信息的函数之一 _sysctlbyname()  
    苹果官方文档这样写道:
    https://developer.apple.com/lega ... sysctlbyname.3.html
    The sysctlbyname() function accepts an ASCII representation of the name and internally looks up the
         integer name vector.  Apart from that, it behaves the same as the standard sysctl() function.  For a
         list of ASCII representations of commonly used sysctl names, please see sysctl(1).

         The information is copied into the buffer specified by oldp.  The size of the buffer is given by the
         location specified by oldlenp before the call
    , and that location gives the amount of data copied after
         a successful call and after a call that returns with the error code ENOMEM.  If the amount of data
         available is greater than the size of the buffer supplied, the call supplies as much data as fits in
         the buffer provided and returns with the error code ENOMEM.  If the old value is not desired, oldp and
         oldlenp should be set to NULL.

         The size of the available data can be determined by calling sysctl() with the NULL argument for oldp.
         The size of the available data will be returned in the location pointed to by oldlenp.  

    基于文档提供的信息,更新下代码:
    [Objective-C] 纯文本查看 复制代码
    /*
    * 修改手机类型为iPhone7 Plus
    * 作者:tree_fly/P.Y.G
    */
    
    #include "substrate.h"
    
    int (*orig_sysctlbyname)(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
    int my_sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen){
        //skip 
        if (strcmp(name, "hw.machine") != 0) 
            return orig_sysctlbyname(name, oldp, oldlenp, newp, newlen);
       
        int ret = orig_sysctlbyname(name, oldp, oldlenp, newp, newlen);
        
        if (oldp == NULL) {
            *oldlenp = 50;
            // expand the buffer length, as normal is 10
            return ret;
        }else {    
            const char *machine = "iРhone7 Рlus 256g(亮黑色)";
            strncpy((char *)oldp, machine, strlen(machine) + 1);
            //modify the machine content
            return ret;            
        }     
        
       
    }
    
    %ctor {
        //hook start
        MSHookFunction((void *)MSFindSymbol(NULL,"_sysctlbyname"), (void *)my_sysctlbyname, (void **)&orig_sysctlbyname);
    }



    附上一张小图片:
    45A184C7-355A-4A7E-90C0-986CA79DA465.png

    评分

    参与人数 3威望 +24 飘云币 +28 收起 理由
    GGLHY + 12 + 20 飞树博士V587
    NoNameX2016 + 8 + 8 赞一个!
    ZMZwise + 4 PYG有你更精彩!

    查看全部评分

    PYG19周年生日快乐!
  • TA的每日心情
    开心
    昨天 21:53
  • 签到天数: 1811 天

    [LV.Master]伴坛终老

    发表于 2016-10-10 23:36:43 | 显示全部楼层
    樹飛哥近來心情好好啊,那麽多産品,謝了
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    难过
    前天 14:49
  • 签到天数: 11 天

    [LV.3]偶尔看看II

    发表于 2016-10-11 00:28:00 | 显示全部楼层
    学习了,膜iOS巨神!
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2023-11-27 16:47
  • 签到天数: 114 天

    [LV.6]常住居民II

    发表于 2016-10-11 09:03:56 | 显示全部楼层
    膜拜。- -虽说I7己经满足不了装逼的需求了。
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2021-9-29 15:05
  • 签到天数: 114 天

    [LV.6]常住居民II

    发表于 2016-10-11 09:17:51 | 显示全部楼层
    羡慕看的懂英文~ 赞一个
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2024-3-29 17:43
  • 签到天数: 847 天

    [LV.10]以坛为家III

    发表于 2016-10-11 09:32:49 | 显示全部楼层
    谢谢了,膜拜大神啊
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2 小时前
  • 签到天数: 1680 天

    [LV.Master]伴坛终老

    发表于 2016-10-11 12:01:47 | 显示全部楼层
    树飞版主 搞个Android的吧 一起装逼
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2024-2-5 17:25
  • 签到天数: 980 天

    [LV.10]以坛为家III

    发表于 2016-10-11 19:19:25 | 显示全部楼层
    大牛带我装逼带我飞
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2024-4-6 11:41
  • 签到天数: 1827 天

    [LV.Master]伴坛终老

    发表于 2016-10-12 07:48:49 | 显示全部楼层
    谢谢分享了!
    PYG19周年生日快乐!
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 加入我们

    本版积分规则

    快速回复 返回顶部 返回列表