pouët.net

Crinkler by Loonies [web] & TBC
[nfo]
screenshot added by RandomGr on 2005-08-18 06:03:41
platform :
type :
release date : july 2005
  • rulez 144
  • is ok 27
  • sucks 0
popularity : 5%
 5%
  • rulez 0.84
  • cdcs 1
alltime top: #144
added on the 2005-07-21 14:31:55 by Blueberry Blueberry

popularity helper

increase the popularity of this prod by spreading this URL:

comments

!
rulezadded on the 2005-07-21 15:19:16 by beton beton
An executable packer is not a demotool...
added on the 2005-07-21 15:22:12 by zoom zoom
I don't know, its a tool created by sceners explicitly for the purpose of efficiently packing 4kb intros. It deserves to be here a lot more than some other "demotool" prods.

Personally, I'm more interested in Blueberry's unreleased Amiga packer...

On a totally unrelated note, the best-named packer in history was "Turtle Smasher". Pure genius!
added on the 2005-07-21 15:46:44 by xeron xeron
how is a tool used in demo and/or intro-making not a demotool, zoom?
rulezadded on the 2005-07-21 16:11:56 by kusma kusma
nice idea to include its own linker!
rulezadded on the 2005-07-21 16:14:34 by toxie toxie
just tested it and it improved my size with only 6 bytes compared to 20to4.. but it seems like it's far more stable then 20to4 atleast ;)
so long all the problem with cab dropping
rulezadded on the 2005-07-21 18:50:51 by bzz bzz
and oh, i must ask, doesnt the link.exe trick work with VS 6.0 ?
added on the 2005-07-21 18:52:23 by bzz bzz
You shouldn't directly compare filesizes with 20to4 on smaller files (in boozies case ~3000b). Crinkler has an 450byte(~200bytes header) overhead to compensate for before it can gain any bytes compared to 20to4. Crinkler being able to match CAB-dropping on your 3kb file actually shows good promise that you could gain at least 100+bytes compared to 20to4 on a final 4kb file ;)
added on the 2005-07-21 21:23:57 by mentor mentor
i just want to say that this packer truly rocks! i love you guys!
added on the 2005-07-22 01:47:43 by kusma kusma
a very elegant solution. neat VS integration, neat exe only output. and most importantly, great compression rate.

reflecting to the manual: avoiding dropping is elegant, but cabinet.dll is no cheating (just like opengl32.dll is no cheating either). it is even possible to use cabinet.dll and LZX without writing to the disk. this still has unexposed potential.
rulezadded on the 2005-07-22 03:30:04 by Ger Ger
Gem: You are right, using standard Windows dlls is not cheating. But running an external program from a BAT file somehow leaves a bad taste in your mouth. And it doesn't work on my system at all.

Dropping is the thing we are mainly rebelling against. And the best way to do that is to make something competitive.

I doubt you would get good results from using cabinet.dll for in-memory decompression. Compression based on context modelling is sufficiently superior to LZX to make up for the extra 200 bytes of decompression code on a 4k.
added on the 2005-07-22 10:07:44 by Blueberry Blueberry
nice tool m8, gonna try it
rulezadded on the 2005-07-23 16:54:08 by bull bull
Version 0.2 is now online.

This version fixes a bug in the decompressor, discovered by Frenetic, which would decompress garbage in some "rare" cases, such as when compressing Parsec in SLOW mode. :)

There are also various corrections and updates to the manual and some other minor changes.

Enjoy! :-D
added on the 2005-07-23 23:32:17 by Blueberry Blueberry
my first feedback: crinkler-.exe was slightly bigger (5000 something) then using a .cab-hack (4800 something)..
added on the 2005-07-25 13:26:36 by toxie toxie
good work, maybe i should stop working on 20to4 as obviously crinkler is (at least for me)
a much better solution right now :)
rulezadded on the 2005-07-25 22:38:29 by muhmac muhmac
toxie: Interesting... Are there perhaps any big blocks of zero data in your file?

We would be delighted if you could send us a copy of your obj file that compresses better with cab, so that we can have a look at why we fare so badly.
added on the 2005-07-25 22:47:15 by Blueberry Blueberry
Blueberry: I will as soon as i think i have a version that's worth it.. Also this was just a quick try (getting it to work somehow), so i bet i will squeeze some few more bytes out of the crinkler-.exe somehow..
anyways: wonderful work!
added on the 2005-07-26 13:04:13 by toxie toxie
this packer rulez!
rulezadded on the 2005-07-27 10:16:56 by RandomGr RandomGr
Looks promising... but XP only?
added on the 2005-08-10 17:56:17 by T$ T$
The next release version will be Windows 2000 compatible. We have designed a new header layout for that which is actually smaller than the old one when the number of imported functions is low, as is typically the case for DirectX-based intros.

It will probably be some time before the next release, though. A couple of weeks at least, I expect.
added on the 2005-08-13 11:46:23 by Blueberry Blueberry
Really good.
rulezadded on the 2005-08-13 12:31:51 by p01 p01
saved my life. really good!
rulezadded on the 2005-08-14 23:13:42 by [self-ban] [self-ban]
I like crinkler very much, but what happend to www.crinkler.net? I have 403 - "You don't have permission to access..." Btw. when will be next release?
rulezadded on the 2005-08-23 01:04:53 by polygon7 polygon7
Permission problem fixed...

No definite time plan for the next release yet. We might spend some time on it next weekend, which may or may not result in a release.
added on the 2005-08-23 10:07:30 by Blueberry Blueberry
wow. big ups for all you 4k gurus releasing stuff like this. it allows incompetent sluts like me to make 4ks that don't even totally suck!! thanks guys (muhmac too, ofc)
rulezadded on the 2005-08-23 10:19:09 by skrebbel skrebbel
how do i get the compression stats in VC6? I turned on compiling debuginfo but it didnt seem to work.
rulezadded on the 2005-08-28 17:57:19 by Gargaj Gargaj
the compression stats feature will be available in version 0.3 of crinkler, but isn't implemented in any publicly released version, yet.
added on the 2005-08-29 10:24:40 by mentor mentor
Impressive, I already used it in two prods, and the compression rates are awesome. When's the next version out?
rulezadded on the 2005-09-27 14:12:25 by shash shash
Wow... Knocked nearly 150 bytes off the release version of anorgatronikum! Guess I'll use this instead of my custom cabdropper thingie for my next prod.
rulezadded on the 2005-10-06 19:00:54 by minas minas
Oh my litte p**** waves with joy! This was just awsome and the integration with Visual Studio was amazing!!!! It didn't like HeapAlloc but who cares?
rulezadded on the 2005-10-28 00:57:16 by ekoli ekoli
actually best packer in the world... for windows xp.
rulezadded on the 2005-10-28 01:01:23 by skarab skarab
"Using an external compressor somehow seems like cheating, and this whole dropping business is a mess"

That sentence alone deserves some serious thumb ups :)
rulezadded on the 2005-10-28 15:13:23 by blala blala
Version 0.3 is now online.
Crinkler is now also the best packer in the world for win2k and vista :)
This version of crinkler also features E8 call transformations, compression statistics and various other tweaks.
added on the 2005-10-31 10:36:30 by mentor mentor
Great! I've just tested with same params than 0.2 and i win 28 bytes, really great.
congrats.
added on the 2005-10-31 14:23:30 by skarab skarab
I lose about 20-30 bytes on all my prods
added on the 2005-10-31 22:14:55 by shash shash
The compression heuristics used in 0.3 are slightly different from those in 0.2. Some intros get smaller, some get bigger, especially those with many imports (since the new header has space for fewer imports).

Try enabling call transformation. It might very well save you those bytes back (depending on how many calls you have).
added on the 2005-10-31 22:35:41 by Blueberry Blueberry
Actually, all the intros that I've tested (openGL) get quite bigger with crinkler 0.3, so i'll stick with 0.2, even with call transformation.
added on the 2005-11-07 19:07:42 by shash shash
Hmm, it really shouldn't get that much bigger.

It would be great if you could send us the object files for the intros you have tried compressing. Then we can investigate what causes the blowup and maybe fix it for the next version.
added on the 2005-11-07 22:32:26 by Blueberry Blueberry
Neat compactor!
rulezadded on the 2005-11-13 13:39:58 by Midfit Midfit
An early christmas present for you: Version 0.4 is online!

As part of our ongoing mission to improve the compatibility of Crinkler, we have now managed to make it compatible with 64-bit versions of Windows.

The new version also includes some other minor improvements and fixes.
added on the 2005-12-18 23:24:09 by Blueberry Blueberry
Blueberry for president of cruncher country :D
Does it work with VS 2005 now btw?
rulezadded on the 2005-12-18 23:45:12 by StingRay StingRay
We haven't done alot of testing of crinkler with vs2005, but it seems the link.exe drop-in trick
doesn't work directly, as vs2005 doesn't search for link.exe in the project folder before the vs /bin folder.

As a quick fix you can explicitly add the folder containing crinkler(renamed to link.exe) to
the top of your executable path in vs2005.

This is far from an elegant solution, but this is the best we have come up with so far.
We are of course open to suggestions on how to make a more smooth integration with visual studio.

Happy crunching :)
added on the 2005-12-26 17:21:03 by mentor mentor
awesome. 'nuff sed.
rulezadded on the 2005-12-27 05:52:41 by e64 e64
Version 0.4a is online - just a minor bugfix release.

It seems that some library files (glut32.lib) do not take the coff archive format specification too seriously. Well, you just have to play nice and skip the blanks, and everything works out fine. :)
added on the 2006-02-09 21:39:59 by Blueberry Blueberry
packed files don't work in win98 or in wine emulation (even if set to winxp) :-( i hope wine poeple will be able to make it work...
added on the 2006-03-13 17:36:08 by selmi selmi
This baby gets my thumb of approval
rulezadded on the 2006-03-13 17:55:46 by Duckers Duckers
Really useful piece of code, when it comes to 4k prods. :)
rulezadded on the 2006-03-13 19:17:47 by KK KK
selmi: Yes, we scrapped Windows 98 from the start, since it is not relevant for demos nowadays. Just like most other software makers, we consider Windows 98 obsolete.

Not working in WinE is a bit worse, although it doesn't come as a surprise to me. Crinkler EXE files are made for the Windows PE loader (in Windows 2000, XP and Vista), rather than the PE file format specification. The WinE PE loader probably contains a lot more sanity checks than the WIndows PE loader, which is why it rejects Crinkler-compressed files.
added on the 2006-03-19 14:00:01 by Blueberry Blueberry
Just today I measured a 4k with apack and with crinkler and crinkler saved an incredible 450 bytes (using GCC). Given you require an additional 450 for your unpacker its an amazing achievement. Great work Mentor and Blueberry. When I get a heart - you get it.
rulezadded on the 2006-07-17 12:12:35 by wroceng wroceng
Why don't you Free the memory you use for decompressing? If freeing this Memory uses to much space you could make an option for guys who don't need this space.
added on the 2006-08-08 20:17:20 by Freak5 Freak5
The memory used for decompressing overlaps the memory for the resulting executable image itself. So if you allocate your memory statically, it will reuse the memory used for decompressing. If this is still too big, you can reduce it using the /HASHSIZE option.
added on the 2006-08-21 20:15:52 by Blueberry Blueberry
Here's my thumb up!
Better late than never :)
rulezadded on the 2006-08-26 22:29:14 by rbz rbz
It works with VS.net 2005, and you don't even need the link.exe trick.
Just add a crinkler command-line step in Project Properties / Build Events / Post-Build Event, something like this:
Crinkler.exe /CRINKLER /VERBOSE:IMPORTS /OUT:$(OutDir)\$(InputName)_crinkled.exe <libs> <objects>
rulezadded on the 2006-09-03 16:51:56 by remageFrs remageFrs
PS: Of course in this case you have to include the obj and lib files manually.
added on the 2006-09-03 17:09:52 by remageFrs remageFrs
I'll use it next week. Hopefuly.
rulezadded on the 2006-09-19 21:30:07 by xernobyl xernobyl
Great tool!
Btw, does it work with Windows Vista?
rulezadded on the 2006-10-10 17:07:39 by nap nap
I just installed Vista RC2 to find out, and unfortunately the answer is no. We will of course investigate this to figure out what goes wrong and fix it for the next version.
In the meantime, don't worry about your intros not running on Vista if you use Crinkler. We will provide you with some means (such as a recompression option) of making intros compressed using non-Vista-compatible versions run on Vista.
added on the 2006-10-31 22:02:35 by Blueberry Blueberry
OK, the problem turned out to be very easy to fix. Here is manual fix that you can use to make intros compressed using Crinkler 0.3 or 0.4 Vista-compatible:

