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.

356 lines
6.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 2000
  5. //
  6. // File: H N C U T I L . H
  7. //
  8. // Contents: Home Networking Configuration Utility Routines
  9. //
  10. // Notes:
  11. //
  12. // Author: jonburs 13 June 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #define HTONS(s) ((UCHAR)((s) >> 8) | ((UCHAR)(s) << 8))
  16. #define HTONL(l) ((HTONS(l) << 16) | HTONS((l) >> 16))
  17. #define NTOHS(s) HTONS(s)
  18. #define NTOHL(l) HTONL(l)
  19. BOOLEAN
  20. ApplicationProtocolExists(
  21. IWbemServices *piwsNamespace,
  22. BSTR bstrWQL,
  23. USHORT usOutgoingPort,
  24. UCHAR ucOutgoingIPProtocol
  25. );
  26. HRESULT
  27. HrFromLastWin32Error();
  28. HRESULT
  29. BuildAndString(
  30. LPWSTR *ppwsz,
  31. LPCWSTR pwszLeft,
  32. LPCWSTR pwszRight
  33. );
  34. HRESULT
  35. BuildAssociatorsQueryBstr(
  36. BSTR *pBstr,
  37. LPCWSTR pwszObjectPath,
  38. LPCWSTR pwszAssocClass
  39. );
  40. HRESULT
  41. BuildEqualsString(
  42. LPWSTR *ppwsz,
  43. LPCWSTR pwszLeft,
  44. LPCWSTR pwszRight
  45. );
  46. HRESULT
  47. BuildEscapedQuotedEqualsString(
  48. LPWSTR *ppwsz,
  49. LPCWSTR pwszLeft,
  50. LPCWSTR pwszRight
  51. );
  52. HRESULT
  53. BuildQuotedEqualsString(
  54. LPWSTR *ppwsz,
  55. LPCWSTR pwszLeft,
  56. LPCWSTR pwszRight
  57. );
  58. HRESULT
  59. BuildReferencesQueryBstr(
  60. BSTR *pBstr,
  61. LPCWSTR pwszObjectPath,
  62. LPCWSTR pwszTargetClass
  63. );
  64. HRESULT
  65. BuildSelectQueryBstr(
  66. BSTR *pBstr,
  67. LPCWSTR pwszProperties,
  68. LPCWSTR pwszFromClause,
  69. LPCWSTR pwszWhereClause
  70. );
  71. BOOLEAN
  72. ConnectionIsBoundToTcp(
  73. PIP_INTERFACE_INFO pIpInfoTable,
  74. GUID *pConnectionGuid
  75. );
  76. HRESULT
  77. ConvertResponseRangeArrayToInstanceSafearray(
  78. IWbemServices *piwsNamespace,
  79. USHORT uscResponses,
  80. HNET_RESPONSE_RANGE rgResponses[],
  81. SAFEARRAY **ppsa
  82. );
  83. HRESULT
  84. CopyResponseInstanceToStruct(
  85. IWbemClassObject *pwcoInstance,
  86. HNET_RESPONSE_RANGE *pResponse
  87. );
  88. HRESULT
  89. CopyStructToResponseInstance(
  90. HNET_RESPONSE_RANGE *pResponse,
  91. IWbemClassObject *pwcoInstance
  92. );
  93. HRESULT
  94. DeleteWmiInstance(
  95. IWbemServices *piwsNamespace,
  96. IWbemClassObject *pwcoInstance
  97. );
  98. LPWSTR
  99. EscapeString(
  100. LPCWSTR wsz
  101. );
  102. HRESULT
  103. InitializeNetCfgForWrite(
  104. OUT INetCfg **ppnetcfg,
  105. OUT INetCfgLock **ppncfglock
  106. );
  107. void
  108. UninitializeNetCfgForWrite(
  109. IN INetCfg *pnetcfg,
  110. IN INetCfgLock *pncfglock
  111. );
  112. HRESULT
  113. FindAdapterByGUID(
  114. IN INetCfg *pnetcfg,
  115. IN GUID *pguid,
  116. OUT INetCfgComponent **ppncfgcomp
  117. );
  118. HRESULT
  119. BindOnlyToBridge(
  120. IN INetCfgComponent *pnetcfgcomp
  121. );
  122. HRESULT
  123. FindINetConnectionByGuid(
  124. GUID *pGuid,
  125. INetConnection **ppNetCon
  126. );
  127. HRESULT
  128. GetBridgeConnection(
  129. IN IWbemServices *piwsHomenet,
  130. OUT IHNetBridge **pphnetBridge
  131. );
  132. HRESULT
  133. GetIHNetConnectionForNetCfgComponent(
  134. IN IWbemServices *piwsHomenet,
  135. IN INetCfgComponent *pnetcfgcomp,
  136. IN BOOLEAN fLanConnection,
  137. IN REFIID iid,
  138. OUT PVOID *ppv
  139. );
  140. HRESULT
  141. GetBooleanValue(
  142. IWbemClassObject *pwcoInstance,
  143. LPCWSTR pwszProperty,
  144. BOOLEAN *pfBoolean
  145. );
  146. HRESULT
  147. GetConnectionInstanceByGuid(
  148. IWbemServices *piwsNamespace,
  149. BSTR bstrWQL,
  150. GUID *pGuid,
  151. IWbemClassObject **ppwcoConnection
  152. );
  153. HRESULT
  154. GetConnAndPropInstancesByGuid(
  155. IWbemServices *piwsNamespace,
  156. GUID *pGuid,
  157. IWbemClassObject **ppwcoConnection,
  158. IWbemClassObject **ppwcoProperties
  159. );
  160. HRESULT
  161. GetConnAndPropInstancesForHNC(
  162. IWbemServices *piwsNamespace,
  163. IHNetConnection *pConn,
  164. IWbemClassObject **ppwcoConnection,
  165. IWbemClassObject **ppwcoProperties
  166. );
  167. HRESULT
  168. GetPhonebookPathFromRasNetcon(
  169. INetConnection *pConn,
  170. LPWSTR *ppwstr
  171. );
  172. HRESULT
  173. GetPortMappingBindingInstance(
  174. IWbemServices *piwsNamespace,
  175. BSTR bstrWQL,
  176. BSTR bstrConnectionPath,
  177. BSTR bstrProtocolPath,
  178. USHORT usPublicPort,
  179. IWbemClassObject **ppInstance
  180. );
  181. HRESULT
  182. GetPropInstanceFromConnInstance(
  183. IWbemServices *piwsNamespace,
  184. IWbemClassObject *pwcoConnection,
  185. IWbemClassObject **ppwcoProperties
  186. );
  187. HRESULT
  188. GetWmiObjectFromPath(
  189. IWbemServices *piwsNamespace,
  190. BSTR bstrPath,
  191. IWbemClassObject **pwcoInstance
  192. );
  193. HRESULT
  194. GetWmiPathFromObject(
  195. IWbemClassObject *pwcoInstance,
  196. BSTR *pbstrPath
  197. );
  198. HRESULT
  199. MapGuidStringToAdapterIndex(
  200. LPCWSTR pwszGuid,
  201. ULONG *pulIndex
  202. );
  203. HRESULT
  204. HostAddrToIpPsz(
  205. DWORD dwIPAddress,
  206. LPWSTR* ppszwNewStr
  207. );
  208. DWORD
  209. IpPszToHostAddr(
  210. LPCWSTR cp
  211. );
  212. BOOLEAN
  213. IsRoutingProtocolInstalled(
  214. ULONG ulProtocolId
  215. );
  216. BOOLEAN
  217. IsServiceRunning(
  218. LPCWSTR pwszServiceName
  219. );
  220. HRESULT
  221. OpenRegKey(
  222. PHANDLE Key,
  223. ACCESS_MASK DesiredAccess,
  224. PCWSTR Name
  225. );
  226. BOOLEAN
  227. PortMappingProtocolExists(
  228. IWbemServices *piwsNamespace,
  229. BSTR bstrWQL,
  230. USHORT usPort,
  231. UCHAR ucIPProtocol
  232. );
  233. HRESULT
  234. QueryRegValueKey(
  235. HANDLE Key,
  236. const WCHAR ValueName[],
  237. PKEY_VALUE_PARTIAL_INFORMATION* Information
  238. );
  239. HRESULT
  240. ReadDhcpScopeSettings(
  241. DWORD *pdwScopeAddress,
  242. DWORD *pdwScopeMask
  243. );
  244. HRESULT
  245. RetrieveSingleInstance(
  246. IWbemServices *piwsNamespace,
  247. const OLECHAR *pwszClass,
  248. BOOLEAN fCreate,
  249. IWbemClassObject **ppwcoInstance
  250. );
  251. HRESULT
  252. SetBooleanValue(
  253. IWbemClassObject *pwcoInstance,
  254. LPCWSTR pwszProperty,
  255. BOOLEAN fBoolean
  256. );
  257. VOID
  258. SetProxyBlanket(
  259. IUnknown *pUnk
  260. );
  261. HRESULT
  262. SpawnNewInstance(
  263. IWbemServices *piwsNamespace,
  264. LPCWSTR wszClass,
  265. IWbemClassObject **ppwcoInstance
  266. );
  267. DWORD
  268. StartOrUpdateService(
  269. VOID
  270. );
  271. VOID
  272. StopService(
  273. VOID
  274. );
  275. HRESULT
  276. UpdateOrStopService(
  277. IWbemServices *piwsNamespace,
  278. BSTR bstrWQL,
  279. DWORD dwControlCode
  280. );
  281. VOID
  282. UpdateService(
  283. DWORD dwControlCode
  284. );
  285. VOID
  286. ValidateFinishedWCOEnum(
  287. IWbemServices *piwsNamespace,
  288. IEnumWbemClassObject *pwcoEnum
  289. );
  290. HRESULT
  291. SendPortMappingListChangeNotification();
  292. HRESULT
  293. SignalModifiedConnection(
  294. GUID *pGUID
  295. );
  296. HRESULT
  297. SignalNewConnection(
  298. GUID *pGUID
  299. );
  300. HRESULT
  301. SignalDeletedConnection(
  302. GUID *pGUID
  303. );