Posted September 6, 201212 yr 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
September 7, 201212 yr 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.
September 7, 201212 yr 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.
September 9, 201212 yr 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
September 10, 201212 yr 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
September 11, 201212 yr ..and one more tutorial on the same subject: http://hooked-on-mne...or-cleaner.html
September 18, 201212 yr @Zer0FlagThanx for this excellent tutorial.Will test in detail.Btw. did yu test to use crinkler with the shrinked exe?
September 18, 201212 yr Author @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
Create an account or sign in to comment