Using a hex editor, change 93 into 50 at offset 6A and change 53 into 93 at offset 74. For 0.3-compressed intros, you have to additionally change cdm.dll into lz32.dll at offset 9C. Voala!

Now let's all cross our fingers and hope that Microsoft don't change anything drastic between RC2 and the final release. ;)
added on the 2006-11-01 21:48:55 by Blueberry Blueberry
Good!
rulezadded on the 2006-11-01 21:54:18 by Zplex Zplex
Blueberry: a Vista-fixed version of Crinkler perhaps? (0.4b?)
added on the 2006-11-06 22:39:29 by Gargaj Gargaj
Crinkler 1.0 pre-announcement:

We are currently finishing the last bits of implementation for Crinkler 1.0, which will be released at tUM 2006. Major new features include:

- Windows Vista compatibility
- Greatly improved compression ratio
- Section reordering to optimize compression
- Big speed improvements
and lots of other stuff.

The new version will be available before the 4k graphics and 4k intro deadlines. Expect to win at least 100 bytes compared to 0.4.

Happy Christmas! :-D
added on the 2006-12-22 12:19:51 by Blueberry Blueberry
Crinkler 1.0 is finally here. Get it on the website now!

Enjoy :)
added on the 2006-12-28 01:39:18 by mentor mentor
Perfectly timed, ment! Cheers. :D
rulezadded on the 2006-12-28 17:38:06 by inSpirAcy inSpirAcy
We use it and it's good!
THANKS.
rulezadded on the 2006-12-30 20:37:31 by las las
i have to thumb it, anyhow, since the autors mailserver did not have the best of starts to the new year, i'll try it here :)

that is basically the errormessage:
: fatal error: LNK 0: could not find symbol '__imp___imp_??2@YAPAXI@Z'
intro : error PRJ0003 : Error spawning 'link.exe'.

any hints?

/abuctee
rulezadded on the 2007-01-03 10:00:31 by abductee abductee
It was bound to happen: A couple of minor bugs were found and fixed after the 1.0 release, so here is version 1.0a... go get it!
added on the 2007-01-07 23:45:38 by Blueberry Blueberry
: fatal error: LNK 0: could not find symbol '___ImageBase'
Anyone that knows a solution to this?? Compiled in VS 2005 Express.
tried 'EXTERN_C IMAGE_DOS_HEADER __ImageBase;'
Thanks.
added on the 2007-01-16 20:12:04 by ekoli ekoli
DON'T use the C runtime library startup code. really. just don't.
added on the 2007-01-16 23:47:00 by ryg ryg
ryg: do I feel like a real jerk right now?? You bet I am! :(
added on the 2007-01-17 00:12:04 by ekoli ekoli
I declared/defined a virtual destructor in separate h/cpp file. Then i got a linker error on using both vs2003 and vs2005:
: fatal error: LNK 0: could not find symbol '??_EB@@UAEPAXI@Z'

If i remove the virtual keyword it works.
If i declare/define the same in the cpp file where main() is defined, the error also disappears.

Whats the problem?
rulezadded on the 2007-01-24 09:56:24 by pirx pirx
pirx: The problem you are experiencing is due to our lack of support for weak externals in the linker. We will look into this and try to implement this feature in an update for Crinkler.
added on the 2007-01-30 14:05:43 by mentor mentor
_THE_ packer for 4ks
rulezadded on the 2007-01-30 14:06:53 by src src
kickass
rulezadded on the 2007-01-30 15:25:52 by loaderror loaderror
mentor: this sounds good.
added on the 2007-01-31 22:29:33 by pirx pirx
Why does a cm-based packer like crinkler need the lempel-ziv lib lz32.dll for decompressing?
added on the 2007-03-31 10:29:02 by Cj Cj
Ueber!
rulezadded on the 2007-03-31 11:30:21 by trc_wm trc_wm
cj: We were actually joking about when someone would notice this suspicious looking import.
Crinkler uses hashed importing exclusively and as such doesn't need an import table, but the PE-loader in win2k crashes on executables without at least one import. To fix this we had to include a dummy import table importing some arbitrary function. It just so happens that lz32.dll has the perfect combination of a short name and availability on all windows version :). This also explains why this dll isn't referenced in versions of Crinkler prior to the win2k fix.

Also lz compression isn't really of much use for 4k compression today, even if it is free :D
(People gave up on cab dropping for a reason, even though it has essentially no depacking overhead)
rulezadded on the 2007-03-31 12:33:30 by mentor mentor
Oops, didn't mean to self thumb
added on the 2007-03-31 12:35:43 by mentor mentor
Self-thumb away, this rules and you know it ;)
rulezadded on the 2007-03-31 13:06:02 by Preacher Preacher
Mentor: Thanks for the answer, it makes sense now. I was just irritated about this library import. :)
added on the 2007-03-31 13:28:04 by Cj Cj
rulezadded on the 2007-04-17 21:11:27 by wie8 wie8
amazing tool!
rulezadded on the 2007-04-26 10:37:35 by cynic cynic
rulezadded on the 2007-05-12 15:20:56 by ٩๏̯͡๏۶ ٩๏̯͡๏۶
Great stuff. Looking forward to weak externals support.
rulezadded on the 2007-05-16 17:00:29 by Hikey Hikey
Mentor, Blueberry, I have a small request that you probably will not like to implement, probably it doesn't fit in Crinkler's way of working but...

as you know floating point numbers compress bad, so people is using the trick of truncating the mantisa with 16 bit of zeros (collapse/necrostudios, farbraush, myself, and probably others). I'm not even sure if Crinkler has enought information to know if a specific constant in the .data segment is a float or not, but would it be possible that you automatically do the truncation for me at linking time? In other to avoid truncating every float (sometimes you don't want truncation for precision issues), only those constants starting like "ct16_" (Crinkler Truncate 16 bits) could be truncated...

I'm saying impossible things? Sorry for asking more from you... Second thumb up to compensate for it :)
rulezadded on the 2007-07-02 22:20:10 by iq iq
another option I would be happy with is to do it per .cpp./obj somehow (like the .obj starting with the indicated prefix) or by function (but this I understand means some logic to inspect the binary the code at link time.
added on the 2007-07-09 23:43:56 by iq iq
Thanks for the suggestion iq. We are working on that feature now, so you will probably see it in the next release (which will be fairly soon).

A tricky part of it is to recognize float constants that are not marked using a special label. It is possible for float constants in the code, since these are put at a special label by the compiler, but other float constants do not appear to be marked in any special way.

But your suggestion of using the label or file name as indicator is good. Using that will be much easier than truncating the values manually.
added on the 2007-07-14 00:22:02 by Blueberry Blueberry
Hi. I'm currently writing direct assembly by hand. Would it be possible to have tips/information on crinkler (and it's packing algorithm and segment reordering) so I could perhaps better align the code/data. I expect my data segment to be vastly bigger than the code segment, and the data segment could be split quite freely. Website or the Manual.txt would be a good place for this information.

Thanks again for this great tool. :)
rulezadded on the 2007-07-29 19:25:50 by XMunkki XMunkki
XMunkki: Yes, as mentioned in the manual, you should split your code and data into as many sections as possible (that is, only group data that is addressed from the same label). This gives Crinkler most flexibility in choosing a good section ordering.

It is also usually a good idea to give uninitialized sections a high alignment, e.g. 256 bytes or more. This makes your pointers to these sections more similar, resulting in better compression.
added on the 2007-08-24 17:49:22 by Blueberry Blueberry
Great tool!!!
rulezadded on the 2007-09-06 20:01:23 by of of
When i compile my simple code with masm32, and link it with clinkler, when i try to run i got windows error like "*.exe has encountered an error...", what im compiling is simple program that just use ExitProcess function, it's my first attempt to create as small exe as possible and i simply can't get it to work so i need some help from more experienced user's.
rulezadded on the 2007-09-30 13:16:57 by demon demon
demon: The current version of Crinkler has some problems with very small files (this will be fixed in the next version). Try something a bit bigger, and if you still have problems, mail us your program (or just the object files) and we will have a look at it.
added on the 2007-10-07 20:40:28 by Blueberry Blueberry
it's indeed amazing stuff ... !!! Hammer !!!
rulezadded on the 2007-10-07 20:45:19 by slippy slippy
dear team... as far as I see crinkler (version 1.0a) is compatible with XP64 and Vista 64 bit, but not Windows Server 2003 64 bit. Is this a known issue? (if so I can help debugging it). May be Server versions do carefully inspect the exe headers? (that's what you pay for when you have a server version?)
added on the 2007-10-09 16:18:25 by iq iq
iq: no, we are not aware of any problems with server versions of windows, but we haven't tested them either :)
We would appreciate if you would send us the details of the crash/refusal to run/etc. to us by e-mail. Depending on the nature of the problem, we may, or may not, choose to fix it :)

thanks for your bugreport
added on the 2007-10-10 07:58:13 by mentor mentor
done
added on the 2007-10-15 02:28:56 by iq iq
This tool rocks. For when the float truncation?
rulezadded on the 2007-12-09 07:16:03 by Nezbie Nezbie
now :)
added on the 2008-01-12 22:01:59 by Gargaj Gargaj
Although as 256B intro coder I have never used Crinkler, I enjoyed a lot of productions created with using it, and I must say rulez here.
rulezadded on the 2008-01-12 22:15:23 by Pirx Pirx
Long, long overdue, but finally, here it is: Crinkler 1.1!

Main new feature is the compression report: A detailed report on the compressed intro with colorcoding to indicate the compression ratio for every byte of code or data. On top of that, it provides disassembly of all the code with all crossreferences as links. Try it!

And then there is the float truncation feature. It is somewhat experimental, as the automatic detection of float constants is necessarily based on heuristics. We are very much interested in feedback on this feature. Is it useful as it is? Any suggestions for improvements?

On the compatibility front, the executables are now compatible with data execution prevention. And, as promised, weak externals are supported now.

The rest are minor fixes and tweaks. See the web page and the manual for the full list.

