aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-06-14 23:36:40 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-06-14 23:36:40 -0400
commitc8b4e580bb827166fcf45a109751702e15be982e (patch)
tree391f965490dc3a83b91e9c5942b6e5d3dfcb5d00
parent80863e13264e871599d44668824a40159b0b080e (diff)
fix windows network browser
-rw-r--r--MediaBrowser.ServerApplication/Networking/NetworkManager.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs
index cc9061fcd..ed60de9d2 100644
--- a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs
+++ b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs
@@ -89,19 +89,21 @@ namespace MediaBrowser.ServerApplication.Networking
/// </summary>
/// <returns>Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER
/// PC's in the Domain</returns>
- private IEnumerable<string> GetNetworkDevicesInternal()
+ private List<string> GetNetworkDevicesInternal()
{
//local fields
const int MAX_PREFERRED_LENGTH = -1;
var SV_TYPE_WORKSTATION = 1;
var SV_TYPE_SERVER = 2;
- var buffer = IntPtr.Zero;
- var tmpBuffer = IntPtr.Zero;
+ IntPtr buffer = IntPtr.Zero;
+ IntPtr tmpBuffer = IntPtr.Zero;
var entriesRead = 0;
var totalEntries = 0;
var resHandle = 0;
var sizeofINFO = Marshal.SizeOf(typeof(_SERVER_INFO_100));
+ var returnList = new List<string>();
+
try
{
//call the DllImport : NetServerEnum with all its required parameters
@@ -118,7 +120,7 @@ namespace MediaBrowser.ServerApplication.Networking
//get pointer to, Pointer to the buffer that received the data from
//the call to NetServerEnum. Must ensure to use correct size of
//STRUCTURE to ensure correct location in memory is pointed to
- tmpBuffer = new IntPtr((int)buffer + (i * sizeofINFO));
+ tmpBuffer = new IntPtr((Int64)buffer + (i * sizeofINFO));
//Have now got a pointer to the list of SV_TYPE_WORKSTATION and
//SV_TYPE_SERVER PC's, which is unmanaged memory
//Needs to Marshal data from an unmanaged block of memory to a
@@ -129,7 +131,7 @@ namespace MediaBrowser.ServerApplication.Networking
//add the PC names to the ArrayList
if (!string.IsNullOrEmpty(svrInfo.sv100_name))
{
- yield return svrInfo.sv100_name;
+ returnList.Add(svrInfo.sv100_name);
}
}
}
@@ -140,6 +142,8 @@ namespace MediaBrowser.ServerApplication.Networking
//the memory that the NetApiBufferAllocate function allocates
NativeMethods.NetApiBufferFree(buffer);
}
+
+ return returnList;
}
/// <summary>