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

        香蕉乱码成人久久天堂爱免费| 欧美一个色资源| 色综合久久综合网97色综合| 国产婷婷精品av在线| 成人深夜视频在线观看| 成人欧美一区二区三区黑人麻豆 | 五月天丁香久久| 欧美人与性动xxxx| 韩国理伦片一区二区三区在线播放 | 亚洲人成影院在线观看| 91国产免费观看| 六月丁香综合在线视频| 欧美国产日韩一二三区| 欧美无人高清视频在线观看| 久久精品99国产精品日本| 久久精品亚洲麻豆av一区二区| av激情综合网| 蜜乳av一区二区| ...xxx性欧美| 精品国内片67194| 欧美无砖专区一中文字| 国产精品自在欧美一区| 亚洲妇女屁股眼交7| 久久久久久日产精品| 欧美这里有精品| 成人午夜碰碰视频| 日本一道高清亚洲日美韩| 国产精品久久毛片av大全日韩| 在线电影一区二区三区| 成人app软件下载大全免费| 五月综合激情婷婷六月色窝| 国产精品日韩成人| 日韩一区二区中文字幕| 欧美亚洲免费在线一区| 成人综合婷婷国产精品久久蜜臀 | 国产欧美日韩综合| 欧美日韩高清不卡| 色综合 综合色| 成人精品视频一区二区三区 | 国产精一区二区三区| 亚洲成a天堂v人片| 亚洲精品视频在线观看免费| 国产午夜精品理论片a级大结局| 欧美男人的天堂一二区| 欧美综合在线视频| 99在线精品免费| 成人小视频免费观看| 国产在线播放一区三区四| 美女被吸乳得到大胸91| 日产欧产美韩系列久久99| 亚洲一区精品在线| 一区二区三区日韩在线观看| 亚洲欧美日韩国产手机在线 | 国产成人综合亚洲网站| 首页国产欧美日韩丝袜| 亚洲成人免费在线观看| 亚洲一区国产视频| 午夜精品爽啪视频| 免费日本视频一区| 激情综合色播五月| 国产伦精品一区二区三区免费| 久久国产精品第一页| 狠狠色综合日日| 国产成人在线网站| www.亚洲人| 色婷婷综合中文久久一本| 在线观看日韩国产| 91 com成人网| 欧美精品一区二区在线观看| 国产欧美在线观看一区| 亚洲天堂精品视频| 亚洲永久免费av| 麻豆一区二区99久久久久| 麻豆高清免费国产一区| 成人网页在线观看| 在线免费一区三区| 日韩欧美国产一区在线观看| 国产婷婷精品av在线| 国产精品大尺度| 亚洲成av人片一区二区| 欧美aaa在线| 国产成人在线电影| 色婷婷综合五月| 日韩精品一区国产麻豆| 中文字幕日韩一区二区| 日韩二区三区四区| 国产白丝精品91爽爽久久| 91美女片黄在线观看| 欧美一级一区二区| 亚洲欧美一区二区三区极速播放 | 一区二区三区中文字幕精品精品| 午夜伊人狠狠久久| 国产盗摄视频一区二区三区| 欧美性大战久久久| 国产午夜精品理论片a级大结局| 尤物视频一区二区| 国产精品影视在线观看| 欧美日韩一区 二区 三区 久久精品| 欧美一二区视频| 亚洲日本青草视频在线怡红院 | 亚洲天堂av老司机| 精品一区二区综合| 欧美乱妇一区二区三区不卡视频| 久久精品亚洲一区二区三区浴池| 亚洲午夜视频在线观看| 国产成人一区在线| 精品奇米国产一区二区三区| 午夜精品久久久久久久久久| 色久综合一二码| 国产精品不卡视频| 国产一区二区三区综合| 欧美图区在线视频| 亚洲男人都懂的| 大尺度一区二区| 久久久国产精品不卡| 男男gaygay亚洲| 欧美精选一区二区| 一区二区三区久久| 91国内精品野花午夜精品| 国产精品久久久久久久久果冻传媒 | 国产69精品久久777的优势| 欧美一级视频精品观看| 午夜欧美视频在线观看| 在线看不卡av| 亚洲综合小说图片| 欧美亚洲综合久久| 亚洲欧美乱综合| 91麻豆免费看片| 亚洲色图在线播放| 91在线看国产| 亚洲精品精品亚洲| 在线观看国产一区二区| 亚洲一区二区影院| 欧美三级欧美一级| 天堂在线亚洲视频| 欧美一级日韩不卡播放免费| 奇米一区二区三区| 日韩欧美国产一区在线观看| 美洲天堂一区二卡三卡四卡视频| 日韩欧美激情四射| 国产精品中文字幕日韩精品| 日本一区二区动态图| 99久久精品免费看国产免费软件| 亚洲欧美一区二区在线观看| 91小视频在线| 亚洲乱码日产精品bd| 欧美日韩在线精品一区二区三区激情| 一二三区精品福利视频| 欧美日韩免费一区二区三区视频| 五月婷婷久久丁香| 久久这里只有精品首页| 成人一区二区三区视频| 一区二区高清在线| 制服丝袜亚洲精品中文字幕| 极品美女销魂一区二区三区免费| 中文字幕不卡三区| 欧美日本在线观看| 国产精品自拍在线| 亚洲一卡二卡三卡四卡无卡久久| 制服丝袜国产精品| aaa亚洲精品| 麻豆成人免费电影| 自拍偷拍国产精品| 日韩一本二本av| 99视频热这里只有精品免费| 午夜精品在线看| 国产精品久久久久久亚洲伦 | 99久久99久久精品免费看蜜桃| 亚洲人成人一区二区在线观看| 91麻豆精品国产无毒不卡在线观看| 精品写真视频在线观看| 亚洲色图清纯唯美| 精品成人一区二区三区| 欧洲色大大久久| 国产成人精品影视| 免费在线观看一区| 一区二区三区中文字幕| 久久九九久久九九| 欧美精品乱人伦久久久久久| 成人av资源网站| 黑人巨大精品欧美一区| 午夜视频久久久久久| 亚洲视频在线观看一区| 久久丝袜美腿综合| 日韩小视频在线观看专区| 日本乱人伦一区| www.一区二区| 成人免费高清视频在线观看| 精品一区二区三区久久久| 舔着乳尖日韩一区| 香蕉成人啪国产精品视频综合网| 国产精品国产a级| 久久嫩草精品久久久精品| 欧美狂野另类xxxxoooo| 91视频com| 97se亚洲国产综合自在线观| 国产一区二区福利| 国产精品自在在线| 国内精品免费**视频| 蜜桃av一区二区|