I need to create a "virtual file", a file that if some program access that file, e can answer the size, permissions, and 'say' what is writen in it.
Why?
I have a Virtual Machine that have and Virtual Hard Disk, and i need that file be a 'link' to other and far location (unknow by Virtual Machine Program)
When the VM try to read, i need to 'say' what is writen, and when it´s try to write, i need to store in other location.
In most cases the file is in a network and splited in many computers (like a Network FileSystem) then i need to know every change/access/read in file and deal with the request.
I can't modify/inject the target program (third-party).
I found a question in this site about Virtual File, but i need to know in real time all changes in the file.
I searched for File Hooks and found nothing.
I tryed to use a virtual driver, but it´s hard to find some code (like Daemon Tools, but with Read/Write).
I thought in a remote folder (or mapped drive) with FTP, but the file size is TOO big (10-50 GB) and i need to read specific sections of the file.
Thanks in advance for any help.
(Windows)
What you are looking for is called a Filter Driver.
Related
This is by no means a "give me the solution" question, but more to gain a higher understanding. Please feel free to point to references where I can learn more about this, I've tried searching and all I get are how to's for setting up and accessing network drives.
I want to be able to monitor a file on a windows machine, but the file sits on a shared drive hosted locally. If it is manipulated by another machine, is there a process I can look for that will indicate that the file may be accessed by a resource elsewhere on the network? I understand that the host machine must be available in order to access the file in the first place, but what processes are called to actually manipulate the file. Is this below the OS level? I have access to a minifilter driver that I can ask a more experienced developer on the team to help me with if need be.
I was trying to reduce some disk space on on my external hard drive and I found a New folder with a file in it. When I opened the folder there was file with the name "store" and no extension. The size of the file is 5.24 GB does anyone know what could it be and is it safe to delete it as I have plenty of data on the External hard drive about 1TB which I cannot loose. please find the screenshot of the image here
If everything else looks and works fine then I'd just delete it. I'm guessing the file was created by a program, perhaps as temporary storage. To be more cautious you could move the file from your external hard drive to your computer, make sure everything works as expected, then either move the file back or delete it accordingly.
Initially I thought the worst case scenario was that the file was some file system information or driver that your computer wasn't recognizing and deleting it would cause corruption. However since it's always connected to the same computer and all the files etc look fine, the worst thing I can think of is that it's the results of a virus scan or some user settings. Therefore it should be safe to delete.
Side note: in the file properties details tab near the bottom there might be an "Owner" listed although it will probably be (your computer's name) / (your username).
I want to essentially make it so that you never need to unzip/unrar any files. Currently, I have a Dokan filesystem which can do it given a specific zip file but I wanted to know how I can make it apply to all files. Meaning, I want to be able to compile a program that has "fopen("test.zip/1.jpg", "rb");". I think that a Shell Extension would work for dynamically loading the file into the filesystem IF I were browsing in the shell explorer but that doesnt help me with the fopen example. Any ideas?
What you want to do can be used with help of file system filter driver, which would track directory enumeration requests and report directories in place of ZIP files. Then this driver would create virtual files and take the data from ZIP archives. Quite a lot of kernel-mode work, I should say. And file system filter driver is not a file system driver, so dokan won't help you at all.
I have two disks as .vmdk files, and four as .vdi files. I can boot virtual machines on them with Sun xMV VirtualBox, and they work just fine. However, I want to mount them on my local computer so I can read some files off of them without starting a virtual machine. I downloaded the vmware-mount utility, but I get this error:
Unable to mount the virtual disk. The disk may be in use by a virtual
machine, may not have enough volumes or mounted under another drive
letter. If not, verify that the file is a valid virtual disk file.
Thinking it's a problem with the utility, I downloaded the SDK and made my own simple program in C to try to mount a disk. It just initializes the API, connects to it, then attempts to open the disk. I get this error, once again claiming it is not a virtual disk:
**LOG: DISKLIB-DSCPTR: descriptor above max size: I64u
**LOG: DISKLIB-LINK : "f:\programming\VMs\windowstrash.vdi" : failed to open (The file specified is not a virtual disk).
**LOG: DISKLIB-CHAIN : "f:\programming\VMs\windowstrash.vdi" : failed to open (The file specified is not a virtual disk).
**LOG: DISKLIB-LIB : Failed to open 'f:\programming\VMs\windowstrash.vdi' with flags 0x1e (The file specified is not a virtual disk).
** FAILURE ** : The file specified is not a virtual disk
The files are clearly virtual disks, though, since I can actually mount and use them with a virtual machine. I tried detaching them from any VMs and trying again, but I got the same results.
Any ideas? Maybe the "descriptor above max size" is a hint?
.vdi is a VirtualBox supported format, but not supported by VMWare.
The .vmdk files are VMWare images - you should be able to load them fine using the vmware tool (VirtualBox supports these too, but the converse is not true).
However, if you are trying to just mount the VDI image somehow....
Try this blog
http://bethesignal.org/blog/2011/01/05/how-to-mount-virtualbox-vdi-image/
This is what you exactly should watch, if you wanna get this done within seconds.
I only posted this, since the other people who visit this page would find it easier.
Thanks.
In a case of removal of this blog in Future, posting the content briefly here would be helpful. So I would extract the contents and post it here as well.
Be the super user
sudo su
Load the nbd kernel module. - the network block device module
modprobe nbd
run qemu-nbd, which is a user space loopback block device server for QEMU-supported disk images. Basically, it knows all about weird disk image formats, and presents them to the kernel via nbd, and ultimately to the rest of the system as if they were a normal disk.
qemu-nbd -c /dev/nbd0 <vdi-file>
That command will expose the entire image as a block device named /dev/nbd0, and the partitions within it as subdevices. For example, the first partition in the image will appear as/dev/nbd0p1.
Now you could, for instance, run cfdisk on the block device, but you will most likely want to mount an individual partition.
mount /dev/nbd0p1 /mnt
When you’re done, unmount the filesystem and shut down the qemu-nbd service.
umount /mnt
qemu-nbd -d /dev/nbd0
Hi all I was wondering how (if possible) to change to an external HDD in C. I am writing a program that works with an external HDD.
Thanks much,
Mr. Man
Be wary of changing directory within a program - all that's usually needed is to open the files on the external device without actually changing directory to it.
However, on both Windows and Unix, the basic answer is via a 'change directory' operation. On Unix-like platforms, that is the 'chdir(2)' system call; your program should specify the name of the directory where the external hard disk is mounted, and then relative pathnames will write to appropriate locations on the disk (subject to the path name not containing too many "../" sequences).
On Windows, you would need to ensure you specify the drive letter as well as the path on the hard drive.