Hide removable drive in the MS Windows explorer? - c

How can I hide the removable drive e.g. flash memory from the user in the MS Windows explorer ?
I want to hide the removable drive from the user and then do some operation on that e.g. delete some files or read some files from that and then show the drive to the user .
I was try to block the drive but when it become blocked I can't do any operations on it so I changed my approach to only hide the drive from the user .
I must do this with pure c and win32 api if needed .
Thanks a lot , good luck .

It should be pretty simple. There's a registry entry that is a 32 bit number that has a 1 in place where a drive should be shown. If you can extract the drive letter that you want, it should be as easy as then just editing this registry entry (which can be done with winapi i believe).
http://genesisdatabase.wordpress.com/2010/10/12/reading-and-writing-registry-in-windows-using-winapi/
Above is the winapi functions for editing registry. Just change it to hide the drive after extracting the letter.
Then edit this value:
http://www.howtogeek.com/howto/windows-vista/hide-drives-from-your-computer-in-windows-vista/
And then change the registry value again to show the drive. You don't want to unmap the drive, because that's a different concept than hiding the drive.

Related

Folder is empty while data transfer Sata Hard Drive From Laptop Into USB External Enclosure

I need a little help - I am trying to take the data from hard drive to another laptop using Sata Hard Drive (2.5" Serial ATA Hard Drive Enclosure). However, it is successfully recognized as E drive but the drive says it is empty. My user account has administrator access (full control)
I am able to see the drive as E drive
When E drive is opened, it says the folder is empty
This is the view including the hidden files. It shows only the system data from the SATA drive but not from the old laptop
The reason of this data transfer is that my laptop faced blue screen while starting Windows. Bios is working fine, so I tried system recovery from the latest backup. However, it crushes at some point. I attempted a few times but seems like when it reads the same point.
It would be appreciate if someone could advise on this. Thank you in advance.
This issue has been resoled with installation of MiniTool Power Data Recovery.

Unknow file extension with file name "store"

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).

How can I create a bootable dvd with custom DOS boot script?

We have a bootable USB stick that works perfectly. It will boot, ask the user for some options, then write files to the hard drive accordingly. We did this by using rufus-2.1, throwing freedos into the USB stick, and basically hijacking autoexec.bat. Autoexec.bat now executes some separate .bat scripts based on user input.
The problem is, we now want to have an option to allow users to burn an iso to a cd or dvd. We've been trying to create an image of the USB stick and burn it to a DVD.
We found plenty of information on this subject, but nothing has worked. We started by extracting the bootimage from various bootable iso files using imgburn. None of these worked. We tried extracting the bootimage from our USB stick, and that also didn't work.
Next we tried WinImage. We extracted the boot information from boot98.exe, hijacked autoexec.exe, created a new image and injected the files. We saved the files as a bootimage and tried the above method again, which also didn't work.
Is there perhaps a more straightforward way to execute DOS .bat scripts through cd/dvd boot? We'd be open to something other than DOS as well, as long as it can write files to a hard drive based on user input through a simple boot interface.
Note: The computer itself does not contain an operating system.
Thanks.
We found a very slick setup that does what we need. Unfortunately, the CD-ROM drivers do not work properly on modern DVD drives. Using this method, it should be possible to put all the scripts directly in autoexec.bat and run commands directly on the "simulated" floppy drive. For whatever reason, we can boot from the "floppy" section of the CD-ROM, but it cannot copy files from A: to C:. I believe we are very close, but no cigar.
http://www.hiren.info/pages/bootablecd
First method that actually produced a bootable CD and allowed scripts to be run by a choice entered by the user.

editing a batch file from shortcut causes the path of the shortcut to change

I've encountered a strange situation and I cant find any information for why it's keep happenning.
My enviorment: I got couple of terminals servers in my domain. I got all the users profiles stored in a diffrent "Main-server". When a user logs in there is a startup script that runs and copy the icons for the user-desktop to its currnet session from the "Main server". One of this icons is a shortcut to a batch file. The batch file itself is located in each of the Terminals servers, and the path for the shortcut is "C:\1st-dir\2nd-dir\run-script.bat".
The strange situation: When I press right-click on the shortcut and choose "Edit", the batch file itself is openned - no supprises here. I then close the file with no changes but now I see that the path for the shortcut have changed, and it's now go to "\\Terminal-serverX\C$\1st-dir\2nd-dir\run-script.bat". Even thou I got couple of terminals servers, it's keep reffering to the same one. I repeated this on diffrent shortcuts and got the same result.
Anyone know why does this happen ?
Looking closely at your post, the original C: got changed to \\Terminal-serverX\C$ when you used the short-cut.
It sounds like 'automated shortcut resolution' might be going on.
From the Microsoft page Disabling Automatic Network Shortcut Resolution
When you create a shortcut to a resource on a mapped network drive, and then remap the same drive to a different network resource, Windows attempts to connect to the original network resource when you access the shortcut.
Furthermore, when you re-establish the original connection, a different drive letter may be mapped to the original resource. This may cause programs to fail because the expected drive mappings are not present.
(I can't tell from your question what OS you are using, and admitedly that page only refers to Windows 95 and NT - so the details might be slightly different for a newer Windows version, but it does look very much like what you described)

Icons from remote files

I have started coding an FTP client application (for fun). I’m trying to represent remotely hosted files with icons. For example, let’s say I’m browsing the root folder of an FTP server (/) and want to display the Backup.zip file with the icon association from that client operating system. On some systems, this may be the windows compression icon and other operating systems this may be WinZip or WinRAR icons.
I have the client browsing local files with the SHGetFileInfo() function. This works great with files that are local, however, this function requires the physical file in order to retrieve the associated icon. So, this will not work with remotely hosted files. I have found some samples of loading icons given a file extension, and this is really where the question comes in... What would be the best strategy to get icons associated to remote files?
Go to the registry every time and look up extension to icon associations
Create 1 byte files with each extension and use the SHGetFileInfo() function for remote files (using local 1 byte files as association for remote files)
Other strategies???
What would a professional software company creating an FTP client do?
Thank you for your time.
-Jessy Houle
I suggest that you don't go to the registry every time: go if you need to, but if you've already been for a given filetype then remember/cache that result (within your program) and reuse it.
Use the procedure here from a previous Stack Overflow question on the same idea and uses the registry instead of an actual file.
How can I get the filetype icon that Windows Explorer shows?

Resources