Well, sometimes I dont trust those library functions. For example...the StrCmpN function...
mov edi,edi
push ebp
mov ebp,esp
sub esp,00000018h
mov eax,[L77FCD280]
push esi
mov esi,[ebp+08h]
push edi
mov edi,[ebp+0Ch]
mov [ebp-04h],eax
lea eax,[ebp-18h]
push eax
push 00000000h
call [KERNEL32.dll!GetCPInfo] ; <---- wtf
test eax,eax
jz L77F809D7
cmp byte ptr [ebp-12h],00h
jnz L77F8F358
L77F809D7:
xor eax,eax
L77F809D9:
push eax
push [ebp+10h]
push edi
push esi
call SUB_L77F70E8C ;<-- goes off somewhere
mov ecx,[ebp-04h]
pop edi
pop esi
call SUB_L77F64020 ;<--- again
leave ;<-- never seen this 1 b4 lol
retn 000Ch
If I did it in assembly it would have been something like
push esi
push edi
push ecx
mov esi, [esp+16] ;32 bit?
mov edi, [esp+20]
mov ecx, [esp+24]
rep cmpsb
;do something tricky to put stuff in eax
;pop vals and thats it. No calling "GetCPInfo" or other stuff. Plain and works.
But then, I did not do any alignment stuff and I'm accessing "bytes" which makes it really really slow? I mean...this is in an app which has to look for a given 1024 (may not always be 1024...any arbitary data size specified by user...min = 1024 and then increases on each run) of bytes of data in a 24156 (dependent on data size...[anothe user specified number...min 1024..increase on each run] * data size) byte buffer 120 times per second in order to encode and decode instructions in time and stay synchronized with a device. You lagg behind => you die. Which means it needs to make the best use of its time slot as it will be running at same processor priority as another app which has to do a lot of work to produce that 1024 bytes and to send to my program => will probably take most of cpu time? Well, I cant feel how fast or slow each is going. Probably because I have a vary fast duel core processor. But it may not be the case. They might be running one of those old 33mhz processor or even older models lol. (probably not that old...oldest machine my uni has that is still in used by nerds at microelectronics department) So its reely scary ^_^. I dont want to die before everyone else lol.