Solved

FindFirstChangeNotification

Posted on 1998-08-06
16
787 Views
Last Modified: 2008-02-01
i am using FindFirstChangeNotification / FindNextChangeNotification in a thread and it works fine.
What reports is only that something has changed in the defined directory or below.

I need to know in which subdir. the change was.
How can i use the handle (h) to find details?

path := stralloc(64);
path := 'c:\temp\';
h := FindFirstChangeNotification(path, BOOL(1), FILE_NOTIFY_CHANGE_FILE_NAME OR FILE_NOTIFY_CHANGE_DIR_NAME);
0
Comment
Question by:kyr
  • 6
  • 5
  • 2
  • +3
16 Comments
 

Expert Comment

by:kashif063098
ID: 1361636
hi
you can use Win32 api GetFileInformationByHandle() to get additional info of directory or file


0
 

Expert Comment

by:kashif063098
ID: 1361637
if you example,please let me know

0
 

Author Comment

by:kyr
ID: 1361638
are you sure?
Does GetFileInformationByHandle work with the handle that
FindFirstChangeNotification returns?

I couldn't make it work...
Actually this handle is a handle to a find change notification object.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361639
As far as I know, FindFirstChangeNotification is just stupid. You can't get further infos from your handle.  :-(
But I'm not so absolutely sure...
We solved this problem with a vxd driver. You can find a vxd sample "FileMonitor" on "www.sysinternals.com". It's just what you need. But I don't know if you really want to work with drivers. If you want, you'll need the example (see above) and Microsoft or Borland C compiler and vireo's vToolsD.
Sorry!
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1361640
Use ReadDirectoryChangesW instead

This gives you access to a structure called FILE_NOTIFY_INFORMATION which contains the name of the file and the operation performed.


0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361641
Works only with WinNT, I suppose...  :-(
0
 

Expert Comment

by:JimmyWhite
ID: 1361642
hi,

Look at Torry's Delphi Pages in the section vcl, files and drives or something like that and you will find 3 or 4 components with source which will do exactly what you want.
The best are : dirchange and dirmon.
0
 

Author Comment

by:kyr
ID: 1361643
Answers2000:
It is only for NT sorry... i cannot accept it. I cannot ever give it a try

JimmyWhite:
This is not what i am looking for.
The first one only tells you a change has occured, while the other one only monitors the current level of the giver directory, not its subs.

QUESTION TURNS TO:
what i found best is to try to connect to filevxd.vxf from filemon at www.sysinternals.com, and do the rest.
But i cannot convert the c code to obj.pascal (source code from site above).
I would appreciate any help to do this
(increased points to 150-tell me for more.)

0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:kyr
ID: 1361644
Adjusted points to 150
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361645
I'm not sure. Do you want to
(1) build the driver itself in Delphi or
(2) use vireo's driver and communicate with it in Delphi?
As far as I know (1) does not work at all. (2) should be possible, but where is your problem? Don't you understand C(++)? If so, I cannot help you, because I don't have the time to do the whole work for you. But if there are only some specific problems, tell me details...

Regards, Madshi.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1361646
0
 

Author Comment

by:kyr
ID: 1361647
ronit: they say nothing of great interest.
it is not that you/they cannot help.

i understand i am using the wrong approach.

the sysinternals vxd driver is abslutely the best solution.

Dear Madshi,
  -can i freely use the driver with a project currently developing?
  -i finally managed to connect to it from delphi and it works perfectly.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361648
kyr,

that's a good question. I don't know that either, because we built our own driver and only looked at the sysinternals sources. Please write to "cogswell@winternals.com". He will answer your question.

Regards, Madshi.
0
 

Author Comment

by:kyr
ID: 1361649
i am giving you the points Madshi!
please propose it as answer.
question is closed.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 150 total points
ID: 1361650
Thanks, kyr...   :-)
0
 

Author Comment

by:kyr
ID: 1361651
thanks too...

cu
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now