none
A way to detect the copy event of a specific folder&its files? RRS feed

  • Question

  • Hi everyone, I have some copyrighted files that will be temporarily saved to a specific folder and will be read and used by another app, and all the files will be wiped out as soon as my application or the application that reads the file closes. However, I don't want the user or any other programs to copy any of the files that are copyrighted, I am looking for a way to detect the copy event of any files that I saved in that folder, and to stop the copying process immediately. I did some research on this, but I didn't find any helpful content. Can anyone give me some ideas on how to detect a copy event and stop it? Or if I can't do that, can I get some suggestions on any other ways to prevent the files from being copied or being read by unauthorized programs? Thanks a lot!
    Tuesday, February 19, 2019 3:13 AM

All replies

  • Hi,

    If you want to make a file unreadable or copyable, you can do the following:

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 19, 2019 7:04 AM
  • Hi realDonaldTrump,

    In advance, sorry I have not made such software.

    But we can (may be able to) make it by using SetClipboardViewer function in Win32 API.
    Please read this article.  (This is written in Japanese. Please use machine translation)

    In short, we can know whether a data (copyrighted files, in your case) is copied into ClipBoard.
    This article teaches us how to do in C# and VB.NET.

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html

    Tuesday, February 19, 2019 7:38 AM
  • Will this file also be uncopyable when it goes to another computer? Will the administrator of another computer be able to edit the properties?
    Wednesday, February 20, 2019 1:56 AM
  • Thank you, I will take a look at the article!
    Wednesday, February 20, 2019 1:57 AM
  • Hi,

    I think you can test your problem.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 21, 2019 6:31 AM
  •  What type of files are you dealing with,  text files,  images,  or ???  Also,  is this second application that is reading the files an application you wrote?

     You are going to find that just about any which way you go about trying to stop a user from copying a file,  finding your folder/files,  or having access to them is a slim chance.  If you just stop them from being copied when the clipboard listener detects one being copied,  you still have the problem that the user could open your files with other apps and then just save them elsewhere.  That can not be detected by the clipboard.

     There is also the FileSystemWatcher class in .net which can detect a file/folder being copied,  deleted,  or changed.  However,  you still have the same problem,  the user could open them with another app and save the files elsewhere without you knowing.  The FileSystemWatcher can not detect another app opening the files.

     Then you also have the method of setting your folder to include the Hidden and System attributes which would make it not visible to most common users.  However,  if the user set the explorer options to not hide system files/folders,  the user would be able to see and access them.

     Another is to set the access control of the folder to deny access for the current user but,  that can easily be changed by the user right clicking your folder and changing the access rules to regain access to it and its files.

     So,  long story short,  you would be just as well off just saving your files in the AppData folder which is a hidden folder which a common user would not know existed,  nor would they normally be looking through it for your files if they did know it existed.

     Other than that,  if both applications are yours and only your apps are using the files,  then you could use your own method to scramble the files,  or encrypt the files before saving them to the hard drive.  Then make your other app so it can read them and unscramble or decrypt the files before it uses them.


    If you say it can`t be done then i`ll try it

    Thursday, February 21, 2019 7:36 PM