The Free Software Media System - Server Backend & API
fix windows network browser
Luke Pulverentic8b4e580bb82
diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.csindex cc9061fcd0..ed60de9d20 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 fieldsconst 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 ArrayListif (!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 allocatesNativeMethods.NetApiBufferFree(buffer);}++ return returnList;}/// <summary>