Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Intercept/Detect File Modifications

Intercept/Detect File Modifications

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Orlando_Herrera
    wrote on last edited by
    #1

    Hi developers!!!, I have a question in VB. (sorry, my english is bad) how can VB intercept a file operation? I've checked out the FileSystemWatcher sample from MSDN. but i don't know how detect when a user try modify or delete or open a File. For example y need intercept when the user or other program try modify or delete or open a file and after ALLOW or NO ALLOW these actios. Thanks !!! Orlando Herrera Mexico :)

    M O 2 Replies Last reply
    0
    • O Orlando_Herrera

      Hi developers!!!, I have a question in VB. (sorry, my english is bad) how can VB intercept a file operation? I've checked out the FileSystemWatcher sample from MSDN. but i don't know how detect when a user try modify or delete or open a File. For example y need intercept when the user or other program try modify or delete or open a file and after ALLOW or NO ALLOW these actios. Thanks !!! Orlando Herrera Mexico :)

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      I don't think you can unless you control the file manage program. Write your own explorer and add in the management you need. Not sure if you can actually remove explorer from the windows OS mind you.

      Never underestimate the power of human stupidity RAH

      C 1 Reply Last reply
      0
      • M Mycroft Holmes

        I don't think you can unless you control the file manage program. Write your own explorer and add in the management you need. Not sure if you can actually remove explorer from the windows OS mind you.

        Never underestimate the power of human stupidity RAH

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Explorer is just a pretty user interface onto the file system. It doesn't actually do much in terms of disk operations. That is all handed off to a lower level part of the operating system. In order to get the level of interaction with the file system the OP wants then he is going to have to learn some C or C++. This is not something that can be achieved in VB.

        Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

        L 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Explorer is just a pretty user interface onto the file system. It doesn't actually do much in terms of disk operations. That is all handed off to a lower level part of the operating system. In order to get the level of interaction with the file system the OP wants then he is going to have to learn some C or C++. This is not something that can be achieved in VB.

          Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You could store information about the files you want to protect (or even actual copies of the files). Then, when the FileSystemWatcher indicates a change has been made, you can determine whether that change was allowed. If it was, update your copy of the file with the new one. If not, then overwrite the changed file with your copy of that file.

          C 1 Reply Last reply
          0
          • L Lost User

            You could store information about the files you want to protect (or even actual copies of the files). Then, when the FileSystemWatcher indicates a change has been made, you can determine whether that change was allowed. If it was, update your copy of the file with the new one. If not, then overwrite the changed file with your copy of that file.

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            And in the meantime in a multi-user / multi-threaded environment another process has picked up the file that was "protected" before your process can get in there and change it back.

            Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

            L 1 Reply Last reply
            0
            • C Colin Angus Mackay

              And in the meantime in a multi-user / multi-threaded environment another process has picked up the file that was "protected" before your process can get in there and change it back.

              Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              There were no requirements given in the original post. Not all solutions apply in all situations. It's up to the poster to determine what is appropriate - not you.

              C 1 Reply Last reply
              0
              • L Lost User

                There were no requirements given in the original post. Not all solutions apply in all situations. It's up to the poster to determine what is appropriate - not you.

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                The JZ wrote:

                There were no requirements given in the original post

                Actually, there was. The OP wrote "For example y need intercept when the user or other program try modify or delete or open a file and after ALLOW or NO ALLOW these actios". The OP clearly states the need to "intercept" and "allow" or "no[t] allow" the operations. Your solution did not do that. It did monitor the action and correct it after the fact. That is not the same as the OP was asking - He didn't want the action to happen in the first place.

                Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

                L 1 Reply Last reply
                0
                • C Colin Angus Mackay

                  The JZ wrote:

                  There were no requirements given in the original post

                  Actually, there was. The OP wrote "For example y need intercept when the user or other program try modify or delete or open a file and after ALLOW or NO ALLOW these actios". The OP clearly states the need to "intercept" and "allow" or "no[t] allow" the operations. Your solution did not do that. It did monitor the action and correct it after the fact. That is not the same as the OP was asking - He didn't want the action to happen in the first place.

                  Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  There were no requirements pertaining to multi-users or multi-threading, as you posted. The question was to intercept file operations. There were no requirements as to how to that - user requirements, environment requirements, and so on. The only requirement that can be assumed is that VB must be used since this is a VB forum. I felt I had an idea to share. If you did not like my idea, I do not care. But if I feel I can provide an idea, I will continue to do so.

                  C 1 Reply Last reply
                  0
                  • L Lost User

                    There were no requirements pertaining to multi-users or multi-threading, as you posted. The question was to intercept file operations. There were no requirements as to how to that - user requirements, environment requirements, and so on. The only requirement that can be assumed is that VB must be used since this is a VB forum. I felt I had an idea to share. If you did not like my idea, I do not care. But if I feel I can provide an idea, I will continue to do so.

                    C Offline
                    C Offline
                    Colin Angus Mackay
                    wrote on last edited by
                    #9

                    The JZ wrote:

                    There were no requirements pertaining to multi-users or multi-threading, as you posted.

                    Yes, there was. It is running on Windows therefore the requirement exists by default. Just by booting windows you have many processes and services starting up - each of these has at least one thread, and they all run in many user accounts. A user is not necessarily a physical person.

                    The JZ wrote:

                    The question was to intercept file operations.

                    Yes, and that file operation would have to be made on some other thread somewhere otherwise what's to intecept. So that accounts for the multi-threaded part. And since threads can have different user security contexts that accounts for the multi-user part.

                    The JZ wrote:

                    If you did not like my idea, I do not care

                    You are arguing - therefore you care.

                    Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux My Blog

                    1 Reply Last reply
                    0
                    • O Orlando_Herrera

                      Hi developers!!!, I have a question in VB. (sorry, my english is bad) how can VB intercept a file operation? I've checked out the FileSystemWatcher sample from MSDN. but i don't know how detect when a user try modify or delete or open a File. For example y need intercept when the user or other program try modify or delete or open a file and after ALLOW or NO ALLOW these actios. Thanks !!! Orlando Herrera Mexico :)

                      O Offline
                      O Offline
                      Orlando_Herrera
                      wrote on last edited by
                      #10

                      SO.....in resume ? can i do it with VB or not? i think that people have diferents ideas, but is good all Replys. i want only controll with my application: for example: when a program try open "c:example.txt", my application notify to me "heeey program JON DOE(any example) want modify this FILE" and I clic ACEPT or DENY. LIKE Windows Vista is other good example. When you execute a program Vista ask you..."really, you want execute this program?" and you clic ACEPT or CANCEL

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups