C program that, after compiling and linking, results in an EXE file that contains an edata section?2019 Community Moderator ElectionWhat is the smallest possible Windows (PE) executable?When is assembly faster than C?What REALLY happens when you don't free after malloc?Improve INSERT-per-second performance of SQLite?Names of source shared libraries for imported symbols in ELF formatDifference between shared objects (.so), static libraries (.a), and DLL's (.so)?How binary file can be portable in C programming?Unresolved Reference when linking compiled code with NASM and MSVCExecutable Section Headers - Meaning and use?Role of the Dll name specified in the .edata section of a Dll

Russian cases: A few examples, I'm really confused

In-house repeater?

What is the greatest age difference between a married couple in Tanach?

How to write cleanly even if my character uses expletive language?

Be in awe of my brilliance!

Have researchers managed to "reverse time"? If so, what does that mean for physics?

Replacing Windows 7 security updates with anti-virus?

Humanity loses the vast majority of its technology, information, and population in the year 2122. How long does it take to rebuild itself?

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

How is the Swiss post e-voting system supposed to work, and how was it wrong?

Calculus II Professor will not accept my correct integral evaluation that uses a different method, should I bring this up further?

Am I not good enough for you?

Why did it take so long to abandon sail after steamships were demonstrated?

Life insurance that covers only simultaneous/dual deaths

It's a yearly task, alright

Using "wallow" verb with object

Brexit - No Deal Rejection

Validating user input

Professor being mistaken for a grad student

Why do Australian milk farmers need to protest supermarkets' milk price?

Old race car problem/puzzle

PlotLabels with equations not expressions

How to answer questions about my characters?

Why is "das Weib" grammatically neuter?



C program that, after compiling and linking, results in an EXE file that contains an edata section?



2019 Community Moderator ElectionWhat is the smallest possible Windows (PE) executable?When is assembly faster than C?What REALLY happens when you don't free after malloc?Improve INSERT-per-second performance of SQLite?Names of source shared libraries for imported symbols in ELF formatDifference between shared objects (.so), static libraries (.a), and DLL's (.so)?How binary file can be portable in C programming?Unresolved Reference when linking compiled code with NASM and MSVCExecutable Section Headers - Meaning and use?Role of the Dll name specified in the .edata section of a Dll










1















I am reviewing the Microsoft specification on Portable Executable files (EXE files). In particular, I am reviewing the .edata (export data) section. Here's what the specification says about the edata section:




The export data section, named .edata, contains information about
symbols that other images can access through dynamic linking. Exported
symbols are generally found in DLLs, but DLLs can also import symbols.




Can a non-DLL file have an edata section? Specifically, can a C program, after compiling and linking, result in an EXE file that contains an edata section? If yes, would you show a simple C program that, after compiling and linking, results in an EXE file that contains an edata section, please?










share|improve this question






















  • at first section name not play any role at all. and any PE can have export table, in what is problem ?

    – RbMm
    Mar 7 at 17:34











  • The export data section, named .edata - this is wrong. IMAGE_EXPORT_DIRECTORY data directory not a section, can belong to any section with any name

    – RbMm
    Mar 7 at 17:36















1















I am reviewing the Microsoft specification on Portable Executable files (EXE files). In particular, I am reviewing the .edata (export data) section. Here's what the specification says about the edata section:




The export data section, named .edata, contains information about
symbols that other images can access through dynamic linking. Exported
symbols are generally found in DLLs, but DLLs can also import symbols.




Can a non-DLL file have an edata section? Specifically, can a C program, after compiling and linking, result in an EXE file that contains an edata section? If yes, would you show a simple C program that, after compiling and linking, results in an EXE file that contains an edata section, please?










share|improve this question






















  • at first section name not play any role at all. and any PE can have export table, in what is problem ?

    – RbMm
    Mar 7 at 17:34











  • The export data section, named .edata - this is wrong. IMAGE_EXPORT_DIRECTORY data directory not a section, can belong to any section with any name

    – RbMm
    Mar 7 at 17:36













1












1








1








I am reviewing the Microsoft specification on Portable Executable files (EXE files). In particular, I am reviewing the .edata (export data) section. Here's what the specification says about the edata section:




The export data section, named .edata, contains information about
symbols that other images can access through dynamic linking. Exported
symbols are generally found in DLLs, but DLLs can also import symbols.




