示例#1
0
 protected override void internal_refill()
 {
     SHARE_INFO_1[] infos = WinApiNETwrapper.GetShareInfos_1(server_name);
     internal_list.Clear();
     foreach (SHARE_INFO_1 info in infos)
     {
         internal_list.Add(info, null);
     }
 }
示例#2
0
        private NETRESOURCE[] get_hidden_resources(NETRESOURCE res)
        {
            List <NETRESOURCE> ret = new List <NETRESOURCE>();

            try
            {
                string         server_name = res.lpRemoteName.TrimStart(new char[] { '\\' });
                SHARE_INFO_1[] net_shares  = WinApiNETwrapper.GetShareInfos_1(server_name);
                foreach (SHARE_INFO_1 info in net_shares)
                {
                    if (info.shi1_netname.EndsWith("$"))
                    {
                        NETRESOURCE hid_res = new NETRESOURCE();

                        if ((info.shi1_type & NetshareType.DEVICE) == NetshareType.DEVICE)
                        {
                            //IPC$
                            hid_res.dwDisplayType = ResourceDisplayType.GENERIC;
                            hid_res.dwType        = ResourceType.ANY;
                        }
                        else if ((info.shi1_type & NetshareType.PRINTQ) == NetshareType.PRINTQ)
                        {
                            hid_res.dwDisplayType = ResourceDisplayType.SHAREADMIN;
                            hid_res.dwType        = ResourceType.PRINT;
                        }
                        else if ((info.shi1_type & NetshareType.SPECIAL) == NetshareType.SPECIAL)
                        {
                            //C$
                            hid_res.dwDisplayType = ResourceDisplayType.SHAREADMIN;
                            hid_res.dwType        = ResourceType.DISK;
                        }

                        hid_res.lpComment    = info.shi1_remark;
                        hid_res.lpProvider   = res.lpProvider;
                        hid_res.lpRemoteName = string.Format(@"{0}\{1}", res.lpRemoteName, info.shi1_netname);
                        ret.Add(hid_res);
                    }
                }
            }
            catch (Exception) { }
            return(ret.ToArray());
        }