/*:VRX Main */ /* Main */ Main: /* Process the arguments. Get the parent window. */ parse source . calledAs . parent = "" argCount = arg() argOff = 0 if( calledAs \= "COMMAND" )then do if argCount >= 1 then do parent = arg(1) argCount = argCount - 1 argOff = 1 end end; else do call VROptions 'ImplicitNames' call VROptions 'NoEchoQuit' end InitArgs.0 = argCount if( argCount > 0 )then do i = 1 to argCount InitArgs.i = arg( i + argOff ) end drop calledAs argCount argOff /* Load the windows */ call VRInit parse source . . spec _VREPrimaryWindowPath = , VRParseFileName( spec, "dpn" ) || ".VRW" _VREPrimaryWindow = , VRLoad( parent, _VREPrimaryWindowPath ) drop parent spec if( _VREPrimaryWindow == "" )then do call VRMessage "", "Cannot load window:" VRError(), , "Error!" _VREReturnValue = 32000 signal _VRELeaveMain end /* Process events */ call Init signal on halt do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) ) _VREEvent = VREvent() interpret _VREEvent end _VREHalt: _VREReturnValue = Fini() call VRDestroy _VREPrimaryWindow _VRELeaveMain: call VRFini exit _VREReturnValue VRLoadSecondary: __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 ) if __vrlsWait then do call VRFlush end __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) ) if __vrlsHWnd = '' then signal __vrlsDone if __vrlsWait \= 1 then signal __vrlsDone call VRSet __vrlsHWnd, 'WindowMode', 'Modal' __vrlsTmp = __vrlsWindows.0 if( DataType(__vrlsTmp) \= 'NUM' ) then do __vrlsTmp = 1 end else do __vrlsTmp = __vrlsTmp + 1 end __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd ) __vrlsWindows.0 = __vrlsTmp do while( VRIsValidObject( VRWindow() ) = 1 ) __vrlsEvent = VREvent() interpret __vrlsEvent end __vrlsTmp = __vrlsWindows.0 __vrlsWindows.0 = __vrlsTmp - 1 call VRWindow __vrlsWindows.__vrlsTmp __vrlsHWnd = '' __vrlsDone: return __vrlsHWnd /*:VRX __VXREXX____APPENDS__ */ __VXREXX____APPENDS__: /* #append U:\Develop\Samba\trunk\guitools\shared\inittempdir.vrs #append U:\Develop\Samba\trunk\guitools\shared\sambainit.vrs #append U:\Develop\Samba\trunk\guitools\shared\nlv.vrs #append U:\Develop\Samba\trunk\guitools\shared\smbtree.vrs */ return /*:VRX _ChkTDB */ _ChkTDB: ok = SysFileTree(etc'\samba\lock\*.TDB',tdb.,'FO') say etc'\samba\lock\*.TDB 'tdb.0 error = 0 ok = VRMethod("CN_CHKTDB", "RemoveRecord", "ALL") RecHandleArray.0 = 0 ok = VRSet("CN_CHKTDB", "Painting", 0) do I = 1 to tdb.0 RecHandleArray.I = VRMethod("CN_CHKTDB", "Addrecord") end ok = VRSet("CN_CHKTDB", "Painting", 1) /* ok = VRSet("CN_CHKTDB", "Painting", 0) */ do I = 1 to tdb.0 RecHandle = RecHandleArray.I TDBFile =left(filespec('N',tdb.I), 22) TDBSize = stream(tdb.I,'c','query size') ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBFilesFH, TDBFile, ChkTDBIconFH, "$50", ChkTDBSizeFH, TDBSize||" Bytes" ) address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out' out = linein(tdb.I'.out') ok = stream(tdb.I'.out','c','close') say out if pos('integrity is OK',out) > 0 then do /* integrity is ok */ ok = SysFileDelete(tdb.I'.err') ok = SysFileDelete(tdb.I'.out') out = left(out,length(out)-1) TDBRecords = substr(out, pos("and has", out) + 7,) ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, TDBRecords ) address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL' end else do /* tdb error */ ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBIconFH, "$51" ) error = 1 count = 0 out = "" do while lines(tdb.I'.err') > 0 & count < 5 errline = linein(tdb.I'.err') select /* skip unnecessary lines of log */ when pos("bww ",errline) > 0 then iterate when pos("fcntl",errline) > 0 then iterate otherwise do out = out||errline'. ' count = count + 1 end end end ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, out ) ok = VRSet("CN_CHKTDB", "Painting", 1) ok = VRSet("CN_CHKTDB", "Painting", 0) ok = stream(tdb.I'.err','c','close') end /* call charout , left(filespec('N',tdb.I), 22) address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out' out = linein(tdb.I'.out') ok = stream(tdb.I'.out','c','close') say out if pos('integrity is OK',out) = 0 then do call beep 880, 20 address cmd '@tdbbackup -s.bak -v 'tdb.I' 2>NUL 1>NUL' error = 1 count = 0 do while lines(tdb.I'.err') > 0 & count < 5 errline = linein(tdb.I'.err') select /* skip unnecessary lines of log */ when pos("bww ",errline) > 0 then iterate when pos("fcntl",errline) > 0 then iterate otherwise do say right(copies(' ',22)'Cause: 'errline'!',min(length(errline)+22,79)) count = count + 1 end end end ok = stream(tdb.I'.err','c','close') end else do ok = SysFileDelete(tdb.I'.err') ok = SysFileDelete(tdb.I'.out') address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL' end */ end ok = VRSet("CN_CHKTDB", "Painting", 1) return /*:VRX _ColumnShow */ _ColumnShow: userdata = VRGet(VRInfo("Object"),"Userdata") parse var userdata Container '|' fieldh '|' VisStatus say userdata ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus ) return /*:VRX _ColumnsMenu */ _ColumnsMenu: Container = arg(1) ok = VRMethod(Container, "GetFieldList", "Fields." ) do I = 1 to 14 R2I = right("0"||I,2) if I <= fields.0 then do /* say "Columns_"||R2I' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */ ok = VRset("Columns_"||R2I, "Visible", 1) ok = VRset("Columns_"||R2I, "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" )) ok = VRset("Columns_"||R2I, "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )) ok = VRset("Columns_"||R2I, "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )) end else ok = VRset("Columns_"||R2I, "Visible", 0) end ok = VRMethod( "Columns", "Popup", , , "", "" ) return /*:VRX _ContainerInit */ _ContainerInit: say '_ContainerInit() started.' /* Users */ UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) ) UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) ) GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) ) UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) ) UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) ) UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) ) /* Files */ FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) ) FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) ) FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) ) FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) ) DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) ) TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) ) DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) ) AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) ) RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) ) OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) ) UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) ) SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) ) NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) ) /* Service */ SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) ) SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) ) ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) ) SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) ) ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) ) /* Daemons */ DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) ) DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) ) DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) ) smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,"smbd.exe","$41") nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,"nmbd.exe","$41") winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,"winbindd.exe","$41") ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, "smbd.exe") ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, "nmbd.exe") ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, "winbindd.exe") ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "") ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok) ok = VRMethod("CN_Daemons", "SetRecordAttr","All", "Collapsed", 0 ) /* SMBTree */ WorkgroupFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(150) ) NBFH = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" ) IpFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(147) ) MBFH = VRMethod( "CN_smbtree", "AddField", "String", "DMB/LMB" ) OSFH = VRMethod( "CN_smbtree", "AddField", "String", "OS" ) /* VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */ CommentFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(151) ) MacFH = VRMethod( "CN_smbtree", "AddField", "String", "MAC" ) ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH, "ReadOnly", 1) ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH, "ReadOnly", 1) ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH, "ReadOnly", 1) ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1) ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH, "ReadOnly", 1) ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH, "ReadOnly", 1) /* ChkTdb */ ChkTDBFilesFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(134) ) ChkTDBIconFH = VRMethod( "CN_CHKTDB", "AddField", "Icon", NLVGetMessage(146) ) ChkTDBSizeFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(152) ) ChkTDBStatusFH= VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(151) ) ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBIconFH, "Justification","Center", "ReadOnly", 1) ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBSizeFH, "Justification","Right", "ReadOnly", 1) ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBStatusFH, "Justification","Right", "ReadOnly", 1) say '_ContainerInit() done.' return /*:VRX _ContainerSort */ _ContainerSort: ok = VRMethod( "LB_SortFields", "GetSelectedList", "SortFields." ) if Fields.0 = 0 then return idx = SortFields.1 ok = VRset( Container, "DetailSort", Fields.idx ) ok = VRSet( Container, "Sort", SortOrder ) ok = VRMethod( Container, "SortRecords" ) return /*:VRX _CreateSmbStarter */ _CreateSmbStarter: ok = SysFileDelete(samba.!bin'\smbstarter.cmd') call lineout samba.!bin'\smbstarter.cmd', '/* REXX */' call lineout samba.!bin'\smbstarter.cmd', 'signal on failure name CLEANUP' call lineout samba.!bin'\smbstarter.cmd', 'signal on halt name CLEANUP' call lineout samba.!bin'\smbstarter.cmd', 'signal on syntax name CLEANUP' call lineout samba.!bin'\smbstarter.cmd', 'say "Samba Server Starter"' call lineout samba.!bin'\smbstarter.cmd', 'address cmd "@echo off"' call lineout samba.!bin'\smbstarter.cmd', 'home:' call lineout samba.!bin'\smbstarter.cmd', 'select' call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstart") then do' call lineout samba.!bin'\smbstarter.cmd', 'say "Start"' call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd start"' call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstart")' call lineout samba.!bin'\smbstarter.cmd', 'end' call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstop") then do' call lineout samba.!bin'\smbstarter.cmd', 'say "Stop"' call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd stop"' call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstop")' call lineout samba.!bin'\smbstarter.cmd', 'end' call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("restart") then do' call lineout samba.!bin'\smbstarter.cmd', 'say "Restart"' call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd restart"' call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("restart")' call lineout samba.!bin'\smbstarter.cmd', 'end' call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("reload") then do' call lineout samba.!bin'\smbstarter.cmd', 'say "Reload"' call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd reload"' call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("reload")' call lineout samba.!bin'\smbstarter.cmd', 'end' call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("quit") then do' call lineout samba.!bin'\smbstarter.cmd', 'say "Quit"' call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("quit")' call lineout samba.!bin'\smbstarter.cmd', 'signal cleanup' call lineout samba.!bin'\smbstarter.cmd', 'end' call lineout samba.!bin'\smbstarter.cmd', 'otherwise nop' call lineout samba.!bin'\smbstarter.cmd', 'end' call lineout samba.!bin'\smbstarter.cmd', 'ok = SysSleep(1)' call lineout samba.!bin'\smbstarter.cmd', 'signal home' call lineout samba.!bin'\smbstarter.cmd', 'cleanup:' call lineout samba.!bin'\smbstarter.cmd', 'say "Aborting..."' call lineout samba.!bin'\smbstarter.cmd', 'exit' ok = stream(samba.!bin'\smbstarter.cmd','c','close') Setup = 'NOPRINT=YES;DEFAULTVIEW=RUNNING;'||, 'EXENAME='samba.!bin'\smbstarter.cmd;'||, 'STARTUPDIR='samba.!bin';'||, 'TITLE=;'||, 'PROGTYPE=WINDOWABLEVIO;'||, 'MINIMIZED=YES;'||, 'VISIBLE=NO;'||, 'NOAUTOCLOSE=NO;'||, 'OBJECTID=' rc = SysCreateObject('WPProgram', 'SMBSTARTER', '', Setup, 'UPDATE' ) If rc <> 1 Then Say ' > failed to create SMBSTARTER Object' else ok = SysOpenObject('', 'DEFAULT', 1) return /*:VRX _GuessIcon */ _GuessIcon: procedure text = arg(1) select /* Printer guessing */ when pos('LJ',text) > 0 then res = '#65:PMWP.DLL' when pos('LASER',text) > 0 then res = '#65:PMWP.DLL' when pos('EPSON',text) > 0 then res = '#65:PMWP.DLL' when pos('PRINT',text) > 0 then res = '#65:PMWP.DLL' when pos('PRT',text) > 0 then res = '#65:PMWP.DLL' when pos('CANON',text) > 0 then res = '#65:PMWP.DLL' when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL' when pos('FAX',text) > 0 then res = '#65:PMWP.DLL' when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL' when pos('IPC$',text) > 0 then res = '#59:PMWP.DLL' otherwise res = "#34:PMWP.DLL" end return res /*:VRX _GUIInit */ _GUIInit: IF options.!debug == 1 then say time()' _GUIInit() started' if datatype(Top) = 'NUM' then do ok = VRset("Main","Top",Top) ok = VRset("Main","Left",Left) ok = VRset("Main","Width",Width) ok = VRset("Main","Height",Height) end ok = VRSet("Main", "Font", Font.!Main) ok = VRSet("DT_StatusBar","Font", Font.!Status) ok = VRSet("SW_Users", "Font", Font.!Users) ok = VRSet("SW_Files", "Font", Font.!Files) ok = VRSet("SW_Service", "Font", Font.!Service) ok = VRSet("SW_Daemons", "Font", Font.!Daemons) ok = VRSet("SW_SMBTree", "Font", Font.!SMBTree) ok = VRSet("SW_Settings", "Font", Font.!Settings) ok = VRSet("CN_Users", "Font", Font.!Users) ok = VRSet("CN_Files", "Font", Font.!Files) ok = VRSet("CN_Service", "Font", Font.!Service) ok = VRSet("CN_Daemons", "Font", Font.!Daemons) ok = VRSet("CN_SMBTree", "Font", Font.!SMBTree) CALL NLVSetText 'DT_Refresh', 'Caption', 25 CALL NLVSetText 'DT_RefreshMin', 'Caption', 25 CALL NLVSetText 'DT_Intervall', 'Caption', 26 ok = VRSet("DT_IntervallMin", "Caption", NLVGetMessage(26)' 'NLVGetMessage(28)) CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27 CALL NLVSetText 'CB_WPSSTARTSTOP', 'Caption', 29 CALL NLVSetText 'CB_DetectZombies','Caption', 30 CALL NLVSetText 'ContextMenu_Daemons_Sort', 'Caption', 35 CALL NLVSetText 'ContextMenu_Daemons_Ping', 'Caption', 32 CALL NLVSetText 'ContextMenu_Daemons_Details','Caption', 118 CALL NLVSetText 'ContextMenu_Daemons_Tree', 'Caption', 120 CALL NLVSetText 'ContextMenu_Files_Sort', 'Caption', 35 CALL NLVSetText 'ContextMenu_Service_Sort', 'Caption', 35 CALL NLVSetText 'ContextMenu_Service_CloseSHare', 'Caption', 70 CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80 CALL NLVSetText 'ContextMenu_Users_Sort', 'Caption', 35 CALL NLVSetText 'ContextMenu_Tree_SendMsg', 'Caption', 80 CALL NLVSetText 'ContextMenu_Tree_Sort', 'Caption', 35 CALL NLVSetText 'ContextMenu_Tree_Tree', 'Caption', 120 CALL NLVSetText 'ContextMenu_Tree_Details', 'Caption', 118 Buttonwidth = VRMethod( "Screen", "PixelsToTwips", 32 ) ok = VRSet("SPIN_Intervall", "Value", Intervall) ok = VRSet("SPIN_IntervallMin","Value", IntervallMin) ok = VRSet("TM_Refresh","Delay", Intervall * 1000) ok = VRSet("PB_START", "Enabled", VRFileExists(samba.!smbcmd)) ok = VRSet("PB_Restart","Enabled", VRFileExists(samba.!smbcmd)) ok = VRSet("PB_Reload", "Enabled", VRFileExists(samba.!smbcmd)) ok = VRSet("CN_Daemons", "View", DaemonView) ok = VRSet("CN_smbtree", "View", TreeView) ok = VRSet("CB_NoMsgBox", "Set", NoMsgBox) ok = VRSet("CB_WPSStartStop", "Set", WPSStartStop) ok = VRSet("CB_DetectZombies","Set", DetectZombies) call _INILayoutRead "CN_Users" call _INILayoutRead "CN_Files" call _INILayoutRead "CN_Service" call _INILayoutRead "CN_Daemons" call _INILayoutRead "CN_smbtree" ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons) ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons) ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons) ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons) ok = VRSet("CB_Debug","set",options.!Debug) if _ChkTempFreeSpace() < 262144 then do Msg.Type = "W" Msg.Text = NLVGetMessage(116, TempDir) call _ShowMsg end /* Common margin around controls */ margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2 /* Statusbar */ ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText")) call Main_Resize ok = VRSet("Main", "Visible", 1) IF options.!debug == 1 then say time()' _GUIInit() done' return /*:VRX _INILayoutRead */ _INILayoutRead: Container = arg(1) ok = VRMethod(Container, "GetFieldList", "Fields." ) Layout = VRGetIni( "Layout", Container, OurINI ) if Layout = "" then return do I = 1 to Fields.0 ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1)) end return /*:VRX _INILayoutWrite */ _INILayoutWrite: Container = arg(1) ok = VRMethod(Container, "GetFieldList", "Fields." ) Layout = "" do I = 1 to fields.0 Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ) end ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' ) return /*:VRX _INIRead */ _INIRead: IF options.!debug == 1 then say time()' _INIRead() started' OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBSTATUS.INI',,'\') ok = SysFileTree(OurINI, INIFound.,'FO') if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE') IF options.!debug == 1 then say ' OurINI='OurINI Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose') Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose') Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose') Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose') Font.!Users = VRGetIni( "Fonts", "SW_USERS", OurINI , 'NoClose' ) Font.!Files = VRGetIni( "Fonts", "SW_FILES", OurINI , 'NoClose' ) Font.!Service = VRGetIni( "Fonts", "SW_SERVICE", OurINI , 'NoClose' ) Font.!Daemons = VRGetIni( "Fonts", "SW_DAEMONS", OurINI , 'NoClose' ) Font.!SMBTree = VRGetIni( "Fonts", "SW_SMBTREE", OurINI , 'NoClose' ) Font.!Settings= VRGetIni( "Fonts", "SW_SETTINGS", OurINI , 'NoClose' ) Font.!Main = VRGetIni( "Fonts", "Main", OurINI , 'NoClose' ) Font.!Status = VRGetIni( "Fonts", "Statusfont", OurINI , 'NoClose' ) if Font.!Users = "" then Font.!Users = "9.WarpSans" if Font.!Files = "" then Font.!Files = "9.WarpSans" if Font.!Service = "" then Font.!Service = "9.WarpSans" if Font.!Daemons = "" then Font.!Daemons = "9.WarpSans" if Font.!SMBTree = "" then Font.!SMBTree = "9.WarpSans" if Font.!Settings = "" then Font.!Settings = "9.WarpSans" if Font.!Main = "" then Font.!Main = "9.WarpSans" if Font.!Status = "" then Font.!Status = "9.WarpSans" Intervall = VRGetIni( "Settings", "Intervall", OurINI,'NoClose') if Intervall = "" then Intervall = 60 IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI,'NoClose') if IntervallMin = "" then IntervallMin = 180 CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI,'NoClose') if CurrentPageNr = "" then CurrentPageNr = 4 DaemonView = VRGetIni( "Settings", "DaemonView", OurINI,'NoClose') if DaemonView = "" then DaemonView = "Detail" TreeView = VRGetIni( "Settings", "TreeView", OurINI,'NoClose') if TreeView = "" then TreeView = "IconTree" NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI,'NoClose') if NoMsgBox = "" then NoMsgBox = 1 WPSStartStop = VRGetIni( "Settings", "WPSStartStop", OurINI,'NoClose') if WPSStartStop = "" then WPSStartStop = 1 DetectZombies = VRGetIni( "Settings", "DetectZombies", OurINI,'NoClose') if DetectZombies = "" then DetectZombies = 0 options.!debug = VRGetIni( "Options", "Debug", OurINI) if options.!debug = "" then options.!debug = 0 if options.!Debug then ok = VRRedirectStdIO("ON") else ok = VRRedirectStdIO("OFF") advanced.!bigicons = VRGetIni( "Settings", "BigIcons", OurINI) if advanced.!bigicons = "" then advanced.!bigicons = 0 /* For Browse page */ FirstRun = 1 /* For Users page in case connections.tdb is not initialised */ IgnoreSmbNoInit = 1 /* For Refresh tree display code */ RefreshMode ="" smbdpidhandle.0 = 0 nmbdpidhandle.0 = 0 winbpidhandle.0 = 0 prevsmbdct = 0 prevnmbdct = 0 prevwinbct = 0 smbdoutput = TempDir'smbd.out' IF options.!debug == 1 then say time()' _INIRead() done' return /*:VRX _INIWrite */ _INIWrite: IF options.!debug == 1 then say time()' _INIWrite() started' ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' ) ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' ) ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' ) ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' ) ok = VRSetIni( "Settings", "Intervall", VRGet("SPIN_Intervall","Value"),OurINI,'NoClose') ok = VRSetIni( "Settings", "IntervallMin", VRGet("SPIN_IntervallMin","Value"),OurINI,'NoClose') ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr, OurINI,'NoClose') ok = VRSetIni( "Settings", "DaemonView", VRGet("CN_Daemons","View"), OurINI,'NoClose') ok = VRSetIni( "Settings", "TreeView", VRGet("CN_smbtree","View"), OurINI,'NoClose') ok = VRSetIni( "Settings", "NoMsgBox", NoMsgBox, OurINI,'NoClose') ok = VRSetIni( "Settings", "WPSStartStop", WPSStartStop, OurINI,'NoClose') ok = VRSetIni( "Settings", "BigIcons", \VRGet("CN_SMBTREE", "MiniIcons"),OurINI,'NoClose') ok = VRSetIni( "Settings", "DetectZombies",DetectZombies, OurINI,'NoClose') ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' ) call _INILayoutWrite "CN_Users" call _INILayoutWrite "CN_Files" call _INILayoutWrite "CN_Service" call _INILayoutWrite "CN_Daemons" call _INILayoutWrite "CN_smbtree" if VRGet("CN_USERS", "Font") <> "" then ok = VRSet("SW_USERS", "Font", VRGet("CN_USERS", "Font")) if VRGet("CN_FILES", "Font") <> "" then ok = VRSet("SW_FILES", "Font", VRGet("CN_FILES", "Font")) if VRGet("CN_SERVICE", "Font") <> "" then ok = VRSet("SW_SERVICE","Font", VRGet("CN_SERVICE","Font")) if VRGet("CN_DAEMONS", "Font") <> "" then ok = VRSet("SW_DAEMONS","Font", VRGet("CN_DAEMONS","Font")) if VRGet("CN_SMBTREE", "Font") <> "" then ok = VRSet("SW_SMBTREE","Font", VRGet("CN_SMBTREE","Font")) ok = VRSetIni( "Fonts", "SW_USERS", VRGet("SW_USERS", "Font"), OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "SW_FILES", VRGet("SW_FILES", "Font"), OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "SW_SERVICE", VRGet("SW_SERVICE", "Font"), OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "SW_DAEMONS", VRGet("SW_DAEMONS", "Font"), OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "SW_SMBTREE", VRGet("SW_SMBTREE", "Font"), OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "SW_SETTINGS",VRGet("SW_SETTINGS","Font"), OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "Statusfont", VRGet("DT_StatusBar","Font"),OurINI, 'NoClose' ) ok = VRSetIni( "Fonts", "Main", VRGet("Main","Font"), OurINI ) IF options.!debug == 1 then say time()' _INIWrite() done' return /*:VRX _LoadotherFuncs */ _LoadotherFuncs: IF options.!debug == 1 then say time()' _LoadotherFuncs() started' SIGNAL ON SYNTAX NAME DLLMissing call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs' call PRLoadFuncs SIGNAL OFF SYNTAX IF options.!debug == 1 then say time()' _LoadotherFuncs() done' return DLLMissing: Fatal = 1 call VRMessage 'Main', 'REXX function library 'strip(translate(word(sourceline(SIGL-1),4),' ',"',"))'.DLL is missing!', "EVFSGUI fatal error", "E" signal Quit /*:VRX _MsgYesNo */ _MsgYesNo: say "_MsgYesNo() started" buttons.0 = 2 buttons.1 = NLVGetMessage(6) buttons.2 = NLVGetMessage(7) default = 2 buttons.default = NLVGetMessage(7) esc = 2 buttons.esc = NLVGetMessage(7) RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc ) say "_MsgYesNo() done, answer "RC return RC /*:VRX _NLVSetup */ _NLVSetup: settings.!messages = 1 /* language files exist(s) */ settings.!helpfile = "" /* helpfiles do not exist */ settings.!nlv8dot3 = 0 /* NLV may have long filenames */ call NLVSetup Msg.Title = NLVGetMessage(1) ok = VRSet("Main","helpFile", settings.!helpfile) CALL NLVSetText 'PB_Refresh', 'Caption', 11 CALL NLVSetText 'PB_Cancel', 'Caption', 12 CALL NLVSetText 'PB_Help', 'Caption', 13 CALL NLVSetText 'PB_About', 'Caption', 14 CALL NLVSetText 'PB_Refresh', 'Hinttext', 51 CALL NLVSetText 'PB_Cancel', 'Hinttext', 54 CALL NLVSetText 'PB_Help', 'Hinttext', 52 CALL NLVSetText 'PB_About', 'Hinttext', 53 /* CALL NLVSetText 'TAB_1', 'Userdata', 15 CALL NLVSetText 'TAB_2', 'Userdata', 16 CALL NLVSetText 'TAB_3', 'Userdata', 17 CALL NLVSetText 'TAB_4', 'Userdata', 18 CALL NLVSetText 'TAB_5', 'Userdata', 19 CALL NLVSetText 'TAB_6', 'Userdata', 24 CALL NLVSetText 'TAB_1', 'Hinttext', 55 CALL NLVSetText 'TAB_2', 'Hinttext', 56 CALL NLVSetText 'TAB_3', 'Hinttext', 57 CALL NLVSetText 'TAB_4', 'Hinttext', 58 CALL NLVSetText 'TAB_5', 'Hinttext', 59 CALL NLVSetText 'TAB_6', 'Hinttext', 60 */ /* CALL NLVSetText 'Page_1', 'Hinttext', 55 CALL NLVSetText 'Page_2', 'Hinttext', 56 CALL NLVSetText 'Page_3', 'Hinttext', 57 CALL NLVSetText 'Page_4', 'Hinttext', 58 CALL NLVSetText 'Page_5', 'Hinttext', 59 CALL NLVSetText 'Page_6', 'Hinttext', 60 */ return /*:VRX _Refresh */ _Refresh: IF options.!debug == 1 then say time()' _Refresh() started' ok = VRSet("TM_refresh","Enabled", 0) SmbNoInit = 0 refreshoutput = TempDir'refresh.out' refresherr = TempDir'refresh.err' say ' 'samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput address cmd samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput SambaVer = "Samba "||strip(linein(refreshoutput)) say ' smbd.exe: "'SambaVer'"' ok = stream(refreshoutput,'c','close') say ' 'samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput address cmd samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput /* First line is usually empty */ Hdr = linein(refreshoutput) SambaStVer = strip(linein(refreshoutput)) /* we can detect version mismatches here */ say ' smbstatus: "'SambaStVer'"' select when pos('not initialised',SambaStVer) > 0 then do SambaVer = SambaVer||" (Init)" SmbNoInit = 1 end when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)" otherwise nop end Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146)) /* Active User */ Hdr1 = linein(refreshoutput) /* say ' 1:'hdr1 */ Hdr2 = linein(refreshoutput) /* say ' 2:'hdr2 */ Zeile = linein(refreshoutput) say ' 'Zeile if SmbNoInit then do call lineout samba.!msg, SambaStVer call lineout samba.!msg, Hdr1 call lineout samba.!msg, Hdr2 call lineout samba.!msg, Zeile ok = stream(samba.!msg,'c','close') if IgnoreSmbNoInit then do call _SambaShowMsg IgnoreSmbNoInit = 0 end end say ' SmbNoInit = 'SmbNoInit /* Active users */ ok = VRSet("CN_Users","Painting", 0) ok = VRMethod("CN_Users", "RemoveRecord", "ALL") Username.0 = 0 IP.0 = 0 Group.0 = 0 I = 0 if \SmbNoInit then do do while Zeile <> '' parse var Zeile UPID Username Group Machine IP I = I + 1 UPID.I = UPID Username.I = Username Group.I = Group IP = strip(IP) parse var IP '('IP.I')' RecHandle = VRMethod("CN_Users", "Addrecord") ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I) Zeile = linein(refreshoutput) end end Username.0 = I Group.0 = I UPID.0 = I ok = VRSet("CN_Users","Painting", 1) /* Active Services */ Hdr = linein(refreshoutput) Hdr = linein(refreshoutput) I = 0 Zeile = linein(refreshoutput) ok = VRSet("CN_Service","Painting", 0) ok = VRMethod("CN_Service", "RemoveRecord", "ALL") do while Zeile <> '' parse var Zeile Service SPId Machine Connected I = I + 1 SPid.I = SPid Machine.I = Machine Service.I = Service Icon = _GuessIcon(Service.I) Connected = strip(Connected) T. = "" parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year RecHandle = VRMethod("CN_Service", "Addrecord") ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected) Zeile = linein(refreshoutput) end SPid.0 = I Machine.0 = I Service.0 = I ok = VRSet("CN_Service","Painting", 1) /* Open files */ Hdr = linein(refreshoutput) Hdr = linein(refreshoutput) Hdr = linein(refreshoutput) Zeile = linein(refreshoutput) ok = VRSet("CN_Files","Painting", 0) ok = VRMethod("CN_Files", "RemoveRecord", "ALL") File.0 = 0 FPID.0 = 0 do while Zeile <> '' parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest TimeDate = right(rest,25) say 'Refreshcrash "'Rest'"' say 'Refreshcrash "'max(length(Rest)-25)'"' Name = strip(left(Rest,max(length(Rest)-25,1))) I = I + 1 sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\') Username = UID do J = 1 to UPID.0 if FPID = UPID.J then do Username = Username.J leave end end File = SharePath||'\'||translate(Name,'\','/') File.I = File FPID.I = FPID TimeDate = strip(TimeDate) say Timedate T. = "" parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year FileTime = T.TimeoD FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year RecHandle = VRMethod("CN_Files", "Addrecord") ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode, AccessFH, Access, RWFH, RW) ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name) Zeile = linein(refreshoutput) end File.0 = I FPID.0 = I ok = stream(refreshoutput, 'c','close') ok = SysFileDelete(refreshoutput) ok = stream(refresherr, 'c','close') ok = SysFileDelete(refreshouterr) if VRFileExists( samba.!bin"\smbsched.cmd" ) then do address cmd samba.!bin"\smbsched.cmd" end call _RefreshDaemons ok = VRSet("CN_Files","Painting", 1) if VRGet("Main", "WindowState") = "Minimized" then do ok = VRSet("TM_Refresh","Delay", IntervallMin * 1000) end else do ok = VRSet("TM_Refresh","Delay", Intervall * 1000) end ok = VRSet("TM_refresh","Enabled", 1) IF options.!debug == 1 then say time()' _Refresh() done' return /*:VRX _RefreshDaemons */ _RefreshDaemons: IF options.!debug == 1 then say time()' _RefreshDaemons() started' ok = VRSet("TM_RefreshDaemons","Delay",3000) ok = VRSet("CN_Daemons","Painting", 0 ) call VRSet VRWindow(), 'Pointer', 'Wait' do I = 1 to smbdpidhandle.0 ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I ) end do I = 1 to nmbdpidhandle.0 ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I ) end do I = 1 to winbpidhandle.0 ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I ) end Running = _SambaRunning() call VRSet VRWindow(), 'Pointer', '' smbdpids = pids.!smbd nmbdpids = pids.!nmbd winbpids = pids.!nmbd smbdRunning = running.!smbd nmbdRunning = running.!nmbd winbRunning = running.!winb if smbdRunning then do ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids) ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46") smbdpidhandle.0 = words(smbdpids) if options.!debug = 1 then do if smbdpidhandle.0 > prevsmbdct then do prevsmbdct = smbdpidhandle.0 call beep 880*1, 10 call beep 880*2, 10 call beep 880*4, 10 end if smbdpidhandle.0 < prevsmbdct then do prevsmbdct = smbdpidhandle.0 call beep 880*4, 10 call beep 880*2, 10 call beep 880*1, 10 end end do I = 1 to words(smbdpids) Username = "" do J = 1 to UPID.0 if UPID.J = word(smbdpids,I) then do Username = ' 'Username.J leave end end smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48") /* we ping all smbd.exe except the first one */ if DetectZombies = 1 & I > 1 then do ok = VRSet("Main", 'Pointer', 'Wait' ) address cmd samba.!smbcontrolexe' 'word(smbdpids,I)' ping --timeout=2 --debuglevel=0 2>'samba.!error' 1>'samba.!msg ok = VRSet("Main", 'Pointer', '' ) response = linein(samba.!msg) ok = stream(samba.!msg,'c','close') if pos('PONG', response) = 0 then do /* we have a zombie */ ok = VRMethod( "CN_Daemons", "SetRecordAttr", smbdpidhandle.I,"Icon", "$49") say " Found Zombie "word(smbdpids,I) end end if Username <> "" then do smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44") do J = 1 to FPID.0 if FPID.J = word(smbdpids,I) then do dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45") end end end end end else do ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "") ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47") if options.!debug = 1 then do if prevsmbdct > 0 then do prevsmbdct = 0 call beep 880*4, 10 call beep 880*2, 10 call beep 880*1, 10 end end end if nmbdRunning then do ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids) ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46") nmbdpidhandle.0 = words(nmbdpids) do I = 1 to words(nmbdpids) nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , 'PID 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48") end end else do ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "") ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47") end if winbRunning then do ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids) ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46") winbpidhandle.0 = words(winbpids) do I = 1 to words(winbpids) winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , 'PID 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48") end end else do ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "") ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47") end if \(smbdrunning|nmbdrunning|winbrunning) then do ok = VRSet("PB_START", "Enabled", 1) ok = VRSet("PB_STOP", "Enabled", 0) ok = VRSet("PB_ReStart","Enabled", 0) ok = VRSet("PB_ReLoad", "Enabled", 0) end else do ok = VRSet("PB_START", "Enabled", 0) ok = VRSet("PB_STOP", "Enabled", 1) ok = VRSet("PB_ReStart","Enabled", 1) ok = VRSet("PB_ReLoad", "Enabled", 1) end ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "") ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok) ok = VRSet("CN_Daemons","Painting", 1 ) if Running then call _SambaUptime IF options.!debug == 1 then say time()' _RefreshDaemons() done' return /* _pids: procedure pongfile = arg(1) pids = '' do until lines(pongfile) = 0 pongline = linein(pongfile) if word(Pongline,1) = 'PONG' then do parse var pongline pong from tpid pid pids = pids||pid', ' end else pids = pids||pongline end pids = strip(strip(pids),,',') ok = stream(pongfile,'c','close') ok = SysFileDelete(pongfile) return pids */ /* pingout = 'ping.out' '@smbcontrol -t 2 smbd ping -d 0 1>'pingout if rc = 0 then smbdRunning = 1 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DPidsFH, _pids(pingout)) '@smbcontrol -t 2 nmbd ping -d 0 1>'pingout if rc = 0 then nmbdRunning = 1 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DPidsFH, _pids(pingout)) '@smbcontrol -t 1 winbindd ping -d 0 1>'pingout if rc = 0 then winbRunning = 1 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DPidsFH, _pids(pingout)) ok = SysFileDelete(PingOut) */ /*:VRX _RefreshDaemonsDelay */ _RefreshDaemonsDelay: IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() started' IF options.!debug == 1 then say " Old intervall = "VRGet("TM_RefreshDaemons","Delay") ok = VRSet("TM_RefreshDaemons","Delay", 60000) IF options.!debug == 1 then say " New Intervall = "VRGet("TM_RefreshDaemons","Delay") IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() done' return /*:VRX _SambaFindPIDfile */ _SambaFindPIDfile: IF options.!debug == 1 then say time()' _SambaFindPIDfile() started' ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO') if nmbdpid.0 = 1 then nmbdpidfile = nmbdpid.1; else nmbdpidfile = "" IF options.!debug == 1 then say " nmbdpidfile = "nmbdpidfile IF options.!debug == 1 then say time()' _SambaFindPIDfile() done' return /*:VRX _SambaShowError */ _SambaShowError: procedure expose samba. settings. options. I = 0 do while lines(samba.!error) <> 0 I = I + 1 smberr.I = linein(samba.!error) end ok = stream(Samba.!error,"c","close") smberr.0 = I Buttons.1 = "OK" /* NLVGetMessage(2) */ Buttons.0 = 1 id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 ) ok = SysFileDelete(Samba.!error) return /*:VRX _SambaShowMsg */ _SambaShowMsg: procedure expose samba. settings. options. say "SambaShowMsg started" skipWords = arg(1) skip.0 = words(skipWords) do J = 1 to skip.0 skip.J = translate(word(skipWords,J)) end I = 0 do while lines(samba.!msg) <> 0 msgline = linein(samba.!msg) SkipIt = 0 do J = 1 to skip.0 if pos(skip.J,translate(msgline)) > 0 then do skipit = 1 leave end end if \SkipIt then do I = I + 1 smbmsg.I = strip(MsgLine) end end ok = stream(Samba.!msg,"c","close") say " stream close "Samba.!msg" = "ok smbmsg.0 = I if smbmsg.0 > 0 then do Buttons.1 = "OK" /* NLVGetMessage(2) */ Buttons.0 = 1 id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 ) end ok = SysFileDelete(Samba.!msg) say " Delete "Samba.!msg" = "ok say "SambaShowMsg done" return /*:VRX _SambaUptime */ _SambaUptime: IF options.!debug == 1 then say time()' _SambaUptime() started' call _SambaFindPIDfile if nmbdpidfile = "" then do ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41)) return end StartTime = SysGetFileDateTime(nmbdpidfile) if StartTime = -1 then return NowTime = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time() /* StartTime = "2007-12-31 00:00:00" NowTime = "2008-03-05 08:59:50" */ IF options.!debug == 1 then do say " Start Time ='"StartTime"'" say " Now Time ='"NowTime"'" end doM.0 = 12 doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30; doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31 parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29 /* say doM.2 */ uY =nY-sY uM =nM-sM uD =nD-sD uH =nH-sH uMi=nMi-sMi uS =nS-sS if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end if uH < 0 then do; uD = uD - 1; uH = uH + 24; end if uD < 0 then do; /* uM = uM - 1; */ if uM < 0 then uMx = uM + 12; else uMx = uM uD = uD + doM.uMx - 1; end if uM < 0 then do; uY = uY - 1; uM = uM + 12; end /* say uY uM uD uH uMi uS */ UpTimeStr = ' 'NlvGetMessage(43)':' if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44) if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45) if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46) if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47) if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48) if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49) loggingfreespace = word(sysdriveinfo(left(samba.!log,2)),2)%1024%1024 ok = VRset("CN_Daemons", "Caption", UpTimeStr' 'loggingfreespace' MB') select when loggingfreespace < 50 then ok = VRDeleteFile(samba.!log'\log.*') when loggingfreespace < 100 then ok = VRset("CN_Daemons","BackColor","Red") when loggingfreespace < 200 then ok = VRset("CN_Daemons","BackColor","Yellow") otherwise ok = VRset("CN_Daemons","BackColor","SystemWindow") end IF options.!debug == 1 then say time()' _SambaUptime() done' return /*:VRX _SendMsg */ _SendMsg: Buttons.1 = NLVGetMessage( 2 ) Buttons.2 = NLVGetMessage( 3 ) Buttons.0 = 2 Message = "Blurp!" id = VRPrompt( VRWindow(), NLVGetMessage( 85 , CurMachine), "Message", NLVGetMessage( 80 ), "Buttons.", buttons.1, buttons.2 ) MsgFile = SysTempFileName(TempDir'\smbmsg.'??? ) call lineout MsgFile, Message ok = stream(MsgFile,'c','close') say Message address cmd samba.!smbclientexe' --message='CurMachine' 'DebugLevel' <'MsgFile' 2>&1>'samba.!msg /* if rc <> 0 then call _SambaShowError; else */ call _SambaShowMsg ok = SysFileDelete(MsgFile) return /*:VRX _ShowMsg */ _ShowMsg: Buttons.1 = NLVGetMessage(2) Buttons.0 = 1 id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 ) return /*:VRX _TabbedDialogSetup */ _TabbedDialogSetup: IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup started' w = VRLoad( "TDL_1", VRWindowPath(), "SW_DAEMONS" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(18)" ") w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(19)" ") w = VRLoad( "TDL_1", VRWindowPath(), "SW_USERS" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(15)" ") w = VRLoad( "TDL_1", VRWindowPath(), "SW_FILES" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(16)" ") w = VRLoad( "TDL_1", VRWindowPath(), "SW_SERVICE" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(17)" ") w = VRLoad( "TDL_1", VRWindowPath(), "SW_CHKTDB" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(22)" ") w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" ) ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(24)" ") IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup done' return /*:VRX About_Close */ About_Close: call About_Fini return /*:VRX About_Create */ About_Create: call About_Init ok = VRSet("About","Caption", NLVGetMessage(20)) ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2)) SambaTeam.0 = 9 SambaTeam.1 = 'Silvan Scherrer' SambaTeam.2 = 'Herwig Bauernfeind' SambaTeam.3 = 'Vitali Pelenyov' SambaTeam.4 = 'Paul Smedley' SambaTeam.5 = 'Yuri Dario' SambaTeam.6 = 'Alex Taylor' SambaTeam.7 = 'Nikolay Kolosov' SambaTeam.8 = 'All the Samba people' SambaTeam.9 = 'All the netlabs people' ok = VRSet("About","Font", VRGet("SW_SETTINGS","Font")) ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." ) ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(21)) ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer) return /*:VRX About_Fini */ About_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX About_Init */ About_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "Notebook" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX Activate */ Activate: parse arg Nr /* call PushbackAll */ CurrentPageNr = Nr /* ok = VRSet("PB_"Nr,"Font","9.WarpSans Bold") */ /* ok = VRSet("TAB_"Nr,"Top", TabTop-8) ok = VRSet("TAB_"Nr,"Left",TabWidth*(Nr-1)+PageLeft) ok = VRSet("TAB_"Nr,"PicturePath", "#1"||Nr||";#1"||Nr) ok = VRset("DT_PageName", "Caption", VRGet("TAB_"Nr, "UserData")) ok = VRSet("Page_"Nr,"Visible", 1) select when Nr = 1 then ok = VRSet("IPB_paper","PicturePath","#4;#4") when Nr = Pages then ok = VRSet("IPB_paper","PicturePath","#6;#6") otherwise ok = VRSet("IPB_paper","PicturePath","#5;#5") end */ return /*:VRX CB_Debug_Click */ CB_Debug_Click: options.!Debug = VRGet("CB_Debug","set") if options.!Debug then ok = VRREdirectStdIO("ON") else ok = VRREdirectStdIO("OFF") return /*:VRX CB_DetectZombies_Click */ CB_DetectZombies_Click: DetectZombies = VRGet("CB_DetectZombies","set") say 'DetectZombies = "'DetectZombies'"' return /*:VRX CB_NoMsgBox_Click */ CB_NoMsgBox_Click: NoMsgBox = VRGet("CB_NoMsgBox","set") say 'NoMsgBox = "'NoMsgBox'"' return /*:VRX CB_WPSSTARTSTOP_Click */ CB_WPSSTARTSTOP_Click: WPSStartStop = VRGet("CB_WPSStartStop","set") say 'WPSStartStop = "'WPSStartStop'"' return /*:VRX CN_CHKTDB_ContextMenu */ CN_CHKTDB_ContextMenu: if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files" else do RH = VRInfo("Record") OH = VRInfo("Object") if RH <> "" then do ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" ) end end return /*:VRX CN_Daemons_Click */ CN_Daemons_Click: IF options.!debug == 1 then say time()' CN_Daemons_Click() started' NowClickedRecord = VRInfo("Record") say " NowRecord = '"NowClickedRecord"'" say " LastRecord = '"LastClickedRecord"'" if NowClickedRecord <> LastClickedRecord then call _RefreshDaemonsDelay LastClickedRecord = NowClickedRecord IF options.!debug == 1 then say time()' CN_Daemons_Click() done' return /*:VRX CN_Daemons_ContextMenu */ CN_Daemons_ContextMenu: IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() started' if VRInfo("Top") < 400 & VRGet("CN_Daemons", "View") = "Detail" then do say " Going for column modification..." call _ColumnsMenu "CN_Daemons" end else do say " Going for context menu, record = '"VRInfo("Record")"'" call _RefreshDaemonsDelay DRH = VRInfo("Record") DaemonName = "" OH = VRInfo("Object") ok = VRset("ContextMenu_Daemons_Details", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_Tree", "Visible", 1 ) ok = VRset("MItem_9", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_Sort", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_MiniIcons", "Visible", 1 ) ok = VRset("MItem_13", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_Ping", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_Start", "Visible", 1 ) ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 1 ) if DRH <> "" then do DaemonName = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption") ok = VRset("ContextMenu_Daemons_Ping","Visible", 1 ) end select when Words(DaemonName) = 3 & pos("PID ",DaemonName) > 0 then do /* a child process with PID in name */ DaemonName = word(DaemonName,2) ok = VRSet("ContextMenu_Daemons_KillPID", "Caption", NLVGetMessage( 38, DaemonName)) ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 ) end when Words(DaemonName) = 1 & (pos("mbd.exe",Daemonname) > 0 | pos("winbindd.exe",Daemonname) > 0) then do /* on root process */ parse var DaemonName DaemonName'.exe' if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do ok = VRSet("ContextMenu_Daemons_Shutdown", "Caption", NLVGetMessage( 33, DaemonName)) ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 ) end end when pos("\", DaemonName) > 0 then do /* we are on a file */ ok = VRset("MItem_13", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 ) end otherwise do /* we are on a user */ ok = VRset("MItem_13", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 ) ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 ) end end say ' Daemon is "'DaemonName'"' say ' DaemonView = "'DaemonView'"' if VRGet("CN_Daemons","View") = "Detail" then do ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 0) ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 1) end else do ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 1) ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 0) end DaemonView = VRGet("CN_Daemons","View") ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" ) end IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() done' return /*:VRX CN_Files_ContextMenu */ CN_Files_ContextMenu: if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files" else do RH = VRInfo("Record") OH = VRInfo("Object") if RH <> "" then do ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" ) end end return /*:VRX CN_Service_ContextMenu */ CN_Service_ContextMenu: if VRInfo("Top") < 400 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service" else do ok = VRSet("TM_refresh","Enabled", 0) SRH = VRInfo("Record") OH = VRInfo("Object") if SRH <> "" then do Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH) say ' Service is "'Service'"' ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" ) end end return /*:VRX CN_smbtree_Click */ CN_smbtree_Click: rh = VRInfo('Record') if VRMethod( 'CN_SMBTREE', "ValidateRecord", rh) <> 1 then return userdata = VRMethod('CN_smbtree', 'GetRecordAttr', rh, 'UserData') parse var userdata . '|' userdata ok = VRset("Main","StatusText", userdata) return /*:VRX CN_smbtree_ContextMenu */ CN_smbtree_ContextMenu: if VRInfo("Top") < 400 & VRGet("CN_smbtree", "View") = "Detail" then call _ColumnsMenu "CN_smbtree" else do RH = VRInfo("Record") if RH <> "" then do CurMachine = word(VRMethod( "CN_smbtree", "GetRecordAttr", RH, "Caption" ),1) ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" ) end end return /*:VRX CN_Users_ContextMenu */ CN_Users_ContextMenu: if VRInfo("Top") < 400 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users" else do RH = VRInfo("Record") OH = VRInfo("Object") if RH <> "" then do CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH ) ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" ) end end return /*:VRX Columns_01_Click */ Columns_01_Click: call _ColumnShow return /*:VRX Columns_02_Click */ Columns_02_Click: call _ColumnShow return /*:VRX Columns_03_Click */ Columns_03_Click: call _ColumnShow return /*:VRX Columns_04_Click */ Columns_04_Click: call _ColumnShow return /*:VRX Columns_05_Click */ Columns_05_Click: call _ColumnShow return /*:VRX Columns_06_Click */ Columns_06_Click: call _ColumnShow return /*:VRX Columns_07_Click */ Columns_07_Click: call _ColumnShow return /*:VRX Columns_08_Click */ Columns_08_Click: call _ColumnShow return /*:VRX Columns_09_Click */ Columns_09_Click: call _ColumnShow return /*:VRX Columns_10_Click */ Columns_10_Click: call _ColumnShow return /*:VRX Columns_11_Click */ Columns_11_Click: call _ColumnShow return /*:VRX Columns_12_Click */ Columns_12_Click: call _ColumnShow return /*:VRX Columns_13_Click */ Columns_13_Click: call _ColumnShow return /*:VRX Columns_14_Click */ Columns_14_Click: call _ColumnShow return /*:VRX ContextMenu_Daemons_Details_Click */ ContextMenu_Daemons_Details_Click: IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started' ok = VRset("CN_Daemons","View","Detail") ok = VRset("ContextMenu_Daemons_Tree","Enabled",1) ok = VRset("ContextMenu_Daemons_Details","Enabled",0) ok = VRSet("TM_refresh","Enabled", 1) IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done' return /*:VRX ContextMenu_Daemons_KillPID_Click */ ContextMenu_Daemons_KillPID_Click: Msg.Text = NLVGetMessage(39, DaemonName) Msg.Type = 'Q' if _MsgYesNo() = 1 then do ok = PRKillProcess("1",DaemonName ) if ok = 0 then say ", success!"; else say ", error "ok /* say 'kill -9 'DaemonName address cmd 'kill -9 'DaemonName */ end ok = VRSet("TM_Refresh","Enabled", 1) return /*:VRX ContextMenu_Daemons_MiniIcons_Click */ ContextMenu_Daemons_MiniIcons_Click: advanced.!bigicons = \advanced.!bigicons ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons) ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons) ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons) ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons) return /*:VRX ContextMenu_Daemons_Ping_Click */ ContextMenu_Daemons_Ping_Click: ok = VRSet("Main", 'Pointer', 'Wait' ) address cmd samba.!smbcontrolexe' 'DaemonName' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg call _SambaShowMsg "section table registered" ok = VRSet("Main", 'Pointer', '' ) ok = VRSet("TM_refresh","Enabled", 1) return /*:VRX ContextMenu_Daemons_Shutdown_Click */ ContextMenu_Daemons_Shutdown_Click: Msg.Text = NLVGetMessage(34, DaemonName) Msg.Type = 'Q' if _MsgYesNo() = 1 then do address cmd samba.!smbcontrolexe' 'DaemonName' shutdown 2>'samba.!error' 1>'samba.!msg call _SambaShowMsg "section table registered tdb" end ok = VRSet("TM_Refresh","Enabled", 1) return /*:VRX ContextMenu_Daemons_Sort_Click */ ContextMenu_Daemons_Sort_Click: window = VRLoadSecondary( "SW_SORT", "W" ) return /*:VRX ContextMenu_Daemons_Start_Click */ ContextMenu_Daemons_Start_Click: Msg.Text = NLVGetMessage(37, DaemonName) Msg.Type = 'Q' if _MsgYesNo() = 1 then do say samba.!smbcmd' start 'DaemonName address cmd samba.!smbcmd' start 'DaemonName end ok = VRSet("TM_Refresh","Enabled", 1) return /*:VRX ContextMenu_Daemons_Tree_Click */ ContextMenu_Daemons_Tree_Click: IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started' ok = VRset("CN_Daemons","View","IconTree") ok = VRset("ContextMenu_Daemons_Tree","Enabled",0) ok = VRset("ContextMenu_Daemons_Details","Enabled",1) ok = VRSet("TM_refresh","Enabled", 1) IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done' return /*:VRX ContextMenu_Files_Sort_Click */ ContextMenu_Files_Sort_Click: window = VRLoadSecondary( "SW_SORT", "W" ) return /*:VRX ContextMenu_Service_CloseShare_Click */ ContextMenu_Service_CloseShare_Click: Msg.Text = NLVGetMessage(75, Service) Msg.Type = 'Q' if _MsgYesNo() = 1 then do address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */ /* No usable output from Samba here ! */ /* call _SambaShowMsg */ Msg.Text = NLVGetMessage(76, Service) Msg.Type = 'I' call _ShowMsg end ok = VRSet("TM_refresh","Enabled", 1) return /*:VRX ContextMenu_Service_Sort_Click */ ContextMenu_Service_Sort_Click: window = VRLoadSecondary( "SW_SORT", "W" ) return /*:VRX ContextMenu_Tree_Details_Click */ ContextMenu_Tree_Details_Click: ok = VRset("CN_smbtree","View","Detail") ok = VRset("ContextMenu_Tree_Tree","Enabled",1) ok = VRset("ContextMenu_Tree_Details","Enabled",0) ok = VRset("ContextMenu_Tree_Icons","Enabled",1) ok = VRset("TM_Throbber", "Enabled", 1) ok = VRset("Pict_Throbber", "Visible", 0) call _RefreshTree return /*:VRX ContextMenu_Tree_Icons_Click */ ContextMenu_Tree_Icons_Click: ok = VRset("CN_smbtree","View","Icon") ok = VRset("ContextMenu_Tree_Icons","Enabled",0) ok = VRset("ContextMenu_Tree_Tree","Enabled",1) ok = VRset("ContextMenu_Tree_Details","Enabled",1) ok = VRset("TM_Throbber", "Enabled", 1) ok = VRset("Pict_Throbber", "Visible", 1) call _RefreshTree return /*:VRX ContextMenu_Tree_MiniIcons_Click */ ContextMenu_Tree_MiniIcons_Click: advanced.!bigicons = \advanced.!bigicons ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons) ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons) ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons) ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons) return /*:VRX ContextMenu_Tree_SendMsg_Click */ ContextMenu_Tree_SendMsg_Click: call _SendMsg return /*:VRX ContextMenu_Tree_Sort_Click */ ContextMenu_Tree_Sort_Click: window = VRLoadSecondary( "SW_SORT", "W" ) return /*:VRX ContextMenu_Tree_Tree_Click */ ContextMenu_Tree_Tree_Click: ok = VRset("CN_smbtree","View","IconTree") ok = VRset("ContextMenu_Tree_Tree","Enabled",0) ok = VRset("ContextMenu_Tree_Details","Enabled",1) ok = VRset("ContextMenu_Tree_Icons","Enabled",1) ok = VRset("TM_Throbber", "Enabled", 1) ok = VRset("Pict_Throbber", "Visible", 1) call _RefreshTree return /*:VRX ContextMenu_Users_SendMsg_Click */ ContextMenu_Users_SendMsg_Click: call _SendMsg return /*:VRX ContextMenu_Users_Sort_Click */ ContextMenu_Users_Sort_Click: window = VRLoadSecondary( "SW_SORT", "W" ) return /*:VRX DT_STATUSBAR_ContextMenu */ DT_STATUSBAR_ContextMenu: ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText")) return /*:VRX Fini */ Fini: window = VRWindow() call VRSet window, "Visible", 0 drop window return 0 /*:VRX GetBootDrive */ GetBootDrive: /* Use SysBootDrive if possible */ If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2) Else Return SysBootDrive() /*:VRX Halt */ Halt: signal _VREHalt return /*:VRX Init */ Init: window = VRWindow() call VRMethod window, "CenterWindow" call VRSet window, "Visible", 0 call VRMethod window, "Activate" drop window return /*:VRX LB_SortFields_Click */ LB_SortFields_Click: call _ContainerSort return /*:VRX Main_Activate */ Main_Activate: call TM_Refresh_Trigger ok = VRset("TM_Refresh", "Enabled", 1) return /*:VRX Main_Close */ Main_Close: call Quit return /*:VRX Main_Create */ Main_Create: options.!debug = 0 if options.!debug == 1 then do ok = VRRedirectStdIO("ON") say time()' Main_Create started' end else ok = VRRedirectStdIO("OFF") call _LoadOtherFuncs call _InitTempDir call _IniRead call _NLVSetup call _TabbeddialogSetup call _SambaInit if \WPSStartStop then call _CreateSmbStarter if _SambaRunning() then call _SambaFindPIDfile call _ContainerInit call _GUIInit /* str = 'call TAB_'CurrentPageNr'_Click'; say str interpret str say 'Done 'str if CurrentPageNr <> 5 then do ok = VRSet("TM_Throbber", "Enabled", 1) call _RefreshTree end */ ok = VRMethod("PB_Refresh","SetFocus") if options.!debug == 1 then say time()' Main_Create done' return /*:VRX Main_Deactivate */ Main_Deactivate: ok = VRset("TM_Refresh", "Enabled", 0) return /*:VRX Main_Resize */ Main_Resize: IF options.!debug == 1 THEN SAY time()' Main_Resize started' ok = VRSet("Main","Painting", 0) /* Basic measurements */ main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */ main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */ /* if main_iheight < 5500 then ok = VRSet("Main","Height",6200) */ sbar_height = 209 /* Height of status-bar */ marginx2 = margin * 2 /* Common margin around controls */ pbtn_dist = 980 pbtn_nr = 4 pbtn_pos = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin pbtn_height = 400 /* Height of the panels' internal button areas */ pbtn_width = 940 pane_height = main_iheight- sbar_height - pbtn_height - margin * 7 /* Height of notebook */ pane_width = main_iwidth - marginx2 /* Width of the notebook panel */ /* Tabbed Dialog */ ok = VRset("TDL_1", "Top", marginx2 ) ok = VRset("TDL_1", "Left", margin ) ok = VRset("TDL_1", "Width", pane_width ) ok = VRset("TDL_1", "Height", pane_height ) /* Statusbar */ ok = VRSet("GB_STATUSBAR", "Left", margin ) ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin ) ok = VRSet("GB_STATUSBAR", "Height",sbar_height ) ok = VRSet("GB_STATUSBAR", "Width", pane_width ) ok = VRSet("DT_STATUSBAR", "Top", 12 ) ok = VRSet("DT_STATUSBAR", "Left", 12 ) ok = VRSet("DT_STATUSBAR", "Height",sbar_height- 24) ok = VRSet("DT_STATUSBAR", "Width", pane_width - 24) ok = VRSet("PB_Refresh","top", pane_height + margin * 4 ) ok = VRSet("PB_Help", "top", pane_height + margin * 4 ) ok = VRSet("PB_Cancel", "top", pane_height + margin * 4 ) ok = VRSet("PB_About", "top", pane_height + margin * 4 ) ok = VRSet("PB_Refresh","left",pbtn_pos + pbtn_dist * (pbtn_nr - 4)) ok = VRSet("PB_Help", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 3)) ok = VRSet("PB_About", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 2)) ok = VRSet("PB_Cancel", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 1)) ok = VRset("GB_CHKTDB","Top", margin ) ok = VRset("GB_CHKTDB","Left", marginx2) ok = VRset("GB_CHKTDB","Width", pane_width - 760) ok = VRset("GB_CHKTDB","Height", pane_height- 1020) ok = VRset("CN_CHKTDB","Top", margin) ok = VRset("CN_CHKTDB","Left", margin) ok = VRset("CN_CHKTDB","Width", pane_width - 760 - marginx2 ) ok = VRset("CN_CHKTDB","Height", pane_height- 1020- marginx2 ) ok = VRset("GB_USERS","Top", margin ) ok = VRset("GB_USERS","Left", marginx2) ok = VRset("GB_USERS","Width", pane_width - 760) ok = VRset("GB_USERS","Height", pane_height- 1020) ok = VRset("CN_USERS","Top", margin) ok = VRset("CN_USERS","Left", margin) ok = VRset("CN_USERS","Width", pane_width - 760 - marginx2 ) ok = VRset("CN_USERS","Height", pane_height- 1020- marginx2 ) ok = VRset("GB_FILES","Top", margin ) ok = VRset("GB_FILES","Left", marginx2) ok = VRset("GB_FILES","Width", pane_width - 760) ok = VRset("GB_FILES","Height", pane_height- 1020) ok = VRset("CN_FILES","Top", margin) ok = VRset("CN_FILES","Left", margin) ok = VRset("CN_FILES","Width", pane_width - 760 - marginx2 ) ok = VRset("CN_FILES","Height", pane_height- 1020- marginx2 ) ok = VRset("GB_SERVICE","Top", margin ) ok = VRset("GB_SERVICE","Left", marginx2) ok = VRset("GB_SERVICE","Width", pane_width - 760) ok = VRset("GB_SERVICE","Height", pane_height- 1020) ok = VRset("CN_SERVICE","Top", margin) ok = VRset("CN_SERVICE","Left", margin) ok = VRset("CN_SERVICE","Width", pane_width - 760 - marginx2 ) ok = VRset("CN_SERVICE","Height", pane_height- 1020- marginx2 ) ok = VRset("GB_DAEMONS","Top", margin ) ok = VRset("GB_DAEMONS","Left", marginx2) ok = VRset("GB_DAEMONS","Width", pane_width - 760) ok = VRset("GB_DAEMONS","Height", pane_height- 1020) ok = VRset("CN_DAEMONS","Top", margin) ok = VRset("CN_DAEMONS","Left", margin) ok = VRset("CN_DAEMONS","Width", pane_width - 760 - margin*4 - pbtn_width) ok = VRset("CN_DAEMONS","Height", pane_height- 1020 - marginx2 ) ok = VRSet("PB_START", "Top", pbtn_height*2 - marginx2) ok = VRSet("PB_STOP", "Top", pbtn_height*3 - marginx2) ok = VRSet("PB_Restart","Top", pbtn_height*4 - marginx2) ok = VRSet("PB_Reload", "Top", pbtn_height*5 - marginx2) ok = VRSet("PB_DelLogs","Top", pbtn_height*6 - marginx2) ok = VRSet("PB_START", "Left", pane_width - 760 - marginx2 - pbtn_width) ok = VRSet("PB_STOP", "Left", pane_width - 760 - marginx2 - pbtn_width) ok = VRSet("PB_Restart","Left", pane_width - 760 - marginx2 - pbtn_width) ok = VRSet("PB_Reload", "Left", pane_width - 760 - marginx2 - pbtn_width) ok = VRSet("PB_DelLogs","Left", pane_width - 760 - marginx2 - pbtn_width) ok = VRset("GB_SMBTREE","Top", margin ) ok = VRset("GB_SMBTREE","Left", marginx2) ok = VRset("GB_SMBTREE","Width", pane_width - 760) ok = VRset("GB_SMBTREE","Height", pane_height- 1020) ok = VRset("CN_SMBTREE","Top", margin) ok = VRset("CN_SMBTREE","Left", margin) ok = VRset("CN_SMBTREE","Width", pane_width - 760 - marginx2 ) ok = VRset("CN_SMBTREE","Height", pane_height- 1020- marginx2 ) ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 ) ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 ) ok = VRset("GB_SETTINGS","Top", margin ) ok = VRset("GB_SETTINGS","Left", marginx2) ok = VRset("GB_SETTINGS","Width", pane_width - 760) ok = VRset("GB_SETTINGS","Height", pane_height- 1020) /* check and empty event queue, trash spurious resize events */ EventString = '' TrashedResize = 0 do until EventString = 'nop' EventString = VREvent('N') if EventString <> 'nop' then do if EventString = 'CALL Main_Resize' then TrashedResize = 1 else interpret eventString end end if TrashedResize then CALL Main_Resize ok = VRSet("Main", "Painting", 1) IF options.!debug == 1 THEN SAY time()' Main_Resize done' return /*:VRX Page1_Create */ Page1_Create: Return /*:VRX Page1_Init */ Page1_Init: call _ContainerInit return /*:VRX Page2_Create */ Page2_create: Return /*:VRX Page2_init */ Page2_init: return /*:VRX Page3_Create */ Page3_create: Return /*:VRX Page3_Init */ Page3_Init: return /*:VRX Page4_Create */ Page4_Create: Return /*:VRX Page4_init */ Page4_init: return /*:VRX Page5_Create */ Page5_Create: return /*:VRX Page5_Init */ Page5_Init: return /*:VRX Paper_Init */ Paper_Init: ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 )) ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 )) ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420) return /*:VRX PB_About_Click */ PB_About_Click: window = VRLoadSecondary( "About", "W" ) return /*:VRX PB_AboutOK_Click */ PB_AboutOK_Click: call About_Close return /*:VRX PB_Cancel_Click */ PB_Cancel_Click: say 'start PB_Cancel_Click' Call Quit say 'done PB_Cancel_Click' return /*:VRX PB_DELLOGS_Click */ PB_DELLOGS_Click: call VRSet VRWindow(), 'Pointer', 'Wait' /* Fixme - this needs to be read from smb.conf */ samba.!logdir = ETC'\samba\log' ok = SysFileTree(samba.!logdir'\log.*', logs.,'FO') do I = 1 to logs.0 ok = VRMethod( "CN_Daemons", "GetRecordList", "All", "handle." ) KeepLog = 0 do J = 1 to handle.0 CurPID = VRMethod("CN_Daemons", "GetFieldData", handle.J, DPidsFH) if pos(CurPID,logs.I) > 0 then KeepLog = 1 end if KeepLog = 0 then ok = SysFileDelete(logs.I) end call VRSet VRWindow(), 'Pointer', '' return /*:VRX PB_Help_Click */ PB_Help_Click: ok = VRMethod("Main", "InvokeHelp" ) return /*:VRX PB_Refresh_Click */ PB_Refresh_Click: IF options.!debug == 1 then say time()' PB_Refresh_Click() started' ok = SysSleep(0.3) say " CurrentPageNr = "CurrentPageNr select when CurrentPageNr = 2 then do ok = VRset("Pict_Throbber", "Visible", 1) ok = VRset("TM_Throbber", "Enabled", 1) call _RefreshTree end when CurrentPageNr = 6 then do call _ChkTDB end otherwise call _Refresh end IF options.!debug == 1 then say time()' PB_Refresh_Click() done' return /*:VRX PB_RELOAD_Click */ PB_RELOAD_Click: call VRSet VRWindow(), 'Pointer', 'Wait' if WPSStartStop then do ok = SysOpenObject('', 'DEFAULT', 1) end else do call lineout samba.!bin"\smbstart", "reload" ok = stream(samba.!bin"\reload","c","close") end ok = VRSet("TM_Refresh","Delay", 2000) call VRSet VRWindow(), 'Pointer', '' return /*:VRX PB_RESTART_Click */ PB_RESTART_Click: call VRSet VRWindow(), 'Pointer', 'Wait' if WPSStartStop then do ok = SysOpenObject('', 'DEFAULT', 1) end else do call lineout samba.!bin"\restart", "restart" ok = stream(samba.!bin"\restart","c","close") end ok = VRSet("TM_Refresh","Delay", 1000) call VRSet VRWindow(), 'Pointer', '' return /*:VRX PB_Sort_Cancel_Click */ PB_Sort_Cancel_Click: ok = VRset( Container, "DetailSort", Old.SortField ) ok = VRSet( Container, "Sort", Old.SortOrder ) ok = VRMethod( Container, "SortRecords" ) drop Old. call SW_SORT_Close return /*:VRX PB_Sort_OK_Click */ PB_Sort_OK_Click: drop Old. call SW_SORT_Close return /*:VRX PB_START_Click */ PB_START_Click: say "IPB_Start_Click started" call VRSet VRWindow(), 'Pointer', 'Wait' if WPSStartStop then do ok = SysOpenObject('', 'DEFAULT', 1) end else do call lineout samba.!bin"\smbstart", "smbstart" ok = stream(samba.!bin"\smbstart","c","close") end ok = VRSet("TM_Refresh","Delay", 1000) call VRSet VRWindow(), 'Pointer', '' say "IPB_Start_Click done" return /*:VRX PB_STOP_Click */ PB_STOP_Click: say "IPB_Stop_Click started" call VRSet VRWindow(), 'Pointer', 'Wait' if WPSStartStop then do ok = SysOpenObject('', 'DEFAULT', 1) end else do call lineout samba.!bin"\smbstop", "smbstop" ok = stream(samba.!bin"\smbstop","c","close") end ok = VRSet("TM_Refresh","Delay", 1000) call VRSet VRWindow(), 'Pointer', '' say "IPB_Stop_Click done" return /*:VRX PushbackAll */ PushbackAll: Pages = 6 /* Tab distance from top */ TabTop = 20 TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 ) TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 ) /* Page Position */ PageLeft = 120 PageTop = PageLeft + TabTop + 330 /* Page size */ PageHeight = 3000 PageWidth = 3000 call beep 880, 20 /* ok = VRset("DT_PageName", "Caption", "") ok = VRSet("GB_Main","Left", 0) ok = VRSet("GB_Main","Top", TabTop+230) do I = 1 to Pages ok = VRSet("TAB_"I,"Top", TabTop) ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I) ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft) ok = VRSet("TAB_"I,"Width",TabWidth) ok = VRSet("TAB_"I,"Height",TabHeight) ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600)) ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450)) ok = VRSet("Page_"I,"Left", PageLeft) ok = VRSet("Page_"I,"Top", PageTop) ok = VRSet("Page_"I,"Visible", 0) ok = VRSet("Page_"I,"BackColor", "") end */ return /*:VRX Quit */ Quit: call VRSet VRWindow(), 'Pointer', 'Wait' call _IniWrite ok = VRRedirectStdIO("OFF") call _SambaFinish ok = SysFileDelete(smbdoutput) call lineout samba.!bin"\quit", "quit" ok = stream(samba.!bin"\quit","c","close") ok = SysSleep(1) ok = SysDestroyObject('') ok = SysFileDelete(samba.!bin'\smbstarter.cmd') ok = SysFileDelete(samba.!bin'\quit') call VRSet VRWindow(), 'Pointer', '' window = VRWindow() call VRSet window, "Shutdown", 1 drop window return /*:VRX RB_Sort_Ascending_Click */ RB_Sort_Ascending_Click: SortOrder = "Ascending" call _ContainerSort return /*:VRX RB_Sort_Descending_Click */ RB_Sort_Descending_Click: SortOrder = "Descending" call _ContainerSort return /*:VRX RB_Sort_None_Click */ RB_Sort_None_Click: SortOrder = "None" call _ContainerSort return /*:VRX SPIN_Intervall_Change */ SPIN_Intervall_Change: Intervall = VRGet("SPIN_Intervall","Value") ok = VRSet("TM_Refresh","Delay", Intervall * 1000) return /*:VRX SPIN_IntervallMin_Change */ SPIN_IntervallMin_Change: IntervallMin = VRGet("SPIN_IntervallMin","Value") return /*:VRX SW_CHKTDB_Close */ SW_CHKTDB_Close: call SW_CHKTDB_Fini return /*:VRX SW_CHKTDB_Create */ SW_CHKTDB_Create: call SW_CHKTDB_Init return /*:VRX SW_CHKTDB_Fini */ SW_CHKTDB_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_CHKTDB_Init */ SW_CHKTDB_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "Notebook" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_DAEMONS_Close */ SW_DAEMONS_Close: call SW_DAEMONS_Fini return /*:VRX SW_DAEMONS_Create */ SW_DAEMONS_Create: call SW_DAEMONS_Init return /*:VRX SW_DAEMONS_Fini */ SW_DAEMONS_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_DAEMONS_Init */ SW_DAEMONS_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "Notebook" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_FILES_Close */ SW_FILES_Close: call SW_FILES_Fini return /*:VRX SW_FILES_Create */ SW_FILES_Create: call SW_FILES_Init return /*:VRX SW_FILES_Fini */ SW_FILES_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_FILES_Init */ SW_FILES_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "TDL" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_SERVICE_Close */ SW_SERVICE_Close: call SW_SERVICE_Fini return /*:VRX SW_SERVICE_Create */ SW_SERVICE_Create: call SW_SERVICE_Init return /*:VRX SW_SERVICE_Fini */ SW_SERVICE_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_SERVICE_Init */ SW_SERVICE_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "TDL" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_SETTINGS_Close */ SW_SETTINGS_Close: call SW_SETTINGS_Fini return /*:VRX SW_SETTINGS_Create */ SW_SETTINGS_Create: call SW_SETTINGS_Init return /*:VRX SW_SETTINGS_Fini */ SW_SETTINGS_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_SETTINGS_Init */ SW_SETTINGS_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "TDL" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_SMBTREE_Close */ SW_SMBTREE_Close: call SW_SMBTREE_Fini return /*:VRX SW_SMBTREE_Create */ SW_SMBTREE_Create: call SW_SMBTREE_Init return /*:VRX SW_SMBTREE_Fini */ SW_SMBTREE_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_SMBTREE_Init */ SW_SMBTREE_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "TDL" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_SMBTREE_Init_Content */ SW_SMBTREE_Init_Content: ok = VRset("Pict_Throbber", "Visible", 1) ok = VRset("TM_Throbber", "Enabled", 1) call _RefreshTree return /*:VRX SW_SORT_Close */ SW_SORT_Close: call SW_SORT_Fini return /*:VRX SW_SORT_Create */ SW_SORT_Create: call SW_SORT_Init CALL NLVSetText 'SW_SORT', 'Caption', 35 CALL NLVSetText 'PB_Sort_OK', 'Caption', 2 CALL NLVSetText 'PB_Sort_Cancel', 'Caption', 3 CALL NLVSetText 'RB_Sort_Ascending', 'Caption', 90 CALL NLVSetText 'RB_Sort_Descending', 'Caption', 91 CALL NLVSetText 'RB_Sort_None', 'Caption', 92 Container = OH say OH say Container ok = VRMethod(Container, "GetFieldList", "Fields." ) SortOrder = "None" do I = 1 to Fields.0 ok = VRMethod("LB_SortFields","AddString", VRMethod(Container, "GetFieldAttr", fields.I, "Title" )) end Old.SortField = VRGet( Container, "DetailSort" ) Old.SortOrder = VRGet( Container, "Sort" ) say Old.SortField say Old.SortOrder return /*:VRX SW_SORT_Fini */ SW_SORT_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_SORT_Init */ SW_SORT_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "Notebook" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX SW_USERS_Close */ SW_USERS_Close: call SW_USERS_Fini return /*:VRX SW_USERS_Create */ SW_USERS_Create: call SW_USERS_Init return /*:VRX SW_USERS_Fini */ SW_USERS_Fini: window = VRInfo( "Window" ) call VRDestroy window drop window return /*:VRX SW_USERS_Init */ SW_USERS_Init: window = VRInfo( "Object" ) if( \VRIsChildOf( window, "Notebook" ) ) then do call VRMethod window, "CenterWindow" call VRSet window, "Visible", 1 call VRMethod window, "Activate" end drop window return /*:VRX TDL_1_PageSelected */ TDL_1_PageSelected: page = VRInfo("Page") CurrentPageNr = page ok = VRSet("TM_RefreshDaemons","Enabled", 0) ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText")) /* call _TabsStrip */ select when page = 1 then do /* daemons */ ok = VRSet("TM_RefreshDaemons","Enabled", 1) ok = VRSet("TM_RefreshDaemons","Delay", 3000) end when page = 2 then do /* smbtree */ ok = VRMethod( "CN_SMBTree", "GetRecordList", "All", "handle." ) /* if the page is empty, populate it */ if handle.0 = 0 then call PB_Refresh_Click end when page = 3 then do /* Users */ nop end when page = 4 then do /* files */ nop end when page = 5 then do /* service */ nop end when page = 6 then do /* chkTDB */ say "ChkTDB" call _ChkTDB end when page = 7 then do /* Settings */ nop end otherwise nop end return /*:VRX TM_Refresh_Trigger */ TM_Refresh_Trigger: /* call beep 1200, 20 */ ok = VRSet("TM_Refresh","Delay", Intervall * 1000) call _Refresh return /*:VRX TM_RefreshDaemons_Trigger */ TM_RefreshDaemons_Trigger: ok = VRSet("TM_RefreshDaemons","Delay", 3000) call _RefreshDaemons return /*:VRX TM_RefreshTreeDisplay_Trigger */ TM_RefreshTreeDisplay_Trigger: select when RefreshMode = "TREE" then do call _RefreshTreeDisplay end when RefreshMode = "SHARE" then do call _AddSharesDisplay end otherwise say "RefreshMode = "RefreshMode end return /*:VRX TM_Throbber_Trigger */ TM_Throbber_Trigger: pIdx = VRGet("Pict_Throbber","PicturePath") parse var pIdx '#' pidx pidx = pidx + 1 if pidx = 122 then pidx = 111 ok = VRSet("Pict_Throbber","PicturePath","#"pidx) return