This is the test I ran in stage3:
Code: Select all
if (strcmp("test","tes")){
_asm{
mov eax, 0x1337
cli
hlt
}
}
This works correctly it sets eax to 0x1337 then halts the system.
Now I commented this out in stage three went to the HAL and recompiled and ran again and the HAL halts with eax=0x2 and ebx=0x1 (error code from GetProcAddress)
I have no idea why at first I thought it was the strcmp() function itself that was failing so I replaced it with a strcmp() that has been proven to work in an older OS of mine and it still fails.
I'm completely stumped the only thing that would make sense is the address space or that it's a DLL instead of an EXE.
strcmp():
Code: Select all
int strcmp(const char* str1, const char* str2){
int res=0;
while(!(res=*(unsigned char*)str1-*(unsigned char*)str2) && *str2){
++str1;
++str2;
}
if (res<0) res=-1;
if (res>0) res=1;
return res;
}