The compressor itself is unchanged in this release. The only case where the file size will change is if you do not use ranged import. A slightly smaller version of the import code will be used in this case.
added on the 2008-01-12 22:19:45 by Blueberry Blueberry
thanks guys - really terrific.
rulezcdcadded on the 2008-01-12 22:33:29 by auld auld
unbelievable!!!
rulezadded on the 2008-01-13 21:55:47 by yandexx yandexx
Will there ever be a gcc version?
rulezadded on the 2008-01-13 21:56:45 by ferris ferris
Although I'm not a coder I must say "this rocks hard."
rulezadded on the 2008-01-13 22:18:14 by stage7 stage7
Ferris: Which gcc are you using (cygwin/mingw/whatever)? The object format ought to be the same, so if it doesn't work, either of us are doing something wrong. :)

Can you send us some information about what it is you are trying to link with Crinkler and the exact steps you perform to compile and link it? Then we will have a look at it.
added on the 2008-01-14 10:13:20 by Blueberry Blueberry
rulezadded on the 2008-01-14 10:49:18 by zeebr zeebr
once more, thanks a lot for this little toy !! :)
added on the 2008-01-14 12:44:51 by iq iq
yep, that html output helps a lot :)
rulezadded on the 2008-01-14 17:23:31 by gopher gopher
@Blueberry: I've actually got it to work :D

Dev-C++ outputs the .o files (mirrors of VC++'s .obj files) automatically, so I just made all my code one file and copied VC++'s .lib files that I needed and it works just fine now.

I'm acessing the same dll's so there's no need to use gcc's .a files instead of the .lib files crinkler needs.

All in all I got it to work and it was much easier than I thought. Also, CAB dropping got 1.92kb and this got 1.5...so you are a beast, Crinkler!! :D
added on the 2008-01-14 21:57:44 by ferris ferris
thank you very much, guys. this is impressive :D
rulezadded on the 2008-01-15 00:23:59 by slack slack
@Ferris: I'd be happy to know how you got it to work... I've got some problems with it still using GCC.
rulezadded on the 2008-05-07 18:16:50 by visy visy
Any chance for a Solaris compatible version? Would be awesome to VNC to my uni and abuse their CPU farm.
rulezadded on the 2008-05-20 23:30:25 by Lord Graga Lord Graga
YEAH...THIS FRIKKIN CRINKLER JUST ROXX.!

THANX A LOT.!!
rulezadded on the 2008-05-21 01:12:37 by hArDy. hArDy.
Lord Graga: We use several Windows-specific system calls (such as DLL loading) inside Crinkler itself, so it isn't easily ported to other platforms.

However, you could try running it with Wine. As far as I know, Crinkler works fine with Wine, and Wine is available for (x86) Solaris.
added on the 2008-05-26 14:32:03 by Blueberry Blueberry
masterpiece)
rulezadded on the 2008-05-26 14:37:53 by RRROAR RRROAR
Speaking of Wine: Latest versions of wine (at least 0.9.59, perhaps also older versions) are now crinkler compatible - correctly running crinkled files.
added on the 2008-05-26 18:08:02 by lemmus lemmus
Great tool without any doubts! Always proving how lame I am at theory of information. I still get surprised by the increased packed size, while original size is decreased by 10-30 bytes of data or code (badly influencing surrounding context?). Also I sometimes get worse rates when I have more data_seg-s. More advices on dealing with this masterpiece would be highly appreciated 8)
rulezadded on the 2008-06-23 23:13:16 by kraviz kraviz
Fantastic packer!
rulezadded on the 2008-07-01 15:10:30 by d3pth d3pth
Thanks !
rulezadded on the 2008-07-27 21:12:58 by XT95 XT95
Great tool! Question though. I was working on building a very minimal exe using VS 2008. I went the route of putting the crinkler.exe file in my $SolutionDir and renaming it. But, when I run it I keep getting the following error:
fatal error: LNK 0: could not find symbol '__imp__LoadLibraryA@4'
I am not linking against any crt and my project builds fine in Release and debug mode. I am *not* including kernel32.lib in my linker dependencides, which solves the problem. Why is this needed and is there a way I can get around it?

Thanks.
rulezadded on the 2008-08-01 05:02:43 by caseyd caseyd
Great tool!
2 caseyd: I suppose crinkler uses LoadLibrary to avoid import table, so you need to link with kernel32.lib. Good luck ;)
rulezadded on the 2008-08-08 14:11:33 by Ized Ized
Ized: Yeah, that makes sense. Thanks.
added on the 2008-08-08 18:42:14 by caseyd caseyd
Never used this myself but looking how much the quality of Windows 4ks have increased past few years I can only give thumbs up!
rulezadded on the 2008-08-08 18:50:14 by dairos dairos
I am using it now. Great stuff!
rulezadded on the 2008-08-08 19:06:24 by Optimus Optimus
What visa sayed
rulezadded on the 2008-08-09 08:45:32 by #535 #535
Hi, thumb up and, of course, I have got newbie question too. I'm using CodeBlocks w/MinGW (thus it's not VC++, because I've problems with registering VC++ 2008 Express Edition). I took aulds OGL Framework from in4k.untergrund.net and placed it in main.c.

Compiling and linking looks like this (/range, /transform-calls and other option temporary disabled, since the code currently is small)
mingw32-gcc.exe -Wall -Os -c main.c -o Release\main.obj
crinkler.exe /subsystem:windows /LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" /out:Release\AuldOGLFramework.exe opengl32.lib gdi32.lib kernel32.lib user32.lib Release\main.obj /COMPMODE:SLOW /HASHSIZE:256 /HASHTRIES:256 /ORDERTRIES:1024 /UNSAFEIMPORT /PROGRESSGUI
This leds to 641 bytes, through aulds talks about results of around 482 bytes. Is there any switches to compiler and linker I'm missing?

and a second q, I've tried to rename main.c, to main.cpp and got the following error from crinkler:
fatal error: LNK 0: could not find symbol 'WinMainCRTStartup'
Looking into main.obj, I saw this
__Z17WinMainCRTStartupv@0
How to make it look like _WinMainCRTStartup@0?
rulezadded on the 2008-08-18 12:06:06 by SLeo SLeo
declare your function as 'extern "C" __stdcall void WinMainCRTStartup()'.
added on the 2008-08-18 21:17:35 by ryg ryg
@SLeo: he got 482 bytes using dropper, apack and ordinal import turned on.
Using MSVC the best I got here was 614 bytes
added on the 2008-08-19 01:00:36 by rbz rbz
O_o--b
rulezadded on the 2008-08-23 15:06:06 by aha aha
I've got the following error:
.\release\main.obj : fatal error: LNK 0: failed to load file 'F:\TRUE4K\_TRUE4K\MSVC\TRUEINTROSYSTEM\RELEASE\MAIN.OBJ'

the main.obj exist and its in that folder,
I'm using MSVCExpress2008 (v9?) is this the problem? or is the big path ?
rulezadded on the 2008-08-30 23:26:33 by KammutierSpule KammutierSpule
solved: "Crinkler does not support the whole program optimization feature of
Visual Studio (General/Whole Program Optimization). Do not turn it on.
"
brilliant stuff!!!
rulezadded on the 2008-08-31 00:26:49 by efecto efecto
KammutierSpule: Hmm, maybe we should give a slightly more helpful error message in this case. ;)
added on the 2008-08-31 00:56:15 by Blueberry Blueberry
I'm trying get out of msvcr90.dll with this
/REPLACEDLL:[oldDLL=newDLL]
/REPLACEDLL:msvcr90=msvcrt
but I got the sadly error: fatal error: LNK 0: import '_crt_debugger_hook' could not be found in 'msvcrt'
I know thats because new 90.dll from m$ :S how can we use las VC and use the msvcrt.dll at same time? or at least desactivate the "hook" weird thing..?
Hey, this looks brilliant :P but im having a problem, I linked my intro using Crinlker, without problems in the compiling/linking step, but then when I run the final executable, I get this weird windows error:

Runtime error!

Program: myintro.exe

R6034
An application has made an attempt to load the C runtime library incorrectly.

I'm using VC++2005 in a WinXP SP3 box. Any clue? :)

Thanks for the tool, I'm sure this problem on my intro will eventually be fixed and it was the only way to get it under 4k :P
added on the 2008-11-01 20:13:39 by acidbrain acidbrain
Oh and thumbs up :S
rulezadded on the 2008-11-01 20:14:02 by acidbrain acidbrain
CRiNKLOR!
rulezadded on the 2008-11-01 20:22:15 by gMAN gMAN
acidbrain: are you sure that you have only options enabled that are supported by crinkler? E.g. I often forget to turn off the "whole program optimization"-feature in the visual studio options.
added on the 2008-11-01 20:22:24 by src src
oh, and disable the standard runtime library.
added on the 2008-11-01 20:24:36 by src src
4k++ since 2005
rulezadded on the 2008-12-02 01:16:19 by T$ T$
a pleasure to work with. I truly love the compression report, it makes it easier to adapt a more compression friendly dataset layout.

Huge hugs!
rulezadded on the 2008-12-02 05:38:31 by quisten quisten
the best demo tool i came across so far. i use it all the time. makes life so much easier...
rulezadded on the 2009-01-04 14:42:41 by Magic-M Magic-M
Another year, another Crinkler! Version 1.1a is now available.

This release focuses on bug fixes and usability. The only change affecting compression rate is a bug fix in the interaction between call transformation and section reordering, which will probably give you a few bytes if you use both.

Apart from that, the long-known float truncation crash bug is now fixed, and there are some improvements to the HTML compression report.

On the usability front, Crinkler now try to detect if some feature is used that Crinkler does not support and gives a helpful hint, e.g. "Disable 'Basic Runtime Checks' in the compiler options". More importantly, there is a new section in the manual which describes how to go about using (or not using) the standard C runtime library with Crinkler. This will hopefully alleviate some of the problems people have had with getting Crinkler to work.

See the web page and the manual for more details on the new version.

If you have any comments, especially if you find cases the manual does not cover or which could use a helpful hint from Crinkler, please tell us. Enjoy!
added on the 2009-01-14 23:04:21 by Blueberry Blueberry
when i try to use crinkler on obj created by masm here is what i get :

warning: LNK: Entry point hunk has alignment greater than 1, forcing alignment
of 1
error: LNK: Cannot find symbol '__imp__MessageBoxA@16'



the strange thing is i dont have any MessageBox call inside my asm file

C:\masm32\bin\Link.exe /STACK:0x200000,0x200000 /LIBPATH:"C:\masm32\lib" /SUBSYSTEM:WINDOWS framework.obj => works

crinkler framework.obj /SUBSYSTEM:WINDOWS /ENTRY:EntryPoint /LIBPATH:"C:\masm32\lib" /CRINKLER => error message
added on the 2009-01-23 21:58:53 by Tigrou Tigrou
Tigrou: By default the Crinkler decompressor will display an error message (using __imp__MessageBox@A16) if the executable imports from a dll file not on the users system. With the widespread use of the d3dx9_xx family of dlls this is no longer an unlikely scenario.

By using the /UNSAFEIMPORT switch you can change this error message to a simple crash and reduce the decompressor overhead slightly. This is perfectly safe, if you are only using standard dlls.

Crinkler, unlike ms link, doesn't link with any default libraries, so you will have to explicitly link those you, and Crinkler, need. Crinkler needs at least kernel32.lib, but will also need user32.lib if the /UNSAFEIMPORT flag is not used.

If you have further questions about Crinklers quirky behavior, let us know :)
added on the 2009-01-23 22:51:09 by mentor mentor
Quote:
CRiNKLOR!
rulezadded on the 2009-01-23 23:30:24 by Confused Confused
I was giving a try to the latest crinkler and I got the following error message:

error PRJ0002 : Error result 3 returned from 'link.exe'

