Re: [問題] struct 取值跟宣告
※ 引述《loveflames (咕啾咕啾魔法陣)》之銘言:
struct S{
int a[10];
};
main(){
S test;
test.a[0]=1;
LPVOID x = &test;
__asm mov eax,x;
funA();
}
funcA(){
S* lps;
__asm mov lps,eax
printf("test.a[0]=%x\n",lps->a[0]);
}
如果像這樣呢
: 不用參數的取法
: #include <stdio.h>
: struct S{
: int a[10];
: };
: void funcA(){
: int a;
: __asm{
: mov edx,[ebp]
: mov ebx,[edx-40]//如果compiler有對齊之類的就未必是40
: mov a,ebx
: }
: printf("test.a[0]=%x\n",a);
: }
: main(){
: struct S test;
: test.a[0]=1;
: funcA();
: }
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.78.26
推
10/15 13:18, , 1F
10/15 13:18, 1F
推
10/15 13:20, , 2F
10/15 13:20, 2F
推
10/15 17:07, , 3F
10/15 17:07, 3F
推
10/16 09:57, , 4F
10/16 09:57, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):