国产午夜成人免费看片无遮挡_日本免费xxxx色视频_免费人成网上在线观看_黄网址在线永久免费观看

當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

實時偵測目錄中文件變化

實時偵測目錄中文件變化

更新時間:2022-05-16 文章作者:未知 信息來源:網絡 閱讀次數:

在WIN32下用DELPHI偵測目錄變化,可用WIN32提供的文件改變通知API來完成。FindFirstChangeNotification, FindNextChangeNotification,FindCloseChangeNotification。
在應用程序中調用這些函數時,產生一個監控這個變化的句柄,可用WAIT函數集來等待這個變化。這樣,當監控程序運行時,可以達到監控文件變化的動作。更進一步,可把此程序做成一個狀態區圖標(TRAY)來完成監控。

Windows在刪除、復制、移動、訪問文件時并不發送消息,當然截獲不到。要截取這些操作過程的唯一辦法就是截獲API,這又需要你編寫Vxd程序了,殺毒軟件都是這樣作的。你注意一下殺毒軟件一般都帶有一個vxd程序。光有vxd還不行,還需截獲文件API。還有另外一個辦法,就是CIH病毒采用的辦法,直接跳到系統零層去操作。具體辦法如下:
一、SIDT指令( 將中斷描述符表寄存器IDTR--64位寬,16~47Bit存有中斷描述符表IDT基地址--的內容存入指定地址單元)不是特權指令,就是說我們可以在Ring3下執行該指令,獲得IDT的基地址,從而修改IDT,增加一個中斷門安置我們的中斷服務,一旦Ring3程序中產生此中斷,VMM就會調用此中斷服務程序,而此中斷服務程序就運行在Ring0下了。這一點與在DOS下非常相似。

二、要實現對系統中所有文件I/O操作的實時監視,還要用到另一種關鍵技-FileHooking,通過掛接一個處理函數,截獲所有與文件I/O操作有關的系 統調用。Windows9x使用32位保護模式可安裝文件系統(IFS),由可安裝文件系統管理器(IFSManager)協調對文件系統和設備的訪問,它接收以Win32API函數調用形式向系統發出的文件I/O請求,再將請求轉給文件系統驅動程序FSD,由它調用低級別的IOS系統實現最終訪問。每個文件I/OAPI調用都有一個特定的FSD函數與之對應,IFSManager負責完成由API到FSD的參數裝配工作,在完成文件I/OAPI函數參數的裝配之后轉相應FSD執行之前,它會調用一個稱為FileSystemApiHookFunction的Hooker函數。通過安裝自己的Hooker函數,就可以截獲系統內所有對文件I/O的API調用,從而實現實時監控。
=========================================
procedure TForm1.Button2Click(Sender: TObject);
begin
  {establish a notification for file name changes on the selected directory}
  NotificationHandle := FindFirstChangeNotification(PChar(DirectoryListBox1.Directory), FALSE,FILE_NOTIFY_CHANGE_FILE_NAME);
  {if the notification was set up correctly, modify some UI elements...}
  if (NotificationHandle <> INVALID_HANDLE_VALUE) then
  begin
    Button1.Enabled := TRUE;
    Button2.Enabled := FALSE;
  end
  else
  begin
    {...otherwise indicate that there was an error}
    ShowMessage('There was an error setting the notification');
    Exit;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  dwResult: DWORD;         // holds the result of waiting on the notification
  Waiting: Boolean;        // loop control variable
begin
  {setup the loop control for a continuous loop}
  Waiting := TRUE;
  {indicate that the application is waiting for the change notification to fire}
  Button1.Enabled := FALSE;
  StatusBar1.SimpleText := 'Now waiting for a filename change';
  Application.ProcessMessages;
  {enter the loop}
  while Waiting do
  begin
    {at this point, the application is suspended until the notification
     object is signaled that a filename change has occured in the
     selected directory (this includes file deletions)}
    dwResult := WaitForSingleObject(NotificationHandle,INFINITE);
    if (dwResult = WAIT_OBJECT_0) then

    begin
      {indicate that the notification object was signaled}
      ShowMessage('The selected directory signaled a filename change');

      {query the user to see if they wish to continue monitoring this
       directory}
      if Application.MessageBox('Do you wish to continue monitoring this directory?', 'Continue?', MB_ICONQUESTION or
                                MB_YESNO) = IDYES then

        {if the user wishes to continue monitoring the directory, reset
         the notification object and continue the loop...}
        FindNextChangeNotification(NotificationHandle)
      else
        {...otherwise break out of the loop}
        Waiting := FALSE;
    end;
  end;

  {close the notification object}
  FindCloseChangeNotification(NotificationHandle);

  {reset UI elements}

  Button1.Enabled := FALSE;
  Button2.Enabled := TRUE;
  StatusBar1.SimpleText := '';
  FileListBox1.Update;
