diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-16 14:10:58 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-16 14:10:58 -0400 |
| commit | 4f791d6ee1712439c8485260221a8c0aa64760f2 (patch) | |
| tree | 88bd1f7e13bfda15644a054cd205f64753d25275 /MediaBrowser.ServerApplication/Networking/NetworkManager.cs | |
| parent | d9406d48ca0231bc096aeadc595c30f0596c8dda (diff) | |
| parent | 7498b7b5b7e2f7ddf380df1f47421d26c8171418 (diff) | |
Merge branch 'dev'
Diffstat (limited to 'MediaBrowser.ServerApplication/Networking/NetworkManager.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Networking/NetworkManager.cs | 14 |
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> |
