mirror of https://github.com/jellyfin/jellyfin.git
fix windows network browser
This commit is contained in:
parent
80863e1326
commit
c8b4e580bb
|
@ -89,19 +89,21 @@ namespace MediaBrowser.ServerApplication.Networking
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER
|
/// <returns>Arraylist that represents all the SV_TYPE_WORKSTATION and SV_TYPE_SERVER
|
||||||
/// PC's in the Domain</returns>
|
/// PC's in the Domain</returns>
|
||||||
private IEnumerable<string> GetNetworkDevicesInternal()
|
private List<string> GetNetworkDevicesInternal()
|
||||||
{
|
{
|
||||||
//local fields
|
//local fields
|
||||||
const int MAX_PREFERRED_LENGTH = -1;
|
const int MAX_PREFERRED_LENGTH = -1;
|
||||||
var SV_TYPE_WORKSTATION = 1;
|
var SV_TYPE_WORKSTATION = 1;
|
||||||
var SV_TYPE_SERVER = 2;
|
var SV_TYPE_SERVER = 2;
|
||||||
var buffer = IntPtr.Zero;
|
IntPtr buffer = IntPtr.Zero;
|
||||||
var tmpBuffer = IntPtr.Zero;
|
IntPtr tmpBuffer = IntPtr.Zero;
|
||||||
var entriesRead = 0;
|
var entriesRead = 0;
|
||||||
var totalEntries = 0;
|
var totalEntries = 0;
|
||||||
var resHandle = 0;
|
var resHandle = 0;
|
||||||
var sizeofINFO = Marshal.SizeOf(typeof(_SERVER_INFO_100));
|
var sizeofINFO = Marshal.SizeOf(typeof(_SERVER_INFO_100));
|
||||||
|
|
||||||
|
var returnList = new List<string>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//call the DllImport : NetServerEnum with all its required parameters
|
//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
|
//get pointer to, Pointer to the buffer that received the data from
|
||||||
//the call to NetServerEnum. Must ensure to use correct size of
|
//the call to NetServerEnum. Must ensure to use correct size of
|
||||||
//STRUCTURE to ensure correct location in memory is pointed to
|
//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
|
//Have now got a pointer to the list of SV_TYPE_WORKSTATION and
|
||||||
//SV_TYPE_SERVER PC's, which is unmanaged memory
|
//SV_TYPE_SERVER PC's, which is unmanaged memory
|
||||||
//Needs to Marshal data from an unmanaged block of memory to a
|
//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
|
//add the PC names to the ArrayList
|
||||||
if (!string.IsNullOrEmpty(svrInfo.sv100_name))
|
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
|
//the memory that the NetApiBufferAllocate function allocates
|
||||||
NativeMethods.NetApiBufferFree(buffer);
|
NativeMethods.NetApiBufferFree(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue