国产午夜成人免费看片无遮挡_日本免费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>

        三级一区在线视频先锋| 午夜欧美大尺度福利影院在线看 | 免费在线观看精品| 欧美三级韩国三级日本一级| 亚洲免费毛片网站| 欧美日韩电影一区| 国产一区二区日韩精品| 中文字幕永久在线不卡| 欧美日本一区二区在线观看| 免费高清在线视频一区·| 精品人在线二区三区| eeuss鲁片一区二区三区在线看 | 国产午夜精品福利| 91免费国产在线| 日本欧美在线观看| 一区在线观看视频| 欧美成人猛片aaaaaaa| 成人av午夜电影| 天天操天天综合网| 国产精品电影一区二区| 欧美精品在线一区二区| 成人午夜碰碰视频| 免费视频最近日韩| 亚洲欧美成人一区二区三区| 亚洲精品在线免费观看视频| 欧美日韩国产片| 成人高清在线视频| 美女免费视频一区| 亚洲欧洲在线观看av| 欧美一区二区二区| 在线观看视频一区二区欧美日韩| 国产精品888| 另类专区欧美蜜桃臀第一页| 亚洲成人动漫在线免费观看| 亚洲人成亚洲人成在线观看图片| 日韩欧美电影一区| 欧美乱熟臀69xxxxxx| 色婷婷av一区二区三区gif| 成人免费观看av| 国产精品77777| 国产一区欧美二区| 狠狠v欧美v日韩v亚洲ⅴ| 午夜影院在线观看欧美| 一区二区三区.www| 一区二区三区四区蜜桃| 专区另类欧美日韩| 国产精品久久久久影院亚瑟| 久久久www免费人成精品| 欧美一区二区网站| 欧美日韩精品是欧美日韩精品| 成人激情视频网站| 成人av集中营| 不卡av免费在线观看| 东方aⅴ免费观看久久av| 国产一本一道久久香蕉| 国产一区中文字幕| 夫妻av一区二区| 成人免费观看视频| 大胆亚洲人体视频| 成人黄页毛片网站| 91视频一区二区三区| 丁香六月久久综合狠狠色| 国产高清在线精品| 99久久亚洲一区二区三区青草| a亚洲天堂av| 欧洲视频一区二区| 欧美色综合影院| 欧美成人精精品一区二区频| 亚洲精品一区在线观看| 国产亚洲精品aa午夜观看| 国产精品午夜免费| 综合欧美亚洲日本| 午夜视频一区在线观看| 久久精品国产亚洲a| 国产九色sp调教91| 91麻豆视频网站| 欧美日韩亚洲不卡| 久久夜色精品一区| 中文字幕一区av| 亚洲自拍偷拍麻豆| 日日摸夜夜添夜夜添精品视频| 精品中文字幕一区二区| 91在线视频在线| 日韩一级片在线观看| 国产亚洲综合av| 亚洲一区二区三区中文字幕| 久久激情综合网| 色屁屁一区二区| 欧美mv日韩mv国产网站app| 中文字幕中文字幕在线一区| 日韩电影在线一区| 9久草视频在线视频精品| 日韩一区二区在线观看| 中文字幕在线一区| 麻豆精品一区二区综合av| 色拍拍在线精品视频8848| 久久先锋资源网| 亚洲成人午夜电影| 97成人超碰视| 久久久久久久久99精品| 亚洲国产精品久久久男人的天堂 | 国产成人精品综合在线观看| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 亚洲精品一区二区三区四区高清| 亚洲美女区一区| 国产乱码精品1区2区3区| 欧美巨大另类极品videosbest | 91免费视频网| 国产欧美日韩亚州综合| 美女视频黄久久| 欧美天堂亚洲电影院在线播放| 中文字幕成人网| 国产福利精品导航| 精品国精品国产尤物美女| 午夜精彩视频在线观看不卡| 成人av免费在线播放| 国产亚洲一本大道中文在线| 裸体一区二区三区| 51午夜精品国产| 亚州成人在线电影| 欧美午夜片在线观看| 亚洲免费资源在线播放| av在线一区二区三区| 国产精品麻豆欧美日韩ww| 国产**成人网毛片九色| 久久午夜免费电影| 国产伦精品一区二区三区视频青涩| 欧美一卡二卡在线| 蜜臀91精品一区二区三区 | 综合欧美一区二区三区| 不卡视频一二三四| 最新不卡av在线| 色噜噜久久综合| 亚洲成人综合在线| 欧美丰满少妇xxxxx高潮对白| 亚洲国产视频在线| 欧美日韩国产a| 美女爽到高潮91| 国产欧美一区二区三区鸳鸯浴 | 国产高清视频一区| 国产清纯白嫩初高生在线观看91| 国产一区二区三区高清播放| 国产日韩成人精品| 色综合久久综合| 亚洲成人久久影院| 7777精品伊人久久久大香线蕉超级流畅| 亚洲国产欧美日韩另类综合| 欧美丰满少妇xxxbbb| 日本人妖一区二区| 久久视频一区二区| 91免费视频网址| 日本网站在线观看一区二区三区| 精品国产一区二区三区四区四| 国产91对白在线观看九色| 亚洲欧美aⅴ...| 日韩欧美黄色影院| 99久久精品国产观看| 日本伊人色综合网| 国产精品亲子伦对白| 在线不卡一区二区| 国产91富婆露脸刺激对白| 亚洲国产精品自拍| 久久九九99视频| 欧美在线观看禁18| 九九**精品视频免费播放| 中文字幕一区二| 精品久久久久久久久久久院品网| 成人av免费在线播放| 日韩国产精品91| 综合久久综合久久| 久久新电视剧免费观看| 在线欧美小视频| 国产成人在线视频网站| 亚洲高清免费视频| 国产精品国产三级国产| 日韩免费高清视频| 欧美三级在线看| 99久久久无码国产精品| 极品少妇xxxx精品少妇| 亚洲va欧美va国产va天堂影院| 中文一区二区在线观看| 欧美一区二区三区四区视频| 91免费观看视频| 懂色av一区二区三区免费看| 久久超级碰视频| 午夜久久久久久电影| 国产精品白丝在线| 国产欧美一区二区精品性| 日韩欧美一级片| 欧美一级国产精品| 欧美日韩国产综合一区二区| 91小宝寻花一区二区三区| 国产一区二区不卡在线| 蜜臀av一区二区| 日本在线不卡一区| 日韩高清不卡一区二区三区| 亚洲国产视频a| 亚洲午夜av在线| 午夜天堂影视香蕉久久| 亚洲一区二区三区视频在线播放|