I'm on an xp64 machine, at home with my xp32 it works all fine. Any idea?
added on the 2009-01-26 14:37:36 by iq iq
i didn't know this beauty was here!
rulezadded on the 2009-01-26 14:59:51 by decipher decipher
ups
rulezadded on the 2009-01-27 09:03:52 by mad mad
Please, explain how to use this cool stuff with NASM. Give an example of a simple "MessageBox" application and a command line to build it. Thanks...
rulezadded on the 2009-02-08 22:48:17 by scenebas scenebas
scenebas: OK, here's a MessageBox example for NASM:
Code:extern __imp__MessageBoxA@16 global _entry section main text align=1 _entry: push byte 0 push title push body push byte 0 call [__imp__MessageBoxA@16] ret section str1 data align=1 title: db "Crinkler",0 section str2 data align=1 body: db "Read the manual!",0

Assuming you have assembled this code into an object file called mbox.obj and that the LIBPATH is set up correctly (this is the case if you are running a Visual Studio Command Prompt - otherwise you will have to manually point it to your .lib files) the command line to link it is simply
Code:crinkler mbox.obj /ENTRY:entry kernel32.lib user32.lib

This should result in an out.exe executable of 576 bytes.
Add further options at your leisure.

Does that answer your question?
added on the 2009-02-16 23:03:05 by Blueberry Blueberry
I've been using it all the time and have not yet given my thumb. Really Mentor&Blueberry, you rock! Keep up the great work.
rulezadded on the 2009-02-25 12:05:59 by xTr1m xTr1m
IT ROOOOOOOOOOOOX!!!!
rulezadded on the 2009-02-26 08:44:49 by closed closed
Never had to use (yet) but it's obviously good stuff, nice work.
rulezadded on the 2009-03-08 06:37:46 by keops keops
yes excellent tool thank you!
rulezadded on the 2009-03-08 06:38:49 by blackpawn blackpawn
Thankyouverymuch
rulezadded on the 2009-03-08 10:04:22 by kurli kurli
thanx for bringing so much support and joy to the demoscene.
rulezadded on the 2009-03-18 09:49:57 by Sir Sir
ca roule ;)
rulezadded on the 2009-03-18 12:53:24 by seppjo seppjo
although im no coder nor ever participated in a 4k, i still believe that crinkler helped make 4k's as good as they are today ..

thumbs up rune and aske ..
added on the 2009-03-18 13:32:38 by dwarf dwarf
Thumbs up for this great tool!
rulezadded on the 2009-03-18 14:53:41 by ham ham
Thank you for this software :)
rulezadded on the 2009-04-06 15:08:57 by aizen aizen
I'm having trouble executing any 4k compressed by crinkler under Windows 7, I guess you should take a look at that. It might be a problem of the beta, but still, it could be that MS is changing the way they execute programs.
added on the 2009-04-08 18:55:20 by xTr1m xTr1m
i can confirm that the current version doesn't work with windows 7... musician complained ;)... btw... at BP i said i weren't using gap contexts... i was wrong there... what i didn't use was context with gaps in them... there can be a gap between the context and the current position... and they are, of course, important for compression
rulezadded on the 2009-04-16 02:35:01 by jix jix
:)
rulezadded on the 2009-04-16 03:13:49 by texel texel
gets the job done. thanks
rulezadded on the 2009-04-29 17:18:14 by unc unc
The Windows 7 problem is present on RC1 as well
added on the 2009-05-07 21:15:17 by emoon emoon
Thanks for the reports about the Windows 7 problem. I have investigated it using RC1 and identified the cause of the problem: The digging-into-process-structures hack we use to retrieve the address of kernel32.dll apparently does not work on Windows 7. It gives back the address of a new Windows 7 DLL called KernelBase.dll, so when the import code thinks it is calling LoadLibrary, it is calling some bogus function in KernelBase.dll instead.

We need to investigate this some more to determine how to obtain kernel32 in a way that works on both Windows 7 and earlier Windows. Hopefully we can find a method which is the same size as the old one, since this will greatly simplify the task of fixing old intros to work on Windows 7 (not to mention keeping the size down when adding Windows 7 compatibility).

If all goes well, we will have a fix out before Windows 7 goes public. ;)
added on the 2009-05-07 22:04:27 by Blueberry Blueberry
@Blueberry
Quote:
Problem signature:
Problem Event Name: BEX
Application Name: elevated_1280x1024.exe
Application Version: 0.0.0.0
Application Timestamp: 38a66ae8
Fault Module Name: ntdll.dll
Fault Module Version: 6.1.7127.0
Fault Module Timestamp: 4a03d5a1
Exception Offset: 0001e815
Exception Code: c0000409
Exception Data: 00000000
OS Version: 6.1.7127.2.0.0.256.1

Some thoughts regarding Windows 7 and ntdll.dll issues with older software...

Is it possible to write a 'stub' dll which retrieves a correct address for each api? Such 'transparent' solution will help to run a lot of incompatible software on Vista/W7.

Please think about it.
rulezadded on the 2009-05-26 02:14:14 by SubV242 SubV242
I love the thumbing for tools. I wonder what the rating for bass wouldve been if it was added 10 (?) years ago.

Is tools added to top10? If so, it would mean that all demomakers (ie not at all the majority of pouet users) would thumb up the proper tools and therefor removing themselves from top10.. if pouet where from/by demomakers that is.

The moral is that we never should have any censorship or let the demoscene outreach people govern this site. The majority of pouet.net is not demomakers they are just here because Iam. It's my fansite and you all have accounts to enlarge me.

Thank you very much.
yours,
stefan
added on the 2009-05-26 02:22:36 by Hatikvah Hatikvah
stfu
added on the 2009-05-26 02:32:45 by Confused Confused
See http://www.harmonysecurity.com/blog/2009/06/retrieving-kernel32s-base-address.ht ml - it's only 2 bytes larger.

Also, all programs are called from kernel32:BaseThreadInitThunk, so you can use 11 bytes to get the base:

EntryPoint: ; can be 1 or SectionAlign+1
pop edx ; 'Z'
push edx
FindMZ:
dec edx
cwd ; AX must be set <8000h before
cmp word[edx],'MZ'
jne FindMZ
rulezadded on the 2009-06-20 04:37:31 by rrrola rrrola
I wrote a little loader in an attempt to be able to watch intros working under win7. It doesn't work with all, but at least it works with some.
http://www.pouet.net/prod.php?which=53400
added on the 2009-06-25 23:37:34 by snq snq
and the forgotten thumb coming right up (from behind)
rulezadded on the 2009-06-26 00:35:54 by dwarf dwarf
rrrola: The method in your link is exactly what we came up with for the new import code (except we use the InLoadOrder list). The article mentions that the method sometimes does not work on Windows 2000. We have identified the exact circumstances under which it works, which is when kernel32 is imported as the first DLL in the executable's import table (so no easy fix for shellcode here).

The second method you mention was used for the first few versions of Crinkler (up to version 0.3). It only works on 32-bit versions of Windows.
added on the 2009-06-27 12:13:39 by Blueberry Blueberry
Cool.
rulezadded on the 2009-06-27 17:05:15 by lsl lsl
That was new to me. You really should write an article about Crinkler's headers - I doubt anyone has tested the whims of various loaders as thoroughly as you. It would make writing custom compressors a lot easier.

So, I guess the days of the lz32.dll import are over now? :)
added on the 2009-06-30 04:00:46 by rrrola rrrola
I forgot the thumb in my previous comment, so here it is!
Looking forward to the next version with win7 fix :)
rulezadded on the 2009-06-30 21:16:00 by snq snq
When linking mingw .o files against msvcrt (vc6 one), crinkler is unable to find __alloca. Which seems to be not very sane, as msvcrt should have one. Making all variables static solves this (and I believe this is the right way to make a 4k, however, i've seen quite contradictory compression results with statc/not static vars using gz-dropping on linux).
added on the 2009-07-01 05:29:21 by provod provod
w23: This might be some special issue with __alloca (it is a sort of weird thing to do anyway - it doesn't seem like the kind of thing that can be implemented by a library without any cooperation with the compiler). If you send us a "faulty" object file (preferably with source), we can have a look at it.

I agree that static allocation (using global variables) is usually the best solution for 4ks. We have often seen reductions in size when making variables global, in particular when doing it for all variables which are used in a particular way (e.g. all COM object handles).
added on the 2009-07-01 09:31:20 by Blueberry Blueberry
i think __alloca is just an alias for __chkstk (the guard page "make sure to hit every page at least once" mojo), but i'm not certain.
added on the 2009-07-01 09:51:08 by ryg ryg
ryg: That makes sense. It also explains why the call goes away when things are allocated statically. Still, if msvcrt.lib has one, Crinkler should be able to find it.
added on the 2009-07-01 10:08:27 by Blueberry Blueberry
blueberry, not if it's part of the crt startup code that's always linked statically :) lemme check...
added on the 2009-07-01 10:19:21 by ryg ryg
Code:alloca_8: ; 8 byte aligned alloca _alloca_probe_8 = alloca_8 push ecx lea ecx, [esp] + 8 ; TOS before entering this function sub ecx, eax ; New TOS and ecx, (8 - 1) ; Distance from 8 bit align (align down) add eax, ecx ; Increase allocation Size sbb ecx, ecx ; ecx = 0xFFFFFFFF if size wrapped around or eax, ecx ; cap allocation size on wraparound pop ecx ; Restore ecx jmp _chkstk

i think that's the equivalent in current versions of the CRT. so, yeah, __chsktk wrapper taking 8-byte alignment into account.
added on the 2009-07-01 10:29:22 by ryg ryg
my exe is still running in the background after i end by esc when using crinkler, i have to end the process in the task manager. common problem?
added on the 2009-07-10 23:52:37 by termos termos
i always call ExitProcess(0);
added on the 2009-07-11 00:27:54 by xTr1m xTr1m
For some reason, whatever I try, I can't get crinkler to work on any other COMPMODE than INSTANT. Everything else crashes crinkler when compression should begin. I'm running Windows XP x64 SP2 and using VC++ 2008 Express.

Even with INSTANT I get amazing results, but it'd be awesome to see what the difference would be with say SLOW for instance.
rulezadded on the 2009-08-16 13:32:14 by shinmai shinmai
just tested with 1.1 (had been using 1.1a before) and it works fine.
added on the 2009-08-16 14:03:44 by shinmai shinmai
shinmai: Can you send us your object files along with all the lib and dll files used by the intro as they are on your system, please? We have had multiple reports of Crinkler 1.1a crashing, but we have not been able to reproduce it yet. Apparently it only happens on some machines.
added on the 2009-08-23 01:34:29 by Blueberry Blueberry
just for the record, I had exactly the same problem as shinmai, Windows XP x64 SP2, VC++ 2008 Professional.
added on the 2009-08-23 02:27:33 by iq iq
I have no clue since I couldn't have gone beyond seeing the title bar of the Crinkler project on Mentor's laptop while fixing Muon Baryon, but it sounds like a 64-bit issue. I might be wrong though.
added on the 2009-08-23 02:56:05 by decipher decipher
The tool itself rules, but, any hint about a win7 fix?
( and no, activating windows xp sp3 compatibility in the exe settings won't make it :) )
thx in advance..
rulezadded on the 2009-08-23 09:21:01 by nystep nystep
I second the Windows 7 (x64) fix. Blueberry: if you need a tester, just mail me.
rulezadded on the 2009-09-01 08:09:48 by gloom gloom
I'll be willing to test too! I'll be able to run a lot of crippled demos. :D

Specs if yer interested:

Dell Inspiron 1520 running Windows 7 RC1 64 bit Build 7100
Latest official nVidia mobile drivers (186.81 WHQL) and DirectX Drivers
320GB 7,200RPM HDD
4GB RAM
T7250 Core2Duo 2x2.0Ghz
Geforce 8600M GT 256MB

"Code us happy!"
rulezadded on the 2009-09-01 15:10:41 by 8-bit buggery 8-bit buggery
The undoubtedly most anticipated Crinkler release is finally here!

We proudly present to you: Crinkler 1.2 !
-Windows 7 compatible.
-Windows 2000 incompatible.
-Slightly smaller header.
-A recompression mode allowing you to update existing crinkler exe-files to the new header and import code.
-A few minor compression tweaks.

Now go recompress those old incompatible intros! :)
added on the 2009-09-06 00:04:26 by mentor mentor
Jeg elsker dig som jeg sagde! :D
added on the 2009-09-06 00:06:20 by decipher decipher
This is somehow odd. You two really deserve it!
rulezadded on the 2009-09-06 00:45:45 by Puryx Puryx
I would like to thumb it up again, just for the effort you guys put in this. Eternal love.
added on the 2009-09-06 00:47:12 by iq iq
At last!

Thank you very much, guys! I just recompressed the Elevated and it run under Windows 7 like a charm now!
added on the 2009-09-06 12:04:51 by SubV242 SubV242
mentor: you is a superhelt
also: blueberry.
rulezadded on the 2009-09-06 12:25:54 by plaf plaf
The danes - pants-dropping and compression. Delivered.
added on the 2009-09-06 12:28:15 by gloom gloom
yay! :)
added on the 2009-09-06 14:33:17 by gopher gopher
You are awesome guys! Keep the good work!
added on the 2009-09-06 14:35:29 by ham ham
Sensational!
added on the 2009-09-06 14:57:14 by jimshaw jimshaw
Thanks :)
added on the 2009-09-06 19:51:03 by ferris ferris
We got a message while using crinkler v1.2 in VS2005; compilation fails with the following message :
"|-- Estimating models for code ----------------------------|
Project : error PRJ0002 : Error result 3 returned from 'E:\tits-910d\link.exe'."
Getting back on v1.1 resolved the issue.

