Главная    Почта    Новости    Каталог    Одноклассники    Погода    Работа    Игры     Рефераты     Карты
  
по Казнету new!
по каталогу
в рефератах

Защита данных от несанкционированного доступа

fError + mfOkButton);
     end
   else MyMessageBox('          Файл не выбран!!! ',
          nil, mfError + mfOkButton);
 end;

 {**************************************************************************
 **}
 {*----------===== Б Л О К И Р О В К А   В И Н Ч Е С Т Е Р А ======---------
 -*}
 {**************************************************************************
 **}
 procedure LockDisk;
 label
   end_;
 var
   Regs: registers;
   Err : string;
   Inst: byte;
 begin
   {Проверка наличи программы в памяти}
   asm
                 push    ax
                 push    dx
                 mov     Inst, 0
                 mov     ax,1059h
                 mov     dx,2517h
                 int     13h

                 cmp     ax,2517h
                 jne     End_
                 cmp     dx,1059h
                 jne     End_
                 mov     Inst, 1
     End_:       pop     dx
                 pop     ax
   end;
   if Inst = 0 then
     begin
       MakeComFile(3);
       {Установить защиту}
       SwapVectors;
       SetIntVec($09, Int09_Save);
       Exec(MainDir + 'block.com', '');
       GetIntVec($09, Int09_Save);
       SwapVectors;
       {Обраюотчик ошибок}
       if DosError <> 0 then
         CheckExec
       else
         begin
           regs.ah := $4D;
           with regs do
           msdos(regs);
           case Regs.AH of
              0 : MyMessageBox('     Ненормальное завершение.',
                    nil, mfError + mfOkButton);
              1 : MyMessageBox('      Ctrl-C или Ctrl-Break.',
                    nil, mfError + mfOkButton);
              2 : MyMessageBox('   Критическая ошибка устройства.',
                    nil, mfError + mfOkButton);
              3 : MyMessageBox('      Винчестер блокирован.',
                    nil, mfInformation + mfOkButton); { TSR }
           end;
         end;
     end
   else MyMessageBox('       Защита уже установлена.',
          nil, mfError + mfOkButton);
 end;


 {Изменить стандартную палитру}
 function TDirDialog.GetPalette: PPalette;
 const
   {Синяя палитра}
                               CMyCluster                                 =
 #64#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79#80#81#82+
                    #83#84#85#86#87#88#89#90#91#92#93#94#95;
   P: string [32] = CMyCluster;
 begin
   GetPalette := @P;
 end;

 {Окно работы с каталогами}
 constructor TMyChDirDialog.Init(AOptions: Word; HistoryId: Word);
 var
   R        : TRect;
   ScrollBar: PScrollBar;
   CurDir   : DirStr;
 begin
   { Создание окна }
   R.Assign(16, 2, 64, 20);
   TDialog.Init(R, 'Изменить катлог');
   Options := Options or ofCentered;

   { Строка ввода имени каталога }
   R.Assign(3, 3, 30, 4);
   DirInput := New(PInputLine, Init(R, 68));
   Insert(DirInput);
   R.Assign(2, 2, 17, 3);
   Insert(New(PLabel, Init(
                 R, '~И~мя каталога', DirInput)));

   { Список каталогов }
   R.Assign(32, 6, 33, 16);
   ScrollBar := New(PScrollBar, Init(R));
   Insert(ScrollBar);
   R.Assign(3, 6, 32, 16);
   DirList := New(PDirListBox, Init(R, ScrollBar));
   Insert(DirList);
   R.Assign(2, 5, 19, 6);
   Insert(New(PLabel, Init(
                 R, '~Д~ерево каталогов', DirList)));

   { Формирование кнопок }
   R.Assign(35, 6, 45, 8);
   OkButton := New(PButton, Init(
         R, '~А~га', cmOK, bfDefault));
   Insert(OkButton);
   Inc(R.A.Y,3); Inc(R.B.Y,3);
   ChDirButton := New(PButton, Init(
         R, '~С~мена', cmChangeDir, bfNormal));
   Insert(ChDirButton);
   Inc(R.A.Y,3); Inc(R.B.Y,3);
   Insert(New(PButton, Init(
         R, '~Н~ека', cmCancel, bfNormal)));

   if AOptions and cdNoLoadDir = 0 then SetUpDialog;
   SelectNext(False);
 end;

 procedure TMyChDirDialog.SetUpDialog;
 var
   CurDir: DirStr;
 begin
   if DirList <> nil then
     begin
       CurDir := GetCurDir;
       DirList^.NewDirectory(CurDir);
       if (Length(CurDir) > 3) and (CurDir[Length(CurDir)] = '') then
         CurDir := Copy(CurDir,1,Length(CurDir)-1);
       if DirInput <> nil then
         begin
           DirInput^.Data^ := CurDir;
           DirInput^.DrawView;
         end;
     end;
 end;

 function TMyChDirDialog.Valid(Command: Word): Boolean;
 var
   P: PathStr;
 begin
   Valid := True;
   if Command = cmOk then
     begin
       P := FExpand(DirInput^.Data^);
       if (Length(P) > 3) and (P[Length(P)] = '') then
         Dec(P[0]);
       {$I-}
       ChDir(P);
       if IOResult <> 0 then
         begin
           MyMessageBox('      Неправильный каталог!',
             nil, mfError + mfOkButton);
           Valid := False;
         end;
       {$I+}
     end;
 end;


 {Инициализировать рабочее поле}
 constructor TMyBackground.Init(var Bounds: TRect; AText: TTitleStr);
 begin
   inherited Init(Bounds, ' ');
   Text := AText;
   while Length(Text) < SizeOf(TTitleStr) - 1 do
     Text := Text + AText;
 end;

 procedure TMyBackground.Draw;
 var
   DrawBuffer: TDrawBuffer;
 begin
   MoveStr(DrawBuffer, Text, GetColor(1));
   WriteLine(0, 0, Size.X, Size.Y, DrawBuffer);
 end;

 procedure TMyDesktop.InitBackground;
 var
   R: TRect;
 begin
   GetExtent(R);
   Background := New(PMyBackground, Init(R, '___'));
 end;

 {Изменить стандартную палитру}
 function TMyStaticText.GetPalette: PPalette;
 const
   {Синяя палитра}
                               CMyCluster                                 =
 #64#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79#80#81#82+
                    #83#84#85#86#87#88#89#90#91#92#93#94#95;
   P: string [32] = CMyCluster;
 begin
   GetPalette := @P;
 end;


 {Окно "О Программе"}
 constructor TAboutBox.Init;
 var
   R: TRect;
 begin
   R.Assign(0, 0, 30, 16);
   inherited Init(R, 'О программе');
   Options := Options or ofCentered;

   R.Assign(10, 13, 20, 15);
   Insert(New(PButton, Init(R, '~А~га', cmOK, bfDefault)));

   R.Assign(11, 2, 19, 3);
   Insert(New(pMyStaticText, Init(R, 'Sub Rosa')));

   R.Assign(1, 4, 29, 5);
   Insert(New(pStaticText, Init(R, 'Система защиты данных от НСД')));

   R.Assign(5, 5, 29, 6);
   Insert(New(pStaticText, Init(R, 'выполнена  учащимися')));

   R.Assign(10, 6, 29, 7);
   Insert(New(pStaticText, Init(R, 'гр. 4641')));

   R.Assign(6, 7, 29, 8);
   Insert(New(pStaticText, Init(R, 'Егановым  Максимом')));

   R.Assign(14, 8, 22, 9);
   Insert(New(pStaticText, Init(R, 'и')));

   R.Assign(6, 9, 29, 10);
   Insert(New(pStaticText, Init(R, 'Юзефовичем Артемом')));

   R.Assign(6, 11, 29, 12);
   Insert(New(pStaticText, Init(R, 'МГВРК, Минск, 1996')));
 end;

 {Работа программы начинается здесь...}
 constructor TMyApp.Init;
 var
   ReturnVal, i                : Word;
   DirInfo, DirInfo1, DirInfo2 : SearchRec;
   DirInfo3, DirInfo4, DirInfo5: SearchRec;
   Pas                         : string;
   st                          : char;
 begin
   OptInd := 1;
   {Инициализировать файл ресурсов}
   MyRes.Init(New(PBufStream, Init('Setup.res', stOpen, 1024)));
   if MyRes.Stream^.Status <> stOK then
     begin
       Write('Нарушение целостности!');
       halt(1);
     end;
   RegisterType(RMenuBar);
   {Проверить целостность системы}
   MainDir := GetCurDir;
   FindFirst('plus',    AnyFile, DirInfo);
   FindFirst('passw',   AnyFile, DirInfo1);
   FindFirst('block',   AnyFile, DirInfo2);
   FindFirst('keydisk', AnyFile, DirInfo3);
   FindFirst('setup.res',   AnyFile, DirInfo4);
   if (DOSError = 0) and (DirInfo.Size = 1068) and  (DirInfo1.Size  =  204)
 and
      (DirInfo2.Size = 617) and (DirInfo3.Size = 2118) and
      (DirInfo4.Size = 522) then
     begin
       {Получить пароль}
       Assign(FilePass, 'system.res');
       Reset(FilePass);
       Pass := '';
       while not EOF(FilePass) do
         begin
           read(FilePass, st);
           Pass := Pass + st;
         end;
       Close(FilePass);
       {Инициализировать систему}
       TApplication.Init;
       Pas := '';
       ReturnVal := ExecuteDialog(New(PAboutBox, Init), nil);
       InputBox('П А Р О Л Ь', 'Введите пароль:', Pas, 255);
       for i:= 1 to length(Pas) do Pas[i] :=chr(ord(Pas[i]) xor 27);
       if Pas <> Pass then
         begin
               MyMessageBox('            Неверный     пароль!!!',      nil,
 mfError+mfOkButton);
           ClrScr;
           writeln('Несанкционированный доступ!');
           Halt;
         end;
     end
   else
     begin
       writeln('Нарушение целостности!');
       Halt;
     end;
 end;

 {Завершение работы}
 destructor TMyApp.Done;
 begin
   TApplication.Done;
   MyRes.Done;
 end;


 {Обработка событий}
 procedure TMyApp.HandleEvent(var Event: TEvent);
   procedure ChangeDir;
   var
     D: PMyChDirDialog;
   begin
     D:= New(PMyChDirDialog, Init(cdNormal, 101));
     ExecuteDialog(D, nil);
   end;

 var
   ReturnVal: Word;
   regs     : Registers;
   R        : TRect;
 begin
   inherited HandleEvent(Event);
   case Event.What of
     evCommand:
       begin
         case Event.Command of
           cmAboutBox  : ReturnVal :=
                           ExecuteDialog(New(PAboutBox, Init), nil);
           cmOpen      : FileOpen('*.*');
           cmChangeDir : ChangeDir;
           cmSetPass   : Plus(SetPass);
           cmKeyDisk   : Plus(KeyDisk);
           cmCode      : Shifr(FName);
           cmDeCode    : DeShifr(FName);
           cmLockDis
Пред.678910След.
скачать работу

Защита данных от несанкционированного доступа

 

Отправка СМС бесплатно

На правах рекламы


ZERO.kz
 
Модератор сайта RESURS.KZ