Ignore:
Timestamp:
Oct 3, 2011, 9:44:30 AM (14 years ago)
Author:
Herwig Bauernfeind
Message:

GUI-Tools: EVFSGUI 2.5.x: More work done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/shared/smbtree.vrs

    r640 r641  
    1919
    2020    if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0
    21     if UserCred = '-N' then UserCred = ''
     21    if UserCred  = '-N' then UserCred = ''
    2222
    2323    ok = VRMethod("CN_smbtree", "RemoveRecord", "ALL")
     
    7373                else do /* Fill records for details view */
    7474                    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 */
    7882                    parse var IPStr MachineIP ',' .
    7983                    if strip(MachineIP) = "" then MachineIP = machine
     84
    8085                    ok = VRSet("Main", 'Pointer', '<default>' )
    8186
     
    8792                    parse var smbline "Domain=["WorkGroup"] OS=["OS"] Server=["Version"]"Rest
    8893                    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 MACRoles
    93                     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")
    9594                end
    9695            end
     
    169168    if smbmachine.0 = 0 then do /* we are done, no more files around, cleanup, disable Timer and exit */
    170169        RefreshMode = ""
    171         ok = VRset("TM_RefreshTreeDisplay","Enabled",0)
     170        ok = VRset("TM_RefreshTreeDisplay","Enabled", 0)
     171        ok = VRSet("TM_RefreshTreeDisplay","Delay", 1000)
    172172        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 )
    175175        say time()' _AddSharesDisplay() completed'
    176176        return /* exit here */
    177177    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
    179182
    180183    if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
     
    186189        stat = stream(smbmachine.I,'c','open read')
    187190        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
    189194        infoline = ""
    190195        if stat = "READY:" then do /* we found a readable output file */
     
    329334
    330335            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
    336343            ok = VRSet("Main", 'Pointer', '<default>' )
    337 
    338             /* Find out server role, MAC */
    339             MACRoles = _GetMachineMACRoles(machineIP)
    340             parse var MACRoles MAC '|' Roles; drop MACRoles
    341             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")
    343344
    344345            say time()' _AddSharesDisplay() success and cleanup'
     
    360361_GetMachinehandle: procedure /* get recordhandle by machine name (also works for workgroups) */
    361362    Machine = translate(arg(1))
    362 
     363    say '  _GetMachineHandle("'Machine'") started.'
    363364    ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
    364365    match = 0
     
    376377    end
    377378    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'"'
    379380return rh.I
    380381
     
    406407_AddWorkGroup: procedure expose WorkGroupFH
    407408    workgroup = arg(1)
     409    say '  _AddWorkGroup("'workgroup'") started.'
    408410    wgh= VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
    409411    ok = VRMethod( "CN_smbtree", "SetFieldData",  wgh, WorkGroupFH, workgroup)
     
    411413    ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1)
    412414    ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|")
     415    say '  _AddWorkGroup("'workgroup'") done.'
    413416return wgh
    414417
     
    474477return MAC'|'Roles
    475478
     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,,',')
     509return IPStr'|'MAC'|'Roles
     510
    476511/*:VRX         file2stem
    477512*/
Note: See TracChangeset for help on using the changeset viewer.