source: trunk/guitools/evfsgui/evfsgui.vrx@ 1024

Last change on this file since 1024 was 1016, checked in by Herwig Bauernfeind, 9 years ago

GUITools: EVFSGUI 2.6 add support for ndpsmb 3.0 options

File size: 222.3 KB
Line 
1/*:VRX Main
2*/
3/* Main
4*/
5Main:
6/*
7 Samba Connections GUI for OS/2 based systems
8 Copyright (C) 2007-2016 by Alexander Taylor and Herwig Bauernfeind
9 Derived works must contain this copyright notice.
10
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24/* Process the arguments.
25 Get the parent window.
26*/
27 parse source . calledAs .
28 parent = ""
29 argCount = arg()
30 argOff = 0
31 if( calledAs \= "COMMAND" )then do
32 if argCount >= 1 then do
33 parent = arg(1)
34 argCount = argCount - 1
35 argOff = 1
36 end
37 end; else do
38 call VROptions 'ImplicitNames'
39 call VROptions 'NoEchoQuit'
40 end
41 InitArgs.0 = argCount
42 if( argCount > 0 )then do i = 1 to argCount
43 InitArgs.i = arg( i + argOff )
44 end
45 drop calledAs argCount argOff
46
47/* Load the windows
48*/
49 call VRInit
50 parse source . . spec
51 _VREPrimaryWindowPath = ,
52 VRParseFileName( spec, "dpn" ) || ".VRW"
53 _VREPrimaryWindow = ,
54 VRLoad( parent, _VREPrimaryWindowPath )
55 drop parent spec
56 if( _VREPrimaryWindow == "" )then do
57 call VRMessage "", "Cannot load window:" VRError(), ,
58 "Error!"
59 _VREReturnValue = 32000
60 signal _VRELeaveMain
61 end
62
63/* Process events
64*/
65 call Init
66 signal on halt
67 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
68 _VREEvent = VREvent()
69 interpret _VREEvent
70 end
71_VREHalt:
72 _VREReturnValue = Fini()
73 call VRDestroy _VREPrimaryWindow
74_VRELeaveMain:
75 call VRFini
76exit _VREReturnValue
77
78VRLoadSecondary:
79 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
80 if __vrlsWait then do
81 call VRFlush
82 end
83 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
84 if __vrlsHWnd = '' then signal __vrlsDone
85 if __vrlsWait \= 1 then signal __vrlsDone
86 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
87 __vrlsTmp = __vrlsWindows.0
88 if( DataType(__vrlsTmp) \= 'NUM' ) then do
89 __vrlsTmp = 1
90 end
91 else do
92 __vrlsTmp = __vrlsTmp + 1
93 end
94 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
95 __vrlsWindows.0 = __vrlsTmp
96 do while( VRIsValidObject( VRWindow() ) = 1 )
97 __vrlsEvent = VREvent()
98 interpret __vrlsEvent
99 end
100 __vrlsTmp = __vrlsWindows.0
101 __vrlsWindows.0 = __vrlsTmp - 1
102 call VRWindow __vrlsWindows.__vrlsTmp
103 __vrlsHWnd = ''
104__vrlsDone:
105return __vrlsHWnd
106
107/*:VRX __VXREXX____APPENDS__
108*/
109__VXREXX____APPENDS__:
110/*
111#append ..\shared\cltinit.vrs
112#append ..\shared\inittempdir.vrs
113#append ..\shared\nlv.vrs
114#append ..\shared\rexx_md5.vrs
115#append ..\shared\smbtree.vrs
116#append ..\shared\textini.vrs
117#append ..\shared\usercredmem.vrs
118#append ..\shared\rxrpclib.vrs
119*/
120return
121/*:VRX _AboutSambaClientGetInfo
122*/
123_AboutSambaClientGetInfo:
124 call VRSet "SW_ABOUT", "Painting", 0
125 BR = ''
126
127 ok = VRMethod( "CN_About", "RemoveRecord", "All" )
128
129 /* OS Version */
130 if VRFileExists(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG" ) then do
131 OS = linein(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG")
132 OS = subword(OS,1,2) '('translate(word(OS,3))')'
133 ok = stream(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG",'c','close')
134 end
135 else if VRFileExists(SysBootDrive()||"\ECS\ECS_INST.FLG" ) then do
136 OS = linein(SysBootDrive()||"\ECS\ECS_INST.FLG")
137 OS = subword(OS,1,3)
138 ok = stream(SysBootDrive()||"\ECS\ECS_INST.FLG",'c','close')
139 end
140 else OS = "OS/2 Warp/eComStation 1.x"
141
142 DummyRH = VRMethod('CN_About', 'AddRecord')
143 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Operating system", About.ValFH, OS)
144
145 /* Filesystem version */
146 DummyRH = VRMethod('CN_About', 'AddRecord')
147 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "File system", About.ValFH, fs.!name' Version 'fs.!version)
148 ABoutStr = "Samba Client Versions:"||BR
149 AboutStr = AboutStr||'0D0A'x||"File system "||'09'x||fs.!name' Version 'fs.!version||BR
150 plugindll. =""
151
152 /* Plugin */
153 address cmd 'look4dll.exe ndpsmb.dll >'samba.!msg
154 if RC <> 0 then do
155 /* Look4DLL not installed or failed, try fallback search */
156 if rc == 1041 then do /* look4dll not found, use REXX-based search */
157 pluginpath = _DLLSearch('ndpsmb.dll')
158 if pluginpath <> '' then do
159 plugindll.0 = 1
160 plugindll.1 = pluginpath
161 end
162 end
163 else plugindll.0 = 0
164 /* DLL is not in libpath; as a last resort, check some well-known places */
165 if plugindll.0 < 1 then do
166 NDFSDir = value("NDFSDIR",,"OS2ENVIRONMENT")
167 if NDFSDir = "" then do
168 OSDir = value("OSDIR",,"OS2ENVIRONMENT")
169 if OSDir == '' then OSDir = SysBootDrive()'\os2'
170 NDFSDir = OSDir'\dll'
171 end
172 ok = SysFileTree(NDFSDir'\ndpsmb.dll', "plugindll.", 'FOS')
173 end
174 end
175 else do
176 pluginline = linein(samba.!msg)
177 ok = stream(samba.!msg,'c','close')
178 ok = SysFileDelete(samba.!msg)
179 parse var pluginline . 'loaded ' pluginline
180 NDFSDir = VRParseFileName(pluginline,"DP")
181 plugindll.0 = 1
182 plugindll.1 = pluginline
183 end
184
185 if plugindll.0 > 0 then do
186 do J = 1 to plugindll.0
187 DummyRH.1 = VRMethod('CN_About', 'AddRecord')
188 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH.1, About.DscFH, "Plugin file", About.ValFH, plugindll.J)
189 AboutStr = AboutStr||'0D0A'x||"Plugin file "||'09'x||plugindll.J||BR
190
191 address cmd 'bldlevel.exe 'plugindll.J' >'samba.!msg
192
193 I = 0
194 Dummy = linein(samba.!msg)
195 say Dummy
196 Dummy = linein(samba.!msg)
197 say Dummy
198 Dummy = linein(samba.!msg)
199 say Dummy
200 do until lines(samba.!msg) = 0
201 I = I + 1
202 line.I = linein(samba.!msg)
203 if pos('has no LAN component-style version string', line.I) > 0 then do
204 DummyRH = VRMethod('CN_About', 'AddRecord')
205 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Error", About.ValFH, "Plugin has no LAN component-style version string")
206 leave
207 end
208 else do
209 parse var line.I desc':'vers
210 DummyRH = VRMethod('CN_About', 'AddRecord')
211 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Plugin "Desc, About.ValFH, strip(Vers))
212 AboutStr = AboutStr||'0D0A'x||"Plugin "Desc '09'x||strip(Vers)||BR
213 end
214 end
215 line.0 = I
216 ok = stream(samba.!msg,'c','close')
217 ok = SysFileDelete(samba.!msg)
218 end
219 end
220 else do
221 DummyRH = VRMethod('CN_About', 'AddRecord')
222 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Plugin", About.ValFH, "Not found!")
223 AboutStr = AboutStr||'0D0A'x||"Plugin not found!"||BR
224 end
225
226 /* Commandline utilities */
227 address cmd samba.!smbclientexe' -V >'samba.!msg
228 ClutVer = linein(samba.!msg)
229 ok = stream(samba.!msg,'c','close')
230 ok = SysFileDelete(samba.!msg)
231
232 DummyRH = VRMethod('CN_About', 'AddRecord')
233 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Commandline utility path", About.ValFH, VRParseFileName(samba.!smbclientexe,"DP"))
234
235 DummyRH = VRMethod('CN_About', 'AddRecord')
236 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Commandline utilities", About.ValFH, ClutVer)
237 AboutStr = AboutStr||'0D0A'x||"Commandline utilities "||'09'x||ClutVer||BR
238
239 /* GUI Version */
240 DummyRH = VRMethod('CN_About', 'AddRecord')
241 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, options.!appname_long, About.ValFH, VRGet("Main", "HintText"))
242 AboutStr = AboutStr||'0D0A'x||"options.!appname_long "||'09'x || VRGet("Main", "HintText")||BR
243 call VRSet "SW_ABOUT", "Painting", 1
244return
245
246/*:VRX _AddTemplates
247*/
248_AddTemplates:
249 VolTplRH = VRMethod("CN_CURRENT", 'AddRecord', , 'First', 'Volume template', icons.!template )
250 MpTplRH = VRMethod("CN_CURRENT", 'AddRecord', VolTplRH, 'First', 'Mountpoint template', icons.!template )
251return
252
253/*:VRX _BrowseBuildPath
254*/
255_BrowseBuildPath: procedure expose options. icons. samba. sharerh
256 if options.!debug == 1 then say time()' _BrowseBuildPath started'
257 rh = arg(1)
258
259 finished = 0
260 BrowsePathStr = ''
261
262 do while \finished
263 parentrh = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"Parent")
264 resname = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"caption")
265 userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"userdata")
266 parse var userdata udatatype '|' udatamsg
267 parse var resname resname '0D0A'x .
268 resname = strip(resname)
269 /* say " Not connected - cannot open!" */
270 select
271 when udatatype = "SERVER" then do
272 BrowsePathStr = '\\'resname'\'BrowsePathStr
273 finished = 1
274 end
275 when udatatype = "DISK" then do
276 BrowsePathStr = resname'\'BrowsePathStr
277 sharerh =rh
278 rh = parentrh
279 end
280 otherwise do
281 BrowsePathStr = resname'\'BrowsePathStr
282 rh = parentrh
283 end
284 end
285 /* say ' BrowsePathStr = "'BrowsePathStr'"' */
286 end
287 BrowsePathStr = strip(BrowsePathStr,'T','\')
288 if options.!debug == 1 then say time()' _BrowseBuildPath done, returning "'BrowsePathStr'"'
289return BrowsePathStr
290
291/*:VRX _BrowseDirectory
292*/
293_BrowseDirectory: /* This must not be a procedure */
294 if options.!debug == 1 then say time()' _BrowseDirectory started'
295
296 /* Turn off painting */
297 ok = VRSet("CN_SMBTREE","Painting", 0 )
298 call VRSet VRWindow(), 'Pointer', 'Wait'
299
300 /* Make sure credentials are usable */
301 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
302
303 /* We have to remove the double % for smbclient.exe - not entirely clear why */
304 OldUserCred = ""
305 if pos('%%',UserCred) > 0 & pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0 then do
306 OldUserCred = UserCred
307 parse var UserCred '--user='username'%%'password
308 UserCred = '--user='username'%'password
309 say " Strip double %%!!!"
310 end
311
312 say ' 'samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'"'
313 address cmd samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'" 'debuglevel' 2>NUL 1>'samba.!msg
314
315 if UserCred = '-N' then UserCred = ''
316
317 if OldUserCred <> "" then do
318 UserCred = OldUserCred
319 OldUserCred = ""
320 say " Restore double %%!!!"
321 end
322
323 I = 0
324 ok = VRSet("DT_STATUSBAR","Caption", "")
325 do until lines(samba.!msg) = 0
326 infoline = linein(samba.!msg)
327 select
328 when pos('blocks',infoline) > 0 then do /* Last line */
329 /* we should handle size information here */
330 iterate
331 end
332 when I = 0 & length(infoline) > 0 & left(infoline,2) <> " " then do /* Login message */
333 say ' Login message "'Infoline'"'
334 ok = VRMethod("CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Userdata", SMBObj.udatatype'|'infoline )
335 ok = VRSet("DT_STATUSBAR","Caption", infoline)
336 end
337 when left(infoline,2) = " " & length(infoline) > 0 then do /* file or DIR */
338 wn = words(infoline)
339 fyear = word(infoline,wn)
340 ftime = word(infoline,wn-1)
341 fday = word(infoline,wn-2)
342 fmonth = word(infoline,wn-3)
343 fwday = word(infoline,wn-4)
344 pos_attr = pos(fwday,infoline)-16
345 fsize = word(infoline,wn-5)
346 fattr = substr(infoline,pos_attr,6)
347 fname = strip( substr(infoline,3,pos_attr-3))
348 if fname = '.' | fname = '..' then iterate /* we do not display these */
349 if pos('H',fattr) > 0 then iterate /* we do not display hidden files */
350 if pos('S',fattr) > 0 then iterate /* we do not display system files */
351 I = I + 1
352 fh.I = VRMethod( "CN_SMBTREE", "AddRecord", SMBObj.rh, , fname)
353 if pos('D',fattr) = 0 then do
354 Ext = translate(VRParseFIleName(fname,'E'))
355 select
356 when Ext = 'EXE' then ficon = icons.!exe /* executable */
357 when Ext = 'CMD' then ficon = icons.!cmd /* OS/2 or NT batch */
358 when Ext = 'BAT' then ficon = icons.!bat /* DOS batch */
359 when Ext = 'PDF' then ficon = icons.!pdf /* PDF document */
360 when wordpos(Ext, 'XLS SXC ODS') > 0 then ficon = icons.!spreadsheet
361 when wordpos(Ext, 'DOC SXW ODT') > 0 then ficon = icons.!textdocument
362 when wordpos(Ext, 'FW2 FW3 FW4') > 0 then ficon = icons.!framework
363 when wordpos(Ext, 'JPG BMP PNG GIF TIF') > 0 then ficon = icons.!image
364 when wordpos(Ext, 'AVI MPG FLV WMV') > 0 then ficon = icons.!movie
365 when wordpos(Ext, 'WAV MP3 OGG MID') > 0 then ficon = icons.!sound
366 when wordpos(Ext, 'WPI') > 0 then ficon = icons.!warpin
367 when wordpos(Ext, 'ZIP') > 0 then ficon = icons.!zip
368 when wordpos(Ext, 'INF HLP') > 0 then ficon = icons.!view
369 when wordpos(Ext, 'TXT') > 0 then ficon = icons.!plaintext
370 otherwise ficon = icons.!defaultfile /* default file icon */
371 end
372 ftype = 'FILE'
373 end
374 else do
375 ficon = icons.!folder
376 ftype = 'DIRECTORY'
377 end
378
379 ok = VRmethod("CN_SMBTREE", "SetRecordAttr", fh.I, "userdata", ftype'|'fsize' Bytes 'fday'-'fmonth'-'fyear' 'ftime,'icon',Ficon)
380
381 end
382 otherwise nop /* no other line type */
383 end
384 end
385 if I > 0 then ok = VRMethod("CN_SMBTREE","SetRecordAttr",SMBObj.rh, "Icon", icons.!folder_open)
386 ok = stream(samba.!msg,'c','close')
387 ok = SysFileDelete(samba.!msg)
388
389 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh,"Collapsed", 0)
390 /* Turn on painting */
391 call VRSet VRWindow(), 'Pointer', '<default>'
392 ok = VRSet("CN_SMBTREE","Painting", 1 )
393 if options.!debug == 1 then say time()' _BrowseDirectory done'
394return
395
396/*:VRX _BrowseObjectOpen
397*/
398_BrowseObjectOpen: procedure expose samba. options. cd. icons.
399 machine = arg(1)
400 sharename = arg(2)
401 browsepath = arg(3)
402
403 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
404
405 OpenOk = 0
406
407 DO i = 1 TO records.0
408 if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!active then do
409 if options.!debug == 1 then say ' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.MPointFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ServerFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ShareFH)
410 if machine = VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ServerFH) &,
411 sharename = VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ShareFH) then do
412 Object = strip(VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.MPointFH),'T','\')'\'browsepath
413 if options.!debug == 1 then say ' Non UNC object: "'Object'"'
414 ID = VRMethod( "Application", "StartThread", "wps_open", Object, "DEFAULT" )
415 OpenOK = 1
416 end
417 end
418 if OpenOK = 1 then leave
419 end
420return OpenOK
421
422/*:VRX _BrowseResetObject
423*/
424_BrowseResetObject: procedure
425 ok = VRSet("CN_SMBTREE","Painting", 0 )
426 rh = arg(1)
427
428 /* Remove all files and directories whose parent is our share */
429 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "AllRH." )
430 do I = 1 to AllRH.0
431 AllParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",AllRH.I,"Parent")
432 if AllParentRH = rh then ok = VRMethod( "CN_SMBTREE", "RemoveRecord", AllRH.I )
433 end
434 ok = VRSet("CN_SMBTREE","Painting", 1 )
435return
436
437/*:VRX _ContainersInit
438*/
439_ContainersInit:
440 if options.!debug == 1 then say time()' _ContainersInit started'
441 /* Connection details */
442 CD.StatusFH = VRMethod( "CN_CONDET", "AddField", "Icon", "Status" )
443 CD.mpointFH = VRMethod( "CN_CONDET", "AddField", "String", "mpoint" )
444 CD.mpidxFH = VRMethod( "CN_CONDET", "AddField", "String", "index" )
445 CD.workgrpFH = VRMethod( "CN_CONDET", "AddField", "String", "workgroup" )
446 CD.serverFH = VRMethod( "CN_CONDET", "AddField", "String", "server" )
447 CD.shareFH = VRMethod( "CN_CONDET", "AddField", "String", "share" )
448 CD.userFH = VRMethod( "CN_CONDET", "AddField", "String", "user" )
449 CD.passwordFH = VRMethod( "CN_CONDET", "AddField", "String", "password" )
450 CD.spasswordFH = VRMethod( "CN_CONDET", "AddField", "String", "spassword" )
451 CD.masterFH = VRMethod( "CN_CONDET", "AddField", "String", "master" )
452 CD.mtypeFH = VRMethod( "CN_CONDET", "AddField", "String", "mastertype" )
453 CD.memlenFH = VRMethod( "CN_CONDET", "AddField", "String", "memlen" )
454 CD.easupportFH = VRMethod( "CN_CONDET", "AddField", "String", "easupport" )
455 CD.logfileFH = VRMethod( "CN_CONDET", "AddField", "String", "logfile" )
456 CD.loglevelFH = VRMethod( "CN_CONDET", "AddField", "String", "loglevel" )
457 CD.rwFH = VRMethod( "CN_CONDET", "AddField", "String", "readonly" )
458 CD.ctoFH = VRMethod( "CN_CONDET", "AddField", "String", "cachetimeout" )
459 CD.cldFH = VRMethod( "CN_CONDET", "AddField", "String", "cachelistings" )
460 CD.kerberos5FH = VRMethod( "CN_CONDET", "AddField", "String", "krb5support")
461 CD.ntlmv1FH = VRMethod( "CN_CONDET", "AddField", "String", "ntlmv1support")
462 CD.encryptionFH= VRMethod( "CN_CONDET", "AddField", "String", "encryptionsupport")
463 CD.hashFH = VRMethod( "CN_CONDET", "AddField", "String", "hash" )
464
465 /* Connection details */
466 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", options.!debug)
467 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", options.!debug)
468 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", options.!debug)
469 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", options.!debug)
470 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", options.!debug)
471 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", options.!debug)
472 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", options.!debug)
473 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", options.!debug)
474 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.kerberos5FH, "Visible", options.!debug)
475 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ntlmv1FH, "Visible", options.!debug)
476 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.encryptionFH, "Visible", options.!debug)
477 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", options.!debug)
478
479 ok = VRSet("CN_CONDET", "DetailSort", cd.mpointfh )
480
481 /* NLV columns */
482 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.statusfh , "Title", strip(NLVGetMessage(67),"T",":"))
483 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpointfh , "Title", strip(NLVGetMessage(27),"T",":"))
484 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.workgrpFH , "Title", strip(NLVGetMessage(21),"T",":"))
485 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.serverFH , "Title", strip(NLVGetMessage(19),"T",":"))
486 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.shareFH , "Title", strip(NLVGetMessage(20),"T",":"))
487 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.userFH , "Title", strip(NLVGetMessage(25),"T",":"))
488 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ctoFH , "Title", strip(NLVGetMessage(130),"T",":"))
489 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.cldFH , "Title", strip(NLVGetMessage(131),"T",":"))
490 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.easupportFH , "Title", strip(NLVGetMessage(68),"T",":"))
491 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.rwfh , "Title", strip(NLVGetMessage(69),"T",":"))
492 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.kerberos5FH , "Title","Kerberos 5 support")
493 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ntlmv1FH , "Title","NTLMv1 support")
494 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.encryptionFH , "Title","Encryption support")
495
496 /* SMBTree columns */
497 WorkgroupFH= VRMethod( "CN_smbtree", "AddField", "String", "Workgroup" )
498 NBFH = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
499 IpFH = VRMethod( "CN_smbtree", "AddField", "String", "IP" )
500 MBFH = VRMethod( "CN_smbtree", "AddField", "String", "Role" )
501 OSFH = VRMethod( "CN_smbtree", "AddField", "String", "OS" )
502 VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" )
503 CommentFH = VRMethod( "CN_smbtree", "AddField", "String", "Comment" )
504 MacFH = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
505
506 ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH, "ReadOnly", 1)
507 ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH, "ReadOnly", 1)
508 ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH, "ReadOnly", 1)
509 ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
510 ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH, "ReadOnly", 1)
511 ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH, "ReadOnly", 1)
512
513 if options.!debug == 1 then say time()' _ContainersInit done'
514return
515/*:VRX _ContextMenuSelectedSet
516*/
517_ContextMenuSelectedSet:
518 /* Fixme: This routine only works for CN_SMBTREE right now */
519
520 /* Hide all context menu entries */
521 ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
522 ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
523 ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
524 ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
525 ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
526 ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
527 ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
528 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
529
530
531/* ok = VRSet("Menu_Selected_TreeView","Visible",1)
532 ok = VRSet("Menu_Selected_DetailsView","Visible",1)
533 */
534 select
535 when SMBObj.udatatype = "DISK" then do
536 ok = VRSet("Menu_Selected_Connect", "Visible", 1)
537 end
538 when SMBObj.udatatype = "SERVER" then do
539 ok = VRSet("Menu_Selected_Connect", "Visible", 1)
540 ok = VRSet("Menu_Selected_Sep1", "Visible", 1)
541 ok = VRSet("Menu_Selected_Info", "Visible", 1)
542 ok = VRSet("Menu_Selected_TimeSync", "Visible", 1)
543 ok = VRSet("Menu_Selected_Refresh", "Visible", 1)
544 end
545 when SMBObj.udatatype = "WORKGROUP" then do
546 ok = VRSet("Menu_Selected_Connect", "Visible", 1)
547 ok = VRSet("Menu_Selected_Sep1", "Visible", 1)
548 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 1)
549 end
550 when SMBObj.udatatype = "PRINTER" then do
551 call _PrinterInfo
552 /* CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E' */
553 end
554 otherwise nop /* FILE DIRECTORY */
555 end
556return
557
558/*:VRX _CreateSmbConf
559*/
560_CreateSmbConf:
561 if options.!debug == 1 then say time()' '||"_CreateSmbConf started"
562 call lineout samba.!smbconf, '# Samba config file created using' options.!appname_long 'ver. 'word(VRGet("Main","Hinttext"),2)
563 call lineout samba.!smbconf, '# from 'value("USER",,'OS2ENVIRONMENT')'@'value("HOSTNAME",,'OS2ENVIRONMENT')
564 call lineout samba.!smbconf, '# Date: 'date()' 'time()
565 call lineout samba.!smbconf, '[global]'
566 if settings.!network <> '' then do
567 call lineout samba.!smbconf, '09'x||'workgroup = 'settings.!network
568 end
569 else do
570 call lineout samba.!smbconf, '09'x||'workgroup = WORKGROUP'
571 end
572 call lineout samba.!smbconf, '09'x||'log level = 0'
573 ok = stream(samba.!smbconf,'c','close')
574 if options.!debug == 1 then say time()' '||"_CreateSmbConf done"
575return
576
577/*:VRX _DaemonRunning
578*/
579_DaemonRunning: procedure expose fs.
580 ok = PRProcessList(proc)
581 PID = 0
582 do I = 1 to proc.0
583 CurProc = VRParseFileName(proc.i.name,'NE')
584 if CurProc = fs.!prefix"CTL.EXE" then do
585 PID = proc.i.pid
586 leave
587 end
588 end
589return PID
590
591/*:VRX _DelSMBObjectShares
592*/
593_DelSMBObjectShares: procedure expose samba. options. SMBObj. rh
594 /* Purpose: Delete shares for a given Object (as handle) */
595
596 rh = arg(1)
597
598 ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
599
600 do J = 1 to rh.0 /* populate shares with valid entries */
601 ParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Parent")
602
603 if ParentRH = rh then do /* we found a share belonging to our server */
604 ok = VRMethod("CN_SMBTree", "RemoveRecord", rh.J )
605 end
606 end
607 SmbObj.shares. = ''
608 SmbObj.shares.0 = 0
609return
610
611/*:VRX _DialogPopulate
612*/
613_DialogPopulate:
614
615 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Visible", "rh." )
616
617 ok = VRMethod("EF_SHARE", "Reset")
618 ok = VRMethod("EF_SERVER", "Reset")
619 ok = VRMethod("EF_NETWORK", "Reset")
620
621 do I = 1 to rh.0
622
623 Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Userdata")
624 ResName = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Caption")
625
626 parse var ResName ResName '0D0A'x .
627 ResName = strip(ResName)
628 parse var userdata ResType '|' .
629
630 select
631 when ResType = "WORKGROUP" then ok = VRMethod("EF_NETWORK","AddString", ResName)
632 when ResType = "SERVER" then ok = VRMethod("EF_SERVER", "AddString", ResName)
633 when ResType = "DISK" then ok = VRMethod("EF_SHARE", "AddString", ResName)
634 otherwise nop
635 end
636 end
637
638return
639
640/*:VRX _DLLSearch
641*/
642_DLLSearch: PROCEDURE
643 PARSE ARG dname
644 _bd = SysBootDrive()
645
646 IF _bd == '' THEN
647 _bd = FILESPEC('DRIVE', VALUE('COMSPEC',,'OS2ENVIRONMENT'))
648 _csys = _bd'\CONFIG.SYS'
649
650 CALL SysFileSearch 'LIBPATH=', _csys, 'match.'
651 DO i = 1 TO match.0
652 PARSE UPPER VAR match.i _lead 'LIBPATH=' _lpath
653 IF (_lead == '') & (_lpath <> '') THEN LEAVE
654 END
655
656 _lpath = SysQueryExtLIBPATH('B') || ';'_lpath';' || SysQueryExtLIBPATH('E')
657
658 CALL SETLOCAL
659 _testenv = 'TEST_'dname'_LIBPATH'
660 CALL VALUE _testenv, _lpath, 'OS2ENVIRONMENT'
661 location = SysSearchPath( _testenv, dname )
662 CALL ENDLOCAL
663
664RETURN location
665
666/*:VRX _dropdeprecated
667*/
668_dropdeprecated:
669 /* The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
670 The _dropdeprecated routine will drop any value in order to make sure the stem actually works
671 If another variable is added to the stem, ensure to also drop it in dropdeprecated otherwise it will not be exported
672 */
673 drop rh
674 drop parentrh
675 drop gparentrh
676 drop icon
677 drop resname
678 drop comment
679 drop udatatype
680 drop udatamsg
681return
682
683/*:VRX _Dynamic
684*/
685_Dynamic:
686 dyn_code = arg(1)
687 if options.!debug == 1 then say ' Dynamic code: 'dyn_code
688 interpret dyn_code; drop dyn_code
689return
690
691/*:VRX _GetSMBObjectProperties
692*/
693_GetSMBObjectProperties: procedure expose samba. options. SMBObj. rh icon resname udatatype udatamsg parentrh icons.
694 if options.!debug == 1 then say time()' _GetSMBObjectProperties started'
695
696 /* Purpose of this subroutine:
697 The current SMB object's frequently used properties should be stored in a stem
698 SMBObj.rh = recordhandle of the object
699 SMBObj.resname = resourcename of the object
700 SMBObj.comment = commentstring of the object
701 SMBObj.icon = icon of the object
702 SMBObj.udatatype = type of object (WORKGROUP, SERVER, DISK, PRINTER, FILE, DIRECTORY)
703 SMBObj.udatamsg = arbitrary object related data (Login message, file properties)
704 SMBObj.parentrh = recordhandle of the object's parent
705 SMBObj.gparentrh = recordhandle of the object's grandparent
706
707 The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
708 The _dropdeprecated routine will drop any value in order to make sure the stem actually works
709 If another variable is added to the stem, ensure to also drop it in dropdeprecated otherwise it will not be exported
710 */
711 call _dropdeprecated
712
713 SMBObj. = ""
714 SMBObj.rh = arg(1)
715
716 if VRMethod( "CN_SMBTREE", "ValidateRecord", SMBObj.rh) <> 1 | SMBObj.rh = "" then do
717 if options.!debug == 1 then say time()' _GetSMBObjectProperties aborted'
718 return
719 end
720
721 SMBObj.Icon = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Icon")
722
723 SMBObj.parentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Parent")
724 if SMBObj.parentrh = ""
725 then SMBObj.gparentrh = ""
726 else SMBObj.gparentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
727
728 SMBObj.resname = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Caption")
729 parse var SMBObj.resname SMBObj.resname '0D0A'x SMBObj.comment
730 SMBObj.resname = strip(SMBObj.resname)
731 SMBObj.comment = strip(SMBObj.comment)
732
733 Userdata = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Userdata")
734 parse var userdata SMBObj.udatatype '|' SMBObj.udatamsg
735 SMBObj.udatatype = strip(SMBObj.udatatype)
736 SMBObj.udatamsg = strip(SMBObj.udatamsg)
737
738 if options.!debug == 1 then do
739 say ' Handle: "'SMBObj.rh'"'
740 say ' GParentrh "'SMBObj.gparentrh'"'
741 say ' Resource: "'SMBObj.resname'"'
742 say ' Comment: "'SMBObj.comment'"'
743 say ' Type: "'SMBObj.udatatype'"'
744 say ' Message: "'SMBObj.udatamsg'"'
745 say ' Icon: "'SMBObj.icon'"'
746 end
747
748 if options.!debug == 1 then say time()' _GetSMBObjectProperties done'
749return
750
751/*:VRX _GetSMBObjectShares
752*/
753_GetSMBObjectShares: procedure expose samba. options. SMBObj.
754 /* Purpose: Return stem with shares for a given Object (as handle) */
755
756 rh = arg(1)
757
758 SmbObj.shares. = ''
759 SmbObj.shares.0 = 0
760 I = 0
761 ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
762
763 do J = 1 to rh.0 /* populate shares with valid entries */
764 Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Userdata")
765 ResName = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Caption")
766 ParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Parent")
767
768 parse var ResName ResName '0D0A'x .
769 ResName = strip(ResName)
770 parse var userdata ResType '|' .
771
772 if ParentRH = rh then do /* we found a share belonging to our server */
773 if ResType = "DISK" then do
774 I = I + 1
775 SmbObj.shares.I = ResName
776 end
777 end
778 end
779 SmbObj.shares.0 = I
780return
781
782/*:VRX _GUIInit
783*/
784_GUIInit:
785 if options.!debug == 1 then say time()' _GUIInit started'
786 CALL VRSet 'Main', 'HelpFile', settings.!helpfile
787
788 /* Main Window */
789 CALL NLVSetText 'Main', "Caption", 1
790
791 CALL NLVSetText 'Menu_File', "Caption", 80
792 CALL NLVSetText 'Menu_Context', "Caption", 81
793 CALL NLVSetText 'Menu_Selected', "Caption", 83
794 CALL NLVSetText 'Menu_Help', "Caption", 84
795
796 CALL NLVSetText 'Menu_File_LOAD', "Caption", 31
797 CALL NLVSetText 'Menu_File_SAVE', "Caption", 30
798 CALL NLVSetText 'Menu_File_LMHosts_Reset', "Caption", 127
799 CALL NLVSetText 'Menu_File_ucCred_Reset', "Caption", 128
800 CALL NLVSetText 'Menu_File_Autostart', "Caption", 35
801 CALL NLVSetText 'Menu_File_Autostart_Activate', "Caption", 76
802 CALL NLVSetText 'Menu_File_Autostart_Deactivate', "Caption", 77
803 CALL NLVSetText 'Menu_File_Daemon', "Caption", 126
804 CALL NLVSetText 'Menu_File_Daemon_Start', "Caption", 76
805 CALL NLVSetText 'Menu_File_Daemon_Stop', "Caption", 77
806 CALL NLVSetText 'Menu_File_CLOSE', "Caption", 29
807
808 CALL NLVSetText 'Menu_Context_DETACH', "Caption", 11
809 CALL NLVSetText 'Menu_Context_DETACH_ALL', "Caption", 120
810 CALL NLVSetText 'Menu_Context_REFRESH', "Caption", 38
811 CALL NLVSetText 'Menu_Context_UNMOUNT', "Caption", 12
812 CALL NLVSetText 'Menu_Context_EDIT', "Caption", 32
813 CALL NLVSetText 'Menu_Context_OPEN', "Caption", 94
814 CALL NLVSetText 'Menu_Context_OPEN_ICON', "Caption", 95
815 CALL NLVSetText 'Menu_Context_OPEN_TREE', "Caption", 96
816 CALL NLVSetText 'Menu_Context_OPEN_DETAIL', "Caption", 97
817 CALL NLVSetText 'Menu_Context_OPEN_SETTINGS', "Caption", 98
818 CALL NLVSetText 'Menu_Context_OPEN_SPLITVIEW', "Caption", 99
819
820 CALL NLVSetText 'Menu_Selected_Connect', "Caption", 28
821 CALL NLVSetText 'Menu_Selected_Remove', "Caption", 12
822 CALL NLVSetText 'Menu_Selected_Retry', "Caption", 90
823 CALL NLVSetText 'Menu_Selected_Info', "Caption", 92
824 CALL NLVSetText 'Menu_Selected_TimeSync', "Caption", 129
825 CALL NLVSetText 'Menu_Selected_Refresh', "Caption", 38
826 CALL NLVSetText 'Menu_Selected_Default_Workgroup',"Caption", 75
827
828 CALL NLVSetText 'Menu_Help_Extended', "Caption", 4
829 CALL NLVSetText 'Menu_Help_About', "Caption", 91
830
831 /* Left pane */
832 CALL NLVSetText 'DT_CURRENT', "Caption", 10
833 CALL NLVSetText 'PB_DETACH', "Caption", 11
834 CALL NLVSetText 'PB_UNMOUNT', "Caption", 12
835
836 /* Dialog window */
837 CALL NLVSetText 'DT_MOUNT', "Caption", 14
838 CALL NLVSetText 'DT_SERVER', "Caption", 19
839 CALL NLVSetText 'DT_SHARE', "Caption", 20
840 CALL NLVSetText 'DT_NETWORK', "Caption", 21
841 CALL NLVSetText 'CHK_MTYPE', "Caption", 23
842 CALL NLVSetText 'DT_USER', "Caption", 25
843 CALL NLVSetText 'DT_PASSWORD', "Caption", 26
844 CALL NLVSetText 'DT_MPOINT', "Caption", 27
845 CALL NLVSetText 'PB_MOUNT', "Caption", 28
846 CALL NLVSetText 'PB_EDIT_CANCEL', "Caption", 3
847 CALL NLVSetText 'PB_DIALOG_HELP', "Caption", 4
848 CALL NLVSetText 'PB_CLEARCRED', "Caption", 89
849
850 IF (mtype.1 \= '' & mtype.2 \= '' & mtype.3 \= '' & mtype.4 \= '') THEN DO
851 CALL VRMethod CB_MOUNT, 'Clear'
852 CALL VRMethod CB_MOUNT, 'AddStringList', 'mtype.'
853 END
854
855 if (mtype.1 = '' & mtype.2 = '' & mtype.3 = '' & mtype.4 = '') THEN DO /* we do not seem to have an NLV file */
856 /* we fill the array with the list predefined directly in the GUI control */
857 ok = VRMethod( "CB_MOUNT", "GetStringList", "mtype." )
858 end
859
860 /* SMBTree */
861 CALL NLVSetText 'PB_SMBTREE_CONNECT', "Caption", 28
862 CALL NLVSetText 'PB_SMBTREE_REFRESH', "Caption", 38
863 CALL NLVSetText 'PB_SMBTREE_HELP', "Caption", 4
864 CALL NLVSetText 'CN_SMBTREE', "Caption",140
865
866/** Use AutoSize property instead
867 ok = VRSet("Pict_Throbber","Width", VRMethod( "Screen", "PixelsToTwips", 32 ))
868 ok = VRSet("Pict_Throbber","Height", VRMethod( "Screen", "PixelsToTwips", 32 ))
869**/
870 /* Condet */
871 CALL NLVSetText 'PB_CONDET_SAVE', "Caption", 30
872 CALL NLVSetText 'PB_CONDET_LOAD', "Caption", 31
873 CALL NLVSetText 'PB_CONDET_HELP',"Caption", 4
874
875 /* Statusbar */
876 ok = VRSet("DT_STATUSBAR", "Caption", VRGet("Main", "HintText"))
877
878 /* Common margin around controls */
879 margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
880
881 smbwait = "#50"
882
883 if options.!debug == 1 then say time()' _GUIInit done'
884return
885
886/*:VRX _INILoad
887*/
888_INILoad:
889 if options.!debug == 1 then say time()' _INILoad started'
890
891 /* Locate the profile */
892 os2_ini = VALUE('USER_INI',,'OS2ENVIRONMENT')
893 inipath = VRParseFilePath( os2_ini, 'DP')
894 IF inipath == '' THEN inipath = SysBootDrive() || '\OS2'
895 settings.!ini = inipath'\'options.!appname_short'.INI'
896 drop os2_ini inipath
897 if options.!debug == 1 then say ' 'options.!appname_long' INIfile = "'settings.!ini'"'
898
899 settings.!network = ""
900 /* Create default smb.conf if none exists */
901 if \VRFileExists( samba.!smbconf ) then call _CreateSmbConf
902
903 say _ucInitObj()
904 say _ucChkObj()
905
906 IF STREAM( settings.!ini, 'C', 'QUERY EXISTS') == '' THEN DO
907 /* First start */
908 if options.!debug == 1 then say " First start!"
909
910 advanced.!browseauth = 0
911 advanced.!browseimme = 1
912 advanced.!broadcast = 0
913 advanced.!special = 0
914 advanced.!savepassive= 0
915 advanced.!lmhosts = 1
916
917 advanced.!miniicons = 0
918
919 advanced.!easupport = 1
920 advanced.!Kerberos5FH = 0
921 advanced.!ntlmv1FH = 1
922 advanced.!encryptionFH = 0
923 advanced.!readonly = 0
924 advanced.!alwaysmp = 0
925 advanced.!cachetimeout = 10
926 advanced.!cachelistings = 32
927
928 CALL VRSet "Main", 'Height', 7576
929 CALL VRSet "Main", 'Width', 8200
930 CALL VRSet "SPLIT_MAIN", 'Left', 2915
931 CALL VRMethod "Main", 'CenterWindow'
932 call VRSet 'Main', 'Visible', 1
933 call Main_Resize
934 END
935 ELSE DO
936 /* Subsequent start */
937 /* Load window position settings */
938 settings.!x = VRGetIni('Settings', 'X', settings.!ini, 'NoClose')
939 settings.!y = VRGetIni('Settings', 'Y', settings.!ini, 'NoClose')
940 settings.!h = VRGetIni('Settings', 'H', settings.!ini, 'NoClose')
941 settings.!w = VRGetIni('Settings', 'W', settings.!ini, 'NoClose')
942 settings.!s = VRGetIni('Settings', 'S', settings.!ini, 'NoClose')
943
944 IF settings.!x == '' THEN settings.!x = -1
945 IF settings.!y == '' THEN settings.!y = -1
946 IF settings.!h == '' THEN settings.!h = -1
947 IF settings.!w == '' THEN settings.!w = -1
948 IF settings.!s == '' THEN settings.!s = -1
949
950 /* Titlebar settings */
951 settings.!curbcolor = VRGetIni('Settings', 'TitleBarBackground', settings.!ini, 'NoClose')
952 settings.!curfcolor = VRGetIni('Settings', 'TitleBarForeground', settings.!ini, 'NoClose')
953 IF (settings.!curbcolor = '' | settings.!curbcolor = '<default>') THEN settings.!curbcolor = 'SystemActiveTitle'
954 IF (settings.!curfcolor = '' | settings.!curfcolor = '<default>') THEN settings.!curfcolor = 'SystemActiveTitleText'
955
956 /* Load font settings */
957 IF VRFileExists( SysBootDrive() || '\OS2DBCS') == 1
958 THEN default_font = '9.WarpSans Combined'
959 ELSE default_font = '9.WarpSans'
960
961 settings.!cfont = VRGetIni('Settings', 'ContainerFont', settings.!ini, 'NoClose')
962 settings.!wfont = VRGetIni('Settings', 'WindowFont', settings.!ini, 'NoClose')
963 IF settings.!cfont == '' THEN settings.!cfont = default_font
964 IF settings.!wfont == '' THEN settings.!wfont = default_font
965
966 /* Current page */
967 settings.!curpage = VRGetIni('Settings', 'CurrentPage', settings.!ini, 'NoClose')
968 IF settings.!curpage == '' THEN settings.!curpage = 1
969
970 /* Global settings */
971 advanced.!browseauth = VRGetIni('Settings', 'BrowseAuth', settings.!ini, 'NoClose')
972 advanced.!browseimme = VRGetIni('Settings', 'BrowseImme', settings.!ini, 'NoClose')
973 advanced.!broadcast = VRGetIni('Settings', 'Broadcast', settings.!ini, 'NoClose')
974 advanced.!special = VRGetIni('Settings', 'SpecialShares', settings.!ini, 'NoClose')
975 advanced.!savepassive= VRGetIni('Settings', 'SavePassive', settings.!ini, 'NoClose')
976 advanced.!lmhosts = VRGetIni('Settings', 'LMHosts', settings.!ini, 'NoClose')
977 advanced.!miniicons = VRGetIni('Settings', 'MiniIcons', settings.!ini, 'NoClose')
978
979 advanced.!easupport = VRGetIni('Settings', 'EAS', settings.!ini, 'NoClose')
980 advanced.!readonly = VRGetIni('Settings', 'ReadOnly', settings.!ini, 'NoClose')
981 advanced.!alwaysmp = VRGetIni('Settings', 'AlwaysMP', settings.!ini, 'NoClose')
982 advanced.!cachetimeout = VRGetIni('Settings', 'CacheTimeOut', settings.!ini, 'NoClose')
983 advanced.!cachelistings = VRGetIni('Settings', 'CacheListings',settings.!ini, 'NoClose')
984
985 IF advanced.!browseauth == '' THEN advanced.!browseauth = 0
986 IF advanced.!browseimme == '' THEN advanced.!browseimme = 1
987 IF advanced.!broadcast == '' THEN advanced.!broadcast = 0
988 IF advanced.!special == '' THEN advanced.!special = 0
989 IF advanced.!savepassive== '' THEN advanced.!savepassive= 0
990 IF advanced.!lmhosts == '' THEN advanced.!lmhosts = 1
991
992 options.!storecreds = VRGetIni('Settings', 'StoreCreds', settings.!ini, 'NoClose')
993say "options.!storecreds = "options.!storecreds
994 IF options.!storecreds == '' then options.!storecreds = 1
995
996say "options.!storecreds = "options.!storecreds
997 IF _ucChkObj() = 0 then options.!storecreds = 0
998say "options.!storecreds = "options.!storecreds
999
1000 options.!tracmark = VRGetIni('Settings', 'TracMarkup', settings.!ini, 'NoClose')
1001 options.!debug = VRGetIni('Settings', 'Debug', settings.!ini)
1002 IF options.!debug == '' THEN options.!debug = 0 /* Turn off debug by default for release builds */
1003 if options.!debug == 1 then ok = VRRedirectStdIO("ON")
1004 else ok = VRRedirectStdio("OFF")
1005
1006 IF advanced.!miniicons == '' THEN advanced.!miniicons = 0
1007
1008 /* Advanced */
1009 IF advanced.!easupport == '' THEN advanced.!easupport = 1
1010 IF advanced.!readonly == '' THEN advanced.!readonly = 0
1011 IF advanced.!alwaysmp == '' THEN advanced.!alwaysmp = 0
1012 IF advanced.!cachetimeout == '' THEN advanced.!cachetimeout = 10
1013 IF advanced.!cachelistings == '' THEN advanced.!cachelistings = 32
1014
1015 /* Apply the settings */
1016 ok = VRSet("DT_CURRENT","BACKCOLOR", settings.!curbcolor )
1017 ok = VRSet("DT_CURRENT","FORECOLOR", settings.!curfcolor )
1018
1019 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
1020 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
1021 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
1022
1023 IF ( settings.!x >= 0 ) & ( settings.!y >= 0 ) & ( settings.!l >= 0 ) & ( settings.!w >= 0 ) & ( settings.!s >= 0 ) THEN DO
1024 CALL VRSet VRWindow(), 'Left', settings.!x
1025 CALL VRSet VRWindow(), 'Top', settings.!y
1026 CALL VRSet VRWindow(), 'Height', settings.!h
1027 CALL VRSet VRWindow(), 'Width', settings.!w
1028 CALL VRSet "SPLIT_MAIN", 'Left', settings.!s
1029 END
1030 ELSE CALL VRMethod VRWindow(), 'CenterWindow'
1031
1032 CALL VRSet "CN_CURRENT", 'Font', settings.!cfont
1033 CALL VRSet "CN_CONDET", 'Font', settings.!cfont
1034 CALL VRSet "CN_SMBTREE", 'Font', settings.!cfont
1035
1036 CALL VRSet 'Main', 'Font', settings.!wfont
1037 CALL VRSet 'Main', 'StatusFont', settings.!wfont
1038
1039 ok = VRSet("TDL_1","Selected", settings.!curpage)
1040 END
1041
1042 if options.!nogui == 1 then CALL VRLoadSecondary "SW_PROGRESS","W"
1043 else do
1044 if options.!delay > 0 then do
1045 /* Set mouse pointer to wait - this operation might take a few seconds */
1046 call VRSet VRWindow(), 'Pointer', 'Wait'
1047 call Main_Resize
1048 ok = SysSleep(options.!delay)
1049 options.!delay = 0
1050 /* Set mouse pointer to default again */
1051 call VRSet VRWindow(), 'Pointer', '<default>'
1052 end
1053 end
1054
1055 /* Look for usable credentials */
1056 if options.!storecreds = 1 & _ucChkUc() then do
1057 UserCred = _ucGetUc()
1058 parse var UserCred '--user='Credentials.!username'%'Credentials.!password
1059 if left(Credentials.!password,1)='%' then Credentials.!password = substr(Credentials.!password,2)
1060 ok = VRSet("EF_USER", "Value",Credentials.!username)
1061 ok = VRSet("EF_PASSWORD","Value",Credentials.!password)
1062 ok = VRSet("CN_SMBTREE","Caption",VRGet("CN_SMBTREE","Caption")||": "Credentials.!username)
1063 end
1064 else ok = VRSet("CN_SMBTREE","Caption",VRGet("CN_SMBTREE","Caption")||": Guest")
1065
1066 /* SambaInit.VRS needs these 2 */
1067 ShowHidden = advanced.!special
1068 Broadcast = advanced.!broadcast
1069
1070 /* in non debug versions this is normally not visible */
1071 if options.!debug == 1 then say ' NLV MessageFile = "'settings.!messages'"'
1072 if options.!debug == 1 then say ' NLV HelpFile = "'settings.!helpfile'"'
1073
1074 if options.!debug == 1 then say time()' _INILoad done'
1075RETURN
1076
1077/*:VRX _INISave
1078*/
1079_INISave: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba.
1080 if options.!debug == 1 then say time()' '||"SaveSettings started"
1081
1082 if advanced.!savepassive then call _PassiveSave
1083
1084/* This does not make sense anymore
1085 settings.!network = VRGet("EF_NETWORK","Value")
1086 CALL VRSetIni 'Settings', 'Network', settings.!network, settings.!ini, 'NoClose'
1087 */
1088
1089 font = VRGet("CN_CURRENT", 'Font')
1090 CALL VRSetIni 'Settings', 'ContainerFont', font, settings.!ini, 'NoClose'
1091
1092 font = VRGet('Main', 'Font')
1093 CALL VRSetIni 'Settings', 'WindowFont', font, settings.!ini, 'NoClose'
1094
1095 settings.!curbcolor = VRGet("DT_CURRENT","BackColor")
1096 CALL VRSetIni 'Settings', 'TitleBarBackground', settings.!curbcolor, settings.!ini, 'NoClose'
1097
1098 settings.!curfcolor = VRGet("DT_CURRENT","ForeColor")
1099 CALL VRSetIni 'Settings', 'TitleBarForeground', settings.!curfcolor, settings.!ini, 'NoClose'
1100
1101 /* Global options */
1102 CALL VRSetIni 'Settings', 'BrowseAuth', advanced.!browseauth , settings.!ini, 'NoClose'
1103 CALL VRSetIni 'Settings', 'BrowseImme', advanced.!browseimme , settings.!ini, 'NoClose'
1104 CALL VRSetIni 'Settings', 'Broadcast', advanced.!broadcast , settings.!ini, 'NoClose'
1105 CALL VRSetIni 'Settings', 'SpecialShares', advanced.!special , settings.!ini, 'NoClose'
1106 CALL VRSetIni 'Settings', 'SavePassive', advanced.!savepassive, settings.!ini, 'NoClose'
1107 CALL VRSetIni 'Settings', 'LMHosts', advanced.!lmhosts , settings.!ini, 'NoClose'
1108
1109 CALL VRSetIni 'Settings', 'StoreCreds', options.!storecreds , settings.!ini, 'NoClose'
1110 CALL VRSetIni 'Settings', 'Debug', options.!debug , settings.!ini, 'NoClose'
1111 CALL VRSetIni 'Settings', 'MiniIcons', advanced.!miniicons , settings.!ini, 'NoClose'
1112 CALL VRSetIni 'Settings', 'TracMarkup', options.!tracmark , settings.!ini, 'NoClose'
1113
1114 /* Advanced */
1115 CALL VRSetIni 'Settings', 'EAS', advanced.!easupport , settings.!ini, 'NoClose'
1116 CALL VRSetIni 'Settings', 'ReadOnly', advanced.!readonly , settings.!ini, 'NoClose'
1117 CALL VRSetIni 'Settings', 'AlwaysMP', advanced.!alwaysmp , settings.!ini, 'NoClose'
1118 CALL VRSetIni 'Settings', 'CacheTimeOut', advanced.!cachetimeout , settings.!ini, 'NoClose'
1119 CALL VRSetIni 'Settings', 'CacheListings', advanced.!cachelistings, settings.!ini, 'NoClose'
1120
1121 /* Current page */
1122 settings.!curpage = VRget("TDL_1","Selected")
1123 CALL VRSetIni 'Settings', 'CurrentPage', settings.!curpage , settings.!ini, 'NoClose'
1124
1125 /* Save position and size */
1126 settings.!l = VRGet("Main", 'Left' )
1127 settings.!t = VRGet("Main", 'Top' )
1128 settings.!h = VRGet("Main", 'Height')
1129 settings.!w = VRGet("Main", 'Width' )
1130 settings.!s = VRGet("SPLIT_Main", 'Left' )
1131
1132 CALL VRSetIni 'Settings', 'X', settings.!l, settings.!ini, 'NoClose'
1133 CALL VRSetIni 'Settings', 'Y', settings.!t, settings.!ini, 'NoClose'
1134 CALL VRSetIni 'Settings', 'H', settings.!h, settings.!ini, 'NoClose'
1135 CALL VRSetIni 'Settings', 'W', settings.!w, settings.!ini, 'NoClose'
1136 CALL VRSetIni 'Settings', 'S', settings.!s, settings.!ini
1137
1138 if options.!debug == 1 then say time()' '||"SaveSettings done"
1139RETURN
1140
1141/*:VRX _isValidIPAddress
1142*/
1143_isValidIPAddress: procedure
1144 ipaddr = arg(1)
1145 d. = ''
1146 d.0 = 4
1147 fail = 0
1148 parse var ipaddr d.1 '.' d.2 '.' d.3 '.' d.4
1149 do I = 1 to 4
1150 if datatype(d.I) = 'NUM' then do
1151 if d.I < 0 | d.I > 255 then fail = 1
1152 end
1153 else fail = 1
1154 if fail = 1 then leave
1155 end
1156return(\fail)
1157
1158/*:VRX _LMHostsRead
1159*/
1160_LMHostsRead:
1161 ok = file2stem(samba.!lmhosts,'lmhosts.', 'NoDel')
1162 lmname. = "#"
1163 lmapp. = ""
1164 lmname.0 = lmhosts.0
1165 lmip.0 = lmhosts.0
1166 lmapp.0 = lmhosts.0
1167 do I = 1 to lmhosts.0
1168 if left(lmhosts.I,1) = "#" then iterate
1169 parse var lmhosts.I lmip.I ' ' lmname.I '#' lmapp.I
1170 lmip.I = strip(lmip.I)
1171 lmname.I = strip(lmname.I)
1172 if lmapp.I <> "" & left(lmapp.I,1) <> '#' then lmapp.I = '#'lmapp.I
1173 end
1174 drop lmhosts.
1175return
1176
1177/*:VRX _LMHostsReset
1178*/
1179_LMHostsReset:
1180 ok = SysFileDelete(samba.!lmhosts)
1181
1182 Buttons.1 = NLVGetMessage(2)
1183 Buttons.0 = 1
1184 if ok = 0 then do
1185 id = VRMessage( VRWindow(), NLVGetMessage(118,samba.!lmhosts), NLVGetMessage(127), "Information", "Buttons.", 1, 1 )
1186 end
1187 else do
1188 id = VRMessage( VRWindow(), samba.!lmhosts', RC = 'ok, NLVGetMessage(127), "Error", "Buttons.", 1, 1 )
1189 end
1190return
1191
1192/*:VRX _LMHostsUpdate
1193*/
1194_LMHostsUpdate:
1195 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Visible", "rh." )
1196 do I = 1 to rh.0
1197 call _GetSMBObjectProperties rh.I
1198 if SMBObj.udatatype = "SERVER" then do
1199 IP = VRMethod("CN_SMBTREE","GetFieldData",rh.I, IPFH )
1200 Role = VRMethod("CN_SMBTREE","GetFieldData",rh.I, MBFH )
1201 parse var IP T1 '.' T2 '.' T3 '.' T4
1202 if datatype(T1) = "NUM" & datatype(T2) = "NUM" & datatype(T3) = "NUM" & datatype(T4) = "NUM" then do
1203 FoundName = 0
1204 /* Don't add localhost and local link IP to LMHosts */
1205 if T1 = '127' & T2 = '0' & T3 = '0' & T4 = '1' then iterate
1206 if T1 = '169' & T2 = '254' then iterate
1207 do J = 1 to lmname.0 /* machine already in LMHosts? */
1208 if lmname.J = SmbObj.resname then do /* Yes? then update IP */
1209 lmip.J = IP
1210 if pos('PDC',Role) > 0 & SMBObj.parentrh <> "" then do
1211 Domain = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
1212 lmapp.J = "#DOM:"Domain
1213 end
1214 FoundName = 1
1215 leave
1216 end
1217 end
1218 if FoundName = 0 then do /* New machine for LMhosts - add it */
1219 new = lmname.0 + 1
1220 lmname.0 = new
1221 lmname.new = SmbObj.resname
1222 lmip.0 = new
1223 lmip.new = IP
1224 end
1225 end
1226 end
1227 end
1228 ok = SysFileDelete(samba.!lmhosts)
1229 call lineout samba.!lmhosts,'# Created by 'translate(VRParseFilename(settings.!ini,'N'))' Version 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
1230 call lineout samba.!lmhosts,'# Syntax:'
1231 call lineout samba.!lmhosts,left('# IP-address',25)||left('NetBIOS-name',16)' [Role]'
1232 do I = 1 to lmname.0
1233 if left(lmname.I,1) = "#" then iterate
1234 call lineout samba.!lmhosts,left(lmip.I,25)||left(lmname.I,16)' 'lmapp.I
1235 end
1236 ok = stream(samba.!lmhosts,'c','close')
1237return
1238
1239/*:VRX _LMHostsWrite
1240*/
1241_LMHostsWrite:
1242
1243return
1244
1245/*:VRX _LoadOtherFuncs
1246*/
1247_LoadOtherFuncs:
1248 IF options.!debug == 1 then say time()' _LoadotherFuncs() started'
1249 SIGNAL ON SYNTAX
1250
1251 call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
1252 call SysLoadFuncs
1253
1254 call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
1255 call IniLoadFuncs
1256
1257 call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
1258 call PRLoadFuncs
1259
1260 call RxFuncAdd 'RxuInit', 'RXU', 'RxuInit'
1261 call RxuInit
1262
1263 SIGNAL OFF SYNTAX
1264 IF options.!debug == 1 then say time()' _LoadotherFuncs() done'
1265return
1266
1267SYNTAX:
1268 IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler entered.'
1269 Fatal = 1
1270 parse source . . InVXIDE
1271 if left(InVXIDE,length(Tempdir)+5) = TempDir||'__tmp'
1272 then xxx = "VX-REXX IDE: "strip(translate(word(sourceline(SIGL-1),4),' ',"',"))
1273 else xxx = 'A'
1274 call VRMessage 'Main', xxx' REXX function library DLL is missing or unloadable!', options.!appname_long "fatal error", "E"
1275 IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler finished, program will be terminated.'
1276signal Quit
1277
1278/*:VRX _ParseCommandLine
1279*/
1280_ParseCommandLine:
1281 if options.!debug == 1 then say time()' _ParseCommandLine() started'
1282 CmdLine = VRGet("Application","Commandline")
1283 upCmdLine = translate(CmdLine)
1284 if options.!debug == 1 then say ' Commandline = "'CmdLine'"'
1285
1286 ForceNDFS = 0
1287 if wordpos('-NDFS',upCmdLine) > 0 then do
1288 if options.!debug == 1 then say " NDFS switch detected"
1289 CmdLine = delWord(CmdLine,wordpos('-NDFS',upCmdLine),1)
1290 upCmdLine = translate(CmdLine)
1291 ForceNDFS = 1
1292 CALL VRSet "Menu_File_Autostart","Visible", 0
1293 end
1294
1295 if wordpos('-AUTOCLOSE',upCmdLine) > 0 then do
1296 options.!autoclose = 1
1297 if options.!debug == 1 then say " AutoClose switch detected"
1298 CmdLine = delWord(CmdLine,wordpos('-AUTOCLOSE',upCmdLine),1)
1299 upCmdLine = translate(CmdLine)
1300 end
1301 if wordpos('-NOGUI',upCmdLine) > 0 then do
1302 options.!nogui = 1
1303 options.!autoclose = 1
1304 if options.!debug == 1 then say " -NOGUI switch detected"
1305 CmdLine = delWord(CmdLine,wordpos('-NOGUI',upCmdLine),1)
1306 upCmdLine = translate(CmdLine)
1307 end
1308
1309 if wordpos('-TIMESYNC',upCmdLine) > 0 then do
1310 options.!timesync = 1
1311 if options.!debug == 1 then say " -TIMESYNC switch detected"
1312 dwpos = wordpos('-TIMESYNC',upCmdLine)
1313 if dwpos = words(upCmdLine) then do /* TIMESYNC was last parm - assume automatic */
1314 options.!timesrv = ""
1315 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
1316 end
1317 else do
1318 options.!timesrv = word(upCmdLine,dwpos+1)
1319 if left(options.!timesrv,1) = "-" then do /* other parameter detected */
1320 options.!timesrv = ""
1321 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
1322 end
1323 else do /* seems we have a timeserver - IP or name - no further check */
1324 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),2)
1325 end
1326 end
1327 upCmdLine = translate(CmdLine)
1328 end
1329
1330 if wordpos('-DELAY',upCmdLine) > 0 then do
1331 if options.!debug == 1 then say " DELAY switch detected"
1332 dwpos = wordpos('-DELAY',upCmdLine)
1333 if dwpos = words(upCmdLine) then do /* DELAY was last parm - assume 60 seconds */
1334 options.!delay = 60
1335 CmdLine = delWord(CmdLine,dwpos,1)
1336 end
1337 else do
1338 options.!delay = word(upCmdLine,dwpos+1)
1339 if datatype(options.!delay) <> "NUM" then do /* No number of seconds specified */
1340 options.!delay = 60
1341 CmdLine = delWord(CmdLine,dwpos,1)
1342 end
1343 else do
1344 CmdLine = delWord(CmdLine,dwpos,2)
1345 end
1346 end
1347 upCmdLine = translate(CmdLine)
1348 if options.!debug == 1 then say " DELAY set to "options.!delay" seconds."
1349 end
1350
1351 Profile = strip(CmdLine,,'"')
1352 if Profile <> "" then do
1353 Profile = strip(VRParseFilename(Profile,"DPNE"))
1354 options.!autoload = 1
1355 if options.!debug == 1 then say ' Profile = "'Profile'"'
1356 if \VRFileExists(Profile) then do
1357 CALL VRMessage 'Main', NLVGetMessage( 102, Profile ), NLVGetMessage( 1 ), 'E'
1358 /* Disable all switches in case of an error */
1359 options.!autoload = 0
1360 options.!autoclose = 0
1361 options.!nogui = 0
1362 options.!delay = 0
1363 end
1364 end
1365 if options.!debug == 1 then say time()' _ParseCommandLine done'
1366return
1367
1368/*:VRX _PassiveLoad
1369*/
1370_PassiveLoad:
1371 if options.!debug == 1 then say time()' '||"_PassiveLoad started"
1372
1373 do cnt = 1 to 255
1374 resdata = VRGetIni( "PassiveConnections", cnt, settings.!ini )
1375 if resdata = "" then leave
1376
1377 parse var resdata p_mpoint resource rwFlag
1378 if options.!debug == 1 then do
1379 say ' Connection 'cnt', resdata ="'resdata'"'
1380 end
1381
1382/* vfs.!drive = FILESPEC('DRIVE', node )
1383 vfs.!mountpoint = STRIP( node, 'T', '\') */
1384
1385 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
1386 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
1387
1388 p_mpidx = ""
1389
1390 call ParseResParmString
1391
1392 p_rw = rwFlag
1393
1394 /* Create the hash string */
1395 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
1396
1397 /* A truncated, useless entry - skip it */
1398 if p_server = "" & p_share = ""& p_workgroup = "" then iterate
1399
1400 md5.cnt = rexx_md5(hashstr)
1401 md5.0 = cnt
1402
1403 /* Passive connection already restored - skip the dupe one */
1404 PassiveDupe = 0
1405 do X = 1 to md5.0-1
1406 if md5.cnt = md5.X then PassiveDupe = 1
1407 end
1408 if PassiveDupe = 1 then iterate /* do not add record for a duplicate passive connection */
1409
1410 /* Everything is ok, let's add a new entry */
1411 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
1412
1413 /* Fill columns now */
1414 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint)
1415 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpidxfh, p_mpidx)
1416 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.workgrpFH , p_workgroup)
1417 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.serverfh, p_server)
1418 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.sharefh, p_share)
1419 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.userfh, p_user)
1420 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password)
1421 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.spasswordfh, p_spassword)
1422 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout)
1423 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.cldFH, p_cachelistings)
1424 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.masterfh, p_master)
1425 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mtypefh, p_mtype)
1426 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.easupportfh, p_easupport)
1427 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.rwfh, p_rw)
1428 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh, md5.cnt)
1429 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive)
1430 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive)
1431
1432/* Obsolete fields:
1433 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen)
1434 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.logfilefh, p_logfile)
1435 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.loglevelfh, p_loglevel) */
1436 end
1437 if options.!debug == 1 then say time()' '||"_PassiveLoad done"
1438return
1439/*:VRX _PassiveSave
1440*/
1441_PassiveSave:
1442 if options.!debug == 1 then say time()' '||"_PassiveSave started"
1443 ok = VRDelIni( "PassiveConnections", "ALL", settings.!ini )
1444
1445 ok = SysIni(settings.!ini, 'PassiveConnections', 'DELETE:')
1446
1447 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
1448 cnt = 0
1449 DO i = 1 TO records.0
1450
1451 if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!passive then do
1452 cnt = cnt + 1
1453 resdata = ""
1454 resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
1455 resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
1456 resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
1457 resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
1458 resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
1459 resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
1460 resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
1461 resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
1462 resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
1463 resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
1464 resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
1465 resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
1466 resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
1467/* resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
1468 resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
1469 resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
1470 resdata = resdata||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
1471 resdata = resdata||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
1472 resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
1473 resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
1474 ok = VRSetIni( "PassiveConnections", cnt, resdata, settings.!ini )
1475 END
1476 else iterate
1477 end
1478 if options.!debug == 1 then say time()' '||"_PassiveSave done"
1479return
1480
1481/*:VRX _PrinterInfo
1482*/
1483_PrinterInfo:
1484 if \_SMBpdrInstalled() then do
1485 /* SMB.PDR is not installed */
1486 CALL VRMessage 'Main', NLVGetMessage( 104 ), NLVGetMessage( 5 ), 'E'
1487 end
1488 else do /* SMB.pdr is installed */
1489 /* shared queue name */
1490 p_printer = SMBObj.resname
1491
1492 /* printer server */
1493 capt = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
1494 parse var Capt p_prtsrv '0D0A'x .
1495 p_prtsrv = strip(p_prtsrv)
1496
1497 /* workgroup of the printer server */
1498 Gparrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
1499 capt = VRMethod("CN_SMBTREE", "GetRecordAttr", GParrh, "Caption")
1500 parse var Capt p_workgroup '0D0A'x .
1501
1502 /* This is the string we will find in case this resource is already connected */
1503 DescStr = translate(p_prtsrv'#'p_printer'#'p_workgroup'#')
1504 say '"'DescStr'"'
1505 LDescStr = length(DescStr)
1506
1507 /* Enumerate all SMB ports */
1508 ok = SysIni('SYSTEM','PM_SPOOLER_PORT',"All:",'ports')
1509 if ports.0 = 0 then do
1510 /* No SMB ports installed */
1511 CALL VRMessage 'Main', NLVGetMessage( 105 ), NLVGetMessage( 5 ), 'E'
1512 end
1513 else do
1514 /* At least 1 SMB port was found - lets check whether it is already connected to our resource */
1515 FoundPort = 0
1516 do I = 1 to ports.0
1517 if left(ports.i,3) = 'SMB' then do
1518 say ports.I
1519 say translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr))
1520 say DescStr
1521 if translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr)) = DescStr then do
1522 OurPort = ports.I
1523 FoundPort = 1
1524 leave
1525 end
1526 end
1527 end
1528 say 'OurPort = "'OurPort'"'
1529 if Foundport then do
1530 ok = SysIni('SYSTEM','PM_SPOOLER_PRINTER',"All:",'printer')
1531 FoundPrinter = 0
1532 do I = 1 to printer.0
1533 prtsummary = SysINi('SYSTEM','PM_SPOOLER_PRINTER',printer.i)
1534 parse var prtsummary port ';'PrinterDriver';'PrinterQueue';' .
1535 say printer.I' 'prtsummary
1536 if port = ourPort then do
1537 PrinterName = SysINi('SYSTEM','PM_SPOOLER_PRINTER_DESCR',printer.i)
1538 parse var Printername Printername ';' .
1539 CALL VRMessage 'Main', PrinterName' ('PrinterQueue') prints to port ' Port' connected to \\'p_workgroup'\'p_prtsrv'\'p_printer, NLVGetMessage( 1 ), 'I'
1540 FoundPrinter = 1
1541 leave
1542 end
1543 end
1544 if FoundPrinter = 0 then do
1545 /* Port installed and configured, but not used by any printer */
1546 CALL VRMessage 'Main', NLVGetMessage( 106 ), NLVGetMessage( 5 ), 'E'
1547 end
1548 end
1549 else do
1550 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1551 end
1552 end
1553 end
1554return
1555
1556/*:VRX _ShowMsg
1557*/
1558_ShowMsg:
1559 /* preliminary implementation - we just do not ignore it anymore -
1560 - ShowMsg from smbmon/smbusers should become a shared library */
1561 ok = VRSet("DT_StatusBar", "Caption", Msg.Text)
1562return
1563
1564/*:VRX _SmbConfCreateShadowCopy
1565*/
1566_SmbConfCreateShadowCopy:
1567 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy started'
1568 /* we create a complete version of smb.conf in temporary directory for reading purposes */
1569 /* as we can only determine a default value from this complete version of the file */
1570 /* however it is not desirable to always have a complete copy normally */
1571 ok = SysFileDelete(samba.!shadowsmbconf)
1572 if datatype(log_level) <> "NUM" then log_level = 2
1573 say ' 'samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1574 address cmd samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1575 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy done'
1576return
1577
1578/*:VRX _SMBpdrInstalled
1579*/
1580_SMBpdrInstalled: procedure
1581 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
1582return (ok <> "")
1583
1584/*:VRX _StemsInit
1585*/
1586_StemsInit:
1587 if options.!debug == 1 then say time()' _StemsInit started'
1588 if options.!debug == 1 then say ' initializing options.'
1589 options.!workgroup = ''
1590 options.!server = ''
1591 options.!share = ''
1592 options.!user = ''
1593 options.!password = ''
1594 options.!spassword = ''
1595 options.!master = ''
1596 options.!mastertype = ''
1597 options.!memlen = '2'
1598 options.!cachetimeout = '10'
1599 options.!cachelistings = '32'
1600 options.!easupport = '1'
1601 options.!readonly = ''
1602 options.!loglevel = 0
1603 options.!logfile = ''
1604
1605 options.!autoload = 0
1606 options.!autoclose = 0
1607 options.!nogui = 0
1608 options.!autostart = 0
1609 options.!editmode = 0
1610 options.!delay = 0
1611 options.!storecreds = 0
1612 options.!timesync = 0
1613 options.!timesrv = ''
1614
1615 options.!tracmark = 0
1616
1617 app_name_msg = NLVGetMessage( 0 )
1618 IF app_name_msg == '' | WORD( app_name_msg, 1 ) == '[Missing' THEN
1619 app_name_msg = 'EVFSGUI EVFSGUI'
1620
1621 /* These values are used in things like config files, WPS objects, etc.
1622 */
1623 options.!appname_short = TRANSLATE( SUBWORD( app_name_msg, 1, 1 ))
1624 options.!appname_long = SUBWORD( app_name_msg, 2 )
1625
1626 if options.!debug == 1 then say ' initializing vfs. '
1627 vfs.!drive = ''
1628 vfs.!mountpoint = ''
1629
1630 if options.!debug == 1 then say ' initializing advanced. '
1631 advanced.!browseauth = ''
1632 advanced.!browseimme = ''
1633 advanced.!broadcast = ''
1634 advanced.!special = ''
1635 advanced.!savepassive= ''
1636 advanced.!miniicons = ''
1637
1638 advanced.!easupport = 1
1639 advanced.!readonly = ''
1640 advanced.!alwaysmp = ''
1641 advanced.!cachetimeout = '10'
1642 advanced.!cachelistings = '32'
1643
1644 advanced.!smbconfchanged = 0
1645
1646 /* Obsolete */
1647 advanced.!memlen = ''
1648 advanced.!loglevel = '0'
1649 advanced.!logfile = ''
1650
1651 if options.!debug == 1 then say ' initializing credentials. '
1652 credentials.!username = ""
1653 credentials.!password = ""
1654 credentials.!entered = 0
1655
1656 UserCred = ""
1657 RefreshMode = ""
1658
1659 if options.!debug == 1 then say ' initializing mtype. '
1660 mtype.0 = 5
1661 mtype.1 = NLVGetMessage( 15 )
1662 mtype.2 = NLVGetMessage( 16 )
1663 mtype.3 = NLVGetMessage( 17 )
1664 mtype.4 = NLVGetMessage( 18 )
1665 mtype.5 = NLVGetMessage(110 )
1666
1667 if options.!debug == 1 then say ' initializing icons. '
1668 icons.!bat = '#1:PMWP.DLL'
1669 icons.!cmd = '#2:PMWP.DLL'
1670 icons.!exe = '#3:PMWP.DLL'
1671 icons.!template = '#10:PMWP.DLL'
1672 icons.!drive = '#16:PMWP.DLL'
1673 icons.!defaultfile = '#24:PMWP.DLL'
1674 icons.!folder = '#26:PMWP.DLL'
1675 icons.!folder_open = '#34:PMWP.DLL'
1676 icons.!machine_awake = '#35:PMWP.DLL'
1677 icons.!machine_sleeping = '#61:PMWP.DLL'
1678 icons.!workgroup = '#62:PMWP.DLL'
1679 icons.!pdc = '#63:PMWP.DLL'
1680 icons.!active = '#64:PMWP.DLL'
1681 icons.!passive = '#68:PMWP.DLL'
1682 icons.!printer = '#65:PMWP.DLL'
1683 icons.!drive_inactive = '#70:PMWP.DLL'
1684 icons.!pdf = '#80'
1685 icons.!spreadsheet = '#82'
1686 icons.!textdocument = '#86'
1687 icons.!framework = '#87'
1688 icons.!image = '#88'
1689 icons.!movie = '#89'
1690 icons.!sound = '#90'
1691 icons.!warpin = '#91'
1692 icons.!zip = '#92'
1693 icons.!view = '#93'
1694 icons.!plaintext = '#94'
1695
1696 p_workgroup = "Unknown"
1697 p_server = "Unknown"
1698 p_share = "Unknown"
1699
1700 if options.!debug == 1 then say time()' _StemsInit done'
1701return
1702/*:VRX _TabbedDialogSetup
1703*/
1704_TabbedDialogSetup:
1705 if options.!debug == 1 then say time()' _TabbedDialogSetup started'
1706
1707 w = VRLoad( "TDL_1", VRWindowPath(), "SW_DIALOG" )
1708 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(13)" ")
1709 ok = VRMethod( "TDL_1", "SetStatusText", 1, NLVGetMessage(132,"1","2"))
1710 w = VRLoad( "TDL_1", VRWindowPath(), "SW_ADVANCED" )
1711 ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(40)" ")
1712 ok = VRMethod( "TDL_1", "SetStatusText", 2, NLVGetMessage(132,"2","2"))
1713
1714 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
1715 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(39)" ")
1716
1717 w = VRLoad( "TDL_1", VRWindowPath(), "SW_CONDET" )
1718 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(63)" ")
1719 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
1720 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(47)" ")
1721 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBCONF" )
1722 ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(47)" ")
1723 if options.!debug == 1 then say time()' _TabbedDialogSetup done'
1724return
1725
1726
1727/*:VRX _TabFix
1728*/
1729_TabFix:
1730 ok = VRMethod( "TDL_1", "SetTabText", arg(1), " "strip(VRMethod( "TDL_1", "GetTabText", arg(1)))" ")
1731return
1732
1733/*:VRX _TabsStrip
1734*/
1735_TabsStrip:
1736 ok = VRMethod( "TDL_1", "SetTabText", 1, strip(VRMethod( "TDL_1", "GetTabText", 1)))
1737 ok = VRMethod( "TDL_1", "SetTabText", 2, strip(VRMethod( "TDL_1", "GetTabText", 2)))
1738 ok = VRMethod( "TDL_1", "SetTabText", 3, strip(VRMethod( "TDL_1", "GetTabText", 3)))
1739 ok = VRMethod( "TDL_1", "SetTabText", 4, strip(VRMethod( "TDL_1", "GetTabText", 4)))
1740 ok = VRMethod( "TDL_1", "SetTabText", 5, strip(VRMethod( "TDL_1", "GetTabText", 5)))
1741return
1742
1743/*:VRX _TimeSync
1744*/
1745_TimeSync:
1746 if options.!debug == 1 then say time()' _TimeSync started, "'options.!timesrv'"'
1747 TimeMsg.1 = NLVGetMessage(141)' 'time()
1748 if options.!timesrv <> '' then do
1749 say ' 'samba.!netexe' time set -S 'options.!timesrv
1750 address cmd samba.!netexe' time set -S 'options.!timesrv
1751 end
1752 else do
1753 say ' 'samba.!netexe' time set'
1754 address cmd samba.!netexe' time set'
1755 end
1756 options.!timesync = ''
1757 TimeMsg.2 = NLVGetMessage(142)' 'time()
1758 TimeMsg.0 = 2
1759
1760 Buttons.1 = NLVGetMessage(2)
1761 Buttons.0 = 1
1762 id = VRMessageStem( VRWindow(), TimeMsg. , NLVGetMessage(129) , "Information", "Buttons.", 1, 1 )
1763 if options.!debug == 1 then say time()' _TimeSync done'
1764return
1765
1766/*:VRX _UpdateObject
1767*/
1768_UpdateObject: procedure
1769 Object = arg(1)
1770 ObjValue = arg(2)
1771 if VRGet(Object,"Value") <> ObjValue then ok = VRset(Object,"Value",ObjValue)
1772return
1773
1774/*:VRX _UserCredUpdate
1775*/
1776_UserCredUpdate:
1777 if options.!debug == 1 then say time()' _UserCredUpdate started'
1778 credentials.!username = VRGet("EF_USER","Value")
1779 credentials.!password = VRGet("EF_PASSWORD","Value")
1780
1781 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 1 | pos(left(credentials.!password,1),'01234567890') > 0
1782 then UserCred = '--user='Credentials.!username'%%'Credentials.!password
1783 else UserCred = '--user='Credentials.!username'%'Credentials.!password
1784
1785 if options.!storecreds = 1 & \(UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' | UserCred = '--user=%%' | UserCred = '-N') then do
1786 ok = _ucSetUc()
1787 ok = VRSet("Pict_PWINMEM","PicturePath","#36")
1788 if options.!debug == 1 then call beep 2400, 10
1789 end
1790 else do
1791 if options.!debug == 1 then call beep 200, 20
1792 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
1793 end
1794 if options.!debug == 1 then say time()' _UserCredUpdate done'
1795return
1796
1797/*:VRX CB_client_lanman_auth_Click
1798*/
1799CB_client_lanman_auth_Click:
1800 advanced.!smbconfchanged = 1
1801return
1802
1803/*:VRX CB_client_NTLMv2_auth_Click
1804*/
1805CB_client_NTLMv2_auth_Click:
1806 advanced.!smbconfchanged = 1
1807
1808 if VRGet("CB_client_NTLMv2_auth","Set") = 0 then do
1809 ok = VRSet("CB_client_lanman_auth","Enabled", 1)
1810 ok = VRSet("CB_client_plaintext_auth","Enabled", 1)
1811 end
1812 else do
1813 ok = VRSet("CB_client_lanman_auth","Enabled", 0)
1814 ok = VRSet("CB_client_lanman_auth","Set", 0)
1815 ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
1816 ok = VRSet("CB_client_plaintext_auth","Set", 0)
1817 end
1818return
1819
1820/*:VRX CB_client_plaintext_auth_Click
1821*/
1822CB_client_plaintext_auth_Click:
1823 advanced.!smbconfchanged = 1
1824return
1825
1826/*:VRX CB_client_use_spnego_Click
1827*/
1828CB_client_use_spnego_Click:
1829 advanced.!smbconfchanged = 1
1830return
1831
1832/*:VRX CB_client_use_spnego_principal_Click
1833*/
1834CB_client_use_spnego_principal_Click:
1835 advanced.!smbconfchanged = 1
1836return
1837
1838/*:VRX CB_DEBUG_Click
1839*/
1840CB_DEBUG_Click:
1841
1842return
1843
1844/*:VRX CB_ENCRYPTION1_Click
1845*/
1846CB_ENCRYPTION1_Click:
1847 if VRGet("CB_ENCRYPTION1","set") then do
1848 ok = VRSet("CB_CB_NTLMv11", "Set", 0)
1849 ok = VRSet("CB_CB_NTLMv11", "Enabled", 0)
1850 end
1851 else do
1852 ok = VRSet("CB_CB_NTLMv11", "Enabled", 1)
1853 end
1854
1855return
1856
1857/*:VRX CB_ENCRYPTION_Click
1858*/
1859CB_ENCRYPTION_Click:
1860 if VRGet("CB_ENCRYPTION","set") then do
1861 ok = VRSet("CB_CB_NTLMv1", "Set", 0)
1862 ok = VRSet("CB_CB_NTLMv1", "Enabled", 0)
1863 end
1864 else do
1865 ok = VRSet("CB_CB_NTLMv1", "Enabled", 1)
1866 end
1867return
1868
1869/*:VRX CB_KERBEROS51_Click
1870*/
1871CB_KERBEROS51_Click:
1872 if VRGet("CB_KERBEROS51","set") then do
1873 ok = VRSet("CB_CB_NTLMv11", "Set", 0)
1874 ok = VRSet("CB_CB_NTLMv11", "Enabled", 0)
1875 end
1876 else do
1877 ok = VRSet("CB_CB_NTLMv11", "Enabled", 1)
1878 end
1879return
1880/*:VRX CB_KERBEROS5_Click
1881*/
1882CB_KERBEROS5_Click:
1883 if VRGet("CB_KERBEROS5","set") then do
1884 ok = VRSet("CB_CB_NTLMv1", "Set", 0)
1885 ok = VRSet("CB_CB_NTLMv1", "Enabled", 0)
1886 end
1887 else do
1888 ok = VRSet("CB_CB_NTLMv1", "Enabled", 1)
1889 end
1890return
1891
1892/*:VRX CB_LOGGING_Click
1893*/
1894CB_LOGGING_Click:
1895 if VRFileExists(SysBootDrive()'\ndpsmb.dbg') then
1896 ok = SysFileDelete(SysBootDrive()'\ndpsmb.dbg')
1897 else do
1898 call lineout SysBootDrive()'\ndpsmb.dbg','NDPSMB debug flag file'
1899 ok = stream(SysBootDrive()'\ndpsmb.dbg','c','close')
1900 end
1901
1902 CALL VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()'\ndpsmb.dbg')
1903return
1904
1905/*:VRX CB_MOUNT_Change
1906*/
1907CB_MOUNT_Change:
1908 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change started"
1909
1910 mount = VRGet("CB_MOUNT", "Value")
1911
1912 /* Catch empty mount type error */
1913 if mount = "" then do
1914 if mtype.1 <> "" then ok = VRSet("CB_MOUNT", "Value", mtype.1)
1915 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change aborted"
1916 return
1917 end
1918
1919 SELECT
1920 WHEN mount == mtype.1 THEN DO
1921 CALL VRSet "DT_SHARE", "Visible", 1
1922 CALL VRSet "EF_SHARE", "Visible", 1
1923 CALL VRSet "DT_SERVER", "Visible", 1
1924 CALL VRSet "EF_SERVER", "Visible", 1
1925 CALL VRSet "DT_NETWORK", "Visible", 1
1926 CALL VRSet "EF_NETWORK", "Visible", 1
1927 CALL VRSet "CHK_MTYPE", "Visible", 0
1928 CALL NLVSetText "DT_NETWORK", "Caption", 21
1929 END
1930 WHEN mount == mtype.2 THEN DO
1931 CALL VRSet "DT_SHARE", "Visible", 0
1932 CALL VRSet "EF_SHARE", "Visible", 0
1933 CALL VRSet "DT_SERVER", "Visible", 1
1934 CALL VRSet "EF_SERVER", "Visible", 1
1935 CALL VRSet "DT_NETWORK", "Visible", 1
1936 CALL VRSet "EF_NETWORK", "Visible", 1
1937 CALL VRSet "CHK_MTYPE", "Visible", 0
1938 CALL NLVSetText "DT_NETWORK", "Caption", 21
1939 END
1940 WHEN mount == mtype.3 THEN DO
1941 CALL VRSet "DT_SHARE", "Visible", 0
1942 CALL VRSet "EF_SHARE", "Visible", 0
1943 CALL VRSet "DT_SERVER", "Visible", 0
1944 CALL VRSet "EF_SERVER", "Visible", 0
1945 CALL VRSet "DT_NETWORK", "Visible", 1
1946 CALL VRSet "EF_NETWORK", "Visible", 1
1947 CALL VRSet "CHK_MTYPE", "Visible", 0
1948 CALL NLVSetText "DT_NETWORK", "Caption", 21
1949 END
1950 WHEN mount == mtype.4 THEN DO
1951 CALL VRSet "DT_SHARE", "Visible", 0
1952 CALL VRSet "EF_SHARE", "Visible", 0
1953 CALL VRSet "DT_SERVER", "Visible", 0
1954 CALL VRSet "EF_SERVER", "Visible", 0
1955 CALL VRSet "DT_NETWORK", "Visible", 1
1956 CALL VRSet "EF_NETWORK", "Visible", 1
1957 CALL VRSet "CHK_MTYPE", "Visible", 1
1958 CALL NLVSetText "DT_NETWORK", "Caption", 22
1959 END
1960 WHEN mount == mtype.5 THEN DO
1961 CALL VRSet "DT_SHARE", "Visible", 0
1962 CALL VRSet "EF_SHARE", "Visible", 0
1963 CALL VRSet "DT_SERVER", "Visible", 1
1964 CALL VRSet "EF_SERVER", "Visible", 1
1965 CALL VRSet "DT_NETWORK", "Visible", 0
1966 CALL VRSet "EF_NETWORK", "Visible", 0
1967 CALL VRSet "CHK_MTYPE", "Visible", 0
1968 CALL NLVSetText "DT_Server", "Caption", 111
1969 END
1970 OTHERWISE DO
1971 id = VRMessage( "", 'unknown mount type here >>'mount'<< mtype1=>>'mtype.1'<<', "Mount change error", "E", )
1972 END
1973 END
1974 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change done"
1975RETURN
1976
1977/*:VRX CB_NTLMV11_Click
1978*/
1979CB_NTLMV11_Click:
1980 if VRGet("CB_NTLMV11","set") then do
1981 ok = VRSet("CB_KERBEROS51", "Set", 0)
1982 ok = VRSet("CB_ENCRYPTION1","Set", 0)
1983 ok = VRSet("CB_KERBEROS51", "Enabled", 0)
1984 ok = VRSet("CB_ENCRYPTION1","Enabled", 0)
1985 end
1986 else do
1987 ok = VRSet("CB_KERBEROS51", "Enabled", 1)
1988 ok = VRSet("CB_ENCRYPTION1","Enabled", 1)
1989 end
1990return
1991
1992/*:VRX CB_NTLMv1_Click
1993*/
1994CB_NTLMv1_Click:
1995 if VRGet("CB_NTLMV1","set") then do
1996 ok = VRSet("CB_KERBEROS5", "Set", 0)
1997 ok = VRSet("CB_ENCRYPTION","Set", 0)
1998 ok = VRSet("CB_KERBEROS5", "Enabled", 0)
1999 ok = VRSet("CB_ENCRYPTION","Enabled", 0)
2000 end
2001 else do
2002 ok = VRSet("CB_KERBEROS5", "Enabled", 1)
2003 ok = VRSet("CB_ENCRYPTION","Enabled", 1)
2004 end
2005return
2006
2007/*:VRX CN_CONDET_Click
2008*/
2009CN_CONDET_Click:
2010 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
2011return
2012
2013/*:VRX CN_CONDET_ContextMenu
2014*/
2015CN_CONDET_ContextMenu:
2016 rh = VRInfo('Record')
2017 if VRMethod( "CN_CONDET", "ValidateRecord", rh) <> 1 then return
2018
2019 /* Hide all context menu entries */
2020 ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
2021 ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
2022 ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
2023 ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
2024 ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
2025 ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
2026 ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
2027 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
2028
2029 /* This is the place to enable specific context menu entries */
2030 ok = VRMethod( "CN_CONDET", "GetRecordList", "All", "records." )
2031 ok = VRSet("Menu_Selected_Remove", "Visible", (records.0 <> 0))
2032 ok = VRSet("Menu_Selected_Retry", "Visible", (records.0 <> 0))
2033
2034 if VRMethod( "CN_CONDET", "GetFieldData", rh, CD.StatusFH) = icons.!passive then do
2035 ok = VRSet("Menu_Selected_Retry", "Enabled",1)
2036 ok = VRSet("Menu_Selected_Remove", "Enabled",1)
2037 end
2038 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
2039return
2040/*:VRX CN_CONDET_DragStart
2041*/
2042CN_CONDET_DragStart:
2043
2044 obj = VRInfo( "object" )
2045 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
2046 if selrec.0 = 0 then return
2047
2048 Icon = VRMethod("CN_CONDET", "GetRecordAttr", selrec.1, "Icon")
2049
2050 if Icon = icons.!printer then do /* Printers not supported at the moment */
2051 call beep 4800,100
2052 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2053 end
2054 else call VRMethod obj, 'StartDrag'
2055return
2056
2057/*:VRX CN_CURRENT_Click
2058*/
2059CN_CURRENT_Click:
2060 if options.!debug == 1 then say time()' CN_CURRENT_Click started'
2061 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
2062
2063 /* Herwig B. */
2064 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
2065 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0)
2066
2067 rh = VRInfo('Record')
2068 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then return
2069
2070 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2071 options.currentdata = data
2072
2073 /* ok = VRset("DT_StatusBar","Caption", data' - 'VRGet("Main", "HintText")) */
2074
2075 PARSE VAR data p_node ';' p_mounts ';' p_string
2076
2077 if options.!debug == 1 then do
2078 say ' data = "'data'"'
2079 say ' p_node = "'p_node'"'
2080 say ' p_mounts = "'p_mounts'"'
2081 say ' p_string = "'p_string'"'
2082 end
2083
2084 if p_string = ""
2085 then infotext = fs.!name' 'fs.!version
2086 else infotext = p_string
2087
2088 if infotext = "" then infotext = " "
2089 CALL VRSet "CN_CURRENT", "Caption", infotext
2090 CALL VRSet "CN_CURRENT", 'HintText',infotext
2091
2092 IF p_mounts > 0 THEN DO
2093 CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
2094 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
2095
2096 if pos("*",p_string) > 0 | pos(";",p_string) > 0
2097 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
2098 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
2099 END
2100 ELSE DO
2101 CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
2102 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
2103 CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
2104 END
2105
2106 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
2107
2108 IF parent == '' THEN DO
2109 CALL VRSet 'PB_DETACH', 'Enabled', 1
2110 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
2111 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
2112/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
2113 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
2114/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
2115
2116 END
2117 ELSE DO
2118 CALL VRSet 'PB_DETACH', 'Enabled', 0
2119 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
2120 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
2121/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
2122 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
2123/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
2124 END
2125
2126 parse var p_string p_workgroup'\\'p_server'\'p_share
2127
2128 p_workgroup = strip(p_workgroup,'T',':')
2129
2130 if options.!debug == 1 then do
2131 say ' p_workgroup = "'p_workgroup'"'
2132 say ' p_server = "'p_server'"'
2133 say ' p_share = "'p_share'"'
2134 end
2135
2136 p_server = translate(p_server)
2137
2138 ok = VRSet("EF_NETWORK","Value", p_workgroup)
2139 if p_workgroup <> "" then do
2140 wgh = _GetMachineHandle(p_workgroup)
2141 if wgh = "" then wgh = _AddWorkGroup(p_workgroup)
2142 call _UpdateObject "EF_SERVER", p_server
2143 mh = _GetMachineHandle(p_server)
2144 if mh = "" & p_server <> "*" then do
2145 mh = _AddSleepingMachine(p_server,'',wgh)
2146 machine = p_server
2147 call _RefreshShares
2148 end
2149 ok = VRSet("EF_Share","Value", p_share)
2150 select
2151 when p_workgroup = "*" then ok = VRSet("CB_MOUNT","Value", mtype.4)
2152 when p_server = "*" then ok = VRSet("CB_MOUNT","Value", mtype.3)
2153 when p_share = "*" then ok = VRSet("CB_MOUNT","Value", mtype.2)
2154 otherwise ok = VRSet("CB_MOUNT","Value", mtype.1)
2155 end
2156 end
2157 if options.!debug == 1 then say time()' CN_CURRENT_Click done'
2158RETURN
2159
2160/*:VRX CN_CURRENT_ContextMenu
2161*/
2162CN_CURRENT_ContextMenu: /* PROCEDURE EXPOSE existrec. options. icons. fs. */
2163 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu started"
2164
2165 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
2166
2167 rh = VRInfo('Record')
2168
2169 /* we have to check whether the record still exists because under certain
2170 circumstances the event routine is executed after the record was already
2171 removed */
2172 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
2173 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu aborted"
2174 return
2175 end
2176
2177 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2178 PARSE VAR data p_node ';' p_mounts ';' p_string
2179
2180 if options.!debug == 1 then do
2181 say ' data = "'data'"'
2182 say ' p_node = "'p_node'"'
2183 say ' p_mounts = "'p_mounts'"'
2184 say ' p_string = "'p_string'"'
2185 end
2186/*
2187 infotext = p_node
2188 DO i = 1 TO p_mounts
2189 infotext = infotext ' ['p_string']'
2190 END
2191*/
2192 if p_string = ""
2193 then infotext = fs.!name' 'fs.!version
2194 else infotext = p_string
2195
2196 if infotext = "" then infotext = " "
2197 CALL VRSet "CN_CURRENT", "Caption", infotext
2198 CALL VRSet "CN_CURRENT", 'HintText',infotext
2199
2200 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
2201/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1
2202 CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1
2203 CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
2204 CALL VRSet 'Menu_Context_Open_Default', "Visible", 1
2205
2206 IF p_mounts > 0 THEN DO
2207 CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
2208 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
2209
2210 if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
2211 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
2212 END
2213 ELSE DO
2214 CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
2215 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
2216 CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
2217 END
2218
2219 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
2220
2221 IF parent == '' THEN DO
2222 CALL VRSet 'PB_DETACH', 'Enabled', 1
2223 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
2224 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
2225/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
2226 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
2227/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
2228/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
2229 END
2230 ELSE DO
2231 CALL VRSet 'PB_DETACH', 'Enabled', 0
2232 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
2233 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
2234/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
2235 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
2236/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
2237/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 0 */
2238 END
2239
2240 ok = VRMethod( "Menu_Context", "Popup", , , "", "" )
2241 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu done"
2242return
2243
2244/*:VRX CN_CURRENT_DoubleClick
2245*/
2246CN_CURRENT_DoubleClick:
2247 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick started"
2248
2249 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
2250
2251 rh = VRInfo('Record')
2252
2253 /* we have to check whether the record still exists because under certain
2254 circumstances the event routine is executed after the record was already
2255 removed */
2256 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
2257 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick aborted"
2258 return
2259 end
2260
2261 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2262 PARSE VAR data p_node ';' p_mounts ';' p_string
2263
2264 if options.!debug == 1 then do
2265 say ' data = "'data'"'
2266 say ' p_node = "'p_node'"'
2267 say ' p_mounts = "'p_mounts'"'
2268 say ' p_string = "'p_string'"'
2269 end
2270 call Menu_Context_Open_Default_Click
2271
2272 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick done"
2273return
2274
2275/*:VRX CN_CURRENT_DragDrop
2276*/
2277CN_CURRENT_DragDrop:
2278 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop started'
2279 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
2280 if options.!debug == 1 then say " settings.!network = "settings.!network
2281
2282 p_workgroup = ''
2283 p_server = ''
2284 p_share = ''
2285
2286 srcFile = VRInfo( "SourceFile" )
2287 srcCtn = VRInfo( "SourceObject" )
2288 srcRec = VRInfo( "SourceRecord" )
2289 trgCtn = VRInfo( "TargetObject" )
2290 trgRec = VRInfo( "TargetRecord" )
2291
2292 if options.!debug == 1 then do
2293 say ' srcFile = "'srcFile'"'
2294 say ' srcCtn = "'srcCtn'"'
2295 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
2296 say ' srcRec = "'srcRec'"'
2297 say ' trgCtn = "'trgCtn'"'
2298 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
2299 say ' trgRec = "'trgRec'"'
2300 end
2301
2302 if srcFile <> "" then do /* A file was dropped onto the container - attempt to load it */
2303 if options.!debug == 1 then say ' Possible profile dropped: "'srcFile'"'
2304
2305 /* was it really a profile ? */
2306 if translate(VRParseFileName(srcFile,'E')) = translate(fs.!profileext) then do /* Yes - load it! */
2307 options.!autoload = 1
2308 Profile = srcFile
2309 call Menu_File_Load_Click
2310 ok = VRSet("EF_NETWORK","Value",options.!workgroup)
2311 end
2312 else do /* No - barf! */
2313 buttons.0 = 1
2314 buttons.1 = NLVGetMessage(9)
2315 ok = VRMessage('Main', NLVGetMessage(103,srcFile ), NLVGetMessage(5), 'E','buttons.')
2316 end
2317 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done (load profile)'
2318 return
2319 end
2320
2321 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
2322
2323 if VRGet(srcCtn,'Name') = "CN_CONDET" then do
2324 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.MpointFH)
2325
2326 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcRec, cd.workgrpFH )
2327 p_server = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ServerFH)
2328 p_share = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ShareFH)
2329 p_user = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.UserFH)
2330 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.SpasswordFH))
2331
2332 ShareLevel = 1
2333 if p_share = "" then ShareLevel = 2
2334 if p_server = "" then ShareLevel = 3
2335 if p_workgroup = "" then ShareLevel = 4
2336
2337 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
2338 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
2339
2340 call _UpdateObject "EF_SERVER", p_server
2341 ok = VRset("EF_SHARE", "Value", p_share)
2342 ok = VRset("EF_NETWORK", "Value", p_workgroup)
2343 ok = VRset("EF_USER", "Value", p_user)
2344 ok = VRset("EF_PASSWORD", "Value", p_password)
2345
2346 parse var p_mpoint p_drv '\' p_dir
2347
2348 p_dir = strip(p_dir,'T','\')
2349
2350 ok = VRset("CB_DRIVES", "Value", p_drv)
2351 ok = VRset("EF_DIRECTORY", "Value", p_dir)
2352 end /* Drag from CN_CONDET */
2353
2354 else do /* Drag from CN_SMBTREE */
2355 call _GetSMBObjectProperties srcRec
2356 select
2357 when SMBObj.udatatype = "WORKGROUP" then do
2358 say "Workgroup dragged!"
2359 p_workgroup = SMBObj.resname
2360 p_server = ""
2361 p_share = ""
2362
2363 ShareLevel = 3
2364 end
2365 when SMBObj.udatatype = "SERVER" then do
2366 say "Server dragged!"
2367 if SMBObj.parentrh <> "" then do /* detect server without workgroup */
2368 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2369 end
2370 p_server = SMBObj.resname
2371 p_share = ""
2372
2373 ShareLevel = 2
2374 end
2375 when SMBObj.udatatype = "DISK" then do
2376 say "Shared disk dragged!"
2377 if SMBObj.gparentrh <> "" then do /* detect share on a server without workgroup */
2378 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.gparentrh, "Caption")
2379 end
2380 p_server = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2381 parse var p_server p_server '0D0A'x .
2382 p_share = SMBObj.resname
2383
2384 ShareLevel = 1
2385 end
2386 otherwise nop /* Printer */
2387 end
2388 ok = VRSet("EF_NETWORK","Value",p_workgroup)
2389 call _UpdateObject "EF_SERVER", p_server
2390 ok = VRSet("EF_Share","Value", p_share)
2391 end /* Drag from CN_SMBTREE */
2392
2393 if options.!debug == 1 then do
2394 say 'p_workgroup = "'p_workgroup'"'
2395 say 'p_server = "'p_server'"'
2396 say 'p_share = "'p_share'"'
2397 end
2398
2399 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
2400
2401 settings.!network = VRGet("EF_NETWORK","Value")
2402 call CB_MOUNT_Change
2403
2404 if trgRec = "" then do
2405 ok = VRMethod("CB_DRIVES", "GetStringList", "freedrives.")
2406 if freedrives.0 > 0
2407 then ok = VRSet("CB_DRIVES","Value", freedrives.1)
2408 else ok = VRSet("CB_DRIVES","Value", "")
2409
2410 ok = VRSet("EF_DIRECTORY","Value", "")
2411 end
2412 else do
2413 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
2414
2415 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
2416
2417 do while parTrgRH <> ""
2418 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
2419 TargetString = partrgCapt||'\'||TargetString
2420 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
2421 end
2422 say 'TargetString = "'TargetString'"'
2423 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
2424 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
2425 end
2426
2427 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
2428 if VRGet("CB_DRIVES","Value") = "" then return
2429
2430 window = VRLoadSecondary( "SW_LOGIN", "W" )
2431 if credentials.!entered = 1 then call PB_MOUNT_CLICK
2432
2433 if VRGet(srcCtn,'Name') = "CN_CONDET" & VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
2434 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
2435 end
2436 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done'
2437return
2438/*:VRX CN_SMBTREE_Click
2439*/
2440CN_SMBTREE_Click:
2441 if options.!debug == 1 then say time()' CN_SMBTREE_Click started'
2442 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
2443
2444 call _dropdeprecated
2445 call _GetSmbObjectProperties VRInfo('Record')
2446 call _ContextMenuSelectedSet
2447
2448 ok = VRset("DT_Statusbar", "Caption", SMBObj.udatamsg)
2449
2450 if options.!debug == 1 then say time()' CN_SMBTREE_Click done'
2451return
2452/*:VRX CN_SMBTREE_ContextMenu
2453*/
2454CN_SMBTREE_ContextMenu:
2455 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
2456
2457 call _dropdeprecated
2458 call _GetSmbObjectProperties VRInfo('Record')
2459
2460 call _ContextMenuSelectedSet
2461 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
2462
2463 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
2464return
2465/*:VRX CN_SMBTREE_DoubleClick
2466*/
2467CN_SMBTREE_DoubleClick:
2468 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
2469
2470 call _dropdeprecated
2471 call _GetSmbObjectProperties VRInfo('Record')
2472
2473/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2474return */
2475 /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
2476
2477 if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
2478
2479 If SMBObj.udatatype = "DIRECTORY" then do
2480 BrowsePath = _browsebuildpath(SMBObj.rh)
2481
2482 call _BrowseResetObject(SmbObj.rh)
2483
2484 parse var browsepath '\\'machine'\'sharename '\' browsepath
2485 browsepath = browsepath'\*'
2486
2487 call _BrowseDirectory
2488 end
2489
2490 If SMBObj.udatatype = "FILE" then do
2491 BrowsePath = _browsebuildpath(SMBObj.rh)
2492 call _BrowseResetObject(SmbObj.rh)
2493
2494 parse var browsepath '\\'machine'\'sharename '\' browsepath
2495
2496 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2497
2498 if \OpenOK then do
2499 say " Not connected - trying to connect"
2500 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
2501 call PB_SMBTREE_CONNECT_Click
2502 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
2503
2504 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2505
2506 if \OpenOk then do
2507 say " Not connected - cannot open - aborting!"
2508 end
2509 end
2510 end
2511
2512 if SMBObj.udatatype = "DISK" then do
2513 machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
2514 parse var machine machine '0D0A'x .
2515 machine = strip(machine)
2516
2517 call _BrowseResetObject(SmbObj.rh)
2518
2519 sharename = SMBObj.resname
2520 BrowsePath = ""
2521
2522 call _BrowseDirectory
2523 end
2524 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2525return
2526/*:VRX CN_SMBTREE_DragFile
2527*/
2528CN_SMBTREE_DragFile:
2529 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile started'
2530
2531 obj = VRInfo( "object" )
2532
2533 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2534 if SelRH.0 = 0 then do
2535 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2536 return
2537 end
2538
2539 call _dropdeprecated
2540 call _GetSMBObjectProperties SelRH.1
2541
2542 select
2543 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2544 call VRMethod obj, 'StartDrag'
2545 end
2546 when SMBObj.udatatype = "PRINTER" then do
2547 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2548 end
2549 otherwise nop /* FILE DIRECTORY */
2550 end
2551
2552 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile done'
2553return
2554
2555/*:VRX CN_SMBTREE_DragStart
2556*/
2557CN_SMBTREE_DragStart:
2558 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart started'
2559
2560 obj = VRInfo( "object" )
2561
2562 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2563 if SelRH.0 = 0 then do
2564 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2565 return
2566 end
2567
2568 call _dropdeprecated
2569 call _GetSMBObjectProperties SelRH.1
2570
2571 select
2572 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2573 call VRMethod obj, 'StartDrag'
2574 end
2575 when SMBObj.udatatype = "PRINTER" then do
2576 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2577 end
2578 otherwise nop /* FILE DIRECTORY */
2579 end
2580
2581 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart done'
2582return
2583/*:VRX CreateObject
2584*/
2585CreateObject: procedure
2586 Parse Arg Class, Title, Location, Setup, Collision
2587 /* say 'Creating ['Title']' */
2588say Setup
2589 rc = SysCreateObject( Class, Title, Location, Setup, Collision )
2590 If rc <> 1 Then do
2591 Msg.Text = ' > failed to create ['Title' | 'Class'] at location ['Location']'
2592 Msg.Type = 'Error'
2593 say Msg.Text
2594 end
2595return rc
2596/*:VRX DT_STATUSBAR_ContextMenu
2597*/
2598DT_STATUSBAR_ContextMenu:
2599 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2600return
2601
2602/*:VRX EF_PASSWORD1_KeyPress
2603*/
2604EF_PASSWORD1_KeyPress:
2605 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress started'
2606 obj = VRInfo( "Object" )
2607 keystr = VRGet( obj, "KeyString" )
2608/* say keystr */
2609 select
2610 when keystr = "{Enter}" then call PB_LOGIN_OK_Click
2611 when keystr = "{Newline}" then call PB_LOGIN_OK_Click
2612 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2613 otherwise nop
2614 end
2615 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress done'
2616return
2617
2618/*:VRX EF_PASSWORD_Change
2619*/
2620EF_PASSWORD_Change:
2621 Now = VRGet("EF_PASSWORD","value")
2622 if Now = "" | Now = LastPassword then return
2623 ok = SysSleep(1)
2624 LastPassword = Now
2625 if Now <> VRGet("EF_PASSWORD","value") then return
2626 call _UserCredUpdate
2627return
2628
2629/*:VRX EF_SERVER_Change
2630*/
2631EF_SERVER_Change:
2632 if options.!debug == 1 then say time()' EF_SERVER_Change started'
2633 Now = VRGet("EF_SERVER","value")
2634
2635 if Now = "" | Now = LastServer then return
2636 ok = SysSleep(2)
2637 if Now <> VRGet("EF_SERVER","value") then return
2638
2639 IF options.!editmode = 1 then return
2640
2641 /* Do nothing for incomplete IP addresses */
2642 if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" then do /* got an IP address */
2643 if \_IsValidIPAddress(VRGet("EF_SERVER","value")) then return /* it is invalid or incomplete */
2644 end
2645
2646 /* do nothing if a workgroup was mounted */
2647 if VRGet("EF_SERVER","value") = "*" then return
2648
2649 machine = VRGet("EF_SERVER","value")
2650 ok = VRSet("EF_SHARE","Value", "")
2651 ok = VRMethod("EF_SHARE","Reset")
2652
2653 rh = _GetMachineHandle(machine)
2654 if rh <> "" then do
2655 call _GetSMBObjectProperties rh
2656 if SMBObj.parentrh = ""
2657 then ok = VRSet("EF_NETWORK","Value", "") /* The workgroup might be unknown at this moment */
2658 else ok = VRSet("EF_NETWORK","Value", VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentRH,"Caption"))
2659
2660 call _GetSMBObjectShares SMBObj.rh
2661
2662 if SMBObj.shares.0 > 0 then do
2663 ok = VRMethod("EF_SHARE", "AddStringList", "SMBObj.shares.")
2664 end
2665 end
2666 else do
2667 call _RefreshWorkgroups
2668 smbtree.!machine = _AddSleepingMachine(machine,"","")
2669 call _UserCredUpdate
2670 call _RefreshShares
2671 ok = VRSet( "CN_smbtree", "Painting", 1 )
2672
2673 ok = VRSet("Main", 'Pointer', '<default>' )
2674 ok = VRSet("CN_smbtree","Enabled", 1)
2675 ok = VRSet("TM_Throbber","Enabled", 0)
2676 ok = VRSet("Pict_Throbber","Visible", 0)
2677 end
2678
2679 LastServer = VRGet("EF_SERVER","value")
2680 if options.!debug == 1 then say time()' EF_SERVER_Change done'
2681return
2682
2683/*:VRX EF_USER1_KeyPress
2684*/
2685EF_USER1_KeyPress:
2686 if options.!debug == 1 then say time()' EF_USER1_KeyPress started'
2687 obj = VRInfo( "Object" )
2688 keystr = VRGet( obj, "KeyString" )
2689 say keystr
2690 select
2691 when keystr = "{Enter}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2692 when keystr = "{Newline}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2693 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2694 otherwise nop
2695 end
2696 if options.!debug == 1 then say time()' EF_USER1_KeyPress done'
2697return
2698
2699/*:VRX EF_USER_Change
2700*/
2701EF_USER_Change:
2702 Now = VRGet("EF_USER","value")
2703 if Now = "" | Now = LastUser then return
2704 ok = SysSleep(1)
2705 LastUser = Now
2706 if Now <> VRGet("EF_USER","value") then return
2707 call _UserCredUpdate
2708return
2709
2710/*:VRX EF_WINS_SERVER_Change
2711*/
2712EF_WINS_SERVER_Change:
2713 advanced.!smbconfchanged = 1
2714return
2715
2716/*:VRX Fini
2717*/
2718Fini:
2719 window = VRWindow()
2720 call VRSet window, "Visible", 0
2721 drop window
2722return 0
2723
2724/*:VRX GetChildren
2725*/
2726GetChildren: PROCEDURE EXPOSE existrec. exc options. icons. fs. cd. samba.
2727 if options.!debug == 1 then say time()' GetChildren started'
2728 PARSE ARG node, parec
2729
2730 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2731
2732 IF info.2 > 0 THEN icon = icons.!active
2733 ELSE icon = icons.!passive
2734
2735 rh = VRMethod("CN_CURRENT", 'AddRecord', parec, 'Last', info.0, icon )
2736 IF rh == '' | datatype(res.0) <> "NUM" THEN RETURN
2737
2738 exc = exc + 1
2739 existrec.exc = rh
2740 userdata = node';'info.2
2741 DO i = 1 TO res.0
2742 userdata = ParseResourceData( userdata, res.i )
2743 END
2744 if userdata = "UNKNOWN" then ok = VRMethod("CN_CURRENT", 'RemoveRecord', rh)
2745 else do
2746 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata
2747 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2748 end
2749
2750 DO i = 1 TO points.0
2751 childnode = node || points.i || '\'
2752 CALL GetChildren childnode, rh
2753 END
2754 if options.!debug == 1 then say time()' GetChildren done'
2755RETURN
2756
2757/*:VRX GetMountPoints
2758*/
2759GetMountPoints: PROCEDURE EXPOSE existrec. options. icons. fs. cd. samba.
2760 if options.!debug == 1 then say time()' GetMountPoints started'
2761/* CALL VRSet "CN_CURRENT", 'Painting', 0 */
2762/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) started" */
2763 drvs = SysDriveMap('C:', 'USED') /* was "REMOTE" */
2764/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) done" */
2765 ac = 0
2766 DO i = 1 TO WORDS( drvs )
2767 fs = TRANSLATE( SysFileSystemType( WORD( drvs, i )))
2768 IF fs == fs.!fileSystemtype THEN DO
2769 ac = ac + 1
2770 attached.ac = WORD( drvs, i )
2771 END
2772 END
2773 attached.0 = ac
2774
2775 exc = 0
2776 DO i = 1 TO attached.0
2777 node = attached.i'\'
2778
2779 CALL VRMethod 'CB_DRIVES', 'AddString', attached.i
2780
2781 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2782
2783 IF info.2 > 0 THEN icon = icons.!drive
2784 ELSE icon = icons.!drive_inactive
2785
2786 rh = VRMethod("CN_CURRENT", 'AddRecord',, 'Last', attached.i, icon )
2787 IF rh == '' THEN ITERATE
2788
2789 exc = exc + 1
2790 existrec.exc = rh
2791 userdata = node';'info.2
2792 DO j = 1 TO res.0
2793 userdata = ParseResourceData( userdata, res.j )
2794 END
2795/* if options.!debug == 1 then say ' "'attached.i'" "'userdata'"' */
2796 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata /* , 'FileName', 'TESTER.EVP' */
2797 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2798
2799 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'Expanded', 1
2800
2801 DO j = 1 TO points.0
2802 childnode = node || points.j || '\'
2803 CALL GetChildren childnode, rh
2804 END
2805
2806 END
2807 existrec.0 = exc
2808/* CALL VRSet "CN_CURRENT", 'Painting', 1 */
2809 if options.!debug == 1 then say time()' '||"GetMountPoints done"
2810RETURN
2811
2812/*:VRX Halt
2813*/
2814Halt:
2815 signal _VREHalt
2816return
2817
2818/*:VRX Init
2819*/
2820Init:
2821/* Herwig */
2822/* CALL VRSet 'Console', 'WindowListTitle', '' */
2823
2824 window = VRWindow()
2825 call VRSet window, "Visible", 0
2826 call VRMethod window, "Activate"
2827 drop window
2828
2829RETURN
2830
2831/*:VRX LoadFileSysFuncs
2832*/
2833LoadFileSysFuncs:
2834 if options.!debug == 1 then say time()' LoadFileSysFuncs() started'
2835
2836 Fatal = 1
2837 RestartCount = 0
2838 FoundEVFS = 1
2839 FoundND = 1
2840
2841 program = VRGet("Application", "Program")
2842 if program = "" then parse source . . program
2843 say "Program = '"program"'"
2844 program = translate(VRParseFileName(Program,'N'))
2845 say "Program = '"program"'"
2846
2847 if SysSearchPath("PATH", "EVFSCTL.EXE") = "" | program = "SMBGUI" then do
2848 FoundEVFS = 0
2849 ForceNDFS = 1
2850 end
2851
2852CtlRestart:
2853 if \ForceNDFS then signal NoNetDrive
2854
2855ForceNDFS:
2856 if options.!debug == 1 then say ' NDFS check entered'
2857 call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
2858 SIGNAL ON SYNTAX NAME NoNetdrive
2859 call NdRxLoadFuncs
2860 FoundND = 1
2861 SIGNAL OFF SYNTAX
2862 fs.!prefix = 'ND'
2863 fs.!fileSystemtype = "NDFS32"
2864 fs.!profileext = "ndc"
2865 signal CommonToBothFS
2866NoNetdrive:
2867 if options.!debug == 1 then say ' NDFS not found'
2868 CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
2869 SIGNAL ON SYNTAX NAME NoEVFSCALL
2870 CALL EvfsRxLoadFuncs
2871 FoundEVFS = 1
2872 SIGNAL OFF SYNTAX
2873 fs.!prefix = 'EVFS'
2874 fs.!fileSystemtype = "EVFS"
2875 fs.!profileext = "evp"
2876CommonToBothFS:
2877 if options.!debug == 1 then say ' Common version check'
2878 CALL _Dynamic "fsstat = "fs.!prefix"RxQueryIFS()"
2879 if fsstat = 252 then CALL _Dynamic "Found"fs.!prefix" = 0"
2880
2881 if word(fsstat,1) = '0' then do
2882 PARSE VAR fsstat '0 'fsname fsver fsctl .
2883 fs.!name = fsname
2884 fs.!version = fsver
2885
2886 if options.!debug == 1 then DO
2887 say ' fs.!prefix = 'fs.!prefix
2888 say ' fs.!name = 'fs.!Name
2889 say ' Version = 'fsver
2890 say ' fsctl = 'fsctl
2891 end
2892 end
2893 else do
2894 if FoundND = 0 & FoundEVFS = 0 then do
2895 CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
2896 signal Halt
2897 end
2898 signal ForceNDFS
2899 end
2900 IF fsctl \= 1 THEN DO
2901 if ReStartCount = 0 then do
2902 'detach 'fs.!prefix'ctl.exe'
2903 RestartCount = 1
2904 ok = SysSleep(1)
2905 signal CtlRestart
2906 end
2907 else do
2908 CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
2909 signal Halt
2910 end
2911 END
2912
2913 Fatal = 0
2914
2915 if options.!debug == 1 then say time()' LoadFileSysFuncs() done'
2916return
2917
2918/*:VRX Main_Close
2919*/
2920Main_Close:
2921 CALL Quit
2922RETURN
2923
2924/*:VRX Main_Create
2925*/
2926Main_Create:
2927 options.!debug = 0
2928 if options.!debug == 1 then do
2929 ok = VRRedirectStdIO("ON")
2930 say time()' Main_Create started'
2931 end
2932 else ok = VRRedirectStdIO("OFF")
2933
2934 call _InitTempDir
2935 call _LoadOtherFuncs
2936
2937 call NLVSetup
2938 call _StemsInit
2939
2940 call _TabbedDialogSetup
2941 call _ContainersInit
2942 call _GUIInit
2943
2944 CALL _ParseCommandLine
2945
2946 CALL LoadFileSysFuncs
2947
2948 CALL _CltInit
2949
2950 CALL _INILoad
2951
2952 call _TabFix 1
2953 call SW_ADVANCED_Init_Content
2954 call SW_SMBTREE_Init_Content
2955 call SW_CONDET_Init_Content
2956 call SW_SETTINGS_Init_Content
2957
2958 CALL Refresh
2959
2960 if advanced.!savepassive == 1 then CALL _PassiveLoad
2961
2962 IF options.!timesync == 1 THEN CALL _TimeSync
2963
2964 IF options.!autoload == 1 THEN CALL Menu_File_Load_Click
2965
2966 CALL VRSet "CB_MOUNT", "Selected", 1
2967 CALL VRSet "CB_DRIVES", "Selected", 1
2968 IF options.!autoclose == 1
2969 THEN CALL TM_AutoClose_Trigger
2970 ELSE do
2971 if advanced.!browseauth == 1 then do
2972 /* FIXME: unclear why we have to do the following 4 lines here */
2973 call SW_SETTINGS_Init
2974 call SW_SETTINGS_Init_Content
2975 call SW_ADVANCED_Init
2976 call SW_ADVANCED_Init_Content
2977
2978 window = VRLoadSecondary( "SW_LOGIN", "W" )
2979 call Main_Resize
2980 end
2981 if advanced.!browseimme == 1 then call PB_SMBTREE_REFRESH_Click
2982 end
2983
2984 if options.!debug == 1 then say time()' Main_Create done'
2985return
2986
2987/*:VRX Main_KeyPress
2988*/
2989Main_KeyPress:
2990 key = VRGet('Main', 'KeyString')
2991 IF key == '{F5}' THEN CALL Refresh
2992RETURN
2993
2994/*:VRX Main_Resize
2995*/
2996Main_Resize:
2997 if options.!debug == 1 then say time()' Main_Resize started'
2998 ok = VRset("Main","Painting", 0)
2999
3000 /* Basic measurements */
3001 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
3002 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
3003
3004/** This caused weird resizing glitches, horrible jittering, etc. Instead,
3005 ** what we now do (further down) is set a minimum size in twips for the right
3006 ** pane, below which it simply stops resizing and switches to clipping. (The
3007 ** left pane resizes all its controls dynamically anyway.) This better matches
3008 ** standard application behaviour, and makes resizing behave more smoothly.
3009 *
3010 * if VRMethod( "Screen", "TwipsToPixels", main_iheight) < 600 then
3011 * ok = VRSet("Main","Height",VRMethod( "Screen", "PixelsToTwips", 580))
3012 * if VRMethod( "Screen", "TwipsToPixels", main_iwidth) < 730 then
3013 * ok = VRSet("Main","Width", VRMethod( "Screen", "PixelsToTwips", 730))
3014 */
3015
3016 sbar_height = VRGet("GB_STATUSBAR","Height") /* Height of status-bar */
3017 split_left = VRGet("SPLIT_Main","Left") /* Position of the left edge of the split-bar */
3018 marginx2 = margin * 2 /* Common margin around controls */
3019 pbtn_height = 400 /* Height of the panels' internal button areas */
3020
3021 pane_height = main_iheight - sbar_height - (margin * 4) /* Height of a split-bar panel */
3022 lpane_width = split_left - margin /* Width of the left split-bar panel */
3023 rpane_width = main_iwidth - split_left - 60 - margin /* Width of the right split-bar panel */
3024
3025 /* Tabbed Dialog = right pane */
3026 ok = VRset("TDL_1", "Top", marginx2)
3027 ok = VRset("TDL_1", "Left", split_left + 60)
3028 ok = VRset("TDL_1", "Width", rpane_width )
3029 ok = VRset("TDL_1", "Height", pane_height )
3030
3031 /* Current Panel */
3032 ok = VRSet("GB_CURRENT", "Visible", 1 )
3033 ok = VRSet("GB_CURRENT", "Top", marginx2 )
3034 ok = VRSet("GB_CURRENT", "Left", margin )
3035 ok = VRSet("GB_CURRENT", "Width", lpane_width )
3036 ok = VRSet("GB_CURRENT", "Height", pane_height )
3037
3038 ok = VRset("GB_CURRENT3", "Top", margin )
3039 ok = VRset("GB_CURRENT3", "Left", margin )
3040 ok = VRset("GB_CURRENT3", "Height", 245 )
3041 ok = VRset("GB_CURRENT3", "Width", lpane_width - marginx2)
3042
3043 ok = VRset("DT_CURRENT", "Top", 8 )
3044 ok = VRset("DT_CURRENT", "Left", 8 )
3045 ok = VRset("DT_CURRENT", "Height", 213 )
3046 ok = VRset("DT_CURRENT", "Width", (lpane_width - marginx2) - 24 )
3047
3048 ok = VRset("GB_CURRENT2", "Left", margin )
3049 ok = VRset("GB_CURRENT2", "Top", 245 + marginx2 )
3050 ok = VRset("GB_CURRENT2", "Width", lpane_width - marginx2)
3051 ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
3052
3053 ok = VRset("CN_CURRENT", "Top", margin )
3054 ok = VRset("CN_CURRENT", "Left", margin )
3055 ok = VRset("CN_CURRENT", "Width", VRGet("GB_CURRENT2","Width") - marginx2)
3056 ok = VRset("CN_CURRENT", "Height", VRGet("GB_CURRENT2","Height") - marginx2)
3057
3058 ok = VRset("PB_DETACH", "Left", margin )
3059 ok = VRset("PB_DETACH", "Top", pane_height - pbtn_height - marginx2 )
3060 ok = VRset("PB_DETACH", "Width", min((lpane_width-margin*3) % 2, 1313) )
3061 ok = VRset("PB_UNMOUNT", "Left", VRGet("PB_DETACH","Width") + marginx2)
3062 ok = VRset("PB_UNMOUNT", "Top", pane_height - pbtn_height - marginx2 )
3063 ok = VRset("PB_UNMOUNT", "Width", min((lpane_width-margin*3) % 2, 1313) )
3064
3065 /* Splitbar - reduced in size to make it more noticable */
3066 ok = VRset("SPLIT_Main", "Visible", 1 )
3067 ok = VRset("SPLIT_Main", "Top", marginx2 + (pane_height-1200)%2 )
3068 ok = VRset("SPLIT_Main", "Height", 1200 /* pane_height */ )
3069
3070 /* Statusbar */
3071 ok = VRSet("GB_STATUSBAR", "Left", margin )
3072 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
3073 ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width )
3074
3075 ok = VRset("DT_STATUSBAR", "Top", 12 )
3076 ok = VRset("DT_STATUSBAR", "Left", 12 )
3077 ok = VRset("DT_STATUSBAR", "Height", VRGet("GB_STATUSBAR","Height") -24 )
3078 ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
3079
3080 /* Modified for notebook pages */
3081 pane_height = marginx2 + pane_height -1180
3082 rpane_width = marginx2 + rpane_width -760
3083 /* Use this as the width for the container pages, which don't have as strict a minimum width */
3084 rcnr_width = rpane_width
3085
3086 /* Minimum size of right panel (based on SW_DIALOG which is the largest) */
3087 if pane_height < 5360 then pane_height = 5360
3088 if rpane_width < 6010 then rpane_width = 6010
3089
3090 /* Dialog page */
3091 ok = VRSet("GB_DIALOG", "Top", margin /* marginx2 */ )
3092 ok = VRSet("GB_DIALOG", "Left", margin /* marginx2 */ /* split_left + 60 */ )
3093 ok = VRset("GB_DIALOG", "Height", pane_height )
3094 ok = VRset("GB_DIALOG", "Width", rpane_width )
3095
3096 ok = VRset("PB_MOUNT", "Left", margin )
3097 ok = VRset("PB_MOUNT", "Top", pane_height - pbtn_height - marginx2)
3098 ok = VRset("PB_EDIT_CANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
3099 ok = VRset("PB_EDIT_CANCEL", "Top", pane_height - pbtn_height - marginx2)
3100
3101 ok = VRset("PB_DIALOG_HELP", "Left", rpane_width - marginx2 - VRGet("PB_DIALOG_HELP","Width") + 24)
3102 ok = VRset("PB_DIALOG_HELP", "Top", pane_height - pbtn_height - marginx2)
3103
3104 ok = VRset("GB_SHARE", "Left", margin )
3105 ok = VRset("GB_SHARE", "Top", marginx2 /* 245 + marginx2 */ )
3106 ok = VRset("GB_SHARE", "Height", 2252 )
3107 ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
3108
3109 ok = VRset("GB_AUTH", "Left", margin )
3110 ok = VRset("GB_AUTH", "Top", margin * 3 + VRGet("GB_SHARE","Height") /* 245 + (margin * 3) + VRGet("GB_SHARE","Height") */ )
3111 ok = VRset("GB_AUTH", "Width", rpane_width - marginx2 )
3112
3113 ok = VRset("GB_MPOINT","Left", margin )
3114 ok = VRset("GB_MPOINT","Top", /* 245 + */ (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
3115 ok = VRset("GB_MPOINT","Width", rpane_width - marginx2 )
3116
3117 /* Advanced page */
3118 ok = VRSet("GB_ADVANCED", "Top", margin /* marginx2 */ )
3119 ok = VRSet("GB_ADVANCED", "Left", margin /* marginx2 */ /* split_left + 60 */ )
3120 ok = VRset("GB_ADVANCED", "Height", pane_height )
3121 ok = VRset("GB_ADVANCED", "Width", rpane_width )
3122
3123 ok = VRset("GB_ADVANCED2", "Left", margin )
3124 ok = VRset("GB_ADVANCED2", "Top", /* 245 + */ marginx2)
3125 ok = VRset("GB_ADVANCED2", "Width", rpane_width - marginx2)
3126 ok = VRset("GB_ADVANCED2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
3127
3128 ok = VRset("PB_ADVANCED_APPLY", "Left", margin )
3129 ok = VRset("PB_ADVANCED_APPLY", "Top", pane_height - pbtn_height - marginx2)
3130 ok = VRset("PB_ADVANCED_UNDO", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
3131 ok = VRset("PB_ADVANCED_UNDO", "Top", pane_height - pbtn_height - marginx2)
3132 ok = VRset("PB_ADVANCED_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
3133 ok = VRset("PB_ADVANCED_HELP", "Top", pane_height - pbtn_height - marginx2)
3134
3135 /* SMBTree page */
3136 ok = VRSet("GB_SMBTREE", "Top", margin /* x2 */ )
3137 ok = VRSet("GB_SMBTREE", "Left", margin /* x2 */ /* split_left + 60 */ )
3138 ok = VRset("GB_SMBTREE", "Height", pane_height )
3139 ok = VRset("GB_SMBTREE", "Width", rcnr_width )
3140
3141 ok = VRset("GB_SMBTREE2","Left", margin )
3142 ok = VRset("GB_SMBTREE2","Top", /* 45 + */ marginx2 )
3143 ok = VRset("GB_SMBTREE2","Width", rcnr_width - marginx2)
3144 ok = VRset("GB_SMBTREE2","Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
3145
3146 ok = VRset("CN_SMBTREE", "Top", margin )
3147 ok = VRset("CN_SMBTREE", "Left", margin )
3148 ok = VRset("CN_SMBTREE", "Width", VRGet("GB_SMBTREE2","Width") - marginx2)
3149 ok = VRset("CN_SMBTREE", "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
3150
3151 ok = VRset("PB_SMBTREE_CONNECT", "Left", margin )
3152 ok = VRset("PB_SMBTREE_CONNECT", "Top", pane_height - pbtn_height - marginx2)
3153 ok = VRset("PB_SMBTREE_REFRESH", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
3154 ok = VRset("PB_SMBTREE_REFRESH", "Top", pane_height - pbtn_height - marginx2)
3155
3156 hlpmin = VRGet("PB_SMBTREE_REFRESH", "Left") + VRGet("PB_SMBTREE_REFRESH","Width") + marginx2
3157 hlppos = rcnr_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24
3158 IF hlppos < hlpmin THEN hlppos = hlpmin
3159
3160 ok = VRset("PB_SMBTREE_HELP", "Left", hlppos )
3161 ok = VRset("PB_SMBTREE_HELP", "Top", pane_height - pbtn_height - marginx2)
3162
3163 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
3164 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
3165
3166 /* Connection details page */
3167 ok = VRSet("GB_CONDET", "Top", margin /* x2 */ )
3168 ok = VRSet("GB_CONDET", "Left", margin /* x2 */ /* split_left + 60 */ )
3169 ok = VRset("GB_CONDET", "Height", pane_height )
3170 ok = VRset("GB_CONDET", "Width", rcnr_width )
3171
3172 ok = VRset("GB_CONDET2", "Left", margin )
3173 ok = VRset("GB_CONDET2", "Top", /* 245 + */ marginx2)
3174 ok = VRset("GB_CONDET2", "Width", rcnr_width - marginx2)
3175 ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
3176
3177 ok = VRset("CN_CONDET", "Top", margin )
3178 ok = VRset("CN_CONDET", "Left", margin )
3179 ok = VRset("CN_CONDET", "Width", VRGet("GB_CONDET2","Width") - marginx2)
3180 ok = VRset("CN_CONDET", "Height", VRGet("GB_CONDET2","Height") - marginx2)
3181
3182 ok = VRset("PB_CONDET_SAVE", "Left", margin )
3183 ok = VRset("PB_CONDET_SAVE", "Top", pane_height - pbtn_height - marginx2 )
3184 ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
3185 ok = VRset("PB_CONDET_LOAD", "Top", pane_height - pbtn_height - marginx2 )
3186
3187 hlpmin = VRGet("PB_CONDET_LOAD", "Left") + VRGet("PB_CONDET_LOAD","Width") + marginx2
3188 hlppos = rcnr_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24
3189 IF hlppos < hlpmin THEN hlppos = hlpmin
3190
3191 ok = VRset("PB_CONDET_HELP", "Left", hlppos )
3192 ok = VRset("PB_CONDET_HELP", "Top", pane_height - pbtn_height - marginx2)
3193
3194 /* Global settings page */
3195 ok = VRSet("GB_GLOBAL", "Top", margin /* x2 */ )
3196 ok = VRSet("GB_GLOBAL", "Left", margin /* x2 */ /* split_left + 60 */ )
3197 ok = VRset("GB_GLOBAL", "Height", pane_height )
3198 ok = VRset("GB_GLOBAL", "Width", rpane_width )
3199
3200 ok = VRset("GB_GLOBAL2", "Left", margin )
3201 ok = VRset("GB_GLOBAL2", "Top", marginx2 /* 245 + marginx2 */ )
3202 ok = VRset("GB_GLOBAL2", "Width", rpane_width - marginx2 )
3203
3204 ok = VRset("GB_RESOLUTION", "Left", margin )
3205 ok = VRset("GB_RESOLUTION", "Top", margin * 3 + VRGet("GB_GLOBAL2","Height") /* 245 + (margin * 3) + VRGet("GB_GLOBAL2","Height") */ )
3206 ok = VRset("GB_RESOLUTION", "Width", rpane_width - marginx2 )
3207
3208 ok = VRset("GB_LOGGING","Left", margin )
3209 ok = VRset("GB_LOGGING","Top", /* 245 + */ (margin * 4) + VRGet("GB_GLOBAL2","Height") + VRGet("GB_RESOLUTION","Height"))
3210 ok = VRset("GB_LOGGING","Width", rpane_width - marginx2 )
3211
3212 ok = VRset("PB_SETTINGS_APPLY", "Left", margin )
3213 ok = VRset("PB_SETTINGS_APPLY", "Top", pane_height - pbtn_height - marginx2 )
3214 ok = VRset("PB_SETTINGS_APPLY", "Height", pbtn_height)
3215 ok = VRset("PB_SETTINGS_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
3216 ok = VRset("PB_SETTINGS_UNDO", "Top", pane_height - pbtn_height - marginx2 )
3217 ok = VRset("PB_SETTINGS_UNDO", "Height", pbtn_height)
3218 ok = VRset("PB_SETTINGS_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
3219 ok = VRset("PB_SETTINGS_HELP", "Top", pane_height - pbtn_height - marginx2)
3220 ok = VRset("PB_SETTINGS_HELP", "Height", pbtn_height)
3221
3222 /* SMB.CONF Settings page */
3223 ok = VRSet("GB_SMBCONFX", "Top", margin /* x2 */ )
3224 ok = VRSet("GB_SMBCONFX", "Left", margin /* x2 */ /* split_left + 60 */ )
3225 ok = VRset("GB_SMBCONFX", "Height", pane_height )
3226 ok = VRset("GB_SMBCONFX", "Width", rpane_width )
3227
3228 ok = VRset("GB_SMBCONF2", "Left", margin )
3229 ok = VRset("GB_SMBCONF2", "Top", marginx2 )
3230 ok = VRset("GB_SMBCONF2", "Width", rpane_width - marginx2 )
3231 ok = VRset("GB_SMBCONF2", "Height", pane_height - (margin * 7) - pbtn_height /* - 245 */ )
3232
3233 ok = VRset("PB_SMBCONF_APPLY", "Left", margin )
3234 ok = VRset("PB_SMBCONF_APPLY", "Top", pane_height - pbtn_height - marginx2 )
3235 ok = VRset("PB_SMBCONF_APPLY", "Height", pbtn_height)
3236 ok = VRset("PB_SMBCONF_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
3237 ok = VRset("PB_SMBCONF_UNDO", "Top", pane_height - pbtn_height - marginx2 )
3238 ok = VRset("PB_SMBCONF_UNDO", "Height", pbtn_height)
3239 ok = VRset("PB_SMBCONF_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
3240 ok = VRset("PB_SMBCONF_HELP", "Top", pane_height - pbtn_height - marginx2)
3241 ok = VRset("PB_SMBCONF_HELP", "Height", pbtn_height)
3242
3243 /* DOne with pages */
3244 ok = VRset("Main","Painting", 1)
3245
3246 /* check and empty event queue, trash spurious resize events */
3247 EventString = ''
3248 TrashedResize = 0
3249
3250 do until EventString = 'nop'
3251 EventString = VREvent('N')
3252 if EventString <> 'nop' then do
3253 if EventString = 'CALL Main_Resize' then TrashedResize = 1
3254 else interpret eventString
3255 end
3256 end
3257 if TrashedResize then CALL Main_Resize
3258
3259 if options.!debug == 1 then say time()' Main_Resize done'
3260return
3261/*:VRX Menu_Context_ChangeView_Click
3262*/
3263Menu_Context_ChangeView_Click:
3264 ok = VRSet("Cn_Current","View","NameTree")
3265return
3266
3267/*:VRX Menu_Context_Detach_All_Click
3268*/
3269Menu_Context_Detach_All_Click:
3270 ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
3271 do um = 1 to umrh.0
3272 ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
3273 call PB_DETACH_Click
3274 end
3275 drop um umrh.
3276return
3277
3278/*:VRX Menu_Context_Detach_Click
3279*/
3280Menu_Context_Detach_Click:
3281 call PB_DETACH_Click
3282return
3283
3284/*:VRX Menu_Context_Edit_Click
3285*/
3286Menu_Context_Edit_Click:
3287 if options.!debug == 1 then say time()' Menu_Context_Edit_Click started'
3288 /* call VRMethod "TDL_1", 'PostEvent', 'PageSelected', 'Page', 1 */
3289 ok = VRset("TDL_1", 'Selected', 1)
3290 options.!editmode = 1
3291 CALL VRSet "PB_EDIT_CANCEL","Visible", 1
3292 CALL VRSet "PB_UNMOUNT","Enabled", 0
3293
3294 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(33)" " )
3295/* CALL NLVSetText "DT_DIALOG","Caption",33 */
3296 CALL VRSet "GB_CURRENT", "ENABLED", 0
3297
3298 ok = VRSet("CB_MOUNT","Value","")
3299 ok = VRSet("CB_MOUNT","Selected",1)
3300 ok = VRSet("CB_MOUNT","Value",mtype.1)
3301
3302 parse var p_string p_workgroup':\\'p_server'\'p_share
3303
3304 /* if options.!debug == 1 then say time()' '||p_workgroup */
3305
3306 if options.!debug == 1 then say time()' data '||data
3307 if options.!debug == 1 then say time()' domain '||p_workgroup
3308 if options.!debug == 1 then say time()' server '||p_server
3309 if options.!debug == 1 then say time()' share '||p_share
3310 if options.!debug == 1 then say time()' string '||p_string
3311
3312
3313 CALL VRSet "EF_SHARE", "VALUE", p_share
3314 CALL VRSet "EF_SERVER", "VALUE", p_server
3315 CALL VRSet "EF_NETWORK","VALUE", p_workgroup
3316
3317 /* if options.!debug == 1 then say time()' '||p_node */
3318 parse var p_node p_drive'\'p_directory'\'
3319 CALL VRSet "CB_DRIVES", "Value", p_drive
3320 CALL VRSet "EF_DIRECTORY", "Value", p_directory
3321 if options.!debug == 1 then say time()' Menu_Context_Edit_Click done'
3322return
3323
3324/*:VRX Menu_Context_Open_Click
3325*/
3326Menu_Context_Open_Click:
3327 ok = VRSet("Menu_Context_Open_Default","Visible",0)
3328return
3329
3330/*:VRX Menu_Context_Open_Default_Click
3331*/
3332Menu_Context_Open_Default_Click:
3333 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click started"
3334 if \VRIsValidObject(rh) then return
3335
3336 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3337 PARSE VAR userdata mountpoint ';' mounts ';' .
3338
3339 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3340
3341 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
3342
3343 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click done"
3344return
3345
3346/*:VRX Menu_Context_Open_Detail_Click
3347*/
3348Menu_Context_Open_Detail_Click:
3349 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click started"
3350 if \VRIsValidObject(rh) then return
3351
3352 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3353 PARSE VAR userdata mountpoint ';' mounts ';' .
3354
3355 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3356
3357 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
3358
3359 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
3360return
3361
3362/*:VRX Menu_Context_Open_Icon_Click
3363*/
3364Menu_Context_Open_Icon_Click:
3365 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click started"
3366 if \VRIsValidObject(rh) then return
3367
3368 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3369 PARSE VAR userdata mountpoint ';' mounts ';' .
3370
3371 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3372
3373 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
3374
3375 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click done"
3376return
3377
3378/*:VRX Menu_Context_Open_Settings_Click
3379*/
3380Menu_Context_Open_Settings_Click:
3381 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click started"
3382 if \VRIsValidObject(rh) then return
3383
3384 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3385 PARSE VAR userdata mountpoint ';' mounts ';' .
3386
3387 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3388
3389 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
3390
3391 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click done"
3392return
3393
3394/*:VRX Menu_Context_Open_Splitview_Click
3395*/
3396Menu_Context_Open_Splitview_Click:
3397 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click started"
3398 if \VRIsValidObject(rh) then return
3399
3400 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3401 PARSE VAR userdata mountpoint ';' mounts ';' .
3402
3403 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3404
3405 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
3406
3407 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click done"
3408return
3409
3410/*:VRX Menu_Context_Open_Tree_Click
3411*/
3412Menu_Context_Open_Tree_Click:
3413 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click started"
3414 if \VRIsValidObject(rh) then return
3415
3416 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3417 PARSE VAR userdata mountpoint ';' mounts ';' .
3418
3419 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3420
3421 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
3422
3423 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click done"
3424return
3425
3426/*:VRX Menu_Context_Refresh_Click
3427*/
3428Menu_Context_Refresh_Click:
3429 CALL Refresh
3430return
3431
3432/*:VRX Menu_Context_Unmount_Click
3433*/
3434Menu_Context_Unmount_Click:
3435 call PB_UNMOUNT_Click
3436return
3437
3438/*:VRX Menu_File_Autostart_Activate_Click
3439*/
3440Menu_File_Autostart_Activate_Click:
3441 options.!autostart = 1
3442
3443 Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
3444 ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
3445 if ExeName = "" then do
3446 parse source . . script
3447 ExeName = VRParseFilename(script,'DP')'\'options.!appname_short'.EXE'
3448 end
3449 StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
3450 if StartupDir = "" then do
3451 parse source . . script
3452 StartUpDir = VRParseFilename(script,'DP')
3453 end
3454
3455 ObjTitle = NLVGetMessage( 59 )
3456 if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
3457
3458 CALL PB_CONDET_SAVE_Click
3459
3460 rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
3461 'EXENAME='||ExeName||';'||,
3462 'PROGTYPE=PM;'||,
3463 'TITLE='ObjTitle';'||,
3464 'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
3465 'STARTUPDIR='StartupDir';'||,
3466 'NOPRINT=YES;'||,
3467 'HIDEBUTTON=DEFAULT;'||,
3468 'MINWIN=DEFAULT;'||,
3469 'CCVIEW=DEFAULT;'||,
3470 'DEFAULTVIEW=DEFAULT;'||,
3471 'OBJECTID=<'options.!appname_short'_AUTOSTART>',,
3472 'REPLACE' )
3473
3474 IF rc == 1 THEN do
3475 Text = NLVGetMessage( 60 )
3476 if Text = "" then Text = '[Created object in Autostart-Folder]'
3477 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3478 end
3479 ELSE do
3480 Text = NLVGetMessage( 61 )
3481 if Text = "" then Text = '[Could not create object in Autostart-Folder]'
3482 Title = NLVGetMessage( 5 )
3483 if Title = "" then Title = '[Error]'
3484 CALL VRMessage 'Main', Text, Title, 'E'
3485 end
3486
3487 options.!autostart = 0
3488return
3489/*:VRX Menu_File_Autostart_Click
3490*/
3491Menu_File_Autostart_Click:
3492
3493return
3494
3495/*:VRX Menu_File_Autostart_Deactivate_Click
3496*/
3497Menu_File_Autostart_Deactivate_Click:
3498 ok = SysDestroyObject("<'options.!appname_short'_AUTOSTART>")
3499 IF ok == 1 THEN do
3500 Text = NLVGetMessage( 79 )
3501 if Text = "" then Text = '[Autostart object created successfully]'
3502 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3503 end
3504 ELSE do
3505 Text = NLVGetMessage( 78 )
3506 if Text = "" then Text = '[Could find Autostart object]'
3507 Title = NLVGetMessage( 5 )
3508 if Title = "" then Title = '[Error]'
3509 CALL VRMessage 'Main', Text, Title, 'E'
3510 end
3511return
3512
3513/*:VRX Menu_File_Click
3514*/
3515Menu_File_Click:
3516 ok = VRSet("Menu_File_LMHosts_Reset", "Enabled", VRFileExists( samba.!lmhosts ))
3517 ok = VRSet("Menu_File_ucCred_Reset", "Enabled", (VRGet("Pict_PWINMEM","PicturePath") = "#36"))
3518return
3519
3520/*:VRX Menu_File_Close_Click
3521*/
3522Menu_File_Close_Click:
3523 call Quit
3524return
3525
3526/*:VRX Menu_File_Daemon_Start_Click
3527*/
3528Menu_File_Daemon_Start_Click:
3529 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click started'
3530 if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
3531 btns.0 = 2
3532 btns.1 = NLVGetMessage( 6 )
3533 btns.2 = NLVGetMessage( 7 )
3534 confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3535 IF confirm == 1 THEN do
3536 logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
3537 ok1 = SysFileDelete(Logfiles||'\log.smbc')
3538 ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
3539 if ok1 <> 0 | ok2 <> 0 then do
3540 ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
3541 end
3542 drop ok1 ok2
3543 end
3544 end
3545 address cmd 'detach 'fs.!prefix'CTL.EXE'
3546 ok = VRset("GB_CURRENT","Enabled", 1)
3547 ok = VRset("TDL_1","Enabled", 1)
3548 CALL REFRESH
3549 ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
3550 ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
3551 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click done'
3552return
3553
3554/*:VRX Menu_File_Daemon_Stop_Click
3555*/
3556Menu_File_Daemon_Stop_Click:
3557 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click started'
3558 ok = PRProcessList(proc)
3559 do I = 1 to proc.0
3560 CurProc = VRParseFileName(proc.i.name,'NE')
3561 if CurProc = fs.!prefix"CTL.EXE" then do
3562 call charout , ' 'CurProc' RC='
3563 ok = PRKillProcess(1,proc.i.pid)
3564 say ok
3565 end
3566 end
3567 ok = VRset("GB_CURRENT","Enabled", 0)
3568 ok = VRset("TDL_1","Enabled", 0)
3569 ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
3570 ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
3571 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click stopped'
3572return
3573/*:VRX Menu_File_LMHosts_Reset_Click
3574*/
3575Menu_File_LMHosts_Reset_Click:
3576 call _LMHostsReset
3577return
3578
3579/*:VRX Menu_File_Load_Click
3580*/
3581Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
3582 IF options.!autoload == 1 then filename = Profile
3583 else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3584 IF filename == '' THEN RETURN
3585 IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3586 CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3587 RETURN
3588 END
3589
3590 CALL LINEIN filename, 1, 0
3591 DO WHILE LINES( filename )
3592 /* Fix Ticket #202 in order to allow blanks in sharenames */
3593 resline = LINEIN( filename )
3594 nodelen = pos('\\',resline)-2
3595 node = left(resline,nodelen)
3596 rwFlag = word(resline,words(resline))
3597 resource = substr(resline,nodelen+2,length(resline)-(nodelen+2)-(length(rwFlag)+1)+1)
3598 drop resline
3599 drop nodelen
3600
3601 vfs.!drive = FILESPEC('DRIVE', node )
3602 vfs.!mountpoint = STRIP( node, 'T', '\')
3603
3604 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3605 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3606
3607 call ParseResParmString
3608
3609 options.!workgroup = p_workgroup
3610 options.!server = p_server
3611 options.!share = p_share
3612 options.!user = p_user
3613 options.!password = p_password
3614 options.!spassword = p_spassword
3615 options.!master = p_master
3616 options.!mastertype = p_mtype
3617/* options.!memlen = p_memlen
3618 options.!logfile = p_logfile
3619 options.!loglevel = p_loglevel */
3620 options.!cachetimeout = p_cachetimeout
3621 options.!cachelistings = p_cachelistings
3622 options.!easupport = p_easupport
3623
3624 IF rwFlag == 'R' THEN
3625 options.!readonly = 1
3626 ELSE
3627 options.!readonly = 0
3628
3629 CALL Mount
3630
3631 END
3632 CALL STREAM filename, 'C', 'CLOSE'
3633
3634 options.!autoload = 0
3635
3636 CALL Refresh
3637RETURN
3638/*:VRX Menu_File_Save_Click
3639*/
3640Menu_File_Save_Click:
3641 call PB_CONDET_SAVE_Click
3642return
3643
3644/*:VRX Menu_File_ucCred_Reset_Click
3645*/
3646Menu_File_ucCred_Reset_Click:
3647 if _ucChkUc() then ok = _ucDelUc()
3648 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
3649 ok = VRSet("EF_USER", "Value","")
3650 ok = VRSet("EF_PASSWORD","Value","")
3651 call _UserCredUpdate
3652return
3653
3654/*:VRX Menu_Help_About_Click
3655*/
3656Menu_Help_About_Click:
3657 ok = VRLoadSecondary("SW_ABOUT", "W")
3658return
3659
3660/*:VRX Menu_Help_Extended_Click
3661*/
3662Menu_Help_Extended_Click:
3663 ok = VRMethod( "Main", "InvokeHelp" )
3664return
3665
3666/*:VRX Menu_Selected_Connect_Click
3667*/
3668Menu_Selected_Connect_Click:
3669 call PB_SMBTREE_CONNECT_Click
3670return
3671
3672/*:VRX Menu_Selected_Default_Workgroup_Click
3673*/
3674Menu_Selected_Default_Workgroup_Click:
3675 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click started"
3676 if options.!debug == 1 then say ' SMBObj.rh = "'SMBObj.rh'"'
3677 Success = 0
3678 if SMBObj.rh <> "" then do
3679 if options.!debug == 1 then say ' SMBObj.udatatype = "'SMBObj.udatatype'"'
3680 Success = 1
3681 select
3682 when SMBObj.udatatype = "WORKGROUP" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
3683 when SMBObj.udatatype = "DISK" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3684 when SMBObj.udatatype = "PRINTER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3685 when SMBObj.udatatype = "SERVER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
3686 otherwise Success = 0
3687 end
3688
3689 /* FIXME: switch over to REXXIni calls */
3690 if Success = 1 then ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
3691 end
3692 Buttons.1 = NLVGetMessage(2)
3693 Buttons.0 = 1
3694
3695 if Success = 0 then do
3696 id = VRMessage( VRWindow(), NLVGetMessage(5), NLVGetMessage(75), "Error", "Buttons.", 1, 1 )
3697 end
3698 else do
3699 id = VRMessage( VRWindow(), NLVGetMessage(117, workgroupname), NLVGetMessage(75), "Information", "Buttons.", 1, 1 )
3700 end
3701 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click done"
3702return
3703
3704/*:VRX Menu_Selected_DetailsView_Click
3705*/
3706Menu_Selected_DetailsView_Click:
3707 ok = VRSet("CN_smbtree", "View", "Detail")
3708return
3709
3710/*:VRX Menu_Selected_Info_Click
3711*/
3712Menu_Selected_Info_Click:
3713 if options.!debug == 1 then say time()' Menu_Selected_Info_Click started'
3714
3715 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3716 if SelRH.0 = 0 then do
3717 if options.!debug == 1 then say time()' Menu_Selected_Info_Click aborted'
3718 return
3719 end
3720
3721 call _GetSMBObjectProperties SelRH.1
3722
3723 window = VRLoadSecondary( "SW_INFO", "W" )
3724 if options.!debug == 1 then say time()' Menu_Selected_Info_Click done'
3725return
3726
3727/*:VRX Menu_Selected_Refresh_Click
3728*/
3729Menu_Selected_Refresh_Click:
3730 ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
3731 call _DelSMBObjectShares SMBObj.rh
3732 machine = SMBObj.resname
3733 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
3734 call _RefreshShares
3735return
3736
3737/*:VRX Menu_Selected_Remove_Click
3738*/
3739Menu_Selected_Remove_Click:
3740 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
3741 if selrec.0 = 0 then return
3742
3743 do I = 1 to selrec.0
3744 if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
3745 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3746 end
3747 else do
3748 mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
3749 mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
3750 if mpidx = 1 then do
3751 btns.0 = 2
3752 btns.1 = NLVGetMessage( 6 )
3753 btns.2 = NLVGetMessage( 7 )
3754 confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3755 IF confirm \= 1 THEN RETURN
3756
3757 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
3758 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3759 CALL Refresh
3760 end
3761 else do
3762 CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
3763 end
3764 end
3765 end
3766return
3767
3768/*:VRX Menu_Selected_Retry_Click
3769*/
3770Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba. mtype.
3771
3772 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
3773 if srcrec.0 = 0 then return
3774
3775 srcrec = srcrec.1
3776
3777 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
3778
3779 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, cd.workgrpFH )
3780 p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
3781 p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
3782 p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
3783 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
3784
3785 ShareLevel = 1
3786 if p_share = "" then ShareLevel = 2
3787 if p_server = "" then ShareLevel = 3
3788 if p_workgroup = "" then ShareLevel = 4
3789
3790 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
3791 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
3792
3793 call _UpdateObject "EF_SERVER", p_server
3794 ok = VRset("EF_SHARE" , "Value", p_share)
3795 ok = VRset("EF_NETWORK", "Value", p_workgroup)
3796 ok = VRset("EF_USER" , "Value", p_user)
3797 ok = VRset("EF_PASSWORD", "Value", p_password)
3798
3799 parse var p_mpoint p_drv '\' p_dir
3800
3801 p_dir = strip(p_dir,'T','\')
3802
3803 ok = VRset("CB_DRIVES" , "Value", p_drv)
3804 ok = VRset("EF_DIRECTORY" , "Value", p_dir)
3805
3806 CALL PB_MOUNT_Click
3807
3808/* if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
3809 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
3810 end */
3811return
3812
3813/*:VRX Menu_Selected_TimeSync_Click
3814*/
3815Menu_Selected_TimeSync_Click:
3816 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click started'
3817
3818 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3819 if SelRH.0 = 0 then do
3820 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click aborted'
3821 return
3822 end
3823
3824 call _GetSMBObjectProperties SelRH.1
3825
3826 options.!timesrv = SMBObj.resname
3827 call _TimeSync
3828
3829 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click done'
3830return
3831
3832/*:VRX Menu_Selected_TreeView_Click
3833*/
3834Menu_Selected_TreeView_Click:
3835 ok = VRSet("CN_smbtree", "View", "IconTree")
3836return
3837
3838/*:VRX Mount
3839*/
3840Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3841 if options.!debug == 1 then say time()' Mount procedure started'
3842 /* Set mouse pointer to wait - this operation might take a few seconds */
3843 call VRSet VRWindow(), 'Pointer', 'Wait'
3844
3845/* Disabled, because we merge profile now - in earlier revisions
3846 we replaced it but only for preexisting drives - this made only
3847 sense as long as we were unable to detect double connections -
3848 this could be made an option!
3849
3850 IF options.!autoload then do
3851 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
3852 if options.!debug == 1 then say time()' '||'Autoload Detach "'vfs.!drive'" =' ok
3853 end */
3854
3855 /* Attach the virtual drive - only if drive is not already attached */
3856 if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
3857 CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
3858
3859 if options.!debug == 1 then say time()' '||'Attach "'vfs.!drive'" =' ok
3860 end
3861
3862 /* Create the mount point and store whether it was created or already existed */
3863 CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
3864
3865 if options.!debug == 1 then say time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
3866
3867
3868 /* Build the resource parameter string */
3869 src = ''
3870 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3871 IF options.!server \= '' THEN src = src';SERVER='options.!server
3872 IF options.!share \= '' THEN src = src';SHARE='options.!share
3873 IF options.!user \= '' THEN src = src';USER='options.!user
3874 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3875 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3876 IF options.!master \= '' THEN src = src';MASTER='options.!master
3877 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3878/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3879 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3880 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3881 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3882 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3883 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3884
3885 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3886
3887 parse var vfs.!mountpoint mpoint ';' .
3888 mpoint = strip(mpoint,'T','\')||'\'
3889
3890 if options.!master = "" then options.!master = "WORKGROUP"
3891 if options.!mtype = "" then options.!mtype = "1"
3892 if options.!loglevel = "" then options.!loglevel = "0"
3893 if options.!memlen = "" then options.!memlen = "2"
3894 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3895 if options.!cachelistings = "" then options.!cachelistings = "32"
3896 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3897 if options.!password <> "" & options.!spassword = "" then do
3898 options.!spassword = c2x(options.!password)
3899 options.!password = ""
3900 end
3901
3902 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3903
3904 md5 = rexx_md5(hashstr)
3905
3906 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3907 DO i = 1 TO records.0
3908 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3909
3910 if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3911 if options.!debug == 1 then say mpoint'->'md5
3912
3913 if hash = md5 then do
3914 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3915 say "Double connection detected!!"
3916 if options.!spassword <> "" then upw = ":********"
3917 else upw = ""
3918 buttons.0 = 2
3919 buttons.1 = NLVGetMessage(9)
3920 buttons.2 = NLVGetMessage(3)
3921 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3922 if Answer = 2 then do
3923 call VRSet VRWindow(), 'Pointer', '<default>'
3924 say "Double connection - do not mount!!"
3925 return
3926 end
3927 end
3928 else do /* Same hash, status passive - we have to remove it */
3929 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3930 end
3931 end
3932 end
3933
3934 cd.lastrh = ""
3935 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3936
3937 /* Now mount the resource */
3938 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3939
3940 if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
3941 if ok <> 0 then do
3942 if options.!password <> "" then upw = ":********"
3943 else upw = ""
3944 buttons.0 = 2
3945 buttons.1 = NLVGetMessage(2)
3946 buttons.2 = NLVGetMessage(37)
3947 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3948 if Answer = 2 then do /* Show explanation */
3949 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')
3950 end
3951 if cd.lastrh <> '' then do
3952 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3953 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3954 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3955 end
3956
3957 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3958 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3959 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3960 if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3961 end
3962 end
3963 else do
3964 if options.!storecreds = 1 then do
3965 ok = VRSet("EF_User", "Value",options.!user)
3966 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3967 end
3968 end
3969 drop CreateMP /* not required anymore */
3970
3971/* Obsolete - the IOCtl will not be implemented this way in the plugin
3972 The REXX function is present, but is has no counterpart in the plugin
3973 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3974 if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3975 */
3976 /* Set mouse pointer to default again */
3977 call VRSet VRWindow(), 'Pointer', '<default>'
3978 if options.!debug == 1 then say time()' Mount procedure done'
3979RETURN ok
3980
3981/*:VRX MyFreeDriveMap
3982*/
3983MyFreeDriveMap: procedure expose options. icons. fs. samba.
3984 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
3985 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:"
3986/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
3987 useddrives= SysDriveMap("C:","USED")
3988/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
3989
3990 Alldr = words(alldrives)
3991 FreeDriveMap = ""
3992 do I = 1 to AllDr
3993 if word(alldrives,1) = word(useddrives,1) then do
3994 Useddrives = subword(useddrives,2)
3995 Alldrives = subword(Alldrives,2)
3996 end
3997 else do
3998 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3999 Alldrives = subword(Alldrives,2)
4000 end
4001 end
4002 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
4003return FreeDriveMap
4004/*:VRX NoEVFSCALL
4005*/
4006NoEVFSCALL:
4007 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
4008 signal Halt
4009RETURN
4010
4011/*:VRX ParseResourceData
4012*/
4013ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
4014 PARSE ARG userdata, resource
4015 if options.!debug == 1 then say time()' ParseResourceData started'
4016 if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
4017
4018/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
4019
4020/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
4021
4022 select /* Support for other filesystems comes here! */
4023 when left(word(resource,1),5) = "SMBFS" then do
4024 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
4025 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
4026
4027 p_mpoint = strip(p_mpoint,'T','\')||'\'
4028 p_rw = word(resource, words(resource))
4029
4030 /* Workaround for truncated resource string */
4031 if length(p_rw) > 1 then do
4032 /* The resource string must have been truncated
4033 p_rw is already wrong and
4034 p_easupport will most likely be also wrong (look below for workaround!) */
4035 p_rw ="W" /* this is guessed only!!! */
4036 if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
4037 end
4038 /* this should be done unconditionally if the resource string is never truncated */
4039 else resource = left(resource,length(resource)-length(p_rw))
4040
4041 call ParseResParmString
4042
4043 if p_master = "" then p_master = "WORKGROUP"
4044 if p_mtype = "" then p_mtype = "1"
4045 if p_loglevel = "" then p_loglevel = "0"
4046 if p_memlen = "" then p_memlen = "2"
4047
4048 /* Also works around for a truncated resource string! */
4049 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
4050
4051 if p_password <> "" & p_spassword = "" then do
4052 p_spassword = c2x(p_password)
4053 p_password = ""
4054 end
4055
4056 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)
4057 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
4058 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
4059 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)
4060 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
4061 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
4062
4063 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
4064
4065 md5 = rexx_md5(hashstr)
4066
4067 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
4068
4069 SELECT
4070 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
4071 IF p_workgroup == '' THEN
4072 userdata = userdata';\\'p_server'\*'
4073 ELSE
4074 userdata = userdata';'p_workgroup':\\'p_server'\*'
4075 END
4076 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
4077 userdata = userdata';'p_workgroup':\\*'
4078 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
4079 userdata = userdata';*:\\*'
4080 OTHERWISE DO
4081 IF p_workgroup == '' THEN
4082 userdata = userdata';\\'p_server'\'p_share
4083 ELSE
4084 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
4085 END
4086 END
4087
4088 end
4089 when left(word(resource,1),3) = "DAV" then do
4090 userdata = "webDAV"
4091 end
4092 otherwise do /* All unsupported filesystems end here! */
4093 userData = "UNKNOWN"
4094 end
4095 end
4096 if left(word(resource,1),5) <> "SMBFS" then do
4097 end
4098 else do
4099 end
4100
4101 if options.!debug == 1 then say ' returning "'userdata'"'
4102 if options.!debug == 1 then say time()' ParseResourceData done'
4103RETURN userdata
4104
4105/*:VRX ParseResParmString
4106*/
4107ParseResParmString:
4108 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
4109 PARSE VAR resource . ';SERVER=' p_server ';' .
4110 PARSE VAR resource . ';SHARE=' p_share ';' .
4111 PARSE VAR resource . ';USER=' p_user ';' .
4112 PARSE VAR resource . ';PASSWORD=' p_password ';' .
4113 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
4114 PARSE VAR resource . ';MASTER=' p_master ';' .
4115 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
4116 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
4117 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
4118 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
4119 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
4120 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
4121 PARSE VAR resource . ';EASUPPORT=' p_easupport ';' .
4122 PARSE VAR resource . ';KRB5SUPPORT=' p_krb5support ';' .
4123 PARSE VAR resource . ';NTLMV1SUPPORT=' p_ntlmv1support ';' .
4124 PARSE VAR resource . ';ENCRYPTIONSUPPORT=' p_encryptionsupport ' '
4125
4126return
4127/*:VRX PB_ABOUT_CLOSE_Click
4128*/
4129PB_ABOUT_CLOSE_Click:
4130 CALL SW_ABOUT_Close
4131return
4132
4133/*:VRX PB_ABOUT_COPY_Click
4134*/
4135PB_ABOUT_COPY_Click:
4136
4137 if VRGet("CB_TRAC","set") then DO
4138 remainstr = AboutStr
4139 AboutStr = ''
4140 DO WHILE remainstr <> ''
4141 PARSE VAR remainstr _part '0d0a'x remainstr
4142 AboutStr = AboutStr || _part ||'[[BR]]'||'0d0a'x
4143 END
4144 END
4145 ok = VRMethod( "Application", "PutClipboard", AboutStr )
4146 if options.!debug == 1 then call beep 880*2,10
4147 CALL SW_ABOUT_Close
4148return
4149
4150/*:VRX PB_ADVANCED_APPLY_Click
4151*/
4152PB_ADVANCED_APPLY_Click:
4153 advanced.!easupport = VRGet( "CB_EAS", "Set" )
4154 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
4155 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
4156 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
4157 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
4158 advanced.!kerberos5 = VRGet( "CB_KERBEROS5", "Set" )
4159 advanced.!ntlmv1 = VRGet( "CB_NTLMV1", "Set" )
4160 advanced.!encryption = VRGet( "CB_ENCRYPTION", "Set" )
4161
4162 /* Obsolete */
4163 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
4164return
4165
4166/*:VRX PB_ADVANCED_HELP_Click
4167*/
4168PB_ADVANCED_HELP_Click:
4169 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
4170return
4171
4172/*:VRX PB_ADVANCED_UNDO_Click
4173*/
4174PB_ADVANCED_UNDO_Click:
4175 CALL SW_ADVANCED_Init_Content
4176RETURN
4177
4178/*:VRX PB_ClearCred_Click
4179*/
4180PB_ClearCred_Click:
4181 call Menu_File_ucCred_Reset_Click
4182return
4183
4184/*:VRX PB_CONDET_HELP_Click
4185*/
4186PB_CONDET_HELP_Click:
4187 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
4188return
4189
4190/*:VRX PB_CONDET_LOAD_Click
4191*/
4192PB_CONDET_LOAD_Click:
4193 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
4194 call Menu_File_Load_Click
4195 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
4196RETURN
4197
4198/*:VRX PB_CONDET_SAVE_Click
4199*/
4200PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
4201 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
4202
4203 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
4204 ELSE filename = Profile
4205
4206 IF filename == '' THEN RETURN
4207
4208 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
4209 btns.0 = 2
4210 btns.1 = NLVGetMessage( 6 )
4211 if btns.1 = "" then btns.1 = '[Yes]'
4212 btns.2 = NLVGetMessage( 7 )
4213 if btns.2 = "" then btns.2 = '[No]'
4214 Title = NLVGetMessage( 53 )
4215 if Title = "" then Title = "[File exists]"
4216 Text = NLVGetMessage( 54, filename )
4217 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
4218
4219 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
4220 IF confirm \= 1 THEN RETURN
4221 CALL VRChAttr filename,, 'HSR'
4222 CALL VRDeleteFile filename
4223 END
4224
4225 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
4226 DO i = 1 TO records.0
4227 resource = ""
4228 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
4229 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
4230 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
4231 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
4232 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
4233 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
4234 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
4235 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
4236 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
4237 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
4238 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
4239 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
4240 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
4241 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
4242 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
4243/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
4244 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
4245 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
4246 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
4247 resource = resource||';KRB5SUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.kerberos5FH)
4248 resource = resource||';NTLMV1SUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ntlmv1FH)
4249 resource = resource||';ENCRYPTIONSUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.encryptionFH)
4250 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
4251 call lineout filename, resource
4252 END
4253 CALL STREAM filename, 'C', 'CLOSE'
4254
4255 if options.!autostart == 0 THEN do
4256 Title = NLVGetMessage( 51 )
4257 if Title = "" then Title = "[Profile saved]"
4258 Text = NLVGetMessage( 52, filename )
4259 if Text = "" then Text = "[Profile saved to "filename"!]"
4260 CALL VRMessage 'Main', Text , Title, 'I'
4261 end
4262
4263 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
4264RETURN
4265
4266/*:VRX PB_DETACH_Click
4267*/
4268PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4269 if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
4270 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4271 IF select.0 < 1 THEN RETURN
4272
4273 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4274 PARSE VAR userdata mountpoint ';' mounts ';' .
4275 drive = STRIP( mountpoint, 'T', '\')
4276
4277 btns.0 = 2
4278 btns.1 = NLVGetMessage( 6 )
4279 btns.2 = NLVGetMessage( 7 )
4280 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4281 IF confirm \= 1 THEN RETURN
4282
4283 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
4284 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
4285 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
4286 if datatype(mounts) = 'NUM' then do
4287 /* Unmount any resources */
4288 DO i = 1 TO mounts
4289 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4290 END
4291 end
4292 else if options.!debug == 1 then say ' '||"mounts = "mounts
4293
4294 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
4295
4296 CALL Refresh
4297 if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
4298RETURN
4299
4300/*:VRX PB_DIALOG_HELP_Click
4301*/
4302PB_DIALOG_HELP_Click:
4303 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
4304return
4305
4306/*:VRX PB_EDIT_CANCEL_Click
4307*/
4308PB_EDIT_CANCEL_Click:
4309 options.!editmode = 0
4310 CALL VRSet "PB_UNMOUNT","Enabled", 1
4311 CALL VRSet "GB_CURRENT", "ENABLED", 1
4312 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
4313 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
4314/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4315RETURN 0
4316
4317/*:VRX PB_INFO_OK_Click
4318*/
4319PB_INFO_OK_Click:
4320 call SW_INFO_Close
4321RETURN
4322
4323/*:VRX PB_LOGIN_CANCEL_Click
4324*/
4325PB_LOGIN_CANCEL_Click:
4326 credentials.!entered = 0
4327 call SW_LOGIN_Close
4328RETURN
4329
4330/*:VRX PB_LOGIN_OK_Click
4331*/
4332PB_LOGIN_OK_Click:
4333 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
4334 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
4335 options.!storecreds = VRGet("CB_STORECREDS1","Set")
4336 credentials.!entered = 1
4337
4338 if p_server <> "" then do
4339 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
4340
4341 if word(ok,1) = "1" then do
4342 ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
4343 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
4344 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
4345 end
4346 else do
4347 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
4348 end
4349 end
4350
4351 call SW_LOGIN_Close
4352RETURN
4353
4354/*:VRX PB_MOUNT_Click
4355*/
4356PB_MOUNT_Click:
4357 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
4358 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
4359 say " network = "network
4360 if options.!editmode = 1 then do
4361 CALL PB_UNMOUNT_Click
4362 options.!editmode = 0
4363 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
4364/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4365
4366 CALL VRSet "PB_UNMOUNT","Enabled", 1
4367 CALL VRSet "GB_CURRENT", "ENABLED", 1
4368 end
4369
4370 options.!workgroup = ''
4371 options.!server = ''
4372 options.!share = ''
4373 options.!user = ''
4374 options.!password = ''
4375 options.!master = ''
4376 options.!mastertype = ''
4377 options.!memlen = advanced.!memlen
4378 options.!easupport = advanced.!easupport
4379 options.!readonly = advanced.!readonly
4380 options.!loglevel = advanced.!loglevel
4381 options.!logfile = advanced.!logfile
4382 options.!cachetimeout = advanced.!cachetimeout
4383 options.!cachelistings = advanced.!cachelistings
4384 options.!kerberos5 = advanced.!kerberos5
4385 options.!ntlmv1 = advanced.!ntlmv1
4386 options.!encryption = advanced.!encryption
4387
4388 vfs.!drive = ''
4389 vfs.!mountpoint = ''
4390
4391 stype = VRGet( "CB_MOUNT", "Selected" )
4392 share = STRIP( VRGet( "EF_SHARE", "Value" ))
4393 server = STRIP( VRGet( "EF_SERVER", "Value" ))
4394 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
4395 mtype = VRGet( "CHK_MTYPE", "Set" )
4396 userid = STRIP( VRGet( "EF_USER", "Value" ))
4397 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
4398 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
4399 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
4400 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
4401
4402 IF ( stype < 1 | stype > 4 ) THEN stype = 1
4403
4404 /* The required/optional/ignored parameters depend on the type of mount
4405 * requested. (Note, however, that the user, password, easupport and
4406 * memlen parameters are always optional.)
4407 */
4408 SELECT
4409 /* Scenario 1: Mount a single share.
4410 * Required: share, server
4411 * Optional: workgroup
4412 * Unused: master, mastertype
4413 */
4414 WHEN stype = 1 THEN DO
4415 IF server == '' | share == '' THEN DO
4416 /* error */
4417 RETURN 1
4418 END
4419 options.!server = server
4420 options.!share = share
4421 options.!workgroup = network
4422 END
4423
4424 /* Scenario 2: Mount all shares on a server.
4425 * Required: server
4426 * Optional: workgroup
4427 * Unused: share, master, mastertype
4428 */
4429 WHEN stype = 2 THEN DO
4430 IF server == '' THEN DO
4431 /* error */
4432 RETURN 1
4433 END
4434 options.!server = server
4435 options.!workgroup = network
4436 END
4437
4438 /* Scenario 3: Mount all servers in a workgroup.
4439 * Required: workgroup
4440 * Optional: -
4441 * Unused: share, server, master, mastertype
4442 */
4443 WHEN stype = 3 THEN DO
4444 IF workgroup == '' THEN DO
4445 /* error */
4446 RETURN 1
4447 END
4448 options.!workgroup = network
4449 END
4450
4451 /* Scenario 4: Mount all workgroups known to a master.
4452 * Required: master, mastertype
4453 * Optional: -
4454 * Unused: share, server, workgroup
4455 */
4456 WHEN stype = 4 THEN DO
4457 IF master == '' | mastertype == '' THEN DO
4458 /* error */
4459 RETURN 1
4460 END
4461 options.!master = network
4462 options.!mastertype = mtype
4463 END
4464 END
4465
4466 options.!user = userid
4467 options.!password = password
4468
4469 vfs.!drive = mdrive
4470 vfs.!mountpoint = mdrive'\'mpath
4471
4472 CALL Mount
4473 CALL Refresh
4474 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
4475 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
4476RETURN 0
4477
4478/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
4479*/
4480PB_NEWMOUNTPOINTCANCEL_Click:
4481 ok = VRSet("CB_DRIVES","Value","")
4482 ok = VRSet("EF_DIRECTORY","Value","")
4483 call SW_MOUNTPOINT_Close
4484RETURN 0
4485
4486/*:VRX PB_NEWMOUNTPOINTOK_Click
4487*/
4488PB_NEWMOUNTPOINTOK_Click:
4489 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4490 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4491
4492 advanced.!readonly = VRGet("CB_READONLY1","Set")
4493 advanced.!easupport = VRGet("CB_EAS1","Set")
4494 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4495 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4496 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4497 advanced.!kerberos5 = VRGet("CB_KERBEROS51","Set")
4498 advanced.!ntlmv1 = VRGet("CB_NTLMV11","Set")
4499 advanced.!encryption = VRGet("CB_ENCRYPTION1","Set")
4500
4501 call SW_MOUNTPOINT_Close
4502RETURN
4503
4504/*:VRX PB_NEWPORTCANCEL_Click
4505*/
4506PB_NEWPORTCANCEL_Click:
4507/* ok = VRSet("CB_DRIVES","Value","")
4508 ok = VRSet("EF_DIRECTORY","Value","")
4509 call SW_MOUNTPOINT_Close */
4510RETURN 0
4511
4512/*:VRX PB_NEWPORTCONNECT_Click
4513*/
4514PB_NEWPORTCONNECT_Click:
4515/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4516 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4517
4518 advanced.!readonly = VRGet("CB_READONLY1","Set")
4519 advanced.!easupport = VRGet("CB_EAS1","Set")
4520 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4521 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4522 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4523
4524 call SW_MOUNTPOINT_Close */
4525RETURN
4526
4527/*:VRX PB_PROGRESS_ABORT_Click
4528*/
4529PB_PROGRESS_ABORT_Click:
4530 options.!delay = 0
4531 options.!autoload = 0
4532 options.!autoclose = 0
4533 call SW_PROGRESS_Close
4534return
4535
4536/*:VRX PB_SETTINGS_APPLY_Click
4537*/
4538PB_SETTINGS_APPLY_Click:
4539 advanced.!loglevel = VRGet("SPIN_LOG_LEVEL", "Value" )
4540 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4541 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4542 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4543 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4544 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4545 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4546 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4547 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4548
4549 /* Note: CB_LOGGING has its own event tied to the click */
4550 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4551 options.!debug = VRGet("CB_DEBUG", "Set" )
4552
4553 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4554 ok = VRRedirectStdio("ON")
4555 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4556 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4557 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4558 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4559 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4560 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4561 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4562 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4563 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4564 end
4565 else do /* Turn on additional columns in connection details view */
4566 ok = VRRedirectStdio("OFF")
4567 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4568 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4569 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4570 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4571 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4572 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4573 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4574 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4575 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4576 end
4577
4578 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4579 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4580 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4581
4582 if advanced.!lmhosts = 1 then do
4583 call _LMHostsRead
4584 call _LMHostsUpdate
4585 end
4586 if advanced.!smbconfchanged = 1 then do
4587 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4588 handle = IniOpen('global', samba.!smbconf)
4589 call IniSet 'name resolve order', name_resolve_order, handle
4590 /* FIXME: Throw an error in this case */
4591 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4592 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4593 call IniSet 'log level', VRGet("SPIN_LOG_LEVEL","Value"), handle
4594 call IniSave handle
4595 call IniClose handle
4596 advanced.!smbconfchanged = 0
4597 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4598 end
4599 if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
4600return
4601
4602/*:VRX PB_SETTINGS_HELP_Click
4603*/
4604PB_SETTINGS_HELP_Click:
4605 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4606return
4607
4608/*:VRX PB_SETTINGS_UNDO_Click
4609*/
4610PB_SETTINGS_UNDO_Click:
4611 call SW_SETTINGS_Init_Content
4612return
4613
4614/*:VRX PB_SMBCONF_APPLY_Click
4615*/
4616PB_SMBCONF_APPLY_Click:
4617 if advanced.!smbconfchanged = 1 then do
4618 client_NTLMv2_auth = VRGet("CB_client_NTLMv2_auth","Set")
4619 client_lanman_auth = VRGet("CB_client_lanman_auth","Set")
4620 client_plaintext_auth = VRGet("CB_client_plaintext_auth","Set")
4621 client_use_spnego = VRGet("CB_client_use_spnego","Set")
4622 client_use_spnego_principal = VRGet("CB_client_use_spnego_principal","Set")
4623 client_signing = VRGet("SPIN_client_signing","Value")
4624 client_ipc_signing = VRGet("SPIN_client_ipc_signing","Value")
4625
4626 if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
4627 client_max_protocol = VRGet("SPIN_client_max_protocol","Value")
4628 client_min_protocol = VRGet("SPIN_client_min_protocol","Value")
4629 end
4630
4631
4632 handle = IniOpen('global', samba.!smbconf)
4633 call IniSet 'client NTLMv2 auth', YesNo(client_NTLMv2_auth), handle
4634 call IniSet 'client lanman auth', YesNo(client_lanman_auth), handle
4635 call IniSet 'client plaintext auth', YesNo(client_plaintext_auth), handle
4636 call IniSet 'client use spnego', YesNo(client_use_spnego), handle
4637 call IniSet 'client use spnego principal', YesNo(client_use_spnego_principal), handle
4638 call IniSet 'client signing', client_signing, handle
4639 call IniSet 'client ipc signing', client_ipc_signing, handle
4640
4641 if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
4642 call IniSet 'client max protocol', client_max_protocol, handle
4643 call IniSet 'client min protocol', client_min_protocol, handle
4644 end
4645
4646 call IniSave handle
4647 call IniClose handle
4648 advanced.!smbconfchanged = 0
4649 ok = VRSet("PB_SMBCONF_UNDO","Enabled", 0)
4650 end
4651return
4652
4653/*:VRX PB_SMBCONF_HELP_Click
4654*/
4655PB_SMBCONF_HELP_Click:
4656 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4657return
4658
4659/*:VRX PB_SMBCONF_UNDO_Click
4660*/
4661PB_SMBCONF_UNDO_Click:
4662 call SW_SETTINGS_Init_Content
4663return
4664
4665/*:VRX PB_SMBTREE_CONNECT_Click
4666*/
4667PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
4668 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
4669
4670 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4671
4672 if SelRH.0 = 0 then do
4673 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
4674 return
4675 end
4676
4677 p_workgroup = ''
4678 p_server = ''
4679 p_share = ''
4680
4681 srcFile = ""
4682 srcCtn = VRGet("CN_SMBTREE","Self")
4683 srcRec = SelRH.1
4684 trgCtn = VRGet("CN_CURRENT","Self")
4685 trgRec = ""
4686
4687 if options.!debug == 1 then do
4688 say ' srcCtn = "'srcCtn'"'
4689 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4690 say ' srcRec = "'srcRec'"'
4691 say ' trgCtn = "'trgCtn'"'
4692 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4693 say ' trgRec = "'trgRec'"'
4694 end
4695
4696 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4697
4698 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4699 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4700
4701 if ParentRH = "" then do /* A workgroup was dragged */
4702 say "Workgroup dragged!"
4703 parse var DragCapt p_workgroup '0D0A'x .
4704 p_workgroup = strip(p_workgroup)
4705 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4706 call _UpdateObject "EF_SERVER", ""
4707 ok = VRSet("EF_SHARE","Value","")
4708
4709 ShareLevel = 3
4710 end
4711 else do
4712 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4713 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4714
4715 if GParentRH = "" then do /* A server was dragged */
4716 say "Server dragged!"
4717 parse var ParDragCapt p_workgroup '0D0A'x .
4718 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4719 p_workgroup = strip(p_workgroup)
4720
4721 parse var DragCapt p_server '0D0A'x .
4722 p_server = strip(p_server)
4723 call _UpdateObject "EF_SERVER", p_server
4724 ok = VRSet("EF_Share","Value","")
4725
4726 ShareLevel = 2
4727 end
4728 else do /* A share was dragged */
4729 say "Share dragged!"
4730 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4731
4732 parse var GParDragCapt p_workgroup '0D0A'x .
4733 p_workgroup = strip(p_workgroup)
4734 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4735
4736 parse var ParDragCapt p_server '0D0A'x .
4737 p_server = strip(p_server)
4738 call _UpdateObject "EF_SERVER", p_server
4739
4740 parse var DragCapt p_share '0D0A'x .
4741 p_share = strip(p_share)
4742 ok = VRSet("EF_Share","Value",strip(p_share))
4743
4744 ShareLevel = 1
4745 end
4746 end
4747
4748 say 'p_workgroup = "'p_workgroup'"'
4749 say 'p_server = "'p_server'"'
4750 say 'p_share = "'p_share'"'
4751
4752 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4753 call CB_MOUNT_Change
4754
4755 if trgRec = "" then do
4756 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4757 if VRGet("CB_DRIVES","Value") = "" then return
4758 end
4759 else do
4760
4761 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4762
4763 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4764
4765 do while parTrgRH <> ""
4766 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4767 TargetString = partrgCapt||'\'||TargetString
4768 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4769 end
4770 say 'TargetString = "'TargetString'"'
4771 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4772 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4773 end
4774
4775 window = VRLoadSecondary( "SW_LOGIN", "W" )
4776 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4777
4778 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
4779RETURN
4780
4781/*:VRX PB_SMBTREE_HELP_Click
4782*/
4783PB_SMBTREE_HELP_Click:
4784 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4785return
4786
4787/*:VRX PB_SMBTREE_REFRESH_Click
4788*/
4789PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4790 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
4791
4792 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4793 window = VRLoadSecondary( "SW_LOGIN", "W" )
4794 end
4795
4796 call _UserCredUpdate
4797 ok = VRset("Pict_Throbber", "Visible", 1)
4798 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4799 ok = VRset("TM_Throbber", "Enabled", 1)
4800 ShowHidden = advanced.!special
4801 BroadCast = advanced.!broadcast
4802 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4803 ok = time('R')
4804 call _RefreshTree
4805 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
4806RETURN
4807
4808/*:VRX PB_UNMOUNT_Click
4809*/
4810PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4811 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
4812 if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
4813 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4814 IF select.0 < 1 THEN RETURN
4815
4816 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4817 PARSE VAR userdata mountpoint ';' mounts ';' .
4818say 'userdata="'userdata'"'
4819 IF mounts > 0 & options.!editmode = 0 THEN DO
4820 btns.0 = 2
4821 btns.1 = NLVGetMessage( 6 )
4822 btns.2 = NLVGetMessage( 7 )
4823 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4824 IF confirm \= 1 THEN RETURN
4825 END
4826
4827 /* Unmount any resources */
4828 DO i = 1 TO mounts
4829 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4830 END
4831
4832 /* Delete mountpoint */
4833 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4834 IF parent \= '' THEN DO
4835 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4836 END
4837
4838 CALL Refresh
4839 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
4840RETURN 0
4841
4842/*:VRX Pict_PWINMEM_Click
4843*/
4844Pict_PWINMEM_Click:
4845 if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
4846 call Menu_File_ucCred_Reset_Click
4847 end
4848return
4849
4850/*:VRX Quit
4851*/
4852Quit:
4853 if Fatal <> 1 then CALL _INISave
4854 /* ok = VRREdirectSTdio("OFF") */
4855 window = VRWindow()
4856 call VRSet window, "Shutdown", 1
4857 drop window
4858RETURN
4859
4860/*:VRX Refresh
4861*/
4862Refresh:
4863 if options.!debug == 1 then say time()' Refresh started'
4864 CALL VRSet "CN_CURRENT", 'Painting', 0
4865
4866 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4867
4868 /* Remove Active connections from details view */
4869 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4870
4871 do I = 1 to rh.0
4872 /* This catches the bug we observed exactly once and were unable to reproduce! */
4873 if cd.statusfh = 'CD.STATUSFH' then do
4874 if options.!debug == 1 then call beep 880, 50
4875 if options.!debug == 1 then call beep 880, 50
4876 if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
4877 leave
4878 end
4879 if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4880 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4881 end
4882
4883/* call _AddTemplates */
4884 CALL VRSet "PB_DETACH", "Enabled", 0
4885 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4886
4887 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4888/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4889 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4890 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4891 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4892
4893 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4894 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4895
4896 if options.!debug == 1 then say ' Remove records, disable buttons done.'
4897
4898 CALL VRMethod 'CB_DRIVES', 'Clear'
4899
4900 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4901
4902 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4903 drvs = MyFreeDriveMap('C:', 'FREE')
4904
4905 DO i = 1 TO WORDS( drvs )
4906 drvstem.i = WORD( drvs, i )
4907 END
4908
4909 drvstem.0 = WORDS( drvs )
4910
4911 /* Add any existing EVFS drives */
4912 CALL GetMountPoints
4913
4914 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4915 CALL VRSet "CN_CURRENT", 'Painting', 1
4916 if options.!debug == 1 then say time()' '||"Refresh done"
4917RETURN 0
4918
4919/*:VRX SPIN_client_ipc_signing_Change
4920*/
4921SPIN_client_ipc_signing_Change:
4922 advanced.!smbconfchanged = 1
4923return
4924
4925/*:VRX SPIN_client_max_protocol_Change
4926*/
4927SPIN_client_max_protocol_Change:
4928 advanced.!smbconfchanged = 1
4929return
4930
4931/*:VRX SPIN_client_min_protocol_Change
4932*/
4933SPIN_client_min_protocol_Change:
4934 advanced.!smbconfchanged = 1
4935return
4936
4937/*:VRX SPIN_client_signing_Change
4938*/
4939SPIN_client_signing_Change:
4940 advanced.!smbconfchanged = 1
4941return
4942
4943/*:VRX SPIN_LOG_LEVEL_Change
4944*/
4945SPIN_LOG_LEVEL_Change:
4946 advanced.!smbconfchanged = 1
4947return
4948
4949/*:VRX SPIN_NRO1_Change
4950*/
4951SPIN_NRO1_Change:
4952 advanced.!smbconfchanged = 1
4953return
4954
4955/*:VRX SPIN_NRO2_Change
4956*/
4957SPIN_NRO2_Change:
4958 advanced.!smbconfchanged = 1
4959return
4960
4961/*:VRX SPIN_NRO3_Change
4962*/
4963SPIN_NRO3_Change:
4964 advanced.!smbconfchanged = 1
4965return
4966
4967/*:VRX SPIN_NRO4_Change
4968*/
4969SPIN_NRO4_Change:
4970 advanced.!smbconfchanged = 1
4971return
4972
4973/*:VRX SPLIT_Main_Move
4974*/
4975SPLIT_Main_Move:
4976 ok = VRset("Main", "Painting", 0)
4977 NewPos = VRInfo("Left")
4978 OldPos = VRGet("SPLIT_Main","Left")
4979 ok = VRSet("SPLIT_Main","Left", NewPos)
4980 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4981 call Main_Resize
4982 ok = VRset("Main", "Painting", 1)
4983return
4984
4985/*:VRX SW_ABOUT_Close
4986*/
4987SW_ABOUT_Close:
4988 options.!tracmark = VRGet('CB_TRAC', 'Set')
4989 call SW_ABOUT_Fini
4990return
4991
4992/*:VRX SW_ABOUT_Create
4993*/
4994SW_ABOUT_Create:
4995 call SW_ABOUT_Init
4996
4997 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4998 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4999 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
5000 CALL NLVSetText 'CB_TRAC', "Caption", 134
5001
5002 CALL VRSet 'CB_TRAC', 'Set', options.!tracmark
5003
5004 ok = VRSet("DT_About","Caption", Program' (c) 2007-2017 Alexander Taylor for Arca Noae '||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
5005
5006 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
5007 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
5008
5009 call _AboutSambaClientGetInfo
5010
5011return
5012/*:VRX SW_ABOUT_Fini
5013*/
5014SW_ABOUT_Fini:
5015 window = VRInfo( "Window" )
5016 call VRDestroy window
5017 drop window
5018return
5019/*:VRX SW_ABOUT_Init
5020*/
5021SW_ABOUT_Init:
5022 window = VRInfo( "Object" )
5023 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5024 call VRMethod window, "CenterWindow"
5025 call VRSet window, "Visible", 1
5026 call VRMethod window, "Activate"
5027 end
5028 drop window
5029return
5030
5031/*:VRX SW_ADVANCED_Close
5032*/
5033SW_ADVANCED_Close:
5034 call SW_ADVANCED_Fini
5035return
5036
5037/*:VRX SW_ADVANCED_Create
5038*/
5039SW_ADVANCED_Create:
5040 call SW_ADVANCED_Init
5041return
5042
5043/*:VRX SW_ADVANCED_Fini
5044*/
5045SW_ADVANCED_Fini:
5046 window = VRInfo( "Window" )
5047 call VRDestroy window
5048 drop window
5049return
5050/*:VRX SW_ADVANCED_Init
5051*/
5052SW_ADVANCED_Init:
5053 /* Title bar */
5054 CALL NLVSetText "SW_ADVANCED", "Caption", 40
5055
5056 /* Options */
5057 CALL NLVSetText "GB_ADVANCED", "Caption", 43
5058 CALL NLVSetText "CB_EAS", "Caption", 44
5059 CALL NLVSetText "CB_READONLY", "Caption", 45
5060 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
5061 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
5062 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
5063
5064 CALL NLVSetText "CB_NTLMv1", "Caption", 144
5065 CALL NLVSetText "CB_KERBEROS5", "Caption", 145
5066 CALL NLVSetText "CB_ENCRYPTION", "Caption", 146
5067
5068 /* Buttons */
5069 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
5070 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
5071 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
5072
5073 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
5074
5075/* call VRMethod "SW_ADVANCED", "CenterWindow" */
5076 ok = VRSet("SW_ADVANCED", "Visible", 1)
5077/* call VRMethod "SW_ADVANCED", "Activate" */
5078return
5079
5080/*:VRX SW_ADVANCED_Init_Content
5081*/
5082SW_ADVANCED_Init_Content:
5083 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
5084 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
5085 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
5086 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
5087 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
5088 IF advanced.!kerberos5 \= "" THEN ok = VRSet("CB_KERBEROS5", "Set", advanced.!kerberos5)
5089 IF advanced.!NTLMv1 \= "" THEN ok = VRSet("CB_NTLMv1", "Set", advanced.!NTLMv1)
5090 IF advanced.!encryption \= "" THEN ok = VRSet("CB_ENCRYPTION", "Set", advanced.!encryption)
5091 /* Obsolete */
5092 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
5093return
5094
5095/*:VRX SW_CONDET_Close
5096*/
5097SW_CONDET_Close:
5098 call SW_CONDET_Fini
5099return
5100
5101/*:VRX SW_CONDET_Create
5102*/
5103SW_CONDET_Create:
5104 call SW_CONDET_Init
5105return
5106
5107/*:VRX SW_CONDET_Fini
5108*/
5109SW_CONDET_Fini:
5110 window = VRInfo( "Window" )
5111 call VRDestroy window
5112 drop window
5113return
5114/*:VRX SW_CONDET_Init
5115*/
5116SW_CONDET_Init:
5117
5118return
5119
5120/*:VRX SW_CONDET_Init_Content
5121*/
5122SW_CONDET_Init_Content:
5123 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
5124
5125 /* Hide any "foreign" menu entries */
5126 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
5127return
5128
5129/*:VRX SW_DIALOG_Close
5130*/
5131SW_DIALOG_Close:
5132 call SW_DIALOG_Fini
5133return
5134
5135/*:VRX SW_DIALOG_Create
5136*/
5137SW_DIALOG_Create:
5138 call SW_DIALOG_Init
5139return
5140
5141/*:VRX SW_DIALOG_Fini
5142*/
5143SW_DIALOG_Fini:
5144 window = VRInfo( "Window" )
5145 call VRDestroy window
5146 drop window
5147return
5148/*:VRX SW_DIALOG_Init
5149*/
5150SW_DIALOG_Init:
5151 LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
5152
5153 ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
5154 ok = VRSet("Pict_PWINMEM","Width", LEDSize)
5155 ok = VRSet("Pict_PWINMEM","Height", LEDSize)
5156return
5157
5158/*:VRX SW_DIALOG_Init_Content
5159*/
5160SW_DIALOG_Init_Content:
5161 /* obsolete */
5162 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
5163
5164 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5165 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5166 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
5167
5168 call _DialogPopulate
5169return
5170
5171/*:VRX SW_INFO_Close
5172*/
5173SW_INFO_Close:
5174 call SW_INFO_Fini
5175return
5176
5177/*:VRX SW_INFO_Create
5178*/
5179SW_INFO_Create:
5180 if options.!debug == 1 then say time()' SW_INFO_Create started'
5181 call SW_INFO_Init
5182 CALL NLVSetText 'SW_INFO', "Caption", 92
5183 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
5184 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
5185 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
5186
5187 if options.!debug == 1 then do
5188 say ' Handle: "'SMBObj.rh'"'
5189 say ' Resource: "'SMBObj.resname'"'
5190 say ' Comment: "'SMBObj.comment'"'
5191 say ' Type: "'SMBObj.udatatype'"'
5192 say ' Message: "'SMBObj.udatamsg'"'
5193 say ' Icon: "'SMBObj.icon'"'
5194 end
5195say "Vorher:"rpc.srvinfo.OS_VERSION
5196 drop rpc.
5197say "Vorher:"rpc.srvinfo.OS_VERSION
5198 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
5199
5200 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
5201 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
5202 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
5203 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
5204 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
5205 Info.!os = VRMethod( "CN_INFO", "AddRecord")
5206 Info.!server = VRMethod( "CN_INFO", "AddRecord")
5207 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
5208 Info.!status = VRMethod( "CN_INFO", "AddRecord")
5209 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
5210 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
5211
5212 if rpc_success = 1 then do
5213 if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
5214 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
5215 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
5216 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
5217 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
5218 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
5219 /* we did not get these, but we know them anyway */
5220 if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
5221 if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
5222 end
5223 else do
5224 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
5225 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
5226 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
5227 end
5228
5229 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
5230 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
5231 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
5232 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
5233 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
5234 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
5235
5236 if options.!debug == 1 then say time()' SW_INFO_Create done'
5237return
5238
5239/*:VRX SW_INFO_Fini
5240*/
5241SW_INFO_Fini:
5242 window = VRInfo( "Window" )
5243 call VRDestroy window
5244 drop window
5245return
5246/*:VRX SW_INFO_Init
5247*/
5248SW_INFO_Init:
5249 window = VRInfo( "Object" )
5250 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5251 call VRMethod window, "CenterWindow"
5252 call VRSet window, "Visible", 1
5253 call VRMethod window, "Activate"
5254 end
5255 drop window
5256return
5257
5258/*:VRX SW_LOGIN_Close
5259*/
5260SW_LOGIN_Close:
5261 call SW_LOGIN_Fini
5262return
5263
5264/*:VRX SW_LOGIN_Create
5265*/
5266SW_LOGIN_Create:
5267 call SW_LOGIN_Init
5268 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
5269 CALL NLVSetText 'DT_USER1', "Caption", 25
5270 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
5271 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
5272 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
5273 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
5274
5275 if VRIsValidObject(SMBObj.rh) then do
5276 select
5277 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
5278 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
5279 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
5280 when SMBObj.udatatype = "DISK" then do
5281 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
5282 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
5283 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
5284 end
5285 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
5286 end
5287 say loginicon
5288 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
5289 end
5290 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
5291 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
5292 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
5293return
5294
5295/*:VRX SW_LOGIN_Fini
5296*/
5297SW_LOGIN_Fini:
5298 window = VRInfo( "Window" )
5299 call VRDestroy window
5300 drop window
5301return
5302/*:VRX SW_LOGIN_Init
5303*/
5304SW_LOGIN_Init:
5305 window = VRInfo( "Object" )
5306 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5307 call VRMethod window, "CenterWindow"
5308 call VRSet window, "Visible", 1
5309 call VRMethod window, "Activate"
5310 end
5311 drop window
5312return
5313
5314/*:VRX SW_LOGIN_KeyPress
5315*/
5316SW_LOGIN_KeyPress:
5317 obj = VRInfo( "Object" )
5318 keystr = VRGet( obj, "KeyString" )
5319/* say keystr */
5320 select
5321 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
5322 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
5323 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
5324 otherwise nop
5325 end
5326return
5327
5328/*:VRX SW_MOUNTPOINT_Close
5329*/
5330SW_MOUNTPOINT_Close:
5331 call SW_MOUNTPOINT_Fini
5332return
5333
5334/*:VRX SW_MOUNTPOINT_Create
5335*/
5336SW_MOUNTPOINT_Create:
5337 call SW_MOUNTPOINT_Init
5338
5339 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
5340 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
5341 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
5342 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
5343 CALL NLVSetText 'CB_EAS1', "Caption", 44
5344 CALL NLVSetText 'CB_READONLY1', "Caption", 45
5345 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
5346 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
5347 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
5348
5349 CALL NLVSetText "CB_NTLMv11", "Caption", 144
5350 CALL NLVSetText "CB_KERBEROS51", "Caption", 145
5351 CALL NLVSetText "CB_ENCRYPTION1", "Caption", 146
5352
5353 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
5354 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
5355 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
5356
5357 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
5358
5359 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
5360
5361 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
5362 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
5363 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
5364 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
5365 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
5366return
5367
5368/*:VRX SW_MOUNTPOINT_Fini
5369*/
5370SW_MOUNTPOINT_Fini:
5371 window = VRInfo( "Window" )
5372 call VRDestroy window
5373 drop window
5374return
5375/*:VRX SW_MOUNTPOINT_Init
5376*/
5377SW_MOUNTPOINT_Init:
5378 window = VRInfo( "Object" )
5379 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5380 call VRMethod window, "CenterWindow"
5381 call VRSet window, "Visible", 1
5382 call VRMethod window, "Activate"
5383 end
5384 drop window
5385return
5386
5387/*:VRX SW_PORTCONNECT_Close
5388*/
5389SW_PORTCONNECT_Close:
5390 call SW_PORTCONNECT_Fini
5391return
5392
5393/*:VRX SW_PORTCONNECT_Create
5394*/
5395SW_PORTCONNECT_Create:
5396 call SW_PORTCONNECT_Init
5397
5398 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
5399
5400 if ok = "" then do
5401
5402 end
5403 else do
5404 say "Samba Spooler Port driver installed!"
5405 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
5406 smbport.0 = 0
5407 do I = 1 to ports.0
5408 if left(ports.I,3) = "SMB" then do
5409 X = smbport.0
5410 X = X + 1
5411 smbport.0 = X
5412 smbport.X = ports.I
5413 end
5414 end
5415 do I = 1 to smbport.0
5416 say smbport.I
5417 end
5418 end
5419
5420return
5421
5422/*:VRX SW_PORTCONNECT_Fini
5423*/
5424SW_PORTCONNECT_Fini:
5425 window = VRInfo( "Window" )
5426 call VRDestroy window
5427 drop window
5428return
5429/*:VRX SW_PORTCONNECT_Init
5430*/
5431SW_PORTCONNECT_Init:
5432 window = VRInfo( "Object" )
5433 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5434 call VRMethod window, "CenterWindow"
5435 call VRSet window, "Visible", 1
5436 call VRMethod window, "Activate"
5437 end
5438 drop window
5439return
5440
5441/*:VRX SW_PROGRESS_Close
5442*/
5443SW_PROGRESS_Close:
5444 options.!delay = 0
5445 call Main_Resize
5446 call VRSet 'Main', 'Visible', 1
5447 call SW_PROGRESS_Fini
5448return
5449
5450/*:VRX SW_PROGRESS_Create
5451*/
5452SW_PROGRESS_Create:
5453 call SW_PROGRESS_Init
5454 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
5455 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
5456 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
5457
5458 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
5459
5460 CALL VRSet "TM_Progress_Throbber","Enabled", 1
5461 CALL VRSet "TM_TheCloser","Enabled", 1
5462return
5463
5464/*:VRX SW_PROGRESS_Fini
5465*/
5466SW_PROGRESS_Fini:
5467 call VRDestroy "SW_PROGRESS"
5468return
5469/*:VRX SW_PROGRESS_Init
5470*/
5471SW_PROGRESS_Init:
5472 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
5473 call VRSet "SW_PROGRESS", "Visible", 1
5474 call VRMethod "SW_PROGRESS", "Activate"
5475return
5476
5477/*:VRX SW_SETTINGS_Close
5478*/
5479SW_SETTINGS_Close:
5480 call SW_SETTINGS_Fini
5481return
5482
5483/*:VRX SW_SETTINGS_Create
5484*/
5485SW_SETTINGS_Create:
5486 call SW_SETTINGS_Init
5487return
5488
5489/*:VRX SW_SETTINGS_Fini
5490*/
5491SW_SETTINGS_Fini:
5492 window = VRInfo( "Window" )
5493 call VRDestroy window
5494 drop window
5495return
5496/*:VRX SW_SETTINGS_Init
5497*/
5498SW_SETTINGS_Init:
5499 /* Title bar */
5500 call NLVSetText "SW_SETTINGS", "Caption", 47
5501
5502 /* Options */
5503 call NLVSetText "GB_GLOBAL", "Caption", 47
5504 call NLVSetText "CB_DEBUG", "Caption", 42
5505 call NLVSetText "CB_LOGGING", "Caption", 46
5506 call NLVSetText "CB_BROWSEIMME", "Caption", 48
5507 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
5508 call NLVSetText "CB_SPECIAL", "Caption", 66
5509 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
5510 call NLVSetText "CB_LMHOSTS", "Caption", 133
5511 call NLVSetText "CB_BROADCAST", "Caption", 74
5512 call NLVSetText "CB_MINIICONS", "Caption", 70
5513 call NLVSetText "CB_STORECREDS", "Caption", 135
5514
5515 /* Buttons */
5516 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
5517 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
5518 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
5519
5520/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
5521
5522/* call VRMethod "SW_SETTINGS", "CenterWindow" */
5523 ok = VRSet("SW_SETTINGS", "Visible", 1)
5524/* call VRMethod "SW_SETTINGS", "Activate" */
5525return
5526
5527/*:VRX SW_SETTINGS_Init_Content
5528*/
5529SW_SETTINGS_Init_Content:
5530 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
5531
5532 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
5533 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
5534 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
5535 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
5536 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
5537 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
5538
5539 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
5540 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
5541 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
5542
5543 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
5544
5545/* if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile) /* Obsolete */
5546 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOG_LEVEL", "Value", advanced.!loglevel) */
5547
5548 log_level = IniGet('log level', 'global', samba.!smbconf)
5549 call _SmbConfCreateShadowCopy
5550
5551
5552say "log level ="log_level
5553 if log_level = "" then log_level = 2
5554say "log level ="log_level
5555 ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
5556
5557 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
5558
5559 if wins_support = "YES" then do /* we are a WINS server ourself */
5560 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
5561 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
5562 ok = VRSet("EF_WINS_SERVER","Value", "")
5563 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
5564 end
5565 else do
5566 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
5567 end
5568
5569 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
5570
5571 do I = 1 to words(name_resolve_order)
5572 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
5573 end
5574
5575 advanced.!smbconfchanged = 0
5576return
5577
5578/*:VRX SW_SMBCONF_Close
5579*/
5580SW_SMBCONF_Close:
5581 call SW_SMBCONF_Fini
5582return
5583
5584/*:VRX SW_SMBCONF_Create
5585*/
5586SW_SMBCONF_Create:
5587 call SW_SMBCONF_Init
5588return
5589
5590/*:VRX SW_SMBCONF_Fini
5591*/
5592SW_SMBCONF_Fini:
5593 window = VRInfo( "Window" )
5594 call VRDestroy window
5595 drop window
5596return
5597/*:VRX SW_SMBCONF_Init
5598*/
5599SW_SMBCONF_Init:
5600
5601 /* Buttons */
5602 call NLVSetText "PB_SMBCONF_APPLY", "Caption", 122
5603 call NLVSetText "PB_SMBCONF_UNDO", "Caption", 123
5604 call NLVSetText "PB_SMBCONF_HELP", "Caption", 4
5605
5606return
5607
5608/*:VRX SW_SMBCONF_Init_Content
5609*/
5610SW_SMBCONF_Init_Content:
5611 call _SmbConfCreateShadowCopy
5612
5613 client_NTLMv2_auth = ZeroOne(IniGet('client NTLMv2 auth', 'global', samba.!shadowsmbconf))
5614 if client_NTLMv2_auth = 1 then do
5615 ok = VRSet("CB_client_NTLMv2_auth","Set",client_NTLMv2_auth)
5616 ok = VRSet("CB_client_lanman_auth","Enabled", 0)
5617 ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
5618 end
5619 else do
5620 client_lanman_auth = ZeroOne(IniGet('client lanman auth', 'global', samba.!shadowsmbconf))
5621 client_plaintext_auth = ZeroOne(IniGet('client plaintext auth', 'global', samba.!shadowsmbconf))
5622 ok = VRSet("CB_client_lanman_auth","Set",client_lanman_auth)
5623 ok = VRSet("CB_client_plaintext_auth","Set",client_plaintext_auth)
5624 end
5625
5626 client_use_spnego = ZeroOne(IniGet('client use spnego', 'global', samba.!shadowsmbconf))
5627 ok = VRSet("CB_client_use_spnego","Set",client_use_spnego)
5628
5629 client_use_spnego_principal = ZeroOne(IniGet('client use spnego principal', 'global', samba.!shadowsmbconf))
5630 ok = VRSet("CB_client_use_spnego_principal","Set",client_use_spnego_principal)
5631
5632 client_max_protocol = IniGet('client max protocol', 'global', samba.!shadowsmbconf)
5633 if client_max_protocol = "" then do
5634 /* ok = VRSet("SPIN_client_max_protocol","Enabled", 0)
5635 ok = VRSet("DT_client_max_protocol","Enabled", 0) */
5636 end
5637 else ok = VRSet("SPIN_client_max_protocol","Value",client_max_protocol)
5638
5639 client_min_protocol = IniGet('client min protocol', 'global', samba.!shadowsmbconf)
5640 if client_min_protocol = "" then do
5641 /* ok = VRSet("SPIN_client_min_protocol","Enabled", 0)
5642 ok = VRSet("DT_client_min_protocol","Enabled", 0) */
5643 end
5644 else ok = VRSet("SPIN_client_min_protocol","Value",client_min_protocol)
5645
5646 client_signing = IniGet('client signing', 'global', samba.!shadowsmbconf)
5647 client_ipc_signing = IniGet('client ipc signing', 'global', samba.!shadowsmbconf)
5648say "client_signing ="client_signing
5649 ok = VRSet("SPIN_client_signing","Value",client_signing)
5650 ok = VRSet("SPIN_client_ipc_signing","Value",client_signing)
5651
5652 advanced.!smbconfchanged = 0
5653return
5654
5655/*:VRX SW_SMBTREE_Close
5656*/
5657SW_SMBTREE_Close:
5658 call SW_SMBTREE_Fini
5659return
5660
5661/*:VRX SW_SMBTREE_Create
5662*/
5663SW_SMBTREE_Create:
5664 call SW_SMBTREE_Init
5665return
5666
5667/*:VRX SW_SMBTREE_Fini
5668*/
5669SW_SMBTREE_Fini:
5670 window = VRInfo( "Window" )
5671 call VRDestroy window
5672 drop window
5673return
5674/*:VRX SW_SMBTREE_Init
5675*/
5676SW_SMBTREE_Init:
5677
5678return
5679
5680/*:VRX SW_SMBTREE_Init_Content
5681*/
5682SW_SMBTREE_Init_Content:
5683 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
5684
5685 /* Hide any "foreign" menu entries */
5686 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5687 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5688return
5689
5690/*:VRX TDL_1_PageSelected
5691*/
5692TDL_1_PageSelected:
5693 page = VRInfo("Page")
5694
5695 /* call _TabsStrip */
5696 select
5697 when page = 1 then do /* dialog */
5698 call _TabFix 1
5699 end
5700 when page = 2 then do /* advanced */
5701 call SW_ADVANCED_Init_Content
5702 end
5703 when page = 3 then do /* smbtree */
5704 call SW_SMBTREE_Init_Content
5705 end
5706 when page = 4 then do /* condet */
5707 call SW_CONDET_Init_Content
5708 end
5709 when page = 5 then do /* Settings */
5710 call SW_SETTINGS_Init_Content
5711 end
5712 when page = 6 then do /* SMB.CONF */
5713 call SW_SMBCONF_Init_Content
5714 end
5715 otherwise nop
5716 end
5717return
5718/*:VRX TM_AutoClose_Trigger
5719*/
5720TM_AutoClose_Trigger:
5721 call Quit
5722return
5723
5724/*:VRX TM_Progress_Throbber_Trigger
5725*/
5726TM_Progress_Throbber_Trigger:
5727 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5728 parse var pIdx '#' pidx
5729 pidx = pidx + 1
5730 if pidx = 23 then pidx = 11
5731 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5732return
5733
5734/*:VRX TM_RefreshCurrentDisplay_Trigger
5735*/
5736TM_RefreshCurrentDisplay_Trigger:
5737 if RefreshMode <> "" then return
5738 if _DaemonRunning() = 0 then do
5739 say " Daemon not running - disable GUI"
5740 ok = VRset("GB_CURRENT", "Enabled", 0)
5741 ok = VRset("TDL_1", "Enabled", 0)
5742 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5743 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5744 end
5745 else do
5746 say " Daemon running - enable GUI"
5747 ok = VRset("GB_CURRENT", "Enabled", 1)
5748 ok = VRset("TDL_1", "Enabled", 1)
5749 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5750 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5751 end
5752 CALL REFRESH
5753return
5754
5755/*:VRX TM_RefreshTreeDisplay_Trigger
5756*/
5757TM_RefreshTreeDisplay_Trigger:
5758 ShowHidden = advanced.!special
5759 BroadCast = advanced.!broadcast
5760 DoLMHosts = advanced.!lmhosts
5761
5762 select
5763 when RefreshMode = "TREE" then do
5764 call _RefreshTreeDisplay
5765
5766 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5767 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5768 end
5769 end
5770 when RefreshMode = "SHARE" then do
5771 call _AddSharesDisplay
5772 end
5773 otherwise say "RefreshMode = "RefreshMode
5774 end
5775 call _DialogPopulate
5776return
5777
5778/*:VRX TM_TheCloser_Trigger
5779*/
5780TM_TheCloser_Trigger:
5781 call SW_PROGRESS_Close
5782return
5783
5784/*:VRX TM_Throbber_Trigger
5785*/
5786TM_Throbber_Trigger:
5787 pIdx = VRGet("Pict_Throbber","PicturePath")
5788 parse var pIdx '#' pidx
5789 pidx = pidx + 1
5790 if pidx = 23 then pidx = 11
5791 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5792return
5793
5794/*:VRX YesNo
5795*/
5796YesNo: procedure
5797 if arg(1) = 1 then answer = "Yes"
5798 else answer = "No"
5799return answer
5800
5801/*:VRX ZeroOne
5802*/
5803ZeroOne: procedure
5804 if translate(arg(1)) = "YES" then answer = 1
5805 else answer = 0
5806return answer
Note: See TracBrowser for help on using the repository browser.