Drive Letter Proxy

Posted on 2006-11-07
Last Modified: 2010-04-05
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.
Question by:yewnix
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6

Author Comment

ID: 17898451
Would it be possible to hook NtOpenFile / NtCreateFile and instead pass back the handle of the file I specify .. thus opening that file ?
LVL 26

Expert Comment

ID: 17938418
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.

LVL 26

Expert Comment

ID: 17938427
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;
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 17948061
  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.
LVL 26

Expert Comment

ID: 17948479
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?

Author Comment

ID: 17948712
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


Author Comment

ID: 17948751
"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.
LVL 26

Expert Comment

ID: 17949096
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.

Author Comment

ID: 17949152
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..
LVL 26

Expert Comment

ID: 17949981
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.

Author Comment

ID: 17950616
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
LVL 26

Accepted Solution

EddieShipman earned 500 total points
ID: 17950778
no can do, can you not understand it?

Author Comment

ID: 17951086
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..

Author Comment

ID: 18166430
Can anyone give an update on this please ?

Author Comment

ID: 18335607
No longer an issue.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question