Can a non-DLL file have an edata section? Specifically, can a C program, after compiling and linking, result in an EXE file that contains an edata section? If yes, would you show a simple C program that, after compiling and linking, results in an EXE file that contains an edata section, please?










share|improve this question














I am reviewing the Microsoft specification on Portable Executable files (EXE files). In particular, I am reviewing the .edata (export data) section. Here's what the specification says about the edata section:




The export data section, named .edata, contains information about
symbols that other images can access through dynamic linking. Exported
symbols are generally found in DLLs, but DLLs can also import symbols.




Can a non-DLL file have an edata section? Specifically, can a C program, after compiling and linking, result in an EXE file that contains an edata section? If yes, would you show a simple C program that, after compiling and linking, results in an EXE file that contains an edata section, please?







c compilation executable portable-executable






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 12:10









Roger CostelloRoger Costello

1,27111225




1,27111225












  • at first section name not play any role at all. and any PE can have export table, in what is problem ?

    – RbMm
    Mar 7 at 17:34











  • The export data section, named .edata - this is wrong. IMAGE_EXPORT_DIRECTORY data directory not a section, can belong to any section with any name

    – RbMm
    Mar 7 at 17:36

















  • at first section name not play any role at all. and any PE can have export table, in what is problem ?

    – RbMm
    Mar 7 at 17:34











  • The export data section, named .edata - this is wrong. IMAGE_EXPORT_DIRECTORY data directory not a section, can belong to any section with any name

    – RbMm
    Mar 7 at 17:36
















at first section name not play any role at all. and any PE can have export table, in what is problem ?

– RbMm
Mar 7 at 17:34





at first section name not play any role at all. and any PE can have export table, in what is problem ?

– RbMm
Mar 7 at 17:34













The export data section, named .edata - this is wrong. IMAGE_EXPORT_DIRECTORY data directory not a section, can belong to any section with any name

– RbMm
Mar 7 at 17:36





The export data section, named .edata - this is wrong. IMAGE_EXPORT_DIRECTORY data directory not a section, can belong to any section with any name

– RbMm
Mar 7 at 17:36












1 Answer
1






active

oldest

votes


















3














Any PE Image file may contain an export table, regardless of whether it is an EXE or DLL. However, the export tables are not necessarily contained within an .edata section. It is, for example, common to see export tables in the .rdata section instead.



To locate the export table, you should use the Export Table data directory, and not rely on the Section Table at all.



The following is an example C program that, when compiled, will produce an EXE with an export table. However, it might not be placed inside an .edata section (and the EXE might not have an .edata section at all).



#include <stdio.h>

__declspec(dllexport) void some_func(void)

printf("Hellon");
return;


int main()

return 0;




When I compile this program using Visual Studio 2017 on my system, and run dumpbin /HEADERS /EXPORTS on the resulting EXE, I see the following:



...

