/*:VRX Main
*/
/* Main
*/
Main:
/*
Samba Connections GUI for OS/2 based systems
Copyright (C) 2007-2016 by Alexander Taylor and Herwig Bauernfeind
Derived works must contain this copyright notice.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
/* Process the arguments.
Get the parent window.
*/
parse source . calledAs .
parent = ""
argCount = arg()
argOff = 0
if( calledAs \= "COMMAND" )then do
if argCount >= 1 then do
parent = arg(1)
argCount = argCount - 1
argOff = 1
end
end; else do
call VROptions 'ImplicitNames'
call VROptions 'NoEchoQuit'
end
InitArgs.0 = argCount
if( argCount > 0 )then do i = 1 to argCount
InitArgs.i = arg( i + argOff )
end
drop calledAs argCount argOff
/* Load the windows
*/
call VRInit
parse source . . spec
_VREPrimaryWindowPath = ,
VRParseFileName( spec, "dpn" ) || ".VRW"
_VREPrimaryWindow = ,
VRLoad( parent, _VREPrimaryWindowPath )
drop parent spec
if( _VREPrimaryWindow == "" )then do
call VRMessage "", "Cannot load window:" VRError(), ,
"Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
/* Process events
*/
call Init
signal on halt
do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
_VREEvent = VREvent()
interpret _VREEvent
end
_VREHalt:
_VREReturnValue = Fini()
call VRDestroy _VREPrimaryWindow
_VRELeaveMain:
call VRFini
exit _VREReturnValue
VRLoadSecondary:
__vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
if __vrlsWait then do
call VRFlush
end
__vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
if __vrlsHWnd = '' then signal __vrlsDone
if __vrlsWait \= 1 then signal __vrlsDone
call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
__vrlsTmp = __vrlsWindows.0
if( DataType(__vrlsTmp) \= 'NUM' ) then do
__vrlsTmp = 1
end
else do
__vrlsTmp = __vrlsTmp + 1
end
__vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
__vrlsWindows.0 = __vrlsTmp
do while( VRIsValidObject( VRWindow() ) = 1 )
__vrlsEvent = VREvent()
interpret __vrlsEvent
end
__vrlsTmp = __vrlsWindows.0
__vrlsWindows.0 = __vrlsTmp - 1
call VRWindow __vrlsWindows.__vrlsTmp
__vrlsHWnd = ''
__vrlsDone:
return __vrlsHWnd
/*:VRX __VXREXX____APPENDS__
*/
__VXREXX____APPENDS__:
/*
#append ..\shared\browse.vrs
#append ..\shared\cltinit.vrs
#append ..\shared\inittempdir.vrs
#append ..\shared\nlv.vrs
#append ..\shared\rexx_md5.vrs
#append ..\shared\smbtree.vrs
#append ..\shared\textini.vrs
#append ..\shared\usercredmem.vrs
#append ..\shared\rxrpclib.vrs
*/
return
/*:VRX _AboutSambaClientGetInfo
*/
_AboutSambaClientGetInfo:
call VRSet "SW_ABOUT", "Painting", 0
BR = ''
ok = VRMethod( "CN_About", "RemoveRecord", "All" )
/* OS Version */
if VRFileExists(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG" ) then do
OS = linein(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG")
OS = subword(OS,1,2) '('translate(word(OS,3))')'
ok = stream(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG",'c','close')
end
else if VRFileExists(SysBootDrive()||"\ECS\ECS_INST.FLG" ) then do
OS = linein(SysBootDrive()||"\ECS\ECS_INST.FLG")
OS = subword(OS,1,3)
ok = stream(SysBootDrive()||"\ECS\ECS_INST.FLG",'c','close')
end
else OS = "OS/2 Warp/eComStation 1.x"
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Operating system", About.ValFH, OS)
/* Filesystem version */
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "File system", About.ValFH, fs.!name' Version 'fs.!version)
ABoutStr = "Samba Client Versions:"||BR
AboutStr = AboutStr||'0D0A'x||"File system "||'09'x||fs.!name' Version 'fs.!version||BR
plugindll. =""
/* Plugin */
address cmd 'look4dll.exe ndpsmb.dll >'samba.!msg
if RC <> 0 then do
/* Look4DLL not installed or failed, try fallback search */
if rc == 1041 then do /* look4dll not found, use REXX-based search */
pluginpath = _DLLSearch('ndpsmb.dll')
if pluginpath <> '' then do
plugindll.0 = 1
plugindll.1 = pluginpath
end
end
else plugindll.0 = 0
/* DLL is not in libpath; as a last resort, check some well-known places */
if plugindll.0 < 1 then do
NDFSDir = value("NDFSDIR",,"OS2ENVIRONMENT")
if NDFSDir = "" then do
OSDir = value("OSDIR",,"OS2ENVIRONMENT")
if OSDir == '' then OSDir = SysBootDrive()'\os2'
NDFSDir = OSDir'\dll'
end
ok = SysFileTree(NDFSDir'\ndpsmb.dll', "plugindll.", 'FOS')
end
end
else do
pluginline = linein(samba.!msg)
ok = stream(samba.!msg,'c','close')
ok = SysFileDelete(samba.!msg)
parse var pluginline . 'loaded ' pluginline
NDFSDir = VRParseFileName(pluginline,"DP")
plugindll.0 = 1
plugindll.1 = pluginline
end
if plugindll.0 > 0 then do
do J = 1 to plugindll.0
DummyRH.1 = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH.1, About.DscFH, "Plugin file", About.ValFH, plugindll.J)
AboutStr = AboutStr||'0D0A'x||"Plugin file "||'09'x||plugindll.J||BR
address cmd 'bldlevel.exe 'plugindll.J' >'samba.!msg
I = 0
Dummy = linein(samba.!msg)
say Dummy
Dummy = linein(samba.!msg)
say Dummy
Dummy = linein(samba.!msg)
say Dummy
do until lines(samba.!msg) = 0
I = I + 1
line.I = linein(samba.!msg)
if pos('has no LAN component-style version string', line.I) > 0 then do
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Error", About.ValFH, "Plugin has no LAN component-style version string")
leave
end
else do
parse var line.I desc':'vers
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Plugin "Desc, About.ValFH, strip(Vers))
AboutStr = AboutStr||'0D0A'x||"Plugin "Desc '09'x||strip(Vers)||BR
end
end
line.0 = I
ok = stream(samba.!msg,'c','close')
ok = SysFileDelete(samba.!msg)
end
end
else do
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Plugin", About.ValFH, "Not found!")
AboutStr = AboutStr||'0D0A'x||"Plugin not found!"||BR
end
/* Commandline utilities */
address cmd samba.!smbclientexe' -V >'samba.!msg
ClutVer = linein(samba.!msg)
ok = stream(samba.!msg,'c','close')
ok = SysFileDelete(samba.!msg)
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Commandline utility path", About.ValFH, VRParseFileName(samba.!smbclientexe,"DP"))
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Commandline utilities", About.ValFH, ClutVer)
AboutStr = AboutStr||'0D0A'x||"Commandline utilities "||'09'x||ClutVer||BR
/* GUI Version */
DummyRH = VRMethod('CN_About', 'AddRecord')
ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, options.!appname_long, About.ValFH, VRGet("Main", "HintText"))
AboutStr = AboutStr||'0D0A'x||"options.!appname_long "||'09'x || VRGet("Main", "HintText")||BR
call VRSet "SW_ABOUT", "Painting", 1
return
/*:VRX _AddTemplates
*/
_AddTemplates:
VolTplRH = VRMethod("CN_CURRENT", 'AddRecord', , 'First', 'Volume template', icons.!template )
MpTplRH = VRMethod("CN_CURRENT", 'AddRecord', VolTplRH, 'First', 'Mountpoint template', icons.!template )
return
/*:VRX _ContainersInit
*/
_ContainersInit:
if options.!debug == 1 then say time()' _ContainersInit started'
/* Connection details */
CD.StatusFH = VRMethod( "CN_CONDET", "AddField", "Icon", "Status" )
CD.mpointFH = VRMethod( "CN_CONDET", "AddField", "String", "mpoint" )
CD.mpidxFH = VRMethod( "CN_CONDET", "AddField", "String", "index" )
CD.workgrpFH = VRMethod( "CN_CONDET", "AddField", "String", "workgroup" )
CD.serverFH = VRMethod( "CN_CONDET", "AddField", "String", "server" )
CD.shareFH = VRMethod( "CN_CONDET", "AddField", "String", "share" )
CD.userFH = VRMethod( "CN_CONDET", "AddField", "String", "user" )
CD.passwordFH = VRMethod( "CN_CONDET", "AddField", "String", "password" )
CD.spasswordFH = VRMethod( "CN_CONDET", "AddField", "String", "spassword" )
CD.masterFH = VRMethod( "CN_CONDET", "AddField", "String", "master" )
CD.mtypeFH = VRMethod( "CN_CONDET", "AddField", "String", "mastertype" )
CD.memlenFH = VRMethod( "CN_CONDET", "AddField", "String", "memlen" )
CD.easupportFH = VRMethod( "CN_CONDET", "AddField", "String", "easupport" )
CD.logfileFH = VRMethod( "CN_CONDET", "AddField", "String", "logfile" )
CD.loglevelFH = VRMethod( "CN_CONDET", "AddField", "String", "loglevel" )
CD.rwFH = VRMethod( "CN_CONDET", "AddField", "String", "readonly" )
CD.ctoFH = VRMethod( "CN_CONDET", "AddField", "String", "cachetimeout" )
CD.cldFH = VRMethod( "CN_CONDET", "AddField", "String", "cachelistings" )
CD.kerberos5FH = VRMethod( "CN_CONDET", "AddField", "String", "krb5support")
CD.ntlmv1FH = VRMethod( "CN_CONDET", "AddField", "String", "ntlmv1support")
CD.encryptionFH= VRMethod( "CN_CONDET", "AddField", "String", "encryptionsupport")
CD.hashFH = VRMethod( "CN_CONDET", "AddField", "String", "hash" )
/* Connection details */
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.kerberos5FH, "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ntlmv1FH, "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.encryptionFH, "Visible", options.!debug)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", options.!debug)
ok = VRSet("CN_CONDET", "DetailSort", cd.mpointfh )
/* NLV columns */
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.statusfh , "Title", strip(NLVGetMessage(67),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpointfh , "Title", strip(NLVGetMessage(27),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.workgrpFH , "Title", strip(NLVGetMessage(21),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.serverFH , "Title", strip(NLVGetMessage(19),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.shareFH , "Title", strip(NLVGetMessage(20),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.userFH , "Title", strip(NLVGetMessage(25),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ctoFH , "Title", strip(NLVGetMessage(130),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.cldFH , "Title", strip(NLVGetMessage(131),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.easupportFH , "Title", strip(NLVGetMessage(68),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.rwfh , "Title", strip(NLVGetMessage(69),"T",":"))
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.kerberos5FH , "Title","Kerberos 5 support")
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ntlmv1FH , "Title","NTLMv1 support")
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.encryptionFH , "Title","Encryption support")
/* SMBTree columns */
WorkgroupFH= VRMethod( "CN_smbtree", "AddField", "String", "Workgroup" )
NBFH = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
IpFH = VRMethod( "CN_smbtree", "AddField", "String", "IP" )
MBFH = VRMethod( "CN_smbtree", "AddField", "String", "Role" )
OSFH = VRMethod( "CN_smbtree", "AddField", "String", "OS" )
VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" )
CommentFH = VRMethod( "CN_smbtree", "AddField", "String", "Comment" )
MacFH = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH, "ReadOnly", 1)
ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH, "ReadOnly", 1)
ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH, "ReadOnly", 1)
ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH, "ReadOnly", 1)
ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH, "ReadOnly", 1)
if options.!debug == 1 then say time()' _ContainersInit done'
return
/*:VRX _ContextMenuSelectedSet
*/
_ContextMenuSelectedSet:
/* Fixme: This routine only works for CN_SMBTREE right now */
/* Hide all context menu entries */
ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_ACLS", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
/* ok = VRSet("Menu_Selected_TreeView","Visible",1)
ok = VRSet("Menu_Selected_DetailsView","Visible",1)
*/
say SMBObj.udatatype
select
when SMBObj.udatatype = "DISK" then do
ok = VRSet("Menu_Selected_Connect", "Visible", 1)
end
when SMBObj.udatatype = "SERVER" then do
ok = VRSet("Menu_Selected_Connect", "Visible", 1)
ok = VRSet("Menu_Selected_Sep1", "Visible", 1)
ok = VRSet("Menu_Selected_Info", "Visible", 1)
ok = VRSet("Menu_Selected_TimeSync", "Visible", 1)
ok = VRSet("Menu_Selected_Refresh", "Visible", 1)
end
when SMBObj.udatatype = "WORKGROUP" then do
ok = VRSet("Menu_Selected_Connect", "Visible", 1)
ok = VRSet("Menu_Selected_Sep1", "Visible", 1)
ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 1)
end
when SMBObj.udatatype = "PRINTER" then do
call _PrinterInfo
/* CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E' */
end
when SMBObj.udatatype = "DIRECTORY" then do
ok = VRSet("Menu_Selected_ACLS", "Visible", 1)
end
when SMBObj.udatatype = "FILE" then do
ok = VRSet("Menu_Selected_ACLS", "Visible", 1)
end
otherwise nop /* No other value known */
end
return
/*:VRX _CreateSmbConf
*/
_CreateSmbConf:
if options.!debug == 1 then say time()' '||"_CreateSmbConf started"
call lineout samba.!smbconf, '# Samba config file created using' options.!appname_long 'ver. 'word(VRGet("Main","Hinttext"),2)
call lineout samba.!smbconf, '# from 'value("USER",,'OS2ENVIRONMENT')'@'value("HOSTNAME",,'OS2ENVIRONMENT')
call lineout samba.!smbconf, '# Date: 'date()' 'time()
call lineout samba.!smbconf, '[global]'
if settings.!network <> '' then do
call lineout samba.!smbconf, '09'x||'workgroup = 'settings.!network
end
else do
call lineout samba.!smbconf, '09'x||'workgroup = WORKGROUP'
end
call lineout samba.!smbconf, '09'x||'log level = 0'
ok = stream(samba.!smbconf,'c','close')
if options.!debug == 1 then say time()' '||"_CreateSmbConf done"
return
/*:VRX _DaemonRunning
*/
_DaemonRunning: procedure expose fs.
ok = PRProcessList(proc)
PID = 0
do I = 1 to proc.0
CurProc = VRParseFileName(proc.i.name,'NE')
if CurProc = fs.!prefix"CTL.EXE" then do
PID = proc.i.pid
leave
end
end
return PID
/*:VRX _DelSMBObjectShares
*/
_DelSMBObjectShares: procedure expose samba. options. SMBObj. rh
/* Purpose: Delete shares for a given Object (as handle) */
rh = arg(1)
ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
do J = 1 to rh.0 /* populate shares with valid entries */
ParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Parent")
if ParentRH = rh then do /* we found a share belonging to our server */
ok = VRMethod("CN_SMBTree", "RemoveRecord", rh.J )
end
end
SmbObj.shares. = ''
SmbObj.shares.0 = 0
return
/*:VRX _DialogPopulate
*/
_DialogPopulate:
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Visible", "rh." )
ok = VRMethod("EF_SHARE", "Reset")
ok = VRMethod("EF_SERVER", "Reset")
ok = VRMethod("EF_NETWORK", "Reset")
do I = 1 to rh.0
Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Userdata")
ResName = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Caption")
parse var ResName ResName '0D0A'x .
ResName = strip(ResName)
parse var userdata ResType '|' .
select
when ResType = "WORKGROUP" then ok = VRMethod("EF_NETWORK","AddString", ResName)
when ResType = "SERVER" then ok = VRMethod("EF_SERVER", "AddString", ResName)
when ResType = "DISK" then ok = VRMethod("EF_SHARE", "AddString", ResName)
otherwise nop
end
end
return
/*:VRX _DLLSearch
*/
_DLLSearch: PROCEDURE
PARSE ARG dname
_bd = SysBootDrive()
IF _bd == '' THEN
_bd = FILESPEC('DRIVE', VALUE('COMSPEC',,'OS2ENVIRONMENT'))
_csys = _bd'\CONFIG.SYS'
CALL SysFileSearch 'LIBPATH=', _csys, 'match.'
DO i = 1 TO match.0
PARSE UPPER VAR match.i _lead 'LIBPATH=' _lpath
IF (_lead == '') & (_lpath <> '') THEN LEAVE
END
_lpath = SysQueryExtLIBPATH('B') || ';'_lpath';' || SysQueryExtLIBPATH('E')
CALL SETLOCAL
_testenv = 'TEST_'dname'_LIBPATH'
CALL VALUE _testenv, _lpath, 'OS2ENVIRONMENT'
location = SysSearchPath( _testenv, dname )
CALL ENDLOCAL
RETURN location
/*:VRX _Dynamic
*/
_Dynamic:
dyn_code = arg(1)
if options.!debug == 1 then say time()' Dynamic code: 'dyn_code
interpret dyn_code; drop dyn_code
return
/*:VRX _GetSMBObjectProperties
*/
_GetSMBObjectProperties: procedure expose samba. options. SMBObj. rh icon resname udatatype udatamsg parentrh icons.
if options.!debug == 1 then say time()' _GetSMBObjectProperties started'
/* Purpose of this subroutine:
The current SMB object's frequently used properties should be stored in a stem
SMBObj.rh = recordhandle of the object
SMBObj.resname = resourcename of the object
SMBObj.comment = commentstring of the object
SMBObj.icon = icon of the object
SMBObj.udatatype = type of object (WORKGROUP, SERVER, DISK, PRINTER, FILE, DIRECTORY)
SMBObj.udatamsg = arbitrary object related data (Login message, file properties)
SMBObj.parentrh = recordhandle of the object's parent
SMBObj.gparentrh = recordhandle of the object's grandparent
The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
The _dropdeprecated routine will drop any value in order to make sure the stem actually works
If another variable is added to the stem, ensure to also drop it in dropdeprecated otherwise it will not be exported
*/
call _dropdeprecated
SMBObj. = ""
SMBObj.rh = arg(1)
if VRMethod( "CN_SMBTREE", "ValidateRecord", SMBObj.rh) <> 1 | SMBObj.rh = "" then do
if options.!debug == 1 then say time()' _GetSMBObjectProperties aborted'
return
end
SMBObj.Icon = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Icon")
SMBObj.parentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Parent")
if SMBObj.parentrh = ""
then SMBObj.gparentrh = ""
else SMBObj.gparentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
SMBObj.resname = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Caption")
parse var SMBObj.resname SMBObj.resname '0D0A'x SMBObj.comment
SMBObj.resname = strip(SMBObj.resname)
SMBObj.comment = strip(SMBObj.comment)
Userdata = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Userdata")
parse var userdata SMBObj.udatatype '|' SMBObj.udatamsg
SMBObj.udatatype = strip(SMBObj.udatatype)
SMBObj.udatamsg = strip(SMBObj.udatamsg)
if options.!debug == 1 then do
say ' Handle: "'SMBObj.rh'"'
say ' GParentrh "'SMBObj.gparentrh'"'
say ' Resource: "'SMBObj.resname'"'
say ' Comment: "'SMBObj.comment'"'
say ' Type: "'SMBObj.udatatype'"'
say ' Message: "'SMBObj.udatamsg'"'
say ' Icon: "'SMBObj.icon'"'
end
if options.!debug == 1 then say time()' _GetSMBObjectProperties done'
return
/*:VRX _GetSMBObjectShares
*/
_GetSMBObjectShares: procedure expose samba. options. SMBObj.
/* Purpose: Return stem with shares for a given Object (as handle) */
rh = arg(1)
SmbObj.shares. = ''
SmbObj.shares.0 = 0
I = 0
ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
do J = 1 to rh.0 /* populate shares with valid entries */
Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Userdata")
ResName = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Caption")
ParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Parent")
parse var ResName ResName '0D0A'x .
ResName = strip(ResName)
parse var userdata ResType '|' .
if ParentRH = rh then do /* we found a share belonging to our server */
if ResType = "DISK" then do
I = I + 1
SmbObj.shares.I = ResName
end
end
end
SmbObj.shares.0 = I
return
/*:VRX _GUIInit
*/
_GUIInit:
if options.!debug == 1 then say time()' _GUIInit started'
CALL VRSet 'Main', 'HelpFile', settings.!helpfile
/* Main Window */
CALL NLVSetText 'Main', "Caption", 1
CALL NLVSetText 'Menu_File', "Caption", 80
CALL NLVSetText 'Menu_Context', "Caption", 81
CALL NLVSetText 'Menu_Selected', "Caption", 83
CALL NLVSetText 'Menu_Help', "Caption", 84
CALL NLVSetText 'Menu_File_LOAD', "Caption", 31
CALL NLVSetText 'Menu_File_SAVE', "Caption", 30
CALL NLVSetText 'Menu_File_LMHosts_Reset', "Caption", 127
CALL NLVSetText 'Menu_File_ucCred_Reset', "Caption", 128
CALL NLVSetText 'Menu_File_Autostart', "Caption", 35
CALL NLVSetText 'Menu_File_Autostart_Activate', "Caption", 76
CALL NLVSetText 'Menu_File_Autostart_Deactivate', "Caption", 77
CALL NLVSetText 'Menu_File_Daemon', "Caption", 126
CALL NLVSetText 'Menu_File_Daemon_Start', "Caption", 76
CALL NLVSetText 'Menu_File_Daemon_Stop', "Caption", 77
CALL NLVSetText 'Menu_File_CLOSE', "Caption", 29
CALL NLVSetText 'Menu_Context_DETACH', "Caption", 11
CALL NLVSetText 'Menu_Context_DETACH_ALL', "Caption", 120
CALL NLVSetText 'Menu_Context_REFRESH', "Caption", 38
CALL NLVSetText 'Menu_Context_UNMOUNT', "Caption", 12
CALL NLVSetText 'Menu_Context_EDIT', "Caption", 32
CALL NLVSetText 'Menu_Context_OPEN', "Caption", 94
CALL NLVSetText 'Menu_Context_OPEN_ICON', "Caption", 95
CALL NLVSetText 'Menu_Context_OPEN_TREE', "Caption", 96
CALL NLVSetText 'Menu_Context_OPEN_DETAIL', "Caption", 97
CALL NLVSetText 'Menu_Context_OPEN_SETTINGS', "Caption", 98
CALL NLVSetText 'Menu_Context_OPEN_SPLITVIEW', "Caption", 99
CALL NLVSetText 'Menu_Selected_Connect', "Caption", 28
CALL NLVSetText 'Menu_Selected_Remove', "Caption", 12
CALL NLVSetText 'Menu_Selected_Retry', "Caption", 90
CALL NLVSetText 'Menu_Selected_Info', "Caption", 92
CALL NLVSetText 'Menu_Selected_TimeSync', "Caption", 129
CALL NLVSetText 'Menu_Selected_Refresh', "Caption", 38
CALL NLVSetText 'Menu_Selected_Default_Workgroup',"Caption", 75
CALL NLVSetText 'Menu_Help_Extended', "Caption", 4
CALL NLVSetText 'Menu_Help_About', "Caption", 91
/* Left pane */
CALL NLVSetText 'DT_CURRENT', "Caption", 10
CALL NLVSetText 'PB_DETACH', "Caption", 11
CALL NLVSetText 'PB_UNMOUNT', "Caption", 12
/* Dialog window */
CALL NLVSetText 'DT_MOUNT', "Caption", 14
CALL NLVSetText 'DT_SERVER', "Caption", 19
CALL NLVSetText 'DT_SHARE', "Caption", 20
CALL NLVSetText 'DT_NETWORK', "Caption", 21
CALL NLVSetText 'CHK_MTYPE', "Caption", 23
CALL NLVSetText 'DT_USER', "Caption", 25
CALL NLVSetText 'DT_PASSWORD', "Caption", 26
CALL NLVSetText 'DT_MPOINT', "Caption", 27
CALL NLVSetText 'PB_MOUNT', "Caption", 28
CALL NLVSetText 'PB_EDIT_CANCEL', "Caption", 3
CALL NLVSetText 'PB_DIALOG_HELP', "Caption", 4
CALL NLVSetText 'PB_CLEARCRED', "Caption", 89
IF (mtype.1 \= '' & mtype.2 \= '' & mtype.3 \= '' & mtype.4 \= '') THEN DO
CALL VRMethod CB_MOUNT, 'Clear'
CALL VRMethod CB_MOUNT, 'AddStringList', 'mtype.'
END
if (mtype.1 = '' & mtype.2 = '' & mtype.3 = '' & mtype.4 = '') THEN DO /* we do not seem to have an NLV file */
/* we fill the array with the list predefined directly in the GUI control */
ok = VRMethod( "CB_MOUNT", "GetStringList", "mtype." )
end
/* SMBTree */
CALL NLVSetText 'PB_SMBTREE_CONNECT', "Caption", 28
CALL NLVSetText 'PB_SMBTREE_REFRESH', "Caption", 38
CALL NLVSetText 'PB_SMBTREE_HELP', "Caption", 4
CALL NLVSetText 'CN_SMBTREE', "Caption",140
/** Use AutoSize property instead
ok = VRSet("Pict_Throbber","Width", VRMethod( "Screen", "PixelsToTwips", 32 ))
ok = VRSet("Pict_Throbber","Height", VRMethod( "Screen", "PixelsToTwips", 32 ))
**/
/* Condet */
CALL NLVSetText 'PB_CONDET_SAVE', "Caption", 30
CALL NLVSetText 'PB_CONDET_LOAD', "Caption", 31
CALL NLVSetText 'PB_CONDET_HELP',"Caption", 4
/* Statusbar */
call _StatusBarWrapper VRGet("Main", "HintText")
/* Common margin around controls */
margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
smbwait = "#50"
if options.!debug == 1 then say time()' _GUIInit done'
return
/*:VRX _INILoad
*/
_INILoad:
if options.!debug == 1 then say time()' _INILoad started'
/* Locate the profile */
os2_ini = VALUE('USER_INI',,'OS2ENVIRONMENT')
inipath = VRParseFilePath( os2_ini, 'DP')
IF inipath == '' THEN inipath = SysBootDrive() || '\OS2'
settings.!ini = inipath'\'options.!appname_short'.INI'
drop os2_ini inipath
if options.!debug == 1 then say ' 'options.!appname_long' INIfile = "'settings.!ini'"'
settings.!network = ""
/* Create default smb.conf if none exists */
if \VRFileExists( samba.!smbconf ) then call _CreateSmbConf
say _ucInitObj()
say _ucChkObj()
IF STREAM( settings.!ini, 'C', 'QUERY EXISTS') == '' THEN DO
/* First start */
if options.!debug == 1 then say " First start!"
advanced.!browseauth = 0
advanced.!browseimme = 1
advanced.!broadcast = 0
advanced.!special = 0
advanced.!savepassive= 0
advanced.!lmhosts = 1
advanced.!miniicons = 0
advanced.!easupport = 1
advanced.!Kerberos5FH = 0
advanced.!ntlmv1FH = 1
advanced.!encryptionFH = 0
advanced.!readonly = 0
advanced.!alwaysmp = 0
advanced.!cachetimeout = 10
advanced.!cachelistings = 32
CALL VRSet "Main", 'Height', 7576
CALL VRSet "Main", 'Width', 8200
CALL VRSet "SPLIT_MAIN", 'Left', 2915
CALL VRMethod "Main", 'CenterWindow'
call VRSet 'Main', 'Visible', 1
call Main_Resize
END
ELSE DO
/* Subsequent start */
/* Load window position settings */
settings.!x = VRGetIni('Settings', 'X', settings.!ini, 'NoClose')
settings.!y = VRGetIni('Settings', 'Y', settings.!ini, 'NoClose')
settings.!h = VRGetIni('Settings', 'H', settings.!ini, 'NoClose')
settings.!w = VRGetIni('Settings', 'W', settings.!ini, 'NoClose')
settings.!s = VRGetIni('Settings', 'S', settings.!ini, 'NoClose')
IF settings.!x == '' THEN settings.!x = -1
IF settings.!y == '' THEN settings.!y = -1
IF settings.!h == '' THEN settings.!h = -1
IF settings.!w == '' THEN settings.!w = -1
IF settings.!s == '' THEN settings.!s = -1
/* Titlebar settings */
settings.!curbcolor = VRGetIni('Settings', 'TitleBarBackground', settings.!ini, 'NoClose')
settings.!curfcolor = VRGetIni('Settings', 'TitleBarForeground', settings.!ini, 'NoClose')
IF (settings.!curbcolor = '' | settings.!curbcolor = '') THEN settings.!curbcolor = 'SystemActiveTitle'
IF (settings.!curfcolor = '' | settings.!curfcolor = '') THEN settings.!curfcolor = 'SystemActiveTitleText'
/* Load font settings */
IF VRFileExists( SysBootDrive() || '\OS2DBCS') == 1
THEN default_font = '9.WarpSans Combined'
ELSE default_font = '9.WarpSans'
settings.!cfont = VRGetIni('Settings', 'ContainerFont', settings.!ini, 'NoClose')
settings.!wfont = VRGetIni('Settings', 'WindowFont', settings.!ini, 'NoClose')
IF settings.!cfont == '' THEN settings.!cfont = default_font
IF settings.!wfont == '' THEN settings.!wfont = default_font
/* Current page */
settings.!curpage = VRGetIni('Settings', 'CurrentPage', settings.!ini, 'NoClose')
IF settings.!curpage == '' THEN settings.!curpage = 1
/* Global settings */
advanced.!browseauth = VRGetIni('Settings', 'BrowseAuth', settings.!ini, 'NoClose')
advanced.!browseimme = VRGetIni('Settings', 'BrowseImme', settings.!ini, 'NoClose')
advanced.!broadcast = VRGetIni('Settings', 'Broadcast', settings.!ini, 'NoClose')
advanced.!special = VRGetIni('Settings', 'SpecialShares', settings.!ini, 'NoClose')
advanced.!savepassive= VRGetIni('Settings', 'SavePassive', settings.!ini, 'NoClose')
advanced.!lmhosts = VRGetIni('Settings', 'LMHosts', settings.!ini, 'NoClose')
advanced.!miniicons = VRGetIni('Settings', 'MiniIcons', settings.!ini, 'NoClose')
advanced.!easupport = VRGetIni('Settings', 'EAS', settings.!ini, 'NoClose')
advanced.!readonly = VRGetIni('Settings', 'ReadOnly', settings.!ini, 'NoClose')
advanced.!alwaysmp = VRGetIni('Settings', 'AlwaysMP', settings.!ini, 'NoClose')
advanced.!cachetimeout = VRGetIni('Settings', 'CacheTimeOut', settings.!ini, 'NoClose')
advanced.!cachelistings = VRGetIni('Settings', 'CacheListings',settings.!ini, 'NoClose')
IF advanced.!browseauth == '' THEN advanced.!browseauth = 0
IF advanced.!browseimme == '' THEN advanced.!browseimme = 1
IF advanced.!broadcast == '' THEN advanced.!broadcast = 0
IF advanced.!special == '' THEN advanced.!special = 0
IF advanced.!savepassive== '' THEN advanced.!savepassive= 0
IF advanced.!lmhosts == '' THEN advanced.!lmhosts = 1
options.!storecreds = VRGetIni('Settings', 'StoreCreds', settings.!ini, 'NoClose')
say "options.!storecreds = "options.!storecreds
IF options.!storecreds == '' then options.!storecreds = 1
say "options.!storecreds = "options.!storecreds
IF _ucChkObj() = 0 then options.!storecreds = 0
say "options.!storecreds = "options.!storecreds
options.!tracmark = VRGetIni('Settings', 'TracMarkup', settings.!ini, 'NoClose')
options.!debug = VRGetIni('Settings', 'Debug', settings.!ini)
IF options.!debug == '' THEN options.!debug = 0 /* Turn off debug by default for release builds */
if options.!debug == 1 then ok = VRRedirectStdIO("ON")
else ok = VRRedirectStdio("OFF")
IF advanced.!miniicons == '' THEN advanced.!miniicons = 0
/* Advanced */
IF advanced.!easupport == '' THEN advanced.!easupport = 1
IF advanced.!readonly == '' THEN advanced.!readonly = 0
IF advanced.!alwaysmp == '' THEN advanced.!alwaysmp = 0
IF advanced.!cachetimeout == '' THEN advanced.!cachetimeout = 10
IF advanced.!cachelistings == '' THEN advanced.!cachelistings = 32
/* Apply the settings */
ok = VRSet("DT_CURRENT","BACKCOLOR", settings.!curbcolor )
ok = VRSet("DT_CURRENT","FORECOLOR", settings.!curfcolor )
ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
IF ( settings.!x >= 0 ) & ( settings.!y >= 0 ) & ( settings.!l >= 0 ) & ( settings.!w >= 0 ) & ( settings.!s >= 0 ) THEN DO
CALL VRSet VRWindow(), 'Left', settings.!x
CALL VRSet VRWindow(), 'Top', settings.!y
CALL VRSet VRWindow(), 'Height', settings.!h
CALL VRSet VRWindow(), 'Width', settings.!w
CALL VRSet "SPLIT_MAIN", 'Left', settings.!s
END
ELSE CALL VRMethod VRWindow(), 'CenterWindow'
CALL VRSet "CN_CURRENT", 'Font', settings.!cfont
CALL VRSet "CN_CONDET", 'Font', settings.!cfont
CALL VRSet "CN_SMBTREE", 'Font', settings.!cfont
CALL VRSet 'Main', 'Font', settings.!wfont
CALL VRSet 'Main', 'StatusFont', settings.!wfont
ok = VRSet("TDL_1","Selected", settings.!curpage)
END
if options.!nogui == 1 then CALL VRLoadSecondary "SW_PROGRESS","W"
else do
if options.!delay > 0 then do
/* Set mouse pointer to wait - this operation might take a few seconds */
call VRSet VRWindow(), 'Pointer', 'Wait'
call Main_Resize
ok = SysSleep(options.!delay)
options.!delay = 0
/* Set mouse pointer to default again */
call VRSet VRWindow(), 'Pointer', ''
end
end
/* Look for usable credentials */
if options.!storecreds = 1 & _ucChkUc() then do
UserCred = _ucGetUc()
parse var UserCred '--user='Credentials.!username'%'Credentials.!password
if left(Credentials.!password,1)='%' then Credentials.!password = substr(Credentials.!password,2)
ok = VRSet("EF_USER", "Value",Credentials.!username)
ok = VRSet("EF_PASSWORD","Value",Credentials.!password)
ok = VRSet("CN_SMBTREE","Caption",VRGet("CN_SMBTREE","Caption")||": "Credentials.!username)
end
else ok = VRSet("CN_SMBTREE","Caption",VRGet("CN_SMBTREE","Caption")||": Guest")
/* SambaInit.VRS needs these 2 */
ShowHidden = advanced.!special
Broadcast = advanced.!broadcast
/* in non debug versions this is normally not visible */
if options.!debug == 1 then say ' NLV MessageFile = "'settings.!messages'"'
if options.!debug == 1 then say ' NLV HelpFile = "'settings.!helpfile'"'
if options.!debug == 1 then say time()' _INILoad done'
RETURN
/*:VRX _INISave
*/
_INISave: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba.
if options.!debug == 1 then say time()' '||"SaveSettings started"
if advanced.!savepassive then call _PassiveSave
/* This does not make sense anymore
settings.!network = VRGet("EF_NETWORK","Value")
CALL VRSetIni 'Settings', 'Network', settings.!network, settings.!ini, 'NoClose'
*/
font = VRGet("CN_CURRENT", 'Font')
CALL VRSetIni 'Settings', 'ContainerFont', font, settings.!ini, 'NoClose'
font = VRGet('Main', 'Font')
CALL VRSetIni 'Settings', 'WindowFont', font, settings.!ini, 'NoClose'
settings.!curbcolor = VRGet("DT_CURRENT","BackColor")
CALL VRSetIni 'Settings', 'TitleBarBackground', settings.!curbcolor, settings.!ini, 'NoClose'
settings.!curfcolor = VRGet("DT_CURRENT","ForeColor")
CALL VRSetIni 'Settings', 'TitleBarForeground', settings.!curfcolor, settings.!ini, 'NoClose'
/* Global options */
CALL VRSetIni 'Settings', 'BrowseAuth', advanced.!browseauth , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'BrowseImme', advanced.!browseimme , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'Broadcast', advanced.!broadcast , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'SpecialShares', advanced.!special , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'SavePassive', advanced.!savepassive, settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'LMHosts', advanced.!lmhosts , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'StoreCreds', options.!storecreds , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'Debug', options.!debug , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'MiniIcons', advanced.!miniicons , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'TracMarkup', options.!tracmark , settings.!ini, 'NoClose'
/* Advanced */
CALL VRSetIni 'Settings', 'EAS', advanced.!easupport , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'ReadOnly', advanced.!readonly , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'AlwaysMP', advanced.!alwaysmp , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'CacheTimeOut', advanced.!cachetimeout , settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'CacheListings', advanced.!cachelistings, settings.!ini, 'NoClose'
/* Current page */
settings.!curpage = VRget("TDL_1","Selected")
CALL VRSetIni 'Settings', 'CurrentPage', settings.!curpage , settings.!ini, 'NoClose'
/* Save position and size */
settings.!l = VRGet("Main", 'Left' )
settings.!t = VRGet("Main", 'Top' )
settings.!h = VRGet("Main", 'Height')
settings.!w = VRGet("Main", 'Width' )
settings.!s = VRGet("SPLIT_Main", 'Left' )
CALL VRSetIni 'Settings', 'X', settings.!l, settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'Y', settings.!t, settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'H', settings.!h, settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'W', settings.!w, settings.!ini, 'NoClose'
CALL VRSetIni 'Settings', 'S', settings.!s, settings.!ini
if options.!debug == 1 then say time()' '||"SaveSettings done"
RETURN
/*:VRX _isValidIPAddress
*/
_isValidIPAddress: procedure
ipaddr = arg(1)
d. = ''
d.0 = 4
fail = 0
parse var ipaddr d.1 '.' d.2 '.' d.3 '.' d.4
do I = 1 to 4
if datatype(d.I) = 'NUM' then do
if d.I < 0 | d.I > 255 then fail = 1
end
else fail = 1
if fail = 1 then leave
end
return(\fail)
/*:VRX _LMHostsRead
*/
_LMHostsRead:
ok = file2stem(samba.!lmhosts,'lmhosts.', 'NoDel')
lmname. = "#"
lmapp. = ""
lmname.0 = lmhosts.0
lmip.0 = lmhosts.0
lmapp.0 = lmhosts.0
do I = 1 to lmhosts.0
if left(lmhosts.I,1) = "#" then iterate
parse var lmhosts.I lmip.I ' ' lmname.I '#' lmapp.I
lmip.I = strip(lmip.I)
lmname.I = strip(lmname.I)
if lmapp.I <> "" & left(lmapp.I,1) <> '#' then lmapp.I = '#'lmapp.I
end
drop lmhosts.
return
/*:VRX _LMHostsReset
*/
_LMHostsReset:
ok = SysFileDelete(samba.!lmhosts)
Buttons.1 = NLVGetMessage(2)
Buttons.0 = 1
if ok = 0 then do
id = VRMessage( VRWindow(), NLVGetMessage(118,samba.!lmhosts), NLVGetMessage(127), "Information", "Buttons.", 1, 1 )
end
else do
id = VRMessage( VRWindow(), samba.!lmhosts', RC = 'ok, NLVGetMessage(127), "Error", "Buttons.", 1, 1 )
end
return
/*:VRX _LMHostsUpdate
*/
_LMHostsUpdate:
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Visible", "rh." )
do I = 1 to rh.0
call _GetSMBObjectProperties rh.I
if SMBObj.udatatype = "SERVER" then do
IP = VRMethod("CN_SMBTREE","GetFieldData",rh.I, IPFH )
Role = VRMethod("CN_SMBTREE","GetFieldData",rh.I, MBFH )
parse var IP T1 '.' T2 '.' T3 '.' T4
if datatype(T1) = "NUM" & datatype(T2) = "NUM" & datatype(T3) = "NUM" & datatype(T4) = "NUM" then do
FoundName = 0
/* Don't add localhost and local link IP to LMHosts */
if T1 = '127' & T2 = '0' & T3 = '0' & T4 = '1' then iterate
if T1 = '169' & T2 = '254' then iterate
do J = 1 to lmname.0 /* machine already in LMHosts? */
if lmname.J = SmbObj.resname then do /* Yes? then update IP */
lmip.J = IP
if pos('PDC',Role) > 0 & SMBObj.parentrh <> "" then do
Domain = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
lmapp.J = "#DOM:"Domain
end
FoundName = 1
leave
end
end
if FoundName = 0 then do /* New machine for LMhosts - add it */
new = lmname.0 + 1
lmname.0 = new
lmname.new = SmbObj.resname
lmip.0 = new
lmip.new = IP
end
end
end
end
ok = SysFileDelete(samba.!lmhosts)
call lineout samba.!lmhosts,'# Created by 'translate(VRParseFilename(settings.!ini,'N'))' Version 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
call lineout samba.!lmhosts,'# Syntax:'
call lineout samba.!lmhosts,left('# IP-address',25)||left('NetBIOS-name',16)' [Role]'
do I = 1 to lmname.0
if left(lmname.I,1) = "#" then iterate
call lineout samba.!lmhosts,left(lmip.I,25)||left(lmname.I,16)' 'lmapp.I
end
ok = stream(samba.!lmhosts,'c','close')
return
/*:VRX _LMHostsWrite
*/
_LMHostsWrite:
return
/*:VRX _LoadOtherFuncs
*/
_LoadOtherFuncs:
IF options.!debug == 1 then say time()' _LoadotherFuncs() started'
SIGNAL ON SYNTAX
call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call SysLoadFuncs
call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
call IniLoadFuncs
call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
call PRLoadFuncs
call RxFuncAdd 'RxuInit', 'RXU', 'RxuInit'
call RxuInit
SIGNAL OFF SYNTAX
IF options.!debug == 1 then say time()' _LoadotherFuncs() done'
return
SYNTAX:
IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler entered.'
Fatal = 1
parse source . . InVXIDE
if left(InVXIDE,length(Tempdir)+5) = TempDir||'__tmp'
then xxx = "VX-REXX IDE: "strip(translate(word(sourceline(SIGL-1),4),' ',"',"))
else xxx = 'A'
call VRMessage 'Main', xxx' REXX function library DLL is missing or unloadable!', options.!appname_long "fatal error", "E"
IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler finished, program will be terminated.'
signal Quit
/*:VRX _ParseCommandLine
*/
_ParseCommandLine:
if options.!debug == 1 then say time()' _ParseCommandLine() started'
CmdLine = VRGet("Application","Commandline")
upCmdLine = translate(CmdLine)
if options.!debug == 1 then say ' Commandline = "'CmdLine'"'
ForceNDFS = 0
if wordpos('-NDFS',upCmdLine) > 0 then do
if options.!debug == 1 then say " NDFS switch detected"
CmdLine = delWord(CmdLine,wordpos('-NDFS',upCmdLine),1)
upCmdLine = translate(CmdLine)
ForceNDFS = 1
CALL VRSet "Menu_File_Autostart","Visible", 0
end
if wordpos('-AUTOCLOSE',upCmdLine) > 0 then do
options.!autoclose = 1
if options.!debug == 1 then say " AutoClose switch detected"
CmdLine = delWord(CmdLine,wordpos('-AUTOCLOSE',upCmdLine),1)
upCmdLine = translate(CmdLine)
end
if wordpos('-NOGUI',upCmdLine) > 0 then do
options.!nogui = 1
options.!autoclose = 1
if options.!debug == 1 then say " -NOGUI switch detected"
CmdLine = delWord(CmdLine,wordpos('-NOGUI',upCmdLine),1)
upCmdLine = translate(CmdLine)
end
if wordpos('-TIMESYNC',upCmdLine) > 0 then do
options.!timesync = 1
if options.!debug == 1 then say " -TIMESYNC switch detected"
dwpos = wordpos('-TIMESYNC',upCmdLine)
if dwpos = words(upCmdLine) then do /* TIMESYNC was last parm - assume automatic */
options.!timesrv = ""
CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
end
else do
options.!timesrv = word(upCmdLine,dwpos+1)
if left(options.!timesrv,1) = "-" then do /* other parameter detected */
options.!timesrv = ""
CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
end
else do /* seems we have a timeserver - IP or name - no further check */
CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),2)
end
end
upCmdLine = translate(CmdLine)
end
if wordpos('-DELAY',upCmdLine) > 0 then do
if options.!debug == 1 then say " DELAY switch detected"
dwpos = wordpos('-DELAY',upCmdLine)
if dwpos = words(upCmdLine) then do /* DELAY was last parm - assume 60 seconds */
options.!delay = 60
CmdLine = delWord(CmdLine,dwpos,1)
end
else do
options.!delay = word(upCmdLine,dwpos+1)
if datatype(options.!delay) <> "NUM" then do /* No number of seconds specified */
options.!delay = 60
CmdLine = delWord(CmdLine,dwpos,1)
end
else do
CmdLine = delWord(CmdLine,dwpos,2)
end
end
upCmdLine = translate(CmdLine)
if options.!debug == 1 then say " DELAY set to "options.!delay" seconds."
end
Profile = strip(CmdLine,,'"')
if Profile <> "" then do
Profile = strip(VRParseFilename(Profile,"DPNE"))
options.!autoload = 1
if options.!debug == 1 then say ' Profile = "'Profile'"'
if \VRFileExists(Profile) then do
CALL VRMessage 'Main', NLVGetMessage( 102, Profile ), NLVGetMessage( 1 ), 'E'
/* Disable all switches in case of an error */
options.!autoload = 0
options.!autoclose = 0
options.!nogui = 0
options.!delay = 0
end
end
if options.!debug == 1 then say time()' _ParseCommandLine done'
return
/*:VRX _PassiveLoad
*/
_PassiveLoad:
if options.!debug == 1 then say time()' '||"_PassiveLoad started"
do cnt = 1 to 255
resdata = VRGetIni( "PassiveConnections", cnt, settings.!ini )
if resdata = "" then leave
parse var resdata p_mpoint resource rwFlag
if options.!debug == 1 then do
say ' Connection 'cnt', resdata ="'resdata'"'
end
/* vfs.!drive = FILESPEC('DRIVE', node )
vfs.!mountpoint = STRIP( node, 'T', '\') */
/* In case we only have a volume we reattach the backslash, otherwise restore will fail */
if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
p_mpidx = ""
call ParseResParmString
p_rw = rwFlag
/* Create the hash string */
hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
/* A truncated, useless entry - skip it */
if p_server = "" & p_share = ""& p_workgroup = "" then iterate
md5.cnt = rexx_md5(hashstr)
md5.0 = cnt
/* Passive connection already restored - skip the dupe one */
PassiveDupe = 0
do X = 1 to md5.0-1
if md5.cnt = md5.X then PassiveDupe = 1
end
if PassiveDupe = 1 then iterate /* do not add record for a duplicate passive connection */
/* Everything is ok, let's add a new entry */
cd.lastrh = VRMethod("CN_CONDET","AddRecord")
/* Fill columns now */
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpidxfh, p_mpidx)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.workgrpFH , p_workgroup)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.serverfh, p_server)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.sharefh, p_share)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.userfh, p_user)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.spasswordfh, p_spassword)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.cldFH, p_cachelistings)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.masterfh, p_master)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mtypefh, p_mtype)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.easupportfh, p_easupport)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.rwfh, p_rw)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh, md5.cnt)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive)
ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive)
/* Obsolete fields:
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.logfilefh, p_logfile)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.loglevelfh, p_loglevel) */
end
if options.!debug == 1 then say time()' '||"_PassiveLoad done"
return
/*:VRX _PassiveSave
*/
_PassiveSave:
if options.!debug == 1 then say time()' '||"_PassiveSave started"
ok = VRDelIni( "PassiveConnections", "ALL", settings.!ini )
ok = SysIni(settings.!ini, 'PassiveConnections', 'DELETE:')
CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
cnt = 0
DO i = 1 TO records.0
if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!passive then do
cnt = cnt + 1
resdata = ""
resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
/* resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
resdata = resdata||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
resdata = resdata||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
ok = VRSetIni( "PassiveConnections", cnt, resdata, settings.!ini )
END
else iterate
end
if options.!debug == 1 then say time()' '||"_PassiveSave done"
return
/*:VRX _PrinterInfo
*/
_PrinterInfo:
if \_SMBpdrInstalled() then do
/* SMB.PDR is not installed */
CALL VRMessage 'Main', NLVGetMessage( 104 ), NLVGetMessage( 5 ), 'E'
end
else do /* SMB.pdr is installed */
/* shared queue name */
p_printer = SMBObj.resname
/* printer server */
capt = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
parse var Capt p_prtsrv '0D0A'x .
p_prtsrv = strip(p_prtsrv)
/* workgroup of the printer server */
Gparrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
capt = VRMethod("CN_SMBTREE", "GetRecordAttr", GParrh, "Caption")
parse var Capt p_workgroup '0D0A'x .
/* This is the string we will find in case this resource is already connected */
DescStr = translate(p_prtsrv'#'p_printer'#'p_workgroup'#')
say '"'DescStr'"'
LDescStr = length(DescStr)
/* Enumerate all SMB ports */
ok = SysIni('SYSTEM','PM_SPOOLER_PORT',"All:",'ports')
if ports.0 = 0 then do
/* No SMB ports installed */
CALL VRMessage 'Main', NLVGetMessage( 105 ), NLVGetMessage( 5 ), 'E'
end
else do
/* At least 1 SMB port was found - lets check whether it is already connected to our resource */
FoundPort = 0
do I = 1 to ports.0
if left(ports.i,3) = 'SMB' then do
say ports.I
say translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr))
say DescStr
if translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr)) = DescStr then do
OurPort = ports.I
FoundPort = 1
leave
end
end
end
say 'OurPort = "'OurPort'"'
if Foundport then do
ok = SysIni('SYSTEM','PM_SPOOLER_PRINTER',"All:",'printer')
FoundPrinter = 0
do I = 1 to printer.0
prtsummary = SysINi('SYSTEM','PM_SPOOLER_PRINTER',printer.i)
parse var prtsummary port ';'PrinterDriver';'PrinterQueue';' .
say printer.I' 'prtsummary
if port = ourPort then do
PrinterName = SysINi('SYSTEM','PM_SPOOLER_PRINTER_DESCR',printer.i)
parse var Printername Printername ';' .
CALL VRMessage 'Main', PrinterName' ('PrinterQueue') prints to port ' Port' connected to \\'p_workgroup'\'p_prtsrv'\'p_printer, NLVGetMessage( 1 ), 'I'
FoundPrinter = 1
leave
end
end
if FoundPrinter = 0 then do
/* Port installed and configured, but not used by any printer */
CALL VRMessage 'Main', NLVGetMessage( 106 ), NLVGetMessage( 5 ), 'E'
end
end
else do
CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
end
end
end
return
/*:VRX _ShowMsg
*/
_ShowMsg:
/* preliminary implementation - we just do not ignore it anymore -
- ShowMsg from smbmon/smbusers should become a shared library */
call _StatusBarWrapper Msg.Text
return
/*:VRX _SmbConfCreateShadowCopy
*/
_SmbConfCreateShadowCopy:
if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy started'
/* we create a complete version of smb.conf in temporary directory for reading purposes */
/* as we can only determine a default value from this complete version of the file */
/* however it is not desirable to always have a complete copy normally */
ok = SysFileDelete(samba.!shadowsmbconf)
if datatype(log_level) <> "NUM" then log_level = 2
say ' 'samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
address cmd samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy done'
return
/*:VRX _SMBpdrInstalled
*/
_SMBpdrInstalled: procedure
ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
return (ok <> "")
/*:VRX _StemsInit
*/
_StemsInit:
if options.!debug == 1 then say time()' _StemsInit started'
if options.!debug == 1 then say ' initializing options.'
options.!workgroup = ''
options.!server = ''
options.!share = ''
options.!user = ''
options.!password = ''
options.!spassword = ''
options.!master = ''
options.!mastertype = ''
options.!memlen = '2'
options.!cachetimeout = '10'
options.!cachelistings = '32'
options.!easupport = '1'
options.!readonly = ''
options.!loglevel = 0
options.!logfile = ''
options.!autoload = 0
options.!autoclose = 0
options.!nogui = 0
options.!autostart = 0
options.!editmode = 0
options.!delay = 0
options.!storecreds = 0
options.!timesync = 0
options.!timesrv = ''
options.!tracmark = 0
app_name_msg = NLVGetMessage( 0 )
IF app_name_msg == '' | WORD( app_name_msg, 1 ) == '[Missing' THEN
app_name_msg = 'EVFSGUI EVFSGUI'
/* These values are used in things like config files, WPS objects, etc.
*/
options.!appname_short = TRANSLATE( SUBWORD( app_name_msg, 1, 1 ))
options.!appname_long = SUBWORD( app_name_msg, 2 )
if options.!debug == 1 then say ' initializing vfs. '
vfs.!drive = ''
vfs.!mountpoint = ''
if options.!debug == 1 then say ' initializing advanced. '
advanced.!browseauth = ''
advanced.!browseimme = ''
advanced.!broadcast = ''
advanced.!special = ''
advanced.!savepassive= ''
advanced.!miniicons = ''
advanced.!easupport = 1
advanced.!readonly = ''
advanced.!alwaysmp = ''
advanced.!cachetimeout = '10'
advanced.!cachelistings = '32'
advanced.!smbconfchanged = 0
/* Obsolete */
advanced.!memlen = ''
advanced.!loglevel = '0'
advanced.!logfile = ''
if options.!debug == 1 then say ' initializing credentials. '
credentials.!username = ""
credentials.!password = ""
credentials.!entered = 0
UserCred = ""
RefreshMode = ""
if options.!debug == 1 then say ' initializing mtype. '
mtype.0 = 5
mtype.1 = NLVGetMessage( 15 )
mtype.2 = NLVGetMessage( 16 )
mtype.3 = NLVGetMessage( 17 )
mtype.4 = NLVGetMessage( 18 )
mtype.5 = NLVGetMessage(110 )
call _BrowseIconsInit
p_workgroup = "Unknown"
p_server = "Unknown"
p_share = "Unknown"
if options.!debug == 1 then say time()' _StemsInit done'
return
/*:VRX _TabbedDialogSetup
*/
_TabbedDialogSetup:
if options.!debug == 1 then say time()' _TabbedDialogSetup started'
w = VRLoad( "TDL_1", VRWindowPath(), "SW_DIALOG" )
ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(13)" ")
ok = VRMethod( "TDL_1", "SetStatusText", 1, NLVGetMessage(132,"1","2"))
w = VRLoad( "TDL_1", VRWindowPath(), "SW_ADVANCED" )
ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(40)" ")
ok = VRMethod( "TDL_1", "SetStatusText", 2, NLVGetMessage(132,"2","2"))
w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(39)" ")
w = VRLoad( "TDL_1", VRWindowPath(), "SW_CONDET" )
ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(63)" ")
w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(47)" ")
w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBCONF" )
ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(47)" ")
if options.!debug == 1 then say time()' _TabbedDialogSetup done'
return
/*:VRX _TabFix
*/
_TabFix:
ok = VRMethod( "TDL_1", "SetTabText", arg(1), " "strip(VRMethod( "TDL_1", "GetTabText", arg(1)))" ")
return
/*:VRX _TabsStrip
*/
_TabsStrip:
ok = VRMethod( "TDL_1", "SetTabText", 1, strip(VRMethod( "TDL_1", "GetTabText", 1)))
ok = VRMethod( "TDL_1", "SetTabText", 2, strip(VRMethod( "TDL_1", "GetTabText", 2)))
ok = VRMethod( "TDL_1", "SetTabText", 3, strip(VRMethod( "TDL_1", "GetTabText", 3)))
ok = VRMethod( "TDL_1", "SetTabText", 4, strip(VRMethod( "TDL_1", "GetTabText", 4)))
ok = VRMethod( "TDL_1", "SetTabText", 5, strip(VRMethod( "TDL_1", "GetTabText", 5)))
return
/*:VRX _TimeSync
*/
_TimeSync:
if options.!debug == 1 then say time()' _TimeSync started, "'options.!timesrv'"'
TimeMsg.1 = NLVGetMessage(141)' 'time()
if options.!timesrv <> '' then do
say ' 'samba.!netexe' time set -S 'options.!timesrv
address cmd samba.!netexe' time set -S 'options.!timesrv
end
else do
say ' 'samba.!netexe' time set'
address cmd samba.!netexe' time set'
end
options.!timesync = ''
TimeMsg.2 = NLVGetMessage(142)' 'time()
TimeMsg.0 = 2
Buttons.1 = NLVGetMessage(2)
Buttons.0 = 1
id = VRMessageStem( VRWindow(), TimeMsg. , NLVGetMessage(129) , "Information", "Buttons.", 1, 1 )
if options.!debug == 1 then say time()' _TimeSync done'
return
/*:VRX _UpdateObject
*/
_UpdateObject: procedure
Object = arg(1)
ObjValue = arg(2)
if VRGet(Object,"Value") <> ObjValue then ok = VRset(Object,"Value",ObjValue)
return
/*:VRX _UserCredUpdate
*/
_UserCredUpdate:
if options.!debug == 1 then say time()' _UserCredUpdate started'
credentials.!username = VRGet("EF_USER","Value")
credentials.!password = VRGet("EF_PASSWORD","Value")
if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 1 | pos(left(credentials.!password,1),'01234567890') > 0
then UserCred = '--user='Credentials.!username'%%'Credentials.!password
else UserCred = '--user='Credentials.!username'%'Credentials.!password
if options.!storecreds = 1 & \(UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' | UserCred = '--user=%%' | UserCred = '-N') then do
ok = _ucSetUc()
ok = VRSet("Pict_PWINMEM","PicturePath","#36")
if options.!debug == 1 then call beep 2400, 10
end
else do
if options.!debug == 1 then call beep 200, 20
ok = VRSet("Pict_PWINMEM","PicturePath","#37")
end
if options.!debug == 1 then say time()' _UserCredUpdate done'
return
/*:VRX CB_client_lanman_auth_Click
*/
CB_client_lanman_auth_Click:
advanced.!smbconfchanged = 1
return
/*:VRX CB_client_NTLMv2_auth_Click
*/
CB_client_NTLMv2_auth_Click:
advanced.!smbconfchanged = 1
if VRGet("CB_client_NTLMv2_auth","Set") = 0 then do
ok = VRSet("CB_client_lanman_auth","Enabled", 1)
ok = VRSet("CB_client_plaintext_auth","Enabled", 1)
end
else do
ok = VRSet("CB_client_lanman_auth","Enabled", 0)
ok = VRSet("CB_client_lanman_auth","Set", 0)
ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
ok = VRSet("CB_client_plaintext_auth","Set", 0)
end
return
/*:VRX CB_client_plaintext_auth_Click
*/
CB_client_plaintext_auth_Click:
advanced.!smbconfchanged = 1
return
/*:VRX CB_client_use_spnego_Click
*/
CB_client_use_spnego_Click:
advanced.!smbconfchanged = 1
return
/*:VRX CB_client_use_spnego_principal_Click
*/
CB_client_use_spnego_principal_Click:
advanced.!smbconfchanged = 1
return
/*:VRX CB_DEBUG_Click
*/
CB_DEBUG_Click:
return
/*:VRX CB_ENCRYPTION1_Click
*/
CB_ENCRYPTION1_Click:
if VRGet("CB_ENCRYPTION1","set") then do
ok = VRSet("CB_NTLMv11", "Set", 0)
ok = VRSet("CB_NTLMv11", "Enabled", 0)
end
else do
ok = VRSet("CB_NTLMv11", "Enabled", 1)
end
return
/*:VRX CB_ENCRYPTION_Click
*/
CB_ENCRYPTION_Click:
if VRGet("CB_ENCRYPTION","set") then do
ok = VRSet("CB_NTLMv1", "Set", 0)
ok = VRSet("CB_NTLMv1", "Enabled", 0)
end
else do
ok = VRSet("CB_NTLMv1", "Enabled", 1)
end
return
/*:VRX CB_KERBEROS51_Click
*/
CB_KERBEROS51_Click:
if VRGet("CB_KERBEROS51","set") then do
ok = VRSet("CB_NTLMv11", "Set", 0)
ok = VRSet("CB_NTLMv11", "Enabled", 0)
end
else do
ok = VRSet("CB_NTLMv11", "Enabled", 1)
end
return
/*:VRX CB_KERBEROS5_Click
*/
CB_KERBEROS5_Click:
if VRGet("CB_KERBEROS5","set") then do
ok = VRSet("CB_NTLMv1", "Set", 0)
ok = VRSet("CB_NTLMv1", "Enabled", 0)
end
else do
ok = VRSet("CB_NTLMv1", "Enabled", 1)
end
return
/*:VRX CB_LOGGING_Click
*/
CB_LOGGING_Click:
if VRFileExists(SysBootDrive()'\ndpsmb.dbg') then
ok = SysFileDelete(SysBootDrive()'\ndpsmb.dbg')
else do
call lineout SysBootDrive()'\ndpsmb.dbg','NDPSMB debug flag file'
ok = stream(SysBootDrive()'\ndpsmb.dbg','c','close')
end
CALL VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()'\ndpsmb.dbg')
return
/*:VRX CB_MOUNT_Change
*/
CB_MOUNT_Change:
if options.!debug == 1 then say time()' '||"CB_MOUNT_Change started"
mount = VRGet("CB_MOUNT", "Value")
/* Catch empty mount type error */
if mount = "" then do
if mtype.1 <> "" then ok = VRSet("CB_MOUNT", "Value", mtype.1)
if options.!debug == 1 then say time()' '||"CB_MOUNT_Change aborted"
return
end
SELECT
WHEN mount == mtype.1 THEN DO
CALL VRSet "DT_SHARE", "Visible", 1
CALL VRSet "EF_SHARE", "Visible", 1
CALL VRSet "DT_SERVER", "Visible", 1
CALL VRSet "EF_SERVER", "Visible", 1
CALL VRSet "DT_NETWORK", "Visible", 1
CALL VRSet "EF_NETWORK", "Visible", 1
CALL VRSet "CHK_MTYPE", "Visible", 0
CALL NLVSetText "DT_NETWORK", "Caption", 21
END
WHEN mount == mtype.2 THEN DO
CALL VRSet "DT_SHARE", "Visible", 0
CALL VRSet "EF_SHARE", "Visible", 0
CALL VRSet "DT_SERVER", "Visible", 1
CALL VRSet "EF_SERVER", "Visible", 1
CALL VRSet "DT_NETWORK", "Visible", 1
CALL VRSet "EF_NETWORK", "Visible", 1
CALL VRSet "CHK_MTYPE", "Visible", 0
CALL NLVSetText "DT_NETWORK", "Caption", 21
END
WHEN mount == mtype.3 THEN DO
CALL VRSet "DT_SHARE", "Visible", 0
CALL VRSet "EF_SHARE", "Visible", 0
CALL VRSet "DT_SERVER", "Visible", 0
CALL VRSet "EF_SERVER", "Visible", 0
CALL VRSet "DT_NETWORK", "Visible", 1
CALL VRSet "EF_NETWORK", "Visible", 1
CALL VRSet "CHK_MTYPE", "Visible", 0
CALL NLVSetText "DT_NETWORK", "Caption", 21
END
WHEN mount == mtype.4 THEN DO
CALL VRSet "DT_SHARE", "Visible", 0
CALL VRSet "EF_SHARE", "Visible", 0
CALL VRSet "DT_SERVER", "Visible", 0
CALL VRSet "EF_SERVER", "Visible", 0
CALL VRSet "DT_NETWORK", "Visible", 1
CALL VRSet "EF_NETWORK", "Visible", 1
CALL VRSet "CHK_MTYPE", "Visible", 1
CALL NLVSetText "DT_NETWORK", "Caption", 22
END
WHEN mount == mtype.5 THEN DO
CALL VRSet "DT_SHARE", "Visible", 0
CALL VRSet "EF_SHARE", "Visible", 0
CALL VRSet "DT_SERVER", "Visible", 1
CALL VRSet "EF_SERVER", "Visible", 1
CALL VRSet "DT_NETWORK", "Visible", 0
CALL VRSet "EF_NETWORK", "Visible", 0
CALL VRSet "CHK_MTYPE", "Visible", 0
CALL NLVSetText "DT_Server", "Caption", 111
END
OTHERWISE DO
id = VRMessage( "", 'unknown mount type here >>'mount'<< mtype1=>>'mtype.1'<<', "Mount change error", "E", )
END
END
if options.!debug == 1 then say time()' '||"CB_MOUNT_Change done"
RETURN
/*:VRX CB_NTLMV11_Click
*/
CB_NTLMV11_Click:
if VRGet("CB_NTLMV11","set") then do
ok = VRSet("CB_KERBEROS51", "Set", 0)
ok = VRSet("CB_ENCRYPTION1","Set", 0)
ok = VRSet("CB_KERBEROS51", "Enabled", 0)
ok = VRSet("CB_ENCRYPTION1","Enabled", 0)
end
else do
ok = VRSet("CB_KERBEROS51", "Enabled", 1)
ok = VRSet("CB_ENCRYPTION1","Enabled", 1)
end
return
/*:VRX CB_NTLMv1_Click
*/
CB_NTLMv1_Click:
if VRGet("CB_NTLMV1","set") then do
ok = VRSet("CB_KERBEROS5", "Set", 0)
ok = VRSet("CB_ENCRYPTION","Set", 0)
ok = VRSet("CB_KERBEROS5", "Enabled", 0)
ok = VRSet("CB_ENCRYPTION","Enabled", 0)
end
else do
ok = VRSet("CB_KERBEROS5", "Enabled", 1)
ok = VRSet("CB_ENCRYPTION","Enabled", 1)
end
return
/*:VRX CN_CONDET_Click
*/
CN_CONDET_Click:
/* call _StatusBarWrapper VRGet("Main", "HintText") */
return
/*:VRX CN_CONDET_ContextMenu
*/
CN_CONDET_ContextMenu:
rh = VRInfo('Record')
if VRMethod( "CN_CONDET", "ValidateRecord", rh) <> 1 then return
/* Hide all context menu entries */
ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
/* This is the place to enable specific context menu entries */
ok = VRMethod( "CN_CONDET", "GetRecordList", "All", "records." )
ok = VRSet("Menu_Selected_Remove", "Visible", (records.0 <> 0))
ok = VRSet("Menu_Selected_Retry", "Visible", (records.0 <> 0))
if VRMethod( "CN_CONDET", "GetFieldData", rh, CD.StatusFH) = icons.!passive then do
ok = VRSet("Menu_Selected_Retry", "Enabled",1)
ok = VRSet("Menu_Selected_Remove", "Enabled",1)
end
ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
return
/*:VRX CN_CONDET_DragStart
*/
CN_CONDET_DragStart:
obj = VRInfo( "object" )
ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
if selrec.0 = 0 then return
Icon = VRMethod("CN_CONDET", "GetRecordAttr", selrec.1, "Icon")
if Icon = icons.!printer then do /* Printers not supported at the moment */
call beep 4800,100
CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
end
else call VRMethod obj, 'StartDrag'
return
/*:VRX CN_CURRENT_Click
*/
CN_CURRENT_Click:
if options.!debug == 1 then say time()' CN_CURRENT_Click started'
/* call _StatusBarWrapper VRGet("Main", "HintText") */
/* Herwig B. */
CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0)
rh = VRInfo('Record')
if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then return
data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
options.currentdata = data
/* call _StatusBarWrapper data' - 'VRGet("Main", "HintText") */
PARSE VAR data p_node ';' p_mounts ';' p_string
if options.!debug == 1 then do
say ' data = "'data'"'
say ' p_node = "'p_node'"'
say ' p_mounts = "'p_mounts'"'
say ' p_string = "'p_string'"'
end
if p_string = ""
then infotext = fs.!name' 'fs.!version
else infotext = p_string
if infotext = "" then infotext = " "
CALL VRSet "CN_CURRENT", "Caption", infotext
CALL VRSet "CN_CURRENT", 'HintText',infotext
IF p_mounts > 0 THEN DO
CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
if pos("*",p_string) > 0 | pos(";",p_string) > 0
then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
END
ELSE DO
CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
END
parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
IF parent == '' THEN DO
CALL VRSet 'PB_DETACH', 'Enabled', 1
CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
END
ELSE DO
CALL VRSet 'PB_DETACH', 'Enabled', 0
CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
END
parse var p_string p_workgroup'\\'p_server'\'p_share
p_workgroup = strip(p_workgroup,'T',':')
if options.!debug == 1 then do
say ' p_workgroup = "'p_workgroup'"'
say ' p_server = "'p_server'"'
say ' p_share = "'p_share'"'
end
p_server = translate(p_server)
ok = VRSet("EF_NETWORK","Value", p_workgroup)
if p_workgroup <> "" then do
wgh = _GetMachineHandle(p_workgroup)
if wgh = "" then wgh = _AddWorkGroup(p_workgroup)
call _UpdateObject "EF_SERVER", p_server
mh = _GetMachineHandle(p_server)
if mh = "" & p_server <> "*" then do
mh = _AddSleepingMachine(p_server,'',wgh)
machine = p_server
call _RefreshShares
end
ok = VRSet("EF_Share","Value", p_share)
select
when p_workgroup = "*" then ok = VRSet("CB_MOUNT","Value", mtype.4)
when p_server = "*" then ok = VRSet("CB_MOUNT","Value", mtype.3)
when p_share = "*" then ok = VRSet("CB_MOUNT","Value", mtype.2)
otherwise ok = VRSet("CB_MOUNT","Value", mtype.1)
end
end
if options.!debug == 1 then say time()' CN_CURRENT_Click done'
RETURN
/*:VRX CN_CURRENT_ContextMenu
*/
CN_CURRENT_ContextMenu: /* PROCEDURE EXPOSE existrec. options. icons. fs. */
if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu started"
CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
rh = VRInfo('Record')
/* we have to check whether the record still exists because under certain
circumstances the event routine is executed after the record was already
removed */
if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu aborted"
return
end
data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR data p_node ';' p_mounts ';' p_string
if options.!debug == 1 then do
say ' data = "'data'"'
say ' p_node = "'p_node'"'
say ' p_mounts = "'p_mounts'"'
say ' p_string = "'p_string'"'
end
/*
infotext = p_node
DO i = 1 TO p_mounts
infotext = infotext ' ['p_string']'
END
*/
if p_string = ""
then infotext = fs.!name' 'fs.!version
else infotext = p_string
if infotext = "" then infotext = " "
CALL VRSet "CN_CURRENT", "Caption", infotext
CALL VRSet "CN_CURRENT", 'HintText',infotext
CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1
CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1
CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
CALL VRSet 'Menu_Context_Open_Default', "Visible", 1
IF p_mounts > 0 THEN DO
CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
END
ELSE DO
CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
END
parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
IF parent == '' THEN DO
CALL VRSet 'PB_DETACH', 'Enabled', 1
CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
END
ELSE DO
CALL VRSet 'PB_DETACH', 'Enabled', 0
CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 0 */
END
ok = VRMethod( "Menu_Context", "Popup", , , "", "" )
if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu done"
return
/*:VRX CN_CURRENT_DoubleClick
*/
CN_CURRENT_DoubleClick:
if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick started"
CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
rh = VRInfo('Record')
/* we have to check whether the record still exists because under certain
circumstances the event routine is executed after the record was already
removed */
if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick aborted"
return
end
data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR data p_node ';' p_mounts ';' p_string
if options.!debug == 1 then do
say ' data = "'data'"'
say ' p_node = "'p_node'"'
say ' p_mounts = "'p_mounts'"'
say ' p_string = "'p_string'"'
end
call Menu_Context_Open_Default_Click
if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick done"
return
/*:VRX CN_CURRENT_DragDrop
*/
CN_CURRENT_DragDrop:
if options.!debug == 1 then say time()' CN_CURRENT_DragDrop started'
ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
if options.!debug == 1 then say " settings.!network = "settings.!network
p_workgroup = ''
p_server = ''
p_share = ''
srcFile = VRInfo( "SourceFile" )
srcCtn = VRInfo( "SourceObject" )
srcRec = VRInfo( "SourceRecord" )
trgCtn = VRInfo( "TargetObject" )
trgRec = VRInfo( "TargetRecord" )
if options.!debug == 1 then do
say ' srcFile = "'srcFile'"'
say ' srcCtn = "'srcCtn'"'
if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
say ' srcRec = "'srcRec'"'
say ' trgCtn = "'trgCtn'"'
if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
say ' trgRec = "'trgRec'"'
end
if srcFile <> "" then do /* A file was dropped onto the container - attempt to load it */
if options.!debug == 1 then say ' Possible profile dropped: "'srcFile'"'
/* was it really a profile ? */
if translate(VRParseFileName(srcFile,'E')) = translate(fs.!profileext) then do /* Yes - load it! */
options.!autoload = 1
Profile = srcFile
call Menu_File_Load_Click
ok = VRSet("EF_NETWORK","Value",options.!workgroup)
end
else do /* No - barf! */
buttons.0 = 1
buttons.1 = NLVGetMessage(9)
ok = VRMessage('Main', NLVGetMessage(103,srcFile ), NLVGetMessage(5), 'E','buttons.')
end
if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done (load profile)'
return
end
ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
if VRGet(srcCtn,'Name') = "CN_CONDET" then do
p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.MpointFH)
p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcRec, cd.workgrpFH )
p_server = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ServerFH)
p_share = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ShareFH)
p_user = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.UserFH)
p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.SpasswordFH))
ShareLevel = 1
if p_share = "" then ShareLevel = 2
if p_server = "" then ShareLevel = 3
if p_workgroup = "" then ShareLevel = 4
ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
call _UpdateObject "EF_SERVER", p_server
ok = VRset("EF_SHARE", "Value", p_share)
ok = VRset("EF_NETWORK", "Value", p_workgroup)
ok = VRset("EF_USER", "Value", p_user)
ok = VRset("EF_PASSWORD", "Value", p_password)
parse var p_mpoint p_drv '\' p_dir
p_dir = strip(p_dir,'T','\')
ok = VRset("CB_DRIVES", "Value", p_drv)
ok = VRset("EF_DIRECTORY", "Value", p_dir)
end /* Drag from CN_CONDET */
else do /* Drag from CN_SMBTREE */
call _GetSMBObjectProperties srcRec
select
when SMBObj.udatatype = "WORKGROUP" then do
say "Workgroup dragged!"
p_workgroup = SMBObj.resname
p_server = ""
p_share = ""
ShareLevel = 3
end
when SMBObj.udatatype = "SERVER" then do
say "Server dragged!"
if SMBObj.parentrh <> "" then do /* detect server without workgroup */
p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
end
p_server = SMBObj.resname
p_share = ""
ShareLevel = 2
end
when SMBObj.udatatype = "DISK" then do
say "Shared disk dragged!"
if SMBObj.gparentrh <> "" then do /* detect share on a server without workgroup */
p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.gparentrh, "Caption")
end
p_server = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
parse var p_server p_server '0D0A'x .
p_share = SMBObj.resname
ShareLevel = 1
end
otherwise nop /* Printer */
end
ok = VRSet("EF_NETWORK","Value",p_workgroup)
call _UpdateObject "EF_SERVER", p_server
ok = VRSet("EF_Share","Value", p_share)
end /* Drag from CN_SMBTREE */
if options.!debug == 1 then do
say 'p_workgroup = "'p_workgroup'"'
say 'p_server = "'p_server'"'
say 'p_share = "'p_share'"'
end
ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
settings.!network = VRGet("EF_NETWORK","Value")
call CB_MOUNT_Change
if trgRec = "" then do
ok = VRMethod("CB_DRIVES", "GetStringList", "freedrives.")
if freedrives.0 > 0
then ok = VRSet("CB_DRIVES","Value", freedrives.1)
else ok = VRSet("CB_DRIVES","Value", "")
ok = VRSet("EF_DIRECTORY","Value", "")
end
else do
TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
do while parTrgRH <> ""
partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
TargetString = partrgCapt||'\'||TargetString
parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
end
say 'TargetString = "'TargetString'"'
ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
end
window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
if VRGet("CB_DRIVES","Value") = "" then return
window = VRLoadSecondary( "SW_LOGIN", "W" )
if credentials.!entered = 1 then call PB_MOUNT_CLICK
if VRGet(srcCtn,'Name') = "CN_CONDET" & VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
end
if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done'
return
/*:VRX CN_SMBTREE_Click
*/
CN_SMBTREE_Click:
if options.!debug == 1 then say time()' CN_SMBTREE_Click started'
/* call _StatusBarWrapper VRGet("Main", "HintText") */
call _dropdeprecated
call _GetSmbObjectProperties VRInfo('Record')
call _ContextMenuSelectedSet
call _StatusBarWrapper SMBObj.udatamsg
if options.!debug == 1 then say time()' CN_SMBTREE_Click done'
return
/*:VRX CN_SMBTREE_ContextMenu
*/
CN_SMBTREE_ContextMenu:
if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
call _dropdeprecated
RH = VRInfo('Record')
if RH <> "" then do
call _GetSmbObjectProperties RH
call _ContextMenuSelectedSet
BrowsePath = _browsebuildpath(SMBObj.rh)
call _BrowseResetObject(SmbObj.rh)
parse var browsepath '\\'machine'\'sharename '\' browsepath
ok = VRMethod( "Menu_Selected", "Popup", , , "", "PositionOnItem" )
end
if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
return
/*:VRX CN_SMBTREE_DoubleClick
*/
CN_SMBTREE_DoubleClick:
if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
call _dropdeprecated
call _GetSmbObjectProperties VRInfo('Record')
/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
return */
/* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
If SMBObj.udatatype = "DIRECTORY" then do
BrowsePath = _browsebuildpath(SMBObj.rh)
call _BrowseResetObject(SmbObj.rh)
parse var browsepath '\\'machine'\'sharename '\' browsepath
browsepath = browsepath'\*'
call _BrowseDirectory
end
If SMBObj.udatatype = "FILE" then do
BrowsePath = _browsebuildpath(SMBObj.rh)
call _BrowseResetObject(SmbObj.rh)
parse var browsepath '\\'machine'\'sharename '\' browsepath
OpenOk = _browseobjectopen(machine,sharename,browsepath)
if \OpenOK then do
say " Not connected - trying to connect"
ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
call PB_SMBTREE_CONNECT_Click
ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
OpenOk = _browseobjectopen(machine,sharename,browsepath)
if \OpenOk then do
say " Not connected - cannot open - aborting!"
end
end
end
if SMBObj.udatatype = "DISK" then do
machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
parse var machine machine '0D0A'x .
machine = strip(machine)
call _BrowseResetObject(SmbObj.rh)
sharename = SMBObj.resname
BrowsePath = ""
call _BrowseDirectory
end
if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
return
/*:VRX CN_SMBTREE_DragFile
*/
CN_SMBTREE_DragFile:
if options.!debug == 1 then say time()' CN_SMBTREE_DragFile started'
obj = VRInfo( "object" )
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
if SelRH.0 = 0 then do
if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
return
end
call _dropdeprecated
call _GetSMBObjectProperties SelRH.1
select
when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
call VRMethod obj, 'StartDrag'
end
when SMBObj.udatatype = "PRINTER" then do
CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
end
otherwise nop /* FILE DIRECTORY */
end
if options.!debug == 1 then say time()' CN_SMBTREE_DragFile done'
return
/*:VRX CN_SMBTREE_DragStart
*/
CN_SMBTREE_DragStart:
if options.!debug == 1 then say time()' CN_SMBTREE_DragStart started'
obj = VRInfo( "object" )
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
if SelRH.0 = 0 then do
if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
return
end
call _dropdeprecated
call _GetSMBObjectProperties SelRH.1
select
when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
call VRMethod obj, 'StartDrag'
end
when SMBObj.udatatype = "PRINTER" then do
CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
end
otherwise nop /* FILE DIRECTORY */
end
if options.!debug == 1 then say time()' CN_SMBTREE_DragStart done'
return
/*:VRX CreateObject
*/
CreateObject: procedure
Parse Arg Class, Title, Location, Setup, Collision
/* say 'Creating ['Title']' */
say Setup
rc = SysCreateObject( Class, Title, Location, Setup, Collision )
If rc <> 1 Then do
Msg.Text = ' > failed to create ['Title' | 'Class'] at location ['Location']'
Msg.Type = 'Error'
say Msg.Text
end
return rc
/*:VRX DT_STATUSBAR_ContextMenu
*/
DT_STATUSBAR_ContextMenu:
call _StatusBarWrapper VRGet("Main", "HintText")
return
/*:VRX EF_PASSWORD1_KeyPress
*/
EF_PASSWORD1_KeyPress:
if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress started'
obj = VRInfo( "Object" )
keystr = VRGet( obj, "KeyString" )
/* say keystr */
select
when keystr = "{Enter}" then call PB_LOGIN_OK_Click
when keystr = "{Newline}" then call PB_LOGIN_OK_Click
when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
otherwise nop
end
if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress done'
return
/*:VRX EF_PASSWORD_Change
*/
EF_PASSWORD_Change:
Now = VRGet("EF_PASSWORD","value")
if Now = "" | Now = LastPassword then return
ok = SysSleep(1)
LastPassword = Now
if Now <> VRGet("EF_PASSWORD","value") then return
call _UserCredUpdate
return
/*:VRX EF_SERVER_Change
*/
EF_SERVER_Change:
if options.!debug == 1 then say time()' EF_SERVER_Change started'
Now = VRGet("EF_SERVER","value")
if Now = "" | Now = LastServer then return
ok = SysSleep(2)
if Now <> VRGet("EF_SERVER","value") then return
IF options.!editmode = 1 then return
/* Do nothing for incomplete IP addresses */
if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" then do /* got an IP address */
if \_IsValidIPAddress(VRGet("EF_SERVER","value")) then return /* it is invalid or incomplete */
end
/* do nothing if a workgroup was mounted */
if VRGet("EF_SERVER","value") = "*" then return
machine = VRGet("EF_SERVER","value")
ok = VRSet("EF_SHARE","Value", "")
ok = VRMethod("EF_SHARE","Reset")
rh = _GetMachineHandle(machine)
if rh <> "" then do
call _GetSMBObjectProperties rh
if SMBObj.parentrh = ""
then ok = VRSet("EF_NETWORK","Value", "") /* The workgroup might be unknown at this moment */
else ok = VRSet("EF_NETWORK","Value", VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentRH,"Caption"))
call _GetSMBObjectShares SMBObj.rh
if SMBObj.shares.0 > 0 then do
ok = VRMethod("EF_SHARE", "AddStringList", "SMBObj.shares.")
end
end
else do
call _RefreshWorkgroups
smbtree.!machine = _AddSleepingMachine(machine,"","")
call _UserCredUpdate
call _RefreshShares
ok = VRSet( "CN_smbtree", "Painting", 1 )
ok = VRSet("Main", 'Pointer', '' )
ok = VRSet("CN_smbtree","Enabled", 1)
ok = VRSet("TM_Throbber","Enabled", 0)
ok = VRSet("Pict_Throbber","Visible", 0)
end
LastServer = VRGet("EF_SERVER","value")
if options.!debug == 1 then say time()' EF_SERVER_Change done'
return
/*:VRX EF_USER1_KeyPress
*/
EF_USER1_KeyPress:
if options.!debug == 1 then say time()' EF_USER1_KeyPress started'
obj = VRInfo( "Object" )
keystr = VRGet( obj, "KeyString" )
say keystr
select
when keystr = "{Enter}" then ok = VRMethod( "EF_Password1", "SetFocus" )
when keystr = "{Newline}" then ok = VRMethod( "EF_Password1", "SetFocus" )
when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
otherwise nop
end
if options.!debug == 1 then say time()' EF_USER1_KeyPress done'
return
/*:VRX EF_USER_Change
*/
EF_USER_Change:
Now = VRGet("EF_USER","value")
if Now = "" | Now = LastUser then return
ok = SysSleep(1)
LastUser = Now
if Now <> VRGet("EF_USER","value") then return
call _UserCredUpdate
return
/*:VRX EF_WINS_SERVER_Change
*/
EF_WINS_SERVER_Change:
advanced.!smbconfchanged = 1
return
/*:VRX Fini
*/
Fini:
window = VRWindow()
call VRSet window, "Visible", 0
drop window
return 0
/*:VRX GetChildren
*/
GetChildren: PROCEDURE EXPOSE existrec. exc options. icons. fs. cd. samba.
if options.!debug == 1 then say time()' GetChildren started'
PARSE ARG node, parec
CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
IF info.2 > 0 THEN icon = icons.!active
ELSE icon = icons.!passive
rh = VRMethod("CN_CURRENT", 'AddRecord', parec, 'Last', info.0, icon )
IF rh == '' | datatype(res.0) <> "NUM" THEN RETURN
exc = exc + 1
existrec.exc = rh
userdata = node';'info.2
DO i = 1 TO res.0
userdata = ParseResourceData( userdata, res.i )
END
if userdata = "UNKNOWN" then ok = VRMethod("CN_CURRENT", 'RemoveRecord', rh)
else do
CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata
if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
end
DO i = 1 TO points.0
childnode = node || points.i || '\'
CALL GetChildren childnode, rh
END
if options.!debug == 1 then say time()' GetChildren done'
RETURN
/*:VRX GetMountPoints
*/
GetMountPoints: PROCEDURE EXPOSE existrec. options. icons. fs. cd. samba.
if options.!debug == 1 then say time()' GetMountPoints started'
/* CALL VRSet "CN_CURRENT", 'Painting', 0 */
/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) started" */
drvs = SysDriveMap('C:', 'USED') /* was "REMOTE" */
/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) done" */
ac = 0
DO i = 1 TO WORDS( drvs )
fs = TRANSLATE( SysFileSystemType( WORD( drvs, i )))
IF fs == fs.!fileSystemtype THEN DO
ac = ac + 1
attached.ac = WORD( drvs, i )
END
END
attached.0 = ac
exc = 0
DO i = 1 TO attached.0
node = attached.i'\'
CALL VRMethod 'CB_DRIVES', 'AddString', attached.i
CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
IF info.2 > 0 THEN icon = icons.!drive
ELSE icon = icons.!drive_inactive
rh = VRMethod("CN_CURRENT", 'AddRecord',, 'Last', attached.i, icon )
IF rh == '' THEN ITERATE
exc = exc + 1
existrec.exc = rh
userdata = node';'info.2
DO j = 1 TO res.0
userdata = ParseResourceData( userdata, res.j )
END
/* if options.!debug == 1 then say ' "'attached.i'" "'userdata'"' */
CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata /* , 'FileName', 'TESTER.EVP' */
if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'Expanded', 1
DO j = 1 TO points.0
childnode = node || points.j || '\'
CALL GetChildren childnode, rh
END
END
existrec.0 = exc
/* CALL VRSet "CN_CURRENT", 'Painting', 1 */
if options.!debug == 1 then say time()' '||"GetMountPoints done"
RETURN
/*:VRX Halt
*/
Halt:
signal _VREHalt
return
/*:VRX Init
*/
Init:
/* Herwig */
/* CALL VRSet 'Console', 'WindowListTitle', '' */
window = VRWindow()
call VRSet window, "Visible", 0
call VRMethod window, "Activate"
drop window
RETURN
/*:VRX LoadFileSysFuncs
*/
LoadFileSysFuncs:
if options.!debug == 1 then say time()' LoadFileSysFuncs() started'
Fatal = 1
RestartCount = 0
FoundEVFS = 1
FoundND = 1
program = VRGet("Application", "Program")
if program = "" then parse source . . program
say "Program = '"program"'"
program = translate(VRParseFileName(Program,'N'))
say "Program = '"program"'"
if SysSearchPath("PATH", "EVFSCTL.EXE") = "" | program = "SMBGUI" then do
FoundEVFS = 0
ForceNDFS = 1
end
CtlRestart:
if \ForceNDFS then signal NoNetDrive
ForceNDFS:
if options.!debug == 1 then say ' NDFS check entered'
call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
SIGNAL ON SYNTAX NAME NoNetdrive
call NdRxLoadFuncs
FoundND = 1
SIGNAL OFF SYNTAX
fs.!prefix = 'ND'
fs.!fileSystemtype = "NDFS32"
fs.!profileext = "ndc"
signal CommonToBothFS
NoNetdrive:
if options.!debug == 1 then say ' NDFS not found'
CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
SIGNAL ON SYNTAX NAME NoEVFSCALL
CALL EvfsRxLoadFuncs
FoundEVFS = 1
SIGNAL OFF SYNTAX
fs.!prefix = 'EVFS'
fs.!fileSystemtype = "EVFS"
fs.!profileext = "evp"
CommonToBothFS:
if options.!debug == 1 then say ' Common version check'
CALL _Dynamic "fsstat = "fs.!prefix"RxQueryIFS()"
if fsstat = 252 then CALL _Dynamic "Found"fs.!prefix" = 0"
if word(fsstat,1) = '0' then do
PARSE VAR fsstat '0 'fsname fsver fsctl .
fs.!name = fsname
fs.!version = fsver
if options.!debug == 1 then DO
say ' fs.!prefix = 'fs.!prefix
say ' fs.!name = 'fs.!Name
say ' Version = 'fsver
say ' fsctl = 'fsctl
end
end
else do
if FoundND = 0 & FoundEVFS = 0 then do
CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
signal Halt
end
signal ForceNDFS
end
IF fsctl \= 1 THEN DO
if ReStartCount = 0 then do
'detach 'fs.!prefix'ctl.exe'
RestartCount = 1
ok = SysSleep(1)
signal CtlRestart
end
else do
CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
signal Halt
end
END
Fatal = 0
if options.!debug == 1 then say time()' LoadFileSysFuncs() done'
return
/*:VRX Main_Close
*/
Main_Close:
CALL Quit
RETURN
/*:VRX Main_Create
*/
Main_Create:
options.!debug = 0
if options.!debug == 1 then do
ok = VRRedirectStdIO("ON")
say time()' Main_Create started'
end
else ok = VRRedirectStdIO("OFF")
call _InitTempDir
call _LoadOtherFuncs
call NLVSetup
call _StemsInit
call _TabbedDialogSetup
call _ContainersInit
call _GUIInit
CALL _ParseCommandLine
CALL LoadFileSysFuncs
CALL _CltInit
CALL _INILoad
if \VRFileExists(samba.!smbconf)|stream(samba.!smbconf,"c","query size") = 0 then do
call _CreateSmbConf
end
call _TabFix 1
call SW_ADVANCED_Init_Content
call SW_SMBTREE_Init_Content
call SW_CONDET_Init_Content
call SW_SETTINGS_Init_Content
CALL Refresh
if advanced.!savepassive == 1 then CALL _PassiveLoad
IF options.!timesync == 1 THEN CALL _TimeSync
IF options.!autoload == 1 THEN CALL Menu_File_Load_Click
CALL VRSet "CB_MOUNT", "Selected", 1
CALL VRSet "CB_DRIVES", "Selected", 1
IF options.!autoclose == 1
THEN CALL TM_AutoClose_Trigger
ELSE do
if advanced.!browseauth == 1 then do
/* FIXME: unclear why we have to do the following 4 lines here */
call SW_SETTINGS_Init
call SW_SETTINGS_Init_Content
call SW_ADVANCED_Init
call SW_ADVANCED_Init_Content
window = VRLoadSecondary( "SW_LOGIN", "W" )
call Main_Resize
end
if advanced.!browseimme == 1 then call PB_SMBTREE_REFRESH_Click
end
if options.!debug == 1 then say time()' Main_Create done'
return
/*:VRX Main_KeyPress
*/
Main_KeyPress:
key = VRGet('Main', 'KeyString')
IF key == '{F5}' THEN CALL Refresh
RETURN
/*:VRX Main_Resize
*/
Main_Resize:
if options.!debug == 1 then say time()' Main_Resize started'
ok = VRset("Main","Painting", 0)
/* Basic measurements */
main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
/** This caused weird resizing glitches, horrible jittering, etc. Instead,
** what we now do (further down) is set a minimum size in twips for the right
** pane, below which it simply stops resizing and switches to clipping. (The
** left pane resizes all its controls dynamically anyway.) This better matches
** standard application behaviour, and makes resizing behave more smoothly.
*
* if VRMethod( "Screen", "TwipsToPixels", main_iheight) < 600 then
* ok = VRSet("Main","Height",VRMethod( "Screen", "PixelsToTwips", 580))
* if VRMethod( "Screen", "TwipsToPixels", main_iwidth) < 730 then
* ok = VRSet("Main","Width", VRMethod( "Screen", "PixelsToTwips", 730))
*/
sbar_height = VRGet("GB_STATUSBAR","Height") /* Height of status-bar */
split_left = VRGet("SPLIT_Main","Left") /* Position of the left edge of the split-bar */
marginx2 = margin * 2 /* Common margin around controls */
pbtn_height = 400 /* Height of the panels' internal button areas */
pane_height = main_iheight - sbar_height - (margin * 4) /* Height of a split-bar panel */
lpane_width = split_left - margin /* Width of the left split-bar panel */
rpane_width = main_iwidth - split_left - 60 - margin /* Width of the right split-bar panel */
/* Tabbed Dialog = right pane */
ok = VRset("TDL_1", "Top", marginx2)
ok = VRset("TDL_1", "Left", split_left + 60)
ok = VRset("TDL_1", "Width", rpane_width )
ok = VRset("TDL_1", "Height", pane_height )
/* Current Panel */
ok = VRSet("GB_CURRENT", "Visible", 1 )
ok = VRSet("GB_CURRENT", "Top", marginx2 )
ok = VRSet("GB_CURRENT", "Left", margin )
ok = VRSet("GB_CURRENT", "Width", lpane_width )
ok = VRSet("GB_CURRENT", "Height", pane_height )
ok = VRset("GB_CURRENT3", "Top", margin )
ok = VRset("GB_CURRENT3", "Left", margin )
ok = VRset("GB_CURRENT3", "Height", 245 )
ok = VRset("GB_CURRENT3", "Width", lpane_width - marginx2)
ok = VRset("DT_CURRENT", "Top", 8 )
ok = VRset("DT_CURRENT", "Left", 8 )
ok = VRset("DT_CURRENT", "Height", 213 )
ok = VRset("DT_CURRENT", "Width", (lpane_width - marginx2) - 24 )
ok = VRset("GB_CURRENT2", "Left", margin )
ok = VRset("GB_CURRENT2", "Top", 245 + marginx2 )
ok = VRset("GB_CURRENT2", "Width", lpane_width - marginx2)
ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
ok = VRset("CN_CURRENT", "Top", margin )
ok = VRset("CN_CURRENT", "Left", margin )
ok = VRset("CN_CURRENT", "Width", VRGet("GB_CURRENT2","Width") - marginx2)
ok = VRset("CN_CURRENT", "Height", VRGet("GB_CURRENT2","Height") - marginx2)
ok = VRset("PB_DETACH", "Left", margin )
ok = VRset("PB_DETACH", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_DETACH", "Width", min((lpane_width-margin*3) % 2, 1313))
ok = VRset("PB_UNMOUNT", "Left", VRGet("PB_DETACH","Width") + marginx2)
ok = VRset("PB_UNMOUNT", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_UNMOUNT", "Width", min((lpane_width-margin*3) % 2, 1313))
/* Splitbar - reduced in size to make it more noticable */
ok = VRset("SPLIT_Main", "Visible", 1 )
ok = VRset("SPLIT_Main", "Top", marginx2 + (pane_height-1200)%2 )
ok = VRset("SPLIT_Main", "Height", 1200 /* pane_height */ )
/* Statusbar */
ok = VRSet("GB_STATUSBAR", "Left", margin )
ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width )
ok = VRset("DT_STATUSBAR", "Top", 12 )
ok = VRset("DT_STATUSBAR", "Left", 12 )
ok = VRset("DT_STATUSBAR", "Height", VRGet("GB_STATUSBAR","Height") -24 )
ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
/* Modified for notebook pages */
pane_height = marginx2 + pane_height -1180
rpane_width = marginx2 + rpane_width -760
/* Use this as the width for the container pages, which don't have as strict a minimum width */
rcnr_width = rpane_width
/* Minimum size of right panel (based on SW_DIALOG which is the largest) */
if pane_height < 5360 then pane_height = 5360
if rpane_width < 6010 then rpane_width = 6010
/* Dialog page */
ok = VRSet("GB_DIALOG", "Top", margin /* marginx2 */ )
ok = VRSet("GB_DIALOG", "Left", margin /* marginx2 */ /* split_left + 60 */ )
ok = VRset("GB_DIALOG", "Height", pane_height )
ok = VRset("GB_DIALOG", "Width", rpane_width )
ok = VRset("PB_MOUNT", "Left", margin )
ok = VRset("PB_MOUNT", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_EDIT_CANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
ok = VRset("PB_EDIT_CANCEL", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_DIALOG_HELP", "Left", rpane_width - marginx2 - VRGet("PB_DIALOG_HELP","Width") + 24)
ok = VRset("PB_DIALOG_HELP", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("GB_SHARE", "Left", margin )
ok = VRset("GB_SHARE", "Top", marginx2 /* 245 + marginx2 */ )
ok = VRset("GB_SHARE", "Height", 2252 )
ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
ok = VRset("GB_AUTH", "Left", margin )
ok = VRset("GB_AUTH", "Top", margin * 3 + VRGet("GB_SHARE","Height") /* 245 + (margin * 3) + VRGet("GB_SHARE","Height") */ )
ok = VRset("GB_AUTH", "Width", rpane_width - marginx2 )
ok = VRset("GB_MPOINT","Left", margin )
ok = VRset("GB_MPOINT","Top", /* 245 + */ (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
ok = VRset("GB_MPOINT","Width", rpane_width - marginx2 )
/* Advanced page */
ok = VRSet("GB_ADVANCED", "Top", margin /* marginx2 */ )
ok = VRSet("GB_ADVANCED", "Left", margin /* marginx2 */ /* split_left + 60 */ )
ok = VRset("GB_ADVANCED", "Height", pane_height )
ok = VRset("GB_ADVANCED", "Width", rpane_width )
ok = VRset("GB_ADVANCED2", "Left", margin )
ok = VRset("GB_ADVANCED2", "Top", /* 245 + */ marginx2)
ok = VRset("GB_ADVANCED2", "Width", rpane_width - marginx2)
ok = VRset("GB_ADVANCED2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
ok = VRset("PB_ADVANCED_APPLY", "Left", margin )
ok = VRset("PB_ADVANCED_APPLY", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_ADVANCED_UNDO", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
ok = VRset("PB_ADVANCED_UNDO", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_ADVANCED_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
ok = VRset("PB_ADVANCED_HELP", "Top", pane_height - pbtn_height - marginx2)
/* SMBTree page */
ok = VRSet("GB_SMBTREE", "Top", margin /* x2 */ )
ok = VRSet("GB_SMBTREE", "Left", margin /* x2 */ /* split_left + 60 */ )
ok = VRset("GB_SMBTREE", "Height", pane_height )
ok = VRset("GB_SMBTREE", "Width", rcnr_width )
ok = VRset("GB_SMBTREE2","Left", margin )
ok = VRset("GB_SMBTREE2","Top", /* 45 + */ marginx2 )
ok = VRset("GB_SMBTREE2","Width", rcnr_width - marginx2)
ok = VRset("GB_SMBTREE2","Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
ok = VRset("CN_SMBTREE", "Top", margin )
ok = VRset("CN_SMBTREE", "Left", margin )
ok = VRset("CN_SMBTREE", "Width", VRGet("GB_SMBTREE2","Width") - marginx2)
ok = VRset("CN_SMBTREE", "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
ok = VRset("PB_SMBTREE_CONNECT", "Left", margin )
ok = VRset("PB_SMBTREE_CONNECT", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_SMBTREE_REFRESH", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
ok = VRset("PB_SMBTREE_REFRESH", "Top", pane_height - pbtn_height - marginx2)
hlpmin = VRGet("PB_SMBTREE_REFRESH", "Left") + VRGet("PB_SMBTREE_REFRESH","Width") + marginx2
hlppos = rcnr_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24
IF hlppos < hlpmin THEN hlppos = hlpmin
ok = VRset("PB_SMBTREE_HELP", "Left", hlppos )
ok = VRset("PB_SMBTREE_HELP", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
/* Connection details page */
ok = VRSet("GB_CONDET", "Top", margin /* x2 */ )
ok = VRSet("GB_CONDET", "Left", margin /* x2 */ /* split_left + 60 */ )
ok = VRset("GB_CONDET", "Height", pane_height )
ok = VRset("GB_CONDET", "Width", rcnr_width )
ok = VRset("GB_CONDET2", "Left", margin )
ok = VRset("GB_CONDET2", "Top", /* 245 + */ marginx2)
ok = VRset("GB_CONDET2", "Width", rcnr_width - marginx2)
ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
ok = VRset("CN_CONDET", "Top", margin )
ok = VRset("CN_CONDET", "Left", margin )
ok = VRset("CN_CONDET", "Width", VRGet("GB_CONDET2","Width") - marginx2)
ok = VRset("CN_CONDET", "Height", VRGet("GB_CONDET2","Height") - marginx2)
ok = VRset("PB_CONDET_SAVE", "Left", margin )
ok = VRset("PB_CONDET_SAVE", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
ok = VRset("PB_CONDET_LOAD", "Top", pane_height - pbtn_height - marginx2 )
hlpmin = VRGet("PB_CONDET_LOAD", "Left") + VRGet("PB_CONDET_LOAD","Width") + marginx2
hlppos = rcnr_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24
IF hlppos < hlpmin THEN hlppos = hlpmin
ok = VRset("PB_CONDET_HELP", "Left", hlppos )
ok = VRset("PB_CONDET_HELP", "Top", pane_height - pbtn_height - marginx2)
/* Global settings page */
ok = VRSet("GB_GLOBAL", "Top", margin /* x2 */ )
ok = VRSet("GB_GLOBAL", "Left", margin /* x2 */ /* split_left + 60 */ )
ok = VRset("GB_GLOBAL", "Height", pane_height )
ok = VRset("GB_GLOBAL", "Width", rpane_width )
ok = VRset("GB_GLOBAL2", "Left", margin )
ok = VRset("GB_GLOBAL2", "Top", marginx2 /* 245 + marginx2 */ )
ok = VRset("GB_GLOBAL2", "Width", rpane_width - marginx2 )
ok = VRset("GB_RESOLUTION", "Left", margin )
ok = VRset("GB_RESOLUTION", "Top", margin * 3 + VRGet("GB_GLOBAL2","Height") /* 245 + (margin * 3) + VRGet("GB_GLOBAL2","Height") */ )
ok = VRset("GB_RESOLUTION", "Width", rpane_width - marginx2 )
ok = VRset("GB_LOGGING","Left", margin )
ok = VRset("GB_LOGGING","Top", /* 245 + */ (margin * 4) + VRGet("GB_GLOBAL2","Height") + VRGet("GB_RESOLUTION","Height"))
ok = VRset("GB_LOGGING","Width", rpane_width - marginx2 )
ok = VRset("PB_SETTINGS_APPLY", "Left", margin )
ok = VRset("PB_SETTINGS_APPLY", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_SETTINGS_APPLY", "Height", pbtn_height)
ok = VRset("PB_SETTINGS_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
ok = VRset("PB_SETTINGS_UNDO", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_SETTINGS_UNDO", "Height", pbtn_height)
ok = VRset("PB_SETTINGS_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
ok = VRset("PB_SETTINGS_HELP", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_SETTINGS_HELP", "Height", pbtn_height)
/* SMB.CONF Settings page */
ok = VRSet("GB_SMBCONFX", "Top", margin /* x2 */ )
ok = VRSet("GB_SMBCONFX", "Left", margin /* x2 */ /* split_left + 60 */ )
ok = VRset("GB_SMBCONFX", "Height", pane_height )
ok = VRset("GB_SMBCONFX", "Width", rpane_width )
ok = VRset("GB_SMBCONF2", "Left", margin )
ok = VRset("GB_SMBCONF2", "Top", marginx2 )
ok = VRset("GB_SMBCONF2", "Width", rpane_width - marginx2 )
ok = VRset("GB_SMBCONF2", "Height", pane_height - (margin * 7) - pbtn_height /* - 245 */ )
ok = VRset("PB_SMBCONF_APPLY", "Left", margin )
ok = VRset("PB_SMBCONF_APPLY", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_SMBCONF_APPLY", "Height", pbtn_height)
ok = VRset("PB_SMBCONF_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
ok = VRset("PB_SMBCONF_UNDO", "Top", pane_height - pbtn_height - marginx2 )
ok = VRset("PB_SMBCONF_UNDO", "Height", pbtn_height)
ok = VRset("PB_SMBCONF_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
ok = VRset("PB_SMBCONF_HELP", "Top", pane_height - pbtn_height - marginx2)
ok = VRset("PB_SMBCONF_HELP", "Height", pbtn_height)
/* DOne with pages */
ok = VRset("Main","Painting", 1)
/* check and empty event queue, trash spurious resize events */
EventString = ''
TrashedResize = 0
do until EventString = 'nop'
EventString = VREvent('N')
if EventString <> 'nop' then do
if EventString = 'CALL Main_Resize' then TrashedResize = 1
else interpret eventString
end
end
if TrashedResize then CALL Main_Resize
if options.!debug == 1 then say time()' Main_Resize done'
return
/*:VRX Menu_Context_ChangeView_Click
*/
Menu_Context_ChangeView_Click:
ok = VRSet("Cn_Current","View","NameTree")
return
/*:VRX Menu_Context_Detach_All_Click
*/
Menu_Context_Detach_All_Click:
ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
do um = 1 to umrh.0
ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
call PB_DETACH_Click
end
drop um umrh.
return
/*:VRX Menu_Context_Detach_Click
*/
Menu_Context_Detach_Click:
call PB_DETACH_Click
return
/*:VRX Menu_Context_Edit_Click
*/
Menu_Context_Edit_Click:
if options.!debug == 1 then say time()' Menu_Context_Edit_Click started'
/* call VRMethod "TDL_1", 'PostEvent', 'PageSelected', 'Page', 1 */
ok = VRset("TDL_1", 'Selected', 1)
options.!editmode = 1
CALL VRSet "PB_EDIT_CANCEL","Visible", 1
CALL VRSet "PB_UNMOUNT","Enabled", 0
ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(33)" " )
/* CALL NLVSetText "DT_DIALOG","Caption",33 */
CALL VRSet "GB_CURRENT", "ENABLED", 0
ok = VRSet("CB_MOUNT","Value","")
ok = VRSet("CB_MOUNT","Selected",1)
ok = VRSet("CB_MOUNT","Value",mtype.1)
parse var p_string p_workgroup':\\'p_server'\'p_share
/* if options.!debug == 1 then say time()' '||p_workgroup */
if options.!debug == 1 then say time()' data '||data
if options.!debug == 1 then say time()' domain '||p_workgroup
if options.!debug == 1 then say time()' server '||p_server
if options.!debug == 1 then say time()' share '||p_share
if options.!debug == 1 then say time()' string '||p_string
CALL VRSet "EF_SHARE", "VALUE", p_share
CALL VRSet "EF_SERVER", "VALUE", p_server
CALL VRSet "EF_NETWORK","VALUE", p_workgroup
/* if options.!debug == 1 then say time()' '||p_node */
parse var p_node p_drive'\'p_directory'\'
CALL VRSet "CB_DRIVES", "Value", p_drive
CALL VRSet "EF_DIRECTORY", "Value", p_directory
if options.!debug == 1 then say time()' Menu_Context_Edit_Click done'
return
/*:VRX Menu_Context_Open_Click
*/
Menu_Context_Open_Click:
ok = VRSet("Menu_Context_Open_Default","Visible",0)
return
/*:VRX Menu_Context_Open_Default_Click
*/
Menu_Context_Open_Default_Click:
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click started"
if \VRIsValidObject(rh) then return
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click done"
return
/*:VRX Menu_Context_Open_Detail_Click
*/
Menu_Context_Open_Detail_Click:
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click started"
if \VRIsValidObject(rh) then return
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
return
/*:VRX Menu_Context_Open_Icon_Click
*/
Menu_Context_Open_Icon_Click:
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click started"
if \VRIsValidObject(rh) then return
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click done"
return
/*:VRX Menu_Context_Open_Settings_Click
*/
Menu_Context_Open_Settings_Click:
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click started"
if \VRIsValidObject(rh) then return
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click done"
return
/*:VRX Menu_Context_Open_Splitview_Click
*/
Menu_Context_Open_Splitview_Click:
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click started"
if \VRIsValidObject(rh) then return
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click done"
return
/*:VRX Menu_Context_Open_Tree_Click
*/
Menu_Context_Open_Tree_Click:
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click started"
if \VRIsValidObject(rh) then return
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click done"
return
/*:VRX Menu_Context_Refresh_Click
*/
Menu_Context_Refresh_Click:
CALL Refresh
return
/*:VRX Menu_Context_Unmount_Click
*/
Menu_Context_Unmount_Click:
call PB_UNMOUNT_Click
return
/*:VRX Menu_File_Autostart_Activate_Click
*/
Menu_File_Autostart_Activate_Click:
options.!autostart = 1
Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
if ExeName = "" then do
parse source . . script
ExeName = VRParseFilename(script,'DP')'\'options.!appname_short'.EXE'
end
StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
if StartupDir = "" then do
parse source . . script
StartUpDir = VRParseFilename(script,'DP')
end
ObjTitle = NLVGetMessage( 59 )
if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
CALL PB_CONDET_SAVE_Click
rc = CreateObject( 'WPProgram', ObjTitle,'',,
'EXENAME='||ExeName||';'||,
'PROGTYPE=PM;'||,
'TITLE='ObjTitle';'||,
'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
'STARTUPDIR='StartupDir';'||,
'NOPRINT=YES;'||,
'HIDEBUTTON=DEFAULT;'||,
'MINWIN=DEFAULT;'||,
'CCVIEW=DEFAULT;'||,
'DEFAULTVIEW=DEFAULT;'||,
'OBJECTID=<'options.!appname_short'_AUTOSTART>',,
'REPLACE' )
IF rc == 1 THEN do
Text = NLVGetMessage( 60 )
if Text = "" then Text = '[Created object in Autostart-Folder]'
CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
end
ELSE do
Text = NLVGetMessage( 61 )
if Text = "" then Text = '[Could not create object in Autostart-Folder]'
Title = NLVGetMessage( 5 )
if Title = "" then Title = '[Error]'
CALL VRMessage 'Main', Text, Title, 'E'
end
options.!autostart = 0
return
/*:VRX Menu_File_Autostart_Click
*/
Menu_File_Autostart_Click:
return
/*:VRX Menu_File_Autostart_Deactivate_Click
*/
Menu_File_Autostart_Deactivate_Click:
ok = SysDestroyObject("<"options.!appname_short"_AUTOSTART>")
IF ok == 1 THEN do
Text = NLVGetMessage( 79 )
if Text = "" then Text = '[Autostart object created successfully]'
CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
end
ELSE do
Text = NLVGetMessage( 78 )
if Text = "" then Text = '[Could find Autostart object]'
Title = NLVGetMessage( 5 )
if Title = "" then Title = '[Error]'
CALL VRMessage 'Main', Text, Title, 'E'
end
return
/*:VRX Menu_File_Click
*/
Menu_File_Click:
ok = VRSet("Menu_File_LMHosts_Reset", "Enabled", VRFileExists( samba.!lmhosts ))
ok = VRSet("Menu_File_ucCred_Reset", "Enabled", (VRGet("Pict_PWINMEM","PicturePath") = "#36"))
return
/*:VRX Menu_File_Close_Click
*/
Menu_File_Close_Click:
call Quit
return
/*:VRX Menu_File_Daemon_Start_Click
*/
Menu_File_Daemon_Start_Click:
if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click started'
if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
btns.0 = 2
btns.1 = NLVGetMessage( 6 )
btns.2 = NLVGetMessage( 7 )
confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
IF confirm == 1 THEN do
logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
ok1 = SysFileDelete(Logfiles||'\log.smbc')
ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
if ok1 <> 0 | ok2 <> 0 then do
ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
end
drop ok1 ok2
end
end
address cmd 'detach 'fs.!prefix'CTL.EXE'
ok = VRset("GB_CURRENT","Enabled", 1)
ok = VRset("TDL_1","Enabled", 1)
CALL REFRESH
ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click done'
return
/*:VRX Menu_File_Daemon_Stop_Click
*/
Menu_File_Daemon_Stop_Click:
if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click started'
ok = PRProcessList(proc)
do I = 1 to proc.0
CurProc = VRParseFileName(proc.i.name,'NE')
if CurProc = fs.!prefix"CTL.EXE" then do
call charout , ' 'CurProc' RC='
ok = PRKillProcess(1,proc.i.pid)
say ok
end
end
ok = VRset("GB_CURRENT","Enabled", 0)
ok = VRset("TDL_1","Enabled", 0)
ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click stopped'
return
/*:VRX Menu_File_LMHosts_Reset_Click
*/
Menu_File_LMHosts_Reset_Click:
call _LMHostsReset
return
/*:VRX Menu_File_Load_Click
*/
Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
IF options.!autoload == 1 then filename = Profile
else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
IF filename == '' THEN RETURN
IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
RETURN
END
CALL LINEIN filename, 1, 0
DO WHILE LINES( filename )
/* Fix Ticket #202 in order to allow blanks in sharenames */
resline = LINEIN( filename )
nodelen = pos('\\',resline)-2
node = left(resline,nodelen)
rwFlag = word(resline,words(resline))
resource = substr(resline,nodelen+2,length(resline)-(nodelen+2)-(length(rwFlag)+1)+1)
drop resline
drop nodelen
vfs.!drive = FILESPEC('DRIVE', node )
vfs.!mountpoint = STRIP( node, 'T', '\')
/* In case we only have a volume we reattach the backslash, otherwise restore will fail */
if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
call ParseResParmString
options.!workgroup = p_workgroup
options.!server = p_server
options.!share = p_share
options.!user = p_user
options.!password = p_password
options.!spassword = p_spassword
options.!master = p_master
options.!mastertype = p_mtype
/* options.!memlen = p_memlen
options.!logfile = p_logfile
options.!loglevel = p_loglevel */
options.!cachetimeout = p_cachetimeout
options.!cachelistings = p_cachelistings
options.!easupport = p_easupport
IF rwFlag == 'R' THEN
options.!readonly = 1
ELSE
options.!readonly = 0
CALL Mount
END
CALL STREAM filename, 'C', 'CLOSE'
options.!autoload = 0
CALL Refresh
RETURN
/*:VRX Menu_File_Save_Click
*/
Menu_File_Save_Click:
call PB_CONDET_SAVE_Click
return
/*:VRX Menu_File_ucCred_Reset_Click
*/
Menu_File_ucCred_Reset_Click:
if _ucChkUc() then ok = _ucDelUc()
ok = VRSet("Pict_PWINMEM","PicturePath","#37")
ok = VRSet("EF_USER", "Value","")
ok = VRSet("EF_PASSWORD","Value","")
call _UserCredUpdate
return
/*:VRX Menu_Help_About_Click
*/
Menu_Help_About_Click:
ok = VRLoadSecondary("SW_ABOUT", "W")
return
/*:VRX Menu_Help_Extended_Click
*/
Menu_Help_Extended_Click:
ok = VRMethod( "Main", "InvokeHelp" )
return
/*:VRX Menu_Selected_ACLS_Click
*/
Menu_Selected_ACLS_Click:
if options.!debug == 1 then say ' List ACLS for "'SMBObj.udatatype'"'
window = VRLoadSecondary( "SW_ACLS", "W" )
return
/*:VRX Menu_Selected_Connect_Click
*/
Menu_Selected_Connect_Click:
call PB_SMBTREE_CONNECT_Click
return
/*:VRX Menu_Selected_Default_Workgroup_Click
*/
Menu_Selected_Default_Workgroup_Click:
if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click started"
if options.!debug == 1 then say ' SMBObj.rh = "'SMBObj.rh'"'
Success = 0
if SMBObj.rh <> "" then do
if options.!debug == 1 then say ' SMBObj.udatatype = "'SMBObj.udatatype'"'
Success = 1
select
when SMBObj.udatatype = "WORKGROUP" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
when SMBObj.udatatype = "DISK" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
when SMBObj.udatatype = "PRINTER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
when SMBObj.udatatype = "SERVER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
otherwise Success = 0
end
/* FIXME: switch over to REXXIni calls */
if Success = 1 then ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
end
Buttons.1 = NLVGetMessage(2)
Buttons.0 = 1
if Success = 0 then do
id = VRMessage( VRWindow(), NLVGetMessage(5), NLVGetMessage(75), "Error", "Buttons.", 1, 1 )
end
else do
id = VRMessage( VRWindow(), NLVGetMessage(117, workgroupname), NLVGetMessage(75), "Information", "Buttons.", 1, 1 )
end
if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click done"
return
/*:VRX Menu_Selected_DetailsView_Click
*/
Menu_Selected_DetailsView_Click:
ok = VRSet("CN_smbtree", "View", "Detail")
return
/*:VRX Menu_Selected_Info_Click
*/
Menu_Selected_Info_Click:
if options.!debug == 1 then say time()' Menu_Selected_Info_Click started'
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
if SelRH.0 = 0 then do
if options.!debug == 1 then say time()' Menu_Selected_Info_Click aborted'
return
end
call _GetSMBObjectProperties SelRH.1
window = VRLoadSecondary( "SW_INFO", "W" )
if options.!debug == 1 then say time()' Menu_Selected_Info_Click done'
return
/*:VRX Menu_Selected_Refresh_Click
*/
Menu_Selected_Refresh_Click:
ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
call _DelSMBObjectShares SMBObj.rh
machine = SMBObj.resname
ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
call _RefreshShares
return
/*:VRX Menu_Selected_Remove_Click
*/
Menu_Selected_Remove_Click:
ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
if selrec.0 = 0 then return
do I = 1 to selrec.0
if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
end
else do
mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
if mpidx = 1 then do
btns.0 = 2
btns.1 = NLVGetMessage( 6 )
btns.2 = NLVGetMessage( 7 )
confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
IF confirm \= 1 THEN RETURN
CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
CALL Refresh
end
else do
CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
end
end
end
return
/*:VRX Menu_Selected_Retry_Click
*/
Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba. mtype.
ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
if srcrec.0 = 0 then return
srcrec = srcrec.1
p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, cd.workgrpFH )
p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
ShareLevel = 1
if p_share = "" then ShareLevel = 2
if p_server = "" then ShareLevel = 3
if p_workgroup = "" then ShareLevel = 4
ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
call _UpdateObject "EF_SERVER", p_server
ok = VRset("EF_SHARE" , "Value", p_share)
ok = VRset("EF_NETWORK", "Value", p_workgroup)
ok = VRset("EF_USER" , "Value", p_user)
ok = VRset("EF_PASSWORD", "Value", p_password)
parse var p_mpoint p_drv '\' p_dir
p_dir = strip(p_dir,'T','\')
ok = VRset("CB_DRIVES" , "Value", p_drv)
ok = VRset("EF_DIRECTORY" , "Value", p_dir)
CALL PB_MOUNT_Click
/* if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
end */
return
/*:VRX Menu_Selected_TimeSync_Click
*/
Menu_Selected_TimeSync_Click:
if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click started'
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
if SelRH.0 = 0 then do
if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click aborted'
return
end
call _GetSMBObjectProperties SelRH.1
options.!timesrv = SMBObj.resname
call _TimeSync
if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click done'
return
/*:VRX Menu_Selected_TreeView_Click
*/
Menu_Selected_TreeView_Click:
ok = VRSet("CN_smbtree", "View", "IconTree")
return
/*:VRX Mount
*/
Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
if options.!debug == 1 then say time()' Mount procedure started'
/* Set mouse pointer to wait - this operation might take a few seconds */
call VRSet VRWindow(), 'Pointer', 'Wait'
/* Disabled, because we merge profile now - in earlier revisions
we replaced it but only for preexisting drives - this made only
sense as long as we were unable to detect double connections -
this could be made an option!
IF options.!autoload then do
CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
if options.!debug == 1 then say time()' '||'Autoload Detach "'vfs.!drive'" =' ok
end */
/* Attach the virtual drive - only if drive is not already attached */
NewlyAttached = 0
if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
NewlyAttached = 1 /* fixes AN Ticket 1654 */
if options.!debug == 1 then say time()' '||'Attach "'vfs.!drive'" =' ok
end
/* Create the mount point and store whether it was created or already existed */
CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
if options.!debug == 1 then say time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
/* encrypt password if necessary - fix for AN Ticket #1594 */
if options.!password <> '' & options.!spassword = '' then do
options.!spassword = c2x(options.!password)
options.!password = ''
end
/* Build the resource parameter string */
src = ''
IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
IF options.!server \= '' THEN src = src';SERVER='options.!server
IF options.!share \= '' THEN src = src';SHARE='options.!share
IF options.!user \= '' THEN src = src';USER='options.!user
/* fix for AN Ticket #1594 */
/* IF options.!password \= '' THEN src = src';PASSWORD='options.!password */
IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
IF options.!master \= '' THEN src = src';MASTER='options.!master
IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
parse var vfs.!mountpoint mpoint ';' .
mpoint = strip(mpoint,'T','\')||'\'
if options.!master = "" then options.!master = "WORKGROUP"
if options.!mtype = "" then options.!mtype = "1"
if options.!loglevel = "" then options.!loglevel = "0"
if options.!memlen = "" then options.!memlen = "2"
if options.!cachetimeout = "" then options.!cachetimeout = "10"
if options.!cachelistings = "" then options.!cachelistings = "32"
if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
md5 = rexx_md5(hashstr)
CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
DO i = 1 TO records.0
hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
if options.!debug == 1 then say mpoint'->'md5
if hash = md5 then do
If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
say "Double connection detected!!"
if options.!spassword <> "" then upw = ":********"
else upw = ""
buttons.0 = 2
buttons.1 = NLVGetMessage(9)
buttons.2 = NLVGetMessage(3)
Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
if Answer = 2 then do
call VRSet VRWindow(), 'Pointer', ''
say "Double connection - do not mount!!"
return
end
end
else do /* Same hash, status passive - we have to remove it */
ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
end
end
end
cd.lastrh = ""
ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
/* Now mount the resource */
CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
if ok <> 0 then do
if options.!password <> "" then upw = ":********"
else upw = ""
buttons.0 = 2
buttons.1 = NLVGetMessage(2)
buttons.2 = NLVGetMessage(37)
Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
if Answer = 2 then do /* Show explanation */
xx = VRMessage('Main', NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint )||'0D0A'x||'0D0A'x||SysGetMessage(ok)||'0D0A'x||'0D0A'x||SysGetMessage(ok, 'OSO001H.MSG'), NLVGetMessage(37), 'W')
end
if cd.lastrh <> '' then do
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
end
/* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
say "CreateMP="createMP
say "advanced.!alwaysmp="advanced.!alwaysmp
if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
if NewlyAttached = 1 then do /* Also detach drive - fixes AN Ticket 1654 */
CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
if options.!debug == 1 then say time()' '||'Also try to detach "'vfs.!drive'" ok = 'ok
end
end
end
else do
if options.!storecreds = 1 then do
ok = VRSet("EF_User", "Value",options.!user)
ok = VRSet("EF_Password","Value",x2c(options.!spassword))
end
end
drop CreateMP /* not required anymore */
drop NewlyAttached /* not required anymore */
/* Obsolete - the IOCtl will not be implemented this way in the plugin
The REXX function is present, but is has no counterpart in the plugin
ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
*/
/* Set mouse pointer to default again */
call VRSet VRWindow(), 'Pointer', ''
if options.!debug == 1 then say time()' Mount procedure done'
RETURN ok
/*:VRX MyFreeDriveMap
*/
MyFreeDriveMap: procedure expose options. icons. fs. samba.
if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
alldrives = "C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:"
/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
useddrives= SysDriveMap("C:","USED")
/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
Alldr = words(alldrives)
FreeDriveMap = ""
do I = 1 to AllDr
if word(alldrives,1) = word(useddrives,1) then do
Useddrives = subword(useddrives,2)
Alldrives = subword(Alldrives,2)
end
else do
FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
Alldrives = subword(Alldrives,2)
end
end
if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
return FreeDriveMap
/*:VRX NoEVFSCALL
*/
NoEVFSCALL:
CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
signal Halt
RETURN
/*:VRX ParseResourceData
*/
ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
PARSE ARG userdata, resource
if options.!debug == 1 then say time()' ParseResourceData started'
if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
select /* Support for other filesystems comes here! */
when left(word(resource,1),5) = "SMBFS" then do
cd.lastrh = VRMethod("CN_CONDET","AddRecord")
PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
p_mpoint = strip(p_mpoint,'T','\')||'\'
p_rw = word(resource, words(resource))
/* Workaround for truncated resource string */
if length(p_rw) > 1 then do
/* The resource string must have been truncated
p_rw is already wrong and
p_easupport will most likely be also wrong (look below for workaround!) */
p_rw ="W" /* this is guessed only!!! */
if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
end
/* this should be done unconditionally if the resource string is never truncated */
else resource = left(resource,length(resource)-length(p_rw))
call ParseResParmString
if p_master = "" then p_master = "WORKGROUP"
if p_mtype = "" then p_mtype = "1"
if p_loglevel = "" then p_loglevel = "0"
if p_memlen = "" then p_memlen = "2"
/* Also works around for a truncated resource string! */
if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
if p_password <> "" & p_spassword = "" then do
p_spassword = c2x(p_password)
p_password = ""
end
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint, cd.mpidxfh, p_mpidx, cd.workgrpFH , p_workgroup, cd.serverfh, p_server, cd.sharefh, p_share, cd.userfh, p_user)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen, cd.easupportfh, p_easupport, cd.logfilefh, p_logfile, cd.loglevelfh, p_loglevel, cd.rwfh, p_rw)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
md5 = rexx_md5(hashstr)
ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
SELECT
WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
IF p_workgroup == '' THEN
userdata = userdata';\\'p_server'\*'
ELSE
userdata = userdata';'p_workgroup':\\'p_server'\*'
END
WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
userdata = userdata';'p_workgroup':\\*'
WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
userdata = userdata';*:\\*'
OTHERWISE DO
IF p_workgroup == '' THEN
userdata = userdata';\\'p_server'\'p_share
ELSE
userdata = userdata';'p_workgroup':\\'p_server'\'p_share
END
END
end
when left(word(resource,1),3) = "DAV" then do
userdata = "webDAV"
end
otherwise do /* All unsupported filesystems end here! */
userData = "UNKNOWN"
end
end
if left(word(resource,1),5) <> "SMBFS" then do
end
else do
end
if options.!debug == 1 then say ' returning "'userdata'"'
if options.!debug == 1 then say time()' ParseResourceData done'
RETURN userdata
/*:VRX ParseResParmString
*/
ParseResParmString:
PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
PARSE VAR resource . ';SERVER=' p_server ';' .
PARSE VAR resource . ';SHARE=' p_share ';' .
PARSE VAR resource . ';USER=' p_user ';' .
PARSE VAR resource . ';PASSWORD=' p_password ';' .
PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
PARSE VAR resource . ';MASTER=' p_master ';' .
PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
PARSE VAR resource . ';CLD=' p_cachelistings ';' .
PARSE VAR resource . ';EASUPPORT=' p_easupport ';' .
PARSE VAR resource . ';KRB5SUPPORT=' p_krb5support ';' .
PARSE VAR resource . ';NTLMV1SUPPORT=' p_ntlmv1support ';' .
PARSE VAR resource . ';ENCRYPTIONSUPPORT=' p_encryptionsupport ' '
return
/*:VRX PB_ABOUT_CLOSE_Click
*/
PB_ABOUT_CLOSE_Click:
CALL SW_ABOUT_Close
return
/*:VRX PB_ABOUT_COPY_Click
*/
PB_ABOUT_COPY_Click:
if VRGet("CB_TRAC","set") then DO
remainstr = AboutStr
AboutStr = ''
DO WHILE remainstr <> ''
PARSE VAR remainstr _part '0d0a'x remainstr
AboutStr = AboutStr || _part ||'[[BR]]'||'0d0a'x
END
END
ok = VRMethod( "Application", "PutClipboard", AboutStr )
if options.!debug == 1 then call beep 880*2,10
CALL SW_ABOUT_Close
return
/*:VRX PB_ACLS_OK_Click
*/
PB_ACLS_OK_Click:
call SW_ACLS_Close
return
/*:VRX PB_ADVANCED_APPLY_Click
*/
PB_ADVANCED_APPLY_Click:
advanced.!easupport = VRGet( "CB_EAS", "Set" )
advanced.!readonly = VRGet( "CB_READONLY", "Set" )
advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
advanced.!kerberos5 = VRGet( "CB_KERBEROS5", "Set" )
advanced.!ntlmv1 = VRGet( "CB_NTLMV1", "Set" )
advanced.!encryption = VRGet( "CB_ENCRYPTION", "Set" )
/* Obsolete */
advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
return
/*:VRX PB_ADVANCED_HELP_Click
*/
PB_ADVANCED_HELP_Click:
CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
return
/*:VRX PB_ADVANCED_UNDO_Click
*/
PB_ADVANCED_UNDO_Click:
CALL SW_ADVANCED_Init_Content
RETURN
/*:VRX PB_ClearCred_Click
*/
PB_ClearCred_Click:
call Menu_File_ucCred_Reset_Click
return
/*:VRX PB_CONDET_HELP_Click
*/
PB_CONDET_HELP_Click:
CALL VRMethod 'GB_CONDET', 'InvokeHelp'
return
/*:VRX PB_CONDET_LOAD_Click
*/
PB_CONDET_LOAD_Click:
if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
call Menu_File_Load_Click
if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
RETURN
/*:VRX PB_CONDET_SAVE_Click
*/
PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
ELSE filename = Profile
IF filename == '' THEN RETURN
IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
btns.0 = 2
btns.1 = NLVGetMessage( 6 )
if btns.1 = "" then btns.1 = '[Yes]'
btns.2 = NLVGetMessage( 7 )
if btns.2 = "" then btns.2 = '[No]'
Title = NLVGetMessage( 53 )
if Title = "" then Title = "[File exists]"
Text = NLVGetMessage( 54, filename )
if Text = "" then Text = "[File "filename" exists? Overwrite?]"
confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
IF confirm \= 1 THEN RETURN
CALL VRChAttr filename,, 'HSR'
CALL VRDeleteFile filename
END
CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
DO i = 1 TO records.0
resource = ""
resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
resource = resource||';KRB5SUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.kerberos5FH)
resource = resource||';NTLMV1SUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ntlmv1FH)
resource = resource||';ENCRYPTIONSUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.encryptionFH)
resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
call lineout filename, resource
END
CALL STREAM filename, 'C', 'CLOSE'
if options.!autostart == 0 THEN do
Title = NLVGetMessage( 51 )
if Title = "" then Title = "[Profile saved]"
Text = NLVGetMessage( 52, filename )
if Text = "" then Text = "[Profile saved to "filename"!]"
CALL VRMessage 'Main', Text , Title, 'I'
end
if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
RETURN
/*:VRX PB_DETACH_Click
*/
PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
IF select.0 < 1 THEN RETURN
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
drive = STRIP( mountpoint, 'T', '\')
btns.0 = 2
btns.1 = NLVGetMessage( 6 )
btns.2 = NLVGetMessage( 7 )
confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
IF confirm \= 1 THEN RETURN
/* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
/* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
/* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
if datatype(mounts) = 'NUM' then do
/* Unmount any resources */
DO i = 1 TO mounts
CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
END
end
else if options.!debug == 1 then say ' '||"mounts = "mounts
CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
CALL Refresh
if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
RETURN
/*:VRX PB_DIALOG_HELP_Click
*/
PB_DIALOG_HELP_Click:
CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
return
/*:VRX PB_EDIT_CANCEL_Click
*/
PB_EDIT_CANCEL_Click:
options.!editmode = 0
CALL VRSet "PB_UNMOUNT","Enabled", 1
CALL VRSet "GB_CURRENT", "ENABLED", 1
ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
RETURN 0
/*:VRX PB_INFO_OK_Click
*/
PB_INFO_OK_Click:
call SW_INFO_Close
RETURN
/*:VRX PB_LOGIN_CANCEL_Click
*/
PB_LOGIN_CANCEL_Click:
credentials.!entered = 0
call SW_LOGIN_Close
RETURN
/*:VRX PB_LOGIN_OK_Click
*/
PB_LOGIN_OK_Click:
ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
options.!storecreds = VRGet("CB_STORECREDS1","Set")
credentials.!entered = 1
if p_server <> "" then do
ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
if word(ok,1) = "1" then do
call _StatusBarWrapper NLVGetMessage(107, rpc.queryuser.FULL_NAME)
say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
end
else do
CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
end
end
call SW_LOGIN_Close
RETURN
/*:VRX PB_MOUNT_Click
*/
PB_MOUNT_Click:
if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
say " network = "network
if options.!editmode = 1 then do
CALL PB_UNMOUNT_Click
options.!editmode = 0
ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
CALL VRSet "PB_UNMOUNT","Enabled", 1
CALL VRSet "GB_CURRENT", "ENABLED", 1
end
options.!workgroup = ''
options.!server = ''
options.!share = ''
options.!user = ''
options.!password = ''
options.!master = ''
options.!mastertype = ''
options.!memlen = advanced.!memlen
options.!easupport = advanced.!easupport
options.!readonly = advanced.!readonly
options.!loglevel = advanced.!loglevel
options.!logfile = advanced.!logfile
options.!cachetimeout = advanced.!cachetimeout
options.!cachelistings = advanced.!cachelistings
options.!kerberos5 = advanced.!kerberos5
options.!ntlmv1 = advanced.!ntlmv1
options.!encryption = advanced.!encryption
vfs.!drive = ''
vfs.!mountpoint = ''
stype = VRGet( "CB_MOUNT", "Selected" )
share = STRIP( VRGet( "EF_SHARE", "Value" ))
server = STRIP( VRGet( "EF_SERVER", "Value" ))
network = STRIP( VRGet( "EF_NETWORK", "Value" ))
mtype = VRGet( "CHK_MTYPE", "Set" )
userid = STRIP( VRGet( "EF_USER", "Value" ))
password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
mdrive = VRGet( "CB_DRIVES", "SelectedText" )
if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
IF ( stype < 1 | stype > 4 ) THEN stype = 1
/* The required/optional/ignored parameters depend on the type of mount
* requested. (Note, however, that the user, password, easupport and
* memlen parameters are always optional.)
*/
SELECT
/* Scenario 1: Mount a single share.
* Required: share, server
* Optional: workgroup
* Unused: master, mastertype
*/
WHEN stype = 1 THEN DO
IF server == '' | share == '' THEN DO
/* error */
RETURN 1
END
options.!server = server
options.!share = share
options.!workgroup = network
END
/* Scenario 2: Mount all shares on a server.
* Required: server
* Optional: workgroup
* Unused: share, master, mastertype
*/
WHEN stype = 2 THEN DO
IF server == '' THEN DO
/* error */
RETURN 1
END
options.!server = server
options.!workgroup = network
END
/* Scenario 3: Mount all servers in a workgroup.
* Required: workgroup
* Optional: -
* Unused: share, server, master, mastertype
*/
WHEN stype = 3 THEN DO
IF workgroup == '' THEN DO
/* error */
RETURN 1
END
options.!workgroup = network
END
/* Scenario 4: Mount all workgroups known to a master.
* Required: master, mastertype
* Optional: -
* Unused: share, server, workgroup
*/
WHEN stype = 4 THEN DO
IF master == '' | mastertype == '' THEN DO
/* error */
RETURN 1
END
options.!master = network
options.!mastertype = mtype
END
END
options.!user = userid
options.!password = password
/* fix for AN Ticket #1653 */
options.!spassword = c2x(options.!password)
vfs.!drive = mdrive
vfs.!mountpoint = mdrive'\'mpath
CALL Mount
CALL Refresh
ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
RETURN 0
/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
*/
PB_NEWMOUNTPOINTCANCEL_Click:
ok = VRSet("CB_DRIVES","Value","")
ok = VRSet("EF_DIRECTORY","Value","")
call SW_MOUNTPOINT_Close
RETURN 0
/*:VRX PB_NEWMOUNTPOINTOK_Click
*/
PB_NEWMOUNTPOINTOK_Click:
ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
advanced.!readonly = VRGet("CB_READONLY1","Set")
advanced.!easupport = VRGet("CB_EAS1","Set")
advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
advanced.!kerberos5 = VRGet("CB_KERBEROS51","Set")
advanced.!ntlmv1 = VRGet("CB_NTLMV11","Set")
advanced.!encryption = VRGet("CB_ENCRYPTION1","Set")
call SW_MOUNTPOINT_Close
RETURN
/*:VRX PB_NEWPORTCANCEL_Click
*/
PB_NEWPORTCANCEL_Click:
/* ok = VRSet("CB_DRIVES","Value","")
ok = VRSet("EF_DIRECTORY","Value","")
call SW_MOUNTPOINT_Close */
RETURN 0
/*:VRX PB_NEWPORTCONNECT_Click
*/
PB_NEWPORTCONNECT_Click:
/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
advanced.!readonly = VRGet("CB_READONLY1","Set")
advanced.!easupport = VRGet("CB_EAS1","Set")
advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
call SW_MOUNTPOINT_Close */
RETURN
/*:VRX PB_PROGRESS_ABORT_Click
*/
PB_PROGRESS_ABORT_Click:
options.!delay = 0
options.!autoload = 0
options.!autoclose = 0
call SW_PROGRESS_Close
return
/*:VRX PB_SETTINGS_APPLY_Click
*/
PB_SETTINGS_APPLY_Click:
if options.!debug == 1 then say time()' PB_SETTINGS_APPLY_Click() started'
advanced.!loglevel = VRGet("SPIN_LOG_LEVEL", "Value" )
advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
advanced.!special = VRGet("CB_SPECIAL", "Set" )
advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
/* Note: CB_LOGGING has its own event tied to the click */
options.!storecreds = VRGet("CB_STORECREDS", "Set" )
options.!debug = VRGet("CB_DEBUG", "Set" )
if options.!debug == 1 then do /* Turn on additional columns in connection details view */
ok = VRRedirectStdio("ON")
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
end
else do /* Turn on additional columns in connection details view */
ok = VRRedirectStdio("OFF")
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
end
ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
if advanced.!lmhosts = 1 then do
call _LMHostsRead
call _LMHostsUpdate
end
if advanced.!smbconfchanged = 1 then do
name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
handle = IniOpen('global', samba.!smbconf)
call IniSet 'name resolve order', name_resolve_order, handle
/* FIXME: Throw an error in this case */
if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
call IniSet 'log level', VRGet("SPIN_LOG_LEVEL","Value"), handle
call IniSave handle
call IniClose handle
advanced.!smbconfchanged = 0
ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
end
if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
if options.!debug == 1 then say time()' PB_SETTINGS_APPLY_Click() done'
return
/*:VRX PB_SETTINGS_HELP_Click
*/
PB_SETTINGS_HELP_Click:
CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
return
/*:VRX PB_SETTINGS_UNDO_Click
*/
PB_SETTINGS_UNDO_Click:
call SW_SETTINGS_Init_Content
return
/*:VRX PB_SMBCONF_APPLY_Click
*/
PB_SMBCONF_APPLY_Click:
if advanced.!smbconfchanged = 1 then do
client_NTLMv2_auth = VRGet("CB_client_NTLMv2_auth","Set")
client_lanman_auth = VRGet("CB_client_lanman_auth","Set")
client_plaintext_auth = VRGet("CB_client_plaintext_auth","Set")
client_use_spnego = VRGet("CB_client_use_spnego","Set")
client_use_spnego_principal = VRGet("CB_client_use_spnego_principal","Set")
client_signing = VRGet("SPIN_client_signing","Value")
client_ipc_signing = VRGet("SPIN_client_ipc_signing","Value")
if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
client_max_protocol = VRGet("SPIN_client_max_protocol","Value")
client_min_protocol = VRGet("SPIN_client_min_protocol","Value")
end
handle = IniOpen('global', samba.!smbconf)
call IniSet 'client NTLMv2 auth', YesNo(client_NTLMv2_auth), handle
call IniSet 'client lanman auth', YesNo(client_lanman_auth), handle
call IniSet 'client plaintext auth', YesNo(client_plaintext_auth), handle
call IniSet 'client use spnego', YesNo(client_use_spnego), handle
call IniSet 'client use spnego principal', YesNo(client_use_spnego_principal), handle
call IniSet 'client signing', client_signing, handle
call IniSet 'client ipc signing', client_ipc_signing, handle
if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
call IniSet 'client max protocol', client_max_protocol, handle
call IniSet 'client min protocol', client_min_protocol, handle
end
call IniSave handle
call IniClose handle
advanced.!smbconfchanged = 0
ok = VRSet("PB_SMBCONF_UNDO","Enabled", 0)
end
return
/*:VRX PB_SMBCONF_HELP_Click
*/
PB_SMBCONF_HELP_Click:
CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
return
/*:VRX PB_SMBCONF_UNDO_Click
*/
PB_SMBCONF_UNDO_Click:
call SW_SETTINGS_Init_Content
return
/*:VRX PB_SMBTREE_CONNECT_Click
*/
PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
if SelRH.0 = 0 then do
if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
return
end
p_workgroup = ''
p_server = ''
p_share = ''
srcFile = ""
srcCtn = VRGet("CN_SMBTREE","Self")
srcRec = SelRH.1
trgCtn = VRGet("CN_CURRENT","Self")
trgRec = ""
if options.!debug == 1 then do
say ' srcCtn = "'srcCtn'"'
if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
say ' srcRec = "'srcRec'"'
say ' trgCtn = "'trgCtn'"'
if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
say ' trgRec = "'trgRec'"'
end
ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
if ParentRH = "" then do /* A workgroup was dragged */
say "Workgroup dragged!"
parse var DragCapt p_workgroup '0D0A'x .
p_workgroup = strip(p_workgroup)
ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
call _UpdateObject "EF_SERVER", ""
ok = VRSet("EF_SHARE","Value","")
ShareLevel = 3
end
else do
ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
if GParentRH = "" then do /* A server was dragged */
say "Server dragged!"
parse var ParDragCapt p_workgroup '0D0A'x .
ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
p_workgroup = strip(p_workgroup)
parse var DragCapt p_server '0D0A'x .
p_server = strip(p_server)
call _UpdateObject "EF_SERVER", p_server
ok = VRSet("EF_Share","Value","")
ShareLevel = 2
end
else do /* A share was dragged */
say "Share dragged!"
GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
parse var GParDragCapt p_workgroup '0D0A'x .
p_workgroup = strip(p_workgroup)
ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
parse var ParDragCapt p_server '0D0A'x .
p_server = strip(p_server)
call _UpdateObject "EF_SERVER", p_server
parse var DragCapt p_share '0D0A'x .
p_share = strip(p_share)
ok = VRSet("EF_Share","Value",strip(p_share))
ShareLevel = 1
end
end
say 'p_workgroup = "'p_workgroup'"'
say 'p_server = "'p_server'"'
say 'p_share = "'p_share'"'
ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
call CB_MOUNT_Change
if trgRec = "" then do
window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
if VRGet("CB_DRIVES","Value") = "" then return
end
else do
TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
do while parTrgRH <> ""
partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
TargetString = partrgCapt||'\'||TargetString
parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
end
say 'TargetString = "'TargetString'"'
ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
end
window = VRLoadSecondary( "SW_LOGIN", "W" )
if credentials.!entered = 1 then call PB_MOUNT_CLICK
if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
RETURN
/*:VRX PB_SMBTREE_HELP_Click
*/
PB_SMBTREE_HELP_Click:
CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
return
/*:VRX PB_SMBTREE_REFRESH_Click
*/
PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
window = VRLoadSecondary( "SW_LOGIN", "W" )
end
call _UserCredUpdate
ok = VRset("Pict_Throbber", "Visible", 1)
ok = VRset("Menu_Selected_Connect", "Visible", 0)
ok = VRset("TM_Throbber", "Enabled", 1)
ShowHidden = advanced.!special
BroadCast = advanced.!broadcast
ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
ok = time('R')
call _RefreshTree
if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
RETURN
/*:VRX PB_UNMOUNT_Click
*/
PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
IF select.0 < 1 THEN RETURN
userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
PARSE VAR userdata mountpoint ';' mounts ';' .
say 'userdata="'userdata'"'
IF mounts > 0 & options.!editmode = 0 THEN DO
btns.0 = 2
btns.1 = NLVGetMessage( 6 )
btns.2 = NLVGetMessage( 7 )
confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
IF confirm \= 1 THEN RETURN
END
/* Unmount any resources */
DO i = 1 TO mounts
CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
END
/* Delete mountpoint */
parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
IF parent \= '' THEN DO
CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
END
CALL Refresh
if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
RETURN 0
/*:VRX Pict_PWINMEM_Click
*/
Pict_PWINMEM_Click:
if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
call Menu_File_ucCred_Reset_Click
end
return
/*:VRX Quit
*/
Quit:
if Fatal <> 1 then CALL _INISave
/* ok = VRREdirectSTdio("OFF") */
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
RETURN
/*:VRX RB_ACLS_NUMERIC_Click
*/
RB_ACLS_NUMERIC_Click:
aclsnumeric = '--numeric'
ok = VRSet("DT_REV_CONT","Caption","")
ok = VRMethod("CN_ACLS","RemoveRecord","ALL")
ok = VRMethod("CN_ACLS","SetFieldAttr", ACL.userFH, "Visible", 0 )
call _ACLSBrowse
return
/*:VRX RB_ACLS_TEXT_Click
*/
RB_ACLS_TEXT_Click:
aclsnumeric = ''
ok = VRSet("DT_REV_CONT","Caption","")
ok = VRMethod("CN_ACLS","RemoveRecord","ALL")
ok = VRMethod("CN_ACLS","SetFieldAttr", ACL.userFH, "Visible", 1 )
call _ACLSBrowse
return
/*:VRX Refresh
*/
Refresh:
if options.!debug == 1 then say time()' Refresh started'
CALL VRSet "CN_CURRENT", 'Painting', 0
CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
/* Remove Active connections from details view */
ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
do I = 1 to rh.0
/* This catches the bug we observed exactly once and were unable to reproduce! */
if cd.statusfh = 'CD.STATUSFH' then do
if options.!debug == 1 then call beep 880, 50
if options.!debug == 1 then call beep 880, 50
if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
leave
end
if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
end
/* call _AddTemplates */
CALL VRSet "PB_DETACH", "Enabled", 0
CALL VRSet "PB_UNMOUNT", "Enabled", 0
ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
if options.!debug == 1 then say ' Remove records, disable buttons done.'
CALL VRMethod 'CB_DRIVES', 'Clear'
CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
/* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
drvs = MyFreeDriveMap('C:', 'FREE')
DO i = 1 TO WORDS( drvs )
drvstem.i = WORD( drvs, i )
END
drvstem.0 = WORDS( drvs )
/* Add any existing EVFS drives */
CALL GetMountPoints
CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
CALL VRSet "CN_CURRENT", 'Painting', 1
if options.!debug == 1 then say time()' '||"Refresh done"
RETURN 0
/*:VRX SPIN_client_ipc_signing_Change
*/
SPIN_client_ipc_signing_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_client_max_protocol_Change
*/
SPIN_client_max_protocol_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_client_min_protocol_Change
*/
SPIN_client_min_protocol_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_client_signing_Change
*/
SPIN_client_signing_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_LOG_LEVEL_Change
*/
SPIN_LOG_LEVEL_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_NRO1_Change
*/
SPIN_NRO1_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_NRO2_Change
*/
SPIN_NRO2_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_NRO3_Change
*/
SPIN_NRO3_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPIN_NRO4_Change
*/
SPIN_NRO4_Change:
advanced.!smbconfchanged = 1
return
/*:VRX SPLIT_Main_Move
*/
SPLIT_Main_Move:
ok = VRset("Main", "Painting", 0)
NewPos = VRInfo("Left")
OldPos = VRGet("SPLIT_Main","Left")
ok = VRSet("SPLIT_Main","Left", NewPos)
ok = VRset("GB_SMBTREE","Left", NewPos+60)
call Main_Resize
ok = VRset("Main", "Painting", 1)
return
/*:VRX SW_ABOUT_Close
*/
SW_ABOUT_Close:
options.!tracmark = VRGet('CB_TRAC', 'Set')
call SW_ABOUT_Fini
return
/*:VRX SW_ABOUT_Create
*/
SW_ABOUT_Create:
call SW_ABOUT_Init
CALL NLVSetText 'SW_ABOUT', "Caption", 1
CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
CALL NLVSetText 'CB_TRAC', "Caption", 134
CALL VRSet 'CB_TRAC', 'Set', options.!tracmark
ok = VRSet("DT_About","Caption", Program' (c) 2007-2018 Alexander Taylor for Arca Noae '||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
call _AboutSambaClientGetInfo
return
/*:VRX SW_ABOUT_Fini
*/
SW_ABOUT_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_ABOUT_Init
*/
SW_ABOUT_Init:
window = VRInfo( "Object" )
if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
end
drop window
return
/*:VRX SW_ACLS_Close
*/
SW_ACLS_Close:
call SW_ACLS_Fini
return
/*:VRX SW_ACLS_Create
*/
SW_ACLS_Create:
call SW_ACLS_Init
ACL.typeFH = VRMethod( "CN_ACLS", "AddField", "String", "Type" )
ACL.groupFH = VRMethod( "CN_ACLS", "AddField", "String", "Group" )
ACL.userFH = VRMethod( "CN_ACLS", "AddField", "String", "User" )
ACL.ADFH = VRMethod( "CN_ACLS", "AddField", "String", "A/D" )
ACL.flagsFH = VRMethod( "CN_ACLS", "AddField", "String", "Flags" )
ACL.accessFH = VRMethod( "CN_ACLS", "AddField", "String", "Access" )
ok = VRMethod( "CN_ACLS", "RemoveRecord", "ALL")
aclsnumeric = ''
call _ACLSBrowse
return
/*:VRX SW_ACLS_Fini
*/
SW_ACLS_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_ACLS_Init
*/
SW_ACLS_Init:
window = VRInfo( "Object" )
if( \VRIsChildOf( window, "Notebook" ) ) then do
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
end
drop window
return
/*:VRX SW_ADVANCED_Close
*/
SW_ADVANCED_Close:
call SW_ADVANCED_Fini
return
/*:VRX SW_ADVANCED_Create
*/
SW_ADVANCED_Create:
call SW_ADVANCED_Init
return
/*:VRX SW_ADVANCED_Fini
*/
SW_ADVANCED_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_ADVANCED_Init
*/
SW_ADVANCED_Init:
/* Title bar */
CALL NLVSetText "SW_ADVANCED", "Caption", 40
/* Options */
CALL NLVSetText "GB_ADVANCED", "Caption", 43
CALL NLVSetText "CB_EAS", "Caption", 44
CALL NLVSetText "CB_READONLY", "Caption", 45
CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
CALL NLVSetText "CB_NTLMv1", "Caption", 144
CALL NLVSetText "CB_KERBEROS5", "Caption", 145
CALL NLVSetText "CB_ENCRYPTION", "Caption", 146
/* Buttons */
CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
/* call VRMethod "SW_ADVANCED", "CenterWindow" */
ok = VRSet("SW_ADVANCED", "Visible", 1)
/* call VRMethod "SW_ADVANCED", "Activate" */
return
/*:VRX SW_ADVANCED_Init_Content
*/
SW_ADVANCED_Init_Content:
IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY", "Set", advanced.!readonly)
IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP", "Set", advanced.!alwaysmp)
IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
IF advanced.!kerberos5 \= "" THEN ok = VRSet("CB_KERBEROS5", "Set", advanced.!kerberos5)
IF advanced.!NTLMv1 \= "" THEN ok = VRSet("CB_NTLMv1", "Set", advanced.!NTLMv1)
IF advanced.!encryption \= "" THEN ok = VRSet("CB_ENCRYPTION", "Set", advanced.!encryption)
/* Obsolete */
IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
return
/*:VRX SW_CONDET_Close
*/
SW_CONDET_Close:
call SW_CONDET_Fini
return
/*:VRX SW_CONDET_Create
*/
SW_CONDET_Create:
call SW_CONDET_Init
return
/*:VRX SW_CONDET_Fini
*/
SW_CONDET_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_CONDET_Init
*/
SW_CONDET_Init:
return
/*:VRX SW_CONDET_Init_Content
*/
SW_CONDET_Init_Content:
if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
/* Hide any "foreign" menu entries */
ok = VRSet("Menu_Selected_Connect", "Visible", 0)
return
/*:VRX SW_DIALOG_Close
*/
SW_DIALOG_Close:
call SW_DIALOG_Fini
return
/*:VRX SW_DIALOG_Create
*/
SW_DIALOG_Create:
call SW_DIALOG_Init
return
/*:VRX SW_DIALOG_Fini
*/
SW_DIALOG_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_DIALOG_Init
*/
SW_DIALOG_Init:
LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
ok = VRSet("Pict_PWINMEM","Width", LEDSize)
ok = VRSet("Pict_PWINMEM","Height", LEDSize)
return
/*:VRX SW_DIALOG_Init_Content
*/
SW_DIALOG_Init_Content:
/* obsolete */
if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
ok = VRSet("Menu_Selected_Remove", "Visible", 0)
ok = VRSet("Menu_Selected_Retry", "Visible", 0)
ok = VRSet("Menu_Selected_Connect", "Visible", 0)
call _DialogPopulate
return
/*:VRX SW_INFO_Close
*/
SW_INFO_Close:
call SW_INFO_Fini
return
/*:VRX SW_INFO_Create
*/
SW_INFO_Create:
if options.!debug == 1 then say time()' SW_INFO_Create started'
call SW_INFO_Init
CALL NLVSetText 'SW_INFO', "Caption", 92
CALL NLVSetText 'PB_INFO_OK', "Caption", 2
Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
if options.!debug == 1 then do
say ' Handle: "'SMBObj.rh'"'
say ' Resource: "'SMBObj.resname'"'
say ' Comment: "'SMBObj.comment'"'
say ' Type: "'SMBObj.udatatype'"'
say ' Message: "'SMBObj.udatamsg'"'
say ' Icon: "'SMBObj.icon'"'
end
say "Vorher:"rpc.srvinfo.OS_VERSION
drop rpc.
say "Vorher:"rpc.srvinfo.OS_VERSION
rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
Info.!comment = VRMethod( "CN_INFO", "AddRecord")
Info.!domain = VRMethod( "CN_INFO", "AddRecord")
Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
Info.!os = VRMethod( "CN_INFO", "AddRecord")
Info.!server = VRMethod( "CN_INFO", "AddRecord")
if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
Info.!status = VRMethod( "CN_INFO", "AddRecord")
Info.!IP = VRMethod( "CN_INFO", "AddRecord")
Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
if rpc_success = 1 then do
if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
/* we did not get these, but we know them anyway */
if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
end
else do
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
end
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
if options.!debug == 1 then say time()' SW_INFO_Create done'
return
/*:VRX SW_INFO_Fini
*/
SW_INFO_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_INFO_Init
*/
SW_INFO_Init:
window = VRInfo( "Object" )
if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
end
drop window
return
/*:VRX SW_LOGIN_Close
*/
SW_LOGIN_Close:
call SW_LOGIN_Fini
return
/*:VRX SW_LOGIN_Create
*/
SW_LOGIN_Create:
call SW_LOGIN_Init
ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
CALL NLVSetText 'DT_USER1', "Caption", 25
CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
if VRIsValidObject(SMBObj.rh) then do
select
when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
when SMBObj.udatatype = "DISK" then do
if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
end
otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
end
say loginicon
ok = VRSet("Pict_Login","PicturePath", LoginIcon)
end
ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
return
/*:VRX SW_LOGIN_Fini
*/
SW_LOGIN_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_LOGIN_Init
*/
SW_LOGIN_Init:
window = VRInfo( "Object" )
if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
end
drop window
return
/*:VRX SW_LOGIN_KeyPress
*/
SW_LOGIN_KeyPress:
obj = VRInfo( "Object" )
keystr = VRGet( obj, "KeyString" )
/* say keystr */
select
when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
otherwise nop
end
return
/*:VRX SW_MOUNTPOINT_Close
*/
SW_MOUNTPOINT_Close:
call SW_MOUNTPOINT_Fini
return
/*:VRX SW_MOUNTPOINT_Create
*/
SW_MOUNTPOINT_Create:
call SW_MOUNTPOINT_Init
ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
CALL NLVSetText 'DT_MPOINT1', "Caption", 27
CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
CALL NLVSetText 'CB_EAS1', "Caption", 44
CALL NLVSetText 'CB_READONLY1', "Caption", 45
CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
CALL NLVSetText "CB_NTLMv11", "Caption", 144
CALL NLVSetText "CB_KERBEROS51", "Caption", 145
CALL NLVSetText "CB_ENCRYPTION1", "Caption", 146
ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
return
/*:VRX SW_MOUNTPOINT_Fini
*/
SW_MOUNTPOINT_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_MOUNTPOINT_Init
*/
SW_MOUNTPOINT_Init:
window = VRInfo( "Object" )
if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
end
drop window
return
/*:VRX SW_PORTCONNECT_Close
*/
SW_PORTCONNECT_Close:
call SW_PORTCONNECT_Fini
return
/*:VRX SW_PORTCONNECT_Create
*/
SW_PORTCONNECT_Create:
call SW_PORTCONNECT_Init
ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
if ok = "" then do
end
else do
say "Samba Spooler Port driver installed!"
ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
smbport.0 = 0
do I = 1 to ports.0
if left(ports.I,3) = "SMB" then do
X = smbport.0
X = X + 1
smbport.0 = X
smbport.X = ports.I
end
end
do I = 1 to smbport.0
say smbport.I
end
end
return
/*:VRX SW_PORTCONNECT_Fini
*/
SW_PORTCONNECT_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_PORTCONNECT_Init
*/
SW_PORTCONNECT_Init:
window = VRInfo( "Object" )
if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
end
drop window
return
/*:VRX SW_PROGRESS_Close
*/
SW_PROGRESS_Close:
options.!delay = 0
call Main_Resize
call VRSet 'Main', 'Visible', 1
call SW_PROGRESS_Fini
return
/*:VRX SW_PROGRESS_Create
*/
SW_PROGRESS_Create:
call SW_PROGRESS_Init
CALL NLVSetText 'SW_PROGRESS', "Caption", 1
CALL NLVSetText 'DT_PROGRESS', "Caption", 34
CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
CALL VRSet "TM_Progress_Throbber","Enabled", 1
CALL VRSet "TM_TheCloser","Enabled", 1
return
/*:VRX SW_PROGRESS_Fini
*/
SW_PROGRESS_Fini:
call VRDestroy "SW_PROGRESS"
return
/*:VRX SW_PROGRESS_Init
*/
SW_PROGRESS_Init:
call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
call VRSet "SW_PROGRESS", "Visible", 1
call VRMethod "SW_PROGRESS", "Activate"
return
/*:VRX SW_SETTINGS_Close
*/
SW_SETTINGS_Close:
call SW_SETTINGS_Fini
return
/*:VRX SW_SETTINGS_Create
*/
SW_SETTINGS_Create:
call SW_SETTINGS_Init
return
/*:VRX SW_SETTINGS_Fini
*/
SW_SETTINGS_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_SETTINGS_Init
*/
SW_SETTINGS_Init:
/* Title bar */
call NLVSetText "SW_SETTINGS", "Caption", 47
/* Options */
call NLVSetText "GB_GLOBAL", "Caption", 47
call NLVSetText "CB_DEBUG", "Caption", 42
call NLVSetText "CB_LOGGING", "Caption", 46
call NLVSetText "CB_BROWSEIMME", "Caption", 48
call NLVSetText "CB_BROWSEAUTH", "Caption", 49
call NLVSetText "CB_SPECIAL", "Caption", 66
call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
call NLVSetText "CB_LMHOSTS", "Caption", 133
call NLVSetText "CB_BROADCAST", "Caption", 74
call NLVSetText "CB_MINIICONS", "Caption", 70
call NLVSetText "CB_STORECREDS", "Caption", 135
/* Buttons */
call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
/* call VRMethod "SW_SETTINGS", "CenterWindow" */
ok = VRSet("SW_SETTINGS", "Visible", 1)
/* call VRMethod "SW_SETTINGS", "Activate" */
return
/*:VRX SW_SETTINGS_Init_Content
*/
SW_SETTINGS_Init_Content:
ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
/* if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile) /* Obsolete */
if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOG_LEVEL", "Value", advanced.!loglevel) */
log_level = IniGet('log level', 'global', samba.!smbconf)
call _SmbConfCreateShadowCopy
say "log level ="log_level
if log_level = "" then log_level = 2
say "log level ="log_level
ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
if wins_support = "YES" then do /* we are a WINS server ourself */
ok = VRSet("DT_WINS_SERVER","Enabled", 0)
ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
ok = VRSet("EF_WINS_SERVER","Value", "")
ok = VRSet("EF_WINS_SERVER","Enabled", 0)
end
else do
ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
end
name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
do I = 1 to words(name_resolve_order)
ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
end
advanced.!smbconfchanged = 0
return
/*:VRX SW_SMBCONF_Close
*/
SW_SMBCONF_Close:
call SW_SMBCONF_Fini
return
/*:VRX SW_SMBCONF_Create
*/
SW_SMBCONF_Create:
call SW_SMBCONF_Init
return
/*:VRX SW_SMBCONF_Fini
*/
SW_SMBCONF_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_SMBCONF_Init
*/
SW_SMBCONF_Init:
/* Buttons */
call NLVSetText "PB_SMBCONF_APPLY", "Caption", 122
call NLVSetText "PB_SMBCONF_UNDO", "Caption", 123
call NLVSetText "PB_SMBCONF_HELP", "Caption", 4
return
/*:VRX SW_SMBCONF_Init_Content
*/
SW_SMBCONF_Init_Content:
call _SmbConfCreateShadowCopy
client_NTLMv2_auth = ZeroOne(IniGet('client NTLMv2 auth', 'global', samba.!shadowsmbconf))
if client_NTLMv2_auth = 1 then do
ok = VRSet("CB_client_NTLMv2_auth","Set",client_NTLMv2_auth)
ok = VRSet("CB_client_lanman_auth","Enabled", 0)
ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
end
else do
client_lanman_auth = ZeroOne(IniGet('client lanman auth', 'global', samba.!shadowsmbconf))
client_plaintext_auth = ZeroOne(IniGet('client plaintext auth', 'global', samba.!shadowsmbconf))
ok = VRSet("CB_client_lanman_auth","Set",client_lanman_auth)
ok = VRSet("CB_client_plaintext_auth","Set",client_plaintext_auth)
end
client_use_spnego = ZeroOne(IniGet('client use spnego', 'global', samba.!shadowsmbconf))
ok = VRSet("CB_client_use_spnego","Set",client_use_spnego)
client_use_spnego_principal = ZeroOne(IniGet('client use spnego principal', 'global', samba.!shadowsmbconf))
ok = VRSet("CB_client_use_spnego_principal","Set",client_use_spnego_principal)
client_max_protocol = IniGet('client max protocol', 'global', samba.!shadowsmbconf)
if client_max_protocol = "" then do
/* ok = VRSet("SPIN_client_max_protocol","Enabled", 0)
ok = VRSet("DT_client_max_protocol","Enabled", 0) */
end
else ok = VRSet("SPIN_client_max_protocol","Value",client_max_protocol)
client_min_protocol = IniGet('client min protocol', 'global', samba.!shadowsmbconf)
if client_min_protocol = "" then do
/* ok = VRSet("SPIN_client_min_protocol","Enabled", 0)
ok = VRSet("DT_client_min_protocol","Enabled", 0) */
end
else ok = VRSet("SPIN_client_min_protocol","Value",client_min_protocol)
client_signing = IniGet('client signing', 'global', samba.!shadowsmbconf)
client_ipc_signing = IniGet('client ipc signing', 'global', samba.!shadowsmbconf)
say "client_signing ="client_signing
ok = VRSet("SPIN_client_signing","Value",client_signing)
ok = VRSet("SPIN_client_ipc_signing","Value",client_signing)
advanced.!smbconfchanged = 0
return
/*:VRX SW_SMBTREE_Close
*/
SW_SMBTREE_Close:
call SW_SMBTREE_Fini
return
/*:VRX SW_SMBTREE_Create
*/
SW_SMBTREE_Create:
call SW_SMBTREE_Init
return
/*:VRX SW_SMBTREE_Fini
*/
SW_SMBTREE_Fini:
window = VRInfo( "Window" )
call VRDestroy window
drop window
return
/*:VRX SW_SMBTREE_Init
*/
SW_SMBTREE_Init:
return
/*:VRX SW_SMBTREE_Init_Content
*/
SW_SMBTREE_Init_Content:
if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
/* Hide any "foreign" menu entries */
ok = VRSet("Menu_Selected_Remove", "Visible", 0)
ok = VRSet("Menu_Selected_Retry", "Visible", 0)
return
/*:VRX TDL_1_PageSelected
*/
TDL_1_PageSelected:
page = VRInfo("Page")
/* call _TabsStrip */
select
when page = 1 then do /* dialog */
call _TabFix 1
end
when page = 2 then do /* advanced */
call SW_ADVANCED_Init_Content
end
when page = 3 then do /* smbtree */
call SW_SMBTREE_Init_Content
end
when page = 4 then do /* condet */
call SW_CONDET_Init_Content
end
when page = 5 then do /* Settings */
call SW_SETTINGS_Init_Content
end
when page = 6 then do /* SMB.CONF */
call SW_SMBCONF_Init_Content
end
otherwise nop
end
return
/*:VRX TM_AutoClose_Trigger
*/
TM_AutoClose_Trigger:
call Quit
return
/*:VRX TM_Progress_Throbber_Trigger
*/
TM_Progress_Throbber_Trigger:
pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
parse var pIdx '#' pidx
pidx = pidx + 1
if pidx = 23 then pidx = 11
ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
return
/*:VRX TM_RefreshCurrentDisplay_Trigger
*/
TM_RefreshCurrentDisplay_Trigger:
if RefreshMode <> "" then return
if _DaemonRunning() = 0 then do
say " Daemon not running - disable GUI"
ok = VRset("GB_CURRENT", "Enabled", 0)
ok = VRset("TDL_1", "Enabled", 0)
ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
end
else do
say " Daemon running - enable GUI"
ok = VRset("GB_CURRENT", "Enabled", 1)
ok = VRset("TDL_1", "Enabled", 1)
ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
end
CALL REFRESH
return
/*:VRX TM_RefreshTreeDisplay_Trigger
*/
TM_RefreshTreeDisplay_Trigger:
ShowHidden = advanced.!special
BroadCast = advanced.!broadcast
DoLMHosts = advanced.!lmhosts
select
when RefreshMode = "TREE" then do
call _RefreshTreeDisplay
if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
end
end
when RefreshMode = "SHARE" then do
call _AddSharesDisplay
end
otherwise say "RefreshMode = "RefreshMode
end
call _DialogPopulate
return
/*:VRX TM_STATUSBAR_Trigger
*/
TM_STATUSBAR_Trigger:
call _StatusbarReset
return
/*:VRX TM_TheCloser_Trigger
*/
TM_TheCloser_Trigger:
call SW_PROGRESS_Close
return
/*:VRX TM_Throbber_Trigger
*/
TM_Throbber_Trigger:
pIdx = VRGet("Pict_Throbber","PicturePath")
parse var pIdx '#' pidx
pidx = pidx + 1
if pidx = 23 then pidx = 11
ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
return
/*:VRX YesNo
*/
YesNo: procedure
if arg(1) = 1 then answer = "Yes"
else answer = "No"
return answer
/*:VRX ZeroOne
*/
ZeroOne: procedure
if translate(arg(1)) = "YES" then answer = 1
else answer = 0
return answer