Zer0Flag Posted September 6, 2012 Share Posted September 6, 2012 Hello All, I wrote a little paper about reducing the file size of a cpp project. Covers some basic stuff like removing cruntime, merging sections etc.. Hope it helps someone and of course if you have improvements, other techniques or found bugs then feel free to write me. ~Zer0FlagDecrease_WinCppProject_FileSize.pdf 4 Link to comment
aSh Posted September 6, 2012 Share Posted September 6, 2012 A good work, very detailedThank you Link to comment
Aguila Posted September 7, 2012 Share Posted September 7, 2012 I have bookmarked this thread: http://forum.tuts4you.com/topic/20209-msvc2008-removing-msvc-framework-code/There is some more information.What I learned: Using "pragma"s to tweak the output file is much better, because you can combine it with DEFINES. You can fast switch it on or off -> useful for debugging because sometimes this causes some problems. Link to comment
atom0s Posted September 7, 2012 Share Posted September 7, 2012 Just a heads up with your PDF; the option to choose between Multithreaded-DLL and Multithreaded are not present in Express editions of Visual Studio. This is a non-free feature that is only present in the paid versions. Link to comment
Accede Posted September 9, 2012 Share Posted September 9, 2012 Your us /O1 or /O2 i see but if your us /Oxs=Full optimation + small code it makes the result are littel bit more smaller.If your us the command line tools like (cl,link,lib) your can make the result very small.Her an bsp:cl /c /Oxs /W3 mrcore.ccl /c /Oxs /W3 mrarth0.ccl /c /Oxs /W3 mrarth1.ccl /c /Oxs /W3 mrarth2.ccl /c /Oxs /W3 mralloc.ccl /c /Oxs /W3 mrsmall.ccl /c /Oxs /W3 mrio1.ccl /c /Oxs /W3 mrio2.ccl /c /Oxs /W3 mrgcd.ccl /c /Oxs /W3 mrjack.ccl /c /Oxs /W3 mrxgcd.ccl /c /Oxs /W3 mrarth3.ccl /c /Oxs /W3 mrbits.ccl /c /Oxs /W3 mrrand.ccl /c /Oxs /W3 mrprime.ccl /c /Oxs /W3 mrcrt.ccl /c /Oxs /W3 mrscrt.ccl /c /Oxs /W3 mrmonty.ccl /c /Oxs /W3 mrpower.ccl /c /Oxs /W3 mrsroot.ccl /c /Oxs /W3 mrcurve.ccl /c /Oxs /W3 mrfast.ccl /c /Oxs /W3 mrlucas.ccl /c /Oxs /W3 mrzzn2.ccl /c /Oxs /W3 mrzzn2b.ccl /c /Oxs /W3 mrzzn3.ccl /c /Oxs /W3 mrzzn4.ccl /c /Oxs /W3 mrshs.ccl /c /Oxs /W3 mrshs256.ccl /c /Oxs /W3 mrshs512.ccl /c /Oxs /W3 mraes.ccl /c /Oxs /W3 mrgcm.ccl /c /Oxs /W3 mrstrong.ccl /c /Oxs /W3 mrbrick.ccl /c /Oxs /W3 mrebrick.ccl /c /Oxs /W3 mrgf2m.ccl /c /Oxs /W3 mrec2m.ccl /c /Oxs /W3 mrecn2.ccl /c /Oxs /W3 mrflash.ccl /c /Oxs /W3 mrfrnd.ccl /c /Oxs /W3 mrdouble.ccl /c /Oxs /W3 mrround.ccl /c /Oxs /W3 mrbuild.ccl /c /Oxs /W3 mrflsh1.ccl /c /Oxs /W3 mrpi.ccl /c /Oxs /W3 mrflsh2.ccl /c /Oxs /W3 mrflsh3.ccl /c /Oxs /W3 mrflsh4.ccl /c /Oxs /W3 mrkcm.ccl /c /Oxs /W3 mrcomba2.ccopy mrmuldv.w64 mrmuldv.ccl /c /Oxs /W3 mrmuldv.cThe result for this is about 361kb for the lib.If your make the same with vc with out the command line tools your get for the same lib this result:1 - 2 mb Link to comment
R4ndom Posted September 10, 2012 Share Posted September 10, 2012 I had been working on a tutorial for this very subject for a couple weeks now, and after seeing your article (which is very good, btw) I decided to finish mine. It is more detailed than yours (I wanted to see how the various options affected the actual disassembly in OllyDBG) and the pictures have been translated to English. Hope you enjoy.../>http://thelegendofrandom.com/blog/archives/2231 Link to comment
kao Posted September 11, 2012 Share Posted September 11, 2012 ..and one more tutorial on the same subject: http://hooked-on-mne...or-cleaner.html 1 Link to comment
hmi222 Posted September 18, 2012 Share Posted September 18, 2012 @Zer0FlagThanx for this excellent tutorial.Will test in detail.Btw. did yu test to use crinkler with the shrinked exe? Link to comment
Zer0Flag Posted September 18, 2012 Author Share Posted September 18, 2012 @hmi222Thanks, no I didnĀ“t test any packer to see if it get even smaller. Since the goal of this was to show how you can decrease the file size using compiler and linker settings. But you can use ASM to shrink it until you reach 92bytes or something. If you are interested in this you should take a look in google for "tiny pe".~Zer0Flag Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now