source: trunk/guitools/smbmon/smbmon.vrx@ 1028

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

SMBMon Add ACLS browser

File size: 105.3 KB
Line 
1/*:VRX Main
2*/
3/* Samba Status Monitor for OS/2
4Copyright (C) 2007-2017 Herwig Bauernfeind for bww bitwise works GmbH.
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19/* Main
20*/
21Main:
22/* Process the arguments.
23 Get the parent window.
24*/
25 parse source . calledAs .
26 parent = ""
27 argCount = arg()
28 argOff = 0
29 if( calledAs \= "COMMAND" )then do
30 if argCount >= 1 then do
31 parent = arg(1)
32 argCount = argCount - 1
33 argOff = 1
34 end
35 end; else do
36 call VROptions 'ImplicitNames'
37 call VROptions 'NoEchoQuit'
38 end
39 InitArgs.0 = argCount
40 if( argCount > 0 )then do i = 1 to argCount
41 InitArgs.i = arg( i + argOff )
42 end
43 drop calledAs argCount argOff
44
45/* Load the windows
46*/
47 call VRInit
48 parse source . . spec
49 _VREPrimaryWindowPath = ,
50 VRParseFileName( spec, "dpn" ) || ".VRW"
51 _VREPrimaryWindow = ,
52 VRLoad( parent, _VREPrimaryWindowPath )
53 drop parent spec
54 if( _VREPrimaryWindow == "" )then do
55 call VRMessage "", "Cannot load window:" VRError(), ,
56 "Error!"
57 _VREReturnValue = 32000
58 signal _VRELeaveMain
59 end
60
61/* Process events
62*/
63 call Init
64 signal on halt
65 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
66 _VREEvent = VREvent()
67 interpret _VREEvent
68 end
69_VREHalt:
70 _VREReturnValue = Fini()
71 call VRDestroy _VREPrimaryWindow
72_VRELeaveMain:
73 call VRFini
74exit _VREReturnValue
75
76VRLoadSecondary:
77 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
78 if __vrlsWait then do
79 call VRFlush
80 end
81 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
82 if __vrlsHWnd = '' then signal __vrlsDone
83 if __vrlsWait \= 1 then signal __vrlsDone
84 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
85 __vrlsTmp = __vrlsWindows.0
86 if( DataType(__vrlsTmp) \= 'NUM' ) then do
87 __vrlsTmp = 1
88 end
89 else do
90 __vrlsTmp = __vrlsTmp + 1
91 end
92 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
93 __vrlsWindows.0 = __vrlsTmp
94 do while( VRIsValidObject( VRWindow() ) = 1 )
95 __vrlsEvent = VREvent()
96 interpret __vrlsEvent
97 end
98 __vrlsTmp = __vrlsWindows.0
99 __vrlsWindows.0 = __vrlsTmp - 1
100 call VRWindow __vrlsWindows.__vrlsTmp
101 __vrlsHWnd = ''
102__vrlsDone:
103return __vrlsHWnd
104
105/*:VRX __VXREXX____APPENDS__
106*/
107__VXREXX____APPENDS__:
108/*
109#append ..\shared\inittempdir.vrs
110#append ..\shared\sambainit.vrs
111#append ..\shared\nlv.vrs
112#append ..\shared\smbtree.vrs
113#append ..\shared\browse.VRS
114#append ..\shared\usercredmem.vrs
115#append ..\shared\rxrpclib.vrs
116*/
117return
118/*:VRX _ChkTDB
119*/
120_ChkTDB:
121
122ok = SysFileTree(etc'\samba\lock\*.TDB',tdb.,'FO')
123say etc'\samba\lock\*.TDB 'tdb.0
124
125error = 0
126ok = VRMethod("CN_CHKTDB", "RemoveRecord", "ALL")
127
128RecHandleArray.0 = 0
129ok = VRSet("CN_CHKTDB", "Painting", 0)
130
131do I = 1 to tdb.0
132 RecHandleArray.I = VRMethod("CN_CHKTDB", "Addrecord")
133end
134ok = VRSet("CN_CHKTDB", "Painting", 1)
135
136/* ok = VRSet("CN_CHKTDB", "Painting", 0) */
137
138do I = 1 to tdb.0
139 RecHandle = RecHandleArray.I
140 TDBFile =left(filespec('N',tdb.I), 22)
141 TDBSize = stream(tdb.I,'c','query size')
142 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBFilesFH, TDBFile, ChkTDBIconFH, "$50", ChkTDBSizeFH, TDBSize||" Bytes" )
143 address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
144 ok = file2stem(tdb.I'.out',"out.")
145 out = out.ok
146 say out
147 if pos('integrity is OK',out) > 0 then do /* integrity is ok */
148 ok = SysFileDelete(tdb.I'.err')
149 ok = SysFileDelete(tdb.I'.out')
150 out = left(out,length(out)-1)
151 TDBRecords = substr(out, pos("and has", out) + 7,)
152 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, TDBRecords )
153
154 address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
155 end
156 else do /* tdb error */
157 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBIconFH, "$51" )
158 error = 1
159 count = 0
160 out = ""
161 do while lines(tdb.I'.err') > 0 & count < 5
162 errline = linein(tdb.I'.err')
163 select
164 /* skip unnecessary lines of log */
165 when pos("bww ",errline) > 0 then iterate
166 when pos("fcntl",errline) > 0 then iterate
167 otherwise do
168 out = out||errline'. '
169 count = count + 1
170 end
171 end
172 end
173 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, out )
174 ok = VRSet("CN_CHKTDB", "Painting", 1)
175 ok = VRSet("CN_CHKTDB", "Painting", 0)
176
177 ok = stream(tdb.I'.err','c','close')
178 end
179
180/*
181 call charout , left(filespec('N',tdb.I), 22)
182 address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
183 out = linein(tdb.I'.out')
184 ok = stream(tdb.I'.out','c','close')
185 say out
186 if pos('integrity is OK',out) = 0 then do
187 call beep 880, 20
188 address cmd '@tdbbackup -s.bak -v 'tdb.I' 2>NUL 1>NUL'
189 error = 1
190 count = 0
191 do while lines(tdb.I'.err') > 0 & count < 5
192 errline = linein(tdb.I'.err')
193 select
194 /* skip unnecessary lines of log */
195 when pos("bww ",errline) > 0 then iterate
196 when pos("fcntl",errline) > 0 then iterate
197 otherwise do
198 say right(copies(' ',22)'Cause: 'errline'!',min(length(errline)+22,79))
199 count = count + 1
200 end
201 end
202 end
203 ok = stream(tdb.I'.err','c','close')
204 end
205 else do
206 ok = SysFileDelete(tdb.I'.err')
207 ok = SysFileDelete(tdb.I'.out')
208 address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
209 end */
210end
211
212ok = VRSet("CN_CHKTDB", "Painting", 1)
213
214return
215
216/*:VRX _ColumnShow
217*/
218_ColumnShow:
219 userdata = VRGet(VRInfo("Object"),"Userdata")
220 parse var userdata Container '|' fieldh '|' VisStatus
221say userdata
222 ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
223return
224
225/*:VRX _ColumnsMenu
226*/
227_ColumnsMenu:
228 Container = arg(1)
229 ok = VRMethod(Container, "GetFieldList", "Fields." )
230
231 do I = 1 to 14
232 R2I = right("0"||I,2)
233 if I <= fields.0 then do
234/* say "Columns_"||R2I' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
235 ok = VRset("Columns_"||R2I, "Visible", 1)
236 ok = VRset("Columns_"||R2I, "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
237 ok = VRset("Columns_"||R2I, "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
238 ok = VRset("Columns_"||R2I, "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
239 end
240 else ok = VRset("Columns_"||R2I, "Visible", 0)
241 end
242 ok = VRMethod( "Columns", "Popup", , , "", "" )
243return
244
245/*:VRX _ContainerInit
246*/
247_ContainerInit:
248 say '_ContainerInit() started.'
249
250 /* Users */
251 UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) )
252 UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
253 GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
254 UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
255 UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
256 UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
257
258 /* Files */
259 FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) )
260 FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
261 FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
262 FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
263 DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
264 TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
265 DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
266 AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
267 RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
268 OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
269 UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
270 SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
271 NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
272
273 /* Service */
274 SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) )
275 SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
276 ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
277 SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
278 ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
279
280 /* Daemons */
281 DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
282 DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
283 DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
284
285 smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,"smbd.exe","$41")
286 nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,"nmbd.exe","$41")
287 winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,"winbindd.exe","$41")
288
289 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, "smbd.exe")
290 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, "nmbd.exe")
291 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, "winbindd.exe")
292 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
293 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
294 ok = VRMethod("CN_Daemons", "SetRecordAttr","All", "Collapsed", 0 )
295
296
297 /* SMBTree */
298 WorkgroupFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(150) )
299 NBFH = VRMethod( "CN_SMBTREE", "AddField", "String", "NetBIOS name" )
300 IpFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(147) )
301 MBFH = VRMethod( "CN_SMBTREE", "AddField", "String", "DMB/LMB" )
302 OSFH = VRMethod( "CN_SMBTREE", "AddField", "String", "OS" )
303 /* VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */
304 CommentFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(151) )
305 MacFH = VRMethod( "CN_SMBTREE", "AddField", "String", "MAC" )
306
307 ok = VRMethod("CN_SMBTREE","SetfieldAttr",IPFH, "ReadOnly", 1)
308 ok = VRMethod("CN_SMBTREE","SetfieldAttr",NBFH, "ReadOnly", 1)
309 ok = VRMethod("CN_SMBTREE","SetfieldAttr",MBFH, "ReadOnly", 1)
310 ok = VRMethod("CN_SMBTREE","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
311 ok = VRMethod("CN_SMBTREE","SetfieldAttr",OSFH, "ReadOnly", 1)
312 ok = VRMethod("CN_SMBTREE","SetfieldAttr",MacFH, "ReadOnly", 1)
313
314 /* ChkTdb */
315 ChkTDBFilesFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(134) )
316 ChkTDBIconFH = VRMethod( "CN_CHKTDB", "AddField", "Icon", NLVGetMessage(146) )
317 ChkTDBSizeFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(152) )
318 ChkTDBStatusFH= VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(151) )
319
320 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBIconFH, "Justification","Center", "ReadOnly", 1)
321 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBSizeFH, "Justification","Right", "ReadOnly", 1)
322 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBStatusFH, "Justification","Right", "ReadOnly", 1)
323
324 say '_ContainerInit() done.'
325return
326/*:VRX _ContainerSort
327*/
328_ContainerSort:
329 ok = VRMethod( "LB_SortFields", "GetSelectedList", "SortFields." )
330 if Fields.0 = 0 then return
331 idx = SortFields.1
332 ok = VRset( Container, "DetailSort", Fields.idx )
333 ok = VRSet( Container, "Sort", SortOrder )
334 ok = VRMethod( Container, "SortRecords" )
335return
336
337/*:VRX _ContextMenuSelectedSet
338*/
339_ContextMenuSelectedSet:
340 ok = VRSet("ContextMenu_Tree_Tree", "Visible", 0)
341 ok = VRSet("ContextMenu_Tree_Details", "Visible", 0)
342 ok = VRSet("ContextMenu_Tree_Icons", "Visible", 0)
343 ok = VRSet("ContextMenu_Tree_Sort", "Visible", 0)
344 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 0)
345 ok = VRSet("ContextMenu_Tree_Login", "Visible", 0)
346 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 0)
347 ok = VRSet("ContextMenu_Tree_SendMsg", "Visible", 0)
348say SMBObj.udatatype
349 select
350 when SMBObj.udatatype = "WORKGROUP" then do
351 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
352 end
353 when SMBObj.udatatype = "SERVER" then do
354 ok = VRSet("ContextMenu_Tree_Login", "Visible", 1)
355 ok = VRSet("ContextMenu_Tree_SendMsg", "Visible", 1)
356 end
357 when SMBObj.udatatype = "DISK" then do
358 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
359 end
360 when SMBObj.udatatype = "PRINTER" then do
361 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
362 end
363 when SMBObj.udatatype = "DIRECTORY" then do
364 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 1)
365 end
366 when SMBObj.udatatype = "FILE" then do
367 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 1)
368 end
369 otherwise do /* No other value known - default */
370 ok = VRSet("ContextMenu_Tree_Tree", "Visible", 1)
371 ok = VRSet("ContextMenu_Tree_Details", "Visible", 1)
372 ok = VRSet("ContextMenu_Tree_Icons", "Visible", 1)
373 ok = VRSet("ContextMenu_Tree_Sort", "Visible", 1)
374 end
375 end
376return
377
378/*:VRX _CreateSmbStarter
379*/
380_CreateSmbStarter:
381ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
382call lineout samba.!bin'\smbstarter.cmd', '/* REXX */'
383call lineout samba.!bin'\smbstarter.cmd', 'signal on failure name CLEANUP'
384call lineout samba.!bin'\smbstarter.cmd', 'signal on halt name CLEANUP'
385call lineout samba.!bin'\smbstarter.cmd', 'signal on syntax name CLEANUP'
386call lineout samba.!bin'\smbstarter.cmd', 'say "Samba Server Starter"'
387call lineout samba.!bin'\smbstarter.cmd', 'address cmd "@echo off"'
388call lineout samba.!bin'\smbstarter.cmd', 'home:'
389call lineout samba.!bin'\smbstarter.cmd', 'select'
390call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstart") then do'
391call lineout samba.!bin'\smbstarter.cmd', 'say "Start"'
392call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd start"'
393call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstart")'
394call lineout samba.!bin'\smbstarter.cmd', 'end'
395call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstop") then do'
396call lineout samba.!bin'\smbstarter.cmd', 'say "Stop"'
397call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd stop"'
398call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstop")'
399call lineout samba.!bin'\smbstarter.cmd', 'end'
400call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("restart") then do'
401call lineout samba.!bin'\smbstarter.cmd', 'say "Restart"'
402call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd restart"'
403call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("restart")'
404call lineout samba.!bin'\smbstarter.cmd', 'end'
405call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("reload") then do'
406call lineout samba.!bin'\smbstarter.cmd', 'say "Reload"'
407call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd reload"'
408call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("reload")'
409call lineout samba.!bin'\smbstarter.cmd', 'end'
410call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("quit") then do'
411call lineout samba.!bin'\smbstarter.cmd', 'say "Quit"'
412call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("quit")'
413call lineout samba.!bin'\smbstarter.cmd', 'signal cleanup'
414call lineout samba.!bin'\smbstarter.cmd', 'end'
415call lineout samba.!bin'\smbstarter.cmd', 'otherwise nop'
416call lineout samba.!bin'\smbstarter.cmd', 'end'
417call lineout samba.!bin'\smbstarter.cmd', 'ok = SysSleep(1)'
418call lineout samba.!bin'\smbstarter.cmd', 'signal home'
419call lineout samba.!bin'\smbstarter.cmd', 'cleanup:'
420call lineout samba.!bin'\smbstarter.cmd', 'say "Aborting..."'
421call lineout samba.!bin'\smbstarter.cmd', 'exit'
422ok = stream(samba.!bin'\smbstarter.cmd','c','close')
423
424Setup = 'NOPRINT=YES;DEFAULTVIEW=RUNNING;'||,
425 'EXENAME='samba.!bin'\smbstarter.cmd;'||,
426 'STARTUPDIR='samba.!bin';'||,
427 'TITLE=;'||,
428 'PROGTYPE=WINDOWABLEVIO;'||,
429 'MINIMIZED=YES;'||,
430 'VISIBLE=NO;'||,
431 'NOAUTOCLOSE=NO;'||,
432 'OBJECTID=<smbstarter>'
433
434rc = SysCreateObject('WPProgram', 'SMBSTARTER', '<WP_NOWHERE>', Setup, 'UPDATE' )
435If rc <> 1 Then Say ' > failed to create SMBSTARTER Object'
436else ok = SysOpenObject('<smbstarter>', 'DEFAULT', 1)
437
438
439return
440
441/*:VRX _GuessIcon
442*/
443_GuessIcon: procedure
444 text = arg(1)
445 select /* Printer guessing */
446 when pos('LJ',text) > 0 then res = '#65:PMWP.DLL'
447 when pos('LASER',text) > 0 then res = '#65:PMWP.DLL'
448 when pos('EPSON',text) > 0 then res = '#65:PMWP.DLL'
449 when pos('PRINT',text) > 0 then res = '#65:PMWP.DLL'
450 when pos('PRT',text) > 0 then res = '#65:PMWP.DLL'
451 when pos('CANON',text) > 0 then res = '#65:PMWP.DLL'
452 when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL'
453 when pos('FAX',text) > 0 then res = '#65:PMWP.DLL'
454 when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL'
455 when pos('IPC$',text) > 0 then res = '#59:PMWP.DLL'
456 otherwise res = "#34:PMWP.DLL"
457 end
458return res
459
460/*:VRX _GUIInit
461*/
462_GUIInit:
463 IF options.!debug == 1 then say time()' _GUIInit() started'
464
465 if datatype(Top) = 'NUM' then do
466 ok = VRset("Main","Top",Top)
467 ok = VRset("Main","Left",Left)
468 ok = VRset("Main","Width",Width)
469 ok = VRset("Main","Height",Height)
470 end
471
472 ok = VRSet("Main", "Font", Font.!Main)
473 ok = VRSet("DT_StatusBar","Font", Font.!Status)
474 ok = VRSet("SW_Users", "Font", Font.!Users)
475 ok = VRSet("SW_Files", "Font", Font.!Files)
476 ok = VRSet("SW_Service", "Font", Font.!Service)
477 ok = VRSet("SW_Daemons", "Font", Font.!Daemons)
478 ok = VRSet("SW_SMBTree", "Font", Font.!SMBTree)
479 ok = VRSet("SW_Settings", "Font", Font.!Settings)
480
481 ok = VRSet("CN_Users", "Font", Font.!Users)
482 ok = VRSet("CN_Files", "Font", Font.!Files)
483 ok = VRSet("CN_Service", "Font", Font.!Service)
484 ok = VRSet("CN_Daemons", "Font", Font.!Daemons)
485 ok = VRSet("CN_SMBTREE", "Font", Font.!SMBTree)
486
487 CALL NLVSetText 'DT_Refresh', 'Caption', 25
488 CALL NLVSetText 'DT_RefreshMin', 'Caption', 25
489 CALL NLVSetText 'DT_Intervall', 'Caption', 26
490 ok = VRSet("DT_IntervallMin", "Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
491 CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27
492 CALL NLVSetText 'CB_WPSSTARTSTOP', 'Caption', 29
493 CALL NLVSetText 'CB_DetectZombies','Caption', 30
494
495 CALL NLVSetText 'ContextMenu_Daemons_Sort', 'Caption', 35
496 CALL NLVSetText 'ContextMenu_Daemons_Ping', 'Caption', 32
497 CALL NLVSetText 'ContextMenu_Daemons_Details','Caption', 118
498 CALL NLVSetText 'ContextMenu_Daemons_Tree', 'Caption', 120
499
500 CALL NLVSetText 'ContextMenu_Files_Sort', 'Caption', 35
501
502 CALL NLVSetText 'ContextMenu_Service_Sort', 'Caption', 35
503 CALL NLVSetText 'ContextMenu_Service_CloseSHare', 'Caption', 70
504
505 CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80
506 CALL NLVSetText 'ContextMenu_Users_Sort', 'Caption', 35
507
508 CALL NLVSetText 'ContextMenu_Tree_SendMsg', 'Caption', 80
509 CALL NLVSetText 'ContextMenu_Tree_Sort', 'Caption', 35
510 CALL NLVSetText 'ContextMenu_Tree_Tree', 'Caption', 120
511 CALL NLVSetText 'ContextMenu_Tree_Details', 'Caption', 118
512
513 Buttonwidth = VRMethod( "Screen", "PixelsToTwips", 32 )
514
515 ok = VRSet("SPIN_Intervall", "Value", Intervall)
516 ok = VRSet("SPIN_IntervallMin","Value", IntervallMin)
517 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
518
519 ok = VRSet("PB_START", "Enabled", VRFileExists(samba.!smbcmd))
520 ok = VRSet("PB_Restart","Enabled", VRFileExists(samba.!smbcmd))
521 ok = VRSet("PB_Reload", "Enabled", VRFileExists(samba.!smbcmd))
522
523 ok = VRSet("CN_Daemons", "View", DaemonView)
524 ok = VRSet("CN_SMBTREE", "View", TreeView)
525 ok = VRSet("CB_NoMsgBox", "Set", NoMsgBox)
526 ok = VRSet("CB_WPSStartStop", "Set", WPSStartStop)
527 ok = VRSet("CB_DetectZombies","Set", DetectZombies)
528
529 call _INILayoutRead "CN_Users"
530 call _INILayoutRead "CN_Files"
531 call _INILayoutRead "CN_Service"
532 call _INILayoutRead "CN_Daemons"
533 call _INILayoutRead "CN_SMBTREE"
534
535 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
536 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
537 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
538 ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons)
539 ok = VRSet("CB_Debug","set",options.!Debug)
540
541 if _ChkTempFreeSpace() < 262144 then do
542 Msg.Type = "W"
543 Msg.Text = NLVGetMessage(116, TempDir)
544 call _ShowMsg
545 end
546
547 /* Common margin around controls */
548 margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
549
550 /* Statusbar */
551 ok = VRSet("DT_STATUSBAR","Caption", " "||VRGet("Main", "HintText"))
552
553 call Main_Resize
554
555
556 ok = VRSet("Main", "Visible", 1)
557 IF options.!debug == 1 then say time()' _GUIInit() done'
558return
559
560/*:VRX _INILayoutRead
561*/
562_INILayoutRead:
563 Container = arg(1)
564 ok = VRMethod(Container, "GetFieldList", "Fields." )
565 Layout = VRGetIni( "Layout", Container, OurINI )
566 if Layout = "" then return
567 do I = 1 to Fields.0
568 ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1))
569 end
570return
571
572/*:VRX _INILayoutWrite
573*/
574_INILayoutWrite:
575 Container = arg(1)
576 ok = VRMethod(Container, "GetFieldList", "Fields." )
577 Layout = ""
578 do I = 1 to fields.0
579 Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )
580 end
581 ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' )
582return
583
584/*:VRX _INIRead
585*/
586_INIRead:
587 IF options.!debug == 1 then say time()' _INIRead() started'
588
589 OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBSTATUS.INI',,'\')
590 ok = SysFileTree(OurINI, INIFound.,'FO')
591 if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
592 IF options.!debug == 1 then say ' OurINI='OurINI
593
594 Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose')
595 Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose')
596 Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose')
597 Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
598
599 Font.!Users = VRGetIni( "Fonts", "SW_USERS", OurINI , 'NoClose' )
600 Font.!Files = VRGetIni( "Fonts", "SW_FILES", OurINI , 'NoClose' )
601 Font.!Service = VRGetIni( "Fonts", "SW_SERVICE", OurINI , 'NoClose' )
602 Font.!Daemons = VRGetIni( "Fonts", "SW_DAEMONS", OurINI , 'NoClose' )
603 Font.!SMBTree = VRGetIni( "Fonts", "SW_SMBTREE", OurINI , 'NoClose' )
604 Font.!Settings= VRGetIni( "Fonts", "SW_SETTINGS", OurINI , 'NoClose' )
605 Font.!Main = VRGetIni( "Fonts", "Main", OurINI , 'NoClose' )
606 Font.!Status = VRGetIni( "Fonts", "Statusfont", OurINI , 'NoClose' )
607
608 if Font.!Users = "" then Font.!Users = "9.WarpSans"
609 if Font.!Files = "" then Font.!Files = "9.WarpSans"
610 if Font.!Service = "" then Font.!Service = "9.WarpSans"
611 if Font.!Daemons = "" then Font.!Daemons = "9.WarpSans"
612 if Font.!SMBTree = "" then Font.!SMBTree = "9.WarpSans"
613 if Font.!Settings = "" then Font.!Settings = "9.WarpSans"
614 if Font.!Main = "" then Font.!Main = "9.WarpSans"
615 if Font.!Status = "" then Font.!Status = "9.WarpSans"
616
617 Intervall = VRGetIni( "Settings", "Intervall", OurINI,'NoClose')
618 if Intervall = "" then Intervall = 60
619
620 IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI,'NoClose')
621 if IntervallMin = "" then IntervallMin = 180
622
623 CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI,'NoClose')
624 if CurrentPageNr = "" then CurrentPageNr = 4
625
626 DaemonView = VRGetIni( "Settings", "DaemonView", OurINI,'NoClose')
627 if DaemonView = "" then DaemonView = "Detail"
628
629 TreeView = VRGetIni( "Settings", "TreeView", OurINI,'NoClose')
630 if TreeView = "" then TreeView = "IconTree"
631
632 NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI,'NoClose')
633 if NoMsgBox = "" then NoMsgBox = 1
634
635 WPSStartStop = VRGetIni( "Settings", "WPSStartStop", OurINI,'NoClose')
636 if WPSStartStop = "" then WPSStartStop = 1
637
638 DetectZombies = VRGetIni( "Settings", "DetectZombies", OurINI,'NoClose')
639 if DetectZombies = "" then DetectZombies = 0
640
641 options.!debug = VRGetIni( "Options", "Debug", OurINI)
642 if options.!debug = "" then options.!debug = 0
643
644 if options.!Debug then ok = VRRedirectStdIO("ON")
645 else ok = VRRedirectStdIO("OFF")
646 options.!storecreds = VRGetIni('Settings', 'StoreCreds', OurINI, 'NoClose')
647say "options.!storecreds = "options.!storecreds
648 IF options.!storecreds == '' then options.!storecreds = 1
649say "options.!storecreds = "options.!storecreds
650 IF _ucChkObj() = 0 then options.!storecreds = 0
651say "options.!storecreds = "options.!storecreds
652
653
654 advanced.!bigicons = VRGetIni( "Settings", "BigIcons", OurINI)
655 if advanced.!bigicons = "" then advanced.!bigicons = 0
656
657 advanced.!smbconfchanged = 0
658
659 /* For Browse page */
660 FirstRun = 1
661 /* For Users page in case connections.tdb is not initialised */
662 IgnoreSmbNoInit = 1
663
664 /* For Refresh tree display code */
665 RefreshMode =""
666
667 call _BrowseIconsInit
668
669 smbdpidhandle.0 = 0
670 nmbdpidhandle.0 = 0
671 winbpidhandle.0 = 0
672
673 prevsmbdct = 0
674 prevnmbdct = 0
675 prevwinbct = 0
676
677 smbdoutput = TempDir'smbd.out'
678 IF options.!debug == 1 then say time()' _INIRead() done'
679return
680
681/*:VRX _INIWrite
682*/
683_INIWrite:
684 IF options.!debug == 1 then say time()' _INIWrite() started'
685 ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' )
686 ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' )
687 ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' )
688 ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' )
689
690 ok = VRSetIni( "Settings", "Intervall", VRGet("SPIN_Intervall","Value"),OurINI,'NoClose')
691 ok = VRSetIni( "Settings", "IntervallMin", VRGet("SPIN_IntervallMin","Value"),OurINI,'NoClose')
692 ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr, OurINI,'NoClose')
693 ok = VRSetIni( "Settings", "DaemonView", VRGet("CN_Daemons","View"), OurINI,'NoClose')
694 ok = VRSetIni( "Settings", "TreeView", VRGet("CN_SMBTREE","View"), OurINI,'NoClose')
695 ok = VRSetIni( "Settings", "NoMsgBox", NoMsgBox, OurINI,'NoClose')
696 ok = VRSetIni( "Settings", "WPSStartStop", WPSStartStop, OurINI,'NoClose')
697 ok = VRSetIni( "Settings", "BigIcons", \VRGet("CN_SMBTREE", "MiniIcons"),OurINI,'NoClose')
698 ok = VRSetIni( "Settings", "DetectZombies",DetectZombies, OurINI,'NoClose')
699 call VRSetIni 'Settings', 'StoreCreds', options.!storecreds , OurINI, 'NoClose'
700
701 ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' )
702
703 call _INILayoutWrite "CN_Users"
704 call _INILayoutWrite "CN_Files"
705 call _INILayoutWrite "CN_Service"
706 call _INILayoutWrite "CN_Daemons"
707 call _INILayoutWrite "CN_SMBTREE"
708
709 if VRGet("CN_USERS", "Font") <> "<default>" then ok = VRSet("SW_USERS", "Font", VRGet("CN_USERS", "Font"))
710 if VRGet("CN_FILES", "Font") <> "<default>" then ok = VRSet("SW_FILES", "Font", VRGet("CN_FILES", "Font"))
711 if VRGet("CN_SERVICE", "Font") <> "<default>" then ok = VRSet("SW_SERVICE","Font", VRGet("CN_SERVICE","Font"))
712 if VRGet("CN_DAEMONS", "Font") <> "<default>" then ok = VRSet("SW_DAEMONS","Font", VRGet("CN_DAEMONS","Font"))
713 if VRGet("CN_SMBTREE", "Font") <> "<default>" then ok = VRSet("SW_SMBTREE","Font", VRGet("CN_SMBTREE","Font"))
714
715 ok = VRSetIni( "Fonts", "SW_USERS", VRGet("SW_USERS", "Font"), OurINI, 'NoClose' )
716 ok = VRSetIni( "Fonts", "SW_FILES", VRGet("SW_FILES", "Font"), OurINI, 'NoClose' )
717 ok = VRSetIni( "Fonts", "SW_SERVICE", VRGet("SW_SERVICE", "Font"), OurINI, 'NoClose' )
718 ok = VRSetIni( "Fonts", "SW_DAEMONS", VRGet("SW_DAEMONS", "Font"), OurINI, 'NoClose' )
719 ok = VRSetIni( "Fonts", "SW_SMBTREE", VRGet("SW_SMBTREE", "Font"), OurINI, 'NoClose' )
720 ok = VRSetIni( "Fonts", "SW_SETTINGS",VRGet("SW_SETTINGS","Font"), OurINI, 'NoClose' )
721 ok = VRSetIni( "Fonts", "Statusfont", VRGet("DT_StatusBar","Font"),OurINI, 'NoClose' )
722 ok = VRSetIni( "Fonts", "Main", VRGet("Main","Font"), OurINI )
723 IF options.!debug == 1 then say time()' _INIWrite() done'
724return
725
726/*:VRX _LoadotherFuncs
727*/
728_LoadotherFuncs:
729 IF options.!debug == 1 then say time()' _LoadotherFuncs() started'
730 SIGNAL ON SYNTAX NAME DLLMissing
731
732 call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
733 call SysLoadFuncs
734
735 call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
736 call PRLoadFuncs
737
738 call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
739 call IniLoadFuncs
740
741 call RxFuncAdd 'RxDate', 'RexxDate', 'RxDate'
742
743 SIGNAL OFF SYNTAX
744 IF options.!debug == 1 then say time()' _LoadotherFuncs() done'
745return
746
747DLLMissing:
748 Fatal = 1
749 call VRMessage 'Main', 'REXX function library 'strip(translate(word(sourceline(SIGL-1),4),' ',"',"))'.DLL is missing!', "EVFSGUI fatal error", "E"
750signal Quit
751/*:VRX _MsgYesNo
752*/
753_MsgYesNo:
754 say "_MsgYesNo() started"
755 buttons.0 = 2
756 buttons.1 = NLVGetMessage(6)
757 buttons.2 = NLVGetMessage(7)
758 default = 2
759 buttons.default = NLVGetMessage(7)
760 esc = 2
761 buttons.esc = NLVGetMessage(7)
762 RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
763 say "_MsgYesNo() done, answer "RC
764return RC
765
766/*:VRX _NLVSetup
767*/
768_NLVSetup:
769 settings.!messages = 1 /* language files exist(s) */
770 settings.!helpfile = 0 /* helpfiles do not exist */
771 settings.!nlv8dot3 = 0 /* NLV may have long filenames */
772 call NLVSetup
773
774 Msg.Title = NLVGetMessage(1)
775 ok = VRSet("Main","helpFile", settings.!helpfile)
776
777
778
779 CALL NLVSetText 'PB_Refresh', 'Caption', 11
780 CALL NLVSetText 'PB_Apply', 'Caption', 10
781 CALL NLVSetText 'PB_Cancel', 'Caption', 12
782 CALL NLVSetText 'PB_Help', 'Caption', 13
783 CALL NLVSetText 'PB_About', 'Caption', 14
784
785 CALL NLVSetText 'PB_Refresh', 'Hinttext', 51
786 CALL NLVSetText 'PB_Cancel', 'Hinttext', 54
787 CALL NLVSetText 'PB_Help', 'Hinttext', 52
788 CALL NLVSetText 'PB_About', 'Hinttext', 53
789
790/* CALL NLVSetText 'TAB_1', 'Userdata', 15
791 CALL NLVSetText 'TAB_2', 'Userdata', 16
792 CALL NLVSetText 'TAB_3', 'Userdata', 17
793 CALL NLVSetText 'TAB_4', 'Userdata', 18
794 CALL NLVSetText 'TAB_5', 'Userdata', 19
795 CALL NLVSetText 'TAB_6', 'Userdata', 24
796
797 CALL NLVSetText 'TAB_1', 'Hinttext', 55
798 CALL NLVSetText 'TAB_2', 'Hinttext', 56
799 CALL NLVSetText 'TAB_3', 'Hinttext', 57
800 CALL NLVSetText 'TAB_4', 'Hinttext', 58
801 CALL NLVSetText 'TAB_5', 'Hinttext', 59
802 CALL NLVSetText 'TAB_6', 'Hinttext', 60 */
803
804/* CALL NLVSetText 'Page_1', 'Hinttext', 55
805 CALL NLVSetText 'Page_2', 'Hinttext', 56
806 CALL NLVSetText 'Page_3', 'Hinttext', 57
807 CALL NLVSetText 'Page_4', 'Hinttext', 58
808 CALL NLVSetText 'Page_5', 'Hinttext', 59
809 CALL NLVSetText 'Page_6', 'Hinttext', 60 */
810
811
812return
813
814/*:VRX _Refresh
815*/
816_Refresh:
817 IF options.!debug == 1 then say time()' _Refresh() started'
818 ok = VRSet("TM_refresh","Enabled", 0)
819 SmbNoInit = 0
820
821 refreshoutput = TempDir'refresh.out'
822 refresherr = TempDir'refresh.err'
823
824 say ' 'samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
825 address cmd samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
826
827 do while lines(refreshoutput) > 0
828 Hdr = linein(refreshoutput)
829 if pos("Version ",Hdr) > 0 then leave
830 end
831
832 SambaVer = "Samba "||strip(Hdr)
833 say ' smbd.exe: "'SambaVer'"'
834 ok = stream(refreshoutput,'c','close')
835
836 say ' 'samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
837 address cmd samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
838
839 do while lines(refreshoutput) > 0
840 Hdr = linein(refreshoutput)
841 if pos("Samba version",Hdr) > 0 then leave
842 end
843
844 SambaStVer = strip(Hdr) /* we can detect version mismatches here */
845 say ' smbstatus: "'SambaStVer'"'
846
847 select
848 when pos('not initialised',SambaStVer) > 0 then do
849 SambaVer = SambaVer||" (Init)"
850 SmbNoInit = 1
851 end
852 when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)"
853 otherwise nop
854 end
855
856 Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146))
857
858 /* Active User */
859 Hdr1 = linein(refreshoutput)
860/* say ' 1:'hdr1 */
861 Hdr2 = linein(refreshoutput)
862/* say ' 2:'hdr2 */
863 Zeile = linein(refreshoutput)
864 say ' 'Zeile
865 if SmbNoInit then do
866 call lineout samba.!msg, SambaStVer
867 call lineout samba.!msg, Hdr1
868 call lineout samba.!msg, Hdr2
869 call lineout samba.!msg, Zeile
870 ok = stream(samba.!msg,'c','close')
871 if IgnoreSmbNoInit then do
872 call _SambaShowMsg
873 IgnoreSmbNoInit = 0
874 end
875 end
876
877 say ' SmbNoInit = 'SmbNoInit
878
879 /* Active users */
880 ok = VRSet("CN_Users","Painting", 0)
881 ok = VRMethod("CN_Users", "RemoveRecord", "ALL")
882 Username.0 = 0
883 IP.0 = 0
884 Group.0 = 0
885 I = 0
886 if \SmbNoInit then do
887 do while Zeile <> ''
888 parse var Zeile UPID Username Group Machine IP
889 I = I + 1
890 UPID.I = UPID
891 Username.I = Username
892 Group.I = Group
893 IP = strip(IP)
894 parse var IP '('IP.I')'
895 RecHandle = VRMethod("CN_Users", "Addrecord")
896 ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I)
897 Zeile = linein(refreshoutput)
898 end
899 end
900 Username.0 = I
901 Group.0 = I
902 UPID.0 = I
903 ok = VRSet("CN_Users","Painting", 1)
904
905 /* Active Services */
906 Hdr = linein(refreshoutput)
907 Hdr = linein(refreshoutput)
908 I = 0
909 Zeile = linein(refreshoutput)
910 ok = VRSet("CN_Service","Painting", 0)
911 ok = VRMethod("CN_Service", "RemoveRecord", "ALL")
912 do while Zeile <> ''
913 parse var Zeile Service SPId Machine Connected
914 I = I + 1
915 SPid.I = SPid
916 Machine.I = Machine
917 Service.I = Service
918 Icon = _GuessIcon(Service.I)
919
920 Connected = strip(Connected)
921 T. = ""
922 parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year
923 Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year
924
925 RecHandle = VRMethod("CN_Service", "Addrecord")
926 ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected)
927 Zeile = linein(refreshoutput)
928 end
929 SPid.0 = I
930 Machine.0 = I
931 Service.0 = I
932
933 ok = VRSet("CN_Service","Painting", 1)
934
935 /* Open files */
936 Hdr = linein(refreshoutput)
937 Hdr = linein(refreshoutput)
938 Hdr = linein(refreshoutput)
939
940 Zeile = linein(refreshoutput)
941 ok = VRSet("CN_Files","Painting", 0)
942 ok = VRMethod("CN_Files", "RemoveRecord", "ALL")
943 File.0 = 0
944 FPID.0 = 0
945 do while Zeile <> ''
946 parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest
947 TimeDate = right(rest,25)
948
949say 'Refreshcrash "'Rest'"'
950say 'Refreshcrash "'max(length(Rest)-25)'"'
951
952 Name = strip(left(Rest,max(length(Rest)-25,1)))
953 I = I + 1
954 sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\')
955 Username = UID
956 do J = 1 to UPID.0
957 if FPID = UPID.J then do
958 Username = Username.J
959 leave
960 end
961 end
962 File = SharePath||'\'||translate(Name,'\','/')
963 File.I = File
964 FPID.I = FPID
965 TimeDate = strip(TimeDate)
966 say Timedate
967 T. = ""
968 parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year
969 FileTime = T.TimeoD
970 FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year
971 RecHandle = VRMethod("CN_Files", "Addrecord")
972 ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode, AccessFH, Access, RWFH, RW)
973 ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name)
974 Zeile = linein(refreshoutput)
975 end
976 File.0 = I
977 FPID.0 = I
978
979 ok = stream(refreshoutput, 'c','close')
980 ok = SysFileDelete(refreshoutput)
981 ok = stream(refresherr, 'c','close')
982 ok = SysFileDelete(refreshouterr)
983 if VRFileExists( samba.!bin"\smbsched.cmd" ) then do
984 address cmd samba.!bin"\smbsched.cmd"
985 end
986
987 call _RefreshDaemons
988 ok = VRSet("CN_Files","Painting", 1)
989 if VRGet("Main", "WindowState") = "Minimized" then do
990 ok = VRSet("TM_Refresh","Delay", IntervallMin * 1000)
991 end
992 else do
993 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
994 end
995 ok = VRSet("TM_refresh","Enabled", 1)
996
997 IF options.!debug == 1 then say time()' _Refresh() done'
998return
999/*:VRX _RefreshDaemons
1000*/
1001_RefreshDaemons:
1002 IF options.!debug == 1 then say time()' _RefreshDaemons() started'
1003 ok = VRSet("TM_RefreshDaemons","Delay",3000)
1004
1005 ok = VRSet("CN_Daemons","Painting", 0 )
1006 call VRSet VRWindow(), 'Pointer', 'Wait'
1007
1008 do I = 1 to smbdpidhandle.0
1009 ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I )
1010 end
1011
1012 do I = 1 to nmbdpidhandle.0
1013 ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I )
1014 end
1015
1016 do I = 1 to winbpidhandle.0
1017 ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I )
1018 end
1019
1020 Running = _SambaRunning()
1021
1022 call VRSet VRWindow(), 'Pointer', '<default>'
1023
1024 smbdpids = pids.!smbd
1025 nmbdpids = pids.!nmbd
1026 winbpids = pids.!nmbd
1027
1028 smbdRunning = running.!smbd
1029 nmbdRunning = running.!nmbd
1030 winbRunning = running.!winb
1031
1032 if smbdRunning then do
1033 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids)
1034 ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46")
1035 smbdpidhandle.0 = words(smbdpids)
1036 if options.!debug = 1 then do
1037 if smbdpidhandle.0 > prevsmbdct then do
1038 prevsmbdct = smbdpidhandle.0
1039 call beep 880*1, 10
1040 call beep 880*2, 10
1041 call beep 880*4, 10
1042 end
1043 if smbdpidhandle.0 < prevsmbdct then do
1044 prevsmbdct = smbdpidhandle.0
1045 call beep 880*4, 10
1046 call beep 880*2, 10
1047 call beep 880*1, 10
1048 end
1049 end
1050
1051 do I = 1 to words(smbdpids)
1052 Username = ""
1053 do J = 1 to UPID.0
1054 if UPID.J = word(smbdpids,I) then do
1055 Username = ' 'Username.J
1056 leave
1057 end
1058 end
1059 smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
1060 /* we ping all smbd.exe except the first one */
1061 if DetectZombies = 1 & I > 1 then do
1062 ok = VRSet("Main", 'Pointer', 'Wait' )
1063 address cmd samba.!smbcontrolexe' 'word(smbdpids,I)' ping --timeout=2 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1064 ok = VRSet("Main", 'Pointer', '<default>' )
1065 response = linein(samba.!msg)
1066 ok = stream(samba.!msg,'c','close')
1067 if pos('PONG', response) = 0 then do /* we have a zombie */
1068 ok = VRMethod( "CN_Daemons", "SetRecordAttr", smbdpidhandle.I,"Icon", "$49")
1069 say " Found Zombie "word(smbdpids,I)
1070 end
1071 end
1072 if Username <> "" then do
1073 smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
1074 do J = 1 to FPID.0
1075 if FPID.J = word(smbdpids,I) then do
1076 dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45")
1077 end
1078 end
1079 end
1080 end
1081 end
1082 else do
1083 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1084 ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47")
1085 if options.!debug = 1 then do
1086 if prevsmbdct > 0 then do
1087 prevsmbdct = 0
1088 call beep 880*4, 10
1089 call beep 880*2, 10
1090 call beep 880*1, 10
1091 end
1092 end
1093 end
1094
1095 if nmbdRunning then do
1096 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids)
1097 ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46")
1098 nmbdpidhandle.0 = words(nmbdpids)
1099 do I = 1 to words(nmbdpids)
1100 nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , 'PID 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48")
1101 end
1102 end
1103 else do
1104 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1105 ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47")
1106 end
1107
1108 if winbRunning then do
1109 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids)
1110 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46")
1111 winbpidhandle.0 = words(winbpids)
1112 do I = 1 to words(winbpids)
1113 winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , 'PID 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48")
1114 end
1115 end
1116 else do
1117 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1118 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47")
1119 end
1120
1121 if \(smbdrunning|nmbdrunning|winbrunning) then do
1122 ok = VRSet("PB_START", "Enabled", 1)
1123 ok = VRSet("PB_STOP", "Enabled", 0)
1124 ok = VRSet("PB_ReStart","Enabled", 0)
1125 ok = VRSet("PB_ReLoad", "Enabled", 0)
1126 end
1127 else do
1128 ok = VRSet("PB_START", "Enabled", 0)
1129 ok = VRSet("PB_STOP", "Enabled", 1)
1130 ok = VRSet("PB_ReStart","Enabled", 1)
1131 ok = VRSet("PB_ReLoad", "Enabled", 1)
1132 end
1133
1134 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
1135 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
1136 ok = VRSet("CN_Daemons","Painting", 1 )
1137 if Running then call _SambaUptime
1138
1139 IF options.!debug == 1 then say time()' _RefreshDaemons() done'
1140return
1141
1142/*
1143_pids: procedure
1144 pongfile = arg(1)
1145 pids = ''
1146 do until lines(pongfile) = 0
1147 pongline = linein(pongfile)
1148 if word(Pongline,1) = 'PONG' then do
1149 parse var pongline pong from tpid pid
1150 pids = pids||pid', '
1151 end
1152 else pids = pids||pongline
1153 end
1154 pids = strip(strip(pids),,',')
1155 ok = stream(pongfile,'c','close')
1156 ok = SysFileDelete(pongfile)
1157return pids
1158 */
1159
1160/* pingout = 'ping.out'
1161 '@smbcontrol -t 2 smbd ping -d 0 1>'pingout
1162 if rc = 0 then smbdRunning = 1
1163 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DPidsFH, _pids(pingout))
1164
1165 '@smbcontrol -t 2 nmbd ping -d 0 1>'pingout
1166 if rc = 0 then nmbdRunning = 1
1167 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DPidsFH, _pids(pingout))
1168
1169 '@smbcontrol -t 1 winbindd ping -d 0 1>'pingout
1170 if rc = 0 then winbRunning = 1
1171 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DPidsFH, _pids(pingout))
1172
1173 ok = SysFileDelete(PingOut)
1174*/
1175/*:VRX _RefreshDaemonsDelay
1176*/
1177_RefreshDaemonsDelay:
1178 IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() started'
1179 IF options.!debug == 1 then say " Old intervall = "VRGet("TM_RefreshDaemons","Delay")
1180 ok = VRSet("TM_RefreshDaemons","Delay", 60000)
1181 IF options.!debug == 1 then say " New Intervall = "VRGet("TM_RefreshDaemons","Delay")
1182 IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() done'
1183return
1184
1185/*:VRX _SambaFindPIDfile
1186*/
1187_SambaFindPIDfile:
1188 IF options.!debug == 1 then say time()' _SambaFindPIDfile() started'
1189
1190 ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO')
1191 if nmbdpid.0 = 1
1192 then nmbdpidfile = nmbdpid.1;
1193 else nmbdpidfile = ""
1194
1195 IF options.!debug == 1 then say " nmbdpidfile = "nmbdpidfile
1196
1197 IF options.!debug == 1 then say time()' _SambaFindPIDfile() done'
1198return
1199
1200/*:VRX _SambaShowError
1201*/
1202_SambaShowError: procedure expose samba. settings. options.
1203 I = 0
1204 do while lines(samba.!error) <> 0
1205 I = I + 1
1206 smberr.I = linein(samba.!error)
1207 end
1208 ok = stream(Samba.!error,"c","close")
1209 smberr.0 = I
1210 Buttons.1 = "OK" /* NLVGetMessage(2) */
1211 Buttons.0 = 1
1212 id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
1213 ok = SysFileDelete(Samba.!error)
1214return
1215
1216/*:VRX _SambaShowMsg
1217*/
1218_SambaShowMsg: procedure expose samba. settings. options.
1219 say "SambaShowMsg started"
1220 skipWords = arg(1)
1221 skip.0 = words(skipWords)
1222 do J = 1 to skip.0
1223 skip.J = translate(word(skipWords,J))
1224 end
1225 I = 0
1226 do while lines(samba.!msg) <> 0
1227 msgline = linein(samba.!msg)
1228 SkipIt = 0
1229 do J = 1 to skip.0
1230 if pos(skip.J,translate(msgline)) > 0 then do
1231 skipit = 1
1232 leave
1233 end
1234 end
1235 if \SkipIt then do
1236 I = I + 1
1237 smbmsg.I = strip(MsgLine)
1238 end
1239 end
1240 ok = stream(Samba.!msg,"c","close")
1241 say " stream close "Samba.!msg" = "ok
1242 smbmsg.0 = I
1243 if smbmsg.0 > 0 then do
1244 Buttons.1 = "OK" /* NLVGetMessage(2) */
1245 Buttons.0 = 1
1246 id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
1247 end
1248 ok = SysFileDelete(Samba.!msg)
1249 say " Delete "Samba.!msg" = "ok
1250 say "SambaShowMsg done"
1251return
1252/*:VRX _SambaUptime
1253*/
1254_SambaUptime:
1255 IF options.!debug == 1 then say time()' _SambaUptime() started'
1256 call _SambaFindPIDfile
1257 if nmbdpidfile = "" then do
1258 ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41))
1259 return
1260 end
1261
1262 StartTime = SysGetFileDateTime(nmbdpidfile)
1263 if StartTime = -1 then return
1264
1265 NowTime = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time()
1266
1267 /* StartTime = "2007-12-31 00:00:00"
1268 NowTime = "2008-03-05 08:59:50" */
1269
1270 IF options.!debug == 1 then do
1271 say " Start Time ='"StartTime"'"
1272 say " Now Time ='"NowTime"'"
1273 end
1274
1275 doM.0 = 12
1276 doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30;
1277 doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31
1278
1279 parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS
1280 parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS
1281
1282 if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29
1283
1284 /* say doM.2 */
1285
1286 uY =nY-sY
1287 uM =nM-sM
1288 uD =nD-sD
1289 uH =nH-sH
1290 uMi=nMi-sMi
1291 uS =nS-sS
1292
1293
1294
1295 if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end
1296 if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end
1297 if uH < 0 then do; uD = uD - 1; uH = uH + 24; end
1298 if uD < 0 then do;
1299 /* uM = uM - 1; */
1300 if uM < 0 then uMx = uM + 12; else uMx = uM
1301 uD = uD + doM.uMx - 1;
1302 end
1303 if uM < 0 then do; uY = uY - 1; uM = uM + 12; end
1304
1305 /* say uY uM uD uH uMi uS */
1306
1307 UpTimeStr = ' 'NlvGetMessage(43)':'
1308 if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44)
1309 if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45)
1310 if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46)
1311 if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47)
1312 if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48)
1313 if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49)
1314
1315 loggingfreespace = word(sysdriveinfo(left(samba.!log,2)),2)%1024%1024
1316
1317 ok = VRset("CN_Daemons", "Caption", UpTimeStr' 'loggingfreespace' MB')
1318
1319 select
1320 when loggingfreespace < 50 then ok = VRDeleteFile(samba.!log'\log.*')
1321 when loggingfreespace < 100 then ok = VRset("CN_Daemons","BackColor","Red")
1322 when loggingfreespace < 200 then ok = VRset("CN_Daemons","BackColor","Yellow")
1323 otherwise ok = VRset("CN_Daemons","BackColor","SystemWindow")
1324 end
1325
1326 IF options.!debug == 1 then say time()' _SambaUptime() done'
1327return
1328
1329/*:VRX _SendMsg
1330*/
1331_SendMsg:
1332 Buttons.1 = NLVGetMessage( 2 )
1333 Buttons.2 = NLVGetMessage( 3 )
1334 Buttons.0 = 2
1335 Message = "Blurp!"
1336 id = VRPrompt( VRWindow(), NLVGetMessage( 85 , CurMachine), "Message", NLVGetMessage( 80 ), "Buttons.", buttons.1, buttons.2 )
1337
1338 MsgFile = SysTempFileName(TempDir'\smbmsg.'??? )
1339 call lineout MsgFile, Message
1340 ok = stream(MsgFile,'c','close')
1341say Message
1342 address cmd samba.!smbclientexe' --message='CurMachine' 'DebugLevel' <'MsgFile' 2>&1>'samba.!msg
1343 /* if rc <> 0 then call _SambaShowError; else */
1344 call _SambaShowMsg
1345 ok = SysFileDelete(MsgFile)
1346return
1347
1348/*:VRX _ShowMsg
1349*/
1350_ShowMsg:
1351 Buttons.1 = NLVGetMessage(2)
1352 Buttons.0 = 1
1353 id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
1354return
1355
1356/*:VRX _SmbConfCreateShadowCopy
1357*/
1358_SmbConfCreateShadowCopy:
1359 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy started'
1360 /* we create a complete version of smb.conf in temporary directory for reading purposes */
1361 /* as we can only determine a default value from this complete version of the file */
1362 /* however it is not desirable to always have a complete copy normally */
1363 ok = SysFileDelete(samba.!shadowsmbconf)
1364 if dataype(log_Level) <> "NUM" then log_level = 2
1365 say ' 'samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1366 address cmd samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1367 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy done'
1368return
1369
1370/*:VRX _TabbedDialogSetup
1371*/
1372_TabbedDialogSetup:
1373 IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup started'
1374 w = VRLoad( "TDL_1", VRWindowPath(), "SW_DAEMONS" )
1375 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(18)" ")
1376
1377 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
1378 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(19)" ")
1379
1380 w = VRLoad( "TDL_1", VRWindowPath(), "SW_USERS" )
1381 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(15)" ")
1382
1383 w = VRLoad( "TDL_1", VRWindowPath(), "SW_FILES" )
1384 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(16)" ")
1385
1386 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SERVICE" )
1387 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(17)" ")
1388
1389 w = VRLoad( "TDL_1", VRWindowPath(), "SW_CHKTDB" )
1390 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(22)" ")
1391
1392 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
1393 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(24)" ")
1394
1395
1396 IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup done'
1397return
1398
1399/*:VRX _UserCredUpdate
1400*/
1401_UserCredUpdate:
1402 if options.!debug == 1 then say time()' _UserCredUpdate started'
1403 credentials.!username = VRGet("EF_USER1","Value")
1404 credentials.!password = VRGet("EF_PASSWORD1","Value")
1405
1406 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 1 | pos(left(credentials.!password,1),'01234567890') > 0
1407 then UserCred = '--user='Credentials.!username'%%'Credentials.!password
1408 else UserCred = '--user='Credentials.!username'%'Credentials.!password
1409
1410 if options.!storecreds = 1 & \(UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' | UserCred = '--user=%%' | UserCred = '-N') then do
1411 ok = _ucSetUc()
1412/* ok = VRSet("Pict_PWINMEM","PicturePath","#36") */
1413 if options.!debug == 1 then call beep 2400, 10
1414 end
1415 else do
1416 if options.!debug == 1 then call beep 200, 20
1417/* ok = VRSet("Pict_PWINMEM","PicturePath","#37") */
1418 end
1419 if options.!debug == 1 then say time()' _UserCredUpdate done'
1420return
1421/*:VRX About_Close
1422*/
1423About_Close:
1424 call About_Fini
1425return
1426
1427/*:VRX About_Create
1428*/
1429About_Create:
1430 call About_Init
1431 ok = VRSet("About","Caption", NLVGetMessage(20))
1432 ok = VRSet("PB_AboutOK1","Caption", NLVGetMessage(2))
1433 SambaTeam.0 = 11
1434 SambaTeam.1 = 'Silvan Scherrer'
1435 SambaTeam.2 = 'Herwig Bauernfeind'
1436 SambaTeam.3 = 'Dmitrij Kuminov'
1437 SambaTeam.4 = 'Vitali Pelenyov'
1438 SambaTeam.5 = 'Paul Smedley'
1439 SambaTeam.6 = 'Yuri Dario'
1440 SambaTeam.7 = 'Alex Taylor'
1441 SambaTeam.8 = 'Nikolay Kolosov'
1442 SambaTeam.9 = 'All the Samba people'
1443 SambaTeam.10= 'All the ArcaNoae people'
1444 SambaTeam.11= 'All the netlabs people'
1445 ok = VRSet("About","Font", VRGet("SW_SETTINGS","Font"))
1446 ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
1447 ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(21))
1448 ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
1449return
1450
1451/*:VRX About_Fini
1452*/
1453About_Fini:
1454 window = VRInfo( "Window" )
1455 call VRDestroy window
1456 drop window
1457return
1458/*:VRX About_Init
1459*/
1460About_Init:
1461 window = VRInfo( "Object" )
1462 if( \VRIsChildOf( window, "Notebook" ) ) then do
1463 call VRMethod window, "CenterWindow"
1464 call VRSet window, "Visible", 1
1465 call VRMethod window, "Activate"
1466 end
1467 drop window
1468return
1469
1470/*:VRX Activate
1471*/
1472Activate:
1473 parse arg Nr
1474 /* call PushbackAll */
1475 CurrentPageNr = Nr
1476 /* ok = VRSet("PB_"Nr,"Font","9.WarpSans Bold") */
1477/* ok = VRSet("TAB_"Nr,"Top", TabTop-8)
1478 ok = VRSet("TAB_"Nr,"Left",TabWidth*(Nr-1)+PageLeft)
1479 ok = VRSet("TAB_"Nr,"PicturePath", "#1"||Nr||";#1"||Nr)
1480 ok = VRset("DT_PageName", "Caption", VRGet("TAB_"Nr, "UserData"))
1481 ok = VRSet("Page_"Nr,"Visible", 1)
1482 select
1483 when Nr = 1 then ok = VRSet("IPB_paper","PicturePath","#4;#4")
1484 when Nr = Pages then ok = VRSet("IPB_paper","PicturePath","#6;#6")
1485 otherwise ok = VRSet("IPB_paper","PicturePath","#5;#5")
1486 end */
1487return
1488
1489/*:VRX CN_CHKTDB_ContextMenu
1490*/
1491CN_CHKTDB_ContextMenu:
1492 if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1493 else do
1494 RH = VRInfo("Record")
1495 OH = VRInfo("Object")
1496 if RH <> "" then do
1497 ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1498 end
1499 end
1500return
1501
1502/*:VRX CN_Daemons_Click
1503*/
1504CN_Daemons_Click:
1505 IF options.!debug == 1 then say time()' CN_Daemons_Click() started'
1506 NowClickedRecord = VRInfo("Record")
1507 say " NowRecord = '"NowClickedRecord"'"
1508 say " LastRecord = '"LastClickedRecord"'"
1509 if NowClickedRecord <> LastClickedRecord then call _RefreshDaemonsDelay
1510 LastClickedRecord = NowClickedRecord
1511 IF options.!debug == 1 then say time()' CN_Daemons_Click() done'
1512return
1513
1514/*:VRX CN_Daemons_ContextMenu
1515*/
1516CN_Daemons_ContextMenu:
1517 IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() started'
1518 if VRInfo("Top") < 400 & VRGet("CN_Daemons", "View") = "Detail" then do
1519 say " Going for column modification..."
1520 call _ColumnsMenu "CN_Daemons"
1521 end
1522 else do
1523 say " Going for context menu, record = '"VRInfo("Record")"'"
1524
1525 call _RefreshDaemonsDelay
1526 DRH = VRInfo("Record")
1527 DaemonName = ""
1528
1529 OH = VRInfo("Object")
1530 ok = VRset("ContextMenu_Daemons_Details", "Visible", 1 )
1531 ok = VRset("ContextMenu_Daemons_Tree", "Visible", 1 )
1532 ok = VRset("MItem_9", "Visible", 1 )
1533 ok = VRset("ContextMenu_Daemons_Sort", "Visible", 1 )
1534 ok = VRset("ContextMenu_Daemons_MiniIcons", "Visible", 1 )
1535 ok = VRset("MItem_13", "Visible", 1 )
1536 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 1 )
1537 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 1 )
1538 ok = VRset("ContextMenu_Daemons_Start", "Visible", 1 )
1539 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 1 )
1540
1541 if DRH <> "" then do
1542 DaemonName = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption")
1543 ok = VRset("ContextMenu_Daemons_Ping","Visible", 1 )
1544 end
1545
1546 select
1547 when Words(DaemonName) = 3 & pos("PID ",DaemonName) > 0 then do /* a child process with PID in name */
1548 DaemonName = word(DaemonName,2)
1549 ok = VRSet("ContextMenu_Daemons_KillPID", "Caption", NLVGetMessage( 38, DaemonName))
1550 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1551 end
1552 when Words(DaemonName) = 1 & (pos("mbd.exe",Daemonname) > 0 | pos("winbindd.exe",Daemonname) > 0) then do /* on root process */
1553 parse var DaemonName DaemonName'.exe'
1554 if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do
1555 ok = VRSet("ContextMenu_Daemons_Shutdown", "Caption", NLVGetMessage( 33, DaemonName))
1556 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1557 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1558 end
1559 end
1560 when pos("\", DaemonName) > 0 then do /* we are on a file */
1561 ok = VRset("MItem_13", "Visible", 0 )
1562 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 )
1563 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1564 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1565 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 )
1566 end
1567 otherwise do /* we are on a user */
1568 ok = VRset("MItem_13", "Visible", 0 )
1569 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 )
1570 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1571 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1572 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 )
1573 end
1574 end
1575 say ' Daemon is "'DaemonName'"'
1576 say ' DaemonView = "'DaemonView'"'
1577 if VRGet("CN_Daemons","View") = "Detail" then do
1578 ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 0)
1579 ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 1)
1580 end
1581 else do
1582 ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 1)
1583 ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 0)
1584 end
1585 DaemonView = VRGet("CN_Daemons","View")
1586
1587 ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" )
1588 end
1589 IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() done'
1590return
1591
1592/*:VRX CN_Files_ContextMenu
1593*/
1594CN_Files_ContextMenu:
1595 if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1596 else do
1597 RH = VRInfo("Record")
1598 OH = VRInfo("Object")
1599 if RH <> "" then do
1600 ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1601 end
1602 end
1603return
1604
1605/*:VRX CN_Service_ContextMenu
1606*/
1607CN_Service_ContextMenu:
1608 if VRInfo("Top") < 400 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service"
1609 else do
1610 ok = VRSet("TM_refresh","Enabled", 0)
1611 SRH = VRInfo("Record")
1612 OH = VRInfo("Object")
1613 if SRH <> "" then do
1614 Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH)
1615 say ' Service is "'Service'"'
1616 ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" )
1617 end
1618 end
1619return
1620
1621/*:VRX CN_SMBTREE_Click
1622*/
1623CN_SMBTREE_Click:
1624 rh = VRInfo('Record')
1625 if VRMethod( 'CN_SMBTREE', "ValidateRecord", rh) <> 1 then return
1626 userdata = VRMethod('CN_SMBTREE', 'GetRecordAttr', rh, 'UserData')
1627 parse var userdata . '|' userdata
1628 ok = VRset("Main","StatusText", userdata)
1629
1630
1631return
1632
1633/*:VRX CN_SMBTREE_ContextMenu
1634*/
1635CN_SMBTREE_ContextMenu:
1636 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
1637 if VRInfo("Top") < 400 & VRGet("CN_SMBTREE", "View") = "Detail" then call _ColumnsMenu "CN_SMBTREE"
1638 else do
1639 call _dropdeprecated
1640 RH = VRInfo("Record")
1641 if RH <> "" then do
1642 call _GetSmbObjectProperties RH
1643 call _ContextMenuSelectedSet
1644
1645 BrowsePath = _browsebuildpath(SMBObj.rh)
1646
1647 /* call _BrowseResetObject(SmbObj.rh) */
1648
1649 parse var browsepath '\\'machine'\'sharename '\' browsepath
1650
1651 CurMachine = SMBObj.Resname
1652 ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" )
1653 end
1654 else do
1655 call _ContextMenuSelectedSet
1656 end
1657 end
1658 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
1659return
1660
1661/*:VRX CN_SMBTREE_DoubleClick
1662*/
1663CN_SMBTREE_DoubleClick:
1664 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
1665
1666 call _dropdeprecated
1667 call _GetSmbObjectProperties VRInfo('Record')
1668
1669/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
1670return */
1671 /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
1672
1673 if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
1674
1675 If SMBObj.udatatype = "DIRECTORY" then do
1676 BrowsePath = _browsebuildpath(SMBObj.rh)
1677
1678 call _BrowseResetObject(SmbObj.rh)
1679
1680 parse var browsepath '\\'machine'\'sharename '\' browsepath
1681 browsepath = browsepath'\*'
1682
1683 call _BrowseDirectory
1684 end
1685
1686 If SMBObj.udatatype = "FILE" then do
1687 BrowsePath = _browsebuildpath(SMBObj.rh)
1688 call _BrowseResetObject(SmbObj.rh)
1689
1690 parse var browsepath '\\'machine'\'sharename '\' browsepath
1691
1692 OpenOk = _browseobjectopen(machine,sharename,browsepath)
1693
1694 if \OpenOK then do
1695 say " Not connected - trying to connect"
1696 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
1697 call PB_SMBTREE_CONNECT_Click
1698 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
1699
1700 OpenOk = _browseobjectopen(machine,sharename,browsepath)
1701
1702 if \OpenOk then do
1703 say " Not connected - cannot open - aborting!"
1704 end
1705 end
1706 end
1707
1708 if SMBObj.udatatype = "DISK" then do
1709 machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
1710 parse var machine machine '0D0A'x .
1711 machine = strip(machine)
1712
1713 call _BrowseResetObject(SmbObj.rh)
1714
1715 sharename = SMBObj.resname
1716 BrowsePath = ""
1717
1718 call _BrowseDirectory
1719 end
1720 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
1721return
1722/*:VRX CN_Users_ContextMenu
1723*/
1724CN_Users_ContextMenu:
1725 if VRInfo("Top") < 400 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users"
1726 else do
1727 RH = VRInfo("Record")
1728 OH = VRInfo("Object")
1729 if RH <> "" then do
1730 CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH )
1731 ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" )
1732 end
1733 end
1734return
1735
1736/*:VRX Columns_01_Click
1737*/
1738Columns_01_Click:
1739 call _ColumnShow
1740return
1741
1742/*:VRX Columns_02_Click
1743*/
1744Columns_02_Click:
1745 call _ColumnShow
1746return
1747
1748/*:VRX Columns_03_Click
1749*/
1750Columns_03_Click:
1751 call _ColumnShow
1752return
1753
1754/*:VRX Columns_04_Click
1755*/
1756Columns_04_Click:
1757 call _ColumnShow
1758return
1759
1760/*:VRX Columns_05_Click
1761*/
1762Columns_05_Click:
1763 call _ColumnShow
1764return
1765
1766/*:VRX Columns_06_Click
1767*/
1768Columns_06_Click:
1769 call _ColumnShow
1770return
1771
1772/*:VRX Columns_07_Click
1773*/
1774Columns_07_Click:
1775 call _ColumnShow
1776return
1777
1778/*:VRX Columns_08_Click
1779*/
1780Columns_08_Click:
1781 call _ColumnShow
1782return
1783
1784/*:VRX Columns_09_Click
1785*/
1786Columns_09_Click:
1787 call _ColumnShow
1788return
1789
1790/*:VRX Columns_10_Click
1791*/
1792Columns_10_Click:
1793 call _ColumnShow
1794return
1795
1796/*:VRX Columns_11_Click
1797*/
1798Columns_11_Click:
1799 call _ColumnShow
1800return
1801
1802/*:VRX Columns_12_Click
1803*/
1804Columns_12_Click:
1805 call _ColumnShow
1806return
1807
1808/*:VRX Columns_13_Click
1809*/
1810Columns_13_Click:
1811 call _ColumnShow
1812return
1813
1814/*:VRX Columns_14_Click
1815*/
1816Columns_14_Click:
1817 call _ColumnShow
1818return
1819
1820/*:VRX ContextMenu_Daemons_Details_Click
1821*/
1822ContextMenu_Daemons_Details_Click:
1823 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1824 ok = VRset("CN_Daemons","View","Detail")
1825 ok = VRset("ContextMenu_Daemons_Tree","Enabled",1)
1826 ok = VRset("ContextMenu_Daemons_Details","Enabled",0)
1827 ok = VRSet("TM_refresh","Enabled", 1)
1828 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1829return
1830
1831/*:VRX ContextMenu_Daemons_KillPID_Click
1832*/
1833ContextMenu_Daemons_KillPID_Click:
1834 Msg.Text = NLVGetMessage(39, DaemonName)
1835 Msg.Type = 'Q'
1836 if _MsgYesNo() = 1 then do
1837 ok = PRKillProcess("1",DaemonName )
1838 if ok = 0 then say ", success!"; else say ", error "ok
1839
1840/* say 'kill -9 'DaemonName
1841 address cmd 'kill -9 'DaemonName */
1842 end
1843 ok = VRSet("TM_Refresh","Enabled", 1)
1844return
1845
1846/*:VRX ContextMenu_Daemons_MiniIcons_Click
1847*/
1848ContextMenu_Daemons_MiniIcons_Click:
1849 advanced.!bigicons = \advanced.!bigicons
1850 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1851 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1852 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
1853 ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons)
1854return
1855
1856/*:VRX ContextMenu_Daemons_Ping_Click
1857*/
1858ContextMenu_Daemons_Ping_Click:
1859 ok = VRSet("Main", 'Pointer', 'Wait' )
1860 address cmd samba.!smbcontrolexe' 'DaemonName' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1861 call _SambaShowMsg "section table registered"
1862
1863 ok = VRSet("Main", 'Pointer', '<default>' )
1864 ok = VRSet("TM_refresh","Enabled", 1)
1865return
1866
1867/*:VRX ContextMenu_Daemons_Shutdown_Click
1868*/
1869ContextMenu_Daemons_Shutdown_Click:
1870 Msg.Text = NLVGetMessage(34, DaemonName)
1871 Msg.Type = 'Q'
1872 if _MsgYesNo() = 1 then do
1873 address cmd samba.!smbcontrolexe' 'DaemonName' shutdown 2>'samba.!error' 1>'samba.!msg
1874 call _SambaShowMsg "section table registered tdb"
1875 end
1876 ok = VRSet("TM_Refresh","Enabled", 1)
1877return
1878
1879/*:VRX ContextMenu_Daemons_Sort_Click
1880*/
1881ContextMenu_Daemons_Sort_Click:
1882 window = VRLoadSecondary( "SW_SORT", "W" )
1883return
1884
1885/*:VRX ContextMenu_Daemons_Start_Click
1886*/
1887ContextMenu_Daemons_Start_Click:
1888 Msg.Text = NLVGetMessage(37, DaemonName)
1889 Msg.Type = 'Q'
1890 if _MsgYesNo() = 1 then do
1891 say samba.!smbcmd' start 'DaemonName
1892 address cmd samba.!smbcmd' start 'DaemonName
1893 end
1894 ok = VRSet("TM_Refresh","Enabled", 1)
1895return
1896
1897/*:VRX ContextMenu_Daemons_Tree_Click
1898*/
1899ContextMenu_Daemons_Tree_Click:
1900 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1901 ok = VRset("CN_Daemons","View","IconTree")
1902 ok = VRset("ContextMenu_Daemons_Tree","Enabled",0)
1903 ok = VRset("ContextMenu_Daemons_Details","Enabled",1)
1904 ok = VRSet("TM_refresh","Enabled", 1)
1905 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1906return
1907
1908/*:VRX ContextMenu_Files_Sort_Click
1909*/
1910ContextMenu_Files_Sort_Click:
1911 window = VRLoadSecondary( "SW_SORT", "W" )
1912return
1913
1914/*:VRX ContextMenu_Service_CloseShare_Click
1915*/
1916ContextMenu_Service_CloseShare_Click:
1917 Msg.Text = NLVGetMessage(75, Service)
1918 Msg.Type = 'Q'
1919 if _MsgYesNo() = 1 then do
1920 address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */
1921 /* No usable output from Samba here ! */
1922 /* call _SambaShowMsg */
1923 Msg.Text = NLVGetMessage(76, Service)
1924 Msg.Type = 'I'
1925 call _ShowMsg
1926 end
1927 ok = VRSet("TM_refresh","Enabled", 1)
1928return
1929
1930/*:VRX ContextMenu_Service_Sort_Click
1931*/
1932ContextMenu_Service_Sort_Click:
1933 window = VRLoadSecondary( "SW_SORT", "W" )
1934return
1935
1936/*:VRX ContextMenu_Tree_ACLS_Click
1937*/
1938ContextMenu_Tree_ACLS_Click:
1939 if options.!debug == 1 then say ' List ACLS for "'SMBObj.udatatype'"'
1940 window = VRLoadSecondary( "SW_ACLS", "W" )
1941return
1942
1943/*:VRX ContextMenu_Tree_Details_Click
1944*/
1945ContextMenu_Tree_Details_Click:
1946 ok = VRset("CN_SMBTREE","View","Detail")
1947 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1948 ok = VRset("ContextMenu_Tree_Details","Enabled",0)
1949 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1950 ok = VRset("TM_Throbber", "Enabled", 1)
1951 ok = VRset("Pict_Throbber", "Visible", 0)
1952 call _RefreshTree
1953return
1954
1955/*:VRX ContextMenu_Tree_Icons_Click
1956*/
1957ContextMenu_Tree_Icons_Click:
1958 ok = VRset("CN_SMBTREE","View","Icon")
1959 ok = VRset("ContextMenu_Tree_Icons","Enabled",0)
1960 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1961 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1962 ok = VRset("TM_Throbber", "Enabled", 1)
1963 ok = VRset("Pict_Throbber", "Visible", 1)
1964 call _RefreshTree
1965return
1966
1967/*:VRX ContextMenu_Tree_LOGIN_Click
1968*/
1969ContextMenu_Tree_LOGIN_Click:
1970 window = VRLoadSecondary( "SW_LOGIN", "W" )
1971
1972 /* call _UserCredUpdate */
1973
1974return
1975
1976/*:VRX ContextMenu_Tree_MiniIcons_Click
1977*/
1978ContextMenu_Tree_MiniIcons_Click:
1979 advanced.!bigicons = \advanced.!bigicons
1980 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1981 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1982 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
1983 ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons)
1984return
1985
1986/*:VRX ContextMenu_Tree_SendMsg_Click
1987*/
1988ContextMenu_Tree_SendMsg_Click:
1989 call _SendMsg
1990return
1991
1992/*:VRX ContextMenu_Tree_Sort_Click
1993*/
1994ContextMenu_Tree_Sort_Click:
1995 window = VRLoadSecondary( "SW_SORT", "W" )
1996return
1997
1998/*:VRX ContextMenu_Tree_Tree_Click
1999*/
2000ContextMenu_Tree_Tree_Click:
2001 ok = VRset("CN_SMBTREE","View","IconTree")
2002 ok = VRset("ContextMenu_Tree_Tree","Enabled",0)
2003 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
2004 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
2005 ok = VRset("TM_Throbber", "Enabled", 1)
2006 ok = VRset("Pict_Throbber", "Visible", 1)
2007 call _RefreshTree
2008return
2009
2010/*:VRX ContextMenu_Users_SendMsg_Click
2011*/
2012ContextMenu_Users_SendMsg_Click:
2013 call _SendMsg
2014return
2015
2016/*:VRX ContextMenu_Users_Sort_Click
2017*/
2018ContextMenu_Users_Sort_Click:
2019 window = VRLoadSecondary( "SW_SORT", "W" )
2020return
2021
2022/*:VRX DT_STATUSBAR_ContextMenu
2023*/
2024DT_STATUSBAR_ContextMenu:
2025 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2026return
2027
2028/*:VRX EF_log_file_Change
2029*/
2030EF_log_file_Change:
2031 advanced.!smbconfchanged = 1
2032return
2033
2034/*:VRX Fini
2035*/
2036Fini:
2037 window = VRWindow()
2038 call VRSet window, "Visible", 0
2039 drop window
2040return 0
2041
2042/*:VRX GetBootDrive
2043*/
2044GetBootDrive:
2045/* Use SysBootDrive if possible */
2046If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
2047 Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
2048Else
2049 Return SysBootDrive()
2050
2051
2052/*:VRX Halt
2053*/
2054Halt:
2055 signal _VREHalt
2056return
2057
2058/*:VRX Init
2059*/
2060Init:
2061window = VRWindow()
2062call VRMethod window, "CenterWindow"
2063call VRSet window, "Visible", 0
2064call VRMethod window, "Activate"
2065drop window
2066return
2067
2068/*:VRX LB_SortFields_Click
2069*/
2070LB_SortFields_Click:
2071 call _ContainerSort
2072return
2073
2074/*:VRX Main_Activate
2075*/
2076Main_Activate:
2077 call TM_Refresh_Trigger
2078 ok = VRset("TM_Refresh", "Enabled", 1)
2079return
2080
2081/*:VRX Main_Close
2082*/
2083Main_Close:
2084 call Quit
2085return
2086
2087/*:VRX Main_Create
2088*/
2089Main_Create:
2090 options.!debug = 0
2091 if options.!debug == 1 then do
2092 ok = VRRedirectStdIO("ON")
2093 say time()' Main_Create started'
2094 end
2095 else ok = VRRedirectStdIO("OFF")
2096
2097 call _LoadOtherFuncs
2098 call _InitTempDir
2099
2100 call _IniRead
2101 call _NLVSetup
2102
2103 call _TabbeddialogSetup
2104
2105 call _SambaInit
2106 if \WPSStartStop then call _CreateSmbStarter
2107 if _SambaRunning() then call _SambaFindPIDfile
2108 call _ContainerInit
2109 call _GUIInit
2110
2111/* str = 'call TAB_'CurrentPageNr'_Click';
2112say str
2113interpret str
2114say 'Done 'str
2115 if CurrentPageNr <> 5 then do
2116 ok = VRSet("TM_Throbber", "Enabled", 1)
2117 call _RefreshTree
2118 end */
2119 ok = VRMethod("PB_Refresh","SetFocus")
2120
2121 if options.!debug == 1 then say time()' Main_Create done'
2122return
2123/*:VRX Main_Deactivate
2124*/
2125Main_Deactivate:
2126 ok = VRset("TM_Refresh", "Enabled", 0)
2127return
2128
2129/*:VRX Main_Resize
2130*/
2131Main_Resize:
2132 IF options.!debug == 1 THEN SAY time()' Main_Resize started'
2133 ok = VRSet("Main","Painting", 0)
2134
2135 /* Basic measurements */
2136 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2137 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2138
2139 /* if main_iheight < 5500 then ok = VRSet("Main","Height",6200) */
2140 sbar_height = margin * 8 /* Height of status-bar */
2141 marginx2 = margin * 2 /* Common margin around controls */
2142 marginx4 = margin * 4
2143
2144 pbtn_dist = 980
2145 pbtn_nr = 5
2146 pbtn_pos = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
2147 pbtn_height = 400 /* Height of the panels' internal button areas */
2148 pbtn_width = 940
2149
2150 pane_height = main_iheight- sbar_height - pbtn_height - margin * 7 /* Height of notebook */
2151 pane_width = main_iwidth - marginx2 /* Width of the notebook panel */
2152
2153 /* Tabbed Dialog */
2154 ok = VRset("TDL_1", "Top", marginx2 )
2155 ok = VRset("TDL_1", "Left", margin )
2156 ok = VRset("TDL_1", "Width", pane_width )
2157 ok = VRset("TDL_1", "Height", pane_height )
2158
2159 /* Statusbar */
2160 ok = VRSet("GB_STATUSBAR", "Left", margin )
2161 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2162 ok = VRSet("GB_STATUSBAR", "Height",sbar_height )
2163 ok = VRSet("GB_STATUSBAR", "Width", pane_width )
2164
2165 ok = VRSet("DT_STATUSBAR", "Top", 12 )
2166 ok = VRSet("DT_STATUSBAR", "Left", 12 )
2167 ok = VRSet("DT_STATUSBAR", "Height",sbar_height- 24)
2168 ok = VRSet("DT_STATUSBAR", "Width", pane_width - 24)
2169
2170 ok = VRSet("PB_Refresh","top", pane_height + marginx4 )
2171 ok = VRSet("PB_Help", "top", pane_height + marginx4 )
2172 ok = VRSet("PB_Cancel", "top", pane_height + marginx4 )
2173 ok = VRSet("PB_Apply", "top", pane_height + marginx4 )
2174 ok = VRSet("PB_About", "top", pane_height + marginx4 )
2175
2176 ok = VRSet("PB_Refresh","left",pbtn_pos + pbtn_dist * (pbtn_nr - 5))
2177 ok = VRSet("PB_Apply", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 4))
2178 ok = VRSet("PB_Help", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 3))
2179 ok = VRSet("PB_About", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 2))
2180 ok = VRSet("PB_Cancel", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 1))
2181
2182 ok = VRset("GB_CHKTDB","Top", margin )
2183 ok = VRset("GB_CHKTDB","Left", marginx2)
2184 ok = VRset("GB_CHKTDB","Width", pane_width - 760)
2185 ok = VRset("GB_CHKTDB","Height", pane_height- 1020)
2186 ok = VRset("CN_CHKTDB","Top", margin)
2187 ok = VRset("CN_CHKTDB","Left", margin)
2188 ok = VRset("CN_CHKTDB","Width", pane_width - 760 - marginx2 )
2189 ok = VRset("CN_CHKTDB","Height", pane_height- 1020- marginx2 )
2190
2191 ok = VRset("GB_USERS","Top", margin )
2192 ok = VRset("GB_USERS","Left", marginx2)
2193 ok = VRset("GB_USERS","Width", pane_width - 760)
2194 ok = VRset("GB_USERS","Height", pane_height- 1020)
2195 ok = VRset("CN_USERS","Top", margin)
2196 ok = VRset("CN_USERS","Left", margin)
2197 ok = VRset("CN_USERS","Width", pane_width - 760 - marginx2 )
2198 ok = VRset("CN_USERS","Height", pane_height- 1020- marginx2 )
2199
2200 ok = VRset("GB_FILES","Top", margin )
2201 ok = VRset("GB_FILES","Left", marginx2)
2202 ok = VRset("GB_FILES","Width", pane_width - 760)
2203 ok = VRset("GB_FILES","Height", pane_height- 1020)
2204 ok = VRset("CN_FILES","Top", margin)
2205 ok = VRset("CN_FILES","Left", margin)
2206 ok = VRset("CN_FILES","Width", pane_width - 760 - marginx2 )
2207 ok = VRset("CN_FILES","Height", pane_height- 1020- marginx2 )
2208
2209 ok = VRset("GB_SERVICE","Top", margin )
2210 ok = VRset("GB_SERVICE","Left", marginx2)
2211 ok = VRset("GB_SERVICE","Width", pane_width - 760)
2212 ok = VRset("GB_SERVICE","Height", pane_height- 1020)
2213 ok = VRset("CN_SERVICE","Top", margin)
2214 ok = VRset("CN_SERVICE","Left", margin)
2215 ok = VRset("CN_SERVICE","Width", pane_width - 760 - marginx2 )
2216 ok = VRset("CN_SERVICE","Height", pane_height- 1020- marginx2 )
2217
2218 ok = VRset("GB_DAEMONS","Top", margin )
2219 ok = VRset("GB_DAEMONS","Left", marginx2)
2220 ok = VRset("GB_DAEMONS","Width", pane_width - 760)
2221 ok = VRset("GB_DAEMONS","Height", pane_height- 1020)
2222 ok = VRset("CN_DAEMONS","Top", margin)
2223 ok = VRset("CN_DAEMONS","Left", margin)
2224 ok = VRset("CN_DAEMONS","Width", pane_width - 760 - margin*4 - pbtn_width)
2225 ok = VRset("CN_DAEMONS","Height", pane_height- 1020 - marginx2 )
2226
2227 ok = VRSet("PB_START", "Top", pbtn_height*2 - marginx2)
2228 ok = VRSet("PB_STOP", "Top", pbtn_height*3 - marginx2)
2229 ok = VRSet("PB_Restart","Top", pbtn_height*4 - marginx2)
2230 ok = VRSet("PB_Reload", "Top", pbtn_height*5 - marginx2)
2231 ok = VRSet("PB_DelLogs","Top", pbtn_height*6 - marginx2)
2232
2233 ok = VRSet("PB_START", "Left", pane_width - 760 - marginx2 - pbtn_width)
2234 ok = VRSet("PB_STOP", "Left", pane_width - 760 - marginx2 - pbtn_width)
2235 ok = VRSet("PB_Restart","Left", pane_width - 760 - marginx2 - pbtn_width)
2236 ok = VRSet("PB_Reload", "Left", pane_width - 760 - marginx2 - pbtn_width)
2237 ok = VRSet("PB_DelLogs","Left", pane_width - 760 - marginx2 - pbtn_width)
2238
2239 ok = VRset("GB_SMBTREE","Top", margin )
2240 ok = VRset("GB_SMBTREE","Left", marginx2)
2241 ok = VRset("GB_SMBTREE","Width", pane_width - 760)
2242 ok = VRset("GB_SMBTREE","Height", pane_height- 1020)
2243 ok = VRset("CN_SMBTREE","Top", margin)
2244 ok = VRset("CN_SMBTREE","Left", margin)
2245 ok = VRset("CN_SMBTREE","Width", pane_width - 760 - marginx2 )
2246 ok = VRset("CN_SMBTREE","Height", pane_height- 1020- marginx2 )
2247
2248 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
2249 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
2250
2251 ok = VRset("GB_SETTINGS","Top", margin )
2252 ok = VRset("GB_SETTINGS","Left", marginx2)
2253 ok = VRset("GB_SETTINGS","Width", pane_width - 760)
2254 ok = VRset("GB_SETTINGS","Height", pane_height- 1020- marginx2)
2255
2256
2257 /* check and empty event queue, trash spurious resize events */
2258 EventString = ''
2259 TrashedResize = 0
2260 do until EventString = 'nop'
2261 EventString = VREvent('N')
2262 if EventString <> 'nop' then do
2263 if EventString = 'CALL Main_Resize' then TrashedResize = 1
2264 else interpret eventString
2265 end
2266 end
2267 if TrashedResize then CALL Main_Resize
2268 ok = VRSet("Main", "Painting", 1)
2269
2270 IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2271return
2272
2273/*:VRX Page1_Create
2274*/
2275Page1_Create:
2276
2277Return
2278
2279/*:VRX Page1_Init
2280*/
2281Page1_Init:
2282 call _ContainerInit
2283return
2284
2285/*:VRX Page2_Create
2286*/
2287Page2_create:
2288
2289Return
2290/*:VRX Page2_init
2291*/
2292Page2_init:
2293
2294return
2295
2296/*:VRX Page3_Create
2297*/
2298Page3_create:
2299
2300Return
2301/*:VRX Page3_Init
2302*/
2303Page3_Init:
2304
2305return
2306
2307/*:VRX Page4_Create
2308*/
2309Page4_Create:
2310
2311Return
2312/*:VRX Page4_init
2313*/
2314Page4_init:
2315
2316return
2317
2318/*:VRX Page5_Create
2319*/
2320Page5_Create:
2321
2322return
2323
2324/*:VRX Page5_Init
2325*/
2326Page5_Init:
2327
2328return
2329
2330/*:VRX Paper_Init
2331*/
2332Paper_Init:
2333 ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
2334 ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
2335 ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
2336return
2337
2338/*:VRX PB_About_Click
2339*/
2340PB_About_Click:
2341 window = VRLoadSecondary( "About", "W" )
2342return
2343
2344/*:VRX PB_AboutOK1_Click
2345*/
2346PB_AboutOK1_Click:
2347 call About_Close
2348return
2349
2350/*:VRX PB_AboutOK_Click
2351*/
2352PB_AboutOK_Click:
2353 call About_Close
2354return
2355
2356/*:VRX PB_ACLS_OK_Click
2357*/
2358PB_ACLS_OK_Click:
2359 call SW_ACLS_close
2360return
2361
2362/*:VRX PB_Apply_Click
2363*/
2364PB_Apply_Click:
2365 IF options.!debug == 1 then say time()' PB_Apply_Click() started'
2366 options.!Debug = VRGet("CB_Debug","set")
2367 if options.!Debug then ok = VRREdirectStdIO("ON")
2368 else ok = VRREdirectStdIO("OFF")
2369 Intervall = VRGet("SPIN_Intervall","Value")
2370 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2371 IntervallMin = VRGet("SPIN_IntervallMin","Value")
2372
2373 NoMsgBox = VRGet("CB_NoMsgBox","set")
2374 say 'NoMsgBox = "'NoMsgBox'"'
2375
2376 WPSStartStop = VRGet("CB_WPSStartStop","set")
2377 say 'WPSStartStop = "'WPSStartStop'"'
2378
2379 DetectZombies = VRGet("CB_DetectZombies","set")
2380 say 'DetectZombies = "'DetectZombies'"'
2381
2382 options.!storecreds = VRGet("CB_STORECREDS","Set")
2383 say "options.!storecreds = "options.!storecreds
2384
2385 if advanced.!smbconfchanged = 1 then do
2386 log_level = VRGet("SPIN_log_level","Value")
2387 log_file = VRGet("EF_log_file","Value")
2388 max_protocol = VRGet("SPIN_max_protocol","Value")
2389
2390 handle = IniOpen('global', samba.!smbconf)
2391
2392 ok = IniSet('log level', log_level, handle)
2393 ok = IniSet('log file', log_file, handle)
2394 ok = IniSet('max protocol', max_protocol, handle)
2395
2396 ok = IniSave(handle)
2397 ok = IniClose(handle)
2398 advanced.!smbconfchanged = 0
2399 end
2400 IF options.!debug == 1 then say time()' PB_Apply_Click() done'
2401return
2402
2403/*:VRX PB_Cancel_Click
2404*/
2405PB_Cancel_Click:
2406 say 'start PB_Cancel_Click'
2407 Call Quit
2408 say 'done PB_Cancel_Click'
2409return
2410
2411/*:VRX PB_DELLOGS_Click
2412*/
2413PB_DELLOGS_Click:
2414 call VRSet VRWindow(), 'Pointer', 'Wait'
2415
2416 /* Fixme - this needs to be read from smb.conf */
2417 samba.!logdir = ETC'\samba\log'
2418
2419 ok = SysFileTree(samba.!logdir'\log.*', logs.,'FO')
2420 do I = 1 to logs.0
2421 ok = VRMethod( "CN_Daemons", "GetRecordList", "All", "handle." )
2422 KeepLog = 0
2423 do J = 1 to handle.0
2424 CurPID = VRMethod("CN_Daemons", "GetFieldData", handle.J, DPidsFH)
2425 if pos(CurPID,logs.I) > 0 then KeepLog = 1
2426 end
2427 if KeepLog = 0 then ok = SysFileDelete(logs.I)
2428 end
2429
2430 call VRSet VRWindow(), 'Pointer', '<default>'
2431return
2432
2433/*:VRX PB_Help_Click
2434*/
2435PB_Help_Click:
2436 ok = VRMethod("Main", "InvokeHelp" )
2437return
2438
2439/*:VRX PB_LOGIN_CANCEL_Click
2440*/
2441PB_LOGIN_CANCEL_Click:
2442 credentials.!entered = 0
2443 call SW_LOGIN_Close
2444return
2445
2446/*:VRX PB_LOGIN_OK_Click
2447*/
2448PB_LOGIN_OK_Click:
2449/* ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
2450 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value")) */
2451 options.!storecreds = VRGet("CB_STORECREDS1","Set")
2452 credentials.!entered = 1
2453 p_server = SMBObj.resname
2454 if p_server <> "" then do
2455 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
2456
2457 if word(ok,1) = "1" then do
2458 call _StatusBarWrapper NLVGetMessage(107, rpc.queryuser.FULL_NAME)
2459 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
2460 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
2461 call _UserCredUpdate
2462 end
2463 else do
2464 call _StatusBarWrapper VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS
2465 end
2466 end
2467
2468 call SW_LOGIN_Close
2469return
2470
2471/*:VRX PB_Refresh_Click
2472*/
2473PB_Refresh_Click:
2474 IF options.!debug == 1 then say time()' PB_Refresh_Click() started'
2475 ok = SysSleep(0.3)
2476
2477 say " CurrentPageNr = "CurrentPageNr
2478 select
2479 when CurrentPageNr = 2 then do
2480 ok = VRset("Pict_Throbber", "Visible", 1)
2481 ok = VRset("TM_Throbber", "Enabled", 1)
2482 call _RefreshTree
2483 end
2484 when CurrentPageNr = 6 then do
2485 call _ChkTDB
2486 end
2487 otherwise call _Refresh
2488 end
2489 IF options.!debug == 1 then say time()' PB_Refresh_Click() done'
2490return
2491
2492/*:VRX PB_RELOAD_Click
2493*/
2494PB_RELOAD_Click:
2495 call VRSet VRWindow(), 'Pointer', 'Wait'
2496 if WPSStartStop then do
2497 ok = SysOpenObject('<smb_reload>', 'DEFAULT', 1)
2498 end
2499 else do
2500 call lineout samba.!bin"\smbstart", "reload"
2501 ok = stream(samba.!bin"\reload","c","close")
2502 end
2503 ok = VRSet("TM_Refresh","Delay", 2000)
2504 call VRSet VRWindow(), 'Pointer', '<default>'
2505return
2506
2507/*:VRX PB_RESTART_Click
2508*/
2509PB_RESTART_Click:
2510 call VRSet VRWindow(), 'Pointer', 'Wait'
2511 if WPSStartStop then do
2512 ok = SysOpenObject('<smb_restart>', 'DEFAULT', 1)
2513 end
2514 else do
2515 call lineout samba.!bin"\restart", "restart"
2516 ok = stream(samba.!bin"\restart","c","close")
2517 end
2518 ok = VRSet("TM_Refresh","Delay", 1000)
2519 call VRSet VRWindow(), 'Pointer', '<default>'
2520return
2521
2522/*:VRX PB_Sort_Cancel_Click
2523*/
2524PB_Sort_Cancel_Click:
2525 ok = VRset( Container, "DetailSort", Old.SortField )
2526 ok = VRSet( Container, "Sort", Old.SortOrder )
2527 ok = VRMethod( Container, "SortRecords" )
2528 drop Old.
2529 call SW_SORT_Close
2530return
2531
2532/*:VRX PB_Sort_OK_Click
2533*/
2534PB_Sort_OK_Click:
2535 drop Old.
2536 call SW_SORT_Close
2537return
2538
2539/*:VRX PB_START_Click
2540*/
2541PB_START_Click:
2542 say "IPB_Start_Click started"
2543 call VRSet VRWindow(), 'Pointer', 'Wait'
2544 if WPSStartStop then do
2545 ok = SysOpenObject('<smb_start>', 'DEFAULT', 1)
2546 end
2547 else do
2548 call lineout samba.!bin"\smbstart", "smbstart"
2549 ok = stream(samba.!bin"\smbstart","c","close")
2550 end
2551 ok = VRSet("TM_Refresh","Delay", 1000)
2552 call VRSet VRWindow(), 'Pointer', '<default>'
2553 say "IPB_Start_Click done"
2554return
2555/*:VRX PB_STOP_Click
2556*/
2557PB_STOP_Click:
2558 say "IPB_Stop_Click started"
2559 call VRSet VRWindow(), 'Pointer', 'Wait'
2560 if WPSStartStop then do
2561 ok = SysOpenObject('<smb_stop>', 'DEFAULT', 1)
2562 end
2563 else do
2564 call lineout samba.!bin"\smbstop", "smbstop"
2565 ok = stream(samba.!bin"\smbstop","c","close")
2566 end
2567 ok = VRSet("TM_Refresh","Delay", 1000)
2568 call VRSet VRWindow(), 'Pointer', '<default>'
2569 say "IPB_Stop_Click done"
2570return
2571/*:VRX PushbackAll
2572*/
2573PushbackAll:
2574 Pages = 6
2575 /* Tab distance from top */
2576 TabTop = 20
2577 TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
2578 TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
2579
2580 /* Page Position */
2581 PageLeft = 120
2582 PageTop = PageLeft + TabTop + 330
2583
2584 /* Page size */
2585 PageHeight = 3000
2586 PageWidth = 3000
2587 call beep 880, 20
2588/* ok = VRset("DT_PageName", "Caption", "")
2589 ok = VRSet("GB_Main","Left", 0)
2590 ok = VRSet("GB_Main","Top", TabTop+230)
2591 do I = 1 to Pages
2592 ok = VRSet("TAB_"I,"Top", TabTop)
2593 ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
2594 ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
2595 ok = VRSet("TAB_"I,"Width",TabWidth)
2596 ok = VRSet("TAB_"I,"Height",TabHeight)
2597 ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
2598 ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
2599 ok = VRSet("Page_"I,"Left", PageLeft)
2600 ok = VRSet("Page_"I,"Top", PageTop)
2601 ok = VRSet("Page_"I,"Visible", 0)
2602 ok = VRSet("Page_"I,"BackColor", "<default>")
2603 end */
2604return
2605
2606/*:VRX Quit
2607*/
2608Quit:
2609 call VRSet VRWindow(), 'Pointer', 'Wait'
2610 call _IniWrite
2611 ok = VRRedirectStdIO("OFF")
2612 call _SambaFinish
2613
2614 ok = SysFileDelete(smbdoutput)
2615
2616 call lineout samba.!bin"\quit", "quit"
2617 ok = stream(samba.!bin"\quit","c","close")
2618 ok = SysSleep(1)
2619 ok = SysDestroyObject('<smbstarter>')
2620 ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
2621 ok = SysFileDelete(samba.!bin'\quit')
2622 call VRSet VRWindow(), 'Pointer', '<default>'
2623
2624 window = VRWindow()
2625 call VRSet window, "Shutdown", 1
2626 drop window
2627return
2628
2629/*:VRX RB_Sort_Ascending_Click
2630*/
2631RB_Sort_Ascending_Click:
2632 SortOrder = "Ascending"
2633 call _ContainerSort
2634return
2635
2636/*:VRX RB_Sort_Descending_Click
2637*/
2638RB_Sort_Descending_Click:
2639 SortOrder = "Descending"
2640 call _ContainerSort
2641return
2642
2643/*:VRX RB_Sort_None_Click
2644*/
2645RB_Sort_None_Click:
2646 SortOrder = "None"
2647 call _ContainerSort
2648return
2649
2650/*:VRX SPIN_Intervall_Change
2651*/
2652SPIN_Intervall_Change:
2653return
2654
2655/*:VRX SPIN_IntervallMin_Change
2656*/
2657SPIN_IntervallMin_Change:
2658return
2659
2660/*:VRX SPIN_log_level_Change
2661*/
2662SPIN_log_level_Change:
2663 advanced.!smbconfchanged = 1
2664return
2665
2666/*:VRX SPIN_max_protocol_Change
2667*/
2668SPIN_max_protocol_Change:
2669 advanced.!smbconfchanged = 1
2670return
2671
2672/*:VRX SW_ACLS_Close
2673*/
2674SW_ACLS_Close:
2675 call SW_ACLS_Fini
2676return
2677
2678/*:VRX SW_ACLS_Create
2679*/
2680SW_ACLS_Create:
2681 call SW_ACLS_Init
2682
2683 ok = VRSet("SW_ACLS","Caption",'ACLS \\'machine'\'sharename' "'browsepath'"')
2684
2685 ACL.typeFH = VRMethod( "CN_ACLS", "AddField", "String", "Type" )
2686 ACL.valueFH = VRMethod( "CN_ACLS", "AddField", "String", "Value" )
2687
2688 /* Make sure credentials are usable */
2689 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
2690
2691 /* We have to remove the double % for smbclient.exe - not entirely clear why */
2692 OldUserCred = ""
2693 if pos('%%',UserCred) > 0 & pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0 then do
2694 OldUserCred = UserCred
2695 parse var UserCred '--user='username'%%'password
2696 UserCred = '--user='username'%'password
2697 say " Strip double %%!!!"
2698 end
2699
2700 say ' 'samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred
2701 address cmd samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred' 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2702
2703 ok = file2stem(samba.!error,"aclserror.","DEL")
2704
2705 if aclserror.0 = 0 then do
2706 call _StatusBarWrapper "NT_STATUS_OK"
2707
2708 ok = file2stem(samba.!msg,"aclsmsg.","DEL")
2709 do I = 1 to aclsmsg.0
2710 parse var aclsmsg.I aclstype':'aclsvalue
2711 DummyRH = VRMethod('CN_ACLS', 'AddRecord')
2712 ok = VRMethod("CN_ACLS", "SetFieldData", DummyRH, ACL.typeFH, aclstype, ACL.valueFH, aclsvalue)
2713 end
2714 end
2715 else do
2716 call _StatusBarWrapper aclserror.1
2717 call SW_ACLS_close
2718 end
2719return
2720/*:VRX SW_ACLS_Fini
2721*/
2722SW_ACLS_Fini:
2723 window = VRInfo( "Window" )
2724 call VRDestroy window
2725 drop window
2726return
2727/*:VRX SW_ACLS_Init
2728*/
2729SW_ACLS_Init:
2730 window = VRInfo( "Object" )
2731 if( \VRIsChildOf( window, "Notebook" ) ) then do
2732 call VRMethod window, "CenterWindow"
2733 call VRSet window, "Visible", 1
2734 call VRMethod window, "Activate"
2735 end
2736 drop window
2737return
2738
2739/*:VRX SW_CHKTDB_Close
2740*/
2741SW_CHKTDB_Close:
2742 call SW_CHKTDB_Fini
2743return
2744
2745/*:VRX SW_CHKTDB_Create
2746*/
2747SW_CHKTDB_Create:
2748 call SW_CHKTDB_Init
2749return
2750
2751/*:VRX SW_CHKTDB_Fini
2752*/
2753SW_CHKTDB_Fini:
2754 window = VRInfo( "Window" )
2755 call VRDestroy window
2756 drop window
2757return
2758/*:VRX SW_CHKTDB_Init
2759*/
2760SW_CHKTDB_Init:
2761 window = VRInfo( "Object" )
2762 if( \VRIsChildOf( window, "Notebook" ) ) then do
2763 call VRMethod window, "CenterWindow"
2764 call VRSet window, "Visible", 1
2765 call VRMethod window, "Activate"
2766 end
2767 drop window
2768return
2769
2770/*:VRX SW_DAEMONS_Close
2771*/
2772SW_DAEMONS_Close:
2773 call SW_DAEMONS_Fini
2774return
2775
2776/*:VRX SW_DAEMONS_Create
2777*/
2778SW_DAEMONS_Create:
2779 call SW_DAEMONS_Init
2780return
2781
2782/*:VRX SW_DAEMONS_Fini
2783*/
2784SW_DAEMONS_Fini:
2785 window = VRInfo( "Window" )
2786 call VRDestroy window
2787 drop window
2788return
2789/*:VRX SW_DAEMONS_Init
2790*/
2791SW_DAEMONS_Init:
2792 window = VRInfo( "Object" )
2793 if( \VRIsChildOf( window, "Notebook" ) ) then do
2794 call VRMethod window, "CenterWindow"
2795 call VRSet window, "Visible", 1
2796 call VRMethod window, "Activate"
2797 end
2798 drop window
2799return
2800
2801/*:VRX SW_FILES_Close
2802*/
2803SW_FILES_Close:
2804 call SW_FILES_Fini
2805return
2806
2807/*:VRX SW_FILES_Create
2808*/
2809SW_FILES_Create:
2810 call SW_FILES_Init
2811return
2812
2813/*:VRX SW_FILES_Fini
2814*/
2815SW_FILES_Fini:
2816 window = VRInfo( "Window" )
2817 call VRDestroy window
2818 drop window
2819return
2820/*:VRX SW_FILES_Init
2821*/
2822SW_FILES_Init:
2823 window = VRInfo( "Object" )
2824 if( \VRIsChildOf( window, "TDL" ) ) then do
2825 call VRMethod window, "CenterWindow"
2826 call VRSet window, "Visible", 1
2827 call VRMethod window, "Activate"
2828 end
2829 drop window
2830return
2831
2832/*:VRX SW_LOGIN_Close
2833*/
2834SW_LOGIN_Close:
2835 call SW_LOGIN_Fini
2836return
2837
2838/*:VRX SW_LOGIN_Create
2839*/
2840SW_LOGIN_Create:
2841 call SW_LOGIN_Init
2842/* ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
2843 CALL NLVSetText 'DT_USER1', "Caption", 25
2844 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
2845 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
2846 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
2847 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3 */
2848
2849 if VRIsValidObject(SMBObj.rh) then do
2850 select
2851 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
2852 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
2853 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
2854 when SMBObj.udatatype = "DISK" then do
2855 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
2856 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
2857 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
2858 end
2859 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
2860 end
2861 say loginicon
2862 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
2863 end
2864/* ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
2865 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value")) */
2866say options.!storecreds
2867 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
2868return
2869
2870/*:VRX SW_LOGIN_Fini
2871*/
2872SW_LOGIN_Fini:
2873 window = VRInfo( "Window" )
2874 call VRDestroy window
2875 drop window
2876return
2877/*:VRX SW_LOGIN_Init
2878*/
2879SW_LOGIN_Init:
2880 window = VRInfo( "Object" )
2881 if( \VRIsChildOf( window, "Notebook" ) ) then do
2882 call VRMethod window, "CenterWindow"
2883 call VRSet window, "Visible", 1
2884 call VRMethod window, "Activate"
2885 end
2886 drop window
2887return
2888
2889/*:VRX SW_SERVICE_Close
2890*/
2891SW_SERVICE_Close:
2892 call SW_SERVICE_Fini
2893return
2894
2895/*:VRX SW_SERVICE_Create
2896*/
2897SW_SERVICE_Create:
2898 call SW_SERVICE_Init
2899return
2900
2901/*:VRX SW_SERVICE_Fini
2902*/
2903SW_SERVICE_Fini:
2904 window = VRInfo( "Window" )
2905 call VRDestroy window
2906 drop window
2907return
2908/*:VRX SW_SERVICE_Init
2909*/
2910SW_SERVICE_Init:
2911 window = VRInfo( "Object" )
2912 if( \VRIsChildOf( window, "TDL" ) ) then do
2913 call VRMethod window, "CenterWindow"
2914 call VRSet window, "Visible", 1
2915 call VRMethod window, "Activate"
2916 end
2917 drop window
2918return
2919
2920/*:VRX SW_SETTINGS_Close
2921*/
2922SW_SETTINGS_Close:
2923 call SW_SETTINGS_Fini
2924return
2925
2926/*:VRX SW_SETTINGS_Create
2927*/
2928SW_SETTINGS_Create:
2929 call SW_SETTINGS_Init
2930return
2931
2932/*:VRX SW_SETTINGS_Fini
2933*/
2934SW_SETTINGS_Fini:
2935 window = VRInfo( "Window" )
2936 call VRDestroy window
2937 drop window
2938return
2939/*:VRX SW_SETTINGS_Init
2940*/
2941SW_SETTINGS_Init:
2942 window = VRInfo( "Object" )
2943 if( \VRIsChildOf( window, "TDL" ) ) then do
2944 call VRMethod window, "CenterWindow"
2945 call VRSet window, "Visible", 1
2946 call VRMethod window, "Activate"
2947 end
2948 drop window
2949return
2950
2951/*:VRX SW_SETTINGS_Init_Content
2952*/
2953SW_SETTINGS_Init_Content:
2954
2955 log_level = IniGet('log level', 'global', samba.!smbconf)
2956 log_file = IniGet('log file', 'global', samba.!smbconf)
2957 max_protocol = IniGet('max_protocol', 'global', samba.!smbconf)
2958
2959 if log_level = "" then log_level = 2
2960 if max_protocol = "" then max_protocol = "NT1"
2961
2962 ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
2963 ok = VRSet("EF_LOG_FILE","Value",log_file)
2964return
2965
2966/*:VRX SW_SMBTREE_Close
2967*/
2968SW_SMBTREE_Close:
2969 call SW_SMBTREE_Fini
2970return
2971
2972/*:VRX SW_SMBTREE_Create
2973*/
2974SW_SMBTREE_Create:
2975 call SW_SMBTREE_Init
2976return
2977
2978/*:VRX SW_SMBTREE_Fini
2979*/
2980SW_SMBTREE_Fini:
2981 window = VRInfo( "Window" )
2982 call VRDestroy window
2983 drop window
2984return
2985/*:VRX SW_SMBTREE_Init
2986*/
2987SW_SMBTREE_Init:
2988 window = VRInfo( "Object" )
2989 if( \VRIsChildOf( window, "TDL" ) ) then do
2990 call VRMethod window, "CenterWindow"
2991 call VRSet window, "Visible", 1
2992 call VRMethod window, "Activate"
2993 end
2994 drop window
2995return
2996
2997/*:VRX SW_SMBTREE_Init_Content
2998*/
2999SW_SMBTREE_Init_Content:
3000 ok = VRset("Pict_Throbber", "Visible", 1)
3001 ok = VRset("TM_Throbber", "Enabled", 1)
3002 call _RefreshTree
3003return
3004
3005/*:VRX SW_SORT_Close
3006*/
3007SW_SORT_Close:
3008 call SW_SORT_Fini
3009return
3010
3011/*:VRX SW_SORT_Create
3012*/
3013SW_SORT_Create:
3014 call SW_SORT_Init
3015
3016 CALL NLVSetText 'SW_SORT', 'Caption', 35
3017 CALL NLVSetText 'PB_Sort_OK', 'Caption', 2
3018 CALL NLVSetText 'PB_Sort_Cancel', 'Caption', 3
3019
3020 CALL NLVSetText 'RB_Sort_Ascending', 'Caption', 90
3021 CALL NLVSetText 'RB_Sort_Descending', 'Caption', 91
3022 CALL NLVSetText 'RB_Sort_None', 'Caption', 92
3023
3024 Container = OH
3025say OH
3026say Container
3027 ok = VRMethod(Container, "GetFieldList", "Fields." )
3028
3029 SortOrder = "None"
3030
3031 do I = 1 to Fields.0
3032 ok = VRMethod("LB_SortFields","AddString", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
3033 end
3034 Old.SortField = VRGet( Container, "DetailSort" )
3035 Old.SortOrder = VRGet( Container, "Sort" )
3036say Old.SortField
3037say Old.SortOrder
3038return
3039
3040/*:VRX SW_SORT_Fini
3041*/
3042SW_SORT_Fini:
3043 window = VRInfo( "Window" )
3044 call VRDestroy window
3045 drop window
3046return
3047/*:VRX SW_SORT_Init
3048*/
3049SW_SORT_Init:
3050 window = VRInfo( "Object" )
3051 if( \VRIsChildOf( window, "Notebook" ) ) then do
3052 call VRMethod window, "CenterWindow"
3053 call VRSet window, "Visible", 1
3054 call VRMethod window, "Activate"
3055 end
3056 drop window
3057return
3058
3059/*:VRX SW_USERS_Close
3060*/
3061SW_USERS_Close:
3062 call SW_USERS_Fini
3063return
3064
3065/*:VRX SW_USERS_Create
3066*/
3067SW_USERS_Create:
3068 call SW_USERS_Init
3069return
3070
3071/*:VRX SW_USERS_Fini
3072*/
3073SW_USERS_Fini:
3074 window = VRInfo( "Window" )
3075 call VRDestroy window
3076 drop window
3077return
3078/*:VRX SW_USERS_Init
3079*/
3080SW_USERS_Init:
3081 window = VRInfo( "Object" )
3082 if( \VRIsChildOf( window, "Notebook" ) ) then do
3083 call VRMethod window, "CenterWindow"
3084 call VRSet window, "Visible", 1
3085 call VRMethod window, "Activate"
3086 end
3087 drop window
3088return
3089
3090/*:VRX TDL_1_PageSelected
3091*/
3092TDL_1_PageSelected:
3093 page = VRInfo("Page")
3094 CurrentPageNr = page
3095 ok = VRSet("TM_RefreshDaemons","Enabled", 0)
3096 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
3097 /* call _TabsStrip */
3098 select
3099 when page = 1 then do /* daemons */
3100 ok = VRSet("Main","WindowIcon","$46")
3101 ok = VRSet("TM_RefreshDaemons","Enabled", 1)
3102 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
3103 end
3104 when page = 2 then do /* smbtree */
3105 ok = VRSet("Main","WindowIcon","$1")
3106 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "handle." )
3107 /* if the page is empty, populate it */
3108 if handle.0 = 0 then call PB_Refresh_Click
3109 end
3110 when page = 3 then do /* Users */
3111 ok = VRSet("Main","WindowIcon","$44")
3112 end
3113 when page = 4 then do /* files */
3114 ok = VRSet("Main","WindowIcon","$1")
3115 end
3116 when page = 5 then do /* service */
3117 ok = VRSet("Main","WindowIcon","$52")
3118 end
3119 when page = 6 then do /* chkTDB */
3120 ok = VRSet("Main","WindowIcon","$53")
3121 say "ChkTDB"
3122 call _ChkTDB
3123 end
3124 when page = 7 then do /* Settings */
3125 ok = VRSet("Main","WindowIcon","$53")
3126 call SW_SETTINGS_Init_Content
3127 end
3128 otherwise nop
3129 end
3130return
3131
3132/*:VRX TM_Refresh_Trigger
3133*/
3134TM_Refresh_Trigger:
3135/* call beep 1200, 20 */
3136 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
3137 call _Refresh
3138return
3139
3140/*:VRX TM_RefreshDaemons_Trigger
3141*/
3142TM_RefreshDaemons_Trigger:
3143 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
3144 call _RefreshDaemons
3145return
3146
3147/*:VRX TM_RefreshTreeDisplay_Trigger
3148*/
3149TM_RefreshTreeDisplay_Trigger:
3150 select
3151 when RefreshMode = "TREE" then do
3152 call _RefreshTreeDisplay
3153 end
3154 when RefreshMode = "SHARE" then do
3155 call _AddSharesDisplay
3156 end
3157 otherwise say "RefreshMode = "RefreshMode
3158 end
3159return
3160
3161/*:VRX TM_STATUSBAR_Trigger
3162*/
3163TM_STATUSBAR_Trigger:
3164 call _StatusBarReset
3165return
3166
3167/*:VRX TM_Throbber_Trigger
3168*/
3169TM_Throbber_Trigger:
3170 pIdx = VRGet("Pict_Throbber","PicturePath")
3171 parse var pIdx '#' pidx
3172 pidx = pidx + 1
3173 if pidx = 122 then pidx = 111
3174 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
3175return
3176
Note: See TracBrowser for help on using the repository browser.