Wednesday, June 24, 2009

I've almost finished removing any traces of CRT usage from my DLL (yes, another fight to get less than 4k integration module ;), when become stuck with _memset usage somewhere. Assembly language output turned on, and... omg...

 ; 75   :  OPENFILENAME ofn;
 ; 76   :  for (int b = 0; b < sizeof(ofn); b++)
 ; 77   :   ((byte*)&ofn)[b] = 0;
00014 6a 58                push 88 ; 00000058H
00016 8d 44 24 14      lea eax, DWORD PTR _ofn$[esp+108]
0001a 53                     push ebx
0001b 50                     push eax
0001c 88 1e                 mov BYTE PTR [esi], bl
0001e e8 00 00 00 00  call _memset
00023 83 c4 0c            add esp, 12 ; 0000000cH

Hm... That wasn't what I asked for, actually :)

P.S. To say truth, I've spent almost half an hour trying to fool compiler to leave my cycle untouched. Simple math operations doesn't help (beside MOD variants), the easiest solution was to reverse cycle :D