flat assembler
Message board for the users of flat assembler.

Index > Windows > DLL resource only

Author
Thread Post new topic Reply to topic
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 05 Jan 2010, 17:45
I'd like to do to my project an DLL file with resource only. Like menus, bitmaps, icons [and maybe strings]. (I want to free my .exe of get so big)

Can anyone tell me how can I do an DLL resouve only, and use it in my app?

_________________
Sorry if bad english.
Post 05 Jan 2010, 17:45
View user's profile Send private message Reply with quote
score_under



Joined: 27 Aug 2009
Posts: 27
score_under 13 Jan 2010, 10:28
Instead of loading resources from your hInstance or the result of GetModuleHandle(0), load them from the HMODULE of your DLL. (The result of LoadLibrary).
Post 13 Jan 2010, 10:28
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 13 Jan 2010, 16:45
But why? Why's it better to have two files instead of 1? It will actually be bigger since the filesystem has an alignment for files.
Post 13 Jan 2010, 16:45
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 13 Jan 2010, 16:50
Just in case of my .exe get bigger than 2mb (bc of resources), it will run faster if I separate the resources in a dll, don't? So I load only when needed.

ps: 2mb was just a example.
Post 13 Jan 2010, 16:50
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 13 Jan 2010, 17:02
Maybe, you could always just append them to the end of the .exe manually (without being part of a section!) like installers do, which can be really big (gigabytes even). Smile
Post 13 Jan 2010, 17:02
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 13 Jan 2010, 17:05
*_* how??
Post 13 Jan 2010, 17:05
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 13 Jan 2010, 17:15
I don't know how to do it with normal FASM 'format PE' to be honest. But you can append the resources with a simple command after the program is compiled, like:

"copy /B main.exe+resources"

(command line append) -- of course you'll probably have to know the size of your .exe before appending the resources in the source code itself and use it as 'offset' to start reading the resources from, which I don't know if it's possible to get the size of the file with normal 'format PE' FASM -- I use manual macros to make the PE file with 'format binary' where you can get the size.

If it sounds too complicated then go with your method, but should you wish to try this later, maybe to improve yourself, hope it helped. Smile
Post 13 Jan 2010, 17:15
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 13 Jan 2010, 17:21
but how do you load the content of that address? for instance using LoadIcon,0,address? or manually? and you will have to know the size of icon\bitmaps\etc.. seems too complicated.. Exclamation
Post 13 Jan 2010, 17:21
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 13 Jan 2010, 17:50
Well I thought you were talking about 'custom' resources, i.e custom data, not the Windows resources -- because I didn't think Windows resources were so big Question

(obviously I was thinking of 'ReadFile' just like reading any data Very Happy)

_________________
Previously known as The_Grey_Beast
Post 13 Jan 2010, 17:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.