Intercept/Detect File Modifications
-
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 :)
-
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 :)
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
-
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
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
-
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
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.
-
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.
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
-
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
-
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.
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
-
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
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.
-
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.
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
-
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 :)
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