The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Looking for a temporary virtual disk product

In Windows with C++, say you have a tool/library such as a browser control that works with files on the disk, such as webbrowser.Navigate2( "C:/file.htm" ).

Is there a C++ library out there that I can use to create a temporary disk in memory, say H:, then I save files on this virtual disk with normal Windows file APIs. Then I can call webbrowser.Navigate2( "H:/file.htm" ), and if file.htm happens to refer to image.bmp it will naturally look in the same virtual folder.

Ideally it would work like this:

TempVirtualDrive tvd = new TempVirtualDrive();
string strDrive = tvd.DriveLetter();
...

Then at program shutdown or when done with it:
delete tvd;

This would not only be useful for this webbrowser scenario, there would be many uses for this. My google searches didn't turn up anything encouraging though, so may be it is too difficult to implement considering all the file system issues.

If there is such a thing, what is it called?
Am I right in saying "temporary virtual disk"?
Is there an alternative to taking over a drive letter?

Thanks!
Anon and anon
Wednesday, March 08, 2006
 
 
It's called a ram drive. Not sure how you can set one up on the fly...
DJ
Wednesday, March 08, 2006
 
 
Thanks, yeah a "RAM drive" or "ramdrive" but I've had no luck finding anything for temporary use within a program (just to install semi-permanently). Oh well, it probably was a bad idea anyway because during the time you have this temp drive for your program, File Explorer etc could see it too... so that's not too useful.
Anon and anon
Wednesday, March 08, 2006
 
 
It's not exactly what you asked for, but maybe the subst command fills your needs.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/subst.mspx
R. C. James Harlow Send private email
Wednesday, March 08, 2006
 
 
AFAIK, there is no way to achieve that without administrator privileges in Windows. If you do have admin privileges, you can use e.g. FileDisk, FIFS, HttpDisk, Galen Hunt's proxy, etc. Read <http://www.acc.umu.se/~bosse/> carefully.

On Linux, you have FUSE (and proper setup) but you can generally do without admin privileges.

On Plan9, you have what you want. Win and Linux will catch up in 20 years or so.
Ori Berger Send private email
Thursday, March 09, 2006
 
 
Thanks again for the ideas. The point about Windows administrator privileges really finishes it off for me. I also read about Plan9, interesting.
Anon and anon
Thursday, March 09, 2006
 
 
If you are actually ascing question about IE (and not something like...) you can look into "Asynchronous Pluggable Protocols" ( http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/pluggable/overview/overview.asp )
that will provide functionality.
WildTiger Send private email
Thursday, March 09, 2006
 
 
Thanks for the APP suggestion. Yes that is certainly something to pursue in relation to the browser example I gave, although not relevant to the ram disk concept.
Anon and anon
Thursday, March 09, 2006
 
 
What about a temporary UNC local to your PC?

IE: webbrowser.Navigate2( "\\temp\myshare\file.htm" )

I've always wondered about how it would be possible to do that locally without a network connection and a server involved. UNCs are discovered on the fly by applications with no special permissions needed.
Bored Bystander Send private email
Thursday, March 09, 2006
 
 
Couldn't you just plug in a USB drive? That's RAM technically, isn't it?
Bill
Thursday, March 09, 2006
 
 
Thanks for the "temporary UNC" and "USB drive" suggestions but they don't serve the programmatic need as far as I can tell. The UNC would be great in that it doesn't utilize a drive letter, but the privilege issue is not with discovery it is with creating it.
Anon and anon
Friday, March 10, 2006
 
 
You can actually make IE call Into your program...

1. Your program just becomes a webserver and they connect on a weird port: http://localhost:34859/ for exmaple
2. You can actually hook IE to call DIRECTLY into your program. Google for "Asynchronous Pluggable Protocol"  Its ugly until you get it set up, and then its pretty simple. effectively you would be creating your own "protocol" extension, so links in your text would be like:
yourapp://somepage

I know Delphi has some components that do this out of the box, so I imagine you could find some 3rd party code to do this for you.

see:
http://tinyurl.com/zng69

original:
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/pluggable/overview/overview.asp
Michael Johnson Send private email
Friday, March 10, 2006
 
 
Oops, not out-of-the-box on Delphi, meant "available for free"..
Michael Johnson Send private email
Friday, March 10, 2006
 
 
Someone else mentioned the asynchronouse plugin protocol (APP). I have implemented one myself. Again, it does not solve the generic problem of the original post although it addresses the specific browser example.

There are only 2 ways to get images and other external files like css into a IWebBrowser-based control without putting them on disk first. APP is one, and a local webserver is another. A ram disk would theoretically be another way but it is problematic as discussed here. It is unfortunate that MS locked it down this way, but so is life.
Anon and anon
Friday, March 10, 2006
 
 
WAIT.. I just remembered!

RES:// !!!!


You can access Resources IMAGES in a dll (like that handy error page has the little refresh image. right click and see that it is a resource file)

I you have an image or static file you need, you can include it as a resource in a dll.
Michael Johnson Send private email
Friday, March 10, 2006
 
 
ex:

res://shdoclc.dll/warning.gif
Michael Johnson Send private email
Friday, March 10, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz