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 6900933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:36:36+00:00 2026-05-27T07:36:36+00:00

Below is my attempt to read the machine code pointed to by a function

  • 0

Below is my attempt to read the machine code pointed to by a function pointer and print it. Currently, the data being printed is not the same as the code that is generated… I’ve checked the values of the pointers created in the produced executable and listed by the disassembler (there is a difference between code/debugger) but don’t see anything too troubling, or understand how I might fix the problem.

void dummy();

int _tmain(int argc, _TCHAR* argv[])
{
    int i;

    printf("\nReading dummy...\n");
    for(i = 0; i < 25; i++)
        printf("%.2X ", ((char *)((void *)dummy))[i]);
    puts("");

    dummy();

    getchar();
    return 0;
}

void __declspec(naked) dummy()
{
    __asm
    {
        nop;
        nop;
        nop;
        nop;

        ret;
    }
}
  • 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-05-27T07:36:37+00:00Added an answer on May 27, 2026 at 7:36 am

    Two common mistakes to make here. First off, cast to unsigned char* instead of char*. Next, and the important one, Project + Properties, Linker, General and turn off Incremental Linking.

    With incremental linking enabled, a function address actually points to a little stub that contains nothing but a JMP to the real function. Which allows the linker to replace old code with new code without having to rebuild the entire executable image. Your code is reading that stub instead of the real function when incremental linking is enabled. Proper output:

    Reading dummy...
    90 90 90 90 C3 //... rest is random
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my attempt to iterate a sequence of maps; the code fails due
Below is the code i use to extract data from a table to a
I'm currently using the below code within a winform which is generated and compiled
Below is my current char* to hex string function. I wrote it as an
Below is the code of a simple html with a table layout. In FF
In the code below, the Provider object only has one instance of a DbConnection.
See the code below - I am trying to put a const object into
Im using the following code to read to consumer_key and consumer_secret from config.php, pass
In an attempt to create cleaner code, I am trying to write event handler
I've written a program to accept TCP socket connections (server and client code below)

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.