Changeset 641 for trunk/guitools/shared/smbtree.vrs
- Timestamp:
- Oct 3, 2011, 9:44:30 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/guitools/shared/smbtree.vrs
r640 r641 19 19 20 20 if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0 21 if UserCred = '-N' then UserCred = ''21 if UserCred = '-N' then UserCred = '' 22 22 23 23 ok = VRMethod("CN_smbtree", "RemoveRecord", "ALL") … … 73 73 else do /* Fill records for details view */ 74 74 ok = VRSet("Main", 'Pointer', 'Wait' ) 75 /* Get all IP addresses of the machine */ 76 IPStr = _GetMachineIP(machine) 77 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr) 75 /* Get NMBLookup Status for machine */ 76 NMBStatus = _GetMachineNMBSTatus(machine) 77 parse var NMBStatus IPStr'|'MAC '|' Roles; drop NMBStatus 78 if pos("PDC",Roles) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#63:PMWP.DLL") 79 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr,MBFH, Roles, MacFH,MAC) 80 81 /* FIXME: Possibly obsolete */ 78 82 parse var IPStr MachineIP ',' . 79 83 if strip(MachineIP) = "" then MachineIP = machine 84 80 85 ok = VRSet("Main", 'Pointer', '<default>' ) 81 86 … … 87 92 parse var smbline "Domain=["WorkGroup"] OS=["OS"] Server=["Version"]"Rest 88 93 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, OSFH, OS, VersionFH, Version, WorkgroupFH, WorkGroup) 89 90 /* Find out server role, MAC */91 MACRoles = _GetMachineMACRoles(machineIP)92 parse var MACRoles MAC '|' Roles; drop MACRoles93 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, MBFH, Roles, MacFH,MAC)94 if pos("PDC",Roles) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#63:PMWP.DLL")95 94 end 96 95 end … … 169 168 if smbmachine.0 = 0 then do /* we are done, no more files around, cleanup, disable Timer and exit */ 170 169 RefreshMode = "" 171 ok = VRset("TM_RefreshTreeDisplay","Enabled",0) 170 ok = VRset("TM_RefreshTreeDisplay","Enabled", 0) 171 ok = VRSet("TM_RefreshTreeDisplay","Delay", 1000) 172 172 ok = VRSet("CN_smbtree","Enabled", 1) 173 ok = VRSet("CN_smbtree", "Painting", 0 174 ok = VRSet("CN_smbtree", "Painting", 1 173 ok = VRSet("CN_smbtree", "Painting", 0 ) 174 ok = VRSet("CN_smbtree", "Painting", 1 ) 175 175 say time()' _AddSharesDisplay() completed' 176 176 return /* exit here */ 177 177 end 178 else say ' 'smbmachine.0' file(s) to process.' 178 else do 179 say ' 'smbmachine.0' file(s) to process.' 180 if smbmachine.0 = 1 then ok = VRSet("TM_RefreshTreeDisplay", "Delay", VRGet("TM_RefreshTreeDisplay", "Delay") * 2) 181 end 179 182 180 183 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N' … … 186 189 stat = stream(smbmachine.I,'c','open read') 187 190 say '"'stat'"' 188 191 if stat = "READY:" & smbmachine.0 = 1 then do /* We just found out we are processing the last machine */ 192 ok = VRSet("TM_RefreshTreeDisplay","Delay", 1000) 193 end 189 194 infoline = "" 190 195 if stat = "READY:" then do /* we found a readable output file */ … … 329 334 330 335 ok = VRSet("Main", 'Pointer', 'Wait' ) 331 /* Find out IPs */ 332 IPStr = _GetMachineIP(machine) 333 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr) 334 parse var IPStr MachineIP ',' . 335 if strip(MachineIP) = "" then MachineIP = machine 336 337 /* Get NMBLookup Status for machine */ 338 NMBStatus = _GetMachineNMBSTatus(machine) 339 parse var NMBStatus IPStr'|'MAC '|' Roles; drop NMBStatus 340 if pos("PDC",Roles) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#63:PMWP.DLL") 341 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr,MBFH, Roles, MacFH,MAC) 342 336 343 ok = VRSet("Main", 'Pointer', '<default>' ) 337 338 /* Find out server role, MAC */339 MACRoles = _GetMachineMACRoles(machineIP)340 parse var MACRoles MAC '|' Roles; drop MACRoles341 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, MBFH, Roles, MacFH,MAC)342 if pos("PDC",Roles) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#63:PMWP.DLL")343 344 344 345 say time()' _AddSharesDisplay() success and cleanup' … … 360 361 _GetMachinehandle: procedure /* get recordhandle by machine name (also works for workgroups) */ 361 362 Machine = translate(arg(1)) 362 363 say ' _GetMachineHandle("'Machine'") started.' 363 364 ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.) 364 365 match = 0 … … 376 377 end 377 378 if match = 0 then rh.I = "" /* return an empty handle, if there was no match */ 378 say ' Handle for "'Machine'"= "'rh.I'"'379 say ' _GetMachineHandle("'Machine'") done, handle = "'rh.I'"' 379 380 return rh.I 380 381 … … 406 407 _AddWorkGroup: procedure expose WorkGroupFH 407 408 workgroup = arg(1) 409 say ' _AddWorkGroup("'workgroup'") started.' 408 410 wgh= VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL") 409 411 ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup) … … 411 413 ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1) 412 414 ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|") 415 say ' _AddWorkGroup("'workgroup'") done.' 413 416 return wgh 414 417 … … 474 477 return MAC'|'Roles 475 478 479 /*:VRX _GetMachineNMBStatus 480 */ 481 _GetMachineNMBStatus: procedure expose debuglevel samba. 482 machine = arg(1) /* name only allowed */ 483 say ' 'samba.!nmblookupexe' -S 'machine' 'debuglevel' >'samba.!msg 484 address cmd samba.!nmblookupexe' -S 'machine' 'debuglevel' >'samba.!msg 485 ok = file2stem(samba.!msg,"nmblookup.") 486 IPStr = "" 487 Roles = "" 488 MAC = 'xx-xx-xx-xx-xx-xx' 489 do I = 1 to nmblookup.0 490 select 491 when pos(machine'<',nmblookup.I) > 0 then do 492 parse var nmblookup.i ip . 493 ip = strip(ip) 494 if pos(ip, ipstr) = 0 then ipstr = ipstr||ip',' 495 end 496 when pos('<1c>', nmblookup.I) > 0 then Roles = Roles||"PDC," /* # */ 497 when pos('<1b>', nmblookup.I) > 0 then Roles = Roles||"LMB," /* + */ 498 when pos('<1d>', nmblookup.I) > 0 then Roles = Roles||"DMB," /* * */ 499 when pos('MAC', nmblookup.I) > 0 then do 500 parse var nmblookup.I . '=' MAC 501 MAC = strip(MAC) 502 end 503 otherwise nop 504 end 505 end 506 Roles = strip(Roles,,',') 507 if Roles = "" then Roles = "Workstation" 508 ipstr = strip(ipstr,,',') 509 return IPStr'|'MAC'|'Roles 510 476 511 /*:VRX file2stem 477 512 */
Note:
See TracChangeset
for help on using the changeset viewer.