Solved

Drive Letter Proxy

Posted on 2006-11-07
15
171 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
  • 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
 

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now