program

Mikulas Patocka mpat7421 na ss1000.ms.mff.cuni.cz
Pondělí Leden 19 15:39:32 CET 1998


> Mam tu takyto DOSovsky program:
>
>
> #include<stdio.h>
> #include<time.h>
> #include <dos.h>
> #define port 0x2fc
> void main()
>  {
>  time_t cas;
>  cas=time(NULL);
>  printf("\n\nZaciatok cakania.");
>  outport(port,inport(port)|1);
>  while(cas+5>time(NULL)){}  printf("\nUz si sa dockal");
>  outport(port,inport(port)&254);
> }

Ja to zkusim. Pisu to z hlavy, takze to mozna nebude dobre...
At me kdyz tak nekdo opravi.

#include <stdio.h>
#include <time.h>
#include <unistd.h>
#define port 0x2fc

void main()
{
  time_t cas;
  if ( iopl(3) )  // povoleni operace s porty
 {            // kdyz to nema suid root, tak to nepude
  printf("Nebezi to na ROOTa!\n");

  return;
 }
  cas=time(NULL);
  printf("\n\nZaciatok cakania.");
  outw(port,inw(port)|1);       // misto outport outw 
                                // a misto inport inw
  while(cas+5>time(NULL)){}  printf("\nUz si sa dockal");
  outw(port,inw(port)&254);
}

Nevim, jestli to pude, ale zakladni techniky jsou doufam 
zrejme...
Program musi byt samozrejme pusten s pravy root.



Mikulas Patocka




Další informace o konferenci Linux