Solved

How to collect info on the virtual drives?

Posted on 2006-07-13
6
172 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

18 Experts available now in Live!

Get 1:1 Help Now