O'Reilly logo

Windows Debugging: Practical Foundations by Dmitry Vostokov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Function Parameters

"FunctionParameters" Project

In this chapter we learn how a caller function passes its parameters via stack memory and how a callee (the called function) accesses them. We will use the following project that can be downloaded from this ftp location:

ftp://dumpanalysis.org/pub/WDPF/Chapter11/

Here is the project source code:

// FunctionParameters.cpp
int arithmetic (int a, int b);
int main(int argc, char* argv[])
{
       int result = arithmetic (1, 1);
       return 0;
}

// Arithmetic.cpp
int arithmetic (int a, int b)
{
       b = b + a;
       ++a;
       b = a * b;
       return b;
}

Stack Structure

Recall from the previous chapter that EBP register is used to address stack memory locations. This was illustrated on Picture 10.1. Here we provide an example of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required