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

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

EVGSGUI More work on ACLS browser

File size: 215.5 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
3667 /* Build the resource parameter string */
3668 src = ''
3669 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3670 IF options.!server \= '' THEN src = src';SERVER='options.!server
3671 IF options.!share \= '' THEN src = src';SHARE='options.!share
3672 IF options.!user \= '' THEN src = src';USER='options.!user
3673 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3674 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3675 IF options.!master \= '' THEN src = src';MASTER='options.!master
3676 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3677/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3678 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3679 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3680 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3681 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3682 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3683
3684 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3685
3686 parse var vfs.!mountpoint mpoint ';' .
3687 mpoint = strip(mpoint,'T','\')||'\'
3688
3689 if options.!master = "" then options.!master = "WORKGROUP"
3690 if options.!mtype = "" then options.!mtype = "1"
3691 if options.!loglevel = "" then options.!loglevel = "0"
3692 if options.!memlen = "" then options.!memlen = "2"
3693 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3694 if options.!cachelistings = "" then options.!cachelistings = "32"
3695 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3696 if options.!password <> "" & options.!spassword = "" then do
3697 options.!spassword = c2x(options.!password)
3698 options.!password = ""
3699 end
3700
3701 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3702
3703 md5 = rexx_md5(hashstr)
3704
3705 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3706 DO i = 1 TO records.0
3707 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3708
3709 if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3710 if options.!debug == 1 then say mpoint'->'md5
3711
3712 if hash = md5 then do
3713 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3714 say "Double connection detected!!"
3715 if options.!spassword <> "" then upw = ":********"
3716 else upw = ""
3717 buttons.0 = 2
3718 buttons.1 = NLVGetMessage(9)
3719 buttons.2 = NLVGetMessage(3)
3720 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3721 if Answer = 2 then do
3722 call VRSet VRWindow(), 'Pointer', '<default>'
3723 say "Double connection - do not mount!!"
3724 return
3725 end
3726 end
3727 else do /* Same hash, status passive - we have to remove it */
3728 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3729 end
3730 end
3731 end
3732
3733 cd.lastrh = ""
3734 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3735
3736 /* Now mount the resource */
3737 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3738
3739 if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
3740 if ok <> 0 then do
3741 if options.!password <> "" then upw = ":********"
3742 else upw = ""
3743 buttons.0 = 2
3744 buttons.1 = NLVGetMessage(2)
3745 buttons.2 = NLVGetMessage(37)
3746 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3747 if Answer = 2 then do /* Show explanation */
3748 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')
3749 end
3750 if cd.lastrh <> '' then do
3751 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3752 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3753 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3754 end
3755
3756 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3757 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3758 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3759 if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3760 end
3761 end
3762 else do
3763 if options.!storecreds = 1 then do
3764 ok = VRSet("EF_User", "Value",options.!user)
3765 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3766 end
3767 end
3768 drop CreateMP /* not required anymore */
3769
3770/* Obsolete - the IOCtl will not be implemented this way in the plugin
3771 The REXX function is present, but is has no counterpart in the plugin
3772 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3773 if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3774 */
3775 /* Set mouse pointer to default again */
3776 call VRSet VRWindow(), 'Pointer', '<default>'
3777 if options.!debug == 1 then say time()' Mount procedure done'
3778RETURN ok
3779
3780/*:VRX MyFreeDriveMap
3781*/
3782MyFreeDriveMap: procedure expose options. icons. fs. samba.
3783 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
3784 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:"
3785/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
3786 useddrives= SysDriveMap("C:","USED")
3787/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
3788
3789 Alldr = words(alldrives)
3790 FreeDriveMap = ""
3791 do I = 1 to AllDr
3792 if word(alldrives,1) = word(useddrives,1) then do
3793 Useddrives = subword(useddrives,2)
3794 Alldrives = subword(Alldrives,2)
3795 end
3796 else do
3797 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3798 Alldrives = subword(Alldrives,2)
3799 end
3800 end
3801 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
3802return FreeDriveMap
3803/*:VRX NoEVFSCALL
3804*/
3805NoEVFSCALL:
3806 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
3807 signal Halt
3808RETURN
3809
3810/*:VRX ParseResourceData
3811*/
3812ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
3813 PARSE ARG userdata, resource
3814 if options.!debug == 1 then say time()' ParseResourceData started'
3815 if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
3816
3817/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
3818
3819/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
3820
3821 select /* Support for other filesystems comes here! */
3822 when left(word(resource,1),5) = "SMBFS" then do
3823 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
3824 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
3825
3826 p_mpoint = strip(p_mpoint,'T','\')||'\'
3827 p_rw = word(resource, words(resource))
3828
3829 /* Workaround for truncated resource string */
3830 if length(p_rw) > 1 then do
3831 /* The resource string must have been truncated
3832 p_rw is already wrong and
3833 p_easupport will most likely be also wrong (look below for workaround!) */
3834 p_rw ="W" /* this is guessed only!!! */
3835 if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
3836 end
3837 /* this should be done unconditionally if the resource string is never truncated */
3838 else resource = left(resource,length(resource)-length(p_rw))
3839
3840 call ParseResParmString
3841
3842 if p_master = "" then p_master = "WORKGROUP"
3843 if p_mtype = "" then p_mtype = "1"
3844 if p_loglevel = "" then p_loglevel = "0"
3845 if p_memlen = "" then p_memlen = "2"
3846
3847 /* Also works around for a truncated resource string! */
3848 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
3849
3850 if p_password <> "" & p_spassword = "" then do
3851 p_spassword = c2x(p_password)
3852 p_password = ""
3853 end
3854
3855 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)
3856 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
3857 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
3858 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)
3859 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
3860 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
3861
3862 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
3863
3864 md5 = rexx_md5(hashstr)
3865
3866 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
3867
3868 SELECT
3869 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
3870 IF p_workgroup == '' THEN
3871 userdata = userdata';\\'p_server'\*'
3872 ELSE
3873 userdata = userdata';'p_workgroup':\\'p_server'\*'
3874 END
3875 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
3876 userdata = userdata';'p_workgroup':\\*'
3877 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
3878 userdata = userdata';*:\\*'
3879 OTHERWISE DO
3880 IF p_workgroup == '' THEN
3881 userdata = userdata';\\'p_server'\'p_share
3882 ELSE
3883 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
3884 END
3885 END
3886
3887 end
3888 when left(word(resource,1),3) = "DAV" then do
3889 userdata = "webDAV"
3890 end
3891 otherwise do /* All unsupported filesystems end here! */
3892 userData = "UNKNOWN"
3893 end
3894 end
3895 if left(word(resource,1),5) <> "SMBFS" then do
3896 end
3897 else do
3898 end
3899
3900 if options.!debug == 1 then say ' returning "'userdata'"'
3901 if options.!debug == 1 then say time()' ParseResourceData done'
3902RETURN userdata
3903
3904/*:VRX ParseResParmString
3905*/
3906ParseResParmString:
3907 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
3908 PARSE VAR resource . ';SERVER=' p_server ';' .
3909 PARSE VAR resource . ';SHARE=' p_share ';' .
3910 PARSE VAR resource . ';USER=' p_user ';' .
3911 PARSE VAR resource . ';PASSWORD=' p_password ';' .
3912 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
3913 PARSE VAR resource . ';MASTER=' p_master ';' .
3914 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
3915 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
3916 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
3917 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
3918 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
3919 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
3920 PARSE VAR resource . ';EASUPPORT=' p_easupport ';' .
3921 PARSE VAR resource . ';KRB5SUPPORT=' p_krb5support ';' .
3922 PARSE VAR resource . ';NTLMV1SUPPORT=' p_ntlmv1support ';' .
3923 PARSE VAR resource . ';ENCRYPTIONSUPPORT=' p_encryptionsupport ' '
3924
3925return
3926/*:VRX PB_ABOUT_CLOSE_Click
3927*/
3928PB_ABOUT_CLOSE_Click:
3929 CALL SW_ABOUT_Close
3930return
3931
3932/*:VRX PB_ABOUT_COPY_Click
3933*/
3934PB_ABOUT_COPY_Click:
3935
3936 if VRGet("CB_TRAC","set") then DO
3937 remainstr = AboutStr
3938 AboutStr = ''
3939 DO WHILE remainstr <> ''
3940 PARSE VAR remainstr _part '0d0a'x remainstr
3941 AboutStr = AboutStr || _part ||'[[BR]]'||'0d0a'x
3942 END
3943 END
3944 ok = VRMethod( "Application", "PutClipboard", AboutStr )
3945 if options.!debug == 1 then call beep 880*2,10
3946 CALL SW_ABOUT_Close
3947return
3948
3949/*:VRX PB_ACLS_OK_Click
3950*/
3951PB_ACLS_OK_Click:
3952 call SW_ACLS_Close
3953return
3954
3955/*:VRX PB_ADVANCED_APPLY_Click
3956*/
3957PB_ADVANCED_APPLY_Click:
3958 advanced.!easupport = VRGet( "CB_EAS", "Set" )
3959 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
3960 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
3961 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
3962 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
3963 advanced.!kerberos5 = VRGet( "CB_KERBEROS5", "Set" )
3964 advanced.!ntlmv1 = VRGet( "CB_NTLMV1", "Set" )
3965 advanced.!encryption = VRGet( "CB_ENCRYPTION", "Set" )
3966
3967 /* Obsolete */
3968 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
3969return
3970
3971/*:VRX PB_ADVANCED_HELP_Click
3972*/
3973PB_ADVANCED_HELP_Click:
3974 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
3975return
3976
3977/*:VRX PB_ADVANCED_UNDO_Click
3978*/
3979PB_ADVANCED_UNDO_Click:
3980 CALL SW_ADVANCED_Init_Content
3981RETURN
3982
3983/*:VRX PB_ClearCred_Click
3984*/
3985PB_ClearCred_Click:
3986 call Menu_File_ucCred_Reset_Click
3987return
3988
3989/*:VRX PB_CONDET_HELP_Click
3990*/
3991PB_CONDET_HELP_Click:
3992 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
3993return
3994
3995/*:VRX PB_CONDET_LOAD_Click
3996*/
3997PB_CONDET_LOAD_Click:
3998 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
3999 call Menu_File_Load_Click
4000 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
4001RETURN
4002
4003/*:VRX PB_CONDET_SAVE_Click
4004*/
4005PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
4006 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
4007
4008 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
4009 ELSE filename = Profile
4010
4011 IF filename == '' THEN RETURN
4012
4013 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
4014 btns.0 = 2
4015 btns.1 = NLVGetMessage( 6 )
4016 if btns.1 = "" then btns.1 = '[Yes]'
4017 btns.2 = NLVGetMessage( 7 )
4018 if btns.2 = "" then btns.2 = '[No]'
4019 Title = NLVGetMessage( 53 )
4020 if Title = "" then Title = "[File exists]"
4021 Text = NLVGetMessage( 54, filename )
4022 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
4023
4024 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
4025 IF confirm \= 1 THEN RETURN
4026 CALL VRChAttr filename,, 'HSR'
4027 CALL VRDeleteFile filename
4028 END
4029
4030 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
4031 DO i = 1 TO records.0
4032 resource = ""
4033 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
4034 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
4035 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
4036 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
4037 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
4038 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
4039 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
4040 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
4041 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
4042 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
4043 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
4044 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
4045 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
4046 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
4047 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
4048/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
4049 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
4050 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
4051 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
4052 resource = resource||';KRB5SUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.kerberos5FH)
4053 resource = resource||';NTLMV1SUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ntlmv1FH)
4054 resource = resource||';ENCRYPTIONSUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.encryptionFH)
4055 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
4056 call lineout filename, resource
4057 END
4058 CALL STREAM filename, 'C', 'CLOSE'
4059
4060 if options.!autostart == 0 THEN do
4061 Title = NLVGetMessage( 51 )
4062 if Title = "" then Title = "[Profile saved]"
4063 Text = NLVGetMessage( 52, filename )
4064 if Text = "" then Text = "[Profile saved to "filename"!]"
4065 CALL VRMessage 'Main', Text , Title, 'I'
4066 end
4067
4068 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
4069RETURN
4070
4071/*:VRX PB_DETACH_Click
4072*/
4073PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4074 if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
4075 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4076 IF select.0 < 1 THEN RETURN
4077
4078 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4079 PARSE VAR userdata mountpoint ';' mounts ';' .
4080 drive = STRIP( mountpoint, 'T', '\')
4081
4082 btns.0 = 2
4083 btns.1 = NLVGetMessage( 6 )
4084 btns.2 = NLVGetMessage( 7 )
4085 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4086 IF confirm \= 1 THEN RETURN
4087
4088 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
4089 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
4090 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
4091 if datatype(mounts) = 'NUM' then do
4092 /* Unmount any resources */
4093 DO i = 1 TO mounts
4094 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4095 END
4096 end
4097 else if options.!debug == 1 then say ' '||"mounts = "mounts
4098
4099 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
4100
4101 CALL Refresh
4102 if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
4103RETURN
4104
4105/*:VRX PB_DIALOG_HELP_Click
4106*/
4107PB_DIALOG_HELP_Click:
4108 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
4109return
4110
4111/*:VRX PB_EDIT_CANCEL_Click
4112*/
4113PB_EDIT_CANCEL_Click:
4114 options.!editmode = 0
4115 CALL VRSet "PB_UNMOUNT","Enabled", 1
4116 CALL VRSet "GB_CURRENT", "ENABLED", 1
4117 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
4118 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
4119/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4120RETURN 0
4121
4122/*:VRX PB_INFO_OK_Click
4123*/
4124PB_INFO_OK_Click:
4125 call SW_INFO_Close
4126RETURN
4127
4128/*:VRX PB_LOGIN_CANCEL_Click
4129*/
4130PB_LOGIN_CANCEL_Click:
4131 credentials.!entered = 0
4132 call SW_LOGIN_Close
4133RETURN
4134
4135/*:VRX PB_LOGIN_OK_Click
4136*/
4137PB_LOGIN_OK_Click:
4138 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
4139 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
4140 options.!storecreds = VRGet("CB_STORECREDS1","Set")
4141 credentials.!entered = 1
4142
4143 if p_server <> "" then do
4144 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
4145
4146 if word(ok,1) = "1" then do
4147 call _StatusBarWrapper NLVGetMessage(107, rpc.queryuser.FULL_NAME)
4148 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
4149 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
4150 end
4151 else do
4152 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
4153 end
4154 end
4155
4156 call SW_LOGIN_Close
4157RETURN
4158
4159/*:VRX PB_MOUNT_Click
4160*/
4161PB_MOUNT_Click:
4162 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
4163 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
4164 say " network = "network
4165 if options.!editmode = 1 then do
4166 CALL PB_UNMOUNT_Click
4167 options.!editmode = 0
4168 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
4169/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4170
4171 CALL VRSet "PB_UNMOUNT","Enabled", 1
4172 CALL VRSet "GB_CURRENT", "ENABLED", 1
4173 end
4174
4175 options.!workgroup = ''
4176 options.!server = ''
4177 options.!share = ''
4178 options.!user = ''
4179 options.!password = ''
4180 options.!master = ''
4181 options.!mastertype = ''
4182 options.!memlen = advanced.!memlen
4183 options.!easupport = advanced.!easupport
4184 options.!readonly = advanced.!readonly
4185 options.!loglevel = advanced.!loglevel
4186 options.!logfile = advanced.!logfile
4187 options.!cachetimeout = advanced.!cachetimeout
4188 options.!cachelistings = advanced.!cachelistings
4189 options.!kerberos5 = advanced.!kerberos5
4190 options.!ntlmv1 = advanced.!ntlmv1
4191 options.!encryption = advanced.!encryption
4192
4193 vfs.!drive = ''
4194 vfs.!mountpoint = ''
4195
4196 stype = VRGet( "CB_MOUNT", "Selected" )
4197 share = STRIP( VRGet( "EF_SHARE", "Value" ))
4198 server = STRIP( VRGet( "EF_SERVER", "Value" ))
4199 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
4200 mtype = VRGet( "CHK_MTYPE", "Set" )
4201 userid = STRIP( VRGet( "EF_USER", "Value" ))
4202 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
4203 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
4204 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
4205 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
4206
4207 IF ( stype < 1 | stype > 4 ) THEN stype = 1
4208
4209 /* The required/optional/ignored parameters depend on the type of mount
4210 * requested. (Note, however, that the user, password, easupport and
4211 * memlen parameters are always optional.)
4212 */
4213 SELECT
4214 /* Scenario 1: Mount a single share.
4215 * Required: share, server
4216 * Optional: workgroup
4217 * Unused: master, mastertype
4218 */
4219 WHEN stype = 1 THEN DO
4220 IF server == '' | share == '' THEN DO
4221 /* error */
4222 RETURN 1
4223 END
4224 options.!server = server
4225 options.!share = share
4226 options.!workgroup = network
4227 END
4228
4229 /* Scenario 2: Mount all shares on a server.
4230 * Required: server
4231 * Optional: workgroup
4232 * Unused: share, master, mastertype
4233 */
4234 WHEN stype = 2 THEN DO
4235 IF server == '' THEN DO
4236 /* error */
4237 RETURN 1
4238 END
4239 options.!server = server
4240 options.!workgroup = network
4241 END
4242
4243 /* Scenario 3: Mount all servers in a workgroup.
4244 * Required: workgroup
4245 * Optional: -
4246 * Unused: share, server, master, mastertype
4247 */
4248 WHEN stype = 3 THEN DO
4249 IF workgroup == '' THEN DO
4250 /* error */
4251 RETURN 1
4252 END
4253 options.!workgroup = network
4254 END
4255
4256 /* Scenario 4: Mount all workgroups known to a master.
4257 * Required: master, mastertype
4258 * Optional: -
4259 * Unused: share, server, workgroup
4260 */
4261 WHEN stype = 4 THEN DO
4262 IF master == '' | mastertype == '' THEN DO
4263 /* error */
4264 RETURN 1
4265 END
4266 options.!master = network
4267 options.!mastertype = mtype
4268 END
4269 END
4270
4271 options.!user = userid
4272 options.!password = password
4273
4274 vfs.!drive = mdrive
4275 vfs.!mountpoint = mdrive'\'mpath
4276
4277 CALL Mount
4278 CALL Refresh
4279 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
4280 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
4281RETURN 0
4282
4283/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
4284*/
4285PB_NEWMOUNTPOINTCANCEL_Click:
4286 ok = VRSet("CB_DRIVES","Value","")
4287 ok = VRSet("EF_DIRECTORY","Value","")
4288 call SW_MOUNTPOINT_Close
4289RETURN 0
4290
4291/*:VRX PB_NEWMOUNTPOINTOK_Click
4292*/
4293PB_NEWMOUNTPOINTOK_Click:
4294 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4295 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4296
4297 advanced.!readonly = VRGet("CB_READONLY1","Set")
4298 advanced.!easupport = VRGet("CB_EAS1","Set")
4299 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4300 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4301 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4302 advanced.!kerberos5 = VRGet("CB_KERBEROS51","Set")
4303 advanced.!ntlmv1 = VRGet("CB_NTLMV11","Set")
4304 advanced.!encryption = VRGet("CB_ENCRYPTION1","Set")
4305
4306 call SW_MOUNTPOINT_Close
4307RETURN
4308
4309/*:VRX PB_NEWPORTCANCEL_Click
4310*/
4311PB_NEWPORTCANCEL_Click:
4312/* ok = VRSet("CB_DRIVES","Value","")
4313 ok = VRSet("EF_DIRECTORY","Value","")
4314 call SW_MOUNTPOINT_Close */
4315RETURN 0
4316
4317/*:VRX PB_NEWPORTCONNECT_Click
4318*/
4319PB_NEWPORTCONNECT_Click:
4320/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4321 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4322
4323 advanced.!readonly = VRGet("CB_READONLY1","Set")
4324 advanced.!easupport = VRGet("CB_EAS1","Set")
4325 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4326 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4327 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4328
4329 call SW_MOUNTPOINT_Close */
4330RETURN
4331
4332/*:VRX PB_PROGRESS_ABORT_Click
4333*/
4334PB_PROGRESS_ABORT_Click:
4335 options.!delay = 0
4336 options.!autoload = 0
4337 options.!autoclose = 0
4338 call SW_PROGRESS_Close
4339return
4340
4341/*:VRX PB_SETTINGS_APPLY_Click
4342*/
4343PB_SETTINGS_APPLY_Click:
4344 if options.!debug == 1 then say time()' PB_SETTINGS_APPLY_Click() started'
4345 advanced.!loglevel = VRGet("SPIN_LOG_LEVEL", "Value" )
4346 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4347 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4348 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4349 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4350 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4351 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4352 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4353 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4354
4355 /* Note: CB_LOGGING has its own event tied to the click */
4356 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4357 options.!debug = VRGet("CB_DEBUG", "Set" )
4358 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4359 ok = VRRedirectStdio("ON")
4360 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4361 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4362 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4363 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4364 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4365 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4366 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4367 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4368 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4369
4370 end
4371 else do /* Turn on additional columns in connection details view */
4372 ok = VRRedirectStdio("OFF")
4373 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4374 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4375 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4376 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4377 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4378 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4379 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4380 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4381 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4382 end
4383
4384 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4385 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4386 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4387
4388 if advanced.!lmhosts = 1 then do
4389 call _LMHostsRead
4390 call _LMHostsUpdate
4391 end
4392
4393 if advanced.!smbconfchanged = 1 then do
4394 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4395 handle = IniOpen('global', samba.!smbconf)
4396 call IniSet 'name resolve order', name_resolve_order, handle
4397 /* FIXME: Throw an error in this case */
4398 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4399 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4400 call IniSet 'log level', VRGet("SPIN_LOG_LEVEL","Value"), handle
4401 call IniSave handle
4402 call IniClose handle
4403 advanced.!smbconfchanged = 0
4404 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4405 end
4406 if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
4407
4408 if options.!debug == 1 then say time()' PB_SETTINGS_APPLY_Click() done'
4409return
4410
4411/*:VRX PB_SETTINGS_HELP_Click
4412*/
4413PB_SETTINGS_HELP_Click:
4414 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4415return
4416
4417/*:VRX PB_SETTINGS_UNDO_Click
4418*/
4419PB_SETTINGS_UNDO_Click:
4420 call SW_SETTINGS_Init_Content
4421return
4422
4423/*:VRX PB_SMBCONF_APPLY_Click
4424*/
4425PB_SMBCONF_APPLY_Click:
4426 if advanced.!smbconfchanged = 1 then do
4427 client_NTLMv2_auth = VRGet("CB_client_NTLMv2_auth","Set")
4428 client_lanman_auth = VRGet("CB_client_lanman_auth","Set")
4429 client_plaintext_auth = VRGet("CB_client_plaintext_auth","Set")
4430 client_use_spnego = VRGet("CB_client_use_spnego","Set")
4431 client_use_spnego_principal = VRGet("CB_client_use_spnego_principal","Set")
4432 client_signing = VRGet("SPIN_client_signing","Value")
4433 client_ipc_signing = VRGet("SPIN_client_ipc_signing","Value")
4434
4435 if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
4436 client_max_protocol = VRGet("SPIN_client_max_protocol","Value")
4437 client_min_protocol = VRGet("SPIN_client_min_protocol","Value")
4438 end
4439
4440
4441 handle = IniOpen('global', samba.!smbconf)
4442 call IniSet 'client NTLMv2 auth', YesNo(client_NTLMv2_auth), handle
4443 call IniSet 'client lanman auth', YesNo(client_lanman_auth), handle
4444 call IniSet 'client plaintext auth', YesNo(client_plaintext_auth), handle
4445 call IniSet 'client use spnego', YesNo(client_use_spnego), handle
4446 call IniSet 'client use spnego principal', YesNo(client_use_spnego_principal), handle
4447 call IniSet 'client signing', client_signing, handle
4448 call IniSet 'client ipc signing', client_ipc_signing, handle
4449
4450 if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
4451 call IniSet 'client max protocol', client_max_protocol, handle
4452 call IniSet 'client min protocol', client_min_protocol, handle
4453 end
4454
4455 call IniSave handle
4456 call IniClose handle
4457 advanced.!smbconfchanged = 0
4458 ok = VRSet("PB_SMBCONF_UNDO","Enabled", 0)
4459 end
4460return
4461
4462/*:VRX PB_SMBCONF_HELP_Click
4463*/
4464PB_SMBCONF_HELP_Click:
4465 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4466return
4467
4468/*:VRX PB_SMBCONF_UNDO_Click
4469*/
4470PB_SMBCONF_UNDO_Click:
4471 call SW_SETTINGS_Init_Content
4472return
4473
4474/*:VRX PB_SMBTREE_CONNECT_Click
4475*/
4476PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
4477 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
4478
4479 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4480
4481 if SelRH.0 = 0 then do
4482 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
4483 return
4484 end
4485
4486 p_workgroup = ''
4487 p_server = ''
4488 p_share = ''
4489
4490 srcFile = ""
4491 srcCtn = VRGet("CN_SMBTREE","Self")
4492 srcRec = SelRH.1
4493 trgCtn = VRGet("CN_CURRENT","Self")
4494 trgRec = ""
4495
4496 if options.!debug == 1 then do
4497 say ' srcCtn = "'srcCtn'"'
4498 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4499 say ' srcRec = "'srcRec'"'
4500 say ' trgCtn = "'trgCtn'"'
4501 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4502 say ' trgRec = "'trgRec'"'
4503 end
4504
4505 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4506
4507 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4508 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4509
4510 if ParentRH = "" then do /* A workgroup was dragged */
4511 say "Workgroup dragged!"
4512 parse var DragCapt p_workgroup '0D0A'x .
4513 p_workgroup = strip(p_workgroup)
4514 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4515 call _UpdateObject "EF_SERVER", ""
4516 ok = VRSet("EF_SHARE","Value","")
4517
4518 ShareLevel = 3
4519 end
4520 else do
4521 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4522 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4523
4524 if GParentRH = "" then do /* A server was dragged */
4525 say "Server dragged!"
4526 parse var ParDragCapt p_workgroup '0D0A'x .
4527 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4528 p_workgroup = strip(p_workgroup)
4529
4530 parse var DragCapt p_server '0D0A'x .
4531 p_server = strip(p_server)
4532 call _UpdateObject "EF_SERVER", p_server
4533 ok = VRSet("EF_Share","Value","")
4534
4535 ShareLevel = 2
4536 end
4537 else do /* A share was dragged */
4538 say "Share dragged!"
4539 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4540
4541 parse var GParDragCapt p_workgroup '0D0A'x .
4542 p_workgroup = strip(p_workgroup)
4543 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4544
4545 parse var ParDragCapt p_server '0D0A'x .
4546 p_server = strip(p_server)
4547 call _UpdateObject "EF_SERVER", p_server
4548
4549 parse var DragCapt p_share '0D0A'x .
4550 p_share = strip(p_share)
4551 ok = VRSet("EF_Share","Value",strip(p_share))
4552
4553 ShareLevel = 1
4554 end
4555 end
4556
4557 say 'p_workgroup = "'p_workgroup'"'
4558 say 'p_server = "'p_server'"'
4559 say 'p_share = "'p_share'"'
4560
4561 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4562 call CB_MOUNT_Change
4563
4564 if trgRec = "" then do
4565 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4566 if VRGet("CB_DRIVES","Value") = "" then return
4567 end
4568 else do
4569
4570 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4571
4572 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4573
4574 do while parTrgRH <> ""
4575 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4576 TargetString = partrgCapt||'\'||TargetString
4577 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4578 end
4579 say 'TargetString = "'TargetString'"'
4580 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4581 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4582 end
4583
4584 window = VRLoadSecondary( "SW_LOGIN", "W" )
4585 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4586
4587 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
4588RETURN
4589
4590/*:VRX PB_SMBTREE_HELP_Click
4591*/
4592PB_SMBTREE_HELP_Click:
4593 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4594return
4595
4596/*:VRX PB_SMBTREE_REFRESH_Click
4597*/
4598PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4599 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
4600
4601 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4602 window = VRLoadSecondary( "SW_LOGIN", "W" )
4603 end
4604
4605 call _UserCredUpdate
4606 ok = VRset("Pict_Throbber", "Visible", 1)
4607 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4608 ok = VRset("TM_Throbber", "Enabled", 1)
4609 ShowHidden = advanced.!special
4610 BroadCast = advanced.!broadcast
4611 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4612 ok = time('R')
4613 call _RefreshTree
4614 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
4615RETURN
4616
4617/*:VRX PB_UNMOUNT_Click
4618*/
4619PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4620 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
4621 if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
4622 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4623 IF select.0 < 1 THEN RETURN
4624
4625 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4626 PARSE VAR userdata mountpoint ';' mounts ';' .
4627say 'userdata="'userdata'"'
4628 IF mounts > 0 & options.!editmode = 0 THEN DO
4629 btns.0 = 2
4630 btns.1 = NLVGetMessage( 6 )
4631 btns.2 = NLVGetMessage( 7 )
4632 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4633 IF confirm \= 1 THEN RETURN
4634 END
4635
4636 /* Unmount any resources */
4637 DO i = 1 TO mounts
4638 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4639 END
4640
4641 /* Delete mountpoint */
4642 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4643 IF parent \= '' THEN DO
4644 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4645 END
4646
4647 CALL Refresh
4648 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
4649RETURN 0
4650
4651/*:VRX Pict_PWINMEM_Click
4652*/
4653Pict_PWINMEM_Click:
4654 if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
4655 call Menu_File_ucCred_Reset_Click
4656 end
4657return
4658
4659/*:VRX Quit
4660*/
4661Quit:
4662 if Fatal <> 1 then CALL _INISave
4663 /* ok = VRREdirectSTdio("OFF") */
4664 window = VRWindow()
4665 call VRSet window, "Shutdown", 1
4666 drop window
4667RETURN
4668
4669/*:VRX Refresh
4670*/
4671Refresh:
4672 if options.!debug == 1 then say time()' Refresh started'
4673 CALL VRSet "CN_CURRENT", 'Painting', 0
4674
4675 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4676
4677 /* Remove Active connections from details view */
4678 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4679
4680 do I = 1 to rh.0
4681 /* This catches the bug we observed exactly once and were unable to reproduce! */
4682 if cd.statusfh = 'CD.STATUSFH' then do
4683 if options.!debug == 1 then call beep 880, 50
4684 if options.!debug == 1 then call beep 880, 50
4685 if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
4686 leave
4687 end
4688 if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4689 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4690 end
4691
4692/* call _AddTemplates */
4693 CALL VRSet "PB_DETACH", "Enabled", 0
4694 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4695
4696 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4697/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4698 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4699 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4700 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4701
4702 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4703 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4704
4705 if options.!debug == 1 then say ' Remove records, disable buttons done.'
4706
4707 CALL VRMethod 'CB_DRIVES', 'Clear'
4708
4709 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4710
4711 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4712 drvs = MyFreeDriveMap('C:', 'FREE')
4713
4714 DO i = 1 TO WORDS( drvs )
4715 drvstem.i = WORD( drvs, i )
4716 END
4717
4718 drvstem.0 = WORDS( drvs )
4719
4720 /* Add any existing EVFS drives */
4721 CALL GetMountPoints
4722
4723 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4724 CALL VRSet "CN_CURRENT", 'Painting', 1
4725 if options.!debug == 1 then say time()' '||"Refresh done"
4726RETURN 0
4727
4728/*:VRX SPIN_client_ipc_signing_Change
4729*/
4730SPIN_client_ipc_signing_Change:
4731 advanced.!smbconfchanged = 1
4732return
4733
4734/*:VRX SPIN_client_max_protocol_Change
4735*/
4736SPIN_client_max_protocol_Change:
4737 advanced.!smbconfchanged = 1
4738return
4739
4740/*:VRX SPIN_client_min_protocol_Change
4741*/
4742SPIN_client_min_protocol_Change:
4743 advanced.!smbconfchanged = 1
4744return
4745
4746/*:VRX SPIN_client_signing_Change
4747*/
4748SPIN_client_signing_Change:
4749 advanced.!smbconfchanged = 1
4750return
4751
4752/*:VRX SPIN_LOG_LEVEL_Change
4753*/
4754SPIN_LOG_LEVEL_Change:
4755 advanced.!smbconfchanged = 1
4756return
4757
4758/*:VRX SPIN_NRO1_Change
4759*/
4760SPIN_NRO1_Change:
4761 advanced.!smbconfchanged = 1
4762return
4763
4764/*:VRX SPIN_NRO2_Change
4765*/
4766SPIN_NRO2_Change:
4767 advanced.!smbconfchanged = 1
4768return
4769
4770/*:VRX SPIN_NRO3_Change
4771*/
4772SPIN_NRO3_Change:
4773 advanced.!smbconfchanged = 1
4774return
4775
4776/*:VRX SPIN_NRO4_Change
4777*/
4778SPIN_NRO4_Change:
4779 advanced.!smbconfchanged = 1
4780return
4781
4782/*:VRX SPLIT_Main_Move
4783*/
4784SPLIT_Main_Move:
4785 ok = VRset("Main", "Painting", 0)
4786 NewPos = VRInfo("Left")
4787 OldPos = VRGet("SPLIT_Main","Left")
4788 ok = VRSet("SPLIT_Main","Left", NewPos)
4789 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4790 call Main_Resize
4791 ok = VRset("Main", "Painting", 1)
4792return
4793
4794/*:VRX SW_ABOUT_Close
4795*/
4796SW_ABOUT_Close:
4797 options.!tracmark = VRGet('CB_TRAC', 'Set')
4798 call SW_ABOUT_Fini
4799return
4800
4801/*:VRX SW_ABOUT_Create
4802*/
4803SW_ABOUT_Create:
4804 call SW_ABOUT_Init
4805
4806 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4807 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4808 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
4809 CALL NLVSetText 'CB_TRAC', "Caption", 134
4810
4811 CALL VRSet 'CB_TRAC', 'Set', options.!tracmark
4812
4813 ok = VRSet("DT_About","Caption", Program' (c) 2007-2017 Alexander Taylor for Arca Noae '||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
4814
4815 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
4816 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
4817
4818 call _AboutSambaClientGetInfo
4819
4820return
4821/*:VRX SW_ABOUT_Fini
4822*/
4823SW_ABOUT_Fini:
4824 window = VRInfo( "Window" )
4825 call VRDestroy window
4826 drop window
4827return
4828/*:VRX SW_ABOUT_Init
4829*/
4830SW_ABOUT_Init:
4831 window = VRInfo( "Object" )
4832 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4833 call VRMethod window, "CenterWindow"
4834 call VRSet window, "Visible", 1
4835 call VRMethod window, "Activate"
4836 end
4837 drop window
4838return
4839
4840/*:VRX SW_ACLS_Close
4841*/
4842SW_ACLS_Close:
4843 call SW_ACLS_Fini
4844return
4845
4846/*:VRX SW_ACLS_Create
4847*/
4848SW_ACLS_Create:
4849 call SW_ACLS_Init
4850
4851 ok = VRSet("SW_ACLS","Caption",'ACLS \\'machine'\'sharename' "'browsepath'"')
4852
4853 ACL.typeFH = VRMethod( "CN_ACLS", "AddField", "String", "Type" )
4854 ACL.valueFH = VRMethod( "CN_ACLS", "AddField", "String", "Value" )
4855
4856 /* Make sure credentials are usable */
4857 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
4858
4859 /* We have to remove the double % for smbclient.exe - not entirely clear why */
4860 OldUserCred = ""
4861 if pos('%%',UserCred) > 0 & pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0 then do
4862 OldUserCred = UserCred
4863 parse var UserCred '--user='username'%%'password
4864 UserCred = '--user='username'%'password
4865 say " Strip double %%!!!"
4866 end
4867
4868 say ' 'samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred
4869 address cmd samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred' 'debuglevel' 2>'samba.!error' 1>'samba.!msg
4870
4871 ok = file2stem(samba.!error,"aclserror.","DEL")
4872
4873 if aclserror.0 = 0 then do
4874 call _StatusBarWrapper "NT_STATUS_OK"
4875
4876 ok = file2stem(samba.!msg,"aclsmsg.","DEL")
4877 do I = 1 to aclsmsg.0
4878 parse var aclsmsg.I aclstype':'aclsvalue
4879 DummyRH = VRMethod('CN_ACLS', 'AddRecord')
4880 ok = VRMethod("CN_ACLS", "SetFieldData", DummyRH, ACL.typeFH, aclstype, ACL.valueFH, aclsvalue)
4881 end
4882 end
4883 else do
4884 call _StatusBarWrapper aclserror.1
4885 call SW_ACLS_close
4886 end
4887return
4888
4889/*:VRX SW_ACLS_Fini
4890*/
4891SW_ACLS_Fini:
4892 window = VRInfo( "Window" )
4893 call VRDestroy window
4894 drop window
4895return
4896/*:VRX SW_ACLS_Init
4897*/
4898SW_ACLS_Init:
4899 window = VRInfo( "Object" )
4900 if( \VRIsChildOf( window, "Notebook" ) ) then do
4901 call VRMethod window, "CenterWindow"
4902 call VRSet window, "Visible", 1
4903 call VRMethod window, "Activate"
4904 end
4905 drop window
4906return
4907
4908/*:VRX SW_ADVANCED_Close
4909*/
4910SW_ADVANCED_Close:
4911 call SW_ADVANCED_Fini
4912return
4913
4914/*:VRX SW_ADVANCED_Create
4915*/
4916SW_ADVANCED_Create:
4917 call SW_ADVANCED_Init
4918return
4919
4920/*:VRX SW_ADVANCED_Fini
4921*/
4922SW_ADVANCED_Fini:
4923 window = VRInfo( "Window" )
4924 call VRDestroy window
4925 drop window
4926return
4927/*:VRX SW_ADVANCED_Init
4928*/
4929SW_ADVANCED_Init:
4930 /* Title bar */
4931 CALL NLVSetText "SW_ADVANCED", "Caption", 40
4932
4933 /* Options */
4934 CALL NLVSetText "GB_ADVANCED", "Caption", 43
4935 CALL NLVSetText "CB_EAS", "Caption", 44
4936 CALL NLVSetText "CB_READONLY", "Caption", 45
4937 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
4938 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
4939 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
4940
4941 CALL NLVSetText "CB_NTLMv1", "Caption", 144
4942 CALL NLVSetText "CB_KERBEROS5", "Caption", 145
4943 CALL NLVSetText "CB_ENCRYPTION", "Caption", 146
4944
4945 /* Buttons */
4946 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
4947 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
4948 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
4949
4950 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
4951
4952/* call VRMethod "SW_ADVANCED", "CenterWindow" */
4953 ok = VRSet("SW_ADVANCED", "Visible", 1)
4954/* call VRMethod "SW_ADVANCED", "Activate" */
4955return
4956
4957/*:VRX SW_ADVANCED_Init_Content
4958*/
4959SW_ADVANCED_Init_Content:
4960 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
4961 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
4962 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
4963 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
4964 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
4965 IF advanced.!kerberos5 \= "" THEN ok = VRSet("CB_KERBEROS5", "Set", advanced.!kerberos5)
4966 IF advanced.!NTLMv1 \= "" THEN ok = VRSet("CB_NTLMv1", "Set", advanced.!NTLMv1)
4967 IF advanced.!encryption \= "" THEN ok = VRSet("CB_ENCRYPTION", "Set", advanced.!encryption)
4968 /* Obsolete */
4969 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
4970return
4971
4972/*:VRX SW_CONDET_Close
4973*/
4974SW_CONDET_Close:
4975 call SW_CONDET_Fini
4976return
4977
4978/*:VRX SW_CONDET_Create
4979*/
4980SW_CONDET_Create:
4981 call SW_CONDET_Init
4982return
4983
4984/*:VRX SW_CONDET_Fini
4985*/
4986SW_CONDET_Fini:
4987 window = VRInfo( "Window" )
4988 call VRDestroy window
4989 drop window
4990return
4991/*:VRX SW_CONDET_Init
4992*/
4993SW_CONDET_Init:
4994
4995return
4996
4997/*:VRX SW_CONDET_Init_Content
4998*/
4999SW_CONDET_Init_Content:
5000 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
5001
5002 /* Hide any "foreign" menu entries */
5003 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
5004return
5005
5006/*:VRX SW_DIALOG_Close
5007*/
5008SW_DIALOG_Close:
5009 call SW_DIALOG_Fini
5010return
5011
5012/*:VRX SW_DIALOG_Create
5013*/
5014SW_DIALOG_Create:
5015 call SW_DIALOG_Init
5016return
5017
5018/*:VRX SW_DIALOG_Fini
5019*/
5020SW_DIALOG_Fini:
5021 window = VRInfo( "Window" )
5022 call VRDestroy window
5023 drop window
5024return
5025/*:VRX SW_DIALOG_Init
5026*/
5027SW_DIALOG_Init:
5028 LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
5029
5030 ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
5031 ok = VRSet("Pict_PWINMEM","Width", LEDSize)
5032 ok = VRSet("Pict_PWINMEM","Height", LEDSize)
5033return
5034
5035/*:VRX SW_DIALOG_Init_Content
5036*/
5037SW_DIALOG_Init_Content:
5038 /* obsolete */
5039 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
5040
5041 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5042 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5043 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
5044
5045 call _DialogPopulate
5046return
5047
5048/*:VRX SW_INFO_Close
5049*/
5050SW_INFO_Close:
5051 call SW_INFO_Fini
5052return
5053
5054/*:VRX SW_INFO_Create
5055*/
5056SW_INFO_Create:
5057 if options.!debug == 1 then say time()' SW_INFO_Create started'
5058 call SW_INFO_Init
5059 CALL NLVSetText 'SW_INFO', "Caption", 92
5060 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
5061 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
5062 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
5063
5064 if options.!debug == 1 then do
5065 say ' Handle: "'SMBObj.rh'"'
5066 say ' Resource: "'SMBObj.resname'"'
5067 say ' Comment: "'SMBObj.comment'"'
5068 say ' Type: "'SMBObj.udatatype'"'
5069 say ' Message: "'SMBObj.udatamsg'"'
5070 say ' Icon: "'SMBObj.icon'"'
5071 end
5072say "Vorher:"rpc.srvinfo.OS_VERSION
5073 drop rpc.
5074say "Vorher:"rpc.srvinfo.OS_VERSION
5075 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
5076
5077 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
5078 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
5079 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
5080 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
5081 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
5082 Info.!os = VRMethod( "CN_INFO", "AddRecord")
5083 Info.!server = VRMethod( "CN_INFO", "AddRecord")
5084 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
5085 Info.!status = VRMethod( "CN_INFO", "AddRecord")
5086 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
5087 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
5088
5089 if rpc_success = 1 then do
5090 if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
5091 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
5092 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
5093 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
5094 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
5095 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
5096 /* we did not get these, but we know them anyway */
5097 if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
5098 if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
5099 end
5100 else do
5101 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
5102 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
5103 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
5104 end
5105
5106 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
5107 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
5108 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
5109 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
5110 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
5111 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
5112
5113 if options.!debug == 1 then say time()' SW_INFO_Create done'
5114return
5115
5116/*:VRX SW_INFO_Fini
5117*/
5118SW_INFO_Fini:
5119 window = VRInfo( "Window" )
5120 call VRDestroy window
5121 drop window
5122return
5123/*:VRX SW_INFO_Init
5124*/
5125SW_INFO_Init:
5126 window = VRInfo( "Object" )
5127 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5128 call VRMethod window, "CenterWindow"
5129 call VRSet window, "Visible", 1
5130 call VRMethod window, "Activate"
5131 end
5132 drop window
5133return
5134
5135/*:VRX SW_LOGIN_Close
5136*/
5137SW_LOGIN_Close:
5138 call SW_LOGIN_Fini
5139return
5140
5141/*:VRX SW_LOGIN_Create
5142*/
5143SW_LOGIN_Create:
5144 call SW_LOGIN_Init
5145 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
5146 CALL NLVSetText 'DT_USER1', "Caption", 25
5147 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
5148 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
5149 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
5150 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
5151
5152 if VRIsValidObject(SMBObj.rh) then do
5153 select
5154 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
5155 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
5156 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
5157 when SMBObj.udatatype = "DISK" then do
5158 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
5159 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
5160 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
5161 end
5162 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
5163 end
5164 say loginicon
5165 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
5166 end
5167 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
5168 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
5169 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
5170return
5171
5172/*:VRX SW_LOGIN_Fini
5173*/
5174SW_LOGIN_Fini:
5175 window = VRInfo( "Window" )
5176 call VRDestroy window
5177 drop window
5178return
5179/*:VRX SW_LOGIN_Init
5180*/
5181SW_LOGIN_Init:
5182 window = VRInfo( "Object" )
5183 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5184 call VRMethod window, "CenterWindow"
5185 call VRSet window, "Visible", 1
5186 call VRMethod window, "Activate"
5187 end
5188 drop window
5189return
5190
5191/*:VRX SW_LOGIN_KeyPress
5192*/
5193SW_LOGIN_KeyPress:
5194 obj = VRInfo( "Object" )
5195 keystr = VRGet( obj, "KeyString" )
5196/* say keystr */
5197 select
5198 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
5199 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
5200 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
5201 otherwise nop
5202 end
5203return
5204
5205/*:VRX SW_MOUNTPOINT_Close
5206*/
5207SW_MOUNTPOINT_Close:
5208 call SW_MOUNTPOINT_Fini
5209return
5210
5211/*:VRX SW_MOUNTPOINT_Create
5212*/
5213SW_MOUNTPOINT_Create:
5214 call SW_MOUNTPOINT_Init
5215
5216 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
5217 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
5218 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
5219 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
5220 CALL NLVSetText 'CB_EAS1', "Caption", 44
5221 CALL NLVSetText 'CB_READONLY1', "Caption", 45
5222 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
5223 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
5224 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
5225
5226 CALL NLVSetText "CB_NTLMv11", "Caption", 144
5227 CALL NLVSetText "CB_KERBEROS51", "Caption", 145
5228 CALL NLVSetText "CB_ENCRYPTION1", "Caption", 146
5229
5230 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
5231 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
5232 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
5233
5234 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
5235
5236 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
5237
5238 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
5239 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
5240 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
5241 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
5242 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
5243return
5244
5245/*:VRX SW_MOUNTPOINT_Fini
5246*/
5247SW_MOUNTPOINT_Fini:
5248 window = VRInfo( "Window" )
5249 call VRDestroy window
5250 drop window
5251return
5252/*:VRX SW_MOUNTPOINT_Init
5253*/
5254SW_MOUNTPOINT_Init:
5255 window = VRInfo( "Object" )
5256 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5257 call VRMethod window, "CenterWindow"
5258 call VRSet window, "Visible", 1
5259 call VRMethod window, "Activate"
5260 end
5261 drop window
5262return
5263
5264/*:VRX SW_PORTCONNECT_Close
5265*/
5266SW_PORTCONNECT_Close:
5267 call SW_PORTCONNECT_Fini
5268return
5269
5270/*:VRX SW_PORTCONNECT_Create
5271*/
5272SW_PORTCONNECT_Create:
5273 call SW_PORTCONNECT_Init
5274
5275 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
5276
5277 if ok = "" then do
5278
5279 end
5280 else do
5281 say "Samba Spooler Port driver installed!"
5282 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
5283 smbport.0 = 0
5284 do I = 1 to ports.0
5285 if left(ports.I,3) = "SMB" then do
5286 X = smbport.0
5287 X = X + 1
5288 smbport.0 = X
5289 smbport.X = ports.I
5290 end
5291 end
5292 do I = 1 to smbport.0
5293 say smbport.I
5294 end
5295 end
5296
5297return
5298
5299/*:VRX SW_PORTCONNECT_Fini
5300*/
5301SW_PORTCONNECT_Fini:
5302 window = VRInfo( "Window" )
5303 call VRDestroy window
5304 drop window
5305return
5306/*:VRX SW_PORTCONNECT_Init
5307*/
5308SW_PORTCONNECT_Init:
5309 window = VRInfo( "Object" )
5310 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5311 call VRMethod window, "CenterWindow"
5312 call VRSet window, "Visible", 1
5313 call VRMethod window, "Activate"
5314 end
5315 drop window
5316return
5317
5318/*:VRX SW_PROGRESS_Close
5319*/
5320SW_PROGRESS_Close:
5321 options.!delay = 0
5322 call Main_Resize
5323 call VRSet 'Main', 'Visible', 1
5324 call SW_PROGRESS_Fini
5325return
5326
5327/*:VRX SW_PROGRESS_Create
5328*/
5329SW_PROGRESS_Create:
5330 call SW_PROGRESS_Init
5331 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
5332 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
5333 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
5334
5335 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
5336
5337 CALL VRSet "TM_Progress_Throbber","Enabled", 1
5338 CALL VRSet "TM_TheCloser","Enabled", 1
5339return
5340
5341/*:VRX SW_PROGRESS_Fini
5342*/
5343SW_PROGRESS_Fini:
5344 call VRDestroy "SW_PROGRESS"
5345return
5346/*:VRX SW_PROGRESS_Init
5347*/
5348SW_PROGRESS_Init:
5349 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
5350 call VRSet "SW_PROGRESS", "Visible", 1
5351 call VRMethod "SW_PROGRESS", "Activate"
5352return
5353
5354/*:VRX SW_SETTINGS_Close
5355*/
5356SW_SETTINGS_Close:
5357 call SW_SETTINGS_Fini
5358return
5359
5360/*:VRX SW_SETTINGS_Create
5361*/
5362SW_SETTINGS_Create:
5363 call SW_SETTINGS_Init
5364return
5365
5366/*:VRX SW_SETTINGS_Fini
5367*/
5368SW_SETTINGS_Fini:
5369 window = VRInfo( "Window" )
5370 call VRDestroy window
5371 drop window
5372return
5373/*:VRX SW_SETTINGS_Init
5374*/
5375SW_SETTINGS_Init:
5376 /* Title bar */
5377 call NLVSetText "SW_SETTINGS", "Caption", 47
5378
5379 /* Options */
5380 call NLVSetText "GB_GLOBAL", "Caption", 47
5381 call NLVSetText "CB_DEBUG", "Caption", 42
5382 call NLVSetText "CB_LOGGING", "Caption", 46
5383 call NLVSetText "CB_BROWSEIMME", "Caption", 48
5384 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
5385 call NLVSetText "CB_SPECIAL", "Caption", 66
5386 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
5387 call NLVSetText "CB_LMHOSTS", "Caption", 133
5388 call NLVSetText "CB_BROADCAST", "Caption", 74
5389 call NLVSetText "CB_MINIICONS", "Caption", 70
5390 call NLVSetText "CB_STORECREDS", "Caption", 135
5391
5392 /* Buttons */
5393 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
5394 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
5395 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
5396
5397/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
5398
5399/* call VRMethod "SW_SETTINGS", "CenterWindow" */
5400 ok = VRSet("SW_SETTINGS", "Visible", 1)
5401/* call VRMethod "SW_SETTINGS", "Activate" */
5402return
5403
5404/*:VRX SW_SETTINGS_Init_Content
5405*/
5406SW_SETTINGS_Init_Content:
5407 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
5408
5409 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
5410 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
5411 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
5412 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
5413 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
5414 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
5415
5416 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
5417 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
5418 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
5419
5420 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
5421
5422/* if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile) /* Obsolete */
5423 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOG_LEVEL", "Value", advanced.!loglevel) */
5424
5425 log_level = IniGet('log level', 'global', samba.!smbconf)
5426 call _SmbConfCreateShadowCopy
5427
5428
5429say "log level ="log_level
5430 if log_level = "" then log_level = 2
5431say "log level ="log_level
5432 ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
5433
5434 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
5435
5436 if wins_support = "YES" then do /* we are a WINS server ourself */
5437 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
5438 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
5439 ok = VRSet("EF_WINS_SERVER","Value", "")
5440 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
5441 end
5442 else do
5443 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
5444 end
5445
5446 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
5447
5448 do I = 1 to words(name_resolve_order)
5449 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
5450 end
5451
5452 advanced.!smbconfchanged = 0
5453return
5454
5455/*:VRX SW_SMBCONF_Close
5456*/
5457SW_SMBCONF_Close:
5458 call SW_SMBCONF_Fini
5459return
5460
5461/*:VRX SW_SMBCONF_Create
5462*/
5463SW_SMBCONF_Create:
5464 call SW_SMBCONF_Init
5465return
5466
5467/*:VRX SW_SMBCONF_Fini
5468*/
5469SW_SMBCONF_Fini:
5470 window = VRInfo( "Window" )
5471 call VRDestroy window
5472 drop window
5473return
5474/*:VRX SW_SMBCONF_Init
5475*/
5476SW_SMBCONF_Init:
5477
5478 /* Buttons */
5479 call NLVSetText "PB_SMBCONF_APPLY", "Caption", 122
5480 call NLVSetText "PB_SMBCONF_UNDO", "Caption", 123
5481 call NLVSetText "PB_SMBCONF_HELP", "Caption", 4
5482
5483return
5484
5485/*:VRX SW_SMBCONF_Init_Content
5486*/
5487SW_SMBCONF_Init_Content:
5488 call _SmbConfCreateShadowCopy
5489
5490 client_NTLMv2_auth = ZeroOne(IniGet('client NTLMv2 auth', 'global', samba.!shadowsmbconf))
5491 if client_NTLMv2_auth = 1 then do
5492 ok = VRSet("CB_client_NTLMv2_auth","Set",client_NTLMv2_auth)
5493 ok = VRSet("CB_client_lanman_auth","Enabled", 0)
5494 ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
5495 end
5496 else do
5497 client_lanman_auth = ZeroOne(IniGet('client lanman auth', 'global', samba.!shadowsmbconf))
5498 client_plaintext_auth = ZeroOne(IniGet('client plaintext auth', 'global', samba.!shadowsmbconf))
5499 ok = VRSet("CB_client_lanman_auth","Set",client_lanman_auth)
5500 ok = VRSet("CB_client_plaintext_auth","Set",client_plaintext_auth)
5501 end
5502
5503 client_use_spnego = ZeroOne(IniGet('client use spnego', 'global', samba.!shadowsmbconf))
5504 ok = VRSet("CB_client_use_spnego","Set",client_use_spnego)
5505
5506 client_use_spnego_principal = ZeroOne(IniGet('client use spnego principal', 'global', samba.!shadowsmbconf))
5507 ok = VRSet("CB_client_use_spnego_principal","Set",client_use_spnego_principal)
5508
5509 client_max_protocol = IniGet('client max protocol', 'global', samba.!shadowsmbconf)
5510 if client_max_protocol = "" then do
5511 /* ok = VRSet("SPIN_client_max_protocol","Enabled", 0)
5512 ok = VRSet("DT_client_max_protocol","Enabled", 0) */
5513 end
5514 else ok = VRSet("SPIN_client_max_protocol","Value",client_max_protocol)
5515
5516 client_min_protocol = IniGet('client min protocol', 'global', samba.!shadowsmbconf)
5517 if client_min_protocol = "" then do
5518 /* ok = VRSet("SPIN_client_min_protocol","Enabled", 0)
5519 ok = VRSet("DT_client_min_protocol","Enabled", 0) */
5520 end
5521 else ok = VRSet("SPIN_client_min_protocol","Value",client_min_protocol)
5522
5523 client_signing = IniGet('client signing', 'global', samba.!shadowsmbconf)
5524 client_ipc_signing = IniGet('client ipc signing', 'global', samba.!shadowsmbconf)
5525say "client_signing ="client_signing
5526 ok = VRSet("SPIN_client_signing","Value",client_signing)
5527 ok = VRSet("SPIN_client_ipc_signing","Value",client_signing)
5528
5529 advanced.!smbconfchanged = 0
5530return
5531
5532/*:VRX SW_SMBTREE_Close
5533*/
5534SW_SMBTREE_Close:
5535 call SW_SMBTREE_Fini
5536return
5537
5538/*:VRX SW_SMBTREE_Create
5539*/
5540SW_SMBTREE_Create:
5541 call SW_SMBTREE_Init
5542return
5543
5544/*:VRX SW_SMBTREE_Fini
5545*/
5546SW_SMBTREE_Fini:
5547 window = VRInfo( "Window" )
5548 call VRDestroy window
5549 drop window
5550return
5551/*:VRX SW_SMBTREE_Init
5552*/
5553SW_SMBTREE_Init:
5554
5555return
5556
5557/*:VRX SW_SMBTREE_Init_Content
5558*/
5559SW_SMBTREE_Init_Content:
5560 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
5561
5562 /* Hide any "foreign" menu entries */
5563 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5564 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5565return
5566
5567/*:VRX TDL_1_PageSelected
5568*/
5569TDL_1_PageSelected:
5570 page = VRInfo("Page")
5571
5572 /* call _TabsStrip */
5573 select
5574 when page = 1 then do /* dialog */
5575 call _TabFix 1
5576 end
5577 when page = 2 then do /* advanced */
5578 call SW_ADVANCED_Init_Content
5579 end
5580 when page = 3 then do /* smbtree */
5581 call SW_SMBTREE_Init_Content
5582 end
5583 when page = 4 then do /* condet */
5584 call SW_CONDET_Init_Content
5585 end
5586 when page = 5 then do /* Settings */
5587 call SW_SETTINGS_Init_Content
5588 end
5589 when page = 6 then do /* SMB.CONF */
5590 call SW_SMBCONF_Init_Content
5591 end
5592 otherwise nop
5593 end
5594return
5595/*:VRX TM_AutoClose_Trigger
5596*/
5597TM_AutoClose_Trigger:
5598 call Quit
5599return
5600
5601/*:VRX TM_Progress_Throbber_Trigger
5602*/
5603TM_Progress_Throbber_Trigger:
5604 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5605 parse var pIdx '#' pidx
5606 pidx = pidx + 1
5607 if pidx = 23 then pidx = 11
5608 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5609return
5610
5611/*:VRX TM_RefreshCurrentDisplay_Trigger
5612*/
5613TM_RefreshCurrentDisplay_Trigger:
5614 if RefreshMode <> "" then return
5615 if _DaemonRunning() = 0 then do
5616 say " Daemon not running - disable GUI"
5617 ok = VRset("GB_CURRENT", "Enabled", 0)
5618 ok = VRset("TDL_1", "Enabled", 0)
5619 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5620 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5621 end
5622 else do
5623 say " Daemon running - enable GUI"
5624 ok = VRset("GB_CURRENT", "Enabled", 1)
5625 ok = VRset("TDL_1", "Enabled", 1)
5626 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5627 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5628 end
5629 CALL REFRESH
5630return
5631
5632/*:VRX TM_RefreshTreeDisplay_Trigger
5633*/
5634TM_RefreshTreeDisplay_Trigger:
5635 ShowHidden = advanced.!special
5636 BroadCast = advanced.!broadcast
5637 DoLMHosts = advanced.!lmhosts
5638
5639 select
5640 when RefreshMode = "TREE" then do
5641 call _RefreshTreeDisplay
5642
5643 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5644 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5645 end
5646 end
5647 when RefreshMode = "SHARE" then do
5648 call _AddSharesDisplay
5649 end
5650 otherwise say "RefreshMode = "RefreshMode
5651 end
5652 call _DialogPopulate
5653return
5654
5655/*:VRX TM_STATUSBAR_Trigger
5656*/
5657TM_STATUSBAR_Trigger:
5658 call _StatusbarReset
5659return
5660
5661/*:VRX TM_TheCloser_Trigger
5662*/
5663TM_TheCloser_Trigger:
5664 call SW_PROGRESS_Close
5665return
5666
5667/*:VRX TM_Throbber_Trigger
5668*/
5669TM_Throbber_Trigger:
5670 pIdx = VRGet("Pict_Throbber","PicturePath")
5671 parse var pIdx '#' pidx
5672 pidx = pidx + 1
5673 if pidx = 23 then pidx = 11
5674 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5675return
5676
5677/*:VRX YesNo
5678*/
5679YesNo: procedure
5680 if arg(1) = 1 then answer = "Yes"
5681 else answer = "No"
5682return answer
5683
5684/*:VRX ZeroOne
5685*/
5686ZeroOne: procedure
5687 if translate(arg(1)) = "YES" then answer = 1
5688 else answer = 0
5689return answer
Note: See TracBrowser for help on using the repository browser.