2
なぜこのコードは "test"を出力しませんか?プロセッサスタックを変更するには?
#include <stdio.h>
#include <stdlib.h>
void foo (void) {
printf("test\n");
}
__declspec(naked)
void bar (void) {
asm {
push 0x000FFFFF
call malloc
pop ecx
push eax
add eax, 0x000EFFFF
mov ecx, esp
mov esp, eax
push ecx
call foo
pop esp
call free
pop ecx
ret
}
}
int main(int argc, char* argv[])
{
bar();
return 0;
}
あなたはおそらく 'printf( "test \ n");'バッファリングの問題がある場合に備えて –
私のためのNice challange。私はかなり長い間、asmでコードを作成しておらず、これをコンパイルするために呼び出し規約で自分自身をリフレッシュしなければなりませんでした。 – Suma