Still, wonderful tool
rulezadded on the 2009-09-07 12:20:17 by xtrium xtrium
nice! (thumb up)
added on the 2009-09-20 08:28:06 by xTr1m xTr1m
great job, too bad i can't thumb it twice :D
added on the 2009-09-20 10:00:33 by nystep nystep
Windows 7 support \o/
rulezadded on the 2009-09-24 01:13:05 by pera pera
v1.2 and 1.1a crash for me with any program being compiled! 1.1 works fine. I tested it with VC++ 2008 and Vista 32 and 64 bit. Any guess?
rulezadded on the 2009-09-25 12:21:22 by TomasRiker TomasRiker
Thanks for all the crash reports. So far we have been unable to reproduce the problem on our own machines (with similar OSes to the ones mentioned in the crash reports), so our strategy will be to try to get access to a crashing machine to test on.

Anyone who wants to contribute towards this goal can do so by bringing a crashing machine to TRSAC 2009, where we will be present and ready to do the debugging.
added on the 2009-09-25 21:20:50 by Blueberry Blueberry
Anybody tried /RECOMPRESS+/REPORT combo? Is this a feature or a byproduct? ;)

(also I really miss double-thumbing option)
added on the 2009-09-26 12:05:59 by KK KK
It is a feature, though currently not a highly developed one. We have some ideas for improving the output in various ways, such as automatically detecting label positions and the names of imported functions.
added on the 2009-09-27 22:01:38 by Blueberry Blueberry
I get the same crash on XP (HE 2002) SP3, if the info helps at all. VC++ 2005 (yeah I know). Trying to compile an opengl prog with glsl, win32. Works with older crinklers.
added on the 2009-09-29 21:05:21 by auld auld
Hi Mentor. I have some improvements regarding the decompression header. Could we continue on email?
added on the 2009-10-23 16:22:58 by rrrola rrrola
sure. i believe you got my e-mail at function. if not, just use 'mynick at crinkler net'. I'm excited to hear about your discoveries :)
added on the 2009-10-23 18:49:54 by mentor mentor
This sounds so scary that I wonder how the heck you can gain bytes from an already optimized-to-death code.
added on the 2009-10-23 19:06:47 by decipher decipher
I've tried producing some extremely low entropy code (99% of it are mov/push/call, all using just eax register), and I have just one question from my side: is there any way of removing import-by-hash code in favor of native system imports (there is not much functions in D3D code anyway) or moving import code to the end of the code section (which would mean one extra jmp, but entropy gains may be worth it)? Maybe I'm totally wrong about it, but I think import code sitting in front of intro code may sometimes setup prediction tables for different coding style, than rest of the intro uses.


Decipher: Certainly rrrola has different definition of optimized-to-death (maybe we should call it optimizing-to-afterlife). ;)
added on the 2009-11-05 22:47:42 by KK KK
Do you answer mails lately or shall i paste it here ?
added on the 2010-03-11 18:31:59 by hitchhikr hitchhikr
hitch: sorry, i completely forgot about your e-mail. it seems you are not the only one having problems with crinkler 1.2. Blueberry has been looking into the issue, so we will hopefully know something soon. Are you by any chance on an AMD system? :)
added on the 2010-03-11 19:11:13 by mentor mentor
Yep.
added on the 2010-03-11 19:26:37 by hitchhikr hitchhikr
It seem pretty certain that it's the intel compiler (at least the currently used version) producing crashing code for amd systems.
added on the 2010-03-11 20:26:51 by Psycho Psycho
As i explained in the email it crashes because of an array which isn't initialized properly (null pointer) why would a compiler produce such code ?
added on the 2010-03-11 20:57:44 by hitchhikr hitchhikr
I'm on an AMD system as well and I get the "Error result 3 returned..." or a crash as well. Both with VS 2008 RTM and SP1, Windows 7.

My laptop is XP and Intel-based, and on that system everything comes up roses.

Hope this helps you guys fix a great tool, and thanks in advance!
Is possible to decompress everything from EXE file?
rulezadded on the 2010-06-05 19:15:21 by cx cx
There currently exists no decompressor for Crinkler-compressed files. The closest thing is the /RECOMPRESS option of Crinkler 1.2, which produces a new Crinkler-compressed EXE. If you just want to have a look at the code and data in the file, you can combine /RECOMPRESS with /REPORT to get a disassembly and hexdump of the contents of the EXE.
added on the 2010-06-27 13:24:41 by Blueberry Blueberry
After i recompiled my 4k with VS2010 and crinkler i notice the exe is much bigger. I check it again with VS2008 and the exe was smaler. Without using crinkler in both VS Studios the exe file was same size. I quick my both report files but i dont have to much time now to find out.
can someone confirm this ????
added on the 2010-08-18 17:38:01 by Ciclope Ciclope
Ciclope: the uncompressed file sizes are probably the same because they are aligned to 512 bytes size.
added on the 2010-08-18 17:52:07 by Gargaj Gargaj
Just make sure no extra bullshit such as the path the the PDB is embedded within the executable. You have to know your compiler as if it's your partner's body. :)
added on the 2010-08-18 18:14:41 by decipher decipher
@ Decipher

I have in both VS the same compiler and linker settings. And of course is the same Code. Now i will look the ASM report file from crinkler to find out.

