Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

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.

Call c++ member function through asm

Featured Replies

Posted

Hey,

I'm trying to call a c++ class member function through asm. I believe the this param (class id) is passed using ECX in the function call, getting this is no problem. However, when I call the function (with the class id in ECX) the function doesn't crash like before, but it returns incorrect data. I was wondering if anything else needs to be passed to the function or if ECX is infact the class id used to associate data with the caller. Any tips would be appreciated.

If you are getting incorrect data, make sure your params are correct and that you are passing the proper pointer into ECX. As mudlord said, you can do inline ASM inside of C++ using _asm / __asm tags. For calling a class member function something on the line of this should work:

_asm {
push param3
push param2
push param1
lea ECX, [class_ptr]
call member_ptr
}

I'm not great with ASM so don't rely on that to work as I can only give you my assumption. Class calls in C++ internally are done as:

result class::function( class_ptr, param1, param2, param3, ... )

Some good reads about some of this topic:
/>http://www.codeguru.com/cpp/misc/misc/assemblylanguage/article.php/c14641/
/>http://www.codeguru.com/cpp/v-s/tips/debugging/article.php/c14681/
/>http://www.codeguru.com/cpp/v-s/debug/openfaq/article.php/c14799/

Create an account or sign in to comment

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.