end;
===========================================
下面是一個監視的控件:
unit dirnotify;

interface

uses
  Windows, Messages, SysUtils, Classes,
  Graphics, Controls, Forms, Dialogs;

type
  EDirNotificationError = class(Exception);

  TDirNotify = class;
  TNotifyFilter = (nfFileName, nfDirName, nfAttributes, nfSize, nfLastWrite,
    nfSecurity);
  TNotifyFilters = set of TNotifyFilter;

  TNotificationThread = class(TThread)
    Owner: TDirNotify;
    procedure Execute; override;
    procedure DoChange;
  end;

  TDirNotify = class(TComponent)
  private
    FEnabled: Boolean;
    FOnChange: TNotifyEvent;
    FNotificationThread: TNotificationThread;
    FPath: String;
    FWatchSubTree: Boolean;
    FFilter: TNotifyFilters;

    procedure SetEnabled( Value: Boolean );
    procedure SetOnChange( Value: TNotifyEvent );
    procedure SetPath( Value: String );
    procedure SetWatchSubTree( Value: Boolean );
    procedure SetFilter( Value: TNotifyFilters );

    procedure RecreateThread;

  protected
    procedure Change;
    procedure Loaded; override;

  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

  published
    property Enabled: Boolean read FEnabled write SetEnabled default True;
    property OnChange: TNotifyEvent read FOnChange write SetOnChange;
    property Path: String read FPath write SetPath;
    property WatchSubTree: Boolean read FWatchSubTree write SetWatchSubTree;
    property Filter: TNotifyFilters read FFilter write SetFilter default [nfFileName, nfDirName, nfAttributes, nfLastWrite, nfSecurity];
  end;


procedure Register;

implementation

const
  LASTERRORTEXTLENGTH = 500;

var
  LastErrorText: array [0..LASTERRORTEXTLENGTH] of char;


function GetLastErrorText: PChar;
begin
  FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM,
    nil, GetLastError, 0, LastErrorText, LASTERRORTEXTLENGTH, nil );
  Result := LastErrorText;
end;


procedure TNotificationThread.Execute;
var
  h: THandle;
  nf: Longint;
  wst: LongBool;
begin
  nf := 0;
  if (nfFileName in Owner.Filter) then nf := FILE_NOTIFY_CHANGE_FILE_NAME;
  if (nfDirName in Owner.Filter) then nf := nf or FILE_NOTIFY_CHANGE_DIR_NAME;
  if (nfAttributes in Owner.Filter) then nf := nf or FILE_NOTIFY_CHANGE_ATTRIBUTES;
  if (nfSize in Owner.Filter) then nf := nf or FILE_NOTIFY_CHANGE_SIZE;
  if (nfLastWrite in Owner.Filter) then nf := nf or FILE_NOTIFY_CHANGE_LAST_WRITE;
  if (nfSecurity in Owner.Filter) then nf := nf or FILE_NOTIFY_CHANGE_SECURITY;

  // yeahh, this one is stupid but Win98 malfunctions in any other value than 0 or 1
  if Owner.FWatchSubTree then wst := Longbool(1)
  else wst := Longbool(0);

  h := FindFirstChangeNotification( Pointer(Owner.Path), wst, nf );
  if (h = INVALID_HANDLE_VALUE) then
    raise EDirNotificationError.Create( GetLastErrorText );

  repeat
    if (WaitForSingleObject( h, 1000 ) = WAIT_OBJECT_0) then
    begin
      Synchronize(DoChange);

      if not FindNextChangeNotification( h ) then
        raise EDirNotificationError.Create( GetLastErrorText );
    end;
  until Terminated;
end;


procedure TNotificationThread.DoChange;
begin
   Owner.Change;
end;


constructor TDirNotify.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);

  FEnabled := True;
  FFilter := [nfFileName];
end;


