473,508 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preventing files being added to a directory

Is there an easy way to design a service that "listens" for attempts to
add files to a specified directory, and on detecting an attempt
starting another exe? I've no idea how feasible it is without getting
too deep into the WinAPI.

Nov 30 '05 #1
2 971
Greg,

You need to go deeper than the API for this. You need to write a system
level driver which will handle this, and you can't really do it in .NET (you
could write an unmanaged stub which will call managed code, but you can't
create the dll using managed code. Also, I don't know that system level
code should be managed, necessarily).

If you want to just trigger an action when something happens, the
FileSystemWatcher is what you want. However, it won't let you change the
action, which I think is what you are after.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg" <gr*************@yahoo.co.uk> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Is there an easy way to design a service that "listens" for attempts to
add files to a specified directory, and on detecting an attempt
starting another exe? I've no idea how feasible it is without getting
too deep into the WinAPI.

Nov 30 '05 #2
Thanks a lot Nicholas.

I'm definitely not prepared to start writing system level drivers, but
the FileSystemWatcher will do the trick - there are easy ways around my
problem now that I know about this class!

Thanks again,

Greg.

Nov 30 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2412
by: J C-W | last post by:
I have a directory with files (of various formats) contained within a website which uses PHP to control user access via session variables. I would like to protect the directory from direct external...
2
14146
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
1
1569
by: Eike | last post by:
Hi, I am unable to delete a subfolder that I have created programatically. I am using a modification of the apiSHFileOperation by Dev Ashish (http://www.mvps.org/access/api/api0026.htm) to copy...
4
2100
by: thoseion | last post by:
Hi, I am trying to get a program working whereby directory and file names are read into a list. I have been given the original list structure - it appears that the directory names should be added...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.