SECTION HEADER #3
.rdata name
2A94 virtual size
19000 virtual address (0000000140019000 to 000000014001BA93)
2C00 size of raw data
7E00 file pointer to raw data (00007E00 to 0000A9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

...


Section contains the following exports for SampleApp.exe

00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 0001108C some_func = @ILT+135(some_func)


which confirms that the Export Table was put in the .rdata section in this case.






share|improve this answer

























  • Thank you @Erlend Graff - awesome!

    – Roger Costello
    Mar 7 at 22:30










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043473%2fc-program-that-after-compiling-and-linking-results-in-an-exe-file-that-contain%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Any PE Image file may contain an export table, regardless of whether it is an EXE or DLL. However, the export tables are not necessarily contained within an .edata section. It is, for example, common to see export tables in the .rdata section instead.



To locate the export table, you should use the Export Table data directory, and not rely on the Section Table at all.



The following is an example C program that, when compiled, will produce an EXE with an export table. However, it might not be placed inside an .edata section (and the EXE might not have an .edata section at all).



#include <stdio.h>

__declspec(dllexport) void some_func(void)

printf("Hellon");
return;


int main()

return 0;




When I compile this program using Visual Studio 2017 on my system, and run dumpbin /HEADERS /EXPORTS on the resulting EXE, I see the following:



...

SECTION HEADER #3
.rdata name
2A94 virtual size
19000 virtual address (0000000140019000 to 000000014001BA93)
2C00 size of raw data
7E00 file pointer to raw data (00007E00 to 0000A9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

...


Section contains the following exports for SampleApp.exe

00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 0001108C some_func = @ILT+135(some_func)


which confirms that the Export Table was put in the .rdata section in this case.






share|improve this answer

























  • Thank you @Erlend Graff - awesome!

    – Roger Costello
    Mar 7 at 22:30















3














Any PE Image file may contain an export table, regardless of whether it is an EXE or DLL. However, the export tables are not necessarily contained within an .edata section. It is, for example, common to see export tables in the .rdata section instead.



To locate the export table, you should use the Export Table data directory, and not rely on the Section Table at all.



The following is an example C program that, when compiled, will produce an EXE with an export table. However, it might not be placed inside an .edata section (and the EXE might not have an .edata section at all).



#include <stdio.h>

__declspec(dllexport) void some_func(void)

printf("Hellon");
return;


int main()

return 0;




When I compile this program using Visual Studio 2017 on my system, and run dumpbin /HEADERS /EXPORTS on the resulting EXE, I see the following:



...

SECTION HEADER #3
.rdata name
2A94 virtual size
19000 virtual address (0000000140019000 to 000000014001BA93)
2C00 size of raw data
7E00 file pointer to raw data (00007E00 to 0000A9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

...


Section contains the following exports for SampleApp.exe

00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 0001108C some_func = @ILT+135(some_func)


which confirms that the Export Table was put in the .rdata section in this case.






share|improve this answer

























  • Thank you @Erlend Graff - awesome!

    – Roger Costello
    Mar 7 at 22:30













3












3








3







Any PE Image file may contain an export table, regardless of whether it is an EXE or DLL. However, the export tables are not necessarily contained within an .edata section. It is, for example, common to see export tables in the .rdata section instead.



To locate the export table, you should use the Export Table data directory, and not rely on the Section Table at all.



The following is an example C program that, when compiled, will produce an EXE with an export table. However, it might not be placed inside an .edata section (and the EXE might not have an .edata section at all).



#include <stdio.h>

__declspec(dllexport) void some_func(void)

printf("Hellon");
return;


int main()

return 0;




When I compile this program using Visual Studio 2017 on my system, and run dumpbin /HEADERS /EXPORTS on the resulting EXE, I see the following:



...

SECTION HEADER #3
.rdata name
2A94 virtual size
19000 virtual address (0000000140019000 to 000000014001BA93)
2C00 size of raw data
7E00 file pointer to raw data (00007E00 to 0000A9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

...


Section contains the following exports for SampleApp.exe

00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 0001108C some_func = @ILT+135(some_func)


which confirms that the Export Table was put in the .rdata section in this case.






share|improve this answer















Any PE Image file may contain an export table, regardless of whether it is an EXE or DLL. However, the export tables are not necessarily contained within an .edata section. It is, for example, common to see export tables in the .rdata section instead.



To locate the export table, you should use the Export Table data directory, and not rely on the Section Table at all.



The following is an example C program that, when compiled, will produce an EXE with an export table. However, it might not be placed inside an .edata section (and the EXE might not have an .edata section at all).



#include <stdio.h>

__declspec(dllexport) void some_func(void)

printf("Hellon");
return;


int main()

return 0;




When I compile this program using Visual Studio 2017 on my system, and run dumpbin /HEADERS /EXPORTS on the resulting EXE, I see the following:



...

SECTION HEADER #3
.rdata name
2A94 virtual size
19000 virtual address (0000000140019000 to 000000014001BA93)
2C00 size of raw data
7E00 file pointer to raw data (00007E00 to 0000A9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

...


Section contains the following exports for SampleApp.exe

00000000 characteristics
FFFFFFFF time date stamp
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 0001108C some_func = @ILT+135(some_func)


which confirms that the Export Table was put in the .rdata section in this case.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 21:27

























answered Mar 7 at 21:15









Erlend GraffErlend Graff

6231117




6231117












  • Thank you @Erlend Graff - awesome!

    – Roger Costello
    Mar 7 at 22:30

















  • Thank you @Erlend Graff - awesome!

    – Roger Costello
    Mar 7 at 22:30
















Thank you @Erlend Graff - awesome!

– Roger Costello
Mar 7 at 22:30





Thank you @Erlend Graff - awesome!

– Roger Costello
Mar 7 at 22:30



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043473%2fc-program-that-after-compiling-and-linking-results-in-an-exe-file-that-contain%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived