netplaier
一般會員
發表:1 回覆:1 積分:0 註冊:2007-08-24
發送簡訊給我
|
Delphi自帶的ShellChangeNotifier檢測控件可以對目錄如創建,修改,刪除等操作的監控。 但是對臨時文件夾(rfTemplates)就不能判斷出具體創建的對象了,怎麽回事,這方面怎麽解決??? 我想對臨時文件夾中的一些特定類型的文件進行監控操作,請問還有沒有其它方法,搜了一些資料,說通過API到可以(在WIN32下用DELPHI偵測目錄變化,可用WIN32提供的文件改變通知API來完成。FindFirstChangeNotification, FindNextChangeNotification,FindCloseChangeNotification。 ),具體怎麽實現???
編輯記錄
netplaier 重新編輯於 2008-01-27 21:19:51, 註解 無‧
|
pcboy
版主
發表:177 回覆:1838 積分:1463 註冊:2004-01-13
發送簡訊給我
|
考慮看看用 HOOK API 攔截建立目錄的 API
------ 能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案!
子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問!
|
pceyes
尊榮會員
發表:70 回覆:657 積分:1140 註冊:2003-03-13
發送簡訊給我
|
|
pceyes
尊榮會員
發表:70 回覆:657 積分:1140 註冊:2003-03-13
發送簡訊給我
|
除了元件, 也可以研究Source CodeATFileNotification v.1.1.3 | FWS | 317 k | 31 Mar 2007 | By Alexey Torgashin. ATFileNotification is improved version of fisFileNotification component (which was originally written by FIS House). It allows to watch for files/directories changes and to fire an event when change occurs. Improvements are: - Component made Unicode compatible;
- FileName property added: you can watch for changes in a single file;
- Attempt to make component thread-safe (need feedback about it).
Fully functional
Source: Included
Exe-Demo Included
| Download: CB2k6 CB5 CB6 D2005 D2006 D5 D6 D7 | |
Alfa File Monitor Network Edition v.2004 | C | 945 k | 06 May 2004 | By Alfa Corporation. Alfa File Monitor (AFM) is a Delphi component designed for real-time file monitoring. The Lite version of AFM monitors Create, Rename and Delete events (files and directories fire separate events), whereas the Full version monitors all file events, including Read, Write, Flush, Close, Attribute Query, Attribute Change, Time Set, Time Change - in other words all file events You would need. AFM Supports Windows 95/ 98/ 98SE/ Me/ NT4/ 2000/ XP/ 2003.
Note: The demo version will work 3 months after download. After that date it should be removed from the system.
Evaluation (time-limit)
Source: On purchase/registration
Price: $1999.95
Exe-Demo Included
| Download: CB3 CB4 CB5 CB6 D3 D4 D5 D6 D7 | |
|
DCNotify v.1.00 | FWS | 8 k | 23 May 1997 | By Andrew Venmore. TDiskChangeNotify and TDiskChangeNotifyEx are two components that provide notification if any changes have taken place in a folder e.g. Files added/ deleted/ size or attributes changed.
Fully functional
Source: Included
| Download: D2 | |
|
DirMonitor v.1.2 | FWS | 264 k | 03 Dec 2002 | By Juan Carlos Molinos. This is a Windows API based component for monitoring any changes in specified local or remote folder. Unless other Directory Monitors, this one doesn't lose events, even remote. Monitored Events:
- File/Folder Creation, Modify, Change, Deletion, Rename.
- Security changes.
- A single notification for every event.
- Subdirectory notification.
- The event receives the Path File Name affected and selected Action.
Fully functional
Source: Included
Exe-Demo Included
| Download: D6 | |
|
Direcory Changes Monitoring Component v.1.0 | FWS | 8 k | 06 Nov 2000 | By Phaeteon. Direcory Changes Monitoring Component. You will be notified by all inserted, deleted, modified and renamed files or subdirs in a directory. It runs only under NT Plattforms.
Fully functional
Source: Included
| Download: D4 D5 | |
|
Disc Drive Monitor v.1.02 | FWS | 7 k | 04 Feb 1998 | By Grahame Marsh. A TThread class descendant to notify of changes to files and subdirectories. It encapsulates the FindFirstChangeNotification API. Includes a component wrapper for installation on the palette. Requires TBrowseDirectory component.
Fully functional
Source: Included
| Download: D2 D3 | |
|
ShellNotify v.1 | FNCS | 6 k | 24 Jun 2005 | By Federico Firenze. A non-visual componet to catch some undocumented FileSystem events. Such as: - File type association has changes;
- File attributes changes;
- A non-folder item creation / deletion / rename;
- A non-folder item deletion;
- Drive insertion / removed;
- Drive insertion and the Shell should create a new window for the drive;
- Storage media has been inserted / removed;
- Folder Creation / Deletion / Renamed;
- Folder Sharings / Unsharing;
- Network Disconnection;
- The contents of an existing folder changes;
- An image in the system image list changes;
- An existing nonfolder item changes, but the item still exists and has not been renamed.
Fully functional
Source: Included
Exe-Demo Included
| Download: D1 D2 D3 D4 D5 D6 D7 | |
|
TDirChange v.1.1 | FWS | 22 k | 18 Aug 1998 | By Tomasz Kustra. Small component for monitoring directory changes. Now monitors subdirectories.
Fully functional
Source: Included
| Download: D2 D3 | |
|
TDirMon v.1.00 | FWS | 10 k | 24 Feb 1998 | By Francois Piette. This component encapsulate the Win 32 API function FindFirst ChangeNotification. The primary purpose of this component is to monitor changes in a given directory and fire an event when a change occurs (file creation, deletion, etc).
Fully functional
Source: Included
| Download: D2 D3 | |
|
TFnugry DirWatch v.1.0 | FWS | 99 k | 16 Dec 1998 | By Gleb Yourchenko. FnugryDirWatch component wraps the ReadDirectoryChangesW API (NT Only) function that allows applications to respond to changes in the file system, such as new file and/or directory creation, renaming, size, attribute, and time changes, etc.
Fully functional
Source: Included
| Download: D3 | |
|
TFnugry FileNotify v.1.01 | FWS | 74 k | 16 Dec 1998 | By Gleb Yourchenko. TFnugryFileNotify component encapsulates FindXXXXChangeNotification API routines, and can be used to trace file system changes, including file or folder creation, change, access, or deletion.
Fully functional
Source: Included
| Download: D3 | |
|
TGFGLWatch FilesForDelete v.0.1 | FWS | 9 k | 05 Oct 1998 | By Greg Lorriman. Watched individual files for deletion or move using low priority threads. Better feedback than from windows notification API calls when tracking deletions.
Fully functional
Source: Included
| Download: D2 D3 | |
|
TOxygenDirectorySpy v.1.7 | SW | 315 k | 15 Aug 2006 | By Oxygen Software. TOxygenDirectorySpy component allows you to watch file system changes including file or directory creation, access, removing, changing size and attributes. The heart of this component is in that unlike plenty of similar tools, it returns the precise name of a directory or a file having been changed, along with former and current values of changed parameters. You can watch file system changes even on network drives. Now you can monitor multiple directories including their subdirectories. Note: Monitoring subdirectories is not supported by Windows 95/98. If you need it, you should add all these directories manually to Directories property.
With Nag-Screen
Source: On purchase/registration
Price: $25
| Download: D2005 D2006 D3 D4 D5 D6 D7 | |
|
TSHChangeNotify v.3.0 | FWS | 24 k | 12 Oct 2000 | By Elliott Shevin. TSHChangeNotify traps certain events in the system and invokes a event handler in your program when the corresponding event occurs, passing information relating to the event. Examples of events and what you receive are: CD inserted or removed (the path of the CD drive); file renamed or moved (before and after path and file names.
Fully functional
Source: Included
| Download: D2 D3 D4 D5 | |
|
TfisFile Notification v.1.00 | FWS | 5 k | 04 Aug 2000 | By First Internet Software House. This non-visual component monitors the contents of a directory or directory tree. Many different file changes can be monitored such as file size, last write, creation & deletion etc. An event is triggered when these occurs.
Fully functional
Source: Included
| Download: CB3 CB4 D2 D3 D4 D5 |
|
------ 努力會更接近成功
|
bugmans
高階會員
發表:95 回覆:322 積分:188 註冊:2003-04-12
發送簡訊給我
|
|
netplaier
一般會員
發表:1 回覆:1 積分:0 註冊:2007-08-24
發送簡訊給我
|
感謝樓上的幾位答案,的確可監控文件,新建,刪除,修改等操作!與Delphi 7工具面板中Samples頁自帶的ShellChangeNotifier控件的性質與使用方法上基本類似, 在獲取操作對象的路徑(如新建一個文件)上,如何正確讀取其路徑呢?? Delphi自帶的 ShellChangeNotifier使用DEMO可以看這,完全可实现上述FileNotification第三插件的功能。 http://www.delphibbs.com/keylife/iblog_show.asp?xid=4265------------------------------------------------------------------------------- 對與上述所講到對過HOOK API進行操作,不知有具體實例沒??
|
change.jian
版主
發表:29 回覆:620 積分:439 註冊:2003-06-02
發送簡訊給我
|
1.理論上,上述的回覆及您所提的方法,都可以監看到檔案或目錄的變更.您所謂不能監看,小弟大膽猜測應該是程式那裡有 bug 才是. 2.依您的需求,不建議您去使用 Hook API 的技術來做,理由很簡單:吃力不討好. (1)必需先完成所有改變檔案/目錄的 API hook 才行,換言之,您得把所有相關的 API 都 HOOK 到....很累的. (2)由於要 Hook 的對象是不定對象,換言之,您必需要想辦法讓您的 dll (HOOK API) inject 到其他的 process 之後還能不弄掛那些 process,這個並不容易. (3)若真的要很穩的監控,建議您朝 driver 著手, google 一下 filemon 關鍵字,應該可以找到不少資料 (4)若想要 HOOK API 的資料,可以 google 一下 RootKit 這個字,應該也可以找到你要的東西
PS:補充一下,在 VS 2003 /2005 上有您要的元件,叫 FileSystemWatch 的,您也可以參考看看
|
terrygobb
一般會員
發表:5 回覆:22 積分:5 註冊:2009-04-27
發送簡訊給我
|
受教嚕~~感謝分享~~
研讀中~
------ 尋找對的人,對的方法,對的態度跟對的環境
|