You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CONNECTION_INFO_1.cs 3.4 KiB

8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright (C) 2008-2016 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. */
  21. using System.Runtime.InteropServices;
  22. namespace Alphaleonis.Win32.Network
  23. {
  24. internal static partial class NativeMethods
  25. {
  26. /// <summary>Contains the identification number of a connection, number of open files, connection time, number of users on the connection, and the type of connection.</summary>
  27. /// <remarks>Minimum supported client: Windows XP [desktop apps only]</remarks>
  28. /// <remarks>Minimum supported server: Windows Server 2003 [desktop apps only]</remarks>
  29. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  30. internal struct CONNECTION_INFO_1
  31. {
  32. /// <summary>Specifies a connection identification number.</summary>
  33. [MarshalAs(UnmanagedType.U4)] public readonly uint coni1_id;
  34. /// <summary>A combination of values that specify the type of connection made from the local device name to the shared resource.</summary>
  35. [MarshalAs(UnmanagedType.U4)] public readonly ShareType coni1_type;
  36. /// <summary>Specifies the number of files currently open as a result of the connection.</summary>
  37. [MarshalAs(UnmanagedType.U4)] public readonly uint coni1_num_opens;
  38. /// <summary>Specifies the number of users on the connection.</summary>
  39. [MarshalAs(UnmanagedType.U4)] public readonly uint coni1_num_users;
  40. /// <summary>Specifies the number of seconds that the connection has been established.</summary>
  41. [MarshalAs(UnmanagedType.U4)] public readonly uint coni1_time;
  42. /// <summary>If the server sharing the resource is running with user-level security, the UserName member describes which user made the connection. If the server is running with share-level security, coni1_username describes which computer (computername) made the connection.</summary>
  43. /// <remarks>Note that Windows does not support share-level security.</remarks>
  44. [MarshalAs(UnmanagedType.LPWStr)] public readonly string coni1_username;
  45. /// <summary>String that specifies either the share name of the server's shared resource or the computername of the client. The value of this member depends on which name was specified as the qualifier parameter to the NetConnectionEnum function.</summary>
  46. [MarshalAs(UnmanagedType.LPWStr)] public readonly string oni1_netname;
  47. }
  48. }
  49. }