Solved

Drive Letter Proxy

Posted on 2006-11-07
15
187 Views
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).

ie:
my virtual drive is z:\

You define what paths Z can list.
\\server1\images
\\server2\images

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.
0
Comment
Question by:yewnix
[X]
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
15 Comments
 

Author Comment

by:yewnix
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 ?
0
 
LVL 26

Expert Comment

by:EddieShipman
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.

0
 
LVL 26

Expert Comment

by:EddieShipman
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;
var
  NR: TNetResource;
  w: DWord;
begin
  WNetCancelConnection2( PChar( Drive ), 0, False );
  with NR do
  begin
    dwType := RESOURCETYPE_ANY;
    lpLocalName := PChar( Drive );
    lpRemoteName := PChar( Path );
    lpProvider := '';
  end;
  try
    w := WNetAddConnection2( NR, nil, nil, 0 );
    Result := w = 0;
  except
    on E: Exception do Result := False;
  end;
end;
0
Independent Software Vendors: 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

by:yewnix
ID: 17948061
EddieShipman,
  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.
\\server1\images\image.gho
\\server2\images\image001.ghs
\\server3\images\image002.ghs

----------------------------------------
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.
0
 
LVL 26

Expert Comment

by:EddieShipman
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?
0
 

Author Comment

by:yewnix
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

0
 

Author Comment

by:yewnix
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.
0
 
LVL 26

Expert Comment

by:EddieShipman
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.
0
 

Author Comment

by:yewnix
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..
0
 
LVL 26

Expert Comment

by:EddieShipman
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.
0
 

Author Comment

by:yewnix
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
0
 
LVL 26

Accepted Solution

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

Author Comment

by:yewnix
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..
0
 

Author Comment

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

Author Comment

by:yewnix
ID: 18335607
No longer an issue.
0

Featured Post

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!

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

705 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