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

Last change on this file since 1044 was 1039, checked in by Herwig Bauernfeind, 8 years ago

EVFSGUI: Fix AN Ticket #1594

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