Changeset 640


Ignore:
Timestamp:
Sep 25, 2011, 7:05:11 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

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

Location:
trunk/guitools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/evfsgui/evfsgui.vrp

    r639 r640  
    1111VRXWindow: __VREFileListWindow,1,807,11033,1590,3358
    1212VRXWindow: __VRESectionListWindow,1,2674,10648,8696,4782
    13 VRXWindow: __VREToolsWindow,1,2529,723,6486,1665
     13VRXWindow: __VREToolsWindow,1,2529,723,6489,1667
    1414VRXWindow: __VREWindListWindow,1,542,8721,3770,3150
    1515UserFile: 1
    1616UserWindow: Main,1
    17 UserWindow: SW_MOUNTPOINT,1
    18 UserWindow: SW_SMBTREE,1
     17UserWindow: SW_INFO,1
    1918UserWindow: SW_CONDET,1
  • trunk/guitools/evfsgui/evfsgui.vrx

    r639 r640  
    324324    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.easupportFH ,   "Title", strip(NLVGetMessage(68),"T",":"))
    325325    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.rwfh ,          "Title", strip(NLVGetMessage(69),"T",":"))
     326
     327    /* SMBTree columns */
     328    WorkgroupFH= VRMethod( "CN_smbtree", "AddField", "String", "Workgroup"  )
     329    NBFH       = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
     330    IpFH       = VRMethod( "CN_smbtree", "AddField", "String", "IP"  )
     331    MBFH       = VRMethod( "CN_smbtree", "AddField", "String", "Role" )   
     332    OSFH       = VRMethod( "CN_smbtree", "AddField", "String", "OS" )   
     333    VersionFH  = VRMethod( "CN_SmbTree", "AddField", "String", "Version" )
     334    CommentFH  = VRMethod( "CN_smbtree", "AddField", "String", "Comment" )
     335    MacFH      = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
     336
     337    ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH,       "ReadOnly", 1)
     338    ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH,       "ReadOnly", 1)
     339    ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH,       "ReadOnly", 1)
     340    ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
     341    ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH,       "ReadOnly", 1)
     342    ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH,      "ReadOnly", 1)
     343
    326344    IF options.!debug == 1 THEN SAY time()' _ContainersInit done'
    327345return
     
    728746
    729747    /* Advanced */
    730     CALL VRSetIni 'Settings', 'EAS',           advanced.!eas          , settings.!ini, 'NoClose'
     748    CALL VRSetIni 'Settings', 'EAS',           advanced.!easupport    , settings.!ini, 'NoClose'
    731749    CALL VRSetIni 'Settings', 'ReadOnly',      advanced.!readonly     , settings.!ini, 'NoClose'
    732750    CALL VRSetIni 'Settings', 'AlwaysMP',      advanced.!alwaysmp     , settings.!ini, 'NoClose'
     
    778796        upCmdLine = translate(CmdLine)
    779797        ForceNDFS = 1
    780         CALL VRSet "PB_AutoStart","Visible", 0
     798        CALL VRSet "Menu_File_Autostart","Visible", 0
    781799    end
    782800
     
    11911209            CALL VRSet "CHK_MTYPE",  "Visible", 0
    11921210            CALL NLVSetText "DT_NETWORK", "Caption", 21
    1193             /* Does not make sense anymore */
    1194             /* if options.!editmode = 0 Then CALL VRSet "EF_NETWORK","Value", settings.!network */
    11951211        END
    11961212        WHEN mount == 2 THEN DO
     
    12011217            CALL VRSet "CHK_MTYPE",  "Visible", 0
    12021218            CALL NLVSetText "DT_NETWORK", "Caption", 21
    1203             /* Does not make sense anymore  */
    1204             /* CALL VRSet "EF_NETWORK","Value", settings.!network */
    12051219        END
    12061220        WHEN mount == 3 THEN DO
     
    12111225            CALL VRSet "CHK_MTYPE",  "Visible", 0
    12121226            CALL NLVSetText "DT_NETWORK", "Caption", 21
    1213             /* Does not make sense anymore */
    1214             /* CALL VRSet "EF_NETWORK","Value", settings.!network */
    12151227        END
    12161228        WHEN mount == 4 THEN DO
     
    12211233            CALL VRSet "CHK_MTYPE",  "Visible", 1
    12221234            CALL NLVSetText "DT_NETWORK", "Caption", 22
    1223             /* Does not make sense anymore */
    1224             /* CALL VRSet "EF_NETWORK","Value", "" */
    12251235        END
    12261236    END
     
    12921302        SAY '  p_string = "'p_string'"'
    12931303    end
    1294 /*
    1295     infotext = p_node
    1296     DO i = 1 TO p_mounts
    1297         infotext = infotext ' ['p_string']'
    1298     END
    1299 */
    1300     if p_string = "" then
    1301         infotext = fs.!name' 'fs.!version
    1302     else
    1303         infotext = p_string
    1304 
    1305 /* Herwig B.
    1306     CALL VRSet 'Main', 'StatusText', infotext */
     1304
     1305    if p_string = ""
     1306        then infotext = fs.!name' 'fs.!version
     1307        else infotext = p_string
     1308
    13071309    if infotext = "" then infotext = " "
    13081310    CALL VRSet "CN_CURRENT", "Caption", infotext
    13091311    CALL VRSet "CN_CURRENT", 'HintText',infotext
    1310 /* Herwig B. */
    13111312
    13121313    IF p_mounts > 0 THEN DO
     
    13141315        CALL VRSet 'MENU_CONTEXT_UNMOUNT',     'Visible', 1
    13151316       
    1316         if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
    1317                                  else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
     1317        if pos("*",p_string) > 0 | pos(";",p_string) > 0
     1318            then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
     1319            else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
    13181320    END
    13191321    ELSE DO
     
    13431345       
    13441346    END
     1347   
    13451348    parse var p_string p_workgroup':\\'p_server'\'p_share
    13461349
    1347     ok = VRSet("EF_Server","Value", p_server)
    1348 
     1350    p_server = translate(p_server)
     1351
     1352    ok = VRSet("EF_NETWORK","Value", p_workgroup)
     1353    wgh = _GetMachineHandle(p_workgroup)
     1354    if wgh = "" then wgh = _AddWorkGroup(p_workgroup)
     1355    ok = VRSet("EF_SERVER","Value", p_server)
     1356    mh = _GetMachineHandle(p_server)
     1357    if mh = "" then mh = _AddSleepingMachine(p_server,'',wgh)
     1358    machine = p_server
     1359    call _RefreshShares
     1360    ok = VRSet("EF_SHARE","Value", p_share)
    13491361    IF options.!debug == 1 THEN SAY time()' CN_CURRENT_Click done'
    13501362RETURN
     
    13821394    END
    13831395*/
    1384     if p_string = "" then
    1385         infotext = fs.!name' 'fs.!version
    1386     else
    1387         infotext = p_string
    1388 
    1389 /* Herwig B.
    1390     CALL VRSet 'Main', 'StatusText', infotext */
     1396    if p_string = ""
     1397        then infotext = fs.!name' 'fs.!version
     1398        else infotext = p_string
     1399
    13911400    if infotext = "" then infotext = " "
    13921401    CALL VRSet "CN_CURRENT", "Caption", infotext
    13931402    CALL VRSet "CN_CURRENT", 'HintText',infotext
    1394 /* Herwig B. */
    13951403
    13961404    CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
     
    15031511            options.!autoload = 1
    15041512            Profile = srcFile
    1505             call PB_LOAD_Click
     1513            call Menu_File_Load_Click
    15061514            ok = VRSet("EF_NETWORK","Value",options.!workgroup)
    15071515        end
     
    16721680    ok = VRSet("Menu_Selected_Info",             "Visible", 0) /* CN_SMBTREE */
    16731681    ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
    1674 
     1682ok = VRSet("Menu_Selected_TreeView","Visible",1)
     1683ok = VRSet("Menu_Selected_DetailsView","Visible",1)
    16751684    select
    16761685        when SMBObj.udatatype = "DISK" then do
     
    18611870*/
    18621871EF_SERVER_Change:
     1872    IF options.!debug == 1 THEN SAY time()' EF_SERVER_Change started'
    18631873    Now = VRGet("EF_SERVER","value")
    18641874    if Now = "" then return
    1865     ok = SysSleep(1)
     1875    ok = SysSleep(2)
    18661876    if Now <> VRGet("EF_SERVER","value") then return
    18671877
     
    18761886
    18771887    do I = 1 to rh.0
    1878 
    18791888        Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Userdata")
    18801889        ResName  = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Caption")
     
    19191928        call _RefreshWorkgroups
    19201929        machine = VRGet("EF_SERVER","value")
    1921         smbtree.!machine = VRMethod( "CN_SMBTREE", "AddRecord",,, machine)
    1922         /* We make any machine as sleeping initially */
    1923         ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", smbtree.!machine, "Icon",icons.!machine_sleeping)
    1924         ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", smbtree.!machine, "ReadOnly", 1)
    1925         ok = VRMethod( "CN_SMBTREE", "SetFieldData",  smbtree.!machine, NBFH, machine)
     1930        smbtree.!machine = _AddSleepingMachine(machine,"","")
    19261931        call _UserCredUpdate
    19271932        call _RefreshShares
     
    19331938        ok = VRSet("Pict_Throbber","Visible", 0)
    19341939    end
     1940    IF options.!debug == 1 THEN SAY time()' EF_SERVER_Change done'
    19351941return
    19361942
     
    21482154
    21492155    Fatal = 0
     2156
    21502157    IF options.!debug == 1 THEN SAY time()' LoadFileSysFuncs() done'
    21512158return
     
    22332240
    22342241    /* Tabbed Dialog = right pane */
     2242    ok = VRset("TDL_1", "Top",    marginx2)
    22352243    ok = VRset("TDL_1", "Left",   split_left + 60)
    22362244    ok = VRset("TDL_1", "Width",  rpane_width    )
     
    23062314    ok = VRset("GB_SHARE", "Left",  margin )
    23072315    ok = VRset("GB_SHARE", "Top",   marginx2 /* 245 + marginx2 */ )
     2316    ok = VRset("GB_SHARE", "Height",  2252 )
    23082317    ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
    23092318
     
    26752684return
    26762685
     2686/*:VRX         Menu_File_Daemon_Start_Click
     2687*/
     2688Menu_File_Daemon_Start_Click:
     2689    IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Start_Click started'
     2690    address cmd 'detach 'fs.!prefix'CTL.EXE'
     2691    ok = VRset("GB_CURRENT","Enabled", 1)
     2692    ok = VRset("TDL_1","Enabled", 1)
     2693    CALL REFRESH
     2694    ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
     2695    ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
     2696    IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Start_Click done'
     2697return
     2698
     2699/*:VRX         Menu_File_Daemon_Stop_Click
     2700*/
     2701Menu_File_Daemon_Stop_Click:
     2702    IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Stop_Click started'
     2703    ok = PRProcessList(proc)
     2704    do I = 1 to proc.0
     2705        CurProc = VRParseFileName(proc.i.name,'NE')
     2706        if CurProc = fs.!prefix"CTL.EXE" then  do
     2707            call charout , '  'CurProc' RC='
     2708            ok = PRKillProcess(1,proc.i.pid)
     2709            say ok
     2710        end
     2711    end
     2712    ok = VRset("GB_CURRENT","Enabled", 0)
     2713    ok = VRset("TDL_1","Enabled", 0)
     2714    ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
     2715    ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
     2716    IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Stop_Click stopped'
     2717return
    26772718/*:VRX         Menu_File_Load_Click
    26782719*/
     
    27582799return
    27592800
     2801/*:VRX         Menu_Selected_DetailsView_Click
     2802*/
     2803Menu_Selected_DetailsView_Click:
     2804    ok = VRSet("CN_smbtree", "View", "Detail")
     2805return
     2806
    27602807/*:VRX         Menu_Selected_Info_Click
    27612808*/
     
    27702817
    27712818    call _GetSMBObjectProperties SelRH.1
    2772    
    2773     IF options.!debug == 1 THEN say '  'samba.!smbclientexe' -L "'SMBObj.resname'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
    2774     address cmd samba.!smbclientexe' -L "'SMBObj.resname'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
    2775     infoline = linein(samba.!msg)
    2776     if word(infoline,1) = "creating" then do /* upcase tables are missing */
    2777         say "Missing upcase tables detected!"
    2778         infoline = linein(samba.!msg)
    2779         infoline = linein(samba.!msg)
    2780     end
    2781     IF options.!debug == 1 THEN say '  Response = "'Infoline'"'
    2782     ok = stream(samba.!msg,'c','close')
    2783     ok = SysFileDelete(samba.!msg)
    27842819
    27852820    window = VRLoadSecondary( "SW_INFO", "W" )
     
    28612896        if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
    28622897    end
     2898return
     2899
     2900/*:VRX         Menu_Selected_TreeView_Click
     2901*/
     2902Menu_Selected_TreeView_Click:
     2903    ok = VRSet("CN_smbtree", "View", "IconTree")
    28632904return
    28642905
     
    31813222*/
    31823223PB_CONDET_LOAD_Click:
    3183     IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
    3184     call PB_LOAD_CLICK
    3185     IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click done"
     3224    IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_LOAD_Click started"
     3225    call Menu_File_Load_Click
     3226    IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_LOAD_Click done"
    31863227RETURN
    31873228
     
    33303371    IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click started"
    33313372    ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
    3332 say "network = "network
     3373    say "network = "network
    33333374    if options.!editmode = 1 then do
    33343375        CALL PB_UNMOUNT_Click
    33353376        options.!editmode = 0
    3336         ok = VRMethod("TDL_1","SetTabText", " "NLVGetMessage(13)" ")
     3377        ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
    33373378/*      CALL NLVSetText 'DT_DIALOG',        "Caption", 13 */
    33383379
    33393380        CALL VRSet "PB_UNMOUNT","Enabled", 1
    3340         CALL VRSet "PB_SAVE","Enabled", 1
    3341         CALL VRSet "PB_LOAD","Enabled", 1
    33423381        CALL VRSet "GB_CURRENT", "ENABLED", 1
    33433382    end
     
    37853824    CALL VRMethod 'CB_DRIVES', 'Clear'
    37863825
    3787     CALL VRSet "CN_CURRENT", "Caption", ' '
     3826    CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
    37883827
    37893828    /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
     
    40674106*/
    40684107SW_INFO_Create:
     4108    IF options.!debug == 1 THEN SAY time()' SW_INFO_Create started'   
    40694109    call SW_INFO_Init
    40704110    CALL NLVSetText 'SW_INFO',    "Caption", 92
     
    40744114    Info.ValueFH   = VRMethod( "CN_INFO", "AddField", "String", "Value" )
    40754115
    4076     parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
    40774116    Info.!domain = VRMethod( "CN_INFO", "AddRecord")
    4078     ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21),'T',':'),Info.ValueFH, Workgroup )
    4079     Info.!os = VRMethod( "CN_INFO", "AddRecord")
    4080     ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93),'T',':'),Info.ValueFH, OS )
     4117    Info.!os     = VRMethod( "CN_INFO", "AddRecord")
    40814118    Info.!server = VRMethod( "CN_INFO", "AddRecord")
    4082     ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19),'T',':'),Info.ValueFH, Server )
    4083 
    40844119    Info.!status = VRMethod( "CN_INFO", "AddRecord")
     4120    Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
     4121    Info.!IP     = VRMethod( "CN_INFO", "AddRecord")
     4122    Info.!MAC    = VRMethod( "CN_INFO", "AddRecord")
     4123
     4124
     4125    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
     4126    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os,     Info.TypeFH, strip(NLVGetMessage(93),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH  ))
     4127    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH  ))
     4128    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, "Role",Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH  ))
     4129    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP,     Info.TypeFH, "IP"  ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH  ))
     4130    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC,    Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
     4131
    40854132    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, SMBObj.udatamsg )
    4086 
     4133    IF options.!debug == 1 THEN SAY time()' SW_INFO_Create done'   
    40874134return
    40884135
     
    44064453TDL_1_PageSelected:
    44074454    page =  VRInfo("Page")
    4408 say "Page="page
     4455
    44094456    /* call _TabsStrip */
    44104457    select
  • trunk/guitools/shared/smbtree.vrs

    r638 r640  
    1010    if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
    1111    if ShowHidden = 'SHOWHIDDEN' | ShowHidden = '' then ShowHidden = 0
    12 
    1312    if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
    1413
    15     say       '  detach 'samba.!smbtreeexe' 'BroadCast' -S 'debuglevel' 'UserCred' >'samba.!msg
    16     address cmd 'detach 'samba.!smbtreeexe' 'BroadCast' -S 'debuglevel' 'UserCred' >'samba.!msg
     14    say "  UserCred="UserCred
     15
     16    /* smbtree -S = List workgroups (domains) and servers of tree */
     17    say       '  detach 'samba.!smbtreeexe' 'BroadCast' -S 'UserCred' 'debuglevel' >'samba.!msg
     18    address cmd 'detach 'samba.!smbtreeexe' 'BroadCast' -S 'UserCred' 'debuglevel' >'samba.!msg
    1719
    1820    if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0
     
    3133_RefreshTreeDisplay:
    3234    say time()' _RefreshTreeDisplay() started'
    33     say '  samba.!msg = "'samba.!msg'"'
     35
    3436    stat = stream(samba.!msg,'c','open read')
    3537    if stat <> "READY:" then return
    3638
    37     if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then do
    38         UserCred = '-N'
    39     end
    40 
     39    if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
    4140    if ShowHidden = 'SHOWHIDDEN' | ShowHidden = '' then ShowHidden = 0
     41    if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
    4242
    4343    ok = VRset("TM_RefreshTreeDisplay","Enabled",0)
    44 /*  ok = VRSet("Main", "StatusText", NLVGetMessage(50)) */
    4544    ok = VRSet("CN_smbtree", 'Enabled', 0 )
    46 /*  ok = VRSet("Main", 'Pointer', 'Wait' ) */
    4745
    4846    ok = VRSet( "CN_smbtree", "Painting", 0  )
     
    5048
    5149    drop smbtree.
    52     drop smbtreeline.
    53 
    54     sl = 0
    55 
    56     do until lines(samba.!msg) = 0
    57         sl = sl + 1
    58         smbtreeline.sl = linein(samba.!msg)
    59     end
    60     smbtreeline.0 = sl
    61     ok = stream(samba.!msg,'c','close')
    62     ok = SysFileDelete(samba.!msg)
     50
     51    ok = file2stem(samba.!msg,"smbtreeline.")
    6352
    6453    do sl = 1 to smbtreeline.0
    6554        Header = c2x(left(smbtreeline.sl,3))
    6655        select
    67             when Header = "09095C" then do /* share - obsolete, we do that differently now see below! */
    68                 smbtreeline.sl = strip(smbtreeline.sl,,'09'x)
    69                 parse var smbtreeline.sl '\\'machine'\'share '09'x comment
    70                 machine = strip(machine)
    71                 share   = strip(share)
    72                 comment = strip(comment)
    73                 text = translate(share' 'comment)
    74                 res = _GuessIcon(text)
    75                 if VRGet("CN_smbtree","View") = "IconTree" then do
    76                     parent = smbtree.!machine
    77                     smbtree.!share = VRMethod( "CN_smbtree", "AddRecord",parent,, share||'0D0A'x||comment, res)
    78                     ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!share, "ReadOnly", 1)
    79                     if pos("$", share) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!share, "Visible", ShowHidden)
    80                 end
    81             end /* end of obsolete share code */
    82             when Header = "095C5C" then do /* Machine */
     56            when Header = "09095C" then nop /* share - obsolete, we only list domains and servers here */
     57            when Header = "095C5C" then do  /* machine */
    8358                smbtreeline.sl = strip(smbtreeline.sl,,'09'x)
    8459                parse var smbtreeline.sl '\\'machine '0909'x comment
     
    8661                comment = strip(comment)
    8762                if VRGet("CN_smbtree","View") = "IconTree" then parent = smbtree.!workgroup; else parent = ""
    88                 smbtree.!machine = VRMethod( "CN_smbtree", "AddRecord",parent,, machine||'0D0A'x||comment)
    8963                /* We make any machine as sleeping initially */
    90                 ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#61:PMWP.DLL")
    91                 ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "ReadOnly", 1)
    92                 ok = VRMethod( "CN_smbtree", "SetFieldData",  smbtree.!machine, NBFH, machine, CommentFH, Comment, WorkGroupFH, CurWG)
     64                smbtree.!machine = _AddSleepingMachine(machine,comment,parent)
     65
    9366                ok = VRSet( "CN_smbtree", "Painting", 1  )
    9467                ok = VRSet( "CN_smbtree", "Painting", 0  )
    95                 if VRGet("CN_smbtree","View") = "Detail" then do
    96                     address cmd samba.!nmblookupexe' 'machine' 'debuglevel' -N >'samba.!msg
    97                     ipstr = ""
    98                     ip = ""
    99                     do until lines(samba.!msg) = 0
    100                         nmblookupline = linein(samba.!msg)
    101                         if pos(strip(machine)'<',nmblookupline) > 0 then do
    102                             parse var nmblookupline ip .
    103                             if pos(strip(ip), ipstr) = 0 then do
    104                                 ipstr = ipstr||ip','
    105                             end
    106                         end
    107                     end
    108                     ok = SysFileDelete(samba.!msg)
    109                     ipstr = strip(ipstr,,',')
     68
     69                if VRGet("CN_smbtree","View") <> "Detail" then do
     70                    /* Tree view */
     71                    call _RefreshShares
     72                end
     73                else do /* Fill records for details view */
     74                    ok = VRSet("Main", 'Pointer', 'Wait' )
     75                    /* Get all IP addresses of the machine */
     76                    IPStr = _GetMachineIP(machine)
    11077                    ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr)
     78                    parse var IPStr MachineIP ',' .
     79                    if strip(MachineIP) = "" then MachineIP = machine
     80                    ok = VRSet("Main", 'Pointer', '<default>' )
     81
     82                    /* Find out OS, version */
     83                    say     '  'samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'samba.!msg' 1>NUL'
     84                    address cmd samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'samba.!msg' 1>NUL'
     85                    smbline = linein(samba.!msg)
    11186                    ok = stream(samba.!msg,'c','close')
    112                     if ip <> "" then do
    113                         address cmd samba.!smbclientexe' -L "'strip(machine)'" -I "'ip'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
    114                         smbline = linein(samba.!msg)
    115                         ok = stream(samba.!msg,'c','close')
    116                         parse var smbline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
    117                         ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, OSFH, OS)
    118                         /* WorkGroupFH, Workgroup */
    119                         address cmd samba.!nmblookupexe' -A 'machine' 'debuglevel' -N >'samba.!msg
    120                         Master = ""
    121                         do until lines(samba.!msg) = 0
    122                             nmblookupline = linein(samba.!msg)
    123                             if pos('<1b>', nmblookupline) > 0 then Master = Master||"LMB," /* + */
    124                             if pos('<1d>', nmblookupline) > 0 then Master = Master||"DMB," /* * */
    125                             if pos('MAC',nmblookupline) > 0 then do
    126                                 parse var nmblookupline . '=' MAC
    127                                 MAC = strip(MAC)
    128                             end
    129                         end
    130                         Master= strip(Master,,',')
    131                         ok = stream(samba.!msg,'c','close')
    132                         ok = SysFileDelete(samba.!msg)
    133                         ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, MBFH, Master,MacFH,MAC)
    134                     end
    135                 end
    136                 else do
    137                     call _RefreshShares
    138                 end
    139             end
    140             when smbtreeline.sl = "" then nop
    141             otherwise do
    142                 say '  Workgroup: "'smbtreeline.sl'"'
     87                    parse var smbline "Domain=["WorkGroup"] OS=["OS"] Server=["Version"]"Rest
     88                    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")
     95                end
     96            end
     97            when smbtreeline.sl = "" then nop /* skip empty lines */
     98            otherwise do /* possibly a new workgroup */
     99                say '  Possible workgroup: "'smbtreeline.sl'"'
     100                /* check for eventual error messages */
    143101                if pos("RECEIVING",translate(smbtreeline.sl)) > 0 | pos("TDB(",translate(smbtreeline.sl)) > 0 then do
    144102                    Msg.Type = "W"
     
    146104                    call _ShowMsg
    147105                end
    148                 else do
     106                else do /* it is really a new workgroup */
    149107                    if VRGet("CN_smbtree","View") = "IconTree" then do
    150                         smbtree.!workgroup = VRMethod( "CN_smbtree", "AddRecord",,, smbtreeline.sl,"#62:PMWP.DLL")
    151                         ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!workgroup, WorkGroupFH, smbtreeline.sl)
    152                         ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!workgroup, "Collapsed", 0)
    153                         ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!workgroup, "ReadOnly", 1)
    154                         ok = VRMethod( "CN_smbtree", 'SetRecordAttr', smbtree.!workgroup, "UserData", "WORKGROUP|")
     108                        smbtree.!workgroup = _AddWorkGroup(smbtreeline.sl)
    155109                    end
    156110                    CurWG = smbtreeline.sl
     
    172126_RefreshShares:
    173127    say time()' _RefreshShares() started'
    174     /* RefreshID = RANDOM() */
     128
    175129    smbmachine = TempDir||"smbmachine."||machine
    176130    MaxSmbClient = 32 /* Do not run more than MaxSmbClient instances of smbclient.exe at the same time */
     
    195149    if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
    196150
    197     say       '  detach 'samba.!smbclientexe' -L "'strip(machine)'" 'UserCred' 'debuglevel' 1>'smbmachine' 2>NUL'
    198     address cmd 'detach 'samba.!smbclientexe' -L "'strip(machine)'" 'UserCred' 'debuglevel' 1>'smbmachine' 2>NUL'
     151    say       '  detach 'samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'smbmachine' 1>&2'
     152    address cmd 'detach 'samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'smbmachine' 1>&2'
    199153
    200154    if UserCred = '-N' then UserCred = ''
     
    213167
    214168    ok = SysFileTree(Tempdir||'smbmachine.*',smbmachine.,'FO')
    215     say '  'smbmachine.0' file(s) to process.'
    216 
    217169    if smbmachine.0 = 0 then do /* we are done, no more files around, cleanup, disable Timer and exit */
    218170        RefreshMode = ""
     171        ok = VRset("TM_RefreshTreeDisplay","Enabled",0)
    219172        ok = VRSet("CN_smbtree","Enabled", 1)
    220         ok = VRset("TM_RefreshTreeDisplay","Enabled",0)
    221         ok = VRSet( "CN_smbtree", "Painting", 0  )
    222         ok = VRSet( "CN_smbtree", "Painting", 1  )
     173        ok = VRSet("CN_smbtree", "Painting", 0  )
     174        ok = VRSet("CN_smbtree", "Painting", 1  )
    223175        say time()' _AddSharesDisplay() completed'
    224176        return /* exit here */
    225177    end
     178    else say '  'smbmachine.0' file(s) to process.'
    226179
    227180    if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
     
    229182
    230183    do I = 1 to smbmachine.0
    231         say ' Going for "'smbmachine.I'"'
     184        call charout , '  Going for "'smbmachine.I'", got '
    232185        if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
    233186        stat = stream(smbmachine.I,'c','open read')
    234 
     187        say '"'stat'"'
     188
     189        infoline = ""
    235190        if stat = "READY:" then do /* we found a readable output file */
    236191            OneWorkGroupOnly = 0
    237             /* Machine = VRParseFilename(smbmachine.I,'E') */
     192           
    238193            Machine = substr(smbmachine.I,pos('.',smbmachine.I)+1)
    239194
    240195            smbtree.!machine = _GetMachinehandle(Machine)
    241             say '  Machine (handle) = "'machine'" ('smbtree.!machine')'
    242 
     196           
    243197            if smbtree.!machine = "" then do /* invalid (old) file */
    244198                say time()' _AddSharesDisplay() exit with Invalid file found (no corresponding machine)'
     
    247201                iterate
    248202            end
     203            line = linein(smbmachine.I) /* PID line */
    249204            line = linein(smbmachine.I)
     205            if pos('creating lame', line) > 0 then do
     206                line = linein(smbmachine.I)
     207                line = linein(smbmachine.I)
     208            end
     209            if pos('Server=[', line) > 0 then do
     210                infoline = linein(smbmachine.I)
     211                parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
     212                ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, OSFH, OS, VersionFH, Server)
     213                line = linein(smbmachine.I)
     214            end
    250215            say '  Answer "'line'"'
    251216            ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'UserData', "SERVER|"||strip(line))
     
    321286                wgh = _GetMachinehandle(workgroup)
    322287                if wgh = "" then do /* The machine appears to be in a new workgroup - add it as well */
    323                     /* NOTE: This should be obsolete now because the list of available
    324                        workgroups should always have been updated before we get here */
    325                     wgh = VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
    326                     ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup)
    327                     ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "Collapsed", 0)
    328                     ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1)
    329                     ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|")
     288                    /* NOTE: This should be obsolete now because the list of available     */
     289                    /*       workgroups should always have been updated before we get here */
     290                    wgh = _AddWorkGroup(workgroup)
    330291                end
    331292                /* we only do this for machines with empty parent (=workgroup) handle */
     
    339300                    /* There are multiple workgroups, we need additional */
    340301                    /* measures to find out which is our workgroup       */
    341                     say     '  'samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
    342                     address cmd samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
    343                     infoline = linein(samba.!msg)
    344                     if word(infoline,1) = "creating" then do /* upcase tables are missing */
    345                         say "Missing upcase tables detected!"
     302                    if infoline <> "" then do
     303                        say     '  'samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
     304                        address cmd samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
    346305                        infoline = linein(samba.!msg)
    347                         infoline = linein(samba.!msg)
     306
     307                        if word(infoline,1) = "creating" then do /* upcase tables are missing */
     308                            say "Missing upcase tables detected!"
     309                            infoline = linein(samba.!msg)
     310                            infoline = linein(samba.!msg)
     311                        end
     312                        IF options.!debug == 1 THEN say '  Response = "'Infoline'"'
     313                        ok = stream(samba.!msg,'c','close')
     314                        ok = SysFileDelete(samba.!msg)
    348315                    end
    349                     IF options.!debug == 1 THEN say '  Response = "'Infoline'"'
    350                     ok = stream(samba.!msg,'c','close')
    351                     ok = SysFileDelete(samba.!msg)
    352 
    353                     parse var infoline "Domain=["WorkGroup"] "Rest
     316
     317                    parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
     318
    354319                    wgh = _GetMachinehandle(workgroup)
    355320                    if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do
     
    358323                end
    359324                else do
    360                     /* The machine does not allow browsing and does not report a workgroup */
    361                     say '  "'Machine'" does not allow browsing. Unable to determine workgroup.'
    362                 end
    363             end
     325                    /* The machine does not allow browsing and does not report a workgroup here */
     326                    say '  "'Machine'" does not allow browsing.'
     327                end
     328            end
     329
     330            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            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")
    364343
    365344            say time()' _AddSharesDisplay() success and cleanup'
     
    368347            if ok <> 0 then say '  Failure 'ok' deleting "'smbmachine.I'"!'
    369348        end
    370         else say '  Got "'stat'" for "'smbmachine.I'"'
    371349    end
    372350
     
    398376    end
    399377    if match = 0 then rh.I = "" /* return an empty handle, if there was no match */
     378    say '  Handle for "'Machine'" = "'rh.I'"'
    400379return rh.I
    401380
     
    407386    if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
    408387
    409     say         samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
     388    say     '  'samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
    410389    address cmd samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
    411390
     
    413392    if UserCred = '-N' then UserCred = ''
    414393
    415     drop wgline.
    416 
    417     sl = 0
    418 
    419     do until lines(samba.!msg) = 0
    420         sl = sl + 1
    421         wgline.sl = linein(samba.!msg)
    422     end
    423     wgline.0 = sl
    424     ok = stream(samba.!msg,'c','close')
    425     ok = SysFileDelete(samba.!msg)
    426 
    427     do sl = 1 to wgline.0
    428        if pos("RECEIVING",translate(wgline.sl)) > 0 | pos("TDB(",translate(wgline.sl)) > 0 then do
    429             iterate /* We ignore errors here */
    430         end
    431         workgroup = wgline.sl
     394    ok = File2Stem(samba.!msg,"workgroups.")
     395    do I = 1 to workgroups.0
     396        workgroup = translate(workgroups.I)
     397        if pos("RECEIVING",workgroup) > 0 | pos("TDB(",workgroup) > 0 then iterate /* We ignore errors here */
    432398        wgh = _GetMachinehandle(workgroup)
    433         if wgh = "" then do /* A new workgroup was found -- add it */
    434             wgh = VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
    435             ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup)
    436             ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "Collapsed", 0)
    437             ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1)
    438             ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|")
    439         end
     399        if wgh = "" then wgh = _AddWorkGroup(workgroup) /* A new workgroup was found -- add it */
    440400    end
    441401    say time()' _RefreshWorkgroups() done'
    442402return
    443403
     404/*:VRX         _AddWorkgroup
     405*/
     406_AddWorkGroup: procedure expose WorkGroupFH
     407    workgroup = arg(1)
     408    wgh= VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
     409    ok = VRMethod( "CN_smbtree", "SetFieldData",  wgh, WorkGroupFH, workgroup)
     410    ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "Collapsed", 0)
     411    ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1)
     412    ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|")
     413return wgh
     414
     415/*:VRX         _AddSleepingMachine
     416*/
     417_AddSleepingMachine: procedure expose WorkGroupFH NBFH CommentFH
     418    machine = arg(1)
     419    comment = arg(2)
     420    parent  = arg(3)
     421    mh = VRMethod( "CN_smbtree", "AddRecord",parent,, machine||'0D0A'x||comment)
     422    ok = VRMethod( "CN_smbtree", "SetFieldData",  mh, NBFH, machine, CommentFH, comment)
     423    ok = VRMethod( "CN_smbtree", "SetRecordAttr", mh, "Icon","#61:PMWP.DLL")
     424    ok = VRMethod( "CN_smbtree", "SetRecordAttr", mh, "ReadOnly", 1)
     425    ok = VRMethod( "CN_smbtree", "SetRecordAttr", mh, "Collapsed", 1)
     426    ok = VRMethod( "CN_smbtree", 'SetRecordAttr', mh, "UserData", "SERVER|")
     427    if parent <> "" then do
     428        WGName  = translate(VRMethod("CN_smbtree","GetRecordAttr",parent,"Caption"))
     429        parse var WGName  WGName '0D0A'x .
     430        ok = VRMethod( "CN_smbtree", "SetFieldData",  mh, WorkgroupFH, strip(WGName))
     431    end
     432return mh
     433
     434/*:VRX         _GetMachineIP
     435*/
     436_GetMachineIP: procedure expose debuglevel samba.
     437    /* Get all IP addresses of the machine */
     438    machine = arg(1)
     439    say     '  'samba.!nmblookupexe' 'machine' 'debuglevel' >'samba.!msg
     440    address cmd samba.!nmblookupexe' 'machine' 'debuglevel' >'samba.!msg
     441    ok = file2stem(samba.!msg,"nmblookup.")
     442    ipstr = ""; ip = ""
     443    do i = 1 to nmblookup.0
     444        if pos(strip(machine)'<',nmblookup.i) = 0 then iterate
     445        parse var nmblookup.i ip .
     446        if pos(strip(ip), ipstr) = 0 then ipstr = ipstr||ip','
     447    end
     448    ipstr = strip(ipstr,,',')
     449return IpStr
     450
     451/*:VRX         _GetMachineRole
     452*/
     453_GetMachineMACRoles: procedure expose debuglevel samba.
     454    machine = arg(1) /* May be name or IP */
     455    say     '  'samba.!nmblookupexe' -A 'machine' 'debuglevel' >'samba.!msg
     456    address cmd samba.!nmblookupexe' -A 'machine' 'debuglevel' >'samba.!msg
     457    ok = file2stem(samba.!msg,"nmblookup.")
     458    Roles = ""
     459    MAC = 'xx-xx-xx-xx-xx-xx'
     460    do I = 1 to nmblookup.0
     461        select
     462            when pos('<1c>', nmblookup.I) > 0 then Roles = Roles||"PDC," /* # */
     463            when pos('<1b>', nmblookup.I) > 0 then Roles = Roles||"LMB," /* + */
     464            when pos('<1d>', nmblookup.I) > 0 then Roles = Roles||"DMB," /* * */
     465            when pos('MAC',  nmblookup.I) > 0 then do
     466                parse var nmblookup.I . '=' MAC
     467                MAC = strip(MAC)
     468            end
     469            otherwise nop
     470        end
     471    end
     472    Roles = strip(Roles,,',')
     473    if Roles = "" then Roles = "Workstation"
     474return MAC'|'Roles
     475
     476/*:VRX         file2stem
     477*/
     478file2stem:
     479    msgfile = arg(1)
     480    msgstem = arg(2)
     481    if right(msgstem,1) <> '.' then msgstem = msgstem'.'
     482    say '  file2stem("'msgfile'","'msgstem'")'
     483    dyn = 'drop 'msgstem
     484    interpret dyn
     485    stemcount = 0
     486    do while lines(msgfile) > 0
     487        stemcount = stemcount + 1
     488        inline = linein(msgfile)
     489        if pos('creating lame',inline) > 0 then do
     490            stemcount = stemcount - 1
     491            iterate
     492        end
     493        dyn = msgstem||stemcount' = inline'
     494        interpret dyn
     495    end
     496    dyn = msgstem||"0 = "stemcount
     497    interpret dyn
     498    ok = stream(msgfile,'c','close')
     499    ok = SysFileDelete(msgfile)
     500    drop msgfile msgstem
     501return stemcount
Note: See TracChangeset for help on using the changeset viewer.