Drive Letter Proxy

I'd like advice on an approach to take to do the following.
What I need is to create a Virtual Drive that acts as a proxy to a different server for the file(s).

my virtual drive is z:\

You define what paths Z can list.

if myimage.gho is on \\server1\images then the user goes there

Is this even somewhat possible ?

Subst won't work because it only seems to take one path.
Who is Participating?
Eddie ShipmanConnect With a Mentor All-around developerCommented:
no can do, can you not understand it?
yewnixAuthor Commented:
Would it be possible to hook NtOpenFile / NtCreateFile and instead pass back the handle of the file I specify .. thus opening that file ?
Eddie ShipmanAll-around developerCommented:
You can map a network drive to the UNC path using WNetAddConnection2() and WNetCancelConnection2() to do the job. You can also use the "NET USE" command.

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Eddie ShipmanAll-around developerCommented:
Here's some code to do it, posted on the Borland NG's by John Leavey:

function Connect_Drive( Drive, Path: String ): Boolean;
  NR: TNetResource;
  w: DWord;
  WNetCancelConnection2( PChar( Drive ), 0, False );
  with NR do
    lpLocalName := PChar( Drive );
    lpRemoteName := PChar( Path );
    lpProvider := '';
    w := WNetAddConnection2( NR, nil, nil, 0 );
    Result := w = 0;
    on E: Exception do Result := False;
yewnixAuthor Commented:
  Thanks for the reply. However this solution isn't what i'm looking for as it wouldn't do what I need it to. Here is a more detailed explaination of what i'm looking at accomplishing

[computer with virtual drive shared as \\mainserver\images]

3 Servers each containing a part of the image.

A computer with a ghost bootdisk
Boots and maps a network drive letter I to \\mainserver\images
When the computer tries to open mike.gho the [mainserver] finds out what server has the first part, and hands off the handle of the file back to the unit trying to load the image
When the computer goes for the second and third part it would do that same.

So as I stated before I was wondering if I hooked the api call NtCreateFile on the [mainserver]
Then it would query a database to find out where that file is located... get the file handle off the associated \\server\image\<image part>
Then hand it back to the unit loading the image

Ofcourse the network shares would use the same username\password for every server so that authentication would be automatic.
Eddie ShipmanAll-around developerCommented:
I as totally unaware of any way to map one drive to THREE different computers.
Please enlighten me...

In the ghost bootdisk, can you modify the batch file it runs upon startup?
May I ask HOW ghost only took PART of the image in each gho file?
yewnixAuthor Commented:
I'm not wanting to "MAP" one drive letter to three computers.
Basically I just want to HOOK the API call and when the computer doing the image download trys to open the file
the server sees it(because of the hook) and then passes back the HANDLE of the file off of a different server.

I'm not modifying anything into bootdisk at all.
It will ALWAYS map to \\mainserver\images

yewnixAuthor Commented:
"May I ask HOW ghost only took PART of the image in each gho file?"

Ghost can split an image into mutliple parts.
I believe the standard 2GB.
So if my total image is 6GB then i have three parts, each 2GB large.
Eddie ShipmanAll-around developerCommented:
Ghost is the only thing that handles putting the parts together. there is no way for you to do it otherwise.
ghost uses it's own compression algorithm and you won't be able to even figure out where the file
lies, much less decompress it.
yewnixAuthor Commented:
GHOST is still opening the file and uncompressing it to disk..
Do you still not understand what i'm trying to do ?

When I state HANDLE of the file I mean it programmatically..
Eddie ShipmanAll-around developerCommented:
Do you understand what I'm saying?
Ghost is the only thing has the capability to locate/open those files.

Since they are compressed using Ghost's compression algorithm you won't be able to
do anything with them even if you ARE successful in locating the parts. There is no way to
"hook" into Ghost to capture the opening because Ghost runs in a DOS virtual machine.

I'd like to know why you are so adamant to do this, anyway.
yewnixAuthor Commented:
I'm not hooking GHOST. I'm hooking the main server that ghosts maps its drive letter to.

I would like to make my own DFS(Distrubuted File System)
Window's DFS does not offer me enough functionality
yewnixAuthor Commented:
You are saying I can't create an application that is ran on the main server that creates a virtual drive(shared as \\mainserver\images)
Then installs a hook on NtCreateFile....

and when a different computer boots ghost off a dos disk... maps to \\mainserver\images
and when it requests a file....
the application that implemented the hook catches this and says.. no here is a different file..
yewnixAuthor Commented:
Can anyone give an update on this please ?
yewnixAuthor Commented:
No longer an issue.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.