Gargaj: Yes i know what you mean, but i mean the real exe size not the aligned size saved on HD.
added on the 2010-08-18 19:53:11 by Ciclope Ciclope
I'm crinkled!
rulezadded on the 2010-08-23 14:45:43 by rez rez
helped me no end in making my first 1k :)
rulezadded on the 2010-08-23 16:45:31 by Weyland Yutani Weyland Yutani
Awesome tool!
rulezadded on the 2010-08-23 17:16:48 by raer raer
I'm using Crinkler for some months. Currently, I'm writing a synth that will probably produce an OBJ and I want to know if Crinkler removes dead code where present or if, on the other side, I should remove it manually before producing the OBJ.
rulezadded on the 2010-09-14 21:26:08 by merry merry
"1>Project : error PRJ0002 : Error result 3 returned from [...]" too .. :(
Win Xp + VC 2008 SP1 & 2010
added on the 2010-09-16 19:15:39 by XT95 XT95
ciclope, the compiler/linker is also aligning the .exe

merry, shouldn't your linker take care of REAL dead code? (however, neither crinkler, the compiler nor the linker will do runtime analysis to remove your pseudo dead code).
XT95, same setup, same problem here,
did you find a solution ?
added on the 2010-09-19 10:40:02 by p4p4 p4p4
p4p4 -> I saw many people who have this problem, and actually no solution :(
added on the 2010-09-24 23:18:12 by XT95 XT95
merry: Crinkler removes any function which is not called from live code, if the compiler has placed the function in its own section (Crinkler can only remove whole sections). Check the compression report to make sure the function is gone.
added on the 2010-10-17 13:51:29 by Blueberry Blueberry
About the crash problem: We are almost certain the problem is with the OpenMP implementation in the Intel compiler. We are investigating alternatives.

One option is to use the Microsoft compiler instead. However, the OpenMP implementation in the Microsoft compiler does not have an option to link statically, which would necessitate an OpenMP DLL alongside Crinkler. Besides being cumbersome (you have to remember the DLL every time you copy Crinkler around), such side-by-side deployment potentially requires some nasty manifest trickery and also violates the distribution license for the MSVC runtime DLLs (they must be installed by an installer).

Does anyone know of any appropriately licensed static library giving equivalent functionality to OpenMP?
added on the 2010-10-17 21:42:32 by Blueberry Blueberry
We found a usable workaround for AMD systems, until the problem is fixed:
Use the old crinkler 1.1 (which can compress but generates exes that crashes on windows 7) as linker, and then make a post build event that uses crinkler 1.2 /recompress to get the final exe without doing any further compression. That's only 1-2 seconds additional build time for your crinkler builds.
added on the 2010-10-23 02:32:05 by Psycho Psycho
hi, im trying to compress my exe and gets error.
in crinkler 1.1: fatal error: LNK 0: failed to load file 'file.exe';
in 1.2: error: LNK: Unsupported file type.
i have an exe-file. i changed entry point to: mainCRTStartup. using Visual C++ Express 2008 with release build. no manifest. x86. subsystem: windows.
ive tried different command line options without luck.
im running Vista 32bit on laptop w. intel dual cpu. any ideas?
added on the 2010-12-28 23:34:30 by rudi rudi
rudi: crinkler replace your linker, it's not something you run on an exe-file...
added on the 2010-12-28 23:39:14 by kusma kusma
rudi: Crinkler does not operate on .exe files. Rather, it replaces the linker to operate directly on the .obj and .lib files.

See the INSTALLATION section in the manual for information on how to integrate Crinkler into the Visual Studio build process.
added on the 2010-12-28 23:47:55 by Blueberry Blueberry
i thought it was an exe-packer all along. :P got it to work. thanks.
added on the 2010-12-29 00:23:40 by rudi rudi
Crinkler 1.3 is released!

The long discussed AMD crash bug is now fixed. All that was needed to fix it was to use a newer version of the Intel compiler.

Other highlights include:
- Optimizations to the decompression code reducing the size of the header by 21 bytes. Big thanks to Řrřola for his suggestions leading to these reductions.
- New option - /OVERRIDEALIGNMENTS - to specify label alignments, enabling much higher alignments than what is possible using the normal object file alignment mechanism.
- No limit on the number of calls that can be transformed by call transform (previous limit was 255).
- Various other fixes - see the manual or the web site for the full list.

Enjoy!
added on the 2011-03-05 20:12:08 by Blueberry Blueberry
BB Image
added on the 2011-03-05 20:33:53 by rbz rbz
oh thank god for the AMD fix - thanks guys.
added on the 2011-03-06 10:18:13 by auld auld
Also thanks for fixing the issue with absolute paths!
rulezadded on the 2011-03-17 09:43:56 by eyebex eyebex
kringler!
rulezadded on the 2011-03-17 11:13:29 by rasmus/loonies rasmus/loonies
I'd thumb it up again if I could... Thanks Blueberry!
added on the 2011-03-17 11:35:58 by raer raer
I'll thumb it up for you, RareWtFailWhale. Here you go.
rulezadded on the 2011-03-17 11:53:08 by sol_hsa sol_hsa
crinkler - making awesome 4ks possible!
rulezadded on the 2011-03-17 12:28:11 by wysiwtf wysiwtf
.
rulezadded on the 2011-03-17 13:47:03 by panic panic
Thank you very much for the crash bug fix. I have used crinkler for many years now and under a virtual machine because of the crash bug. But now I don't need a virtual machine anymore to run crinkler. Thank you guys!
added on the 2011-04-04 05:51:01 by Bugg Bugg
You are the best!
rulezadded on the 2011-04-25 10:47:37 by Cosmocat Cosmocat
Hi everyone,

I'm trying to use crlinker tonight for the first time with visual studio 2010 express (simply hello world). I placed crlinker to my project folder and renamed to link.exe. I have strictly followed the installation part in manual.txt. But ... the linking step failed with the error code -1073740777. Is this kind of error was arrived to one of you? Of course my project compile fine if I remove /CRLINKER option.
rulezadded on the 2011-05-04 01:00:15 by NeKoFu NeKoFu
"/CRLINKER" ? should be "/CRINKLER" for starters.

Another thing to be sure of is, make sure it's in your solution directory, not the project directory (though they might be the same). Look for the .sln file.
added on the 2011-05-04 01:07:33 by ferris ferris
Oh, hands down the best cruncher around and I haven't even thumbed it up!
rulezadded on the 2011-05-04 01:25:48 by msqrt msqrt
Hi Ferris, thanks to answer so quickly.

Sorry for my typing mistake in my previous post. I use /CRINKLER in additionnal link option.

Well, link.exe is in the same folder of my .sln file. I have launched a build without /CRINKLER option only for checking my project with the visual studio linker and it works. With /CRINKLER I got the error.
added on the 2011-05-04 01:26:08 by NeKoFu NeKoFu
NeKoFu: This sounds a bit like the error some people were seeing with 1.2 on AMD CPUs. Which Crinkler version are you using? Which CPU do you have?
added on the 2011-05-04 08:13:10 by Blueberry Blueberry
I can not believe I never placed a comment here. Thank you so much for sharing this truly wonderful tool.
rulezadded on the 2011-05-04 08:27:04 by chock chock
Blueberry: I use the 1.3 on an Intel I5
Thanks for your help
added on the 2011-05-04 12:15:57 by NeKoFu NeKoFu
I'm having some problems every time I use any componented of the standard template library or some other simple functions (std::string, std::ofstream, exit(0)).

I get this error whenever I use any of the std componentes: LNK: Cannot find symbol '___security_cookie'

If I use exit(0) I get this error: LNK: Cannot find symbol '__imp__exit'

Which libraries am I missing?

I'm using Visual Studio 2010 & Windows 7 64bit (I compile as 32 bit). Is VS2010 and Win7 supported?
added on the 2011-05-10 12:00:06 by n3Xus n3Xus
I managed to fix the problems by linking the following libs:"comsupp.lib" "delayimp.lib" "libcmt.lib" "libcpmt.lib" "libcpmt1.lib" "msvcmrt.lib" "msvcprt.lib" "msvcrt.lib"
"msvcurt.lib" "oldnames.lib" "vcomp.lib" "ptrustu.lib" "RunTmChk.lib" "pgort.lib" "pgobootrun.lib"
:D
added on the 2011-05-10 19:45:37 by n3Xus n3Xus
To get rid of the ___security_cookie dependency, set Buffer Security Check to No in the Code Generation options.

Use ExitProcess(0) instead of exit(0) to call directly into kernel32.dll and thus avoid this standard library dependency.

Read the section on Standard Runtime Libraries in the manual for further tips.
added on the 2011-05-11 10:25:39 by Blueberry Blueberry
Replacing exit(0) with ExitProcess(0) did the trick.

Question: I want to use DirectX 11 for graphics, but I always get the ___security_cookie error whenever I try to use any DX11 code. Is it possible for me to use it or would I have to use some older DX9 version for graphics?
added on the 2011-05-12 02:50:48 by n3Xus n3Xus
I tried some DX11 code, and I can get rid of the ___security_cookie error by setting Configuration Properties -> C/C++ -> Code Generation -> Buffer Security Check to No. Works in both VS 2008 and 2010 here.

If you send your project and source files, we can have a look at it.
added on the 2011-05-17 15:25:38 by Blueberry Blueberry
NeFoKu: If you send your project, source and object files, we will see if we can reproduce the error.
added on the 2011-05-17 15:27:43 by Blueberry Blueberry
Oops, haven't thumbed this yet :)
rulezadded on the 2011-11-17 09:20:53 by eladamri eladamri
I just got the following message from crinkler 1.3:

Quote:

error: LNK: Cannot find symbol '__chkstk'.
* HINT: Avoid declaring large arrays or structs inside functions. Use global variables instead.


I'm not having large arrays or structs inside my function, but it's recursive, which ends up being the same: MSVC thinks you're using (its definition of) lots of stack and ends up generating __chkstk calls.

You can work around this by supplying the /Gs option with a sufficiently large value, such as /Gs999999 (http://support.microsoft.com/kb/100775/en-us).

Perhaps you might want to mention that in crinkler's hint message too.
rulezadded on the 2011-12-26 10:48:17 by Moerder Moerder
Oh, actually I AM using lots of local storage, nothing to do with being recursive. Still, /Gs is able to fix it for me.
added on the 2011-12-26 10:52:03 by Moerder Moerder
Late but very deserved thumb :)
rulezadded on the 2011-12-26 13:37:04 by kb_ kb_
I've used it and it rules -> thumb. I only wish that the source code was available..
rulezadded on the 2011-12-26 15:25:13 by Tjoppen Tjoppen
I just used it to compress the first working release build for windows of an old 4k intro, which I'm using to port my engine from linux.

Crinkler saved *326* bytes so far, and I'm sure that it will be able to save much more with some tweaking!
rulezadded on the 2012-01-01 22:55:32 by cmr cmr
Is there a way to replace the IBH code and do "some other things"? :)
What Tjoppen said.
added on the 2012-01-21 14:39:32 by las las
after hand-crafting some linux elf32 executables and gz-dropping them afterwards, i would pretty much like to get this baby ported to linux. how deep is it win32/PE-specific? is it at all possible to get just the bare packing algorithm? i could do the linking stage for elf32 myself
rulezadded on the 2012-01-22 05:20:56 by provod provod
Mandatory thumb. Very impressive material here.
rulezadded on the 2012-02-06 08:49:13 by Zavie Zavie
Excellent Cruncher
rulezadded on the 2012-03-02 21:57:24 by Frequent Frequent
Is there any update planned? Any idea of when forwarded RVAs will be supported?

Anyway, THE cruncher. The only. Completely amazing piece of work.
added on the 2012-04-19 00:56:15 by merry merry
merry: We didn't have any plans to support forwarded RVA imports, but if there is a demand for it, we will consider it of course. It will add a considerable amount of code to the importer, though, so you will probably be better off doing things differently if possible. Which function do you need it for?
added on the 2012-05-07 16:52:31 by Blueberry Blueberry
Messrs C. Rinkler and Sons, bespoke byte removal services
rulezadded on the 2012-05-23 14:25:15 by Fell Fell
I had a quick look at this today, and I see some things in the import code:

64678B4730 mov eax,fs:[bx+30]
could be
6467A13000 mov eax,fs:[30]
(maybe a zero in the instruction helps somehow)

mov ebx,<image base>
could be
mov ebx,[eax+08]
if placed after the fs: line, for a 2 bytes saving.

also, the check for DLL loading:
test ebp,ebp
jne OUT
push 00000000
push 00000000
push edx
push 00000000
could be
test ebp,ebp
jne OUT
push ebp
push ebp
push edx
push ebp
since ebp is known to be zero at that point, for a 3 bytes saving.

the code in the header could be shortened by at least 3 bytes, but I didn't see any advantage because it seems that nothing can move into the gap.
rulezadded on the 2012-07-18 23:44:40 by qkumba qkumba
even better: ebx=fs:[30] on process start (it's even documented somewhere), so push ebx in the header, pop eax in the second stage, no need for the fs: line at all.
added on the 2012-07-19 00:02:39 by qkumba qkumba
mov eax,[edx+1C]
add eax,ebp
mov eax,[eax+4*ecx]
mov [esp+1C],eax

if ebp and edx were exchanged, you could use

add edx,[ebp+1C]
mov eax,[edx+4*ecx]
mov [esp+1C],eax

for a 2 bytes saving

extending that:

mov eax,[edx+4*ecx]
mov [esp+1C],eax
popad

could be

pop eax
push [edx+4*ecx]
popad

for a 3 bytes saving.
of course, the actual savings after compressing these might be 0 or worse. :-/
added on the 2012-07-19 03:13:44 by qkumba qkumba
the original PEB_LDR_DATA code could be used, if you resolved LoadLibraryExA instead of LoadLibraryA. the ExA version exists in kernelbase.dll and kernel32.dll, and it takes two additional parameters which would both be zero.

for the import table on Win2k, the requirement was to import from either kernel32.dll, or something that imports from kernel32.dll, so that kernel32.dll is loaded somehow. lz32.dll could have been wmi.dll for a 1 byte saving.
added on the 2012-07-19 05:20:40 by qkumba qkumba
qkumba:
Thanks for all the input.

It seems you are right about ebx=[fs:30] on startup. A quick test suggests that we can
save about 3 bytes. It does complicate the call transform code, but I think it will still be a net win in that case.
Can we rely on this across all windows versions?
It would be much appreciated if you can find the documentation you are mentioning :)


Quote:

mov ebx,<image base>
could be
mov ebx,[eax+08]
if placed after the fs: line, for a 2 bytes saving.


This seems to be slightly worse, at least for my example project, because we go from 2 to 3 non-zero bytes.
Optimizing for compressed size is tricky.
We reuse the same instruction sequences, addressing modes and registers as much as possible.
In the end it tends to compress better than the more compact alternatives we have tried. (lodsd+xchg+SIB)
This is of course highly context dependent, so you would ideally want the import code and
intro code to be written in a similar style.

Quote:

also, the check for DLL loading:
test ebp,ebp
jne OUT
push 00000000
push 00000000
push edx
push 00000000
could be
test ebp,ebp
jne OUT
push ebp
push ebp
push edx
push ebp
since ebp is known to be zero at that point, for a 3 bytes saving.


You do realize that these pushes are in your code, right?
Yes, ebp is guaranteed to be zero after the import code, but you will have to exploit it
yourself. We are not going to rewrite user code :)

Quote:

