2
我得到這個錯誤:內聯彙編,誤差
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
我不知道如何解決這個問題,誰能幫助我?
我的代碼是:
#include "common.h"
char* file = "c:\\town.las";
char* file_mode = "r";
#pragma pack(1)
struct LASHEADER
{
char LASF[4];
};
void main()
{
LASHEADER lasHeader;
FILE* of;
__asm
{
push ebp
mov eax, file_mode
push eax
push file
call fopen
mov of, eax
mov esi, esp
mov eax, DWORD PTR of
push eax
push 1
push 4 // this should be sizeof LASHEADER
lea ecx, DWORD PTR lasHeader
push ecx
call DWORD PTR fread
add esp, 16
cmp esi, esp
mov eax, of
push eax
call fclose
}
}
我如何能做到什麼要求?我試圖在沒有運氣的情況下推動ebp和流行音樂。
你錯過了一個'推eax' :) – Jester
@Jester有一個無用的負荷EAX和推動,當推恆定是可能的,所以我取代了它。那是你的意思嗎? – Gene
謝謝,它清除了一點,但我現在得到一個新的錯誤「運行時檢查失敗#2 - 圍繞變量'lasHeader'堆棧已損壞。」但我會嘗試你的建議。 – Dean