PeterdeB
asked on
How to collect info on the virtual drives?
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 :)
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 :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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(@lp szDrive, @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;
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(@lp
// 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;
ASKER
Geeez....even before I asked this question you already came up with the answer....this is really magic Mister Wizard!!
Regs Paul :)
Regs Paul :)
ASKER
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....
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....
ASKER
Regs Paul :)