the code in the header could be shortened by at least 3 bytes, but I didn't see any advantage because it seems that nothing can move into the gap.

Yes, gaining a lone byte somewhere in the header doesn't really help.
I'm guessing part of the saving you are mentioning is in the code around the stack reserve field.
You also need to be aware that the code inside the header is not as naive as it might seem, as it is under some additional constraints.

mov ebx, dword 3
is actually just a shorter way of jumping across the subsystem field (dword 2/3), while at the same time initializing ebx to something >1.
The next 4 fields are the reserve/commit fields for the stack and heap. We have to be extra careful about these, as they need to be small
valued dwords in order for windows not to explode, so the instructions are chosen to always have 00/01 in the most significant bytes of these 4 dwords :)

Quote:

mov eax,[edx+1C]
add eax,ebp
mov eax,[eax+4*ecx]
mov [esp+1C],eax

if ebp and edx were exchanged, you could use

add edx,[ebp+1C]
mov eax,[edx+4*ecx]
mov [esp+1C],eax

for a 2 bytes saving


I tried this and it seems to be more than a byte worse than the original code.
mov eax, [edx+xxh]
add eax, ebp
This is actually one of these repeated patterns I mentioned earlier. This is the third instance of the pattern and the fourth instance of add eax, ebp , so at this point it is at a significant discount :)
I also prefer to use ebp instead of edx as it is preserved across calls, so it is easier to exploit it being 0 in your intro.

Quote:

mov eax,[edx+4*ecx]
mov [esp+1C],eax
popad

could be

pop eax
push [edx+4*ecx]
popad

for a 3 bytes saving.

Wouldn't this store the value into EDI instead of EAX?


Quote:

for the import table on Win2k, the requirement was to import from either kernel32.dll, or something that imports from kernel32.dll, so that kernel32.dll is loaded somehow. lz32.dll could have been wmi.dll for a 1 byte saving.

This is from the old header. We no longer support win2k. Also, you wouldn't really save 1 byte as it was in a 8 byte slot in the header.


Quote:

the original PEB_LDR_DATA code could be used, if you resolved LoadLibraryExA instead of LoadLibraryA. the ExA version exists in kernelbase.dll and kernel32.dll, and it takes two additional parameters which would both be zero.

This sounds very interesting. I'm not really sure I follow. How do you get to kernelbase.dll and can you do this reliably on all windows versions?
Using kernelbase would result in an overhead when the intro imports from kernel32, but I guess we could redirect the imports to kernelbase in the
instances where we can. Either way, I'm curious about this :)
added on the 2012-07-19 10:53:19 by mentor mentor
Quote:
It seems you are right about ebx=[fs:30] on startup. A quick test suggests that we can
save about 3 bytes. It does complicate the call transform code, but I think it will still be a net win in that case.
Can we rely on this across all windows versions?
It would be much appreciated if you can find the documentation you are mentioning :)


Yes, you can rely on that across all Windows versions. I will look for the documentation.

Quote:

...

You do realize that these pushes are in your code, right?


That was taken from the one file that I examined. It never occurred to me to check which parts Crinkler added. :-)

Quote:
Quote:
the code in the header could be shortened by at least 3 bytes, but I didn't see any advantage because it seems that nothing can move into the gap.


Yes, gaining a lone byte somewhere in the header doesn't really help.
I'm guessing part of the saving you are mentioning is in the code around the stack reserve field.
You also need to be aware that the code inside the header is not as naive as it might seem, as it is under some additional constraints.


I understand that. I have some experience in crushing PE headers (see pferrie.host22.com). ;-)

Speaking of which, you don't need any section table at all. It is legal to set NumberOfSections to 0 since you import nothing (import table must be in a section since WinXP), and you still allocate all the memory that you want. DEP is not a problem if section alignment < 4096. I'm sure that complicates things for you, but just in case you didn't know.

Quote:
mov ebx, dword 3
is actually just a shorter way of jumping across the subsystem field (dword 2/3), while at the same time initializing ebx to something >1.


Yes, but as noted above, it's already non-zero.

Quote:
Quote:


for the import table on Win2k, the requirement was to import from either kernel32.dll, or something that imports from kernel32.dll, so that kernel32.dll is loaded somehow. lz32.dll could have been wmi.dll for a 1 byte saving.


This is from the old header. We no longer support win2k. Also, you wouldn't really save 1 byte as it was in a 8 byte slot in the header.


If you moved lfanew to 0x10, for example, then it would fit at offset 2, with room for an instruction or two.

Quote:
Quote:
the original PEB_LDR_DATA code could be used, if you resolved LoadLibraryExA instead of LoadLibraryA. the ExA version exists in kernelbase.dll and kernel32.dll, and it takes two additional parameters which would both be zero.


This sounds very interesting. I'm not really sure I follow. How do you get to kernelbase.dll and can you do this reliably on all windows versions?
Using kernelbase would result in an overhead when the intro imports from kernel32, but I guess we could redirect the imports to kernelbase in the
instances where we can. Either way, I'm curious about this :)


When run on Win7, the old PEB code would fetch kernelbase.dll instead of kernel32.dll, and then call the wrong API because the hash loop exited.
So, if you resolved LoadLibraryExA instead of LoadLibraryA, then you'd get a valid address no matter which platform was used.
I haven't seen any demos using kernel32.dll, but I suppose that if one did, then you'd still have a regular import entry for it, so the behaviour would not change visibly. I will test that.
added on the 2012-07-19 16:50:44 by qkumba qkumba
Quote:
You do realize that these pushes are in your code, right?


I just checked again. It is Crinker code. It's the exit code when a DLL can't be loaded.
The "OUT" label that I referenced was the truncated process name (OUT:some address).
added on the 2012-07-19 17:14:45 by qkumba qkumba
ah ok, I misunderstood your suggestion then as ebp is also zero at the end of the normal execution. I'm running with /UNSAFEIMPORT here, so I didn't think of the error message path. Yes, that push 0 can be turned into push ebp. The difference tends to be around +-1byte depending on the style of the intro code. We are using 0 right now, as we have an expectation that sequences of
push 0 is more common than sequences of push ebp in intro code. But looking at it again now it seems to be pretty even with the ebp variant, so we should probably make it a majority vote based on our test suite of intros.

It is very common for 4ks to call ExitProcess, but that wouldn't really be a problem, as I can see it is also in kernelbase.

I tried the old import code again and it is just around one byte smaller after compression. Which will then unfortunately be negated by the need to push two zeroes on the stack before LoadLibraryExA.

Thanks again, It's great to have someone with in-depth knowledge of the darker corners of win32 look into this :)
added on the 2012-07-19 18:46:45 by mentor mentor
the LoadLibrary pushes might be achieved in the header for no cost at all...
added on the 2012-07-19 20:42:59 by qkumba qkumba
that would require more than just two pushes as loadlibrary is called in a loop. we actually need two pushes per dll. this can of course still be done, but it will be at least at couple of instructions and won't be easy to fit into the current header layout and we are still talking about a potential 1 byte improvement :)

I'm curious now. If we are guaranteed that ebx=[fs:30] on all windows versions, do we have similar guarantees about any of the other registers, flags, etc.?
I get ecx=esi=edi=0 and edx=eip, but can I rely on any of this? I have tried, and failed, to find this information many times.
added on the 2012-07-19 21:23:42 by mentor mentor
okay, so forget the LoadLibrary thing. :-)

the dec al/inc al part - these seem less likely to appear than dec eax/inc eax.
would it be better to xor eax,eax before the lodsb, and then dec eax and inc eax instead?
the xor/lodsb sequence appears earlier, so maybe that helps compression.

and in that case, perhaps instead of dec/jns, you could use test/jne, and instead of the inc/je, you could use cmp eax,ebp. it's bigger, but might compress better.
you've reached the end of the list when ebp is zero.

as far as initial registers, only ebx is defined. edx=eip only if syscall mode is used (which can be disabled in some ways), other register values have changed over time.
added on the 2012-07-19 22:15:47 by qkumba qkumba
mentor, if you accept mail from Gmail, I have sent you a new PE header code.
added on the 2012-07-22 07:07:54 by qkumba qkumba
still incredibly useful
rulezadded on the 2012-08-06 00:49:57 by imerso imerso
Any current developments? :)
I would love to have some extra bytes.
added on the 2012-08-28 14:47:09 by las las
Obviously a thumb up.
rulezadded on the 2012-08-28 17:16:19 by pommak pommak
It would be great if packing code were released separately, as a lib, together with a possibly unoptimal example unpacker.
rulezadded on the 2012-09-16 18:28:33 by RCL RCL
Not sure why I haven't thumbed this yet. Big thumb up! :)
rulezadded on the 2012-09-26 11:35:24 by raizor raizor
Hi, i'm trying to learn dx11 & crinkler

a function call to
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);

reports a linking error LNK: Cannot find symbol '_D3DX11CompileFromFileW@44'

am i missing a .lib or something?
added on the 2012-10-02 22:33:45 by pulis pulis
4k intros usually don't load files from disk..
added on the 2012-10-02 22:36:04 by bstrr bstrr
bstrr: i'll try to embed the shader to .exe once i get this tutorial working :)
added on the 2012-10-02 22:42:41 by pulis pulis
Anyone else having problems running crinkler intros on win7 x64 nowadays? Apparently something weird is going on, all of them crash instantly for me, even the supposedly win7 fixed Elevated. I don't know whether it's only my machine, or it's due to a recent windows update or something else. Common crash details are below, if this helps anything:

Code:Problem Event Name: APPCRASH Fault Module Name: ntdll.dll Fault Module Version: 6.1.7601.17725 Exception Code: c0000005 Exception Offset: 000300e2 OS Version: 6.1.7601.2.1.0.256.1 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

One thing is sure, I had the same OS installation a year ago and they were still working back then.
added on the 2012-10-02 23:09:56 by zoom zoom
my code starts at "int WINAPI WinMain(.." if i change it & linker->advanced->entry point, the program won
't run correctly and a zombie program remains in the system. i'm trying to get rid of msvcrt.lib. whenever i remove it from linker dependencies the crinkler won't find the entry point, and if i try to change it the way i do, i get this zombie. help please.
rulezadded on the 2012-10-06 21:58:38 by pulis pulis
I too have many crash with win7 fixed intros (crinkler 1.2 and 1.3). Only one seem to work well after recompress : Lunaquatic.

The issue seems to be an incompatibility with the Geforce R304 driver (from 304.48 to 306.97). The 301.42 is the last one who can properly run crinkler compressed intros.

Any fix planned?
added on the 2012-10-12 17:12:48 by vampire7 vampire7
Yes, I am using the 306.23 driver myself. Maybe it's related to Windows 8 compatibility changes?
added on the 2012-10-12 17:29:35 by zoom zoom
Thank you for the bug reports, and for the pointer to the GeForce driver. Now we have something to investigate. I have seen some problems on one Windows 7 machine myself, and it is also running a driver in that version range.
added on the 2012-10-12 20:35:37 by Blueberry Blueberry
might help your investigation

Seems we nailed it down to "something with dx9 and the NV driver".
added on the 2012-10-16 16:01:28 by las las
Crinkler hangs with following code: (full source)
http://www.sistavip.com/pub/CrinklerPackage.zip
Pls Hlp! (We all love Crinkler) -> Kirill
rulezadded on the 2012-10-20 16:34:34 by Key-Real Key-Real
nvinit.dll has a known bug in it that causes crashes like this. See my comment on the page that las linked. If that's the same crash that people are seeing (and if the solution is the same), then it's not Crinkler's fault.
added on the 2012-10-25 03:41:09 by qkumba qkumba
I went back to nvidia driver 301.42, it worked of course. But then I installed 306.97 again, and now it works. Even after reboot ... now somebody explain THIS! :-)
By the way, thanks for all the info, guys!
added on the 2012-11-17 11:40:32 by quiller quiller
Question about the Crinkler license...

