I'm getting this error:
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.
I don't know how to solve it, can anyone help me?
My code is:
#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
}
}
how can i do what it asked? i tried to do push ebp and pop at the end with no luck.