Hello all,

I'm using MapDrive UDF from Jens Meyer (sealeopard@usa.net) to map network drives, but it seems that clients with win2k have problems with the 'labeling' facilitie...

Is there a limitation to the label (less then 20)?

The UDF is below, thank you all.
code:
;FUNCTION      MapDrive
;ACTION Maps a UNC name to a specific driveletter
;AUTHOR Jens Meyer (sealeopard@usa.net)
;VERSION 1.44 (removed issue where label was not applied when mapping to already mapped drive)
; 1.43
;DATE CREATED 2001/12/20
;DATE MODIFIED 2003/05/13
;KIXTART 4.12+
;SYNTAX MAPDRIVE(DRIVE, UNC [, PERSISTENCE, LABEL])
;PARAMETERS DRIVE
; Required string containing driveletter or *
; UNC
; Required string containing UNC name
; PERSISTENCE
; Optional boolean indicating a persistent connection
; LABEL
; Optional string to relabel a mapped share (Windows 2000/XP/2003 only)
;RETURNS 0 or the error code @error
;REMARKS 'Persistent' is not supported under Windows 9x to prevent different users
; from receiving drive shares they should not have access to. Deep mapping is
; not supported under Windows 9x.
;DEPENDENCIES none
;EXAMPLE $rc = MAPDRIVE('z','\\SERVER\share',1)
; $rc = MAPDRIVE('*','\\SERVER\share',0,'whatever')
;KIXTART BBS http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000108
Function mapdrive($drive, $unc, optional $persist, optional $label)
Dim $mount, $subkey, $regvalue, $rc, $iErr, $driveobj
Dim $deep, $regkey
Select
Case @INWIN=2
$persist=0
Case NOT VarType($persist)
$persist=0
Case $persist
$persist=1
Case 1
$persist=0
EndSelect
$drive=Ucase(Trim($drive))
If ($drive<'C' OR $drive>'Z') AND $drive<>'*'
$mapdrive=15
Exit 15
EndIf
$mount=$drive+':'
$mapdrive=0
If Right($unc,1)='\'
$unc=Left($unc,Len($unc)-1)
EndIf
$deep=Split($unc,'\')
If Ubound($deep)>3
$deep=1
Else
$deep=0
EndIf
If @INWIN=1
$subkey='HKEY_USERS\'+@SID+'\Network\'+$drive
Else
$subkey='HKEY_CURRENT_USER\Network\'+$drive
EndIf
If KeyExist($subkey)
$regvalue=Lcase(ReadValue($subkey,'RemotePath'))
If $regvalue<>Lcase(Trim($unc)) OR $persist=0
Use $mount /delete /persistent
If KeyExist($subkey)
$rc=DelKey($subkey)
EndIf
EndIf
EndIf
If NOT Exist($mount)
Select
Case ($deep OR InStr($unc,'\\'+@WKSTA+'\')) AND @INWIN=2
$iErr=3
Case $deep AND Val(@DOS)=4
Shell 'subst '+$mount+' '+$unc
$iErr=@ERROR
Case $persist
Use $mount $unc /persistent
$iErr=@ERROR
Case 1
Use $mount $unc
$iErr=@ERROR
EndSelect
EndIf
If $label AND Val(@DOS)>4 AND NOT $iErr
$driveobj=CreateObject('shell.application')
$iErr=@ERROR
If NOT $iErr
$driveobj.namespace($mount+'\').self.name=$label
$iErr=@error
EndIf
$driveobj=''
EndIf
Debug off
$mapdrive=$iErr
Exit $iErr
EndFunction

MapDrive('l','\\$MyFileServer\ESEGUR-LIS-DGTV-TRTMNTCLNTS',0,'LIS-DGTV-TRTMNTCLNTS')

Luis Arnauth