Source code of Windows XP (NT5)
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.

156 lines
3.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: C O M P D E F S . H
  7. //
  8. // Contents: Basic component related defintions.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 15 Jan 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "netcfgx.h"
  17. // Maximum length (arbitrary) for bind strings.
  18. // Bind strings are of the form \Device\foo_bar_...
  19. //
  20. const UINT _MAX_BIND_LENGTH = 512;
  21. // A property of a component is its "Class". This corresponds directly
  22. // to the concept of Class exposed by SetupAPI. That is, devices of all
  23. // kinds belong to a class. There are five basic network classes:
  24. // Net : network adapters or software drivers that usually reside
  25. // at layer 2 or below.
  26. // Irda : represent Infra-red networking devices (layer 2)
  27. // Nettrans : network transports (protocols like TCP/IP, IPX, etc.)
  28. // Netservice : network services (File & Print, QOS, NetBIOS, etc.)
  29. // Netclient : network clients (Client for Microsoft Networks, etc.)
  30. //
  31. enum NETCLASS
  32. {
  33. NC_NET,
  34. NC_INFRARED,
  35. NC_NETTRANS,
  36. NC_NETCLIENT,
  37. NC_NETSERVICE,
  38. NC_CELEMS, // count of elements in this enum, not an item
  39. NC_INVALID // sentinel value for an invalid class, not an item
  40. };
  41. // map of NETCLASS enum to GUIDs for class
  42. //
  43. extern const GUID* MAP_NETCLASS_TO_GUID[];
  44. // map of NETCLASS enum to registry subkey strings for class
  45. //
  46. extern const PCWSTR MAP_NETCLASS_TO_NETWORK_SUBTREE[];
  47. extern const WCHAR c_szTempNetcfgStorageForUninstalledEnumeratedComponent[];
  48. inline
  49. BOOL
  50. FIsValidNetClass (
  51. NETCLASS Class)
  52. {
  53. return ((UINT)Class < NC_CELEMS);
  54. }
  55. inline
  56. BOOL
  57. FIsConsideredNetClass (
  58. NETCLASS Class)
  59. {
  60. AssertH (FIsValidNetClass (Class));
  61. return (NC_NET == Class || NC_INFRARED == Class);
  62. }
  63. inline
  64. BOOL
  65. FIsEnumerated (
  66. NETCLASS Class)
  67. {
  68. AssertH (FIsValidNetClass (Class));
  69. // Currently, NC_NET and NC_INFRARED must be enumerated and they
  70. // are the only ones that are.
  71. //
  72. return (NC_NET == Class || NC_INFRARED == Class);
  73. }
  74. inline
  75. BOOL
  76. FIsEnumerated (
  77. const GUID& guidClass)
  78. {
  79. // Currently, NET and INFRARED must be enumerated and they
  80. // are the only ones that are.
  81. //
  82. return (GUID_DEVCLASS_NET == guidClass ||
  83. GUID_DEVCLASS_INFRARED == guidClass);
  84. }
  85. inline
  86. BOOL
  87. FIsPhysicalAdapter (
  88. NETCLASS Class,
  89. DWORD dwCharacteristics)
  90. {
  91. return FIsConsideredNetClass(Class) && (NCF_PHYSICAL & dwCharacteristics);
  92. }
  93. inline
  94. BOOL
  95. FIsPhysicalNetAdapter (
  96. NETCLASS Class,
  97. DWORD dwCharacteristics)
  98. {
  99. return (NC_NET == Class) && (NCF_PHYSICAL & dwCharacteristics);
  100. }
  101. NETCLASS
  102. NetClassEnumFromGuid (
  103. const GUID& guidClass);
  104. // BASIC_COMPONENT_DATA is a structure used by code which
  105. // creates a CComponent. It is present just to avoid passing
  106. // bunches of parameters to a function.
  107. //
  108. struct BASIC_COMPONENT_DATA
  109. {
  110. GUID InstanceGuid;
  111. NETCLASS Class;
  112. DWORD dwCharacter;
  113. DWORD dwDeipFlags;
  114. PCWSTR pszInfId;
  115. PCWSTR pszPnpId;
  116. };
  117. HRESULT
  118. HrOpenDeviceInfo (
  119. IN NETCLASS Class,
  120. IN PCWSTR pszPnpId,
  121. OUT HDEVINFO* phdiOut,
  122. OUT SP_DEVINFO_DATA* pdeidOut);
  123. HRESULT
  124. HrOpenComponentInstanceKey (
  125. IN NETCLASS Class,
  126. IN const GUID& InstanceGuid, OPTIONAL
  127. IN PCWSTR pszPnpId, OPTIONAL
  128. IN REGSAM samDesired,
  129. OUT HKEY* phkey,
  130. OUT HDEVINFO* phdiOut OPTIONAL,
  131. OUT SP_DEVINFO_DATA* pdeidOut OPTIONAL);