how to create 1kb exe
Here is instruction how to make very small *.exe file with simple animation.
1. Create empty win32 project in visual studio 2012.
2. Place crinkler in solution directory. Rename it to link.exe.
3. Go to Project options, VC++ Directories, Executable Directories, and add $(SolutionDir) at top of tle list.
4. Change Properites, General, Character Set to Not set.
5. Turn off whole code optimalization.
6. Go to Properities, Linker, Advenced, Entry Point and set it to string "winmain".
7. Go to Properites / Linker / Command line and add /CRINKLER to command line.
8. Add empty cpp file. Put ther that code:
1. Create empty win32 project in visual studio 2012.
2. Place crinkler in solution directory. Rename it to link.exe.
3. Go to Project options, VC++ Directories, Executable Directories, and add $(SolutionDir) at top of tle list.
4. Change Properites, General, Character Set to Not set.
5. Turn off whole code optimalization.
6. Go to Properities, Linker, Advenced, Entry Point and set it to string "winmain".
7. Go to Properites / Linker / Command line and add /CRINKLER to command line.
8. Add empty cpp file. Put ther that code:
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include
#define XRES 1920
#define YRES 1080
static const BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER),XRES,-YRES,1,32,BI_RGB,0,0,0,0,0},{0,0,0,0}};
static unsigned int buffer[XRES*YRES] = { 0 };
__declspec(naked) void winmain()
{
// Prolog
__asm enter 0x10, 0;
__asm pushad;
{
HWND hwnd = CreateWindow("i", 0, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0);
HDC hdc = GetDC(hwnd);
while(true)
{
for( int a=0; a<XRES*YRES; a++)
buffer[a]= 0xFF0000 + ((a*12345+345)%0x1000000);
StretchDIBits(hdc,0,0,XRES,YRES,0,0,XRES,YRES,buffer,&bmi,DIB_RGB_COLORS,SRCCOPY);
if(GetAsyncKeyState(VK_ESCAPE))break;
}
ExitProcess(0);
}
}