destructor TDirNotify.Destroy;
begin
  FNotificationThread.Free;
  inherited Destroy;
end;

procedure TDirNotify.Loaded;
begin
  inherited;

  RecreateThread;
end;


procedure TDirNotify.SetEnabled(Value: Boolean);
begin
  if Value <> FEnabled then
  begin
    FEnabled := Value;

    RecreateThread;
  end;
end;


procedure TDirNotify.SetPath( Value: String );
begin
  if Value <> FPath then
  begin
    FPath := Value;
    RecreateThread;
  end;
end;


procedure TDirNotify.SetWatchSubTree( Value: Boolean );
begin
  if Value <> FWatchSubTree then
  begin
    FWatchSubTree := Value;
    RecreateThread;
  end;
end;


procedure TDirNotify.SetFilter( Value: TNotifyFilters );
begin
  if Value <> FFilter then
  begin
    FFilter := Value;
    RecreateThread;
  end;
end;


procedure TDirNotify.SetOnChange(Value: TNotifyEvent);
begin
   FOnChange := Value;
end;


procedure TDirNotify.Change;
begin
   if Assigned(FOnChange) then
      FOnChange(Self);
end;


procedure TDirNotify.RecreateThread;
begin
  // destroy thread
  FNotificationThread.Free;
  FNotificationThread := nil;

  if FEnabled and not(csDesigning in ComponentState)
    and not(csLoading in ComponentState) and (FPath <> '') then
  begin
    // create thread
    FNotificationThread := TNotificationThread.Create(True);
    FNotificationThread.Owner := self;
    FNotificationThread.Resume;
  end;
end;


procedure Register;
begin
   RegisterComponents('System', [TDirNotify]);
end;

end. 

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

