|
如果已知一个函数的地址,如何调用它?
搜了一下百度,貌似没戏
看来C语言设计的时候也没办法知道可变参数的结束地址在哪里 |
|
如果已知一个函数的地址,如何调用它?
我觉得11楼的解决方案可行,现在就是要找到可变参数的结束地址,然后从开始地址到结束地址整个拷贝到堆栈就可以了吧,百度上介绍可变参数是有的,但是还没找到有说明堆栈中参数下面的是指向哪里如何获取的 |
|
如果已知一个函数的地址,如何调用它?
坦白的说我考虑这样的函数是因为想用在多线程到单一线程的转换中。当一个函数被多个线程调用时,先判断是否为函数的工作线程,如果不是就把自己的函数地址和参数发给工作线程,让工作线程来执行它,所以这只是个内部的调用,更不用移植。所以不需要关心调用约定了,呵呵 |
|
如果已知一个函数的地址,如何调用它?
调用方式先不管它吧,就当做是stdcall了 |
|
如果已知一个函数的地址,如何调用它?
[QUOTE=北极狐狸;1014086]函数调用,不一定要用push 指令,可以用sub 抬栈顶 ESP 如 mov [esp-4],var1 mov [esp-8],var2 mov [esp-0xb,var3 sub ESP,0B //相当于push 三次 call fooaddress 就可以了,不知道是不是...[/QUOTE] 不好意思,这几天在看另一个问题,没关注这帖子,这个方法挺好的,应该能行,但现在还有最后一个问题,如何知道可变参数的结束地址(va_start可以获取起始地址)?这样我就可以把可变参数mov进堆栈了,是吧? |
|
如果已知一个函数的地址,如何调用它?
还有我试了一下,貌似push的值都是int型的才行,如果我直接push一个bool或者short型的参数结果就出错,而且会堆栈溢出;这个push的时候能指定大小么?还是必须都转成int型之后才能push? push的原理是什么?我可不可以把所有的参数按照函数约定的顺序包装到一块内存,然后整个push一次?这样的话还是用push么? |
|
如果已知一个函数的地址,如何调用它?
参数必须一个一个push么?可是va_arg(...)获取变参的时候要知道变量的类型大小?这个只有调用func1的人是知道的,但是func1本身是不知道的,咋办? |
|
如果已知一个函数的地址,如何调用它?
同志们,这么好赚的分数不要让它白白溜掉啊 |
|
|
|
[求助]工作中遇到的一个追求速度的算法,国外有人控制在30秒内,我却要6分钟.
如果没有规律可循的话,我觉得这个靠硬件优化比较靠谱,比如多线程,多磁盘阵列,固态硬盘,提高数据的访问性能。就如同38楼说的那样靠猜边界不能保证数据的正确性。 |
|
[求助]工作中遇到的一个追求速度的算法,国外有人控制在30秒内,我却要6分钟.
这个挺像压缩软件的算法的,不知道说的对不对,建议楼主去看看lwz之类的算法 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值