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

  • Home
  • SEARCH
  • 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 3968136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:48:21+00:00 2026-05-20T03:48:21+00:00

My program is combined with some additional data at the end of the original

  • 0

My program is combined with some additional data at the end of the original exe. The program would extract the additional data to disk when running the program.

However my program can’t get the right offset of the appended data after signing the combined executable program.

I compared the signed exe and the original exe, the signing information is appended at the end of the exe. So I’m looking for a Win32 API to get the length of signing segment from the signed program. After that, my program could find the right offset of combined data, then extract them correctly.

Could anyone give me a hint?

  • 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-20T03:48:22+00:00Added an answer on May 20, 2026 at 3:48 am

    I find a tool named PEDump(written by Matt Pietrek for his book) with source code to demonstrate how to get the size of signing information.

    Below is the code extracted from PEDump for my purpose,

    // MakePtr is a macro that allows you to easily add to values (including
    // pointers) together without dealing with C's pointer arithmetic.  It
    // essentially treats the last two parameters as DWORDs.  The first
    // parameter is used to typecast the result to the appropriate pointer type.
    #define MakePtr( cast, ptr, addValue ) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
    
    // Names of the data directory elements that are defined
    const char *ImageDirectoryNames[] = {
        "EXPORT", "IMPORT", "RESOURCE", "EXCEPTION", "SECURITY", "BASERELOC",
        "DEBUG", "COPYRIGHT", "GLOBALPTR", "TLS", "LOAD_CONFIG",
        "BOUND_IMPORT", "IAT",  // These two entries added for NT 3.51
        "DELAY_IMPORT" };       // This entry added in NT 5
    
    #define NUMBER_IMAGE_DIRECTORY_ENTRYS \
        (sizeof(ImageDirectoryNames)/sizeof(char *))
            HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(getProgramFile()));
            HANDLE hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
            if ( hFileMapping == 0 )
            {
                printf("%s", "Couldn't open file mapping with CreateFileMapping()\n");
            } else {
                LPVOID lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
                if ( lpFileBase == 0 )
                {
                    printf("%s", "Couldn't map view of file with MapViewOfFile()\n");
                } else {
                    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
                    PIMAGE_FILE_HEADER pImgFileHdr = (PIMAGE_FILE_HEADER)lpFileBase;
                    // it's EXE file
                    if ( dosHeader->e_magic == IMAGE_DOS_SIGNATURE )
                    {
                        PIMAGE_NT_HEADERS pNTHeader;
                        DWORD base = (DWORD)dosHeader;
    
                        pNTHeader = MakePtr( PIMAGE_NT_HEADERS, dosHeader, dosHeader->e_lfanew );
    
                        PIMAGE_OPTIONAL_HEADER optionalHeader = (PIMAGE_OPTIONAL_HEADER)&pNTHeader->OptionalHeader;
                        for ( int i=0; i < optionalHeader->NumberOfRvaAndSizes; i++)
                        {
                            // DataDirectory[4] represents security directory
                            if ( 4 == i ) {
                                signingLength = optionalHeader->DataDirectory[i].Size;
                                break;
                            }
                        }
                    }
                    UnmapViewOfFile(lpFileBase);
                }
                CloseHandle(hFileMapping);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What program can I use to decompile a class file? Will I actually get
i have some project, which can be running on databases with different names. I
Most program languages have some kind of exception handling; some languages have return codes,
This app has been running fine for months, but now on iOS4 i get
I have some UUIDs that are being generated in my program at random, but
My situation: I'm running a C# testing program which allows me to configure certain
According to maven site , and some tutorials on the web, mvn archetype:generate would
I've made a little C# tool for monitoring sidebar.exe (as some know there's a
We would like to add DLLs to an install based on some external command
My program processes PDF files and reads some streams out of them. There are

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.