PE Loading: What to do with resource section?When Resources of a PE file are loadedQuestions Regarding DLL Loading in a Process Address SpaceFailed to load the JNI shared Library (JDK)Discarding DLL's resource after using itWhen Resources of a PE file are loadedPE File sections - SizeOfRawData or VirtualSizeSize of exe file vs available memoryWhat parts of a PE file are mapped into memory by the MS loader?How and where is the heap allocated in regards to a portable executable on Windows NT/10?Does ELF or PE loader support sections for GPUs, or some OS have any plans in implementing this functionality?Why does a loaded PE binary need IAT?

Checkmate in 1 on a Tangled Board

How do I tell the reader that my character is autistic in Fantasy?

How do I ensure my employees don't abuse my flexible work hours policy?

Why was Pan Am Flight 103 flying over Lockerbie?

Missing root certificates on Windows Server 2016 (fresh install)

Cooking a nice pan seared steak for picky eaters

Reusable spacecraft: why still have fairings detach, instead of open/close?

Simple logic puzzle

Can I use Alchemist's fire to turn my sword into a virtual Flame Blade?

If I were to build a J3 cub twice the size of the original using the same CG would it fly?

Bin Packing with Relational Penalization

List Manipulation : a,b,c,d,e,f,g,h into a,b,c,d,e,f,g,h

Why is it important to have a receptacle next to load centers?

Compiling all Exception messages into a string

What is the proper markup for a Math operator in boldface?

Conference in Los Angeles, visa?

What European countries have secret voting within the Legislature?

How can I know if a PDF file was created via LaTeX or XeLaTeX?

Why would anyone even use a Portkey?

Can European countries bypass the EU and make their own individual trade deal with the U.S.?

A quine of sorts

Converting Geographic Coordinates into Lambert2008 coordinates

Adjective for 'made of pus' or 'corrupted by pus' or something of something of pus

I just started should I accept a farewell lunch for a coworker I don't know?



PE Loading: What to do with resource section?


When Resources of a PE file are loadedQuestions Regarding DLL Loading in a Process Address SpaceFailed to load the JNI shared Library (JDK)Discarding DLL's resource after using itWhen Resources of a PE file are loadedPE File sections - SizeOfRawData or VirtualSizeSize of exe file vs available memoryWhat parts of a PE file are mapped into memory by the MS loader?How and where is the heap allocated in regards to a portable executable on Windows NT/10?Does ELF or PE loader support sections for GPUs, or some OS have any plans in implementing this functionality?Why does a loaded PE binary need IAT?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm studying PE file format and how windows loads them. I already know about most sections and how they get loaded/mapped in memory. But I have no idea what happens to resource section since all addresses in there seem to be sequential and doesn't seem to need any change.



I've made a test loader that does the basic loading but the target .exe file has resources in it and they never get loaded.










share|improve this question






















  • Doesn't it happen on demand when the program attempts to load resources?

    – David Heffernan
    Mar 25 at 15:21











  • not need any special processing. @DavidHeffernan - no, resourse mapped to memory when pe loaded. LoadResource not actually load any data, but return address in memory where resource already mapped.

    – RbMm
    Mar 25 at 15:58











  • @RbMm That's a yes then, the virtual memory system loads the data on page fault when first accessed

    – David Heffernan
    Mar 25 at 16:03











  • @DavidHeffernan It might not need any manual mapping if the PE is loaded at default address (0x00400000). But since the PE could load at any virtual address manually, LoadIcon and friends won't ever find the resource at expected location.

    – MadZarx
    Mar 25 at 17:40






  • 1





    What you are talking about there is not mapping. You are talking about relocations. Resources don't need relocations. You need to read up on what mapping is.

    – David Heffernan
    Mar 25 at 18:41

















0















I'm studying PE file format and how windows loads them. I already know about most sections and how they get loaded/mapped in memory. But I have no idea what happens to resource section since all addresses in there seem to be sequential and doesn't seem to need any change.



I've made a test loader that does the basic loading but the target .exe file has resources in it and they never get loaded.










share|improve this question






















  • Doesn't it happen on demand when the program attempts to load resources?

    – David Heffernan
    Mar 25 at 15:21











  • not need any special processing. @DavidHeffernan - no, resourse mapped to memory when pe loaded. LoadResource not actually load any data, but return address in memory where resource already mapped.

    – RbMm
    Mar 25 at 15:58











  • @RbMm That's a yes then, the virtual memory system loads the data on page fault when first accessed

    – David Heffernan
    Mar 25 at 16:03











  • @DavidHeffernan It might not need any manual mapping if the PE is loaded at default address (0x00400000). But since the PE could load at any virtual address manually, LoadIcon and friends won't ever find the resource at expected location.

    – MadZarx
    Mar 25 at 17:40






  • 1





    What you are talking about there is not mapping. You are talking about relocations. Resources don't need relocations. You need to read up on what mapping is.

    – David Heffernan
    Mar 25 at 18:41