国产午夜成人免费看片无遮挡_日本免费xxxx色视频_免费人成网上在线观看_黄网址在线永久免费观看

  • <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        亚洲国产岛国毛片在线| 在线精品国精品国产尤物884a| 国产成人精品免费网站| 91精品国产日韩91久久久久久| 成人免费一区二区三区在线观看| 91在线看国产| 一区二区三区四区视频精品免费 | 国产亚洲美州欧州综合国| 日韩高清在线一区| 欧美日韩国产中文| 婷婷久久综合九色国产成人| 欧美一级理论性理论a| 国产中文字幕精品| 国产三级精品视频| 日韩写真欧美这视频| 狠狠色丁香久久婷婷综| 欧美电影免费观看高清完整版在| 蜜臀av在线播放一区二区三区| 国产天堂亚洲国产碰碰| 色网综合在线观看| 奇米影视一区二区三区| 中文字幕+乱码+中文字幕一区| eeuss国产一区二区三区| 亚洲精品免费视频| 久久网站热最新地址| 成人午夜视频在线| 蜜臀精品一区二区三区在线观看 | 色婷婷国产精品| 91免费视频观看| 日韩电影在线看| 国产精品午夜春色av| 波多野结衣在线一区| 亚洲一区二区av电影| 91精品国产综合久久香蕉麻豆| 国产一区二区按摩在线观看| 亚洲黄色av一区| 精品国产青草久久久久福利| 成人黄页毛片网站| 久久精品国产久精国产| 亚洲高清免费观看高清完整版在线观看| 欧美一区二区三区男人的天堂| 国产一区二区在线观看免费 | 国产精品久久久久久户外露出| 欧美日韩国产另类一区| 波多野结衣在线一区| 国产精品羞羞答答xxdd| 亚洲一区二区三区美女| 精品福利视频一区二区三区| www.亚洲色图| 国产精品一区二区无线| 亚洲国产精品久久不卡毛片| 中文字幕日韩精品一区| 国产校园另类小说区| 欧美午夜一区二区| 成人性生交大片免费看中文| 奇米影视一区二区三区小说| 亚洲毛片av在线| 亚洲精品欧美综合四区| 亚洲日本丝袜连裤袜办公室| 国产精品九色蝌蚪自拍| 国产精品久久久久影院色老大| xvideos.蜜桃一区二区| 国产调教视频一区| 亚洲欧洲av一区二区三区久久| 国产精品不卡在线| 亚洲靠逼com| 婷婷久久综合九色综合绿巨人 | 亚洲成人午夜影院| 美女国产一区二区| 自拍偷拍国产精品| 国产亚洲精品7777| 国产精品久久久久久一区二区三区| 国产亚洲欧美一区在线观看| 久久九九国产精品| 日本一区二区三区国色天香| 国产日韩欧美精品一区| 中文字幕亚洲欧美在线不卡| 国产精品福利一区| 中文字幕制服丝袜一区二区三区| 久久综合国产精品| 久久亚洲私人国产精品va媚药| 精品久久人人做人人爽| 久久在线观看免费| 国产精品毛片久久久久久| 一区二区三区中文在线观看| 日韩高清一区在线| 成人免费黄色大片| 欧美三级午夜理伦三级中视频| 日韩免费性生活视频播放| 国产精品热久久久久夜色精品三区| 亚洲另类色综合网站| 久久综合狠狠综合久久综合88| 久久久不卡影院| 偷拍一区二区三区| 亚洲成a天堂v人片| 日韩电影一区二区三区四区| 亚洲婷婷国产精品电影人久久| 亚洲在线视频免费观看| 免费在线欧美视频| 成人黄色片在线观看| 欧美日韩免费在线视频| 久久久精品影视| 亚洲成人激情综合网| 国产乱码精品一区二区三区忘忧草 | 欧美精品自拍偷拍动漫精品| 中文成人综合网| 日本成人在线看| 成人三级伦理片| 午夜精品一区二区三区三上悠亚| 精品一区二区三区在线视频| 欧美性生交片4| 国产精品免费视频一区| 久久97超碰国产精品超碰| 在线观看视频一区| 中文字幕精品在线不卡| 久久精品免费观看| 欧美精选午夜久久久乱码6080| 亚洲视频在线一区二区| 国产成人午夜99999| 日韩一区二区电影| 水野朝阳av一区二区三区| 在线亚洲精品福利网址导航| 国产精品第四页| 菠萝蜜视频在线观看一区| 久久久国产一区二区三区四区小说| 调教+趴+乳夹+国产+精品| 色系网站成人免费| 亚洲人妖av一区二区| 99这里只有精品| 国产精品久久久久久久久免费樱桃| 国产在线视视频有精品| 日韩精品一区在线观看| 久久精品国产精品亚洲红杏| 日韩视频一区二区三区| 精东粉嫩av免费一区二区三区| 69久久夜色精品国产69蝌蚪网| 亚洲一区日韩精品中文字幕| 色诱视频网站一区| 国产欧美一区二区在线| 成人晚上爱看视频| 亚洲婷婷国产精品电影人久久| 成人免费福利片| 日韩美女视频19| 色综合久久久久综合体桃花网| 国产精品二区一区二区aⅴ污介绍| 97精品国产露脸对白| 亚洲一本大道在线| 欧美一级二级在线观看| 国内精品嫩模私拍在线| 国产欧美日韩在线看| 色综合一区二区三区| 亚洲午夜精品在线| 精品三级av在线| 91在线精品秘密一区二区| 一区二区三区在线免费视频| 51精品视频一区二区三区| 久久99久久精品欧美| 中文字幕的久久| 欧美日韩一级黄| 国产一区二区三区免费在线观看| 椎名由奈av一区二区三区| 欧美日本国产视频| 国产成人午夜片在线观看高清观看| 亚洲免费av观看| 日韩精品一区在线| 91天堂素人约啪| 免费在线欧美视频| 亚洲三级电影全部在线观看高清| 欧美一区二区成人6969| 99热精品国产| 久久丁香综合五月国产三级网站 | ㊣最新国产の精品bt伙计久久| 69堂精品视频| 99久久er热在这里只有精品15 | 成人av电影观看| 天天综合色天天| 亚洲视频资源在线| 精品国精品国产| 久久婷婷成人综合色| 日本一二三不卡| 免费不卡在线视频| 国产丝袜欧美中文另类| 欧美这里有精品| 国产成人精品综合在线观看 | 精品国产乱码久久久久久1区2区| 成人永久免费视频| 免费成人性网站| 亚洲靠逼com| 国产精品久久久久久久岛一牛影视 | 日韩精品免费视频人成| 亚洲视频在线观看一区| 久久久精品tv| 欧美成人精品福利| 在线综合亚洲欧美在线视频 | 国产传媒欧美日韩成人| 免费视频一区二区| 日韩不卡免费视频| 三级不卡在线观看| 日韩在线播放一区二区| 天天免费综合色|