From 465f0cc1e2e4fc50a0adbef79a4a317eec5eb454 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Sat, 23 Feb 2013 12:54:51 -0500 Subject: moved some network code to the networking assembly --- .../Management/NativeMethods.cs | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 MediaBrowser.Networking/Management/NativeMethods.cs (limited to 'MediaBrowser.Networking/Management/NativeMethods.cs') diff --git a/MediaBrowser.Networking/Management/NativeMethods.cs b/MediaBrowser.Networking/Management/NativeMethods.cs new file mode 100644 index 000000000..9a888fab2 --- /dev/null +++ b/MediaBrowser.Networking/Management/NativeMethods.cs @@ -0,0 +1,72 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace MediaBrowser.Networking.Management +{ + /// + /// Class NativeMethods + /// + [SuppressUnmanagedCodeSecurity] + public static class NativeMethods + { + //declare the Netapi32 : NetServerEnum method import + /// + /// Nets the server enum. + /// + /// Name of the server. + /// The dw level. + /// The p buf. + /// The dw pref max len. + /// The dw entries read. + /// The dw total entries. + /// Type of the dw server. + /// The domain. + /// The dw resume handle. + /// System.Int32. + [DllImport("Netapi32", CharSet = CharSet.Auto, SetLastError = true), + SuppressUnmanagedCodeSecurityAttribute] + + public static extern int NetServerEnum( + string ServerName, // must be null + int dwLevel, + ref IntPtr pBuf, + int dwPrefMaxLen, + out int dwEntriesRead, + out int dwTotalEntries, + int dwServerType, + string domain, // null for login domain + out int dwResumeHandle + ); + + //declare the Netapi32 : NetApiBufferFree method import + /// + /// Nets the API buffer free. + /// + /// The p buf. + /// System.Int32. + [DllImport("Netapi32", SetLastError = true), + SuppressUnmanagedCodeSecurityAttribute] + + public static extern int NetApiBufferFree( + IntPtr pBuf); + } + + //create a _SERVER_INFO_100 STRUCTURE + /// + /// Struct _SERVER_INFO_100 + /// + [StructLayout(LayoutKind.Sequential)] + public struct _SERVER_INFO_100 + { + /// + /// The sv100_platform_id + /// + internal int sv100_platform_id; + /// + /// The sv100_name + /// + [MarshalAs(UnmanagedType.LPWStr)] + internal string sv100_name; + } +} -- cgit v1.2.3