0












0








0








I'm studying PE file format and how windows loads them. I already know about most sections and how they get loaded/mapped in memory. But I have no idea what happens to resource section since all addresses in there seem to be sequential and doesn't seem to need any change.



I've made a test loader that does the basic loading but the target .exe file has resources in it and they never get loaded.










share|improve this question














I'm studying PE file format and how windows loads them. I already know about most sections and how they get loaded/mapped in memory. But I have no idea what happens to resource section since all addresses in there seem to be sequential and doesn't seem to need any change.



I've made a test loader that does the basic loading but the target .exe file has resources in it and they never get loaded.







windows winapi portable-executable






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 14:55









MadZarxMadZarx

381 silver badge5 bronze badges




381 silver badge5 bronze badges












  • Doesn't it happen on demand when the program attempts to load resources?

    – David Heffernan
    Mar 25 at 15:21











  • not need any special processing. @DavidHeffernan - no, resourse mapped to memory when pe loaded. LoadResource not actually load any data, but return address in memory where resource already mapped.

    – RbMm
    Mar 25 at 15:58











  • @RbMm That's a yes then, the virtual memory system loads the data on page fault when first accessed

    – David Heffernan
    Mar 25 at 16:03











  • @DavidHeffernan It might not need any manual mapping if the PE is loaded at default address (0x00400000). But since the PE could load at any virtual address manually, LoadIcon and friends won't ever find the resource at expected location.

    – MadZarx
    Mar 25 at 17:40






  • 1





    What you are talking about there is not mapping. You are talking about relocations. Resources don't need relocations. You need to read up on what mapping is.

    – David Heffernan
    Mar 25 at 18:41

















  • Doesn't it happen on demand when the program attempts to load resources?

    – David Heffernan
    Mar 25 at 15:21











  • not need any special processing. @DavidHeffernan - no, resourse mapped to memory when pe loaded. LoadResource not actually load any data, but return address in memory where resource already mapped.

    – RbMm
    Mar 25 at 15:58











  • @RbMm That's a yes then, the virtual memory system loads the data on page fault when first accessed

    – David Heffernan
    Mar 25 at 16:03











  • @DavidHeffernan It might not need any manual mapping if the PE is loaded at default address (0x00400000). But since the PE could load at any virtual address manually, LoadIcon and friends won't ever find the resource at expected location.

    – MadZarx
    Mar 25 at 17:40






  • 1





    What you are talking about there is not mapping. You are talking about relocations. Resources don't need relocations. You need to read up on what mapping is.

    – David Heffernan
    Mar 25 at 18:41
















Doesn't it happen on demand when the program attempts to load resources?

– David Heffernan
Mar 25 at 15:21





Doesn't it happen on demand when the program attempts to load resources?

– David Heffernan
Mar 25 at 15:21













not need any special processing. @DavidHeffernan - no, resourse mapped to memory when pe loaded. LoadResource not actually load any data, but return address in memory where resource already mapped.

– RbMm
Mar 25 at 15:58





not need any special processing. @DavidHeffernan - no, resourse mapped to memory when pe loaded. LoadResource not actually load any data, but return address in memory where resource already mapped.

– RbMm
Mar 25 at 15:58













@RbMm That's a yes then, the virtual memory system loads the data on page fault when first accessed

– David Heffernan
Mar 25 at 16:03





@RbMm That's a yes then, the virtual memory system loads the data on page fault when first accessed

– David Heffernan
Mar 25 at 16:03













@DavidHeffernan It might not need any manual mapping if the PE is loaded at default address (0x00400000). But since the PE could load at any virtual address manually, LoadIcon and friends won't ever find the resource at expected location.

– MadZarx
Mar 25 at 17:40





@DavidHeffernan It might not need any manual mapping if the PE is loaded at default address (0x00400000). But since the PE could load at any virtual address manually, LoadIcon and friends won't ever find the resource at expected location.

– MadZarx
Mar 25 at 17:40




1




1





What you are talking about there is not mapping. You are talking about relocations. Resources don't need relocations. You need to read up on what mapping is.

– David Heffernan
Mar 25 at 18:41





What you are talking about there is not mapping. You are talking about relocations. Resources don't need relocations. You need to read up on what mapping is.

– David Heffernan
Mar 25 at 18:41












1 Answer
1






active

oldest

votes


















2














According to PE Format




It is important to recognize that PE files are not loaded into memory as single memory mapping files.Windows loader (also known as PE loader) traverses PE files and decides which part of the file is mapped. This mapping method maps the higher offset of the file to the higher memory address. PE file structure is basically the same in disk and memory, but it is not completely copied when loaded into memory. The Windows loader decides which parts to load and which parts do not need to be loaded. Moreover, due to the inconsistency between disk alignment and memory alignment, the distribution of PE files loaded into memory will be different from that of PE files on disk.




