Ok, I checked into this and SetVolumeMountPoint can only be used for physical mount points like \Device\etc and does not work for these virtual mappings we are dealing with. All documentation indicates that these settings are not persisted across a reboot, and I found no good examples of how to handle this. After some thought, I came up with the following: when we persist the info for the drive, we create an entry in the registry key:

So when the user logs in, the Run will execute our subst command, and is able to handle mutliple settings because the CMD processor sees the "&" as a command break. The small downside is that the user sees a quick console window during startup, but the upside is that the code can deal with adding/removing these settings directly, and does not rely upon some other process or program to perform the mappings during startup (another alternative). I have also taken the time to wrap the code into a container object and interface item class, where the container can return useful drive listing information, as well as an array [A]..[Z] of SymbolicDrive items. To reduce your learning curve and implementation time, I also revamped the code I gave you earlier today so that it works on this new unit.

Regards,
Russell

unit SymbolicLink;
////////////////////////////////////////////////////////////////////////////////
//
// Unit : SymbolicLink
// Author : rllibby
// Date : 07.14.2006
// Description : Symbolic link handling class for Delphi. The code used
// within the class relies upon Windows 2000 or higher, and
// allows for persisting drives by creating a Run command
// that has the list of drives (paths) to SUBST when the PC
// restarts and is logged back in.
//
////////////////////////////////////////////////////////////////////////////////
interface

////////////////////////////////////////////////////////////////////////////////
// Interface for symbolic drive link
////////////////////////////////////////////////////////////////////////////////
type
ISymbolicDrive = interface(IUnknown)
['{6430AC48-3C1A-45AA-A5C5-FE0785756911}']
// Returns the drive letter only
function DriveLetter: Char;
// Determines if the drive letter is available for use (currently unmapped)
function IsAvailable: Boolean;
// Determines if the drive letter is a virtual mapping for a physical path
function IsPath: Boolean;
// Determines if the drive letter has been persisted to the registry
function IsPersisted: Boolean;
// Persist or remove the registry info for this drive, depeding on the Keep parameter
procedure Persist(Keep: Boolean = True);
// Returns the device of path that a drive is mapped to
function GetDevicePath: String;
// Sets the virtual device path. If already mapped, the current mapping is removed.
// If the new path is blank, the drive is not remapped.
procedure SetDevicePath(Value: String);
// Property to get / set the device path
property DevicePath: String read GetDevicePath write SetDevicePath;
end;

// 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) or (StrLComp(lpszReturn, '\\.\', 4) = 0) then Inc(lpszReturn, 4);
// Convert to string result
SetString(result, lpszReturn, StrLen(lpszReturn));
end
else
// Failed to get path
SetLength(result, 0);

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…