Solved

How to collect info on the virtual drives?

Posted on 2006-07-13
6
173 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
  • 3
  • 3
6 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 125 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi custom sort exception 6 136
How to use Hashing sha1 in Delphi 2010 4 206
Delphi : could not find program, '...exe' 2 149
Base1 Encode/Decode 3 68
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

11 Experts available now in Live!

Get 1:1 Help Now