Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

request password program in C

Tags:

c

I am reading a program that requests a password written by C. But there is one line I do not understand is :

if(!OK){
 printf("\nWrong password!"); getch();
 f = MK_FP(0xFFFF,0x0000); f(); // this line I don't know
}

while f is pointer of function void far (*f)(void). is anyone can explain thank you

like image 993
computerluv Avatar asked Feb 09 '23 09:02

computerluv


1 Answers

This lines were used to reboot a PC from the BIOS (MS-DOS).

MK_FP(0xFFFF,0x0000);

construct a far pointer (32 bits at the time) and returns it as a pointer to function. Then f is executed at that address, rebooting the PC.

It wouldn't work today on modern OSes.

This program uses it.

like image 117
Déjà vu Avatar answered Feb 13 '23 04:02

Déjà vu