Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to collect info on the virtual drives?

Posted on 2006-07-13
6
Medium Priority
?
185 Views
Last Modified: 2010-04-05
Hi my dear friends!

I figured out how to create virtual drives. Now I wnat to know how to read the path or folder to which they point. Where and how can I read or collect info on the virutal drives on my system?

Regards Paul :)
0
Comment
Question by:PeterdeB
[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
  • 3
  • 3
6 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 17104754

Paul,

If you are using DefineDosDevice to create the virtual drives, then the code here should be helpful to you:

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20855893.html

If you aren't using DefineDosDevice, can you tell us how you are creating the "virtual" drive letters?

Regards,
Russell
0
 

Author Comment

by:PeterdeB
ID: 17104824
Yesss perfect!! Thanks a lot!

Regs Paul :)
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 17104847
You are very welcome Paul...

I also wanted to add that pretty much all drives are just symbolic links, so when you are checking them, the ones that are mapped to paths will show up as:

\??\X:\path

and the physical one (drives) will show up as

\Device\DeviceName

So for the paths, you need to stip off the leading \??\

Just an fyi,
Russell

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 26

Expert Comment

by:Russell Libby
ID: 17104917
Code for cleaning up the return of GetSymbolicLink..

function GetSymbolicLink(Drive: String): String;
var  lpszPath:      Array [0..MAX_PATH] of Char;
     lpszDrive:     Array [0..2] of Char;
     lpszReturn:    PChar;
     dwSize:        DWORD;
begin

  // Copy the first 2 bytes of the drive over (we only need the X:)
  StrPLCopy(@lpszDrive, Drive, 2);

  // Null terminate
  lpszDrive[2]:=#0;

  // Allocate space for the result
  SetLength(result, MAX_PATH);

  // Query the DOS device
  dwSize:=QueryDosDevice(@lpszDrive, @lpszPath, MAX_PATH);

  // Set the length of the result
  if (dwSize > 0) then
  begin
     // Get pointer to string
     lpszReturn:=@lpszPath;
     // Check for path setting
     if (StrLComp(lpszReturn, '\??\', 4) = 0) then Inc(lpszReturn, 4);
     // Convert to string result
     SetString(result, lpszReturn, StrLen(lpszReturn));
  end
  else
     SetLength(result, 0);

end;
0
 

Author Comment

by:PeterdeB
ID: 17107065
Geeez....even before I asked this question you already came up with the answer....this is really magic Mister Wizard!!

Regs Paul :)
0
 

Author Comment

by:PeterdeB
ID: 17107167
I have some other questions too regarding Virtual Drives. I will post them immediately as new questions. Also your last reply on my unasked question, is worth quite some points. Last but not least I bumped into the topic you linked me to and noticed the forced accept.

I will pick my question more carefully more descriptive, this will help out others more easily. This valuable resource is without doubt the best available. Nothing but compliments on both the EE crew and its EE wizards out here!

Regs Paul :)

Many thanks many thanks my friend.....many thanks....
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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