Here is a picture :application loaded into memory



Memory mapping picture



The base address value is set by PE file itself. According to the default settings, the EXE file established by visual c++ has the base address of 00400000h and the base address of DLL file is 10000000h. However, you can change this address when creating an application by using the connector / BASE option when connecting to the application, or by setting it up through the REBASE application after linking.



In addition, this question is similar to what you asked. You can refer to it.



When Resources of a PE file are loaded






share|improve this answer






















    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%2f55340622%2fpe-loading-what-to-do-with-resource-section%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









    2














    According to PE Format




    It is important to recognize that PE files are not loaded into memory as single memory mapping files.Windows loader (also known as PE loader) traverses PE files and decides which part of the file is mapped. This mapping method maps the higher offset of the file to the higher memory address. PE file structure is basically the same in disk and memory, but it is not completely copied when loaded into memory. The Windows loader decides which parts to load and which parts do not need to be loaded. Moreover, due to the inconsistency between disk alignment and memory alignment, the distribution of PE files loaded into memory will be different from that of PE files on disk.




    Here is a picture :application loaded into memory



    Memory mapping picture



    The base address value is set by PE file itself. According to the default settings, the EXE file established by visual c++ has the base address of 00400000h and the base address of DLL file is 10000000h. However, you can change this address when creating an application by using the connector / BASE option when connecting to the application, or by setting it up through the REBASE application after linking.



    In addition, this question is similar to what you asked. You can refer to it.



    When Resources of a PE file are loaded






    share|improve this answer



























      2














      According to PE Format




      It is important to recognize that PE files are not loaded into memory as single memory mapping files.Windows loader (also known as PE loader) traverses PE files and decides which part of the file is mapped. This mapping method maps the higher offset of the file to the higher memory address. PE file structure is basically the same in disk and memory, but it is not completely copied when loaded into memory. The Windows loader decides which parts to load and which parts do not need to be loaded. Moreover, due to the inconsistency between disk alignment and memory alignment, the distribution of PE files loaded into memory will be different from that of PE files on disk.




      Here is a picture :application loaded into memory



      Memory mapping picture



      The base address value is set by PE file itself. According to the default settings, the EXE file established by visual c++ has the base address of 00400000h and the base address of DLL file is 10000000h. However, you can change this address when creating an application by using the connector / BASE option when connecting to the application, or by setting it up through the REBASE application after linking.



      In addition, this question is similar to what you asked. You can refer to it.



      When Resources of a PE file are loaded






      share|improve this answer

























        2












        2








        2







        According to PE Format




        It is important to recognize that PE files are not loaded into memory as single memory mapping files.Windows loader (also known as PE loader) traverses PE files and decides which part of the file is mapped. This mapping method maps the higher offset of the file to the higher memory address. PE file structure is basically the same in disk and memory, but it is not completely copied when loaded into memory. The Windows loader decides which parts to load and which parts do not need to be loaded. Moreover, due to the inconsistency between disk alignment and memory alignment, the distribution of PE files loaded into memory will be different from that of PE files on disk.




        Here is a picture :application loaded into memory



        Memory mapping picture



        The base address value is set by PE file itself. According to the default settings, the EXE file established by visual c++ has the base address of 00400000h and the base address of DLL file is 10000000h. However, you can change this address when creating an application by using the connector / BASE option when connecting to the application, or by setting it up through the REBASE application after linking.



        In addition, this question is similar to what you asked. You can refer to it.



        When Resources of a PE file are loaded






        share|improve this answer













        According to PE Format




        It is important to recognize that PE files are not loaded into memory as single memory mapping files.Windows loader (also known as PE loader) traverses PE files and decides which part of the file is mapped. This mapping method maps the higher offset of the file to the higher memory address. PE file structure is basically the same in disk and memory, but it is not completely copied when loaded into memory. The Windows loader decides which parts to load and which parts do not need to be loaded. Moreover, due to the inconsistency between disk alignment and memory alignment, the distribution of PE files loaded into memory will be different from that of PE files on disk.




        Here is a picture :application loaded into memory



        Memory mapping picture



        The base address value is set by PE file itself. According to the default settings, the EXE file established by visual c++ has the base address of 00400000h and the base address of DLL file is 10000000h. However, you can change this address when creating an application by using the connector / BASE option when connecting to the application, or by setting it up through the REBASE application after linking.



        In addition, this question is similar to what you asked. You can refer to it.



        When Resources of a PE file are loaded







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 8:17









        Strive Sun - MSFTStrive Sun - MSFT

        5501 silver badge8 bronze badges




        5501 silver badge8 bronze badges


















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            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%2f55340622%2fpe-loading-what-to-do-with-resource-section%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

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현