How to start VbScript if someone access on my extern hard disk - vbscript

i have an extern hard disk connected with my router. Now everyone in my homenetwork have access to the external hard disk. Is it possible to start an vbscript if someone access my external hard disk?
regards

There are ways to do this but they require that you change your design a little. The easiest way, would be to redirect the access of your external drive through a file server. (It could just be a Windows desktop).
Remove the share access from your external hard drive for everyone except your File Server, create a share on the file server that connects to this external drive, and have everyone use the hard drive through the share on the File Server.
Then you can get creative with scripts that monitor share usage like the link in
this example.
This comes with the drawback that your file server will need to be on in order for the hard drive to be accessible.

Related

How to create a software-implemented drive

There are some applications (let us call them providers), which (when running) provide a virtual file and directory structure under a new drive letter. Access requests from other processes to those files and directories are served by the provider.
One example of such provider could be the Google Drive for Windows (the new one, not the old Backup and Sync), which maps the contents of your Google Drive to a chosen drive letter.
I thought there should be some simple user-mode API, which should allow my app to provide a new drive and the contents of files and directories on it. I thought that many applications use such API, but I cannot find it. The closest I could get are IFS (installable file system drivers) and file system filter drivers, but those are kernel-mode and they seem too complex. They just seem not designed to accomplish such task.
So, what API should I use to make a simple software-implemented drive?
In addition to the suggestions in the comments there is also now the Projected Filesystem, which allows software to provide a drive-like interface though callbacks and not just by creating an actual disk image. It is my understanding that Projected FS is how, for instance, SQL Server does its table-backed files interface.

How to detect Windows file closures locally and on network drives

I'm working on a Win32 based document management system that employs an automatic check in/check out model. The model it currently uses for tracking documents in use (monitoring the processes of the applications that open the documents) is not particularly robust so I'm researching alternatives.
Check outs are easy as the DocMgt application is responsible for launching the other application (Word, Adobe, Notepad etc) and passing it the document.
It's the automatic check-in requirement that is more difficult. When the user closes the document in Word/Adobe/Notepad ideally the DocMgt system would be automatically notified so it can perform an automatic check in of the updated document.
To complicate things further the document is likely to be stored on a network drive not a local drive.
Anyone got any tips on API calls, techniques or architectures to support this sort of functionality?
I'm not expecting a magic 3 line solution, the research I've done so far leads me to believe that this is far from a trivial problem and will require some significant work to implement. I'm interested in all suggestions whether they're for a full or part solution.
What you describe is a common task. It is perfectly doable, though not without its share of hassle. Here I assume that the files are closed on the computer where your code can run (even if the files are stored on the mounted network share).
There exist two approaches to controlling the files when they are used: the filter and the virtual filesystem.
The filter sits in the middle, between the process and the filesystem (any filesystem, either local, network or fully virtual) and intercepts file requests that go to this filesystem. Here it is required that the filter code is run on the computer, via which the requests are passed (this requirement seems to be met in your scenario).
The virtual filesystem is an endpoint for the requests that come from the applications. When you implement the virtual filesystem, you handle all requests, so you always fully control the lifetime of the files. As the filesystem is virtual, you are free to keep the files anywhere including the real disk (local or network) or even in the cloud.
The benefit of the filter approach is that you can control individual files that reside on the real disks, while the virtual filesystem can be mounted only to the new drive letter or into the empty directory on the NTFS drive, which is not always fisible. At the same time, sitting in the middle, the filter is to some extent more restricted at what it can do, and the files can be altered while the filter is not running. Finally, filters are more complicated and potentially error prone, as they sit in the middle and must play nice with other filters and with endpoints.
I don't have specific recommendations, but if the separate drive letter is an option, I would recommend the virtual filesystem.
Our company developed (and continues to maintain for the new owner) two products, CBFS Filter and CBFS Connect, which let you create a filter and a virtual filesystem respectively, all in the user mode. Those products are used in many software titles, including some Document Management Systems (which is close to what you do). You will find both products on their website.

How to design cloud based filesystem via osxFUSE

Currently i'm working on FUSE based filesystem, that loads file from cloud and stores in local cache.
On user side im using obj-c framework, that wraps Fuse C high level API.
User can see all his files from cloud storage in a listing of a mounted drive. It is just 'ghost' files, not actually stored in local cache.
When user double click on a file, downloading of a file starting.
Under the hood, i block every 'readFileAtPath' call from fuse, till requested chunk of a file data is loaded.
That leads to different freezing issues in Finder and other apps.
For example, when file loading and a reads calls blocked, 'contentsOfDirectoryAtPath' is also blocked - user can't browse a drive, it appears empty, or folders content is incomplete.
I cant respond with error when user clicked on a file, i should download it and provide it content.
Now i'm thinking, is it a correct way to implement such functionality?
Anyone with similar requirements who resolved such issues?
Thanks for any ideas.

Very low disk access in Windows -disk.sys api

I'm looking for some documentation/clues about how would it be possible to read a disk in Windows without the using CreateFile() on a volume. For example the standard files functions only give an access to formated disk.
Is there any kind of documentation about the driver disk.sys such as an export list, functions prototypes etc ?
Would the direct use of the driver be the right approach ?

boost::interprocess between Windows service and user application

I'm using boost::interprocess to communicates between two applications. When the two applications are launch by the same user, it works great.
When one of the application is a service, it fails.
I found that the shared media is in fact a file that is created in the "TMP" directory. So it fails because each application is creating his own file in his own "TMP" directory.
Maybe I'm not using it the good way for my particular purpose.
Does anybody having a clue of how to solve my problem?
Thanks a lot,
Nic
EDIT:
I tried using "managed_mapped_file". My problem is that the win32 implementation is calling "CreateFileMapping" without specifying a name for the object. In my special case, I think I need to specify something like "Global\MyMappedFile" so that both the application and the service can view the mapped file.
Here is something that works :
I'm using "boost::interprocess::managed_windows_shared_memory"
The name of my section is "Global\MySharedMemory"
I have to handle the case where the application is started and the service not. This is because even if my application can have read/write access to the shared memory, it can't create it. Only the service can. (In fact, the application can if and only if the user running it has a special privilege SeCreateGlobalPrivilege)
Maybe somebody can find a better way ;-)
Nic
it's something about the Window Stations and ACL. you need to modify the source to make it work between windows service and user application.
in vista and win7, services run at winsta0, but applications at winsta1. so you need to give a LPSECURITY_ATTRIBUTES with the right DACL.

Resources