Clicky

I am using SHChangeNotifyRegister to monitor when someone copies files from the system to a USB stick.  The returned value is the path of the USB drive plus the name of the file.  This works fine because I know the drive letter the USB stick is mapped to.  

Now I want to monitor when files are copied FROM the USB stick.  Because the returned value is the TO address I don't know where the copied file has come from - (it could be another mapped drive).

Any ideas?

asked 12/11/2011 05:15

jdthedj's gravatar image

jdthedj ♦♦


5 Answers:

You must  capture globally for file and get first char. This is a drive letter.
Now you can get device/media type using and when it is DRIVE_REMOVABLE do something...



definition of GetDriveType you can fin in jcl/jvcl delphi package or JwaWinBase.pas
windows header translation.

link

answered

sinisav's gravatar image

sinisav

Thanks for the reply sinisav - I am already able to determine when a file is put onto the flash drive, but I need to know if a file is copied from there to the hard drive
link

answered 2011-12-11 at 23:58:12

jdthedj's gravatar image

jdthedj


Same procedure for checking DRIVE_REMOVABLE but with difference to check if
it is DRIVE_FIXED. So get source and destination drive letter and check:

1:
2:
3:
4:
...
    GetDriveType("A") = DRIVE_REMOVABLE
    GetDriveType("C") = DRIVE_FIXED
...

link

answered 2011-12-12 at 11:02:47

sinisav's gravatar image

sinisav

@sinisav You are not understanding the question.  I know all about the drives - I just want to know if a file has been copied from the flash drive to the hard drive.

Anyway I have found a workaround.  I fill a listbox with all the filenames from the flash drive, including subfolders, then when a file appears (is created) on another drive I check to see if it is in the list.  If it is there is a strong probability that the file came from the flash drive.
link

answered 2011-12-13 at 02:41:58

jdthedj's gravatar image

jdthedj

Found my own solution

link

answered 2011-12-13 at 10:57:48

jdthedj's gravatar image

jdthedj

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 12/11/2011 05:15

Seen: 148 times

Last updated: 12/17/2011 05:20