Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

The value of ESP was not properly saved across a function call...

Featured Replies

LOL Aight, Im Kinda Not The Best At This Stuff. BUT It Deals With Assembly From OllyDBG And A Game Called GunZ.

Im Trying To Figure Out A Way To Get This

typedef void (__cdecl* ZChatOutputFunction)(const char* lpcMsg, int iType,int iLoc,DWORD dwColor);

ZChatOutputFunction ZChatOutput = (ZChatOutputFunction)ZChat;

void EchoOutput(const char *szMsg, ...)

{

char szBuf[0x4000];

va_list vaArgs;

va_start(vaArgs, szMsg);

_vsnprintf(szBuf, sizeof(szBuf), szMsg, vaArgs);

va_end(vaArgs);

ZChatOutput(szBuf, 2, 0, 0xFFFFFFFF);//ZChatOutput You Get From An Address In OllyDBG, That Works...

}

To Work In Inline asm

Like So

#define ZChatOutput 0x0042ABC0;//This Is The Address

void Echo(const char *szMsg, ...){

_asm{

pushad

PUSH eax

mov eax,ZChatOutput

PUSH 0xFFFFFFFF

PUSH 0

PUSH 2

PUSH szMsg

call eax

pop eax

popad

}}

Now... It Works, Somewhat

It Outputs A Sample Message Lets Say When I Call It Like So

Echo("Hello, This Is Testing ZChatOutput!");

It Outputs That String In-Game

But Then A Second Later It Crashes, And I Get This Message [image Attached]

The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with calling convention with a function pointer declared with a different calling convention.

errorvu8.png

Any Help is Appreciated!

Thanks~

-Marneus901

When I see code like that, it reminds me that you can have buffer overrun issues when using char *, and also, you should really be using stdcall instead of a C calling convention (like you are doing). It would be interesting for you to try and have it compile in VS 2005 or 2008.

  • Author

Well The Thing Is, I Want To Use Inline asm, Not The Calling Conventions. With The Inline asm, I Have No Calling Conventions, It Works Like I Said, It Outputs, Then Gives Me That ESP Error >.>

So, It Shouldnt* Have To Deal With The Calling Conventions.

An Example Of Perfect Working Code Is

void SetAP(){
if(InGame()){//Check If In Game So We Dont Crash
_asm{
mov ecx,MyZChar //Get Our Character ID
mov eax,ZCharacter__SetAPOffset //Get The SetAP Offset
PUSH 999 //Push The Value We Want Our AP At
call eax //And Send To The Offset
}
}
}

It Perfectly Sets My AP, With No Errors. Which Is Weird Why Output Gives Me An Error...

Edited by Marneus901

It is odd, and your initial post of sample code above doesn't have any glaring errors I can see. However, you may want to consider trying to save the register before you go in, and restore it on your way out. It's something you could try, although I'm thinking the compiler should catch it for you.

Again, not sure - it's not obvious what the problem is.

It is odd, and your initial post of sample code above doesn't have any glaring errors I can see. However, you may want to consider trying to save the register before you go in, and restore it on your way out. It's something you could try, although I'm thinking the compiler should catch it for you.

Again, not sure - it's not obvious what the problem is.

Yeah, I told him basically the same thing, I figured it was something with the way the call was returning, since it executes all the code just fine. I myself have only looked at it for a few minutes here and there, but I agree that nothing jumped out at me. I'll have to remember that we have some ASM gurus out there too, been so long since I've used anything besides VBScript or C# that I almost forgot other languages existed.

  • Author

Ok, I Found The Solution, And I Got It To Work.

I Needed To Clean Up The Stack Using

add esp,[# of pushed values * 4]

I Found The Solution Here: http://www.codeproject.com/cpp/calling_con...demystified.asp

The Way It Should Look Like Is Like So

void Echo(const char *szMsg, ...){ 
_asm{
mov eax,ZChatOutput
PUSH 0xFFFFFFFF
PUSH 0
PUSH 2
PUSH szMsg
call eax
add esp,16
}}

I Had To add esp,16, 16 Because 4 Pushed Values * 4 = 16, Hence add esp,16

Thanks For Your Attempts To Help Otherwise!

-Marneus901

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.