Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:16:05+00:00 2026-06-04T20:16:05+00:00

I am just learning Assembler and debugging skills in OllyDbg in order to learn

  • 0

I am just learning Assembler and debugging skills in OllyDbg in order to learn how to use undocumented functions. Now I am having the following problem:

I have the following code part (from OllyDbg):

MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
MOV EAX, DWORD PTR SS:[EBP+8]
XOR EDX,EDX
LEA ECX, DWORD PTR DS:[EAX+4]
MOV DWORD PTR DS:[EAX], EDX
MOV DWORD PTR DS:[ECX+4],ECX
MOV DWORD PTR DS:[ECX],ECX
MOV DWORD PTR DS:[EAX+C],ECX
MOV ECX, DWORD PTR SS:[EBP+C]

This is the beginning of the function and the goal is to find the data structure. So I figured out that it first pushes the EBP on the stack and then move the ESP (current stack pointer) to EBP where I think it now defines a stack frame for the function. Now the tutorial says that in the popular layout the first argument is placed at [EBP+8] and the second at [EBP+C]

This is what I do not understand. How do I know that the first parameter is placed at EBP+8 ?

Hopefully someone can help me!
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:16:06+00:00Added an answer on June 4, 2026 at 8:16 pm

    What kind of “undocumented functions” do you mean? Assembly is just compiled high-level code most of the time. There’s hardly anything “undocumented” about it.

    EBP is most often used as the stack frame pointer in functions, most notably in the C calling convention (also known by the name cdecl). With this convention, the parameters are passed on the stack in reverse order (e.g. the last parameter is pushed first), and the called function uses EBP to access them. Based on the code you posted, I think the data structure might be pointed to by the first parameter. Have a look :

    MOV EAX, DWORD PTR SS:[EBP+8]
    LEA ECX, DWORD PTR DS:[EAX+4]
    MOV DWORD PTR DS:[EAX], EDX
    MOV DWORD PTR DS:[ECX+4],ECX
    MOV DWORD PTR DS:[ECX],ECX
    MOV DWORD PTR DS:[EAX+C],ECX
    MOV ECX, DWORD PTR SS:[EBP+C]
    

    The first instruction moves the first argument into EAX. Then an offset of 4 is added to that argument and moved into ECX. Note that this is done by the LEA instruction, which is shorthand for “Load Effective Address”. It is used for unsigned arithmetic and compilers like to use it when doing pointer arithmetic and adding offsets – so whenever you see this instruction, you should be alarmed that whatever it operates on might be a pointer to a structure. Of course, there’s no way to know for sure. Later on we have some MOVs to and from that address, where ECX is used to access memory. The structures, if they exist, would look something like this in C :

    struct a { /* pointed to by EAX / [EBP+8] */
        int memb1; /* MOV DWORD PTR DS:[EAX], EDX */
        struct b* memb2; /* LEA ECX, DWORD PTR DS:[EAX+4] */
        int memb3; /* unused? */
        int memb4; /* MOV DWORD PTR DS:[EAX+C],ECX */
    };
    
    struct b {
        int memb1; /* MOV DWORD PTR DS:[ECX],ECX */
        int memb2; /* MOV DWORD PTR DS:[ECX+4],ECX */
    };
    

    Hope this clears things up somehow. Reverse-engineering assembly code is a very hard and time-consuming task, especially if you don’t have any API calls which would tell you the type of arguments used by the application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just learning Silverlight 4/RIA and i 'm stuck in a weird problem: setup an
I am just learning how to use Terracotta after discovering it about a month
I'm just learning about SproutCore now, seems great. But I can't find a good
I am learning assembler, and found some the following surprising. I essentially copied some
Just started learning x64 assembly and I have a question about functions, arguments, and
I am learning x86 assembler in order to write a compiler. In particular, I'm
Just learning C#, radiobuttons and checkboxes. No urgency. The code works to display the
Im just learning mod_rewrite and regex stuff, and what I'm trying to do is
Im just learning SQLite and I can't get my parameters to compile into the
I'm just learning DDD (Eric Evans book is open in front of me) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.