It says "You may use Crinkler for any non-commercial purpose". May Crinkler be used for commercial purposes as well? If so, any restrictions besides "must not be used for any safety critical purpose"?

Specifically, I have a tiny two-option config utility. I've got to fit it into 4KB somehow.

Thanks

James
added on the 2012-11-26 18:57:44 by JamesB JamesB
question about crinkler, can I use crinkler to compile Chevrolet : http://www.pouet.net/prod.php?which=60469
added on the 2012-11-26 19:16:43 by Bartoshe Bartoshe
???
added on the 2012-11-26 19:16:58 by Bartoshe Bartoshe
Quote:
question about crinkler, can I use crinkler to compile Chevrolet

No, Crinkler does not support compressed sizes of more than 64k, because of the way things are laid out in memory. Try kkrunchy (if size matters) or UPX (if decompression speed matters) for things in that size category.
added on the 2012-11-30 09:17:26 by Blueberry Blueberry
Quote:
May Crinkler be used for commercial purposes as well?

No, Crinkler may not be used for commercial purposes. That could indeed be spelled out more clearly in the license.

Try leaving out the manifest, linking with the VS6 version of msvcrt.lib (see the Crinkler manual for some guidelines on this) and stripping the executable. This can usually bring the overhead down to 1k (512 bytes header + 512 bytes import table), which means you will have 3k for your code, which should be plenty for what you describe.
added on the 2012-11-30 09:25:48 by Blueberry Blueberry
Quote:
Cannot find symbol '_D3DX11CompileFromFileW@44'

Try d3dx11.lib from the DirectX SDK.
added on the 2012-11-30 09:43:36 by Blueberry Blueberry
That is a pity. Is there no commercially licensable version, then, if not the standard one?
added on the 2012-11-30 22:39:14 by JamesB JamesB
Basically, Crinkler is an experimental hack, and executables produced by it will likely break on some future Windows version and/or graphics driver (until recompressed using a then-updated version of Crinkler). That is why we consider it unsuitable for commercial uses.

Furthermore, we don't expect any commercial uses of cramming as much as excruciatingly possible into 4 kilobytes, though we may of course yet be surprised in this regard.

It still sounds to me like the utility you are making can be comfortably squeezed into 4k by using standard exe size reducing tricks, most of which you would need to do anyway to make Crinkler happy. A few more tricks for the list:

- Define your own entry point (/ENTRY option to the VS linker).
- Define your own MS-DOS stub (/STUB option to the VS linker). Give it the first 64 bytes of any exe file as the stub file to produce an empty stub. This should make the whole header fit in 512 bytes with up to 3 sections (code, rdata (also containing import table) and bss).
- Do not include reloc information (/FIXED option to the VS linker).
added on the 2012-12-03 22:01:22 by Blueberry Blueberry
It has been far too long, but now the wait is over. Another major release of Crinkler has seen the light of day. Crinkler 1.4 is out!

Major new features include:

- The crash problem seen with recent NVIDIA drivers is fixed. Thanks to qkumba for pointing to the source of the problem: the export table pointer. This is now zero, and all is well.

- Completely redesigned header, using zero sections, a smaller PE header offset and cramming every last bit of unused space in the header (and a fair portion of the used space as well) with code. The result is a size reduction of typically 30-50 bytes for your intro. Again thanks to qkumba for guidance concerning this header layout.

- Forwarded RVA imports are now supported. This for instance enables Crinkler to link with uFMOD or libv2 out of the box.

- Dynamic C++ initializers (initializers for global variables) are supported. Direct calls to all initializer functions are inserted before the entry point. They can be disabled using the /NOINITIALIZERS switch.

- Support for setting the Large Address Aware flag on the output executable. This enables the program to allocate more than 2GB of memory (usually around 3.5GB on 64-bit systems). It is still still not possible to allocate more than 2GB statically, as this is the maximum virtual size of 32-bit Windows executables.

- Crinkler reports all unresolved symbols, rather than stopping after the first one, and indicates the object file referencing each symbol.

See the manual and the website for the full list.

Go pick it up at crinkler.net today! Enjoy! :-D
added on the 2013-01-19 22:24:26 by Blueberry Blueberry
Nice update! BB Image
added on the 2013-01-19 22:38:09 by ham ham
Thanks for your hard work on this. :)
rulezadded on the 2013-01-19 22:52:21 by Saga Musix Saga Musix
.
rulezadded on the 2013-01-19 23:42:01 by red red
Fantastic guys can finally get the 4k's working on my Windows 8 lappy!
Excellent, fantastic tool. Many thanks for the update!
rulezadded on the 2013-01-20 01:41:31 by fizzer fizzer
yay, this update is awesome news!! thanks! and even more awesome is that it means you are working in a new 4k too?
added on the 2013-01-20 20:22:55 by iq iq
iq: no, just crinkler for now :)
added on the 2013-01-20 20:33:02 by mentor mentor
Thumb up! Also for à new IQ&Mentor&Puryx 4kb ;))
rulezadded on the 2013-01-20 21:19:13 by magic magic
@mentor: ohhhh :(
added on the 2013-01-20 22:52:40 by iq iq
Key-Real:
Quote:
Crinkler hangs with following code: (full source)
http://www.sistavip.com/pub/CrinklerPackage.zip

Actually, it doesn't hang, it just takes very long to get started because of the large amount of code. Given enough time, Crinkler 1.3 runs out of memory and crashes. :-/

The new version can handle more memory - enough to successfully compress your example code. Try it! :-D
added on the 2013-01-21 09:53:23 by Blueberry Blueberry
Hey! I had the idea of trying to gain a few bytes by putting every function in its own text section, and to let crinkler rearrange my code for optimal order for compression.

When I tried this out, I got a size increase overall due to 4-byte section alignment, and NOPs being inserted as padding.

I tried just putting one function in a separate section and let crinkler re-arrange it and gained 5 bytes, and then 2 additional bytes when I re-arranged the code manually (and let everything still be in one text section), so there may be potential.

So, the idea is to remove padding NOPs (0x90) from text sections. I have no idea if this would be easy to implement for you though (the HTML report showing disassembled code is promising, at least).

I guess you could theoretically do the same with data sections, but there may not be any way to detect this. Or well, I haven't checked, perhaps data sections are padded with 0x00?
added on the 2013-02-05 23:04:15 by cmr cmr
Last but not least, thanks for an absolutely amazing tool! I'll have to buy you two beer, dinner or whatever sometime.
added on the 2013-02-05 23:07:22 by cmr cmr
An alternative idea, which wouldn't require the programmer to manually put stuff into separate sections, is to split code sections after jmp and ret instructions prior to reordering in crinkler. This would require an extensive rewrite of all addresses in the code though.

And hmm, I just realized that this may require relative addresses to be modified to be absolute.... this is becoming complex :)
added on the 2013-02-05 23:18:25 by cmr cmr
Forcing the alignments of code sections to 1 is actually already on our to-do list, it just didn't make it to the 1.4 release. :)

We have discussed the possibility of chopping up sections based on some kind of code control flow analysis. It would be an experimental feature at best. And even if it would work, I don't think the benefit would be particularly great. If you really need your code split up, you can do so by hand.
added on the 2013-02-15 23:52:36 by Blueberry Blueberry
Alright, if I get some time for it I'll try more manual rearrangement and see how much more I can gain in my case.
But yeah, I agree that it may not be worth the effort.
added on the 2013-02-16 14:05:02 by cmr cmr
Hey Mentor and/or Blueberry,

I'm trying to make a 4K in VS2012 Express with the XP-compatible linker flag (platform toolset = Visual Studio 2012 - Windows XP (v110_xp), instead of the default Visual Studio 2012 (v110) ), and crinkler 1.4 does not like that:

1>LINK : error : cannot parse token '/SUBSYSTEM:WINDOWS,5.01': unknown argument WINDOWS,5.01

Would it be possible to fix this, preferably before Revision?
rulezadded on the 2013-03-23 16:10:38 by Seven Seven
To sum up the conversations I had with Seven about this XP compatibility issue:
The fix is to not select the XP compatibility option. Executables created using Crinkler will be XP compatible without it. We will make Crinkler more tolerant to the syntax of this option in a future version.
added on the 2013-04-07 23:03:12 by Blueberry Blueberry
How to use crinkler in Dev-C++ with TDM-GCC x64 ? Pleaaaase
sandeeeeeh: Crinkler is a 32-bit linker. Compile your code for 32 bits and you should be fine. If you really need 64-bit code, you are out of luck, unfortunately.

You will probably need to link with some MinGW-specific runtime library. To minimize the amount of code pulled in from the runtime library, be sure to define your own entry point (using the /ENTRY option).

Let us know if you still encounter problems.
added on the 2013-10-21 09:51:35 by Blueberry Blueberry
My building try has failed like this.

uncompressed size of code: 208209
uncompressed size of data: 15431

|-- Estimating models for code -----------------------------------------|


This is the end of testing. I can't see no more line.

I want to know the reason of normal exit.

Could you please show me the way?
rulezadded on the 2013-12-05 08:04:33 by hjohn hjohn
hjohn: Your code section is quite huge. Crinkler is probably running out of memory.

Does your code section contain one or more big blocks of zeros? If so, try to separate those out into a bss section.

If you actually have 200kb of ordinary code, it will probably not compress down to anywhere near 4kb, and so Crinkler is maybe not the right tool for the job.

If your code is generated and highly redundant, and you expect it to compress down to a few kb, try to generate it at runtime instead.
added on the 2013-12-05 10:39:16 by Blueberry Blueberry
Hmm, i just migrated an intro from v1.2 to v1.4.
v1.3 brought "Header size reduced by 21 bytes."
v1.4 brought "New zero-section header layout saving around 30-50 bytes."
So i should get an about 50-70bytes smaller .exe in the end, right?
Too bad, i got an .exe 25 bytes bigger. Exceeding the 4096b this way.
Any Idea why this could happen? Will have a look into the manual again now, if i find a clue or a fix i´ll report back here asap.
added on the 2014-01-24 03:02:59 by hArDy. hArDy.
You probably have some C++ initializers that weren't being run before. Try /NOINITIALIZERS.
added on the 2014-01-29 23:10:32 by Blueberry Blueberry
Some intros (Sincere and Atrium) crash with Windows 8.1 and Intel HD Graphics (IronLake) 8.15.10.2900. Of course, these intros are recompressed with crinkler 1.4. All the other 4k intros that I have are working properly.
On the same machine with Windows 8, Sincere worked properly. Unfortunately, there is only one version of this driver for Windows 8.1, so I cannot do other tests on this point.
added on the 2014-03-16 15:29:13 by vampire7 vampire7
Blueberry:
Thanks, that did the trick! Have been completely unaware of this switch so far! Damn me!
added on the 2014-03-16 16:17:48 by hArDy. hArDy.
This is one of the greatest gifts to sizecoders and the scene. Thank you.
rulezadded on the 2014-07-24 09:35:22 by drift drift

submit changes

if this prod is a fake, some info is false or the download link is broken,

do not post about it in the comments, it will get lost.

instead, click here !

[previous edits]

add a comment