Solved

How to collect info on the virtual drives?

Posted on 2006-07-13
6
181 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 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
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, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

624 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